@magic-xpa/angular 4.800.0-dev480.20 → 4.800.0-dev480.203
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 +1377 -2646
- 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 +41 -249
- 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 +10 -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 +603 -1880
- 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 +15 -208
- 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,128 +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
|
-
* Returns the title (tooltip) text of the control
|
|
2903
|
-
* @param controlId Id of control
|
|
2904
|
-
* @param rowId Id of row, if applicable
|
|
2905
|
-
* @returns
|
|
2906
|
-
*/
|
|
2907
|
-
// mgGetTitle for zoom button
|
|
2908
2309
|
getZoomButtonTitle(controlId, rowId) {
|
|
2909
2310
|
return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
|
|
2910
2311
|
}
|
|
2911
|
-
/**
|
|
2912
|
-
* Gets the selection control's selected value
|
|
2913
|
-
* @param controlId Id of control
|
|
2914
|
-
* @param rowId Id of row, if applicable
|
|
2915
|
-
* @returns
|
|
2916
|
-
*/
|
|
2917
|
-
// getSelectedValue
|
|
2918
2312
|
getSelectedValue(controlId, rowId) {
|
|
2919
2313
|
return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
|
|
2920
2314
|
}
|
|
2921
|
-
/**
|
|
2922
|
-
* Gets the place-holder text of the control
|
|
2923
|
-
* @param controlId Id of control
|
|
2924
|
-
* @param rowId Id of row, if applicable
|
|
2925
|
-
* @returns
|
|
2926
|
-
*/
|
|
2927
|
-
// mgGetPlaceholder
|
|
2928
2315
|
getPlaceholder(controlId, rowId) {
|
|
2929
2316
|
return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
|
|
2930
2317
|
}
|
|
2931
|
-
/**
|
|
2932
|
-
* Returns a type for input controls - should the control be a simple text or a password control
|
|
2933
|
-
* @param controlId Id of control
|
|
2934
|
-
* @param rowId Id of row, if applicable
|
|
2935
|
-
* @returns
|
|
2936
|
-
*/
|
|
2937
|
-
// mgGetType
|
|
2938
2318
|
getType(controlId, rowId) {
|
|
2939
2319
|
let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
|
|
2940
2320
|
return result ? "password" : "text";
|
|
2941
2321
|
}
|
|
2942
|
-
/**
|
|
2943
|
-
* Returns the tab-index of the control
|
|
2944
|
-
* @param controlId Id of control
|
|
2945
|
-
* @param rowId Id of row, if applicable
|
|
2946
|
-
* @returns
|
|
2947
|
-
*/
|
|
2948
|
-
// mgGetTabIndex
|
|
2949
2322
|
getTabIndex(controlId, rowId) {
|
|
2950
2323
|
return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
|
|
2951
2324
|
}
|
|
2952
|
-
/**
|
|
2953
|
-
* Returns the value of the control
|
|
2954
|
-
* @param controlId Id of control
|
|
2955
|
-
* @param rowId Id of row, if applicable
|
|
2956
|
-
* @returns
|
|
2957
|
-
*/
|
|
2958
|
-
/// mgGetValue -->
|
|
2959
2325
|
getValue(controlId, rowId) {
|
|
2960
2326
|
let val = this.task.getValue(controlId, rowId);
|
|
2961
2327
|
return val;
|
|
2962
2328
|
}
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
*/
|
|
2969
|
-
/// getPicture -->
|
|
2329
|
+
getFormattedValue(controlId, rowId) {
|
|
2330
|
+
let val = this.task.getValue(controlId, rowId);
|
|
2331
|
+
val = this.task.getFormattedValue(controlId, val);
|
|
2332
|
+
return val;
|
|
2333
|
+
}
|
|
2970
2334
|
getPicture(controlId, rowId) {
|
|
2971
2335
|
if (isNullOrUndefined(controlId))
|
|
2972
2336
|
return null;
|
|
2973
2337
|
let pic = this.task.GetControlPictureMask(controlId);
|
|
2974
2338
|
return (pic != null) ? pic.getFormat().toString() : null;
|
|
2975
2339
|
}
|
|
2976
|
-
/**
|
|
2977
|
-
* Returns the custom (user) properties of the control
|
|
2978
|
-
* @param controlId Id of control
|
|
2979
|
-
* @param propertyName Name of requested property
|
|
2980
|
-
* @param rowId Id of row, if applicable
|
|
2981
|
-
* @returns
|
|
2982
|
-
*/
|
|
2983
|
-
// mgGetCustomProperty
|
|
2984
2340
|
getCustomProperty(controlId, propertyNameOrRowID, rowId) {
|
|
2985
2341
|
if (controlId.indexOf('~') == -1)
|
|
2986
2342
|
return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
|
|
@@ -3005,22 +2361,21 @@ class AccessorMagicService {
|
|
|
3005
2361
|
}
|
|
3006
2362
|
return userProperties;
|
|
3007
2363
|
}
|
|
3008
|
-
/**
|
|
3009
|
-
* Gets the values of the items of a selection control
|
|
3010
|
-
* @param id Id of control
|
|
3011
|
-
* @param rowId Id of row, if applicable
|
|
3012
|
-
* @returns
|
|
3013
|
-
*/
|
|
3014
|
-
// mgGetItemListValues
|
|
3015
2364
|
getItemListValues(id, rowId) {
|
|
3016
2365
|
return this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
3017
2366
|
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
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
|
+
}
|
|
3024
2379
|
getDisplayValue(id, rowId) {
|
|
3025
2380
|
let displayValue = "";
|
|
3026
2381
|
let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
@@ -3029,12 +2384,6 @@ class AccessorMagicService {
|
|
|
3029
2384
|
displayValue = o[value].displayValue;
|
|
3030
2385
|
return displayValue;
|
|
3031
2386
|
}
|
|
3032
|
-
/**
|
|
3033
|
-
* Returns whether a tab page is selected or not
|
|
3034
|
-
* @param index of current option in iterarotr
|
|
3035
|
-
* @param control Id of list control
|
|
3036
|
-
* @returns
|
|
3037
|
-
*/ // isOptionSelected
|
|
3038
2387
|
isOptionSelected(index, controlId) {
|
|
3039
2388
|
let val = this.task.getValue(controlId, "0");
|
|
3040
2389
|
for (let item of val) {
|
|
@@ -3043,40 +2392,18 @@ class AccessorMagicService {
|
|
|
3043
2392
|
}
|
|
3044
2393
|
return false;
|
|
3045
2394
|
}
|
|
3046
|
-
/**
|
|
3047
|
-
* Returns whether a tab page is selected or not - used for the tab buttons
|
|
3048
|
-
* @param controlId Id of control
|
|
3049
|
-
* @param layer Id of the tab page
|
|
3050
|
-
* @returns
|
|
3051
|
-
*/ // mgIsTabPageSelected
|
|
3052
2395
|
isTabPageSelected(controlId, layer) {
|
|
3053
2396
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
|
|
3054
|
-
return val == (layer - 1);
|
|
3055
|
-
}
|
|
3056
|
-
/**
|
|
3057
|
-
* Returns whether a tab page layer is selected or not - used for the div which represents the tab page
|
|
3058
|
-
* @param controlId Id of control
|
|
3059
|
-
* @param layer Id of the tab page
|
|
3060
|
-
* @returns
|
|
3061
|
-
*/ // mgIsTabLayerSelected
|
|
2397
|
+
return val == (layer - 1);
|
|
2398
|
+
}
|
|
3062
2399
|
isTabPageLayerSelected(controlId, layer) {
|
|
3063
2400
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
|
|
3064
|
-
return val == (layer - 1);
|
|
2401
|
+
return val == (layer - 1);
|
|
3065
2402
|
}
|
|
3066
|
-
/**
|
|
3067
|
-
* Returns the index of the selected tab page
|
|
3068
|
-
* @param controlId Id of control
|
|
3069
|
-
* @returns
|
|
3070
|
-
*/
|
|
3071
2403
|
getTabSelectedIndex(controlId) {
|
|
3072
2404
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
|
|
3073
|
-
return val;
|
|
2405
|
+
return val;
|
|
3074
2406
|
}
|
|
3075
|
-
// private methodes
|
|
3076
|
-
/**
|
|
3077
|
-
* @ignore
|
|
3078
|
-
*/
|
|
3079
|
-
// mgIfRowCreated
|
|
3080
2407
|
ifRowCreated(row) {
|
|
3081
2408
|
if (row == null)
|
|
3082
2409
|
return false;
|
|
@@ -3084,48 +2411,25 @@ class AccessorMagicService {
|
|
|
3084
2411
|
let result = this.getFormGroupByRow(rowId);
|
|
3085
2412
|
return !isNullOrUndefined(result);
|
|
3086
2413
|
}
|
|
3087
|
-
/**
|
|
3088
|
-
* @ignore
|
|
3089
|
-
*/
|
|
3090
|
-
// mgGetFormGroupByRow
|
|
3091
2414
|
getFormGroupByRow(id) {
|
|
3092
2415
|
return this.task.formGroups[id];
|
|
3093
2416
|
}
|
|
3094
|
-
/**
|
|
3095
|
-
* @ignore
|
|
3096
|
-
*/
|
|
3097
|
-
// isRowSelected (not changed)
|
|
3098
2417
|
isRowSelected(controlId, rowId) {
|
|
3099
2418
|
const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
|
|
3100
2419
|
return selectedRow == rowId;
|
|
3101
2420
|
}
|
|
3102
|
-
/**
|
|
3103
|
-
* Returns whether a row is in edit state
|
|
3104
|
-
* @param row
|
|
3105
|
-
*/
|
|
3106
2421
|
isRowInRowEditing(row) {
|
|
3107
2422
|
let guiRowId = '0';
|
|
3108
2423
|
guiRowId = typeof row == "number" ? row.toString() : row.rowId;
|
|
3109
2424
|
return this.task.isRowInRowEditing(guiRowId);
|
|
3110
2425
|
}
|
|
3111
|
-
/**
|
|
3112
|
-
* Returns whether a row is in edit state, use this method while control outside table control
|
|
3113
|
-
* @param row
|
|
3114
|
-
*/
|
|
3115
2426
|
isCurrentInRowEditing() {
|
|
3116
2427
|
let row = this.task.tableService.getSelectedRow();
|
|
3117
2428
|
return this.task.isRowInRowEditing(row);
|
|
3118
2429
|
}
|
|
3119
|
-
/**
|
|
3120
|
-
* @ignore
|
|
3121
|
-
*/
|
|
3122
|
-
// GetGuiTopIndex
|
|
3123
2430
|
guiTopIndex() {
|
|
3124
2431
|
return this.task.tableService.getTableTopIndex();
|
|
3125
2432
|
}
|
|
3126
|
-
/**
|
|
3127
|
-
* @ignore
|
|
3128
|
-
*/
|
|
3129
2433
|
getErrMsg(id, rowId) {
|
|
3130
2434
|
let c = this.task.getFormControl(rowId, id);
|
|
3131
2435
|
if (c.hasError('required'))
|
|
@@ -3147,12 +2451,6 @@ class AccessorMagicService {
|
|
|
3147
2451
|
}
|
|
3148
2452
|
return 'unknown error';
|
|
3149
2453
|
}
|
|
3150
|
-
/**
|
|
3151
|
-
* Sets a user-supplied value to the specified control
|
|
3152
|
-
* @param controlName
|
|
3153
|
-
* @param value
|
|
3154
|
-
* @param refreshDisplay
|
|
3155
|
-
*/
|
|
3156
2454
|
setValueToControl(controlName, value, refreshDisplay) {
|
|
3157
2455
|
if (typeof refreshDisplay === "undefined")
|
|
3158
2456
|
refreshDisplay = true;
|
|
@@ -3161,44 +2459,28 @@ class AccessorMagicService {
|
|
|
3161
2459
|
guiEvent.param = refreshDisplay;
|
|
3162
2460
|
this.task.insertEvent(guiEvent);
|
|
3163
2461
|
}
|
|
3164
|
-
/**
|
|
3165
|
-
* @ignore
|
|
3166
|
-
*/
|
|
3167
2462
|
isDataviewEmpty() {
|
|
3168
2463
|
return this.task.Records.isEmptyDataView;
|
|
3169
2464
|
}
|
|
3170
|
-
/**
|
|
3171
|
-
* simulates a click event on the specified control, for the Magic engine
|
|
3172
|
-
* @param controlName
|
|
3173
|
-
* @param rowId
|
|
3174
|
-
*/
|
|
3175
2465
|
simulateClick(controlName, rowId) {
|
|
3176
2466
|
if (typeof rowId === "undefined")
|
|
3177
2467
|
rowId = 0;
|
|
3178
2468
|
this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
|
|
3179
2469
|
}
|
|
3180
|
-
/**
|
|
3181
|
-
* Return Boolean TRUE if user logged in Else it will return FALSE
|
|
3182
|
-
*/
|
|
3183
2470
|
isLoggedIn() {
|
|
3184
2471
|
return this.task.getIsLoggenIn();
|
|
3185
2472
|
}
|
|
3186
|
-
/**
|
|
3187
|
-
* Returns JS object containing the records with all table fields.
|
|
3188
|
-
*/
|
|
3189
2473
|
GetFormRecords() {
|
|
3190
2474
|
let rowId = 0;
|
|
3191
2475
|
let recArray;
|
|
3192
2476
|
if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
|
|
3193
2477
|
let recList = this.task.Records.list;
|
|
3194
2478
|
let tableControls = new Array();
|
|
3195
|
-
//Generate list of table fields names
|
|
3196
2479
|
for (const key in this.task.template) {
|
|
3197
2480
|
if (this.task.template[key] == '1')
|
|
3198
2481
|
tableControls.push(key);
|
|
3199
2482
|
}
|
|
3200
2483
|
recArray = new Array();
|
|
3201
|
-
//Update the records as list of objects with values for table fields.
|
|
3202
2484
|
if (tableControls.length > 0) {
|
|
3203
2485
|
recList.forEach((ctrlMetaData) => {
|
|
3204
2486
|
if (this.task.Records.isRowCreated(rowId)) {
|
|
@@ -3214,20 +2496,23 @@ class AccessorMagicService {
|
|
|
3214
2496
|
}
|
|
3215
2497
|
return recArray;
|
|
3216
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
|
+
}
|
|
3217
2508
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
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, [{
|
|
3221
2512
|
type: Injectable
|
|
3222
2513
|
}], function () { return [{ type: TaskMagicService }]; }, null); })();
|
|
3223
2514
|
|
|
3224
|
-
/**
|
|
3225
|
-
* Central place for adding the Magic services
|
|
3226
|
-
*/
|
|
3227
2515
|
class MagicServices {
|
|
3228
|
-
/**
|
|
3229
|
-
* @ignore
|
|
3230
|
-
*/
|
|
3231
2516
|
constructor(task, subformService, tableService, titleService, mgAccessorService) {
|
|
3232
2517
|
this.task = task;
|
|
3233
2518
|
this.subformService = subformService;
|
|
@@ -3240,74 +2525,36 @@ class MagicServices {
|
|
|
3240
2525
|
task.mgAccessorService = mgAccessorService;
|
|
3241
2526
|
}
|
|
3242
2527
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
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, [{
|
|
3246
2531
|
type: Injectable
|
|
3247
2532
|
}], function () { return [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }]; }, null); })();
|
|
3248
2533
|
|
|
3249
|
-
/**
|
|
3250
|
-
* Base component representing a Magic task
|
|
3251
|
-
*/
|
|
3252
2534
|
class TaskBaseMagicComponent {
|
|
3253
|
-
/**
|
|
3254
|
-
*
|
|
3255
|
-
* @param ref changes-detector object
|
|
3256
|
-
* @param magicServices Access point for all Magic services
|
|
3257
|
-
*/
|
|
3258
2535
|
constructor(ref, magicServices) {
|
|
3259
2536
|
this.ref = ref;
|
|
3260
2537
|
this.magicServices = magicServices;
|
|
3261
|
-
/**
|
|
3262
|
-
* @ignore
|
|
3263
|
-
*/
|
|
3264
2538
|
this.magicProperties = MagicProperties;
|
|
3265
2539
|
}
|
|
3266
|
-
/**
|
|
3267
|
-
* Returns the Magic task service
|
|
3268
|
-
* @returns
|
|
3269
|
-
*/
|
|
3270
2540
|
get task() {
|
|
3271
2541
|
return this.magicServices.task;
|
|
3272
2542
|
}
|
|
3273
|
-
/**
|
|
3274
|
-
* Returns the Magic subform service
|
|
3275
|
-
* @returns
|
|
3276
|
-
*/
|
|
3277
2543
|
get mgSub() {
|
|
3278
2544
|
return this.magicServices.subformService;
|
|
3279
2545
|
}
|
|
3280
|
-
/**
|
|
3281
|
-
* Returns the Magic table service
|
|
3282
|
-
* @returns
|
|
3283
|
-
*/
|
|
3284
2546
|
get tableService() {
|
|
3285
2547
|
return this.magicServices.tableService;
|
|
3286
2548
|
}
|
|
3287
|
-
/**
|
|
3288
|
-
* Returns the Magic accessor service
|
|
3289
|
-
* @returns
|
|
3290
|
-
*/
|
|
3291
2549
|
get mg() {
|
|
3292
2550
|
return this.magicServices.mgAccessorService;
|
|
3293
2551
|
}
|
|
3294
|
-
/**
|
|
3295
|
-
* Returns the task Id
|
|
3296
|
-
* @returns
|
|
3297
|
-
*/
|
|
3298
2552
|
get taskId() {
|
|
3299
2553
|
return this.task.taskId;
|
|
3300
2554
|
}
|
|
3301
|
-
/**
|
|
3302
|
-
* Returns the FormGroup for screen-mode forms
|
|
3303
|
-
* @returns
|
|
3304
|
-
*/
|
|
3305
2555
|
get screenFormGroup() {
|
|
3306
2556
|
return this.task.ScreenModeControls;
|
|
3307
2557
|
}
|
|
3308
|
-
/**
|
|
3309
|
-
* Interface implementation
|
|
3310
|
-
*/
|
|
3311
2558
|
ngOnInit() {
|
|
3312
2559
|
let subscription = this.task.detectChanges.pipe().subscribe(c => {
|
|
3313
2560
|
this.ref.detectChanges();
|
|
@@ -3315,48 +2562,19 @@ class TaskBaseMagicComponent {
|
|
|
3315
2562
|
this.task.initTask(this.taskIdParam, this.taskDescription);
|
|
3316
2563
|
this.createFormControlsAccessor(this.screenFormGroup);
|
|
3317
2564
|
this.setInputDateFormat();
|
|
3318
|
-
// subcribe to custom property changes
|
|
3319
2565
|
this.task.customPropertiesSubject.pipe().subscribe(property => {
|
|
3320
2566
|
this.PropertyChanged(property.propertyName, property.rowId, property.value);
|
|
3321
2567
|
});
|
|
3322
|
-
// subcribe to records count changes
|
|
3323
2568
|
this.task.recordsCountChangeSubject.pipe().subscribe(value => {
|
|
3324
2569
|
this.RecordsCountChanged(value);
|
|
3325
2570
|
});
|
|
3326
2571
|
}
|
|
3327
|
-
/**
|
|
3328
|
-
* @ignore
|
|
3329
|
-
*/
|
|
3330
2572
|
createFormControlsAccessor(formGroup) { }
|
|
3331
|
-
/**
|
|
3332
|
-
* @ignore
|
|
3333
|
-
*/
|
|
3334
2573
|
setInputDateFormat() { }
|
|
3335
|
-
/**
|
|
3336
|
-
* This method is called when the value of any custom property is updated in Magic
|
|
3337
|
-
* propertyName : name of property which is updated. The format is <controlname>~<propertyname>
|
|
3338
|
-
* rowId : row number of the updated property for controls in table control (0 for controls outside table)
|
|
3339
|
-
* value : updated value of the property
|
|
3340
|
-
* @returns : void
|
|
3341
|
-
* To use the method override it in your component and check the property name and write you code ..for eg
|
|
3342
|
-
* if(propertyName == 'controlname~propertyName') {// your code}
|
|
3343
|
-
* else { // your code}
|
|
3344
|
-
*/
|
|
3345
2574
|
PropertyChanged(propertyName, rowId, value) {
|
|
3346
|
-
|
|
3347
|
-
}
|
|
3348
|
-
/**
|
|
3349
|
-
* Records count change subject is subscribed to change in its value. This method will be called
|
|
3350
|
-
* as the value of records count is received at from server.
|
|
3351
|
-
* @returns : void
|
|
3352
|
-
* To use the method override it in your component.
|
|
3353
|
-
*/
|
|
2575
|
+
}
|
|
3354
2576
|
RecordsCountChanged(recordsCount) {
|
|
3355
|
-
// intentionally left blank because the implementation should be in the derived class
|
|
3356
2577
|
}
|
|
3357
|
-
/**
|
|
3358
|
-
* Interface implementation
|
|
3359
|
-
*/
|
|
3360
2578
|
ngAfterViewInit() {
|
|
3361
2579
|
this.mgSub.init();
|
|
3362
2580
|
}
|
|
@@ -3366,16 +2584,13 @@ class TaskBaseMagicComponent {
|
|
|
3366
2584
|
this.task.oldPageSize = this.tableService.getPageSize();
|
|
3367
2585
|
}
|
|
3368
2586
|
}
|
|
3369
|
-
/**
|
|
3370
|
-
* Interface implementation
|
|
3371
|
-
*/
|
|
3372
2587
|
ngOnDestroy() {
|
|
3373
2588
|
this.task.dispose();
|
|
3374
2589
|
}
|
|
3375
2590
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
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, [{
|
|
3379
2594
|
type: Component,
|
|
3380
2595
|
args: [{
|
|
3381
2596
|
selector: 'task-magic',
|
|
@@ -3388,22 +2603,13 @@ class TaskBaseMagicComponent {
|
|
|
3388
2603
|
type: Input
|
|
3389
2604
|
}] }); })();
|
|
3390
2605
|
|
|
3391
|
-
/**
|
|
3392
|
-
* @ignore
|
|
3393
|
-
*/
|
|
3394
2606
|
class RowMagicDirective {
|
|
3395
2607
|
constructor(_task, element) {
|
|
3396
2608
|
this._task = _task;
|
|
3397
2609
|
this.element = element;
|
|
3398
|
-
/**
|
|
3399
|
-
* @ignore
|
|
3400
|
-
*/
|
|
3401
2610
|
this.rowChangedSubscriber = null;
|
|
3402
2611
|
this.htmlElement = this.element.nativeElement;
|
|
3403
2612
|
}
|
|
3404
|
-
/**
|
|
3405
|
-
* Initializes this object
|
|
3406
|
-
*/
|
|
3407
2613
|
ngOnInit() {
|
|
3408
2614
|
this.rowChangedSubscriber = this._task
|
|
3409
2615
|
.OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
|
|
@@ -3418,16 +2624,7 @@ class RowMagicDirective {
|
|
|
3418
2624
|
return (rect.top >= parentRect.top &&
|
|
3419
2625
|
rect.bottom <= parentRect.bottom);
|
|
3420
2626
|
}
|
|
3421
|
-
/**
|
|
3422
|
-
* Cleanup
|
|
3423
|
-
*/
|
|
3424
2627
|
ngOnDestroy() {
|
|
3425
|
-
// Don't know why, but when the table is loaded for the first time, we
|
|
3426
|
-
// get ngOnInit() for the 1st row (rowId = "0") and then ngOnDestroy()
|
|
3427
|
-
// for number of rows in the page but here this.rowId is undefined.
|
|
3428
|
-
// Since ngOnInit() was not called for all these rows, this.rowChangedSubscriber
|
|
3429
|
-
// is null and hence crashes.
|
|
3430
|
-
// So, the condition to check nulity is added.
|
|
3431
2628
|
if (this.rowChangedSubscriber !== null) {
|
|
3432
2629
|
this.rowChangedSubscriber.unsubscribe();
|
|
3433
2630
|
}
|
|
@@ -3439,11 +2636,11 @@ class RowMagicDirective {
|
|
|
3439
2636
|
}
|
|
3440
2637
|
}
|
|
3441
2638
|
}
|
|
3442
|
-
|
|
3443
|
-
|
|
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) {
|
|
3444
2641
|
ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
|
|
3445
2642
|
} }, inputs: { rowId: ["magicRow", "rowId"] } });
|
|
3446
|
-
|
|
2643
|
+
(function () { ɵsetClassMetadata(RowMagicDirective, [{
|
|
3447
2644
|
type: Directive,
|
|
3448
2645
|
args: [{
|
|
3449
2646
|
selector: '[magicRow]'
|
|
@@ -3456,35 +2653,16 @@ class RowMagicDirective {
|
|
|
3456
2653
|
args: ['click', ['$event']]
|
|
3457
2654
|
}] }); })();
|
|
3458
2655
|
|
|
3459
|
-
/**
|
|
3460
|
-
* Connects HTML elements to the Magic Web Client engine
|
|
3461
|
-
*/
|
|
3462
2656
|
class MagicDirective {
|
|
3463
|
-
/**
|
|
3464
|
-
*
|
|
3465
|
-
* @param _task The task service
|
|
3466
|
-
* @param element The element for which the directive is applied
|
|
3467
|
-
* @param renderer Renderer for the element
|
|
3468
|
-
* @param vcRef
|
|
3469
|
-
* @param magicRow
|
|
3470
|
-
*/
|
|
3471
2657
|
constructor(_task, element, renderer, vcRef, magicRow) {
|
|
3472
2658
|
this._task = _task;
|
|
3473
2659
|
this.element = element;
|
|
3474
2660
|
this.renderer = renderer;
|
|
3475
2661
|
this.vcRef = vcRef;
|
|
3476
2662
|
this.magicRow = magicRow;
|
|
3477
|
-
/**
|
|
3478
|
-
* Collection of event handlers for this element
|
|
3479
|
-
*/
|
|
3480
2663
|
this.eventHandlers = {};
|
|
3481
2664
|
this.eventsOnlyVal = false;
|
|
3482
2665
|
this.htmlElement = this.element.nativeElement;
|
|
3483
|
-
//let c = (<any>this.vcRef)._view;
|
|
3484
|
-
//while (!(c instanceof TaskBaseMagicComponent)) {
|
|
3485
|
-
// c = c.component;
|
|
3486
|
-
//}
|
|
3487
|
-
//this.component = c;
|
|
3488
2666
|
if (!(typeof magicRow === 'undefined' || magicRow === null))
|
|
3489
2667
|
this.rowId = magicRow.rowId;
|
|
3490
2668
|
}
|
|
@@ -3493,40 +2671,28 @@ class MagicDirective {
|
|
|
3493
2671
|
this.selector = 'magic';
|
|
3494
2672
|
}
|
|
3495
2673
|
;
|
|
3496
|
-
/**
|
|
3497
|
-
* This flag is used when we only want to register to events, but do not want to execute commands sent from server
|
|
3498
|
-
*/
|
|
3499
2674
|
set eventsOnly(val) {
|
|
3500
2675
|
console.log('eventsOnly');
|
|
3501
2676
|
this.eventsOnlyVal = true;
|
|
3502
2677
|
}
|
|
3503
2678
|
;
|
|
3504
|
-
/**
|
|
3505
|
-
* Get the task service
|
|
3506
|
-
* @returns
|
|
3507
|
-
*/
|
|
3508
2679
|
get task() {
|
|
3509
2680
|
return this._task;
|
|
3510
2681
|
}
|
|
3511
|
-
/**
|
|
3512
|
-
* Register to the events this element may need to handle
|
|
3513
|
-
*/
|
|
3514
2682
|
regEvents() {
|
|
3515
|
-
// Handle events for which event handler may be removed and restored
|
|
3516
2683
|
this.eventHandlers['focusin'] = this.OnFocus.bind(this);
|
|
3517
2684
|
Object.keys(this.eventHandlers).forEach((key) => {
|
|
3518
2685
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
|
3519
2686
|
});
|
|
3520
|
-
|
|
3521
|
-
let events = ['click', 'mousedown', 'dblclick']; // ,'resize', 'load', 'unload'
|
|
2687
|
+
let events = ['click', 'mousedown', 'dblclick'];
|
|
3522
2688
|
events.forEach(event => {
|
|
3523
2689
|
this.renderer.listen(this.htmlElement, event, (e) => {
|
|
3524
|
-
// check if the event is fired from zoom button ( to identify the connected zoom button in engine)
|
|
3525
2690
|
let fromButton = false;
|
|
3526
2691
|
if (this.htmlElement instanceof HTMLButtonElement)
|
|
3527
2692
|
fromButton = true;
|
|
3528
2693
|
this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
|
|
3529
|
-
|
|
2694
|
+
if (!MagicDirective.opened)
|
|
2695
|
+
e.cancelBubble = true;
|
|
3530
2696
|
});
|
|
3531
2697
|
});
|
|
3532
2698
|
this.renderer.listen(this.htmlElement, 'change', (e) => {
|
|
@@ -3537,13 +2703,10 @@ class MagicDirective {
|
|
|
3537
2703
|
this.task.insertEvent(guiEvent);
|
|
3538
2704
|
}
|
|
3539
2705
|
});
|
|
3540
|
-
// handle the input event
|
|
3541
2706
|
fromEvent(this.htmlElement, 'input').pipe(map((event) => {
|
|
3542
2707
|
return event.target.value;
|
|
3543
|
-
}), debounceTime(200)
|
|
3544
|
-
).subscribe((x) => {
|
|
2708
|
+
}), debounceTime(200)).subscribe((x) => {
|
|
3545
2709
|
if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
|
|
3546
|
-
// Don't support character binding for date/time values
|
|
3547
2710
|
let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
|
|
3548
2711
|
if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
|
|
3549
2712
|
this.task.mgAccessorService.setValueToControl(this.id, x, true);
|
|
@@ -3569,25 +2732,16 @@ class MagicDirective {
|
|
|
3569
2732
|
(e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
|
|
3570
2733
|
if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
|
|
3571
2734
|
guiEvent.keyCode = e.keyCode;
|
|
3572
|
-
// Defect 160021 fixed - don't set e.cancelBubble when combobox is opened and esc key is pressed
|
|
3573
2735
|
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && !MagicDirective.opened)
|
|
3574
2736
|
e.cancelBubble = true;
|
|
3575
2737
|
this.task.insertEvent(guiEvent);
|
|
3576
2738
|
}
|
|
3577
2739
|
});
|
|
3578
2740
|
}
|
|
3579
|
-
/**
|
|
3580
|
-
* Handle focus event
|
|
3581
|
-
*/
|
|
3582
2741
|
OnFocus() {
|
|
3583
2742
|
this.task.insertEvent(getGuiEventObj('focus', this.id, +this.rowId));
|
|
3584
2743
|
event.cancelBubble = true;
|
|
3585
2744
|
}
|
|
3586
|
-
/**
|
|
3587
|
-
* Is the command's element the same as this directive's element
|
|
3588
|
-
* @param command
|
|
3589
|
-
* @returns true/false
|
|
3590
|
-
*/
|
|
3591
2745
|
IsSameElement(command) {
|
|
3592
2746
|
let line = command.line;
|
|
3593
2747
|
if (this.task.isTableControl(command.CtrlName))
|
|
@@ -3596,17 +2750,9 @@ class MagicDirective {
|
|
|
3596
2750
|
(line === +this.rowId ||
|
|
3597
2751
|
(line === 0 && isNullOrUndefined(this.rowId))));
|
|
3598
2752
|
}
|
|
3599
|
-
/**
|
|
3600
|
-
* Is the command's element the same as this directive's component
|
|
3601
|
-
* @param command
|
|
3602
|
-
* @returns true/false
|
|
3603
|
-
*/
|
|
3604
2753
|
IsSameComponent(command) {
|
|
3605
2754
|
return (command.controlName === this.id);
|
|
3606
2755
|
}
|
|
3607
|
-
/**
|
|
3608
|
-
* @ignore
|
|
3609
|
-
*/
|
|
3610
2756
|
regUpdatesUI() {
|
|
3611
2757
|
this.subscribeRefreshDom = this.task
|
|
3612
2758
|
.refreshDom.pipe(filter(c => this.IsSameElement(c)))
|
|
@@ -3628,17 +2774,10 @@ class MagicDirective {
|
|
|
3628
2774
|
this.handleInteractiveCommands(command);
|
|
3629
2775
|
});
|
|
3630
2776
|
}
|
|
3631
|
-
/**
|
|
3632
|
-
* Initializes this object
|
|
3633
|
-
*/
|
|
3634
2777
|
ngOnInit() {
|
|
3635
2778
|
this.regEvents();
|
|
3636
2779
|
this.regUpdatesUI();
|
|
3637
2780
|
}
|
|
3638
|
-
/**
|
|
3639
|
-
* Handles the commands received from the Magic WebClient engine
|
|
3640
|
-
* @param command
|
|
3641
|
-
*/
|
|
3642
2781
|
handleCommand(command) {
|
|
3643
2782
|
switch (command.CommandType) {
|
|
3644
2783
|
case CommandType.SET_PROPERTY:
|
|
@@ -3646,16 +2785,12 @@ class MagicDirective {
|
|
|
3646
2785
|
break;
|
|
3647
2786
|
case CommandType.SET_FOCUS:
|
|
3648
2787
|
this.focusUnlistener();
|
|
3649
|
-
// Do not set focus on connected zoom button
|
|
3650
2788
|
if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
|
|
3651
2789
|
this.htmlElement.focus();
|
|
3652
2790
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, 'focusin', this.eventHandlers['focusin']);
|
|
3653
2791
|
break;
|
|
3654
2792
|
}
|
|
3655
2793
|
}
|
|
3656
|
-
/**
|
|
3657
|
-
* handle the interactive commands like CallJS
|
|
3658
|
-
*/
|
|
3659
2794
|
handleInteractiveCommands(command) {
|
|
3660
2795
|
switch (command._commandType) {
|
|
3661
2796
|
case InteractiveCommandType.CALL_JS:
|
|
@@ -3665,24 +2800,18 @@ class MagicDirective {
|
|
|
3665
2800
|
let resultString = '';
|
|
3666
2801
|
try {
|
|
3667
2802
|
if (!isNullOrUndefined(magicComponent[methodName])) {
|
|
3668
|
-
// invoke the method on instance of magic componenet
|
|
3669
2803
|
resultString = magicComponent[methodName].apply(magicComponent, args);
|
|
3670
2804
|
}
|
|
3671
2805
|
else
|
|
3672
|
-
console.error('Instance method ' + methodName + ' does not exists');
|
|
2806
|
+
console.error('Instance method ' + methodName + ' does not exists');
|
|
3673
2807
|
}
|
|
3674
2808
|
catch (e) {
|
|
3675
|
-
// any other exception
|
|
3676
2809
|
console.error(e.message);
|
|
3677
2810
|
}
|
|
3678
|
-
command.resultString = resultString;
|
|
2811
|
+
command.resultString = resultString;
|
|
3679
2812
|
break;
|
|
3680
2813
|
}
|
|
3681
2814
|
}
|
|
3682
|
-
/**
|
|
3683
|
-
* Handle the Magic set-property command
|
|
3684
|
-
* @param command
|
|
3685
|
-
*/
|
|
3686
2815
|
handleSetProperty(command) {
|
|
3687
2816
|
switch (command.Operation) {
|
|
3688
2817
|
case HtmlProperties.ReadOnly:
|
|
@@ -3693,17 +2822,14 @@ class MagicDirective {
|
|
|
3693
2822
|
break;
|
|
3694
2823
|
}
|
|
3695
2824
|
}
|
|
3696
|
-
/**
|
|
3697
|
-
* Cleanup
|
|
3698
|
-
*/
|
|
3699
2825
|
ngOnDestroy() {
|
|
3700
2826
|
this.subscribeRefreshDom.unsubscribe();
|
|
3701
2827
|
}
|
|
3702
2828
|
}
|
|
3703
2829
|
MagicDirective.opened = false;
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
2830
|
+
MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
|
2831
|
+
MagicDirective.ɵdir = ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
|
|
2832
|
+
(function () { ɵsetClassMetadata(MagicDirective, [{
|
|
3707
2833
|
type: Directive,
|
|
3708
2834
|
args: [{
|
|
3709
2835
|
selector: '[magic]'
|
|
@@ -3720,9 +2846,6 @@ MagicDirective.opened = false;
|
|
|
3720
2846
|
type: Input
|
|
3721
2847
|
}] }); })();
|
|
3722
2848
|
|
|
3723
|
-
/**
|
|
3724
|
-
* @ignore
|
|
3725
|
-
*/
|
|
3726
2849
|
class NoControlMagicDirective extends MagicDirective {
|
|
3727
2850
|
constructor(_task, element, renderer, vcRef, magicRow) {
|
|
3728
2851
|
super(_task, element, renderer, vcRef, magicRow);
|
|
@@ -3757,12 +2880,10 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3757
2880
|
}
|
|
3758
2881
|
}
|
|
3759
2882
|
}
|
|
3760
|
-
// is the div a tab control
|
|
3761
2883
|
isTabControl() {
|
|
3762
2884
|
return this.htmlElement instanceof HTMLDivElement &&
|
|
3763
2885
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
|
|
3764
2886
|
}
|
|
3765
|
-
// is the div a radio buttons wrapper
|
|
3766
2887
|
isRadio() {
|
|
3767
2888
|
return this.htmlElement instanceof HTMLDivElement &&
|
|
3768
2889
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
|
|
@@ -3771,7 +2892,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3771
2892
|
super.handleCommand(command);
|
|
3772
2893
|
switch (command.CommandType) {
|
|
3773
2894
|
case CommandType.SET_CLASS:
|
|
3774
|
-
//remove the class which was replaced by this new one, as registered in the ControlMetadata
|
|
3775
2895
|
const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
|
|
3776
2896
|
if (controlMetadata.removedClass != '') {
|
|
3777
2897
|
this.htmlElement.classList.remove(controlMetadata.removedClass);
|
|
@@ -3784,7 +2904,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3784
2904
|
this.htmlElement.innerText = command.value;
|
|
3785
2905
|
if (this.htmlElement instanceof HTMLSelectElement)
|
|
3786
2906
|
this.htmlElement.value = command.value;
|
|
3787
|
-
if (this.htmlElement instanceof HTMLAnchorElement)
|
|
2907
|
+
if (this.htmlElement instanceof HTMLAnchorElement)
|
|
3788
2908
|
this.htmlElement.text = command.value;
|
|
3789
2909
|
if (this.htmlElement instanceof HTMLInputElement) {
|
|
3790
2910
|
if (this.htmlElement.type === "checkbox") {
|
|
@@ -3808,7 +2928,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3808
2928
|
break;
|
|
3809
2929
|
}
|
|
3810
2930
|
}
|
|
3811
|
-
// handle set-property commands
|
|
3812
2931
|
handleSetProperty(command) {
|
|
3813
2932
|
super.handleSetProperty(command);
|
|
3814
2933
|
switch (command.Operation) {
|
|
@@ -3824,7 +2943,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3824
2943
|
break;
|
|
3825
2944
|
case HtmlProperties.ItemsList:
|
|
3826
2945
|
if (this.htmlElement instanceof HTMLSelectElement) {
|
|
3827
|
-
// clear the list
|
|
3828
2946
|
var len = this.htmlElement.length;
|
|
3829
2947
|
for (var i = len - 1; i >= 0; i--) {
|
|
3830
2948
|
this.htmlElement.remove(i);
|
|
@@ -3866,8 +2984,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3866
2984
|
let child = tabControl.children[i];
|
|
3867
2985
|
const layer = child.getAttribute('layer') - 1;
|
|
3868
2986
|
if (child instanceof HTMLButtonElement) {
|
|
3869
|
-
|
|
3870
|
-
if (layer == command.obj1) { // compare int to string
|
|
2987
|
+
if (layer == command.obj1) {
|
|
3871
2988
|
child.classList.add('tab_button_active');
|
|
3872
2989
|
}
|
|
3873
2990
|
else {
|
|
@@ -3875,7 +2992,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3875
2992
|
}
|
|
3876
2993
|
}
|
|
3877
2994
|
else {
|
|
3878
|
-
// not a buton - hide unselected tabpages
|
|
3879
2995
|
let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
|
|
3880
2996
|
child.setAttribute('style', style);
|
|
3881
2997
|
}
|
|
@@ -3897,9 +3013,9 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3897
3013
|
}
|
|
3898
3014
|
}
|
|
3899
3015
|
}
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3016
|
+
NoControlMagicDirective.ɵfac = function NoControlMagicDirective_Factory(t) { return new (t || NoControlMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
|
3017
|
+
NoControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: ["magicnc", "magic"] }, features: [ɵɵInheritDefinitionFeature] });
|
|
3018
|
+
(function () { ɵsetClassMetadata(NoControlMagicDirective, [{
|
|
3903
3019
|
type: Directive,
|
|
3904
3020
|
args: [{
|
|
3905
3021
|
selector: '[magicnc]'
|
|
@@ -3911,127 +3027,9 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3911
3027
|
args: ['magicnc']
|
|
3912
3028
|
}] }); })();
|
|
3913
3029
|
|
|
3914
|
-
/**
|
|
3915
|
-
* Mock component, implements routing by connecting the requested URL with the appropriate Magic task
|
|
3916
|
-
*/
|
|
3917
|
-
class RouterContainerMagicComponent {
|
|
3918
|
-
/**
|
|
3919
|
-
*
|
|
3920
|
-
* @param changeDetectorRef
|
|
3921
|
-
* @param activatedRoute
|
|
3922
|
-
* @param magic
|
|
3923
|
-
* @param componentFactoryResolver
|
|
3924
|
-
* @param viewContainerRef
|
|
3925
|
-
* @param componentList
|
|
3926
|
-
* @param pendingCommandsCollector
|
|
3927
|
-
*/
|
|
3928
|
-
constructor(activatedRoute, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
|
|
3929
|
-
this.activatedRoute = activatedRoute;
|
|
3930
|
-
this.magic = magic;
|
|
3931
|
-
this.containerTaskService = containerTaskService;
|
|
3932
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
3933
|
-
this.viewContainerRef = viewContainerRef;
|
|
3934
|
-
this.componentList = componentList;
|
|
3935
|
-
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
3936
|
-
this.routerCommandsMagicService = routerCommandsMagicService;
|
|
3937
|
-
this.componentRef = null;
|
|
3938
|
-
this.parentMgSubformService = null;
|
|
3939
|
-
}
|
|
3940
|
-
/**
|
|
3941
|
-
* Initialization
|
|
3942
|
-
*/
|
|
3943
|
-
ngOnInit() {
|
|
3944
|
-
let outletname = this.activatedRoute.outlet;
|
|
3945
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
3946
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
3947
|
-
if (subformMagicService == null || subformMagicService.currentRouteDefinition === null) {
|
|
3948
|
-
this.insertRouteEvent(currentActiveRoute);
|
|
3949
|
-
SubformMagicService.routerContainers.push(this);
|
|
3950
|
-
}
|
|
3951
|
-
else {
|
|
3952
|
-
this.initializeComponent();
|
|
3953
|
-
}
|
|
3954
|
-
}
|
|
3955
|
-
insertRouteEvent(currentActiveRoute) {
|
|
3956
|
-
let guiEvent = getGuiEventObj('RouterNavigate', null, 0);
|
|
3957
|
-
guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
|
|
3958
|
-
if (currentActiveRoute.snapshot.outlet !== 'primary')
|
|
3959
|
-
guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
|
|
3960
|
-
// if this is LoadOnDemandModuleMagicComponent it's mean that this is load on demand module and we
|
|
3961
|
-
// need to take the path form routeConfig.path
|
|
3962
|
-
let calcRouterPath = currentActiveRoute.routeConfig.path;
|
|
3963
|
-
// add the RouterPath only if exist
|
|
3964
|
-
if (calcRouterPath.length > 0) {
|
|
3965
|
-
let routerPath = calcRouterPath;
|
|
3966
|
-
let tokens = StrUtil.tokenize(routerPath, "/:");
|
|
3967
|
-
guiEvent.RouterPath = tokens[0];
|
|
3968
|
-
guiEvent.RouterParams = new List();
|
|
3969
|
-
for (let i = 1; i < tokens.length; i++) {
|
|
3970
|
-
guiEvent.RouterParams.push(this.activatedRoute.snapshot.params[tokens[i]]);
|
|
3971
|
-
}
|
|
3972
|
-
}
|
|
3973
|
-
this.containerTaskService.insertEvent(guiEvent);
|
|
3974
|
-
}
|
|
3975
|
-
initializeComponent() {
|
|
3976
|
-
// re-init subformMagicService since it may change after executing "RouterNavigate" event.
|
|
3977
|
-
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
|
3978
|
-
if (subformMagicService.currentRouteDefinition !== null) {
|
|
3979
|
-
let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
|
|
3980
|
-
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
|
3981
|
-
this.componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
3982
|
-
Object.assign(this.componentRef.instance, subformMagicService.currentRouteDefinition.parameters);
|
|
3983
|
-
let myActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
3984
|
-
let routeParams = StrUtil.tokenize(myActiveRoute.snapshot.routeConfig.path, "/:");
|
|
3985
|
-
subformMagicService.routesDict[myActiveRoute.snapshot.outlet] = routeParams[0];
|
|
3986
|
-
this.parentMgSubformService = subformMagicService;
|
|
3987
|
-
subformMagicService.currentRouteDefinition = null;
|
|
3988
|
-
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
|
3989
|
-
//When the component is initialized, then also we get the notification for paramMap subscription.
|
|
3990
|
-
//But in this case, we do not have to raise the event, because magic engine itself has initiated the route with the same parameters.
|
|
3991
|
-
//So, control it via ignoreParamChange flag.
|
|
3992
|
-
let ignoreParamChange = true;
|
|
3993
|
-
myActiveRoute.paramMap.subscribe(params => {
|
|
3994
|
-
if (!ignoreParamChange)
|
|
3995
|
-
this.insertRouteEvent(myActiveRoute);
|
|
3996
|
-
ignoreParamChange = false;
|
|
3997
|
-
});
|
|
3998
|
-
this.parentMgSubformService.refreshView();
|
|
3999
|
-
this.routerCommandsMagicService.ExecuteNextCommand();
|
|
4000
|
-
}
|
|
4001
|
-
}
|
|
4002
|
-
/**
|
|
4003
|
-
* Cleanup
|
|
4004
|
-
*/
|
|
4005
|
-
ngOnDestroy() {
|
|
4006
|
-
// TODO Routing: Call close() only if the task is not already closed.
|
|
4007
|
-
// Task can be closed when a router is overlayed by another task via call operation.
|
|
4008
|
-
if (this.componentRef != null) {
|
|
4009
|
-
this.componentRef.instance.task.close();
|
|
4010
|
-
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
|
4011
|
-
this.parentMgSubformService.routesDict[currentActiveRoute.outlet] = "";
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
/** @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)); };
|
|
4016
|
-
/** @nocollapse */ RouterContainerMagicComponent.ɵcmp = ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
4017
|
-
/*@__PURE__*/ (function () { ɵsetClassMetadata(RouterContainerMagicComponent, [{
|
|
4018
|
-
type: Component,
|
|
4019
|
-
args: [{
|
|
4020
|
-
selector: 'magic-route-outlet',
|
|
4021
|
-
template: `
|
|
4022
|
-
`
|
|
4023
|
-
}]
|
|
4024
|
-
}], function () { return [{ type: ActivatedRoute }, { type: EngineMagicService }, { type: TaskMagicService }, { type: ComponentFactoryResolver }, { type: ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }]; }, null); })();
|
|
4025
|
-
|
|
4026
|
-
/**
|
|
4027
|
-
* @ignore
|
|
4028
|
-
*/
|
|
4029
3030
|
class Constants {
|
|
4030
3031
|
}
|
|
4031
3032
|
Constants.DATE_FMT = 'dd/MMM/yyyy';
|
|
4032
|
-
/**
|
|
4033
|
-
* @ignore
|
|
4034
|
-
*/
|
|
4035
3033
|
class DateMagicPipe extends DatePipe {
|
|
4036
3034
|
constructor(_task) {
|
|
4037
3035
|
super('en-US');
|
|
@@ -4043,7 +3041,6 @@ class DateMagicPipe extends DatePipe {
|
|
|
4043
3041
|
let mgDateFormatter = new MgDateFormatter();
|
|
4044
3042
|
if (!isNullOrUndefined(value) && mask !== null) {
|
|
4045
3043
|
formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
|
|
4046
|
-
// If control is label control of table, due to query mode, then save the format here.
|
|
4047
3044
|
if (formatStr != null && this._task.isTableControl(controlId)) {
|
|
4048
3045
|
if (this._task.mgInputDateFormat == null)
|
|
4049
3046
|
this._task.mgInputDateFormat = formatStr;
|
|
@@ -4057,9 +3054,9 @@ class DateMagicPipe extends DatePipe {
|
|
|
4057
3054
|
return value;
|
|
4058
3055
|
}
|
|
4059
3056
|
}
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
3057
|
+
DateMagicPipe.ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
|
|
3058
|
+
DateMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
|
|
3059
|
+
(function () { ɵsetClassMetadata(DateMagicPipe, [{
|
|
4063
3060
|
type: Pipe,
|
|
4064
3061
|
args: [{
|
|
4065
3062
|
name: 'magicDate'
|
|
@@ -4124,17 +3121,11 @@ class MgDateFormatter {
|
|
|
4124
3121
|
return formatStr.ToString();
|
|
4125
3122
|
}
|
|
4126
3123
|
else
|
|
4127
|
-
return "dd-mm-yyyy";
|
|
3124
|
+
return "dd-mm-yyyy";
|
|
4128
3125
|
}
|
|
4129
3126
|
}
|
|
4130
3127
|
|
|
4131
|
-
/**
|
|
4132
|
-
* Perform Magic validation on input controls which hold alphanumeric strings
|
|
4133
|
-
*/
|
|
4134
3128
|
class MgformatMagicDirective {
|
|
4135
|
-
/**
|
|
4136
|
-
* @ignore
|
|
4137
|
-
*/
|
|
4138
3129
|
constructor(magicDir, _task) {
|
|
4139
3130
|
this.magicDir = magicDir;
|
|
4140
3131
|
this._task = _task;
|
|
@@ -4142,20 +3133,12 @@ class MgformatMagicDirective {
|
|
|
4142
3133
|
ngAfterViewInit() {
|
|
4143
3134
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4144
3135
|
if (control != null && this._task.mgInputDateFormat == null) {
|
|
4145
|
-
// get the first date control's format.
|
|
4146
3136
|
let pic = this._task.GetControlPictureMask(this.magicDir.id);
|
|
4147
3137
|
if (pic.getAttr() == StorageAttribute.DATE) {
|
|
4148
3138
|
this.formatDate(pic);
|
|
4149
3139
|
}
|
|
4150
3140
|
}
|
|
4151
3141
|
}
|
|
4152
|
-
/**
|
|
4153
|
-
* @ignore
|
|
4154
|
-
*/
|
|
4155
|
-
/**
|
|
4156
|
-
* This can be used to set pattern
|
|
4157
|
-
* On input, verifies the input matches the required mask
|
|
4158
|
-
*/
|
|
4159
3142
|
onFocusEvent($event) {
|
|
4160
3143
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4161
3144
|
if (control != null) {
|
|
@@ -4180,10 +3163,6 @@ class MgformatMagicDirective {
|
|
|
4180
3163
|
}
|
|
4181
3164
|
}
|
|
4182
3165
|
}
|
|
4183
|
-
/**
|
|
4184
|
-
* @ignore
|
|
4185
|
-
*/
|
|
4186
|
-
// This can be used to implement uppercase/lower case
|
|
4187
3166
|
onChangeEvent($event) {
|
|
4188
3167
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4189
3168
|
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
|
@@ -4201,9 +3180,6 @@ class MgformatMagicDirective {
|
|
|
4201
3180
|
let mgDateFormatter = new MgDateFormatter();
|
|
4202
3181
|
this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
|
|
4203
3182
|
}
|
|
4204
|
-
/**
|
|
4205
|
-
* @ignore
|
|
4206
|
-
*/
|
|
4207
3183
|
formatAlphaUnicode(control) {
|
|
4208
3184
|
let value = control.value;
|
|
4209
3185
|
if (value !== null && value.length > 0) {
|
|
@@ -4229,9 +3205,6 @@ class MgformatMagicDirective {
|
|
|
4229
3205
|
control.setValue(valueStr.ToString());
|
|
4230
3206
|
}
|
|
4231
3207
|
}
|
|
4232
|
-
/**
|
|
4233
|
-
* @ignore
|
|
4234
|
-
*/
|
|
4235
3208
|
formatBoolean(control) {
|
|
4236
3209
|
let value = control.value;
|
|
4237
3210
|
if (value !== null && value.length > 0) {
|
|
@@ -4244,12 +3217,6 @@ class MgformatMagicDirective {
|
|
|
4244
3217
|
}
|
|
4245
3218
|
}
|
|
4246
3219
|
}
|
|
4247
|
-
/**
|
|
4248
|
-
* @ignore
|
|
4249
|
-
*/
|
|
4250
|
-
/// <summary>
|
|
4251
|
-
/// generate pattern from fld's format
|
|
4252
|
-
/// </summary>
|
|
4253
3220
|
generatePattern(attribute, pic) {
|
|
4254
3221
|
let pattern = "";
|
|
4255
3222
|
switch (attribute) {
|
|
@@ -4263,12 +3230,6 @@ class MgformatMagicDirective {
|
|
|
4263
3230
|
}
|
|
4264
3231
|
return pattern;
|
|
4265
3232
|
}
|
|
4266
|
-
/**
|
|
4267
|
-
* @ignore
|
|
4268
|
-
*/
|
|
4269
|
-
/// <summary>
|
|
4270
|
-
/// generate pattern for Alpha
|
|
4271
|
-
/// </summary>
|
|
4272
3233
|
generatePatternForNumber(pic) {
|
|
4273
3234
|
let patternStr = new StringBuilder();
|
|
4274
3235
|
patternStr.Append("^");
|
|
@@ -4281,9 +3242,6 @@ class MgformatMagicDirective {
|
|
|
4281
3242
|
patternStr.Append("$");
|
|
4282
3243
|
return patternStr.ToString();
|
|
4283
3244
|
}
|
|
4284
|
-
/**
|
|
4285
|
-
* @ignore
|
|
4286
|
-
*/
|
|
4287
3245
|
isPatternGenerationNeeded(attr, pic) {
|
|
4288
3246
|
switch (attr) {
|
|
4289
3247
|
case StorageAttribute.NUMERIC:
|
|
@@ -4293,12 +3251,6 @@ class MgformatMagicDirective {
|
|
|
4293
3251
|
return (pic.getMaskChars() > 0) ? true : false;
|
|
4294
3252
|
}
|
|
4295
3253
|
}
|
|
4296
|
-
/**
|
|
4297
|
-
* @ignore
|
|
4298
|
-
*/
|
|
4299
|
-
/// <summary>
|
|
4300
|
-
/// generate pattern for Alpha
|
|
4301
|
-
/// </summary>
|
|
4302
3254
|
generatePatternForAlpha(pic) {
|
|
4303
3255
|
let cnt = 0;
|
|
4304
3256
|
let inputAllChars = false;
|
|
@@ -4309,7 +3261,6 @@ class MgformatMagicDirective {
|
|
|
4309
3261
|
let pattern = new StringBuilder();
|
|
4310
3262
|
pattern.Append("^");
|
|
4311
3263
|
for (let i = 0; i < mask.length;) {
|
|
4312
|
-
//start new subset , if mask[i] is one of these.
|
|
4313
3264
|
if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
|
|
4314
3265
|
|| mask.charCodeAt(i) == PICInterface.PIC_X)) {
|
|
4315
3266
|
pattern.Append("(");
|
|
@@ -4355,13 +3306,9 @@ class MgformatMagicDirective {
|
|
|
4355
3306
|
pattern.Append("$");
|
|
4356
3307
|
return pattern.ToString();
|
|
4357
3308
|
}
|
|
4358
|
-
/**
|
|
4359
|
-
* @ignore
|
|
4360
|
-
*/
|
|
4361
3309
|
getDirectiveCount(mask, idx, pattern, changeInPattern) {
|
|
4362
3310
|
changeInPattern.value = false;
|
|
4363
3311
|
let patternCount = 0;
|
|
4364
|
-
// find max chars
|
|
4365
3312
|
while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
|
|
4366
3313
|
patternCount++;
|
|
4367
3314
|
idx++;
|
|
@@ -4370,9 +3317,6 @@ class MgformatMagicDirective {
|
|
|
4370
3317
|
changeInPattern.value = true;
|
|
4371
3318
|
return patternCount;
|
|
4372
3319
|
}
|
|
4373
|
-
/**
|
|
4374
|
-
* @ignore
|
|
4375
|
-
*/
|
|
4376
3320
|
IsPatternMatches(mask, pattern) {
|
|
4377
3321
|
for (let i = 0; i < pattern.length; i++)
|
|
4378
3322
|
if (mask == pattern[i])
|
|
@@ -4380,11 +3324,11 @@ class MgformatMagicDirective {
|
|
|
4380
3324
|
return false;
|
|
4381
3325
|
}
|
|
4382
3326
|
}
|
|
4383
|
-
|
|
4384
|
-
|
|
3327
|
+
MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(ɵɵdirectiveInject(MagicDirective), ɵɵdirectiveInject(TaskMagicService)); };
|
|
3328
|
+
MgformatMagicDirective.ɵdir = ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4385
3329
|
ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
|
|
4386
3330
|
} } });
|
|
4387
|
-
|
|
3331
|
+
(function () { ɵsetClassMetadata(MgformatMagicDirective, [{
|
|
4388
3332
|
type: Directive,
|
|
4389
3333
|
args: [{
|
|
4390
3334
|
selector: '[mgFormat]'
|
|
@@ -4397,9 +3341,6 @@ class MgformatMagicDirective {
|
|
|
4397
3341
|
args: ['change', ['$event']]
|
|
4398
3342
|
}] }); })();
|
|
4399
3343
|
|
|
4400
|
-
/**
|
|
4401
|
-
* @ignore
|
|
4402
|
-
*/
|
|
4403
3344
|
class TimeMagicPipe extends DatePipe {
|
|
4404
3345
|
constructor(_task) {
|
|
4405
3346
|
super('en-US');
|
|
@@ -4435,33 +3376,20 @@ class TimeMagicPipe extends DatePipe {
|
|
|
4435
3376
|
return value;
|
|
4436
3377
|
}
|
|
4437
3378
|
}
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
3379
|
+
TimeMagicPipe.ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
|
|
3380
|
+
TimeMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
|
|
3381
|
+
(function () { ɵsetClassMetadata(TimeMagicPipe, [{
|
|
4441
3382
|
type: Pipe,
|
|
4442
3383
|
args: [{
|
|
4443
3384
|
name: 'magicTime'
|
|
4444
3385
|
}]
|
|
4445
3386
|
}], function () { return [{ type: TaskMagicService }]; }, null); })();
|
|
4446
3387
|
|
|
4447
|
-
/**
|
|
4448
|
-
* Validates the field range.
|
|
4449
|
-
*/
|
|
4450
3388
|
class RangeValidatorMagicDirective {
|
|
4451
|
-
/**
|
|
4452
|
-
*
|
|
4453
|
-
* @param _task The task service
|
|
4454
|
-
* @param vcRef
|
|
4455
|
-
*/
|
|
4456
3389
|
constructor(_task, vcRef) {
|
|
4457
3390
|
this._task = _task;
|
|
4458
3391
|
this.vcRef = vcRef;
|
|
4459
3392
|
}
|
|
4460
|
-
/**
|
|
4461
|
-
* Validation method
|
|
4462
|
-
* @param c FormControl to validate
|
|
4463
|
-
* @returns If validation fails, return error message, else returns null
|
|
4464
|
-
*/
|
|
4465
3393
|
validate(c) {
|
|
4466
3394
|
let controlName;
|
|
4467
3395
|
controlName = this.getControlName(c);
|
|
@@ -4483,23 +3411,20 @@ class RangeValidatorMagicDirective {
|
|
|
4483
3411
|
};
|
|
4484
3412
|
}
|
|
4485
3413
|
}
|
|
4486
|
-
/**
|
|
4487
|
-
* @ignore
|
|
4488
|
-
*/
|
|
4489
3414
|
getControlName(c) {
|
|
4490
3415
|
const formGroup = c.parent.controls;
|
|
4491
3416
|
return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
|
|
4492
3417
|
}
|
|
4493
3418
|
}
|
|
4494
|
-
|
|
4495
|
-
|
|
3419
|
+
RangeValidatorMagicDirective.ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ViewContainerRef)); };
|
|
3420
|
+
RangeValidatorMagicDirective.ɵdir = ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [ɵɵProvidersFeature([
|
|
4496
3421
|
{
|
|
4497
3422
|
provide: NG_VALIDATORS,
|
|
4498
3423
|
useExisting: RangeValidatorMagicDirective,
|
|
4499
3424
|
multi: true,
|
|
4500
3425
|
}
|
|
4501
3426
|
])] });
|
|
4502
|
-
|
|
3427
|
+
(function () { ɵsetClassMetadata(RangeValidatorMagicDirective, [{
|
|
4503
3428
|
type: Directive,
|
|
4504
3429
|
args: [{
|
|
4505
3430
|
selector: '[rangevalidator] ',
|
|
@@ -4519,48 +3444,29 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
4519
3444
|
const ctx_r0 = ɵɵnextContext();
|
|
4520
3445
|
ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
|
|
4521
3446
|
} }
|
|
4522
|
-
/**
|
|
4523
|
-
* Represents a Magic subform
|
|
4524
|
-
*/
|
|
4525
3447
|
class SubformMagicComponent {
|
|
4526
|
-
/**
|
|
4527
|
-
* @ignore
|
|
4528
|
-
*/
|
|
4529
3448
|
constructor(vcRef, mgSub) {
|
|
4530
3449
|
this.vcRef = vcRef;
|
|
4531
3450
|
this.mgSub = mgSub;
|
|
4532
|
-
/**
|
|
4533
|
-
* @ignore
|
|
4534
|
-
*/
|
|
4535
3451
|
this.component = null;
|
|
4536
|
-
// For angular 10 - find the component from views
|
|
4537
3452
|
this.component = (this.vcRef._hostView).find(v => !isNullOrUndefined(v));
|
|
4538
3453
|
}
|
|
4539
|
-
/**
|
|
4540
|
-
* @ignore
|
|
4541
|
-
*/
|
|
4542
3454
|
set magic(val) { this.id = val; }
|
|
4543
3455
|
;
|
|
4544
|
-
/**
|
|
4545
|
-
* @ignore
|
|
4546
|
-
*/
|
|
4547
3456
|
get Component() {
|
|
4548
3457
|
return this.mgSub.mgGetComp(this.id);
|
|
4549
3458
|
}
|
|
4550
|
-
/**
|
|
4551
|
-
* @ignore
|
|
4552
|
-
*/
|
|
4553
3459
|
get Parameters() {
|
|
4554
3460
|
return this.mgSub.mgGetParameters(this.id);
|
|
4555
3461
|
}
|
|
4556
3462
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
3463
|
+
SubformMagicComponent.ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(SubformMagicService)); };
|
|
3464
|
+
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) {
|
|
4559
3465
|
ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
|
|
4560
3466
|
} if (rf & 2) {
|
|
4561
3467
|
ɵɵproperty("ngIf", ctx.Component);
|
|
4562
3468
|
} }, directives: [NgIf, DynamicComponent, DynamicIoDirective], encapsulation: 2 });
|
|
4563
|
-
|
|
3469
|
+
(function () { ɵsetClassMetadata(SubformMagicComponent, [{
|
|
4564
3470
|
type: Component,
|
|
4565
3471
|
args: [{
|
|
4566
3472
|
selector: 'magic-subform',
|
|
@@ -4600,24 +3506,14 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
4600
3506
|
ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
|
|
4601
3507
|
} }
|
|
4602
3508
|
const _c1$1 = ["*"];
|
|
4603
|
-
/**
|
|
4604
|
-
* Represents a Magic subform
|
|
4605
|
-
*/
|
|
4606
3509
|
class ErrorMagicComponent {
|
|
4607
|
-
/**
|
|
4608
|
-
* @ignore
|
|
4609
|
-
*/
|
|
4610
3510
|
constructor(_task, mgService, changeDetectorRef) {
|
|
4611
3511
|
this._task = _task;
|
|
4612
3512
|
this.mgService = mgService;
|
|
4613
3513
|
this.changeDetectorRef = changeDetectorRef;
|
|
4614
|
-
// if true - display standard magic error message, if false - customer has provides his own content and we'll use it
|
|
4615
3514
|
this.defaultDisplay = true;
|
|
4616
3515
|
this.rowId = "0";
|
|
4617
3516
|
}
|
|
4618
|
-
/**
|
|
4619
|
-
* @ignore
|
|
4620
|
-
*/
|
|
4621
3517
|
set magic(val) {
|
|
4622
3518
|
this.id = val;
|
|
4623
3519
|
}
|
|
@@ -4631,10 +3527,6 @@ class ErrorMagicComponent {
|
|
|
4631
3527
|
this.changeDetectorRef.detectChanges();
|
|
4632
3528
|
}
|
|
4633
3529
|
;
|
|
4634
|
-
/**
|
|
4635
|
-
* returns true if the html element has no children
|
|
4636
|
-
* @param element
|
|
4637
|
-
*/
|
|
4638
3530
|
isEmpty(element) {
|
|
4639
3531
|
const nodes = element.childNodes;
|
|
4640
3532
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -4645,9 +3537,6 @@ class ErrorMagicComponent {
|
|
|
4645
3537
|
}
|
|
4646
3538
|
return true;
|
|
4647
3539
|
}
|
|
4648
|
-
/**
|
|
4649
|
-
* @ignore
|
|
4650
|
-
*/
|
|
4651
3540
|
HasErrors(id) {
|
|
4652
3541
|
if (!isUndefined(id)) {
|
|
4653
3542
|
let control = this._task.getFormControl(this.rowId, id);
|
|
@@ -4669,8 +3558,8 @@ class ErrorMagicComponent {
|
|
|
4669
3558
|
return false;
|
|
4670
3559
|
}
|
|
4671
3560
|
}
|
|
4672
|
-
|
|
4673
|
-
|
|
3561
|
+
ErrorMagicComponent.ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(AccessorMagicService), ɵɵdirectiveInject(ChangeDetectorRef)); };
|
|
3562
|
+
ErrorMagicComponent.ɵcmp = ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
|
|
4674
3563
|
ɵɵviewQuery(_c0$2, true);
|
|
4675
3564
|
} if (rf & 2) {
|
|
4676
3565
|
var _t;
|
|
@@ -4681,7 +3570,7 @@ class ErrorMagicComponent {
|
|
|
4681
3570
|
} if (rf & 2) {
|
|
4682
3571
|
ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
|
|
4683
3572
|
} }, directives: [NgIf], encapsulation: 2 });
|
|
4684
|
-
|
|
3573
|
+
(function () { ɵsetClassMetadata(ErrorMagicComponent, [{
|
|
4685
3574
|
type: Component,
|
|
4686
3575
|
args: [{
|
|
4687
3576
|
selector: 'mgError',
|
|
@@ -4706,28 +3595,19 @@ class ErrorMagicComponent {
|
|
|
4706
3595
|
args: ['customContent', { static: false }]
|
|
4707
3596
|
}] }); })();
|
|
4708
3597
|
|
|
4709
|
-
/**
|
|
4710
|
-
* Directive for checkboxes, to handle the 'change' event
|
|
4711
|
-
*/
|
|
4712
3598
|
class CheckboxMagicDirective {
|
|
4713
|
-
/**
|
|
4714
|
-
* @ignore
|
|
4715
|
-
*/
|
|
4716
3599
|
constructor(magicDirective) {
|
|
4717
3600
|
this.magicDirective = magicDirective;
|
|
4718
3601
|
}
|
|
4719
|
-
/**
|
|
4720
|
-
* Handles the Checkbox 'change' event - pass it to the Magic engine
|
|
4721
|
-
*/
|
|
4722
3602
|
onChange($event) {
|
|
4723
3603
|
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
4724
3604
|
}
|
|
4725
3605
|
}
|
|
4726
|
-
|
|
4727
|
-
|
|
3606
|
+
CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3607
|
+
CheckboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4728
3608
|
ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
4729
3609
|
} } });
|
|
4730
|
-
|
|
3610
|
+
(function () { ɵsetClassMetadata(CheckboxMagicDirective, [{
|
|
4731
3611
|
type: Directive,
|
|
4732
3612
|
args: [{
|
|
4733
3613
|
selector: `
|
|
@@ -4739,25 +3619,19 @@ class CheckboxMagicDirective {
|
|
|
4739
3619
|
args: ['change', ['$event']]
|
|
4740
3620
|
}] }); })();
|
|
4741
3621
|
|
|
4742
|
-
/**
|
|
4743
|
-
* Directive for comboboxes, to handle the 'change' event
|
|
4744
|
-
*/
|
|
4745
3622
|
class ComboboxMagicDirective {
|
|
4746
3623
|
constructor(magicDirective) {
|
|
4747
3624
|
this.magicDirective = magicDirective;
|
|
4748
3625
|
}
|
|
4749
|
-
/**
|
|
4750
|
-
* Handles the Combobox 'change' event - pass it to the Magic engine
|
|
4751
|
-
*/
|
|
4752
3626
|
onChange($event) {
|
|
4753
3627
|
this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
4754
3628
|
}
|
|
4755
3629
|
}
|
|
4756
|
-
|
|
4757
|
-
|
|
3630
|
+
ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3631
|
+
ComboboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4758
3632
|
ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
4759
3633
|
} } });
|
|
4760
|
-
|
|
3634
|
+
(function () { ɵsetClassMetadata(ComboboxMagicDirective, [{
|
|
4761
3635
|
type: Directive,
|
|
4762
3636
|
args: [{
|
|
4763
3637
|
selector: `select[magic]:not([multiple])`,
|
|
@@ -4767,20 +3641,14 @@ class ComboboxMagicDirective {
|
|
|
4767
3641
|
args: ['change', ['$event']]
|
|
4768
3642
|
}] }); })();
|
|
4769
3643
|
|
|
4770
|
-
/**
|
|
4771
|
-
* This service supports custom actions on magic exit
|
|
4772
|
-
*/
|
|
4773
3644
|
class ExitMagicService {
|
|
4774
|
-
/**
|
|
4775
|
-
* Override this method to implement custom logic on magic exit
|
|
4776
|
-
*/
|
|
4777
3645
|
exitMagic() {
|
|
4778
3646
|
console.log("Magic application terminated");
|
|
4779
3647
|
}
|
|
4780
3648
|
}
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
3649
|
+
ExitMagicService.ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
|
|
3650
|
+
ExitMagicService.ɵprov = ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
|
|
3651
|
+
(function () { ɵsetClassMetadata(ExitMagicService, [{
|
|
4784
3652
|
type: Injectable
|
|
4785
3653
|
}], null, null); })();
|
|
4786
3654
|
|
|
@@ -4804,19 +3672,7 @@ function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
|
4804
3672
|
function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
|
|
4805
3673
|
ɵɵelement(0, "div", 9);
|
|
4806
3674
|
} }
|
|
4807
|
-
/**
|
|
4808
|
-
* Root Magic component
|
|
4809
|
-
*/
|
|
4810
3675
|
class MagicShellComponent {
|
|
4811
|
-
/**
|
|
4812
|
-
*
|
|
4813
|
-
* @param magic Magic's service
|
|
4814
|
-
* @param componentList Magic component list
|
|
4815
|
-
* @param changeDetectorRef Changes detector
|
|
4816
|
-
* @param titleService Title setting service
|
|
4817
|
-
* @param httpClient The native httpClient instance
|
|
4818
|
-
* @param exitMagicService Magic exit service
|
|
4819
|
-
*/
|
|
4820
3676
|
constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, exitMagicService) {
|
|
4821
3677
|
this.engineMagicService = engineMagicService;
|
|
4822
3678
|
this.componentList = componentList;
|
|
@@ -4826,32 +3682,22 @@ class MagicShellComponent {
|
|
|
4826
3682
|
this.httpClient = httpClient;
|
|
4827
3683
|
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
4828
3684
|
this.exitMagicService = exitMagicService;
|
|
4829
|
-
/**
|
|
4830
|
-
* Root component to be displayed in the window
|
|
4831
|
-
*/
|
|
4832
3685
|
this.RootComponent = null;
|
|
4833
3686
|
this.magicEngineTerminated = false;
|
|
4834
3687
|
this.initialize();
|
|
4835
3688
|
this.setTitle();
|
|
4836
3689
|
}
|
|
4837
|
-
/**
|
|
4838
|
-
* Before-unload event listener
|
|
4839
|
-
* @param event
|
|
4840
|
-
*/
|
|
4841
3690
|
onBeforeUnload(event) {
|
|
4842
3691
|
if (this.engineMagicService.TransCacheExists()) {
|
|
4843
|
-
// Show the confirmation box before unloading the browser
|
|
4844
3692
|
event.returnValue = 'Are you sure?';
|
|
4845
3693
|
return 'Are you sure?';
|
|
4846
3694
|
}
|
|
4847
3695
|
else {
|
|
4848
|
-
// terminate the magic server context using fetch API with keep-alive
|
|
4849
3696
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
|
4850
3697
|
this.magicEngineTerminated = true;
|
|
4851
3698
|
}
|
|
4852
3699
|
}
|
|
4853
3700
|
onUnload(event) {
|
|
4854
|
-
// Chrome provides an opportunity to terminate the context after user approves the browser unload alert
|
|
4855
3701
|
if (!this.magicEngineTerminated)
|
|
4856
3702
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
|
4857
3703
|
}
|
|
@@ -4862,26 +3708,13 @@ class MagicShellComponent {
|
|
|
4862
3708
|
setViewContainerRef(vcRef) {
|
|
4863
3709
|
this.overlayWindowsContainerViewRef = vcRef;
|
|
4864
3710
|
}
|
|
4865
|
-
/**
|
|
4866
|
-
* Initialization of Magic mechanisms
|
|
4867
|
-
*/
|
|
4868
3711
|
initialize() {
|
|
4869
3712
|
this.registerUICommands();
|
|
4870
3713
|
}
|
|
4871
|
-
/**
|
|
4872
|
-
* Set the title
|
|
4873
|
-
*/
|
|
4874
3714
|
setTitle() {
|
|
4875
3715
|
const newTitle = this.componentList.title;
|
|
4876
3716
|
this.titleService.setTitle(newTitle);
|
|
4877
3717
|
}
|
|
4878
|
-
/**
|
|
4879
|
-
* Set the component according to requested form
|
|
4880
|
-
* @param formName Name of the form to open
|
|
4881
|
-
* @param taskId Id of opening task
|
|
4882
|
-
* @param taskDescription TODO
|
|
4883
|
-
* @param isModal whether modal window is being opened
|
|
4884
|
-
*/
|
|
4885
3718
|
setComponent(formName, taskId, taskDescription, isModal) {
|
|
4886
3719
|
this.pendingCommandsCollector.startCollecting();
|
|
4887
3720
|
if (isModal) {
|
|
@@ -4893,9 +3726,6 @@ class MagicShellComponent {
|
|
|
4893
3726
|
}
|
|
4894
3727
|
this.changeDetectorRef.detectChanges();
|
|
4895
3728
|
}
|
|
4896
|
-
/**
|
|
4897
|
-
* @ignore
|
|
4898
|
-
*/
|
|
4899
3729
|
registerUICommands() {
|
|
4900
3730
|
this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
|
|
4901
3731
|
.subscribe(command => {
|
|
@@ -4907,10 +3737,6 @@ class MagicShellComponent {
|
|
|
4907
3737
|
GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
|
|
4908
3738
|
});
|
|
4909
3739
|
}
|
|
4910
|
-
/**
|
|
4911
|
-
* Execute commands received from the Magic WebClient engine
|
|
4912
|
-
* @param command
|
|
4913
|
-
*/
|
|
4914
3740
|
executeCommand(command) {
|
|
4915
3741
|
switch (command.CommandType) {
|
|
4916
3742
|
case CommandType.OPEN_FORM:
|
|
@@ -4925,7 +3751,7 @@ class MagicShellComponent {
|
|
|
4925
3751
|
this.RootComponentParameters = {};
|
|
4926
3752
|
this.changeDetectorRef.detectChanges();
|
|
4927
3753
|
}
|
|
4928
|
-
else {
|
|
3754
|
+
else {
|
|
4929
3755
|
this.overlayWindowService.close(command.str);
|
|
4930
3756
|
this.changeDetectorRef.detectChanges();
|
|
4931
3757
|
}
|
|
@@ -4943,20 +3769,21 @@ class MagicShellComponent {
|
|
|
4943
3769
|
if (this.exitMagicService)
|
|
4944
3770
|
this.exitMagicService.exitMagic();
|
|
4945
3771
|
break;
|
|
3772
|
+
case CommandType.SHOW_HTML_ERROR:
|
|
3773
|
+
window.document.write(command.str);
|
|
3774
|
+
break;
|
|
4946
3775
|
}
|
|
4947
3776
|
}
|
|
4948
3777
|
}
|
|
4949
|
-
|
|
4950
|
-
|
|
3778
|
+
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)); };
|
|
3779
|
+
MagicShellComponent.ɵcmp = ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
|
|
4951
3780
|
ɵɵstaticViewQuery(_c0$3, true);
|
|
4952
3781
|
} if (rf & 2) {
|
|
4953
3782
|
var _t;
|
|
4954
3783
|
ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
|
|
4955
3784
|
} }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4956
3785
|
ɵɵ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);
|
|
4957
|
-
} }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [ɵɵProvidersFeature([
|
|
4958
|
-
// ExitMagicService
|
|
4959
|
-
])], 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) {
|
|
3786
|
+
} }, 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) {
|
|
4960
3787
|
ɵɵelementStart(0, "div", null, 0);
|
|
4961
3788
|
ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 1);
|
|
4962
3789
|
ɵɵelement(3, "div", 2, 3);
|
|
@@ -4969,13 +3796,11 @@ class MagicShellComponent {
|
|
|
4969
3796
|
ɵɵadvance(3);
|
|
4970
3797
|
ɵɵproperty("ngIf", ctx.showSpinner);
|
|
4971
3798
|
} }, 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 }"] });
|
|
4972
|
-
|
|
3799
|
+
(function () { ɵsetClassMetadata(MagicShellComponent, [{
|
|
4973
3800
|
type: Component,
|
|
4974
3801
|
args: [{
|
|
4975
3802
|
selector: 'magic-root',
|
|
4976
|
-
providers: [
|
|
4977
|
-
// ExitMagicService
|
|
4978
|
-
],
|
|
3803
|
+
providers: [],
|
|
4979
3804
|
template: `
|
|
4980
3805
|
<div #magicRoot>
|
|
4981
3806
|
<ndc-dynamic
|
|
@@ -5042,25 +3867,19 @@ class MagicShellComponent {
|
|
|
5042
3867
|
args: ['window:unload', ['$event']]
|
|
5043
3868
|
}] }); })();
|
|
5044
3869
|
|
|
5045
|
-
/**
|
|
5046
|
-
* @ignore
|
|
5047
|
-
*/
|
|
5048
3870
|
const CHECKBOX_VALUE_ACCESSOR = {
|
|
5049
3871
|
provide: NG_VALUE_ACCESSOR,
|
|
5050
3872
|
useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
|
|
5051
3873
|
multi: true,
|
|
5052
3874
|
};
|
|
5053
|
-
/**
|
|
5054
|
-
* Value accessor for Checkbox without a FormControl
|
|
5055
|
-
*/
|
|
5056
3875
|
class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
|
|
5057
3876
|
}
|
|
5058
|
-
|
|
5059
|
-
|
|
3877
|
+
MagicCheckboxControlValueAccessor.ɵfac = function MagicCheckboxControlValueAccessor_Factory(t) { return ɵMagicCheckboxControlValueAccessor_BaseFactory(t || MagicCheckboxControlValueAccessor); };
|
|
3878
|
+
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) {
|
|
5060
3879
|
ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
|
|
5061
3880
|
} }, features: [ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
|
|
5062
|
-
const ɵMagicCheckboxControlValueAccessor_BaseFactory =
|
|
5063
|
-
|
|
3881
|
+
const ɵMagicCheckboxControlValueAccessor_BaseFactory = ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor);
|
|
3882
|
+
(function () { ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
|
|
5064
3883
|
type: Directive,
|
|
5065
3884
|
args: [{
|
|
5066
3885
|
selector: `
|
|
@@ -5073,25 +3892,19 @@ const ɵMagicCheckboxControlValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInh
|
|
|
5073
3892
|
}]
|
|
5074
3893
|
}], null, null); })();
|
|
5075
3894
|
|
|
5076
|
-
/**
|
|
5077
|
-
* @ignore
|
|
5078
|
-
*/
|
|
5079
3895
|
const MAGIC_DEFAULT_VALUE_ACCESSOR = {
|
|
5080
3896
|
provide: NG_VALUE_ACCESSOR,
|
|
5081
3897
|
useExisting: forwardRef(() => MagicDefaultValueAccessor),
|
|
5082
3898
|
multi: true
|
|
5083
3899
|
};
|
|
5084
|
-
/**
|
|
5085
|
-
* @ignore
|
|
5086
|
-
*/
|
|
5087
3900
|
class MagicDefaultValueAccessor extends DefaultValueAccessor {
|
|
5088
3901
|
}
|
|
5089
|
-
|
|
5090
|
-
|
|
3902
|
+
MagicDefaultValueAccessor.ɵfac = function MagicDefaultValueAccessor_Factory(t) { return ɵMagicDefaultValueAccessor_BaseFactory(t || MagicDefaultValueAccessor); };
|
|
3903
|
+
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) {
|
|
5091
3904
|
ɵɵ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); });
|
|
5092
3905
|
} }, exportAs: ["magic"], features: [ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
|
|
5093
|
-
const ɵMagicDefaultValueAccessor_BaseFactory =
|
|
5094
|
-
|
|
3906
|
+
const ɵMagicDefaultValueAccessor_BaseFactory = ɵɵgetInheritedFactory(MagicDefaultValueAccessor);
|
|
3907
|
+
(function () { ɵsetClassMetadata(MagicDefaultValueAccessor, [{
|
|
5095
3908
|
type: Directive,
|
|
5096
3909
|
args: [{
|
|
5097
3910
|
selector: `
|
|
@@ -5109,25 +3922,19 @@ const ɵMagicDefaultValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFa
|
|
|
5109
3922
|
}]
|
|
5110
3923
|
}], null, null); })();
|
|
5111
3924
|
|
|
5112
|
-
/**
|
|
5113
|
-
* Directive for checkboxes which should not have a form control
|
|
5114
|
-
*/
|
|
5115
3925
|
class CheckboxNoFormControlMagicDirective {
|
|
5116
3926
|
constructor(magicDirective) {
|
|
5117
3927
|
this.magicDirective = magicDirective;
|
|
5118
3928
|
}
|
|
5119
|
-
/**
|
|
5120
|
-
* Handle the 'Checkbox' change event - pass it to the Magic engine
|
|
5121
|
-
*/
|
|
5122
3929
|
onChange($event) {
|
|
5123
3930
|
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
5124
3931
|
}
|
|
5125
3932
|
}
|
|
5126
|
-
|
|
5127
|
-
|
|
3933
|
+
CheckboxNoFormControlMagicDirective.ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3934
|
+
CheckboxNoFormControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
5128
3935
|
ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
5129
3936
|
} } });
|
|
5130
|
-
|
|
3937
|
+
(function () { ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
|
|
5131
3938
|
type: Directive,
|
|
5132
3939
|
args: [{
|
|
5133
3940
|
selector: `
|
|
@@ -5139,25 +3946,19 @@ class CheckboxNoFormControlMagicDirective {
|
|
|
5139
3946
|
args: ['change', ['$event']]
|
|
5140
3947
|
}] }); })();
|
|
5141
3948
|
|
|
5142
|
-
/**
|
|
5143
|
-
* Directive for non-checkbox input controls which do not have a form control
|
|
5144
|
-
*/
|
|
5145
3949
|
class InputNoFormControlMagicDirective {
|
|
5146
3950
|
constructor(magicDirective) {
|
|
5147
3951
|
this.magicDirective = magicDirective;
|
|
5148
3952
|
}
|
|
5149
|
-
/**
|
|
5150
|
-
* Handles the 'change' event - pass it to the Magic engine
|
|
5151
|
-
*/
|
|
5152
3953
|
onChange($event) {
|
|
5153
3954
|
this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
|
|
5154
3955
|
}
|
|
5155
3956
|
}
|
|
5156
|
-
|
|
5157
|
-
|
|
3957
|
+
InputNoFormControlMagicDirective.ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3958
|
+
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) {
|
|
5158
3959
|
ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
5159
3960
|
} } });
|
|
5160
|
-
|
|
3961
|
+
(function () { ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
|
|
5161
3962
|
type: Directive,
|
|
5162
3963
|
args: [{
|
|
5163
3964
|
selector: `input[magic]:([noFormControl]):not([type=checkbox]),
|
|
@@ -5173,14 +3974,6 @@ const DATE_VALUE_ACCESSOR = {
|
|
|
5173
3974
|
useExisting: forwardRef(() => DateValueAccessor),
|
|
5174
3975
|
multi: true
|
|
5175
3976
|
};
|
|
5176
|
-
/**
|
|
5177
|
-
* The accessor for writing a value and listening to changes on a date input element
|
|
5178
|
-
*
|
|
5179
|
-
* ### Example
|
|
5180
|
-
* `<input type="date" name="birthday" ngModel dateInput>`
|
|
5181
|
-
* OR
|
|
5182
|
-
* `<input type="date" formControlName="birthday" dateInput>`
|
|
5183
|
-
*/
|
|
5184
3977
|
class DateValueAccessor {
|
|
5185
3978
|
constructor(renderer, elementRef) {
|
|
5186
3979
|
this.renderer = renderer;
|
|
@@ -5188,7 +3981,6 @@ class DateValueAccessor {
|
|
|
5188
3981
|
this.onChange = (_) => { };
|
|
5189
3982
|
this.onTouched = () => { };
|
|
5190
3983
|
}
|
|
5191
|
-
/** Writes a new value to the element (model -> view) */
|
|
5192
3984
|
writeValue(value) {
|
|
5193
3985
|
if (!value) {
|
|
5194
3986
|
this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
|
|
@@ -5196,26 +3988,23 @@ class DateValueAccessor {
|
|
|
5196
3988
|
}
|
|
5197
3989
|
this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
|
|
5198
3990
|
}
|
|
5199
|
-
/** Registers a callback function, called when value changes (view -> model) */
|
|
5200
3991
|
registerOnChange(fn) {
|
|
5201
3992
|
this.onChange = v => fn(v instanceof Date
|
|
5202
3993
|
? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
|
|
5203
3994
|
: v);
|
|
5204
3995
|
}
|
|
5205
|
-
/** Registers a callback function, called when the control is blurred */
|
|
5206
3996
|
registerOnTouched(fn) {
|
|
5207
3997
|
this.onTouched = fn;
|
|
5208
3998
|
}
|
|
5209
|
-
/** Enables or disables the element when the control status changes */
|
|
5210
3999
|
setDisabledState(isDisabled) {
|
|
5211
4000
|
this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
|
|
5212
4001
|
}
|
|
5213
4002
|
}
|
|
5214
|
-
|
|
5215
|
-
|
|
4003
|
+
DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ElementRef)); };
|
|
4004
|
+
DateValueAccessor.ɵdir = ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
|
5216
4005
|
ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
|
|
5217
4006
|
} }, features: [ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
|
|
5218
|
-
|
|
4007
|
+
(function () { ɵsetClassMetadata(DateValueAccessor, [{
|
|
5219
4008
|
type: Directive,
|
|
5220
4009
|
args: [{
|
|
5221
4010
|
selector: "[dateInput]",
|
|
@@ -5229,25 +4018,12 @@ class DateValueAccessor {
|
|
|
5229
4018
|
args: ["blur", []]
|
|
5230
4019
|
}] }); })();
|
|
5231
4020
|
|
|
5232
|
-
/**
|
|
5233
|
-
* 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
|
|
5234
|
-
*/
|
|
5235
4021
|
class NonMagicControlDirective {
|
|
5236
|
-
/**
|
|
5237
|
-
*
|
|
5238
|
-
* @param _task The task service
|
|
5239
|
-
* @param element The element for which the directive is applied
|
|
5240
|
-
* @param renderer Renderer for the element
|
|
5241
|
-
* @param vcRef
|
|
5242
|
-
*/
|
|
5243
4022
|
constructor(_task, element, renderer, vcRef) {
|
|
5244
4023
|
this._task = _task;
|
|
5245
4024
|
this.element = element;
|
|
5246
4025
|
this.renderer = renderer;
|
|
5247
4026
|
this.vcRef = vcRef;
|
|
5248
|
-
/**
|
|
5249
|
-
* Collection of event handlers for this element
|
|
5250
|
-
*/
|
|
5251
4027
|
this.eventHandlers = {};
|
|
5252
4028
|
this.eventsOnlyVal = false;
|
|
5253
4029
|
this.htmlElement = this.element.nativeElement;
|
|
@@ -5257,40 +4033,26 @@ class NonMagicControlDirective {
|
|
|
5257
4033
|
this.selector = 'NonMagicControl';
|
|
5258
4034
|
}
|
|
5259
4035
|
;
|
|
5260
|
-
/**
|
|
5261
|
-
* Get the task service
|
|
5262
|
-
* @returns
|
|
5263
|
-
*/
|
|
5264
4036
|
get task() {
|
|
5265
4037
|
return this._task;
|
|
5266
4038
|
}
|
|
5267
|
-
/**
|
|
5268
|
-
* Register to the events this element may need to handle
|
|
5269
|
-
*/
|
|
5270
4039
|
regEvents() {
|
|
5271
|
-
// Handle events for which event handler may be removed and restored
|
|
5272
4040
|
this.eventHandlers['focusin'] = this.OnFocus.bind(this);
|
|
5273
4041
|
Object.keys(this.eventHandlers).forEach((key) => {
|
|
5274
4042
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
|
5275
4043
|
});
|
|
5276
4044
|
}
|
|
5277
|
-
/**
|
|
5278
|
-
* Handle focus event
|
|
5279
|
-
*/
|
|
5280
4045
|
OnFocus() {
|
|
5281
4046
|
this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', "", -1));
|
|
5282
4047
|
event.cancelBubble = true;
|
|
5283
4048
|
}
|
|
5284
|
-
/**
|
|
5285
|
-
* Initialize this object
|
|
5286
|
-
*/
|
|
5287
4049
|
ngOnInit() {
|
|
5288
4050
|
this.regEvents();
|
|
5289
4051
|
}
|
|
5290
4052
|
}
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
4053
|
+
NonMagicControlDirective.ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef)); };
|
|
4054
|
+
NonMagicControlDirective.ɵdir = ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: ["NonMagicControl", "magic"] } });
|
|
4055
|
+
(function () { ɵsetClassMetadata(NonMagicControlDirective, [{
|
|
5294
4056
|
type: Directive,
|
|
5295
4057
|
args: [{
|
|
5296
4058
|
selector: '[NonMagicControl]'
|
|
@@ -5300,9 +4062,6 @@ class NonMagicControlDirective {
|
|
|
5300
4062
|
args: ['NonMagicControl']
|
|
5301
4063
|
}] }); })();
|
|
5302
4064
|
|
|
5303
|
-
/**
|
|
5304
|
-
* @ignore
|
|
5305
|
-
*/
|
|
5306
4065
|
const decs = [
|
|
5307
4066
|
MagicDirective,
|
|
5308
4067
|
CheckboxMagicDirective,
|
|
@@ -5333,9 +4092,6 @@ const decs = [
|
|
|
5333
4092
|
MagicFocusDirective,
|
|
5334
4093
|
MagicViewContainerRef
|
|
5335
4094
|
];
|
|
5336
|
-
/**
|
|
5337
|
-
* @ignore
|
|
5338
|
-
*/
|
|
5339
4095
|
class MagicModule {
|
|
5340
4096
|
static forRoot() {
|
|
5341
4097
|
return {
|
|
@@ -5350,12 +4106,11 @@ class MagicModule {
|
|
|
5350
4106
|
};
|
|
5351
4107
|
}
|
|
5352
4108
|
}
|
|
5353
|
-
|
|
5354
|
-
|
|
4109
|
+
MagicModule.ɵmod = ɵɵdefineNgModule({ type: MagicModule });
|
|
4110
|
+
MagicModule.ɵinj = ɵɵdefineInjector({ factory: function MagicModule_Factory(t) { return new (t || MagicModule)(); }, providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [[
|
|
5355
4111
|
CommonModule,
|
|
5356
4112
|
FormsModule,
|
|
5357
4113
|
ReactiveFormsModule,
|
|
5358
|
-
//ThemeModule,
|
|
5359
4114
|
RouterModule,
|
|
5360
4115
|
DynamicModule,
|
|
5361
4116
|
HttpClientModule
|
|
@@ -5390,7 +4145,6 @@ class MagicModule {
|
|
|
5390
4145
|
MagicViewContainerRef], imports: [CommonModule,
|
|
5391
4146
|
FormsModule,
|
|
5392
4147
|
ReactiveFormsModule,
|
|
5393
|
-
//ThemeModule,
|
|
5394
4148
|
RouterModule,
|
|
5395
4149
|
DynamicModule,
|
|
5396
4150
|
HttpClientModule], exports: [MagicDirective,
|
|
@@ -5421,7 +4175,7 @@ class MagicModule {
|
|
|
5421
4175
|
NonMagicControlDirective,
|
|
5422
4176
|
MagicFocusDirective,
|
|
5423
4177
|
MagicViewContainerRef] }); })();
|
|
5424
|
-
|
|
4178
|
+
(function () { ɵsetClassMetadata(MagicModule, [{
|
|
5425
4179
|
type: NgModule,
|
|
5426
4180
|
args: [{
|
|
5427
4181
|
declarations: [...decs],
|
|
@@ -5431,12 +4185,10 @@ class MagicModule {
|
|
|
5431
4185
|
CommonModule,
|
|
5432
4186
|
FormsModule,
|
|
5433
4187
|
ReactiveFormsModule,
|
|
5434
|
-
//ThemeModule,
|
|
5435
4188
|
RouterModule,
|
|
5436
4189
|
DynamicModule,
|
|
5437
4190
|
HttpClientModule
|
|
5438
4191
|
],
|
|
5439
|
-
//Customizable providers
|
|
5440
4192
|
providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
|
|
5441
4193
|
}]
|
|
5442
4194
|
}], null, null); })();
|
|
@@ -5524,7 +4276,7 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
|
5524
4276
|
this.mgdtfmt = this.task.mgInputDateFormat;
|
|
5525
4277
|
if (displayFormat === 'input') {
|
|
5526
4278
|
if (this.mgdtfmt == null)
|
|
5527
|
-
this.mgdtfmt = 'M/d/yyyy';
|
|
4279
|
+
this.mgdtfmt = 'M/d/yyyy';
|
|
5528
4280
|
return formatDate(date, this.mgdtfmt, this.locale);
|
|
5529
4281
|
}
|
|
5530
4282
|
else {
|
|
@@ -5532,9 +4284,9 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
|
5532
4284
|
}
|
|
5533
4285
|
}
|
|
5534
4286
|
}
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
4287
|
+
MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(ɵɵinject(Platform), ɵɵinject(TaskMagicService)); };
|
|
4288
|
+
MgDateAdapter.ɵprov = ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
|
|
4289
|
+
(function () { ɵsetClassMetadata(MgDateAdapter, [{
|
|
5538
4290
|
type: Injectable
|
|
5539
4291
|
}], function () { return [{ type: Platform }, { type: TaskMagicService }]; }, null); })();
|
|
5540
4292
|
|
|
@@ -5542,9 +4294,6 @@ const matDateProviders = [
|
|
|
5542
4294
|
{ provide: DateAdapter, useClass: MgDateAdapter },
|
|
5543
4295
|
{ provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
|
|
5544
4296
|
];
|
|
5545
|
-
/**
|
|
5546
|
-
* Magic service providers
|
|
5547
|
-
*/
|
|
5548
4297
|
const basicMagicProviders = [
|
|
5549
4298
|
MagicServices,
|
|
5550
4299
|
TaskMagicService,
|
|
@@ -5558,18 +4307,7 @@ const magicProviders = [
|
|
|
5558
4307
|
TableMagicService
|
|
5559
4308
|
];
|
|
5560
4309
|
|
|
5561
|
-
/**
|
|
5562
|
-
* @ignore
|
|
5563
|
-
*/
|
|
5564
|
-
///////////////////////////////////////////////////////////
|
|
5565
|
-
// class to hold gui-related helper methods
|
|
5566
|
-
///////////////////////////////////////////////////////////
|
|
5567
4310
|
class utils {
|
|
5568
|
-
///////////////////////////////////////////////////////////
|
|
5569
|
-
// Add magic child control to the supplied array.
|
|
5570
|
-
// Recursive, and checks children even if they are not magic controls.
|
|
5571
|
-
// Magic controls are controls which have a magic directive attached to them.
|
|
5572
|
-
///////////////////////////////////////////////////////////
|
|
5573
4311
|
static addChildren(parent, children, selector) {
|
|
5574
4312
|
for (var i = 0; i < parent.children.length; i++) {
|
|
5575
4313
|
if (typeof parent.children[i].attributes[selector] !== "undefined") {
|
|
@@ -5578,9 +4316,6 @@ class utils {
|
|
|
5578
4316
|
this.addChildren(parent.children[i], children, selector);
|
|
5579
4317
|
}
|
|
5580
4318
|
}
|
|
5581
|
-
///////////////////////////////////////////////////////////
|
|
5582
|
-
// Calculate the distance between the control and the supplied x,y coordinates
|
|
5583
|
-
///////////////////////////////////////////////////////////
|
|
5584
4319
|
static getDistance(control, x, y) {
|
|
5585
4320
|
let left = control.clientLeft, top = control.clientTop;
|
|
5586
4321
|
let dx, dy;
|
|
@@ -5607,9 +4342,6 @@ class utils {
|
|
|
5607
4342
|
const ret = (dx * dx + dy * dy);
|
|
5608
4343
|
return ret;
|
|
5609
4344
|
}
|
|
5610
|
-
///////////////////////////////////////////////////////////
|
|
5611
|
-
//
|
|
5612
|
-
///////////////////////////////////////////////////////////
|
|
5613
4345
|
static getDimentions(el) {
|
|
5614
4346
|
let xPos = 0;
|
|
5615
4347
|
let yPos = 0;
|
|
@@ -5617,14 +4349,12 @@ class utils {
|
|
|
5617
4349
|
let height = el.height;
|
|
5618
4350
|
while (el) {
|
|
5619
4351
|
if (el.tagName == "BODY") {
|
|
5620
|
-
// deal with browser quirks with body/window/document and page scroll
|
|
5621
4352
|
let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
5622
4353
|
let yScroll = el.scrollTop || document.documentElement.scrollTop;
|
|
5623
4354
|
xPos += (el.offsetLeft - xScroll + el.clientLeft);
|
|
5624
4355
|
yPos += (el.offsetTop - yScroll + el.clientTop);
|
|
5625
4356
|
}
|
|
5626
4357
|
else {
|
|
5627
|
-
// for all other non-BODY elements
|
|
5628
4358
|
xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
|
|
5629
4359
|
yPos += (el.offsetTop - el.scrollTop + el.clientTop);
|
|
5630
4360
|
}
|
|
@@ -5639,9 +4369,6 @@ class utils {
|
|
|
5639
4369
|
}
|
|
5640
4370
|
}
|
|
5641
4371
|
|
|
5642
|
-
/**
|
|
5643
|
-
* @ignore
|
|
5644
|
-
*/
|
|
5645
4372
|
class ModalFormDefinition {
|
|
5646
4373
|
constructor() {
|
|
5647
4374
|
this.taskId = "";
|
|
@@ -5650,9 +4377,5 @@ class ModalFormDefinition {
|
|
|
5650
4377
|
}
|
|
5651
4378
|
}
|
|
5652
4379
|
|
|
5653
|
-
/**
|
|
5654
|
-
* Generated bundle index. Do not edit.
|
|
5655
|
-
*/
|
|
5656
|
-
|
|
5657
4380
|
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 };
|
|
5658
4381
|
//# sourceMappingURL=magic-xpa-angular.js.map
|