@magic-xpa/angular 4.800.0-dev480.22 → 4.800.0-dev480.220
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 +1382 -2648
- 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 +15 -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 +7 -23
- package/esm2015/src/ui/directives/magic-focus.directive.js +4 -7
- package/esm2015/src/ui/directives/magic.directive.js +12 -82
- 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 +608 -1882
- 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 +1 -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;
|
|
@@ -1943,6 +1854,7 @@ class TaskMagicService {
|
|
|
1943
1854
|
control.setValidators([control.validator, this.customValidator(guiRowId.toString(), controlId)]);
|
|
1944
1855
|
else
|
|
1945
1856
|
control.setValidators(this.customValidator(guiRowId.toString(), controlId));
|
|
1857
|
+
control.updateValueAndValidity();
|
|
1946
1858
|
}
|
|
1947
1859
|
}
|
|
1948
1860
|
break;
|
|
@@ -1955,7 +1867,7 @@ class TaskMagicService {
|
|
|
1955
1867
|
properties.setStyle(command.Operation, command.obj1);
|
|
1956
1868
|
break;
|
|
1957
1869
|
case CommandType.SET_ATTRIBUTE:
|
|
1958
|
-
properties = this.Records.list[
|
|
1870
|
+
properties = this.Records.list[0].getControlMetadata(controlId);
|
|
1959
1871
|
properties.dataType = String.fromCharCode(command.number);
|
|
1960
1872
|
break;
|
|
1961
1873
|
case CommandType.SET_VALUE:
|
|
@@ -1974,12 +1886,11 @@ class TaskMagicService {
|
|
|
1974
1886
|
case CommandType.SET_EMPTY_DATAVIEW:
|
|
1975
1887
|
this.setIsEmptyDataView(command.Bool1);
|
|
1976
1888
|
break;
|
|
1889
|
+
case CommandType.SET_FOCUS:
|
|
1890
|
+
this.refreshDom.next(command);
|
|
1891
|
+
break;
|
|
1977
1892
|
}
|
|
1978
|
-
this.refreshDom.next(command);
|
|
1979
1893
|
}
|
|
1980
|
-
/**
|
|
1981
|
-
custom validator
|
|
1982
|
-
*/
|
|
1983
1894
|
customValidator(rowid, id) {
|
|
1984
1895
|
return (control) => {
|
|
1985
1896
|
let controlMetadata;
|
|
@@ -1993,13 +1904,6 @@ class TaskMagicService {
|
|
|
1993
1904
|
return null;
|
|
1994
1905
|
};
|
|
1995
1906
|
}
|
|
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
1907
|
ConvertValToNative(controlId, rowId, val) {
|
|
2004
1908
|
let properties;
|
|
2005
1909
|
properties = this.Records.list[0].getControlMetadata(controlId);
|
|
@@ -2048,13 +1952,6 @@ class TaskMagicService {
|
|
|
2048
1952
|
return val;
|
|
2049
1953
|
}
|
|
2050
1954
|
}
|
|
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
1955
|
ConvertValFromNative(controlId, rowId, val) {
|
|
2059
1956
|
let properties;
|
|
2060
1957
|
properties = this.Records.list[0].getControlMetadata(controlId);
|
|
@@ -2097,22 +1994,12 @@ class TaskMagicService {
|
|
|
2097
1994
|
return val;
|
|
2098
1995
|
}
|
|
2099
1996
|
}
|
|
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
1997
|
resize(pageSize, topGuiRowId) {
|
|
2107
1998
|
let guiEvent = getGuiEventObj('resize', 'table', 0);
|
|
2108
1999
|
guiEvent.PageSize = pageSize;
|
|
2109
|
-
//As 'getRows' event also gets executed, set the guiEvent.Line parameter.
|
|
2110
2000
|
guiEvent.Line = topGuiRowId;
|
|
2111
2001
|
this.insertEvent(guiEvent);
|
|
2112
2002
|
}
|
|
2113
|
-
/**
|
|
2114
|
-
* Fetches data for new table rows when scrolling done
|
|
2115
|
-
*/
|
|
2116
2003
|
onScrollDown() {
|
|
2117
2004
|
if (!this.Records.includesLast) {
|
|
2118
2005
|
let guiEvent = getGuiEventObj('getRows', 'table', 0);
|
|
@@ -2120,29 +2007,15 @@ class TaskMagicService {
|
|
|
2120
2007
|
this.insertEvent(guiEvent);
|
|
2121
2008
|
}
|
|
2122
2009
|
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Sets the new browser window title
|
|
2125
|
-
* @param newTitle New window title
|
|
2126
|
-
*/
|
|
2127
2010
|
setTitle(newTitle) {
|
|
2128
2011
|
this.mgTitleService.setTitle(newTitle);
|
|
2129
2012
|
}
|
|
2130
|
-
/**
|
|
2131
|
-
* @ignore
|
|
2132
|
-
*/
|
|
2133
2013
|
getGuiRowId(dvRowId, isTableControl) {
|
|
2134
2014
|
return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
|
|
2135
2015
|
}
|
|
2136
|
-
/**
|
|
2137
|
-
*
|
|
2138
|
-
* @ignore
|
|
2139
|
-
*/
|
|
2140
2016
|
getDvRowId(guiRowId) {
|
|
2141
2017
|
return (guiRowId - this.Records.recordsBeforeCurrentView);
|
|
2142
2018
|
}
|
|
2143
|
-
/**
|
|
2144
|
-
* Clean up the service when it is no longer needed
|
|
2145
|
-
*/
|
|
2146
2019
|
dispose() {
|
|
2147
2020
|
this.refreshDom.complete();
|
|
2148
2021
|
this.detectChanges.complete();
|
|
@@ -2152,14 +2025,6 @@ class TaskMagicService {
|
|
|
2152
2025
|
this.customPropertiesSubject.complete();
|
|
2153
2026
|
this.OnSelectedRowChanged.complete();
|
|
2154
2027
|
}
|
|
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
2028
|
onComboboxSelectionChanged(event, idx, line) {
|
|
2164
2029
|
let guiEvent = getGuiEventObj('selectionchanged', idx, line);
|
|
2165
2030
|
if (typeof (event) == 'number') {
|
|
@@ -2167,467 +2032,136 @@ class TaskMagicService {
|
|
|
2167
2032
|
}
|
|
2168
2033
|
else {
|
|
2169
2034
|
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);
|
|
2035
|
+
let indexes = new Array(event.target.selectedOptions.length);
|
|
2036
|
+
for (let i = 0; i < event.target.selectedOptions.length; i++) {
|
|
2037
|
+
indexes[i] = event.target.selectedOptions[i].index;
|
|
2038
|
+
}
|
|
2039
|
+
guiEvent.Value = indexes.join(',');
|
|
2464
2040
|
}
|
|
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
2041
|
else
|
|
2479
|
-
|
|
2042
|
+
guiEvent.Value = event.value;
|
|
2480
2043
|
}
|
|
2481
|
-
|
|
2482
|
-
this.task.refreshView();
|
|
2044
|
+
this.insertEvent(guiEvent);
|
|
2483
2045
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2046
|
+
onListBoxSelectionChanged(event, idx) {
|
|
2047
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2048
|
+
let selectedOptions;
|
|
2049
|
+
if (!isNullOrUndefined(event.target))
|
|
2050
|
+
selectedOptions = event.target.selectedOptions;
|
|
2051
|
+
else
|
|
2052
|
+
selectedOptions = event.source.selectedOptions.selected;
|
|
2053
|
+
let length = selectedOptions.length;
|
|
2054
|
+
let indexes = new Array(length);
|
|
2055
|
+
for (let i = 0; i < length; i++) {
|
|
2056
|
+
if (!isNullOrUndefined(event.target))
|
|
2057
|
+
indexes[i] = (selectedOptions[i]).index;
|
|
2058
|
+
else
|
|
2059
|
+
indexes[i] = (selectedOptions[i]).value;
|
|
2060
|
+
}
|
|
2061
|
+
guiEvent.Value = indexes;
|
|
2062
|
+
this.insertEvent(guiEvent);
|
|
2063
|
+
}
|
|
2064
|
+
onCheckChanged(event, idx, rowId) {
|
|
2065
|
+
if (typeof rowId === 'undefined')
|
|
2066
|
+
rowId = 0;
|
|
2067
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, rowId);
|
|
2068
|
+
if (typeof (event) == 'boolean') {
|
|
2069
|
+
guiEvent.Value = event;
|
|
2503
2070
|
}
|
|
2504
2071
|
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
|
-
}
|
|
2072
|
+
if (typeof event.target === 'undefined')
|
|
2073
|
+
guiEvent.Value = (event).checked;
|
|
2074
|
+
else
|
|
2075
|
+
guiEvent.Value = (event.target).checked;
|
|
2518
2076
|
}
|
|
2077
|
+
this.insertEvent(guiEvent);
|
|
2519
2078
|
}
|
|
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
|
-
});
|
|
2079
|
+
mgOnTabSelectionChanged(idx, layer) {
|
|
2080
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2081
|
+
guiEvent.Value = layer.toString();
|
|
2082
|
+
this.insertEvent(guiEvent);
|
|
2532
2083
|
}
|
|
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();
|
|
2084
|
+
mgOnRadioSelectionChanged(event, idx) {
|
|
2085
|
+
let result = this.getFormControl('0', idx);
|
|
2086
|
+
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
|
2087
|
+
if (typeof result.value !== 'string')
|
|
2088
|
+
guiEvent.Value = result.value.index;
|
|
2089
|
+
else
|
|
2090
|
+
guiEvent.Value = result.value;
|
|
2091
|
+
this.insertEvent(guiEvent);
|
|
2545
2092
|
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
*/
|
|
2549
|
-
refreshView() {
|
|
2550
|
-
this.task.refreshView();
|
|
2093
|
+
close() {
|
|
2094
|
+
this.insertEvent(getGuiEventObj('close', null, 0));
|
|
2551
2095
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2096
|
+
IsStub() {
|
|
2097
|
+
return this.magic.isStub;
|
|
2098
|
+
}
|
|
2099
|
+
saveData(data) {
|
|
2100
|
+
this.magic.saveData(data);
|
|
2101
|
+
}
|
|
2102
|
+
createData() {
|
|
2103
|
+
let myData = {
|
|
2104
|
+
records: this.Records,
|
|
2105
|
+
template: this.template
|
|
2106
|
+
};
|
|
2107
|
+
let text = 'loadData():any {\n' +
|
|
2108
|
+
' let stubData = ' + JSON.stringify(myData) + ';\n' +
|
|
2109
|
+
' this.loadStubData(stubData);}';
|
|
2110
|
+
console.log(text);
|
|
2111
|
+
this.saveData(text);
|
|
2112
|
+
}
|
|
2113
|
+
loadStubData(stubData) {
|
|
2114
|
+
this.Records = stubData.records;
|
|
2115
|
+
this.settemplate(stubData.template);
|
|
2116
|
+
this.taskId = '1';
|
|
2117
|
+
for (let i = 0; i < this.Records.list.length; i++)
|
|
2118
|
+
this.buildTableRowControls(i);
|
|
2119
|
+
}
|
|
2120
|
+
loadData() {
|
|
2121
|
+
alert('Please, overwrite method loadData');
|
|
2122
|
+
}
|
|
2123
|
+
setStubValue(guiRowId, fc, name) {
|
|
2124
|
+
if (this.IsStub()) {
|
|
2125
|
+
try {
|
|
2126
|
+
let val = this.Records.list[guiRowId].values[name];
|
|
2127
|
+
fc.setValue(val);
|
|
2128
|
+
}
|
|
2129
|
+
catch (e) {
|
|
2130
|
+
}
|
|
2561
2131
|
}
|
|
2562
|
-
return currentActiveRoute;
|
|
2563
2132
|
}
|
|
2564
2133
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
/** @nocollapse */ SubformMagicService.ɵprov = ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
|
2569
|
-
/*@__PURE__*/ (function () { ɵsetClassMetadata(SubformMagicService, [{
|
|
2134
|
+
TaskMagicService.ɵfac = function TaskMagicService_Factory(t) { return new (t || TaskMagicService)(ɵɵinject(EngineMagicService), ɵɵinject(OverlayWindowService)); };
|
|
2135
|
+
TaskMagicService.ɵprov = ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
|
2136
|
+
(function () { ɵsetClassMetadata(TaskMagicService, [{
|
|
2570
2137
|
type: Injectable
|
|
2571
|
-
}], function () { return [{ type:
|
|
2138
|
+
}], function () { return [{ type: EngineMagicService }, { type: OverlayWindowService }]; }, null); })();
|
|
2572
2139
|
|
|
2573
|
-
/**
|
|
2574
|
-
* Implements various table-related functionalities
|
|
2575
|
-
*/
|
|
2576
2140
|
class TableMagicService {
|
|
2577
|
-
/**
|
|
2578
|
-
*
|
|
2579
|
-
* @param componentList Component-mapping service
|
|
2580
|
-
* @param task Magic task service
|
|
2581
|
-
*/
|
|
2582
2141
|
constructor(componentList, task) {
|
|
2583
2142
|
this.componentList = componentList;
|
|
2584
2143
|
this.task = task;
|
|
2585
2144
|
this.shouldOpenFieldTextEditor = true;
|
|
2586
2145
|
}
|
|
2587
|
-
/**
|
|
2588
|
-
* Refreshes the DataSource
|
|
2589
|
-
*/
|
|
2590
2146
|
refreshDataSource() {
|
|
2591
2147
|
}
|
|
2592
|
-
/**
|
|
2593
|
-
* Returns the table page size
|
|
2594
|
-
*/
|
|
2595
2148
|
getPageSize() {
|
|
2596
2149
|
return 10;
|
|
2597
2150
|
}
|
|
2598
|
-
/**
|
|
2599
|
-
* Returns max no of rows in the table.
|
|
2600
|
-
*/
|
|
2601
2151
|
getMaxRowsInTable() {
|
|
2602
2152
|
return this.task.Records.list.length;
|
|
2603
2153
|
}
|
|
2604
|
-
/**
|
|
2605
|
-
* Selects the specified row
|
|
2606
|
-
* @param rowId The row to select
|
|
2607
|
-
*/
|
|
2608
2154
|
selectRow(rowId) {
|
|
2609
2155
|
this.selectedItem = rowId;
|
|
2610
2156
|
}
|
|
2611
2157
|
getSelectedRow() {
|
|
2612
2158
|
return this.selectedItem;
|
|
2613
2159
|
}
|
|
2614
|
-
/**
|
|
2615
|
-
* Returns the selected row
|
|
2616
|
-
*/
|
|
2617
2160
|
selectedRow() {
|
|
2618
2161
|
return null;
|
|
2619
2162
|
}
|
|
2620
|
-
/**
|
|
2621
|
-
* Selects the specified page
|
|
2622
|
-
* @param pageId The page to select
|
|
2623
|
-
*/
|
|
2624
2163
|
selectPage(pageId) {
|
|
2625
2164
|
}
|
|
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
2165
|
OpenDialogForControl(element) {
|
|
2632
2166
|
if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
|
|
2633
2167
|
element.tagName === "INPUT" ||
|
|
@@ -2635,34 +2169,17 @@ class TableMagicService {
|
|
|
2635
2169
|
return false;
|
|
2636
2170
|
return true;
|
|
2637
2171
|
}
|
|
2638
|
-
/**
|
|
2639
|
-
* Returns the dialog used to edit values
|
|
2640
|
-
*/
|
|
2641
2172
|
getDialog() {
|
|
2642
2173
|
return null;
|
|
2643
2174
|
}
|
|
2644
|
-
/**
|
|
2645
|
-
* Handles the table "scrolled" event
|
|
2646
|
-
*/
|
|
2647
2175
|
onScrollDown() {
|
|
2648
2176
|
this.task.onScrollDown();
|
|
2649
2177
|
}
|
|
2650
|
-
/**
|
|
2651
|
-
* To be overwitten in specific implelemtations
|
|
2652
|
-
*/
|
|
2653
2178
|
sortData(e) { }
|
|
2654
|
-
/**
|
|
2655
|
-
* To be overwitten in specific implelemtations
|
|
2656
|
-
*/
|
|
2657
2179
|
mgOnPaginateChange(e) { }
|
|
2658
2180
|
mgOptionChanged(e) { }
|
|
2659
|
-
/**
|
|
2660
|
-
* Change the number of lines in a table
|
|
2661
|
-
* @param size New number of lines in table
|
|
2662
|
-
*/
|
|
2663
2181
|
updateTableSize(size) {
|
|
2664
|
-
if (size === 0)
|
|
2665
|
-
{
|
|
2182
|
+
if (size === 0) {
|
|
2666
2183
|
size = 1;
|
|
2667
2184
|
this.task.Records.clearFirstTableRecord(this.task.template);
|
|
2668
2185
|
}
|
|
@@ -2670,17 +2187,11 @@ class TableMagicService {
|
|
|
2670
2187
|
this.task.Records.updateSize(size);
|
|
2671
2188
|
this.task.setIncludesFirst(false);
|
|
2672
2189
|
}
|
|
2673
|
-
/**
|
|
2674
|
-
* @ignore
|
|
2675
|
-
*/
|
|
2676
2190
|
setTableTopIndex(value) {
|
|
2677
2191
|
if (!this.task.Records.includesFirst)
|
|
2678
2192
|
value++;
|
|
2679
2193
|
this.task.Records.setGuiTopIndex(value);
|
|
2680
2194
|
}
|
|
2681
|
-
/**
|
|
2682
|
-
* @ignore
|
|
2683
|
-
*/
|
|
2684
2195
|
getTableTopIndex() {
|
|
2685
2196
|
let topIndex = this.task.Records.getGuiTopIndex();
|
|
2686
2197
|
if (!this.task.Records.includesFirst)
|
|
@@ -2688,55 +2199,32 @@ class TableMagicService {
|
|
|
2688
2199
|
return topIndex;
|
|
2689
2200
|
}
|
|
2690
2201
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2202
|
+
TableMagicService.ɵfac = function TableMagicService_Factory(t) { return new (t || TableMagicService)(ɵɵinject(ComponentListMagicService), ɵɵinject(TaskMagicService)); };
|
|
2203
|
+
TableMagicService.ɵprov = ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
|
|
2204
|
+
(function () { ɵsetClassMetadata(TableMagicService, [{
|
|
2694
2205
|
type: Injectable
|
|
2695
2206
|
}], function () { return [{ type: ComponentListMagicService }, { type: TaskMagicService }]; }, null); })();
|
|
2696
2207
|
|
|
2697
|
-
/**
|
|
2698
|
-
* Enables changing the browser title using Magic expression (SetTitle)
|
|
2699
|
-
*/
|
|
2700
2208
|
class TitleMagicService {
|
|
2701
|
-
/**
|
|
2702
|
-
*
|
|
2703
|
-
* @param titleService Angular's title-changing class
|
|
2704
|
-
*/
|
|
2705
2209
|
constructor(titleService) {
|
|
2706
2210
|
this.titleService = titleService;
|
|
2707
2211
|
}
|
|
2708
|
-
/**
|
|
2709
|
-
* Set the new title of the window
|
|
2710
|
-
* @param newTitle New title of the window
|
|
2711
|
-
*/
|
|
2712
2212
|
setTitle(newTitle) {
|
|
2713
2213
|
this.titleService.setTitle(newTitle);
|
|
2714
2214
|
}
|
|
2715
2215
|
}
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2216
|
+
TitleMagicService.ɵfac = function TitleMagicService_Factory(t) { return new (t || TitleMagicService)(ɵɵinject(Title)); };
|
|
2217
|
+
TitleMagicService.ɵprov = ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
|
|
2218
|
+
(function () { ɵsetClassMetadata(TitleMagicService, [{
|
|
2719
2219
|
type: Injectable
|
|
2720
2220
|
}], function () { return [{ type: Title }]; }, null); })();
|
|
2721
2221
|
|
|
2722
|
-
/**
|
|
2723
|
-
* Provides the UI with values calculated by the Magic WebClient
|
|
2724
|
-
*/
|
|
2725
2222
|
class AccessorMagicService {
|
|
2726
|
-
/**
|
|
2727
|
-
* @ignore
|
|
2728
|
-
*/
|
|
2729
2223
|
constructor(task) {
|
|
2730
2224
|
this.task = task;
|
|
2731
2225
|
this.Logger = null;
|
|
2732
2226
|
this.Logger = Logger.Instance;
|
|
2733
2227
|
}
|
|
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
2228
|
checkIsReadOnly(controlId) {
|
|
2741
2229
|
let properties;
|
|
2742
2230
|
properties = this.task.Records.list[0].getControlMetadata(controlId);
|
|
@@ -2745,99 +2233,45 @@ class AccessorMagicService {
|
|
|
2745
2233
|
else
|
|
2746
2234
|
return true;
|
|
2747
2235
|
}
|
|
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
2236
|
getText(controlId, rowId) {
|
|
2756
2237
|
return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
|
|
2757
2238
|
}
|
|
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
2239
|
getTabpageText(controlId, layer) {
|
|
2766
2240
|
const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
|
|
2767
2241
|
if (typeof items !== "undefined")
|
|
2768
2242
|
return items[layer].displayValue;
|
|
2769
2243
|
return "";
|
|
2770
2244
|
}
|
|
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
2245
|
getImage(controlId, rowId) {
|
|
2779
2246
|
let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
|
|
2780
2247
|
return result;
|
|
2781
2248
|
}
|
|
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
2249
|
isImageExists(controlId, rowId) {
|
|
2790
2250
|
let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
|
|
2791
2251
|
return !isNullOrUndefined(result);
|
|
2792
2252
|
}
|
|
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
2253
|
getClasses(controlId, rowId) {
|
|
2801
2254
|
return this.task.getClasses(controlId, rowId);
|
|
2802
2255
|
}
|
|
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
2256
|
getStyle(controlId, styleName, rowId) {
|
|
2812
2257
|
let style = this.task.getStyle(controlId, styleName, rowId);
|
|
2813
2258
|
return style;
|
|
2814
2259
|
}
|
|
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
2260
|
getVisible(controlId, rowId) {
|
|
2823
2261
|
let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
|
|
2824
2262
|
return vis ? 'visible' : 'hidden';
|
|
2825
2263
|
}
|
|
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
2264
|
getNumericPicture(picture) {
|
|
2833
2265
|
if (isNullOrUndefined(picture))
|
|
2834
2266
|
return null;
|
|
2835
2267
|
let pic = new PIC(picture, StorageAttribute.NUMERIC, 0);
|
|
2836
2268
|
var obj = {};
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2269
|
+
obj['prefix'] = "";
|
|
2270
|
+
if (pic.getPosPref_().length > 0 && pic.getNegPref_().length > 0) {
|
|
2271
|
+
let pref = '-' + pic.getPosPref_();
|
|
2272
|
+
if (pref == pic.getNegPref_())
|
|
2273
|
+
obj['prefix'] = pic.getPosPref_();
|
|
2274
|
+
}
|
|
2841
2275
|
if (pic.getPosSuff_().length > 0)
|
|
2842
2276
|
obj['suffix'] = pic.getPosSuff_();
|
|
2843
2277
|
else
|
|
@@ -2859,128 +2293,51 @@ class AccessorMagicService {
|
|
|
2859
2293
|
obj['wholes'] = pic.getWholes();
|
|
2860
2294
|
return obj;
|
|
2861
2295
|
}
|
|
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
2296
|
getMustInput(controlId, rowId) {
|
|
2870
2297
|
let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
|
|
2871
2298
|
return vis ? 'true' : 'false';
|
|
2872
2299
|
}
|
|
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
2300
|
isDisabled(controlId, rowId) {
|
|
2881
2301
|
let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
|
|
2882
2302
|
return result === true ? null : true;
|
|
2883
2303
|
}
|
|
2884
|
-
/**
|
|
2885
|
-
* @ignore
|
|
2886
|
-
*/
|
|
2887
|
-
// getProperty (not changed)
|
|
2888
2304
|
getProperty(controlId, prop, rowId) {
|
|
2889
2305
|
return this.task.getProperty(controlId, prop, rowId);
|
|
2890
2306
|
}
|
|
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
2307
|
getTitle(controlId, rowId) {
|
|
2899
2308
|
return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
|
|
2900
2309
|
}
|
|
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
2310
|
getZoomButtonTitle(controlId, rowId) {
|
|
2909
2311
|
return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
|
|
2910
2312
|
}
|
|
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
2313
|
getSelectedValue(controlId, rowId) {
|
|
2919
2314
|
return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
|
|
2920
2315
|
}
|
|
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
2316
|
getPlaceholder(controlId, rowId) {
|
|
2929
2317
|
return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
|
|
2930
2318
|
}
|
|
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
2319
|
getType(controlId, rowId) {
|
|
2939
2320
|
let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
|
|
2940
2321
|
return result ? "password" : "text";
|
|
2941
2322
|
}
|
|
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
2323
|
getTabIndex(controlId, rowId) {
|
|
2950
2324
|
return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
|
|
2951
2325
|
}
|
|
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
2326
|
getValue(controlId, rowId) {
|
|
2960
2327
|
let val = this.task.getValue(controlId, rowId);
|
|
2961
2328
|
return val;
|
|
2962
2329
|
}
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
*/
|
|
2969
|
-
/// getPicture -->
|
|
2330
|
+
getFormattedValue(controlId, rowId) {
|
|
2331
|
+
let val = this.task.getValue(controlId, rowId);
|
|
2332
|
+
val = this.task.getFormattedValue(controlId, val);
|
|
2333
|
+
return val;
|
|
2334
|
+
}
|
|
2970
2335
|
getPicture(controlId, rowId) {
|
|
2971
2336
|
if (isNullOrUndefined(controlId))
|
|
2972
2337
|
return null;
|
|
2973
2338
|
let pic = this.task.GetControlPictureMask(controlId);
|
|
2974
2339
|
return (pic != null) ? pic.getFormat().toString() : null;
|
|
2975
2340
|
}
|
|
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
2341
|
getCustomProperty(controlId, propertyNameOrRowID, rowId) {
|
|
2985
2342
|
if (controlId.indexOf('~') == -1)
|
|
2986
2343
|
return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
|
|
@@ -3005,22 +2362,21 @@ class AccessorMagicService {
|
|
|
3005
2362
|
}
|
|
3006
2363
|
return userProperties;
|
|
3007
2364
|
}
|
|
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
2365
|
getItemListValues(id, rowId) {
|
|
3016
2366
|
return this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
3017
2367
|
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
2368
|
+
getFilteredList(controlId, rowId) {
|
|
2369
|
+
if (isNullOrUndefined(rowId))
|
|
2370
|
+
rowId = '0';
|
|
2371
|
+
let items = this.getItemListValues(controlId, rowId);
|
|
2372
|
+
let value = this.task.getFormControl(rowId, controlId).value;
|
|
2373
|
+
if (value !== null && value !== "" && items instanceof Array) {
|
|
2374
|
+
value = value.toLowerCase();
|
|
2375
|
+
return items.filter(option => option.displayValue.toLowerCase().includes(value));
|
|
2376
|
+
}
|
|
2377
|
+
else
|
|
2378
|
+
return items;
|
|
2379
|
+
}
|
|
3024
2380
|
getDisplayValue(id, rowId) {
|
|
3025
2381
|
let displayValue = "";
|
|
3026
2382
|
let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
|
@@ -3029,12 +2385,6 @@ class AccessorMagicService {
|
|
|
3029
2385
|
displayValue = o[value].displayValue;
|
|
3030
2386
|
return displayValue;
|
|
3031
2387
|
}
|
|
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
2388
|
isOptionSelected(index, controlId) {
|
|
3039
2389
|
let val = this.task.getValue(controlId, "0");
|
|
3040
2390
|
for (let item of val) {
|
|
@@ -3043,40 +2393,18 @@ class AccessorMagicService {
|
|
|
3043
2393
|
}
|
|
3044
2394
|
return false;
|
|
3045
2395
|
}
|
|
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
2396
|
isTabPageSelected(controlId, layer) {
|
|
3053
2397
|
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
|
|
2398
|
+
return val == (layer - 1);
|
|
2399
|
+
}
|
|
3062
2400
|
isTabPageLayerSelected(controlId, layer) {
|
|
3063
2401
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
|
|
3064
|
-
return val == (layer - 1);
|
|
2402
|
+
return val == (layer - 1);
|
|
3065
2403
|
}
|
|
3066
|
-
/**
|
|
3067
|
-
* Returns the index of the selected tab page
|
|
3068
|
-
* @param controlId Id of control
|
|
3069
|
-
* @returns
|
|
3070
|
-
*/
|
|
3071
2404
|
getTabSelectedIndex(controlId) {
|
|
3072
2405
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
|
|
3073
|
-
return val;
|
|
2406
|
+
return val;
|
|
3074
2407
|
}
|
|
3075
|
-
// private methodes
|
|
3076
|
-
/**
|
|
3077
|
-
* @ignore
|
|
3078
|
-
*/
|
|
3079
|
-
// mgIfRowCreated
|
|
3080
2408
|
ifRowCreated(row) {
|
|
3081
2409
|
if (row == null)
|
|
3082
2410
|
return false;
|
|
@@ -3084,48 +2412,25 @@ class AccessorMagicService {
|
|
|
3084
2412
|
let result = this.getFormGroupByRow(rowId);
|
|
3085
2413
|
return !isNullOrUndefined(result);
|
|
3086
2414
|
}
|
|
3087
|
-
/**
|
|
3088
|
-
* @ignore
|
|
3089
|
-
*/
|
|
3090
|
-
// mgGetFormGroupByRow
|
|
3091
2415
|
getFormGroupByRow(id) {
|
|
3092
2416
|
return this.task.formGroups[id];
|
|
3093
2417
|
}
|
|
3094
|
-
/**
|
|
3095
|
-
* @ignore
|
|
3096
|
-
*/
|
|
3097
|
-
// isRowSelected (not changed)
|
|
3098
2418
|
isRowSelected(controlId, rowId) {
|
|
3099
2419
|
const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
|
|
3100
2420
|
return selectedRow == rowId;
|
|
3101
2421
|
}
|
|
3102
|
-
/**
|
|
3103
|
-
* Returns whether a row is in edit state
|
|
3104
|
-
* @param row
|
|
3105
|
-
*/
|
|
3106
2422
|
isRowInRowEditing(row) {
|
|
3107
2423
|
let guiRowId = '0';
|
|
3108
2424
|
guiRowId = typeof row == "number" ? row.toString() : row.rowId;
|
|
3109
2425
|
return this.task.isRowInRowEditing(guiRowId);
|
|
3110
2426
|
}
|
|
3111
|
-
/**
|
|
3112
|
-
* Returns whether a row is in edit state, use this method while control outside table control
|
|
3113
|
-
* @param row
|
|
3114
|
-
*/
|
|
3115
2427
|
isCurrentInRowEditing() {
|
|
3116
2428
|
let row = this.task.tableService.getSelectedRow();
|
|
3117
2429
|
return this.task.isRowInRowEditing(row);
|
|
3118
2430
|
}
|
|
3119
|
-
/**
|
|
3120
|
-
* @ignore
|
|
3121
|
-
*/
|
|
3122
|
-
// GetGuiTopIndex
|
|
3123
2431
|
guiTopIndex() {
|
|
3124
2432
|
return this.task.tableService.getTableTopIndex();
|
|
3125
2433
|
}
|
|
3126
|
-
/**
|
|
3127
|
-
* @ignore
|
|
3128
|
-
*/
|
|
3129
2434
|
getErrMsg(id, rowId) {
|
|
3130
2435
|
let c = this.task.getFormControl(rowId, id);
|
|
3131
2436
|
if (c.hasError('required'))
|
|
@@ -3147,12 +2452,6 @@ class AccessorMagicService {
|
|
|
3147
2452
|
}
|
|
3148
2453
|
return 'unknown error';
|
|
3149
2454
|
}
|
|
3150
|
-
/**
|
|
3151
|
-
* Sets a user-supplied value to the specified control
|
|
3152
|
-
* @param controlName
|
|
3153
|
-
* @param value
|
|
3154
|
-
* @param refreshDisplay
|
|
3155
|
-
*/
|
|
3156
2455
|
setValueToControl(controlName, value, refreshDisplay) {
|
|
3157
2456
|
if (typeof refreshDisplay === "undefined")
|
|
3158
2457
|
refreshDisplay = true;
|
|
@@ -3161,44 +2460,28 @@ class AccessorMagicService {
|
|
|
3161
2460
|
guiEvent.param = refreshDisplay;
|
|
3162
2461
|
this.task.insertEvent(guiEvent);
|
|
3163
2462
|
}
|
|
3164
|
-
/**
|
|
3165
|
-
* @ignore
|
|
3166
|
-
*/
|
|
3167
2463
|
isDataviewEmpty() {
|
|
3168
2464
|
return this.task.Records.isEmptyDataView;
|
|
3169
2465
|
}
|
|
3170
|
-
/**
|
|
3171
|
-
* simulates a click event on the specified control, for the Magic engine
|
|
3172
|
-
* @param controlName
|
|
3173
|
-
* @param rowId
|
|
3174
|
-
*/
|
|
3175
2466
|
simulateClick(controlName, rowId) {
|
|
3176
2467
|
if (typeof rowId === "undefined")
|
|
3177
2468
|
rowId = 0;
|
|
3178
2469
|
this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
|
|
3179
2470
|
}
|
|
3180
|
-
/**
|
|
3181
|
-
* Return Boolean TRUE if user logged in Else it will return FALSE
|
|
3182
|
-
*/
|
|
3183
2471
|
isLoggedIn() {
|
|
3184
2472
|
return this.task.getIsLoggenIn();
|
|
3185
2473
|
}
|
|
3186
|
-
/**
|
|
3187
|
-
* Returns JS object containing the records with all table fields.
|
|
3188
|
-
*/
|
|
3189
2474
|
GetFormRecords() {
|
|
3190
2475
|
let rowId = 0;
|
|
3191
2476
|
let recArray;
|
|
3192
2477
|
if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
|
|
3193
2478
|
let recList = this.task.Records.list;
|
|
3194
2479
|
let tableControls = new Array();
|
|
3195
|
-
//Generate list of table fields names
|
|
3196
2480
|
for (const key in this.task.template) {
|
|
3197
2481
|
if (this.task.template[key] == '1')
|
|
3198
2482
|
tableControls.push(key);
|
|
3199
2483
|
}
|
|
3200
2484
|
recArray = new Array();
|
|
3201
|
-
//Update the records as list of objects with values for table fields.
|
|
3202
2485
|
if (tableControls.length > 0) {
|
|
3203
2486
|
recList.forEach((ctrlMetaData) => {
|
|
3204
2487
|
if (this.task.Records.isRowCreated(rowId)) {
|
|
@@ -3214,20 +2497,23 @@ class AccessorMagicService {
|
|
|
3214
2497
|
}
|
|
3215
2498
|
return recArray;
|
|
3216
2499
|
}
|
|
2500
|
+
SetCookie(name, value, expires, path, domain, secure, sameSite) {
|
|
2501
|
+
CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
|
|
2502
|
+
}
|
|
2503
|
+
GetCookie(name) {
|
|
2504
|
+
return CookieService.getCookie(name);
|
|
2505
|
+
}
|
|
2506
|
+
DeleteCookie(name) {
|
|
2507
|
+
return CookieService.deleteCookie(name);
|
|
2508
|
+
}
|
|
3217
2509
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
2510
|
+
AccessorMagicService.ɵfac = function AccessorMagicService_Factory(t) { return new (t || AccessorMagicService)(ɵɵinject(TaskMagicService)); };
|
|
2511
|
+
AccessorMagicService.ɵprov = ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
|
|
2512
|
+
(function () { ɵsetClassMetadata(AccessorMagicService, [{
|
|
3221
2513
|
type: Injectable
|
|
3222
2514
|
}], function () { return [{ type: TaskMagicService }]; }, null); })();
|
|
3223
2515
|
|
|
3224
|
-
/**
|
|
3225
|
-
* Central place for adding the Magic services
|
|
3226
|
-
*/
|
|
3227
2516
|
class MagicServices {
|
|
3228
|
-
/**
|
|
3229
|
-
* @ignore
|
|
3230
|
-
*/
|
|
3231
2517
|
constructor(task, subformService, tableService, titleService, mgAccessorService) {
|
|
3232
2518
|
this.task = task;
|
|
3233
2519
|
this.subformService = subformService;
|
|
@@ -3240,74 +2526,36 @@ class MagicServices {
|
|
|
3240
2526
|
task.mgAccessorService = mgAccessorService;
|
|
3241
2527
|
}
|
|
3242
2528
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
2529
|
+
MagicServices.ɵfac = function MagicServices_Factory(t) { return new (t || MagicServices)(ɵɵinject(TaskMagicService), ɵɵinject(SubformMagicService), ɵɵinject(TableMagicService), ɵɵinject(TitleMagicService), ɵɵinject(AccessorMagicService)); };
|
|
2530
|
+
MagicServices.ɵprov = ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
|
|
2531
|
+
(function () { ɵsetClassMetadata(MagicServices, [{
|
|
3246
2532
|
type: Injectable
|
|
3247
2533
|
}], function () { return [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }]; }, null); })();
|
|
3248
2534
|
|
|
3249
|
-
/**
|
|
3250
|
-
* Base component representing a Magic task
|
|
3251
|
-
*/
|
|
3252
2535
|
class TaskBaseMagicComponent {
|
|
3253
|
-
/**
|
|
3254
|
-
*
|
|
3255
|
-
* @param ref changes-detector object
|
|
3256
|
-
* @param magicServices Access point for all Magic services
|
|
3257
|
-
*/
|
|
3258
2536
|
constructor(ref, magicServices) {
|
|
3259
2537
|
this.ref = ref;
|
|
3260
2538
|
this.magicServices = magicServices;
|
|
3261
|
-
/**
|
|
3262
|
-
* @ignore
|
|
3263
|
-
*/
|
|
3264
2539
|
this.magicProperties = MagicProperties;
|
|
3265
2540
|
}
|
|
3266
|
-
/**
|
|
3267
|
-
* Returns the Magic task service
|
|
3268
|
-
* @returns
|
|
3269
|
-
*/
|
|
3270
2541
|
get task() {
|
|
3271
2542
|
return this.magicServices.task;
|
|
3272
2543
|
}
|
|
3273
|
-
/**
|
|
3274
|
-
* Returns the Magic subform service
|
|
3275
|
-
* @returns
|
|
3276
|
-
*/
|
|
3277
2544
|
get mgSub() {
|
|
3278
2545
|
return this.magicServices.subformService;
|
|
3279
2546
|
}
|
|
3280
|
-
/**
|
|
3281
|
-
* Returns the Magic table service
|
|
3282
|
-
* @returns
|
|
3283
|
-
*/
|
|
3284
2547
|
get tableService() {
|
|
3285
2548
|
return this.magicServices.tableService;
|
|
3286
2549
|
}
|
|
3287
|
-
/**
|
|
3288
|
-
* Returns the Magic accessor service
|
|
3289
|
-
* @returns
|
|
3290
|
-
*/
|
|
3291
2550
|
get mg() {
|
|
3292
2551
|
return this.magicServices.mgAccessorService;
|
|
3293
2552
|
}
|
|
3294
|
-
/**
|
|
3295
|
-
* Returns the task Id
|
|
3296
|
-
* @returns
|
|
3297
|
-
*/
|
|
3298
2553
|
get taskId() {
|
|
3299
2554
|
return this.task.taskId;
|
|
3300
2555
|
}
|
|
3301
|
-
/**
|
|
3302
|
-
* Returns the FormGroup for screen-mode forms
|
|
3303
|
-
* @returns
|
|
3304
|
-
*/
|
|
3305
2556
|
get screenFormGroup() {
|
|
3306
2557
|
return this.task.ScreenModeControls;
|
|
3307
2558
|
}
|
|
3308
|
-
/**
|
|
3309
|
-
* Interface implementation
|
|
3310
|
-
*/
|
|
3311
2559
|
ngOnInit() {
|
|
3312
2560
|
let subscription = this.task.detectChanges.pipe().subscribe(c => {
|
|
3313
2561
|
this.ref.detectChanges();
|
|
@@ -3315,48 +2563,19 @@ class TaskBaseMagicComponent {
|
|
|
3315
2563
|
this.task.initTask(this.taskIdParam, this.taskDescription);
|
|
3316
2564
|
this.createFormControlsAccessor(this.screenFormGroup);
|
|
3317
2565
|
this.setInputDateFormat();
|
|
3318
|
-
// subcribe to custom property changes
|
|
3319
2566
|
this.task.customPropertiesSubject.pipe().subscribe(property => {
|
|
3320
2567
|
this.PropertyChanged(property.propertyName, property.rowId, property.value);
|
|
3321
2568
|
});
|
|
3322
|
-
// subcribe to records count changes
|
|
3323
2569
|
this.task.recordsCountChangeSubject.pipe().subscribe(value => {
|
|
3324
2570
|
this.RecordsCountChanged(value);
|
|
3325
2571
|
});
|
|
3326
2572
|
}
|
|
3327
|
-
/**
|
|
3328
|
-
* @ignore
|
|
3329
|
-
*/
|
|
3330
2573
|
createFormControlsAccessor(formGroup) { }
|
|
3331
|
-
/**
|
|
3332
|
-
* @ignore
|
|
3333
|
-
*/
|
|
3334
2574
|
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
2575
|
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
|
-
*/
|
|
2576
|
+
}
|
|
3354
2577
|
RecordsCountChanged(recordsCount) {
|
|
3355
|
-
// intentionally left blank because the implementation should be in the derived class
|
|
3356
2578
|
}
|
|
3357
|
-
/**
|
|
3358
|
-
* Interface implementation
|
|
3359
|
-
*/
|
|
3360
2579
|
ngAfterViewInit() {
|
|
3361
2580
|
this.mgSub.init();
|
|
3362
2581
|
}
|
|
@@ -3366,16 +2585,13 @@ class TaskBaseMagicComponent {
|
|
|
3366
2585
|
this.task.oldPageSize = this.tableService.getPageSize();
|
|
3367
2586
|
}
|
|
3368
2587
|
}
|
|
3369
|
-
/**
|
|
3370
|
-
* Interface implementation
|
|
3371
|
-
*/
|
|
3372
2588
|
ngOnDestroy() {
|
|
3373
2589
|
this.task.dispose();
|
|
3374
2590
|
}
|
|
3375
2591
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
2592
|
+
TaskBaseMagicComponent.ɵfac = function TaskBaseMagicComponent_Factory(t) { return new (t || TaskBaseMagicComponent)(ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(MagicServices)); };
|
|
2593
|
+
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 });
|
|
2594
|
+
(function () { ɵsetClassMetadata(TaskBaseMagicComponent, [{
|
|
3379
2595
|
type: Component,
|
|
3380
2596
|
args: [{
|
|
3381
2597
|
selector: 'task-magic',
|
|
@@ -3388,22 +2604,13 @@ class TaskBaseMagicComponent {
|
|
|
3388
2604
|
type: Input
|
|
3389
2605
|
}] }); })();
|
|
3390
2606
|
|
|
3391
|
-
/**
|
|
3392
|
-
* @ignore
|
|
3393
|
-
*/
|
|
3394
2607
|
class RowMagicDirective {
|
|
3395
2608
|
constructor(_task, element) {
|
|
3396
2609
|
this._task = _task;
|
|
3397
2610
|
this.element = element;
|
|
3398
|
-
/**
|
|
3399
|
-
* @ignore
|
|
3400
|
-
*/
|
|
3401
2611
|
this.rowChangedSubscriber = null;
|
|
3402
2612
|
this.htmlElement = this.element.nativeElement;
|
|
3403
2613
|
}
|
|
3404
|
-
/**
|
|
3405
|
-
* Initializes this object
|
|
3406
|
-
*/
|
|
3407
2614
|
ngOnInit() {
|
|
3408
2615
|
this.rowChangedSubscriber = this._task
|
|
3409
2616
|
.OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
|
|
@@ -3418,16 +2625,7 @@ class RowMagicDirective {
|
|
|
3418
2625
|
return (rect.top >= parentRect.top &&
|
|
3419
2626
|
rect.bottom <= parentRect.bottom);
|
|
3420
2627
|
}
|
|
3421
|
-
/**
|
|
3422
|
-
* Cleanup
|
|
3423
|
-
*/
|
|
3424
2628
|
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
2629
|
if (this.rowChangedSubscriber !== null) {
|
|
3432
2630
|
this.rowChangedSubscriber.unsubscribe();
|
|
3433
2631
|
}
|
|
@@ -3435,15 +2633,16 @@ class RowMagicDirective {
|
|
|
3435
2633
|
onClick($event) {
|
|
3436
2634
|
if (this.rowId != '') {
|
|
3437
2635
|
this._task.insertEvent(getGuiEventObj('click', "magicRow", +this.rowId));
|
|
3438
|
-
|
|
2636
|
+
if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
|
|
2637
|
+
event.cancelBubble = true;
|
|
3439
2638
|
}
|
|
3440
2639
|
}
|
|
3441
2640
|
}
|
|
3442
|
-
|
|
3443
|
-
|
|
2641
|
+
RowMagicDirective.ɵfac = function RowMagicDirective_Factory(t) { return new (t || RowMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef)); };
|
|
2642
|
+
RowMagicDirective.ɵdir = ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
3444
2643
|
ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
|
|
3445
2644
|
} }, inputs: { rowId: ["magicRow", "rowId"] } });
|
|
3446
|
-
|
|
2645
|
+
(function () { ɵsetClassMetadata(RowMagicDirective, [{
|
|
3447
2646
|
type: Directive,
|
|
3448
2647
|
args: [{
|
|
3449
2648
|
selector: '[magicRow]'
|
|
@@ -3456,35 +2655,16 @@ class RowMagicDirective {
|
|
|
3456
2655
|
args: ['click', ['$event']]
|
|
3457
2656
|
}] }); })();
|
|
3458
2657
|
|
|
3459
|
-
/**
|
|
3460
|
-
* Connects HTML elements to the Magic Web Client engine
|
|
3461
|
-
*/
|
|
3462
2658
|
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
2659
|
constructor(_task, element, renderer, vcRef, magicRow) {
|
|
3472
2660
|
this._task = _task;
|
|
3473
2661
|
this.element = element;
|
|
3474
2662
|
this.renderer = renderer;
|
|
3475
2663
|
this.vcRef = vcRef;
|
|
3476
2664
|
this.magicRow = magicRow;
|
|
3477
|
-
/**
|
|
3478
|
-
* Collection of event handlers for this element
|
|
3479
|
-
*/
|
|
3480
2665
|
this.eventHandlers = {};
|
|
3481
2666
|
this.eventsOnlyVal = false;
|
|
3482
2667
|
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
2668
|
if (!(typeof magicRow === 'undefined' || magicRow === null))
|
|
3489
2669
|
this.rowId = magicRow.rowId;
|
|
3490
2670
|
}
|
|
@@ -3493,40 +2673,28 @@ class MagicDirective {
|
|
|
3493
2673
|
this.selector = 'magic';
|
|
3494
2674
|
}
|
|
3495
2675
|
;
|
|
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
2676
|
set eventsOnly(val) {
|
|
3500
2677
|
console.log('eventsOnly');
|
|
3501
2678
|
this.eventsOnlyVal = true;
|
|
3502
2679
|
}
|
|
3503
2680
|
;
|
|
3504
|
-
/**
|
|
3505
|
-
* Get the task service
|
|
3506
|
-
* @returns
|
|
3507
|
-
*/
|
|
3508
2681
|
get task() {
|
|
3509
2682
|
return this._task;
|
|
3510
2683
|
}
|
|
3511
|
-
/**
|
|
3512
|
-
* Register to the events this element may need to handle
|
|
3513
|
-
*/
|
|
3514
2684
|
regEvents() {
|
|
3515
|
-
// Handle events for which event handler may be removed and restored
|
|
3516
2685
|
this.eventHandlers['focusin'] = this.OnFocus.bind(this);
|
|
3517
2686
|
Object.keys(this.eventHandlers).forEach((key) => {
|
|
3518
2687
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
|
3519
2688
|
});
|
|
3520
|
-
|
|
3521
|
-
let events = ['click', 'mousedown', 'dblclick']; // ,'resize', 'load', 'unload'
|
|
2689
|
+
let events = ['click', 'mousedown', 'dblclick'];
|
|
3522
2690
|
events.forEach(event => {
|
|
3523
2691
|
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
2692
|
let fromButton = false;
|
|
3526
2693
|
if (this.htmlElement instanceof HTMLButtonElement)
|
|
3527
2694
|
fromButton = true;
|
|
3528
2695
|
this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
|
|
3529
|
-
|
|
2696
|
+
if (MagicDirective.noOfAutoCompleteBoxesOpened < 1)
|
|
2697
|
+
e.cancelBubble = true;
|
|
3530
2698
|
});
|
|
3531
2699
|
});
|
|
3532
2700
|
this.renderer.listen(this.htmlElement, 'change', (e) => {
|
|
@@ -3537,13 +2705,10 @@ class MagicDirective {
|
|
|
3537
2705
|
this.task.insertEvent(guiEvent);
|
|
3538
2706
|
}
|
|
3539
2707
|
});
|
|
3540
|
-
// handle the input event
|
|
3541
2708
|
fromEvent(this.htmlElement, 'input').pipe(map((event) => {
|
|
3542
2709
|
return event.target.value;
|
|
3543
|
-
}), debounceTime(200)
|
|
3544
|
-
).subscribe((x) => {
|
|
2710
|
+
}), debounceTime(200)).subscribe((x) => {
|
|
3545
2711
|
if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
|
|
3546
|
-
// Don't support character binding for date/time values
|
|
3547
2712
|
let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
|
|
3548
2713
|
if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
|
|
3549
2714
|
this.task.mgAccessorService.setValueToControl(this.id, x, true);
|
|
@@ -3569,25 +2734,16 @@ class MagicDirective {
|
|
|
3569
2734
|
(e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
|
|
3570
2735
|
if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
|
|
3571
2736
|
guiEvent.keyCode = e.keyCode;
|
|
3572
|
-
|
|
3573
|
-
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && !MagicDirective.opened)
|
|
2737
|
+
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
|
|
3574
2738
|
e.cancelBubble = true;
|
|
3575
2739
|
this.task.insertEvent(guiEvent);
|
|
3576
2740
|
}
|
|
3577
2741
|
});
|
|
3578
2742
|
}
|
|
3579
|
-
/**
|
|
3580
|
-
* Handle focus event
|
|
3581
|
-
*/
|
|
3582
2743
|
OnFocus() {
|
|
3583
2744
|
this.task.insertEvent(getGuiEventObj('focus', this.id, +this.rowId));
|
|
3584
2745
|
event.cancelBubble = true;
|
|
3585
2746
|
}
|
|
3586
|
-
/**
|
|
3587
|
-
* Is the command's element the same as this directive's element
|
|
3588
|
-
* @param command
|
|
3589
|
-
* @returns true/false
|
|
3590
|
-
*/
|
|
3591
2747
|
IsSameElement(command) {
|
|
3592
2748
|
let line = command.line;
|
|
3593
2749
|
if (this.task.isTableControl(command.CtrlName))
|
|
@@ -3596,17 +2752,9 @@ class MagicDirective {
|
|
|
3596
2752
|
(line === +this.rowId ||
|
|
3597
2753
|
(line === 0 && isNullOrUndefined(this.rowId))));
|
|
3598
2754
|
}
|
|
3599
|
-
/**
|
|
3600
|
-
* Is the command's element the same as this directive's component
|
|
3601
|
-
* @param command
|
|
3602
|
-
* @returns true/false
|
|
3603
|
-
*/
|
|
3604
2755
|
IsSameComponent(command) {
|
|
3605
2756
|
return (command.controlName === this.id);
|
|
3606
2757
|
}
|
|
3607
|
-
/**
|
|
3608
|
-
* @ignore
|
|
3609
|
-
*/
|
|
3610
2758
|
regUpdatesUI() {
|
|
3611
2759
|
this.subscribeRefreshDom = this.task
|
|
3612
2760
|
.refreshDom.pipe(filter(c => this.IsSameElement(c)))
|
|
@@ -3628,17 +2776,10 @@ class MagicDirective {
|
|
|
3628
2776
|
this.handleInteractiveCommands(command);
|
|
3629
2777
|
});
|
|
3630
2778
|
}
|
|
3631
|
-
/**
|
|
3632
|
-
* Initializes this object
|
|
3633
|
-
*/
|
|
3634
2779
|
ngOnInit() {
|
|
3635
2780
|
this.regEvents();
|
|
3636
2781
|
this.regUpdatesUI();
|
|
3637
2782
|
}
|
|
3638
|
-
/**
|
|
3639
|
-
* Handles the commands received from the Magic WebClient engine
|
|
3640
|
-
* @param command
|
|
3641
|
-
*/
|
|
3642
2783
|
handleCommand(command) {
|
|
3643
2784
|
switch (command.CommandType) {
|
|
3644
2785
|
case CommandType.SET_PROPERTY:
|
|
@@ -3646,16 +2787,12 @@ class MagicDirective {
|
|
|
3646
2787
|
break;
|
|
3647
2788
|
case CommandType.SET_FOCUS:
|
|
3648
2789
|
this.focusUnlistener();
|
|
3649
|
-
// Do not set focus on connected zoom button
|
|
3650
2790
|
if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
|
|
3651
2791
|
this.htmlElement.focus();
|
|
3652
2792
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, 'focusin', this.eventHandlers['focusin']);
|
|
3653
2793
|
break;
|
|
3654
2794
|
}
|
|
3655
2795
|
}
|
|
3656
|
-
/**
|
|
3657
|
-
* handle the interactive commands like CallJS
|
|
3658
|
-
*/
|
|
3659
2796
|
handleInteractiveCommands(command) {
|
|
3660
2797
|
switch (command._commandType) {
|
|
3661
2798
|
case InteractiveCommandType.CALL_JS:
|
|
@@ -3665,24 +2802,18 @@ class MagicDirective {
|
|
|
3665
2802
|
let resultString = '';
|
|
3666
2803
|
try {
|
|
3667
2804
|
if (!isNullOrUndefined(magicComponent[methodName])) {
|
|
3668
|
-
// invoke the method on instance of magic componenet
|
|
3669
2805
|
resultString = magicComponent[methodName].apply(magicComponent, args);
|
|
3670
2806
|
}
|
|
3671
2807
|
else
|
|
3672
|
-
console.error('Instance method ' + methodName + ' does not exists');
|
|
2808
|
+
console.error('Instance method ' + methodName + ' does not exists');
|
|
3673
2809
|
}
|
|
3674
2810
|
catch (e) {
|
|
3675
|
-
// any other exception
|
|
3676
2811
|
console.error(e.message);
|
|
3677
2812
|
}
|
|
3678
|
-
command.resultString = resultString;
|
|
2813
|
+
command.resultString = resultString;
|
|
3679
2814
|
break;
|
|
3680
2815
|
}
|
|
3681
2816
|
}
|
|
3682
|
-
/**
|
|
3683
|
-
* Handle the Magic set-property command
|
|
3684
|
-
* @param command
|
|
3685
|
-
*/
|
|
3686
2817
|
handleSetProperty(command) {
|
|
3687
2818
|
switch (command.Operation) {
|
|
3688
2819
|
case HtmlProperties.ReadOnly:
|
|
@@ -3693,17 +2824,15 @@ class MagicDirective {
|
|
|
3693
2824
|
break;
|
|
3694
2825
|
}
|
|
3695
2826
|
}
|
|
3696
|
-
/**
|
|
3697
|
-
* Cleanup
|
|
3698
|
-
*/
|
|
3699
2827
|
ngOnDestroy() {
|
|
3700
2828
|
this.subscribeRefreshDom.unsubscribe();
|
|
3701
2829
|
}
|
|
3702
2830
|
}
|
|
3703
2831
|
MagicDirective.opened = false;
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
2832
|
+
MagicDirective.noOfAutoCompleteBoxesOpened = 0;
|
|
2833
|
+
MagicDirective.ɵfac = function MagicDirective_Factory(t) { return new (t || MagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
|
2834
|
+
MagicDirective.ɵdir = ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", rowId: "rowId" } });
|
|
2835
|
+
(function () { ɵsetClassMetadata(MagicDirective, [{
|
|
3707
2836
|
type: Directive,
|
|
3708
2837
|
args: [{
|
|
3709
2838
|
selector: '[magic]'
|
|
@@ -3720,9 +2849,6 @@ MagicDirective.opened = false;
|
|
|
3720
2849
|
type: Input
|
|
3721
2850
|
}] }); })();
|
|
3722
2851
|
|
|
3723
|
-
/**
|
|
3724
|
-
* @ignore
|
|
3725
|
-
*/
|
|
3726
2852
|
class NoControlMagicDirective extends MagicDirective {
|
|
3727
2853
|
constructor(_task, element, renderer, vcRef, magicRow) {
|
|
3728
2854
|
super(_task, element, renderer, vcRef, magicRow);
|
|
@@ -3757,12 +2883,10 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3757
2883
|
}
|
|
3758
2884
|
}
|
|
3759
2885
|
}
|
|
3760
|
-
// is the div a tab control
|
|
3761
2886
|
isTabControl() {
|
|
3762
2887
|
return this.htmlElement instanceof HTMLDivElement &&
|
|
3763
2888
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
|
|
3764
2889
|
}
|
|
3765
|
-
// is the div a radio buttons wrapper
|
|
3766
2890
|
isRadio() {
|
|
3767
2891
|
return this.htmlElement instanceof HTMLDivElement &&
|
|
3768
2892
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
|
|
@@ -3771,7 +2895,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3771
2895
|
super.handleCommand(command);
|
|
3772
2896
|
switch (command.CommandType) {
|
|
3773
2897
|
case CommandType.SET_CLASS:
|
|
3774
|
-
//remove the class which was replaced by this new one, as registered in the ControlMetadata
|
|
3775
2898
|
const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
|
|
3776
2899
|
if (controlMetadata.removedClass != '') {
|
|
3777
2900
|
this.htmlElement.classList.remove(controlMetadata.removedClass);
|
|
@@ -3784,7 +2907,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3784
2907
|
this.htmlElement.innerText = command.value;
|
|
3785
2908
|
if (this.htmlElement instanceof HTMLSelectElement)
|
|
3786
2909
|
this.htmlElement.value = command.value;
|
|
3787
|
-
if (this.htmlElement instanceof HTMLAnchorElement)
|
|
2910
|
+
if (this.htmlElement instanceof HTMLAnchorElement)
|
|
3788
2911
|
this.htmlElement.text = command.value;
|
|
3789
2912
|
if (this.htmlElement instanceof HTMLInputElement) {
|
|
3790
2913
|
if (this.htmlElement.type === "checkbox") {
|
|
@@ -3808,7 +2931,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3808
2931
|
break;
|
|
3809
2932
|
}
|
|
3810
2933
|
}
|
|
3811
|
-
// handle set-property commands
|
|
3812
2934
|
handleSetProperty(command) {
|
|
3813
2935
|
super.handleSetProperty(command);
|
|
3814
2936
|
switch (command.Operation) {
|
|
@@ -3824,7 +2946,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3824
2946
|
break;
|
|
3825
2947
|
case HtmlProperties.ItemsList:
|
|
3826
2948
|
if (this.htmlElement instanceof HTMLSelectElement) {
|
|
3827
|
-
// clear the list
|
|
3828
2949
|
var len = this.htmlElement.length;
|
|
3829
2950
|
for (var i = len - 1; i >= 0; i--) {
|
|
3830
2951
|
this.htmlElement.remove(i);
|
|
@@ -3866,8 +2987,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3866
2987
|
let child = tabControl.children[i];
|
|
3867
2988
|
const layer = child.getAttribute('layer') - 1;
|
|
3868
2989
|
if (child instanceof HTMLButtonElement) {
|
|
3869
|
-
|
|
3870
|
-
if (layer == command.obj1) { // compare int to string
|
|
2990
|
+
if (layer == command.obj1) {
|
|
3871
2991
|
child.classList.add('tab_button_active');
|
|
3872
2992
|
}
|
|
3873
2993
|
else {
|
|
@@ -3875,7 +2995,6 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3875
2995
|
}
|
|
3876
2996
|
}
|
|
3877
2997
|
else {
|
|
3878
|
-
// not a buton - hide unselected tabpages
|
|
3879
2998
|
let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
|
|
3880
2999
|
child.setAttribute('style', style);
|
|
3881
3000
|
}
|
|
@@ -3897,9 +3016,9 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3897
3016
|
}
|
|
3898
3017
|
}
|
|
3899
3018
|
}
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3019
|
+
NoControlMagicDirective.ɵfac = function NoControlMagicDirective_Factory(t) { return new (t || NoControlMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
|
3020
|
+
NoControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: ["magicnc", "magic"] }, features: [ɵɵInheritDefinitionFeature] });
|
|
3021
|
+
(function () { ɵsetClassMetadata(NoControlMagicDirective, [{
|
|
3903
3022
|
type: Directive,
|
|
3904
3023
|
args: [{
|
|
3905
3024
|
selector: '[magicnc]'
|
|
@@ -3911,127 +3030,9 @@ class NoControlMagicDirective extends MagicDirective {
|
|
|
3911
3030
|
args: ['magicnc']
|
|
3912
3031
|
}] }); })();
|
|
3913
3032
|
|
|
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
3033
|
class Constants {
|
|
4030
3034
|
}
|
|
4031
3035
|
Constants.DATE_FMT = 'dd/MMM/yyyy';
|
|
4032
|
-
/**
|
|
4033
|
-
* @ignore
|
|
4034
|
-
*/
|
|
4035
3036
|
class DateMagicPipe extends DatePipe {
|
|
4036
3037
|
constructor(_task) {
|
|
4037
3038
|
super('en-US');
|
|
@@ -4043,7 +3044,6 @@ class DateMagicPipe extends DatePipe {
|
|
|
4043
3044
|
let mgDateFormatter = new MgDateFormatter();
|
|
4044
3045
|
if (!isNullOrUndefined(value) && mask !== null) {
|
|
4045
3046
|
formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
|
|
4046
|
-
// If control is label control of table, due to query mode, then save the format here.
|
|
4047
3047
|
if (formatStr != null && this._task.isTableControl(controlId)) {
|
|
4048
3048
|
if (this._task.mgInputDateFormat == null)
|
|
4049
3049
|
this._task.mgInputDateFormat = formatStr;
|
|
@@ -4057,9 +3057,9 @@ class DateMagicPipe extends DatePipe {
|
|
|
4057
3057
|
return value;
|
|
4058
3058
|
}
|
|
4059
3059
|
}
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
3060
|
+
DateMagicPipe.ɵfac = function DateMagicPipe_Factory(t) { return new (t || DateMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
|
|
3061
|
+
DateMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
|
|
3062
|
+
(function () { ɵsetClassMetadata(DateMagicPipe, [{
|
|
4063
3063
|
type: Pipe,
|
|
4064
3064
|
args: [{
|
|
4065
3065
|
name: 'magicDate'
|
|
@@ -4124,17 +3124,11 @@ class MgDateFormatter {
|
|
|
4124
3124
|
return formatStr.ToString();
|
|
4125
3125
|
}
|
|
4126
3126
|
else
|
|
4127
|
-
return "dd-mm-yyyy";
|
|
3127
|
+
return "dd-mm-yyyy";
|
|
4128
3128
|
}
|
|
4129
3129
|
}
|
|
4130
3130
|
|
|
4131
|
-
/**
|
|
4132
|
-
* Perform Magic validation on input controls which hold alphanumeric strings
|
|
4133
|
-
*/
|
|
4134
3131
|
class MgformatMagicDirective {
|
|
4135
|
-
/**
|
|
4136
|
-
* @ignore
|
|
4137
|
-
*/
|
|
4138
3132
|
constructor(magicDir, _task) {
|
|
4139
3133
|
this.magicDir = magicDir;
|
|
4140
3134
|
this._task = _task;
|
|
@@ -4142,20 +3136,12 @@ class MgformatMagicDirective {
|
|
|
4142
3136
|
ngAfterViewInit() {
|
|
4143
3137
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4144
3138
|
if (control != null && this._task.mgInputDateFormat == null) {
|
|
4145
|
-
// get the first date control's format.
|
|
4146
3139
|
let pic = this._task.GetControlPictureMask(this.magicDir.id);
|
|
4147
3140
|
if (pic.getAttr() == StorageAttribute.DATE) {
|
|
4148
3141
|
this.formatDate(pic);
|
|
4149
3142
|
}
|
|
4150
3143
|
}
|
|
4151
3144
|
}
|
|
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
3145
|
onFocusEvent($event) {
|
|
4160
3146
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4161
3147
|
if (control != null) {
|
|
@@ -4180,10 +3166,6 @@ class MgformatMagicDirective {
|
|
|
4180
3166
|
}
|
|
4181
3167
|
}
|
|
4182
3168
|
}
|
|
4183
|
-
/**
|
|
4184
|
-
* @ignore
|
|
4185
|
-
*/
|
|
4186
|
-
// This can be used to implement uppercase/lower case
|
|
4187
3169
|
onChangeEvent($event) {
|
|
4188
3170
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
|
4189
3171
|
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
|
@@ -4201,9 +3183,6 @@ class MgformatMagicDirective {
|
|
|
4201
3183
|
let mgDateFormatter = new MgDateFormatter();
|
|
4202
3184
|
this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
|
|
4203
3185
|
}
|
|
4204
|
-
/**
|
|
4205
|
-
* @ignore
|
|
4206
|
-
*/
|
|
4207
3186
|
formatAlphaUnicode(control) {
|
|
4208
3187
|
let value = control.value;
|
|
4209
3188
|
if (value !== null && value.length > 0) {
|
|
@@ -4229,9 +3208,6 @@ class MgformatMagicDirective {
|
|
|
4229
3208
|
control.setValue(valueStr.ToString());
|
|
4230
3209
|
}
|
|
4231
3210
|
}
|
|
4232
|
-
/**
|
|
4233
|
-
* @ignore
|
|
4234
|
-
*/
|
|
4235
3211
|
formatBoolean(control) {
|
|
4236
3212
|
let value = control.value;
|
|
4237
3213
|
if (value !== null && value.length > 0) {
|
|
@@ -4244,12 +3220,6 @@ class MgformatMagicDirective {
|
|
|
4244
3220
|
}
|
|
4245
3221
|
}
|
|
4246
3222
|
}
|
|
4247
|
-
/**
|
|
4248
|
-
* @ignore
|
|
4249
|
-
*/
|
|
4250
|
-
/// <summary>
|
|
4251
|
-
/// generate pattern from fld's format
|
|
4252
|
-
/// </summary>
|
|
4253
3223
|
generatePattern(attribute, pic) {
|
|
4254
3224
|
let pattern = "";
|
|
4255
3225
|
switch (attribute) {
|
|
@@ -4263,12 +3233,6 @@ class MgformatMagicDirective {
|
|
|
4263
3233
|
}
|
|
4264
3234
|
return pattern;
|
|
4265
3235
|
}
|
|
4266
|
-
/**
|
|
4267
|
-
* @ignore
|
|
4268
|
-
*/
|
|
4269
|
-
/// <summary>
|
|
4270
|
-
/// generate pattern for Alpha
|
|
4271
|
-
/// </summary>
|
|
4272
3236
|
generatePatternForNumber(pic) {
|
|
4273
3237
|
let patternStr = new StringBuilder();
|
|
4274
3238
|
patternStr.Append("^");
|
|
@@ -4281,9 +3245,6 @@ class MgformatMagicDirective {
|
|
|
4281
3245
|
patternStr.Append("$");
|
|
4282
3246
|
return patternStr.ToString();
|
|
4283
3247
|
}
|
|
4284
|
-
/**
|
|
4285
|
-
* @ignore
|
|
4286
|
-
*/
|
|
4287
3248
|
isPatternGenerationNeeded(attr, pic) {
|
|
4288
3249
|
switch (attr) {
|
|
4289
3250
|
case StorageAttribute.NUMERIC:
|
|
@@ -4293,12 +3254,6 @@ class MgformatMagicDirective {
|
|
|
4293
3254
|
return (pic.getMaskChars() > 0) ? true : false;
|
|
4294
3255
|
}
|
|
4295
3256
|
}
|
|
4296
|
-
/**
|
|
4297
|
-
* @ignore
|
|
4298
|
-
*/
|
|
4299
|
-
/// <summary>
|
|
4300
|
-
/// generate pattern for Alpha
|
|
4301
|
-
/// </summary>
|
|
4302
3257
|
generatePatternForAlpha(pic) {
|
|
4303
3258
|
let cnt = 0;
|
|
4304
3259
|
let inputAllChars = false;
|
|
@@ -4309,7 +3264,6 @@ class MgformatMagicDirective {
|
|
|
4309
3264
|
let pattern = new StringBuilder();
|
|
4310
3265
|
pattern.Append("^");
|
|
4311
3266
|
for (let i = 0; i < mask.length;) {
|
|
4312
|
-
//start new subset , if mask[i] is one of these.
|
|
4313
3267
|
if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
|
|
4314
3268
|
|| mask.charCodeAt(i) == PICInterface.PIC_X)) {
|
|
4315
3269
|
pattern.Append("(");
|
|
@@ -4355,13 +3309,9 @@ class MgformatMagicDirective {
|
|
|
4355
3309
|
pattern.Append("$");
|
|
4356
3310
|
return pattern.ToString();
|
|
4357
3311
|
}
|
|
4358
|
-
/**
|
|
4359
|
-
* @ignore
|
|
4360
|
-
*/
|
|
4361
3312
|
getDirectiveCount(mask, idx, pattern, changeInPattern) {
|
|
4362
3313
|
changeInPattern.value = false;
|
|
4363
3314
|
let patternCount = 0;
|
|
4364
|
-
// find max chars
|
|
4365
3315
|
while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
|
|
4366
3316
|
patternCount++;
|
|
4367
3317
|
idx++;
|
|
@@ -4370,9 +3320,6 @@ class MgformatMagicDirective {
|
|
|
4370
3320
|
changeInPattern.value = true;
|
|
4371
3321
|
return patternCount;
|
|
4372
3322
|
}
|
|
4373
|
-
/**
|
|
4374
|
-
* @ignore
|
|
4375
|
-
*/
|
|
4376
3323
|
IsPatternMatches(mask, pattern) {
|
|
4377
3324
|
for (let i = 0; i < pattern.length; i++)
|
|
4378
3325
|
if (mask == pattern[i])
|
|
@@ -4380,11 +3327,11 @@ class MgformatMagicDirective {
|
|
|
4380
3327
|
return false;
|
|
4381
3328
|
}
|
|
4382
3329
|
}
|
|
4383
|
-
|
|
4384
|
-
|
|
3330
|
+
MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(ɵɵdirectiveInject(MagicDirective), ɵɵdirectiveInject(TaskMagicService)); };
|
|
3331
|
+
MgformatMagicDirective.ɵdir = ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4385
3332
|
ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
|
|
4386
3333
|
} } });
|
|
4387
|
-
|
|
3334
|
+
(function () { ɵsetClassMetadata(MgformatMagicDirective, [{
|
|
4388
3335
|
type: Directive,
|
|
4389
3336
|
args: [{
|
|
4390
3337
|
selector: '[mgFormat]'
|
|
@@ -4397,9 +3344,6 @@ class MgformatMagicDirective {
|
|
|
4397
3344
|
args: ['change', ['$event']]
|
|
4398
3345
|
}] }); })();
|
|
4399
3346
|
|
|
4400
|
-
/**
|
|
4401
|
-
* @ignore
|
|
4402
|
-
*/
|
|
4403
3347
|
class TimeMagicPipe extends DatePipe {
|
|
4404
3348
|
constructor(_task) {
|
|
4405
3349
|
super('en-US');
|
|
@@ -4435,33 +3379,20 @@ class TimeMagicPipe extends DatePipe {
|
|
|
4435
3379
|
return value;
|
|
4436
3380
|
}
|
|
4437
3381
|
}
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
3382
|
+
TimeMagicPipe.ɵfac = function TimeMagicPipe_Factory(t) { return new (t || TimeMagicPipe)(ɵɵdirectiveInject(TaskMagicService)); };
|
|
3383
|
+
TimeMagicPipe.ɵpipe = ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
|
|
3384
|
+
(function () { ɵsetClassMetadata(TimeMagicPipe, [{
|
|
4441
3385
|
type: Pipe,
|
|
4442
3386
|
args: [{
|
|
4443
3387
|
name: 'magicTime'
|
|
4444
3388
|
}]
|
|
4445
3389
|
}], function () { return [{ type: TaskMagicService }]; }, null); })();
|
|
4446
3390
|
|
|
4447
|
-
/**
|
|
4448
|
-
* Validates the field range.
|
|
4449
|
-
*/
|
|
4450
3391
|
class RangeValidatorMagicDirective {
|
|
4451
|
-
/**
|
|
4452
|
-
*
|
|
4453
|
-
* @param _task The task service
|
|
4454
|
-
* @param vcRef
|
|
4455
|
-
*/
|
|
4456
3392
|
constructor(_task, vcRef) {
|
|
4457
3393
|
this._task = _task;
|
|
4458
3394
|
this.vcRef = vcRef;
|
|
4459
3395
|
}
|
|
4460
|
-
/**
|
|
4461
|
-
* Validation method
|
|
4462
|
-
* @param c FormControl to validate
|
|
4463
|
-
* @returns If validation fails, return error message, else returns null
|
|
4464
|
-
*/
|
|
4465
3396
|
validate(c) {
|
|
4466
3397
|
let controlName;
|
|
4467
3398
|
controlName = this.getControlName(c);
|
|
@@ -4483,23 +3414,20 @@ class RangeValidatorMagicDirective {
|
|
|
4483
3414
|
};
|
|
4484
3415
|
}
|
|
4485
3416
|
}
|
|
4486
|
-
/**
|
|
4487
|
-
* @ignore
|
|
4488
|
-
*/
|
|
4489
3417
|
getControlName(c) {
|
|
4490
3418
|
const formGroup = c.parent.controls;
|
|
4491
3419
|
return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
|
|
4492
3420
|
}
|
|
4493
3421
|
}
|
|
4494
|
-
|
|
4495
|
-
|
|
3422
|
+
RangeValidatorMagicDirective.ɵfac = function RangeValidatorMagicDirective_Factory(t) { return new (t || RangeValidatorMagicDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ViewContainerRef)); };
|
|
3423
|
+
RangeValidatorMagicDirective.ɵdir = ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [ɵɵProvidersFeature([
|
|
4496
3424
|
{
|
|
4497
3425
|
provide: NG_VALIDATORS,
|
|
4498
3426
|
useExisting: RangeValidatorMagicDirective,
|
|
4499
3427
|
multi: true,
|
|
4500
3428
|
}
|
|
4501
3429
|
])] });
|
|
4502
|
-
|
|
3430
|
+
(function () { ɵsetClassMetadata(RangeValidatorMagicDirective, [{
|
|
4503
3431
|
type: Directive,
|
|
4504
3432
|
args: [{
|
|
4505
3433
|
selector: '[rangevalidator] ',
|
|
@@ -4519,48 +3447,29 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
4519
3447
|
const ctx_r0 = ɵɵnextContext();
|
|
4520
3448
|
ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
|
|
4521
3449
|
} }
|
|
4522
|
-
/**
|
|
4523
|
-
* Represents a Magic subform
|
|
4524
|
-
*/
|
|
4525
3450
|
class SubformMagicComponent {
|
|
4526
|
-
/**
|
|
4527
|
-
* @ignore
|
|
4528
|
-
*/
|
|
4529
3451
|
constructor(vcRef, mgSub) {
|
|
4530
3452
|
this.vcRef = vcRef;
|
|
4531
3453
|
this.mgSub = mgSub;
|
|
4532
|
-
/**
|
|
4533
|
-
* @ignore
|
|
4534
|
-
*/
|
|
4535
3454
|
this.component = null;
|
|
4536
|
-
// For angular 10 - find the component from views
|
|
4537
3455
|
this.component = (this.vcRef._hostView).find(v => !isNullOrUndefined(v));
|
|
4538
3456
|
}
|
|
4539
|
-
/**
|
|
4540
|
-
* @ignore
|
|
4541
|
-
*/
|
|
4542
3457
|
set magic(val) { this.id = val; }
|
|
4543
3458
|
;
|
|
4544
|
-
/**
|
|
4545
|
-
* @ignore
|
|
4546
|
-
*/
|
|
4547
3459
|
get Component() {
|
|
4548
3460
|
return this.mgSub.mgGetComp(this.id);
|
|
4549
3461
|
}
|
|
4550
|
-
/**
|
|
4551
|
-
* @ignore
|
|
4552
|
-
*/
|
|
4553
3462
|
get Parameters() {
|
|
4554
3463
|
return this.mgSub.mgGetParameters(this.id);
|
|
4555
3464
|
}
|
|
4556
3465
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
3466
|
+
SubformMagicComponent.ɵfac = function SubformMagicComponent_Factory(t) { return new (t || SubformMagicComponent)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(SubformMagicService)); };
|
|
3467
|
+
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
3468
|
ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
|
|
4560
3469
|
} if (rf & 2) {
|
|
4561
3470
|
ɵɵproperty("ngIf", ctx.Component);
|
|
4562
3471
|
} }, directives: [NgIf, DynamicComponent, DynamicIoDirective], encapsulation: 2 });
|
|
4563
|
-
|
|
3472
|
+
(function () { ɵsetClassMetadata(SubformMagicComponent, [{
|
|
4564
3473
|
type: Component,
|
|
4565
3474
|
args: [{
|
|
4566
3475
|
selector: 'magic-subform',
|
|
@@ -4600,24 +3509,14 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
4600
3509
|
ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
|
|
4601
3510
|
} }
|
|
4602
3511
|
const _c1$1 = ["*"];
|
|
4603
|
-
/**
|
|
4604
|
-
* Represents a Magic subform
|
|
4605
|
-
*/
|
|
4606
3512
|
class ErrorMagicComponent {
|
|
4607
|
-
/**
|
|
4608
|
-
* @ignore
|
|
4609
|
-
*/
|
|
4610
3513
|
constructor(_task, mgService, changeDetectorRef) {
|
|
4611
3514
|
this._task = _task;
|
|
4612
3515
|
this.mgService = mgService;
|
|
4613
3516
|
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
3517
|
this.defaultDisplay = true;
|
|
4616
3518
|
this.rowId = "0";
|
|
4617
3519
|
}
|
|
4618
|
-
/**
|
|
4619
|
-
* @ignore
|
|
4620
|
-
*/
|
|
4621
3520
|
set magic(val) {
|
|
4622
3521
|
this.id = val;
|
|
4623
3522
|
}
|
|
@@ -4631,10 +3530,6 @@ class ErrorMagicComponent {
|
|
|
4631
3530
|
this.changeDetectorRef.detectChanges();
|
|
4632
3531
|
}
|
|
4633
3532
|
;
|
|
4634
|
-
/**
|
|
4635
|
-
* returns true if the html element has no children
|
|
4636
|
-
* @param element
|
|
4637
|
-
*/
|
|
4638
3533
|
isEmpty(element) {
|
|
4639
3534
|
const nodes = element.childNodes;
|
|
4640
3535
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -4645,9 +3540,6 @@ class ErrorMagicComponent {
|
|
|
4645
3540
|
}
|
|
4646
3541
|
return true;
|
|
4647
3542
|
}
|
|
4648
|
-
/**
|
|
4649
|
-
* @ignore
|
|
4650
|
-
*/
|
|
4651
3543
|
HasErrors(id) {
|
|
4652
3544
|
if (!isUndefined(id)) {
|
|
4653
3545
|
let control = this._task.getFormControl(this.rowId, id);
|
|
@@ -4669,8 +3561,8 @@ class ErrorMagicComponent {
|
|
|
4669
3561
|
return false;
|
|
4670
3562
|
}
|
|
4671
3563
|
}
|
|
4672
|
-
|
|
4673
|
-
|
|
3564
|
+
ErrorMagicComponent.ɵfac = function ErrorMagicComponent_Factory(t) { return new (t || ErrorMagicComponent)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(AccessorMagicService), ɵɵdirectiveInject(ChangeDetectorRef)); };
|
|
3565
|
+
ErrorMagicComponent.ɵcmp = ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
|
|
4674
3566
|
ɵɵviewQuery(_c0$2, true);
|
|
4675
3567
|
} if (rf & 2) {
|
|
4676
3568
|
var _t;
|
|
@@ -4681,7 +3573,7 @@ class ErrorMagicComponent {
|
|
|
4681
3573
|
} if (rf & 2) {
|
|
4682
3574
|
ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
|
|
4683
3575
|
} }, directives: [NgIf], encapsulation: 2 });
|
|
4684
|
-
|
|
3576
|
+
(function () { ɵsetClassMetadata(ErrorMagicComponent, [{
|
|
4685
3577
|
type: Component,
|
|
4686
3578
|
args: [{
|
|
4687
3579
|
selector: 'mgError',
|
|
@@ -4706,28 +3598,19 @@ class ErrorMagicComponent {
|
|
|
4706
3598
|
args: ['customContent', { static: false }]
|
|
4707
3599
|
}] }); })();
|
|
4708
3600
|
|
|
4709
|
-
/**
|
|
4710
|
-
* Directive for checkboxes, to handle the 'change' event
|
|
4711
|
-
*/
|
|
4712
3601
|
class CheckboxMagicDirective {
|
|
4713
|
-
/**
|
|
4714
|
-
* @ignore
|
|
4715
|
-
*/
|
|
4716
3602
|
constructor(magicDirective) {
|
|
4717
3603
|
this.magicDirective = magicDirective;
|
|
4718
3604
|
}
|
|
4719
|
-
/**
|
|
4720
|
-
* Handles the Checkbox 'change' event - pass it to the Magic engine
|
|
4721
|
-
*/
|
|
4722
3605
|
onChange($event) {
|
|
4723
3606
|
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
4724
3607
|
}
|
|
4725
3608
|
}
|
|
4726
|
-
|
|
4727
|
-
|
|
3609
|
+
CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3610
|
+
CheckboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4728
3611
|
ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
4729
3612
|
} } });
|
|
4730
|
-
|
|
3613
|
+
(function () { ɵsetClassMetadata(CheckboxMagicDirective, [{
|
|
4731
3614
|
type: Directive,
|
|
4732
3615
|
args: [{
|
|
4733
3616
|
selector: `
|
|
@@ -4739,25 +3622,19 @@ class CheckboxMagicDirective {
|
|
|
4739
3622
|
args: ['change', ['$event']]
|
|
4740
3623
|
}] }); })();
|
|
4741
3624
|
|
|
4742
|
-
/**
|
|
4743
|
-
* Directive for comboboxes, to handle the 'change' event
|
|
4744
|
-
*/
|
|
4745
3625
|
class ComboboxMagicDirective {
|
|
4746
3626
|
constructor(magicDirective) {
|
|
4747
3627
|
this.magicDirective = magicDirective;
|
|
4748
3628
|
}
|
|
4749
|
-
/**
|
|
4750
|
-
* Handles the Combobox 'change' event - pass it to the Magic engine
|
|
4751
|
-
*/
|
|
4752
3629
|
onChange($event) {
|
|
4753
3630
|
this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
4754
3631
|
}
|
|
4755
3632
|
}
|
|
4756
|
-
|
|
4757
|
-
|
|
3633
|
+
ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3634
|
+
ComboboxMagicDirective.ɵdir = ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4758
3635
|
ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
4759
3636
|
} } });
|
|
4760
|
-
|
|
3637
|
+
(function () { ɵsetClassMetadata(ComboboxMagicDirective, [{
|
|
4761
3638
|
type: Directive,
|
|
4762
3639
|
args: [{
|
|
4763
3640
|
selector: `select[magic]:not([multiple])`,
|
|
@@ -4767,20 +3644,14 @@ class ComboboxMagicDirective {
|
|
|
4767
3644
|
args: ['change', ['$event']]
|
|
4768
3645
|
}] }); })();
|
|
4769
3646
|
|
|
4770
|
-
/**
|
|
4771
|
-
* This service supports custom actions on magic exit
|
|
4772
|
-
*/
|
|
4773
3647
|
class ExitMagicService {
|
|
4774
|
-
/**
|
|
4775
|
-
* Override this method to implement custom logic on magic exit
|
|
4776
|
-
*/
|
|
4777
3648
|
exitMagic() {
|
|
4778
3649
|
console.log("Magic application terminated");
|
|
4779
3650
|
}
|
|
4780
3651
|
}
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
3652
|
+
ExitMagicService.ɵfac = function ExitMagicService_Factory(t) { return new (t || ExitMagicService)(); };
|
|
3653
|
+
ExitMagicService.ɵprov = ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
|
|
3654
|
+
(function () { ɵsetClassMetadata(ExitMagicService, [{
|
|
4784
3655
|
type: Injectable
|
|
4785
3656
|
}], null, null); })();
|
|
4786
3657
|
|
|
@@ -4804,19 +3675,7 @@ function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
|
4804
3675
|
function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
|
|
4805
3676
|
ɵɵelement(0, "div", 9);
|
|
4806
3677
|
} }
|
|
4807
|
-
/**
|
|
4808
|
-
* Root Magic component
|
|
4809
|
-
*/
|
|
4810
3678
|
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
3679
|
constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, exitMagicService) {
|
|
4821
3680
|
this.engineMagicService = engineMagicService;
|
|
4822
3681
|
this.componentList = componentList;
|
|
@@ -4826,32 +3685,22 @@ class MagicShellComponent {
|
|
|
4826
3685
|
this.httpClient = httpClient;
|
|
4827
3686
|
this.pendingCommandsCollector = pendingCommandsCollector;
|
|
4828
3687
|
this.exitMagicService = exitMagicService;
|
|
4829
|
-
/**
|
|
4830
|
-
* Root component to be displayed in the window
|
|
4831
|
-
*/
|
|
4832
3688
|
this.RootComponent = null;
|
|
4833
3689
|
this.magicEngineTerminated = false;
|
|
4834
3690
|
this.initialize();
|
|
4835
3691
|
this.setTitle();
|
|
4836
3692
|
}
|
|
4837
|
-
/**
|
|
4838
|
-
* Before-unload event listener
|
|
4839
|
-
* @param event
|
|
4840
|
-
*/
|
|
4841
3693
|
onBeforeUnload(event) {
|
|
4842
3694
|
if (this.engineMagicService.TransCacheExists()) {
|
|
4843
|
-
// Show the confirmation box before unloading the browser
|
|
4844
3695
|
event.returnValue = 'Are you sure?';
|
|
4845
3696
|
return 'Are you sure?';
|
|
4846
3697
|
}
|
|
4847
3698
|
else {
|
|
4848
|
-
// terminate the magic server context using fetch API with keep-alive
|
|
4849
3699
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
|
4850
3700
|
this.magicEngineTerminated = true;
|
|
4851
3701
|
}
|
|
4852
3702
|
}
|
|
4853
3703
|
onUnload(event) {
|
|
4854
|
-
// Chrome provides an opportunity to terminate the context after user approves the browser unload alert
|
|
4855
3704
|
if (!this.magicEngineTerminated)
|
|
4856
3705
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
|
4857
3706
|
}
|
|
@@ -4862,26 +3711,13 @@ class MagicShellComponent {
|
|
|
4862
3711
|
setViewContainerRef(vcRef) {
|
|
4863
3712
|
this.overlayWindowsContainerViewRef = vcRef;
|
|
4864
3713
|
}
|
|
4865
|
-
/**
|
|
4866
|
-
* Initialization of Magic mechanisms
|
|
4867
|
-
*/
|
|
4868
3714
|
initialize() {
|
|
4869
3715
|
this.registerUICommands();
|
|
4870
3716
|
}
|
|
4871
|
-
/**
|
|
4872
|
-
* Set the title
|
|
4873
|
-
*/
|
|
4874
3717
|
setTitle() {
|
|
4875
3718
|
const newTitle = this.componentList.title;
|
|
4876
3719
|
this.titleService.setTitle(newTitle);
|
|
4877
3720
|
}
|
|
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
3721
|
setComponent(formName, taskId, taskDescription, isModal) {
|
|
4886
3722
|
this.pendingCommandsCollector.startCollecting();
|
|
4887
3723
|
if (isModal) {
|
|
@@ -4893,9 +3729,6 @@ class MagicShellComponent {
|
|
|
4893
3729
|
}
|
|
4894
3730
|
this.changeDetectorRef.detectChanges();
|
|
4895
3731
|
}
|
|
4896
|
-
/**
|
|
4897
|
-
* @ignore
|
|
4898
|
-
*/
|
|
4899
3732
|
registerUICommands() {
|
|
4900
3733
|
this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
|
|
4901
3734
|
.subscribe(command => {
|
|
@@ -4907,10 +3740,6 @@ class MagicShellComponent {
|
|
|
4907
3740
|
GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
|
|
4908
3741
|
});
|
|
4909
3742
|
}
|
|
4910
|
-
/**
|
|
4911
|
-
* Execute commands received from the Magic WebClient engine
|
|
4912
|
-
* @param command
|
|
4913
|
-
*/
|
|
4914
3743
|
executeCommand(command) {
|
|
4915
3744
|
switch (command.CommandType) {
|
|
4916
3745
|
case CommandType.OPEN_FORM:
|
|
@@ -4925,7 +3754,7 @@ class MagicShellComponent {
|
|
|
4925
3754
|
this.RootComponentParameters = {};
|
|
4926
3755
|
this.changeDetectorRef.detectChanges();
|
|
4927
3756
|
}
|
|
4928
|
-
else {
|
|
3757
|
+
else {
|
|
4929
3758
|
this.overlayWindowService.close(command.str);
|
|
4930
3759
|
this.changeDetectorRef.detectChanges();
|
|
4931
3760
|
}
|
|
@@ -4943,20 +3772,21 @@ class MagicShellComponent {
|
|
|
4943
3772
|
if (this.exitMagicService)
|
|
4944
3773
|
this.exitMagicService.exitMagic();
|
|
4945
3774
|
break;
|
|
3775
|
+
case CommandType.SHOW_HTML_ERROR:
|
|
3776
|
+
window.document.write(command.str);
|
|
3777
|
+
break;
|
|
4946
3778
|
}
|
|
4947
3779
|
}
|
|
4948
3780
|
}
|
|
4949
|
-
|
|
4950
|
-
|
|
3781
|
+
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)); };
|
|
3782
|
+
MagicShellComponent.ɵcmp = ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
|
|
4951
3783
|
ɵɵstaticViewQuery(_c0$3, true);
|
|
4952
3784
|
} if (rf & 2) {
|
|
4953
3785
|
var _t;
|
|
4954
3786
|
ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
|
|
4955
3787
|
} }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
|
|
4956
3788
|
ɵɵ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) {
|
|
3789
|
+
} }, 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
3790
|
ɵɵelementStart(0, "div", null, 0);
|
|
4961
3791
|
ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 1);
|
|
4962
3792
|
ɵɵelement(3, "div", 2, 3);
|
|
@@ -4969,13 +3799,11 @@ class MagicShellComponent {
|
|
|
4969
3799
|
ɵɵadvance(3);
|
|
4970
3800
|
ɵɵproperty("ngIf", ctx.showSpinner);
|
|
4971
3801
|
} }, 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
|
-
|
|
3802
|
+
(function () { ɵsetClassMetadata(MagicShellComponent, [{
|
|
4973
3803
|
type: Component,
|
|
4974
3804
|
args: [{
|
|
4975
3805
|
selector: 'magic-root',
|
|
4976
|
-
providers: [
|
|
4977
|
-
// ExitMagicService
|
|
4978
|
-
],
|
|
3806
|
+
providers: [],
|
|
4979
3807
|
template: `
|
|
4980
3808
|
<div #magicRoot>
|
|
4981
3809
|
<ndc-dynamic
|
|
@@ -5042,25 +3870,19 @@ class MagicShellComponent {
|
|
|
5042
3870
|
args: ['window:unload', ['$event']]
|
|
5043
3871
|
}] }); })();
|
|
5044
3872
|
|
|
5045
|
-
/**
|
|
5046
|
-
* @ignore
|
|
5047
|
-
*/
|
|
5048
3873
|
const CHECKBOX_VALUE_ACCESSOR = {
|
|
5049
3874
|
provide: NG_VALUE_ACCESSOR,
|
|
5050
3875
|
useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
|
|
5051
3876
|
multi: true,
|
|
5052
3877
|
};
|
|
5053
|
-
/**
|
|
5054
|
-
* Value accessor for Checkbox without a FormControl
|
|
5055
|
-
*/
|
|
5056
3878
|
class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
|
|
5057
3879
|
}
|
|
5058
|
-
|
|
5059
|
-
|
|
3880
|
+
MagicCheckboxControlValueAccessor.ɵfac = function MagicCheckboxControlValueAccessor_Factory(t) { return ɵMagicCheckboxControlValueAccessor_BaseFactory(t || MagicCheckboxControlValueAccessor); };
|
|
3881
|
+
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
3882
|
ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
|
|
5061
3883
|
} }, features: [ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
|
|
5062
|
-
const ɵMagicCheckboxControlValueAccessor_BaseFactory =
|
|
5063
|
-
|
|
3884
|
+
const ɵMagicCheckboxControlValueAccessor_BaseFactory = ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor);
|
|
3885
|
+
(function () { ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
|
|
5064
3886
|
type: Directive,
|
|
5065
3887
|
args: [{
|
|
5066
3888
|
selector: `
|
|
@@ -5073,25 +3895,19 @@ const ɵMagicCheckboxControlValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInh
|
|
|
5073
3895
|
}]
|
|
5074
3896
|
}], null, null); })();
|
|
5075
3897
|
|
|
5076
|
-
/**
|
|
5077
|
-
* @ignore
|
|
5078
|
-
*/
|
|
5079
3898
|
const MAGIC_DEFAULT_VALUE_ACCESSOR = {
|
|
5080
3899
|
provide: NG_VALUE_ACCESSOR,
|
|
5081
3900
|
useExisting: forwardRef(() => MagicDefaultValueAccessor),
|
|
5082
3901
|
multi: true
|
|
5083
3902
|
};
|
|
5084
|
-
/**
|
|
5085
|
-
* @ignore
|
|
5086
|
-
*/
|
|
5087
3903
|
class MagicDefaultValueAccessor extends DefaultValueAccessor {
|
|
5088
3904
|
}
|
|
5089
|
-
|
|
5090
|
-
|
|
3905
|
+
MagicDefaultValueAccessor.ɵfac = function MagicDefaultValueAccessor_Factory(t) { return ɵMagicDefaultValueAccessor_BaseFactory(t || MagicDefaultValueAccessor); };
|
|
3906
|
+
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
3907
|
ɵɵ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
3908
|
} }, exportAs: ["magic"], features: [ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), ɵɵInheritDefinitionFeature] });
|
|
5093
|
-
const ɵMagicDefaultValueAccessor_BaseFactory =
|
|
5094
|
-
|
|
3909
|
+
const ɵMagicDefaultValueAccessor_BaseFactory = ɵɵgetInheritedFactory(MagicDefaultValueAccessor);
|
|
3910
|
+
(function () { ɵsetClassMetadata(MagicDefaultValueAccessor, [{
|
|
5095
3911
|
type: Directive,
|
|
5096
3912
|
args: [{
|
|
5097
3913
|
selector: `
|
|
@@ -5109,25 +3925,19 @@ const ɵMagicDefaultValueAccessor_BaseFactory = /*@__PURE__*/ ɵɵgetInheritedFa
|
|
|
5109
3925
|
}]
|
|
5110
3926
|
}], null, null); })();
|
|
5111
3927
|
|
|
5112
|
-
/**
|
|
5113
|
-
* Directive for checkboxes which should not have a form control
|
|
5114
|
-
*/
|
|
5115
3928
|
class CheckboxNoFormControlMagicDirective {
|
|
5116
3929
|
constructor(magicDirective) {
|
|
5117
3930
|
this.magicDirective = magicDirective;
|
|
5118
3931
|
}
|
|
5119
|
-
/**
|
|
5120
|
-
* Handle the 'Checkbox' change event - pass it to the Magic engine
|
|
5121
|
-
*/
|
|
5122
3932
|
onChange($event) {
|
|
5123
3933
|
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
|
5124
3934
|
}
|
|
5125
3935
|
}
|
|
5126
|
-
|
|
5127
|
-
|
|
3936
|
+
CheckboxNoFormControlMagicDirective.ɵfac = function CheckboxNoFormControlMagicDirective_Factory(t) { return new (t || CheckboxNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3937
|
+
CheckboxNoFormControlMagicDirective.ɵdir = ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
5128
3938
|
ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
5129
3939
|
} } });
|
|
5130
|
-
|
|
3940
|
+
(function () { ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
|
|
5131
3941
|
type: Directive,
|
|
5132
3942
|
args: [{
|
|
5133
3943
|
selector: `
|
|
@@ -5139,25 +3949,19 @@ class CheckboxNoFormControlMagicDirective {
|
|
|
5139
3949
|
args: ['change', ['$event']]
|
|
5140
3950
|
}] }); })();
|
|
5141
3951
|
|
|
5142
|
-
/**
|
|
5143
|
-
* Directive for non-checkbox input controls which do not have a form control
|
|
5144
|
-
*/
|
|
5145
3952
|
class InputNoFormControlMagicDirective {
|
|
5146
3953
|
constructor(magicDirective) {
|
|
5147
3954
|
this.magicDirective = magicDirective;
|
|
5148
3955
|
}
|
|
5149
|
-
/**
|
|
5150
|
-
* Handles the 'change' event - pass it to the Magic engine
|
|
5151
|
-
*/
|
|
5152
3956
|
onChange($event) {
|
|
5153
3957
|
this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
|
|
5154
3958
|
}
|
|
5155
3959
|
}
|
|
5156
|
-
|
|
5157
|
-
|
|
3960
|
+
InputNoFormControlMagicDirective.ɵfac = function InputNoFormControlMagicDirective_Factory(t) { return new (t || InputNoFormControlMagicDirective)(ɵɵdirectiveInject(MagicDirective)); };
|
|
3961
|
+
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
3962
|
ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
|
5159
3963
|
} } });
|
|
5160
|
-
|
|
3964
|
+
(function () { ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
|
|
5161
3965
|
type: Directive,
|
|
5162
3966
|
args: [{
|
|
5163
3967
|
selector: `input[magic]:([noFormControl]):not([type=checkbox]),
|
|
@@ -5173,14 +3977,6 @@ const DATE_VALUE_ACCESSOR = {
|
|
|
5173
3977
|
useExisting: forwardRef(() => DateValueAccessor),
|
|
5174
3978
|
multi: true
|
|
5175
3979
|
};
|
|
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
3980
|
class DateValueAccessor {
|
|
5185
3981
|
constructor(renderer, elementRef) {
|
|
5186
3982
|
this.renderer = renderer;
|
|
@@ -5188,7 +3984,6 @@ class DateValueAccessor {
|
|
|
5188
3984
|
this.onChange = (_) => { };
|
|
5189
3985
|
this.onTouched = () => { };
|
|
5190
3986
|
}
|
|
5191
|
-
/** Writes a new value to the element (model -> view) */
|
|
5192
3987
|
writeValue(value) {
|
|
5193
3988
|
if (!value) {
|
|
5194
3989
|
this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
|
|
@@ -5196,26 +3991,23 @@ class DateValueAccessor {
|
|
|
5196
3991
|
}
|
|
5197
3992
|
this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
|
|
5198
3993
|
}
|
|
5199
|
-
/** Registers a callback function, called when value changes (view -> model) */
|
|
5200
3994
|
registerOnChange(fn) {
|
|
5201
3995
|
this.onChange = v => fn(v instanceof Date
|
|
5202
3996
|
? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
|
|
5203
3997
|
: v);
|
|
5204
3998
|
}
|
|
5205
|
-
/** Registers a callback function, called when the control is blurred */
|
|
5206
3999
|
registerOnTouched(fn) {
|
|
5207
4000
|
this.onTouched = fn;
|
|
5208
4001
|
}
|
|
5209
|
-
/** Enables or disables the element when the control status changes */
|
|
5210
4002
|
setDisabledState(isDisabled) {
|
|
5211
4003
|
this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
|
|
5212
4004
|
}
|
|
5213
4005
|
}
|
|
5214
|
-
|
|
5215
|
-
|
|
4006
|
+
DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ElementRef)); };
|
|
4007
|
+
DateValueAccessor.ɵdir = ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
|
5216
4008
|
ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
|
|
5217
4009
|
} }, features: [ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
|
|
5218
|
-
|
|
4010
|
+
(function () { ɵsetClassMetadata(DateValueAccessor, [{
|
|
5219
4011
|
type: Directive,
|
|
5220
4012
|
args: [{
|
|
5221
4013
|
selector: "[dateInput]",
|
|
@@ -5229,25 +4021,12 @@ class DateValueAccessor {
|
|
|
5229
4021
|
args: ["blur", []]
|
|
5230
4022
|
}] }); })();
|
|
5231
4023
|
|
|
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
4024
|
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
4025
|
constructor(_task, element, renderer, vcRef) {
|
|
5244
4026
|
this._task = _task;
|
|
5245
4027
|
this.element = element;
|
|
5246
4028
|
this.renderer = renderer;
|
|
5247
4029
|
this.vcRef = vcRef;
|
|
5248
|
-
/**
|
|
5249
|
-
* Collection of event handlers for this element
|
|
5250
|
-
*/
|
|
5251
4030
|
this.eventHandlers = {};
|
|
5252
4031
|
this.eventsOnlyVal = false;
|
|
5253
4032
|
this.htmlElement = this.element.nativeElement;
|
|
@@ -5257,40 +4036,26 @@ class NonMagicControlDirective {
|
|
|
5257
4036
|
this.selector = 'NonMagicControl';
|
|
5258
4037
|
}
|
|
5259
4038
|
;
|
|
5260
|
-
/**
|
|
5261
|
-
* Get the task service
|
|
5262
|
-
* @returns
|
|
5263
|
-
*/
|
|
5264
4039
|
get task() {
|
|
5265
4040
|
return this._task;
|
|
5266
4041
|
}
|
|
5267
|
-
/**
|
|
5268
|
-
* Register to the events this element may need to handle
|
|
5269
|
-
*/
|
|
5270
4042
|
regEvents() {
|
|
5271
|
-
// Handle events for which event handler may be removed and restored
|
|
5272
4043
|
this.eventHandlers['focusin'] = this.OnFocus.bind(this);
|
|
5273
4044
|
Object.keys(this.eventHandlers).forEach((key) => {
|
|
5274
4045
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
|
5275
4046
|
});
|
|
5276
4047
|
}
|
|
5277
|
-
/**
|
|
5278
|
-
* Handle focus event
|
|
5279
|
-
*/
|
|
5280
4048
|
OnFocus() {
|
|
5281
4049
|
this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', "", -1));
|
|
5282
4050
|
event.cancelBubble = true;
|
|
5283
4051
|
}
|
|
5284
|
-
/**
|
|
5285
|
-
* Initialize this object
|
|
5286
|
-
*/
|
|
5287
4052
|
ngOnInit() {
|
|
5288
4053
|
this.regEvents();
|
|
5289
4054
|
}
|
|
5290
4055
|
}
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
4056
|
+
NonMagicControlDirective.ɵfac = function NonMagicControlDirective_Factory(t) { return new (t || NonMagicControlDirective)(ɵɵdirectiveInject(TaskMagicService), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2), ɵɵdirectiveInject(ViewContainerRef)); };
|
|
4057
|
+
NonMagicControlDirective.ɵdir = ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: ["NonMagicControl", "magic"] } });
|
|
4058
|
+
(function () { ɵsetClassMetadata(NonMagicControlDirective, [{
|
|
5294
4059
|
type: Directive,
|
|
5295
4060
|
args: [{
|
|
5296
4061
|
selector: '[NonMagicControl]'
|
|
@@ -5300,9 +4065,6 @@ class NonMagicControlDirective {
|
|
|
5300
4065
|
args: ['NonMagicControl']
|
|
5301
4066
|
}] }); })();
|
|
5302
4067
|
|
|
5303
|
-
/**
|
|
5304
|
-
* @ignore
|
|
5305
|
-
*/
|
|
5306
4068
|
const decs = [
|
|
5307
4069
|
MagicDirective,
|
|
5308
4070
|
CheckboxMagicDirective,
|
|
@@ -5333,9 +4095,6 @@ const decs = [
|
|
|
5333
4095
|
MagicFocusDirective,
|
|
5334
4096
|
MagicViewContainerRef
|
|
5335
4097
|
];
|
|
5336
|
-
/**
|
|
5337
|
-
* @ignore
|
|
5338
|
-
*/
|
|
5339
4098
|
class MagicModule {
|
|
5340
4099
|
static forRoot() {
|
|
5341
4100
|
return {
|
|
@@ -5350,12 +4109,11 @@ class MagicModule {
|
|
|
5350
4109
|
};
|
|
5351
4110
|
}
|
|
5352
4111
|
}
|
|
5353
|
-
|
|
5354
|
-
|
|
4112
|
+
MagicModule.ɵmod = ɵɵdefineNgModule({ type: MagicModule });
|
|
4113
|
+
MagicModule.ɵinj = ɵɵdefineInjector({ factory: function MagicModule_Factory(t) { return new (t || MagicModule)(); }, providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [[
|
|
5355
4114
|
CommonModule,
|
|
5356
4115
|
FormsModule,
|
|
5357
4116
|
ReactiveFormsModule,
|
|
5358
|
-
//ThemeModule,
|
|
5359
4117
|
RouterModule,
|
|
5360
4118
|
DynamicModule,
|
|
5361
4119
|
HttpClientModule
|
|
@@ -5390,7 +4148,6 @@ class MagicModule {
|
|
|
5390
4148
|
MagicViewContainerRef], imports: [CommonModule,
|
|
5391
4149
|
FormsModule,
|
|
5392
4150
|
ReactiveFormsModule,
|
|
5393
|
-
//ThemeModule,
|
|
5394
4151
|
RouterModule,
|
|
5395
4152
|
DynamicModule,
|
|
5396
4153
|
HttpClientModule], exports: [MagicDirective,
|
|
@@ -5421,7 +4178,7 @@ class MagicModule {
|
|
|
5421
4178
|
NonMagicControlDirective,
|
|
5422
4179
|
MagicFocusDirective,
|
|
5423
4180
|
MagicViewContainerRef] }); })();
|
|
5424
|
-
|
|
4181
|
+
(function () { ɵsetClassMetadata(MagicModule, [{
|
|
5425
4182
|
type: NgModule,
|
|
5426
4183
|
args: [{
|
|
5427
4184
|
declarations: [...decs],
|
|
@@ -5431,12 +4188,10 @@ class MagicModule {
|
|
|
5431
4188
|
CommonModule,
|
|
5432
4189
|
FormsModule,
|
|
5433
4190
|
ReactiveFormsModule,
|
|
5434
|
-
//ThemeModule,
|
|
5435
4191
|
RouterModule,
|
|
5436
4192
|
DynamicModule,
|
|
5437
4193
|
HttpClientModule
|
|
5438
4194
|
],
|
|
5439
|
-
//Customizable providers
|
|
5440
4195
|
providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
|
|
5441
4196
|
}]
|
|
5442
4197
|
}], null, null); })();
|
|
@@ -5524,7 +4279,7 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
|
5524
4279
|
this.mgdtfmt = this.task.mgInputDateFormat;
|
|
5525
4280
|
if (displayFormat === 'input') {
|
|
5526
4281
|
if (this.mgdtfmt == null)
|
|
5527
|
-
this.mgdtfmt = 'M/d/yyyy';
|
|
4282
|
+
this.mgdtfmt = 'M/d/yyyy';
|
|
5528
4283
|
return formatDate(date, this.mgdtfmt, this.locale);
|
|
5529
4284
|
}
|
|
5530
4285
|
else {
|
|
@@ -5532,9 +4287,9 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
|
5532
4287
|
}
|
|
5533
4288
|
}
|
|
5534
4289
|
}
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
4290
|
+
MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(ɵɵinject(Platform), ɵɵinject(TaskMagicService)); };
|
|
4291
|
+
MgDateAdapter.ɵprov = ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
|
|
4292
|
+
(function () { ɵsetClassMetadata(MgDateAdapter, [{
|
|
5538
4293
|
type: Injectable
|
|
5539
4294
|
}], function () { return [{ type: Platform }, { type: TaskMagicService }]; }, null); })();
|
|
5540
4295
|
|
|
@@ -5542,9 +4297,6 @@ const matDateProviders = [
|
|
|
5542
4297
|
{ provide: DateAdapter, useClass: MgDateAdapter },
|
|
5543
4298
|
{ provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
|
|
5544
4299
|
];
|
|
5545
|
-
/**
|
|
5546
|
-
* Magic service providers
|
|
5547
|
-
*/
|
|
5548
4300
|
const basicMagicProviders = [
|
|
5549
4301
|
MagicServices,
|
|
5550
4302
|
TaskMagicService,
|
|
@@ -5558,18 +4310,7 @@ const magicProviders = [
|
|
|
5558
4310
|
TableMagicService
|
|
5559
4311
|
];
|
|
5560
4312
|
|
|
5561
|
-
/**
|
|
5562
|
-
* @ignore
|
|
5563
|
-
*/
|
|
5564
|
-
///////////////////////////////////////////////////////////
|
|
5565
|
-
// class to hold gui-related helper methods
|
|
5566
|
-
///////////////////////////////////////////////////////////
|
|
5567
4313
|
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
4314
|
static addChildren(parent, children, selector) {
|
|
5574
4315
|
for (var i = 0; i < parent.children.length; i++) {
|
|
5575
4316
|
if (typeof parent.children[i].attributes[selector] !== "undefined") {
|
|
@@ -5578,9 +4319,6 @@ class utils {
|
|
|
5578
4319
|
this.addChildren(parent.children[i], children, selector);
|
|
5579
4320
|
}
|
|
5580
4321
|
}
|
|
5581
|
-
///////////////////////////////////////////////////////////
|
|
5582
|
-
// Calculate the distance between the control and the supplied x,y coordinates
|
|
5583
|
-
///////////////////////////////////////////////////////////
|
|
5584
4322
|
static getDistance(control, x, y) {
|
|
5585
4323
|
let left = control.clientLeft, top = control.clientTop;
|
|
5586
4324
|
let dx, dy;
|
|
@@ -5607,9 +4345,6 @@ class utils {
|
|
|
5607
4345
|
const ret = (dx * dx + dy * dy);
|
|
5608
4346
|
return ret;
|
|
5609
4347
|
}
|
|
5610
|
-
///////////////////////////////////////////////////////////
|
|
5611
|
-
//
|
|
5612
|
-
///////////////////////////////////////////////////////////
|
|
5613
4348
|
static getDimentions(el) {
|
|
5614
4349
|
let xPos = 0;
|
|
5615
4350
|
let yPos = 0;
|
|
@@ -5617,14 +4352,12 @@ class utils {
|
|
|
5617
4352
|
let height = el.height;
|
|
5618
4353
|
while (el) {
|
|
5619
4354
|
if (el.tagName == "BODY") {
|
|
5620
|
-
// deal with browser quirks with body/window/document and page scroll
|
|
5621
4355
|
let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
5622
4356
|
let yScroll = el.scrollTop || document.documentElement.scrollTop;
|
|
5623
4357
|
xPos += (el.offsetLeft - xScroll + el.clientLeft);
|
|
5624
4358
|
yPos += (el.offsetTop - yScroll + el.clientTop);
|
|
5625
4359
|
}
|
|
5626
4360
|
else {
|
|
5627
|
-
// for all other non-BODY elements
|
|
5628
4361
|
xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
|
|
5629
4362
|
yPos += (el.offsetTop - el.scrollTop + el.clientTop);
|
|
5630
4363
|
}
|
|
@@ -5639,9 +4372,6 @@ class utils {
|
|
|
5639
4372
|
}
|
|
5640
4373
|
}
|
|
5641
4374
|
|
|
5642
|
-
/**
|
|
5643
|
-
* @ignore
|
|
5644
|
-
*/
|
|
5645
4375
|
class ModalFormDefinition {
|
|
5646
4376
|
constructor() {
|
|
5647
4377
|
this.taskId = "";
|
|
@@ -5650,9 +4380,5 @@ class ModalFormDefinition {
|
|
|
5650
4380
|
}
|
|
5651
4381
|
}
|
|
5652
4382
|
|
|
5653
|
-
/**
|
|
5654
|
-
* Generated bundle index. Do not edit.
|
|
5655
|
-
*/
|
|
5656
|
-
|
|
5657
4383
|
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
4384
|
//# sourceMappingURL=magic-xpa-angular.js.map
|