@magic-xpa/angular 4.1200.0-dev4120.4 → 4.1200.0-dev4120.40
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/fesm2022/magic-xpa-angular.mjs +1783 -192
- package/fesm2022/magic-xpa-angular.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/package.json +6 -8
- package/src/controls.metadata.model.d.ts +16 -0
- package/src/interfaces/sub-form-definition.iterface.d.ts +6 -0
- package/src/magic.core.module.d.ts +5 -3
- package/src/services/OverlayWindowService.d.ts +19 -0
- package/src/services/StylesMapManager.d.ts +3 -0
- package/src/services/accessor.magic.service.d.ts +243 -3
- package/src/services/commands-collector.magic.service.d.ts +3 -0
- package/src/services/component-list.magic.service.d.ts +27 -0
- package/src/services/confirmation.components.magic.provider.d.ts +16 -0
- package/src/services/engine.magic.service.d.ts +3 -0
- package/src/services/exit.magic.service.d.ts +6 -0
- package/src/services/magic-color.service.d.ts +6 -0
- package/src/services/magic.providers.d.ts +3 -0
- package/src/services/magic.services.d.ts +6 -0
- package/src/services/router-commands.magic.service.d.ts +6 -0
- package/src/services/subform.magic.service.d.ts +28 -0
- package/src/services/table.magic.service.d.ts +56 -0
- package/src/services/task.magics.service.d.ts +300 -0
- package/src/services/title.magic.service.d.ts +11 -0
- package/src/ui/GuiInteractiveExecutor.d.ts +3 -0
- package/src/ui/components/base-magic-alert.component.d.ts +16 -0
- package/src/ui/components/base-magic-confirm.component.d.ts +18 -0
- package/src/ui/components/magic-alert.component.d.ts +3 -0
- package/src/ui/components/magic-confirmation-box.component.d.ts +3 -0
- package/src/ui/directives/NonMagicControlDirective.d.ts +41 -0
- package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +6 -0
- package/src/ui/directives/magic/checkbox.magic.directive.d.ts +12 -0
- package/src/ui/directives/magic/combobox.magic.directive.d.ts +9 -0
- package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +6 -0
- package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +13 -0
- package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +6 -0
- package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +6 -0
- package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +3 -0
- package/src/ui/directives/magic/row.magic.directive.d.ts +15 -0
- package/src/ui/directives/magic-focus.directive.d.ts +3 -0
- package/src/ui/directives/magic.directive.d.ts +82 -0
- package/src/ui/directives/magicViewContainerRef.directive.d.ts +3 -0
- package/src/ui/directives/mgformat.magic.directive.d.ts +44 -0
- package/src/ui/directives/range-validator.magic.directive.d.ts +16 -0
- package/src/ui/magic-confirmationBox.d.ts +19 -0
- package/src/ui/magic-modal/base-magic-overlay-container.d.ts +9 -0
- package/src/ui/magic-modal/magic-modal-form.d.ts +3 -0
- package/src/ui/magic-modal/magic-modal-interface.d.ts +27 -0
- package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +20 -0
- package/src/ui/magic-modal/magic-overlay-container.d.ts +51 -0
- package/src/ui/magic-root.component.d.ts +42 -0
- package/src/ui/mgerror.magic.component.d.ts +19 -0
- package/src/ui/pipes/date.magic.pipe.d.ts +6 -0
- package/src/ui/pipes/time.magic.pipe.d.ts +3 -0
- package/src/ui/router-container.magic.component.d.ts +19 -0
- package/src/ui/subform.magic.component.d.ts +21 -0
- package/src/ui/task-base.magic.component.d.ts +78 -0
- package/src/ui/utils.d.ts +3 -0
- package/esm2022/index.mjs +0 -59
- package/esm2022/magic-xpa-angular.mjs +0 -2
- package/esm2022/src/controls.metadata.model.mjs +0 -183
- package/esm2022/src/interfaces/sub-form-definition.iterface.mjs +0 -2
- package/esm2022/src/magic.core.module.mjs +0 -159
- package/esm2022/src/services/ISubformMagicService.mjs +0 -2
- package/esm2022/src/services/OverlayWindowService.mjs +0 -245
- package/esm2022/src/services/StylesMapManager.mjs +0 -28
- package/esm2022/src/services/accessor.magic.service.mjs +0 -358
- package/esm2022/src/services/commands-collector.magic.service.mjs +0 -47
- package/esm2022/src/services/component-list.magic.service.mjs +0 -45
- package/esm2022/src/services/confirmation.components.magic.provider.mjs +0 -21
- package/esm2022/src/services/engine.magic.service.mjs +0 -80
- package/esm2022/src/services/exit.magic.service.mjs +0 -13
- package/esm2022/src/services/magic-color.service.mjs +0 -101
- package/esm2022/src/services/magic.lazy.loader.service.mjs +0 -16
- package/esm2022/src/services/magic.providers.mjs +0 -25
- package/esm2022/src/services/magic.services.mjs +0 -36
- package/esm2022/src/services/mg-date-adapter.mjs +0 -108
- package/esm2022/src/services/overlay.conainer.magic.provider.mjs +0 -14
- package/esm2022/src/services/router-commands.magic.service.mjs +0 -31
- package/esm2022/src/services/subform.magic.service.mjs +0 -195
- package/esm2022/src/services/table.magic.service.mjs +0 -81
- package/esm2022/src/services/task.magics.service.mjs +0 -648
- package/esm2022/src/services/title.magic.service.mjs +0 -19
- package/esm2022/src/ui/GuiInteractiveExecutor.mjs +0 -114
- package/esm2022/src/ui/components/base-magic-alert.component.mjs +0 -24
- package/esm2022/src/ui/components/base-magic-confirm.component.mjs +0 -24
- package/esm2022/src/ui/components/magic-alert.component.mjs +0 -36
- package/esm2022/src/ui/components/magic-confirmation-box.component.mjs +0 -42
- package/esm2022/src/ui/directives/NonMagicControlDirective.mjs +0 -58
- package/esm2022/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.mjs +0 -29
- package/esm2022/src/ui/directives/magic/checkbox.magic.directive.mjs +0 -100
- package/esm2022/src/ui/directives/magic/combobox.magic.directive.mjs +0 -37
- package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.mjs +0 -27
- package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +0 -85
- package/esm2022/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.mjs +0 -32
- package/esm2022/src/ui/directives/magic/input.noformcontrol.magic.directive.mjs +0 -28
- package/esm2022/src/ui/directives/magic/nocontrol.magic.directive.mjs +0 -193
- package/esm2022/src/ui/directives/magic/row.magic.directive.mjs +0 -62
- package/esm2022/src/ui/directives/magic-focus.directive.mjs +0 -20
- package/esm2022/src/ui/directives/magic.directive.mjs +0 -232
- package/esm2022/src/ui/directives/magicViewContainerRef.directive.mjs +0 -20
- package/esm2022/src/ui/directives/mgformat.magic.directive.mjs +0 -579
- package/esm2022/src/ui/directives/range-validator.magic.directive.mjs +0 -60
- package/esm2022/src/ui/magic-confirmationBox.mjs +0 -42
- package/esm2022/src/ui/magic-modal/base-magic-overlay-container.mjs +0 -22
- package/esm2022/src/ui/magic-modal/magic-modal-form.mjs +0 -6
- package/esm2022/src/ui/magic-modal/magic-modal-interface.mjs +0 -2
- package/esm2022/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +0 -125
- package/esm2022/src/ui/magic-modal/magic-overlay-container.mjs +0 -162
- package/esm2022/src/ui/magic-root.component.mjs +0 -236
- package/esm2022/src/ui/mgerror.magic.component.mjs +0 -125
- package/esm2022/src/ui/pipes/date.magic.pipe.mjs +0 -106
- package/esm2022/src/ui/pipes/time.magic.pipe.mjs +0 -52
- package/esm2022/src/ui/pipes/time24.magic.pipe.mjs +0 -35
- package/esm2022/src/ui/router-container.magic.component.mjs +0 -115
- package/esm2022/src/ui/subform.magic.component.mjs +0 -56
- package/esm2022/src/ui/task-base.magic.component.mjs +0 -91
- package/esm2022/src/ui/utils.mjs +0 -54
@@ -8,20 +8,23 @@ import { NavigationEnd, RouterModule } from '@angular/router';
|
|
8
8
|
import { FormGroup, FormControl, Validators, NG_VALIDATORS, NG_VALUE_ACCESSOR, CheckboxControlValueAccessor, DefaultValueAccessor, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
9
9
|
import * as i3 from 'ng-dynamic-component';
|
10
10
|
import { DynamicModule } from 'ng-dynamic-component';
|
11
|
-
import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
|
11
|
+
import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstants, CommandType, PIC, GuiEnvironment, Events, Modifiers } from '@magic-xpa/gui';
|
12
12
|
import { MagicBridge, getGuiEventObj, CookieService, Environment, LastFocusedManager } from '@magic-xpa/engine';
|
13
|
-
import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
|
13
|
+
import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, MsgInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
|
14
14
|
import { filter, map, debounceTime } from 'rxjs/operators';
|
15
15
|
import { Subject, EMPTY, fromEvent } from 'rxjs';
|
16
16
|
import { __decorate, __metadata } from 'tslib';
|
17
17
|
import * as i1$1 from '@angular/platform-browser';
|
18
18
|
import * as i1$2 from '@angular/common/http';
|
19
|
-
import {
|
19
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
20
20
|
import { maskitoTimeOptionsGenerator } from '@maskito/kit';
|
21
21
|
import * as i2$1 from '@angular/cdk/platform';
|
22
22
|
import { MaskitoModule } from '@maskito/angular';
|
23
23
|
import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
24
24
|
|
25
|
+
/**
|
26
|
+
* @ignore
|
27
|
+
*/
|
25
28
|
class ControlMetadata {
|
26
29
|
controlType;
|
27
30
|
dataType;
|
@@ -31,9 +34,11 @@ class ControlMetadata {
|
|
31
34
|
removedClass;
|
32
35
|
classes;
|
33
36
|
rangeValidator;
|
37
|
+
// user properties
|
34
38
|
userProperties = new Map();
|
35
39
|
customValidators = new Map();
|
36
40
|
setClass(key, value) {
|
41
|
+
// for no-control - hold the name of the class to be removed later
|
37
42
|
if (this.classesMap.has(key)) {
|
38
43
|
this.removedClass = this.classesMap.get(key);
|
39
44
|
}
|
@@ -48,8 +53,13 @@ class ControlMetadata {
|
|
48
53
|
this.stylesMap.set(key, value);
|
49
54
|
}
|
50
55
|
}
|
56
|
+
/**
|
57
|
+
* @ignore
|
58
|
+
*/
|
51
59
|
class ControlsMetadata {
|
60
|
+
//values of control
|
52
61
|
values = new Map();
|
62
|
+
// dictionary of controls with there properties
|
53
63
|
ControlsProperties = new Map();
|
54
64
|
rowId;
|
55
65
|
isCreated = false;
|
@@ -63,6 +73,8 @@ class ControlsMetadata {
|
|
63
73
|
return this.ControlsProperties.get(controlId);
|
64
74
|
}
|
65
75
|
update(obj) {
|
76
|
+
//should we keep the values here ?
|
77
|
+
//this.values = obj.ControlsValues;
|
66
78
|
let props = obj.ControlsMetaData;
|
67
79
|
for (let controlName in props) {
|
68
80
|
if (!this.ControlsProperties.has(controlName))
|
@@ -91,15 +103,18 @@ class ControlsMetadata {
|
|
91
103
|
return this.values.get(controlName);
|
92
104
|
}
|
93
105
|
}
|
106
|
+
/**
|
107
|
+
* @ignore
|
108
|
+
*/
|
94
109
|
class Records {
|
95
110
|
data = new Map();
|
96
|
-
list = [];
|
111
|
+
list = []; //used for sequential access in table
|
97
112
|
includesFirst;
|
98
113
|
includesLast;
|
99
114
|
guiTopIndex;
|
100
115
|
recordsBeforeCurrentView = 0;
|
101
116
|
isEmptyDataView = false;
|
102
|
-
sizeUpdated = false;
|
117
|
+
sizeUpdated = false; //used for evaluating the RecordsSizeChange.
|
103
118
|
getRow(dvRowId) {
|
104
119
|
return this.list[dvRowId + this.recordsBeforeCurrentView];
|
105
120
|
}
|
@@ -122,14 +137,24 @@ class Records {
|
|
122
137
|
}
|
123
138
|
return false;
|
124
139
|
}
|
140
|
+
/*
|
141
|
+
* for row editing
|
142
|
+
* */
|
125
143
|
startRowEditing(guiRowId) {
|
126
144
|
if (guiRowId < this.list.length && this.data.has(guiRowId))
|
127
145
|
this.data.get(guiRowId).isEditing = true;
|
128
146
|
}
|
147
|
+
/*
|
148
|
+
* stop row editing on row Id
|
149
|
+
* */
|
129
150
|
stopRowEditing(guiRowId) {
|
130
151
|
if (guiRowId < this.list.length && this.data.has(guiRowId))
|
131
152
|
this.data.get(guiRowId).isEditing = false;
|
132
153
|
}
|
154
|
+
/*
|
155
|
+
* return if row is in editing
|
156
|
+
* Called by the HTML code, so parameter is a string, not a numebr
|
157
|
+
* */
|
133
158
|
isRowInRowEditing(guiRowId) {
|
134
159
|
if (+guiRowId < this.list.length) {
|
135
160
|
if (!this.data.has(+guiRowId) || isNullOrUndefined(this.data.get(+guiRowId)))
|
@@ -158,6 +183,7 @@ class Records {
|
|
158
183
|
updateSize(len) {
|
159
184
|
if (this.list.length != len) {
|
160
185
|
if (len < this.list.length) {
|
186
|
+
//remove rows
|
161
187
|
for (let i = len; i < this.list.length; i++) {
|
162
188
|
this.data.delete(i);
|
163
189
|
}
|
@@ -166,6 +192,10 @@ class Records {
|
|
166
192
|
this.sizeUpdated = true;
|
167
193
|
}
|
168
194
|
}
|
195
|
+
/**
|
196
|
+
* crears data for the first record
|
197
|
+
* @param template
|
198
|
+
*/
|
169
199
|
clearFirstTableRecord(template) {
|
170
200
|
if (this.list.length >= 1) {
|
171
201
|
for (const key in template) {
|
@@ -196,6 +226,9 @@ class Records {
|
|
196
226
|
return this.guiTopIndex;
|
197
227
|
}
|
198
228
|
}
|
229
|
+
/**
|
230
|
+
* @ignore
|
231
|
+
*/
|
199
232
|
var HtmlClasses;
|
200
233
|
(function (HtmlClasses) {
|
201
234
|
HtmlClasses["Color"] = "color";
|
@@ -204,6 +237,9 @@ var HtmlClasses;
|
|
204
237
|
HtmlClasses["HintColor"] = "hintcolor";
|
205
238
|
})(HtmlClasses || (HtmlClasses = {}));
|
206
239
|
|
240
|
+
/**
|
241
|
+
* @ignore
|
242
|
+
*/
|
207
243
|
class StylesMapManager {
|
208
244
|
static StylesMap = new Map([
|
209
245
|
[MagicProperties.LineDivider, new Map([[true, "solid"], [false, "hidden"]])],
|
@@ -230,10 +266,15 @@ class StylesMapManager {
|
|
230
266
|
}
|
231
267
|
}
|
232
268
|
|
269
|
+
/**
|
270
|
+
* @ignore
|
271
|
+
*/
|
233
272
|
class EngineMagicService {
|
234
273
|
magicBridge = MagicBridge;
|
235
274
|
isStub = false;
|
275
|
+
// true when user is logged in magic
|
236
276
|
isLoggedIn = false;
|
277
|
+
//TODO - unregister
|
237
278
|
refreshDom = new Subject();
|
238
279
|
interactiveCommands = new Subject();
|
239
280
|
startMagicEngine(httpClient, args) {
|
@@ -283,6 +324,7 @@ class EngineMagicService {
|
|
283
324
|
return this.magicBridge.GetFldRanges(taskId, controlName);
|
284
325
|
}
|
285
326
|
saveData(data) {
|
327
|
+
//this.magicBridge.saveData(data);
|
286
328
|
}
|
287
329
|
getIsLoggedIn() {
|
288
330
|
return this.isLoggedIn;
|
@@ -296,8 +338,8 @@ class EngineMagicService {
|
|
296
338
|
TerminateContextUsingFetchAPI() {
|
297
339
|
this.magicBridge.TerminateContextUsingFetchAPI();
|
298
340
|
}
|
299
|
-
static ɵfac = function EngineMagicService_Factory(
|
300
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac, providedIn: 'root' });
|
341
|
+
/** @nocollapse */ static ɵfac = function EngineMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || EngineMagicService)(); };
|
342
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: EngineMagicService, factory: EngineMagicService.ɵfac, providedIn: 'root' });
|
301
343
|
}
|
302
344
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EngineMagicService, [{
|
303
345
|
type: Injectable,
|
@@ -306,8 +348,17 @@ class EngineMagicService {
|
|
306
348
|
}]
|
307
349
|
}], null, null); })();
|
308
350
|
|
351
|
+
/**
|
352
|
+
* Manages the list of components in a project, and the project title
|
353
|
+
*/
|
309
354
|
class ComponentListMagicService {
|
355
|
+
/**
|
356
|
+
* Map of project components
|
357
|
+
*/
|
310
358
|
components = new Map();
|
359
|
+
/**
|
360
|
+
* Map of project dialogs
|
361
|
+
*/
|
311
362
|
dialogs = new Map();
|
312
363
|
lazyLoadModulesMap = null;
|
313
364
|
getData(name, mustHaveData) {
|
@@ -320,6 +371,11 @@ class ComponentListMagicService {
|
|
320
371
|
data = this.components.get(name);
|
321
372
|
return data;
|
322
373
|
}
|
374
|
+
/**
|
375
|
+
* Return a component according to name
|
376
|
+
* @param name Name of requested component
|
377
|
+
* @returns The requested component
|
378
|
+
*/
|
323
379
|
getComponent(name, mustHaveData = true) {
|
324
380
|
let data = this.getData(name, mustHaveData);
|
325
381
|
return data ? data.component : null;
|
@@ -330,17 +386,30 @@ class ComponentListMagicService {
|
|
330
386
|
this.components.set(key, data);
|
331
387
|
}
|
332
388
|
}
|
389
|
+
/**
|
390
|
+
* Return a component according to name
|
391
|
+
* @param name Name of requested component
|
392
|
+
* @returns The requested component
|
393
|
+
*/
|
333
394
|
getModuleRef(name) {
|
334
395
|
let data = this.getData(name, false);
|
335
396
|
return data ? data.moduleRef : null;
|
336
397
|
;
|
337
398
|
}
|
399
|
+
/**
|
400
|
+
* Return the lazy load module details of the specified component
|
401
|
+
* @param name: Name of requested component
|
402
|
+
* @returns: lazy load module details
|
403
|
+
*/
|
338
404
|
getLazyLoadModuleData(name) {
|
339
405
|
return (this.lazyLoadModulesMap != null && this.lazyLoadModulesMap.hasOwnProperty(name)) ? this.lazyLoadModulesMap[name] : null;
|
340
406
|
}
|
407
|
+
/**
|
408
|
+
* Project title
|
409
|
+
*/
|
341
410
|
title;
|
342
|
-
static ɵfac = function ComponentListMagicService_Factory(
|
343
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: ComponentListMagicService, factory: ComponentListMagicService.ɵfac, providedIn: 'root' });
|
411
|
+
/** @nocollapse */ static ɵfac = function ComponentListMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ComponentListMagicService)(); };
|
412
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ComponentListMagicService, factory: ComponentListMagicService.ɵfac, providedIn: 'root' });
|
344
413
|
}
|
345
414
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComponentListMagicService, [{
|
346
415
|
type: Injectable,
|
@@ -349,6 +418,9 @@ class ComponentListMagicService {
|
|
349
418
|
}]
|
350
419
|
}], null, null); })();
|
351
420
|
|
421
|
+
/**
|
422
|
+
* @ignore
|
423
|
+
*/
|
352
424
|
class CommandsCollectorMagicService {
|
353
425
|
magic;
|
354
426
|
count = 0;
|
@@ -380,8 +452,8 @@ class CommandsCollectorMagicService {
|
|
380
452
|
commands.forEach(command => { this.commands.Remove(command); });
|
381
453
|
return commands;
|
382
454
|
}
|
383
|
-
static ɵfac = function CommandsCollectorMagicService_Factory(
|
384
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac, providedIn: 'root' });
|
455
|
+
/** @nocollapse */ static ɵfac = function CommandsCollectorMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CommandsCollectorMagicService)(i0.ɵɵinject(EngineMagicService)); };
|
456
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: CommandsCollectorMagicService, factory: CommandsCollectorMagicService.ɵfac, providedIn: 'root' });
|
385
457
|
}
|
386
458
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CommandsCollectorMagicService, [{
|
387
459
|
type: Injectable,
|
@@ -390,6 +462,9 @@ class CommandsCollectorMagicService {
|
|
390
462
|
}]
|
391
463
|
}], () => [{ type: EngineMagicService }], null); })();
|
392
464
|
|
465
|
+
/**
|
466
|
+
* @ignore
|
467
|
+
*/
|
393
468
|
class RouteCommand {
|
394
469
|
callerMgSubformServiceRef;
|
395
470
|
routerOutletName;
|
@@ -397,6 +472,9 @@ class RouteCommand {
|
|
397
472
|
parameters;
|
398
473
|
routeParams;
|
399
474
|
}
|
475
|
+
/**
|
476
|
+
* @ignore
|
477
|
+
*/
|
400
478
|
class RouterCommandsMagicService {
|
401
479
|
pendingRouteCommands = [];
|
402
480
|
AddRouteCommand(routeCommand) {
|
@@ -408,8 +486,8 @@ class RouterCommandsMagicService {
|
|
408
486
|
pendingRouteCommand.callerMgSubformServiceRef.ExecuteRouteCommand(pendingRouteCommand);
|
409
487
|
}
|
410
488
|
}
|
411
|
-
static ɵfac = function RouterCommandsMagicService_Factory(
|
412
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac, providedIn: 'root' });
|
489
|
+
/** @nocollapse */ static ɵfac = function RouterCommandsMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RouterCommandsMagicService)(); };
|
490
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: RouterCommandsMagicService, factory: RouterCommandsMagicService.ɵfac, providedIn: 'root' });
|
413
491
|
}
|
414
492
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterCommandsMagicService, [{
|
415
493
|
type: Injectable,
|
@@ -422,8 +500,8 @@ class MagicLazyLoaderService {
|
|
422
500
|
Load(path) {
|
423
501
|
return Promise.reject('error in loading module :' + path);
|
424
502
|
}
|
425
|
-
static ɵfac = function MagicLazyLoaderService_Factory(
|
426
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: MagicLazyLoaderService, factory: MagicLazyLoaderService.ɵfac, providedIn: 'root' });
|
503
|
+
/** @nocollapse */ static ɵfac = function MagicLazyLoaderService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicLazyLoaderService)(); };
|
504
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicLazyLoaderService, factory: MagicLazyLoaderService.ɵfac, providedIn: 'root' });
|
427
505
|
}
|
428
506
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicLazyLoaderService, [{
|
429
507
|
type: Injectable,
|
@@ -432,6 +510,9 @@ class MagicLazyLoaderService {
|
|
432
510
|
}]
|
433
511
|
}], null, null); })();
|
434
512
|
|
513
|
+
/**
|
514
|
+
* Service for managing subforms and routing
|
515
|
+
*/
|
435
516
|
class SubformMagicService {
|
436
517
|
task;
|
437
518
|
activatedRoute;
|
@@ -443,8 +524,8 @@ class SubformMagicService {
|
|
443
524
|
loader;
|
444
525
|
injector;
|
445
526
|
compiler;
|
446
|
-
subformsDict = {};
|
447
|
-
routesDict = {};
|
527
|
+
subformsDict /*:{ [x: string]: SubformDefinition }*/ = {};
|
528
|
+
routesDict = {}; // dictionary of router outlet to router path
|
448
529
|
currentRouteDefinition = null;
|
449
530
|
static currentCallerMgSubformServiceRef = null;
|
450
531
|
static routerContainers = new Array();
|
@@ -460,6 +541,11 @@ class SubformMagicService {
|
|
460
541
|
this.injector = injector;
|
461
542
|
this.compiler = compiler;
|
462
543
|
}
|
544
|
+
/**
|
545
|
+
* Finds and returns the component according to the subform name
|
546
|
+
* @param subformName
|
547
|
+
* @returns
|
548
|
+
*/
|
463
549
|
mgGetComp(subformName) {
|
464
550
|
if (subformName in this.subformsDict) {
|
465
551
|
let formName = this.subformsDict[subformName].formName;
|
@@ -468,6 +554,11 @@ class SubformMagicService {
|
|
468
554
|
}
|
469
555
|
return null;
|
470
556
|
}
|
557
|
+
/**
|
558
|
+
* Returns the parameters of the subform
|
559
|
+
* @param subformName
|
560
|
+
* @returns
|
561
|
+
*/
|
471
562
|
mgGetParameters(subformName) {
|
472
563
|
if (subformName in this.subformsDict) {
|
473
564
|
return this.subformsDict[subformName].parameters;
|
@@ -475,6 +566,9 @@ class SubformMagicService {
|
|
475
566
|
else
|
476
567
|
return '';
|
477
568
|
}
|
569
|
+
/**
|
570
|
+
* @ignore
|
571
|
+
*/
|
478
572
|
deleteSubformComp(subformControlName, formName) {
|
479
573
|
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
480
574
|
if (this.subformsDict[subformControlName].formName === formName) {
|
@@ -483,22 +577,27 @@ class SubformMagicService {
|
|
483
577
|
}
|
484
578
|
}
|
485
579
|
}
|
580
|
+
/**
|
581
|
+
* @ignore
|
582
|
+
*/
|
486
583
|
addSubformComp(subformControlName, formName, taskId, taskDescription, routerPath, params, inDefaultOutlet) {
|
487
584
|
this.pendingCommandsCollector.startCollecting();
|
488
585
|
let refreshNeeded = false;
|
489
|
-
if (isNullOrUndefined(routerPath)) {
|
586
|
+
if (isNullOrUndefined(routerPath)) { // call in destination subform
|
490
587
|
if (Object.keys(this.subformsDict).indexOf(subformControlName) >= 0) {
|
491
588
|
if (this.subformsDict[subformControlName].formName === formName) {
|
492
589
|
this.subformsDict[subformControlName] = {};
|
493
590
|
this.task.refreshView();
|
494
591
|
}
|
495
592
|
}
|
593
|
+
// Load the lazy load module, if needed
|
496
594
|
let moduleRef = this.componentListMagicService.getModuleRef(formName);
|
497
595
|
if (moduleRef == null) {
|
498
596
|
let lazyLoadModule = this.componentListMagicService.getLazyLoadModuleData(formName);
|
499
597
|
if (lazyLoadModule != null) {
|
500
598
|
const Magic = 'Magic';
|
501
599
|
const Module = 'Module';
|
600
|
+
// extract name of module(XX) from 'MagicXXModule'
|
502
601
|
const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
|
503
602
|
this.loader.Load(moduleName).then(m => {
|
504
603
|
const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
|
@@ -516,10 +615,11 @@ class SubformMagicService {
|
|
516
615
|
formName,
|
517
616
|
parameters: { taskIdParam: taskId, taskDescription: taskDescription }
|
518
617
|
};
|
618
|
+
//this.ref.detectChanges();
|
519
619
|
refreshNeeded = true;
|
520
620
|
}
|
521
621
|
}
|
522
|
-
else {
|
622
|
+
else { // call route
|
523
623
|
if (inDefaultOutlet)
|
524
624
|
subformControlName = 'primary';
|
525
625
|
let routeParams = new List();
|
@@ -534,6 +634,10 @@ class SubformMagicService {
|
|
534
634
|
parameters: { taskIdParam: taskId, taskDescription: taskDescription },
|
535
635
|
routeParams: routeParams
|
536
636
|
};
|
637
|
+
// If SubformMagicService.currentCallerMgSubformServiceRef !== null means that router.navigate() is already
|
638
|
+
// called once, but angular has not yet executed it (ngOnInit of the new component is not called).
|
639
|
+
// In such a case, do not executed router.navigate() again. Because, angular ignores the previous one.
|
640
|
+
// So, put a command in the queue which will be executed after the first one is executed.
|
537
641
|
if (SubformMagicService.currentCallerMgSubformServiceRef === null)
|
538
642
|
this.ExecuteRouteCommand(routeCommand);
|
539
643
|
else
|
@@ -542,10 +646,15 @@ class SubformMagicService {
|
|
542
646
|
if (refreshNeeded)
|
543
647
|
this.task.refreshView();
|
544
648
|
}
|
649
|
+
/**
|
650
|
+
* Open the subform using a route command
|
651
|
+
*/
|
545
652
|
ExecuteRouteCommand(routeCommand) {
|
546
653
|
let currentSubformMagicService = routeCommand.callerMgSubformServiceRef;
|
547
654
|
let relativeRoute = SubformMagicService.getRelativeRoute(currentSubformMagicService.activatedRoute);
|
548
655
|
if (currentSubformMagicService.routesDict[routeCommand.routerOutletName] === routeCommand.routeParams[0]) {
|
656
|
+
// If the specified router outlet already hosts the same router path, router.navigate() doesn't actually navigate.
|
657
|
+
// So, first clear the outlet (passing null route params, clears the outlet) and then navigate again.
|
549
658
|
currentSubformMagicService.router.navigate([{ outlets: { [routeCommand.routerOutletName]: null } }], { relativeTo: relativeRoute })
|
550
659
|
.then((result) => {
|
551
660
|
SubformMagicService.currentCallerMgSubformServiceRef = currentSubformMagicService;
|
@@ -585,7 +694,12 @@ class SubformMagicService {
|
|
585
694
|
}
|
586
695
|
});
|
587
696
|
}
|
697
|
+
/**
|
698
|
+
* @ignore
|
699
|
+
*/
|
588
700
|
init() {
|
701
|
+
// If commands were issued for this task before ngOnInit(), they were not executed because task had not registered for them.
|
702
|
+
// So, execute them now.
|
589
703
|
const pendingCommands = this.pendingCommandsCollector.GetCommands(this.task.taskId);
|
590
704
|
if (pendingCommands.length > 0) {
|
591
705
|
pendingCommands.forEach(command => { this.task.executeCommand(command); });
|
@@ -593,9 +707,15 @@ class SubformMagicService {
|
|
593
707
|
}
|
594
708
|
this.pendingCommandsCollector.stopCollecting();
|
595
709
|
}
|
710
|
+
/**
|
711
|
+
* @ignore
|
712
|
+
*/
|
596
713
|
refreshView() {
|
597
714
|
this.task.refreshView();
|
598
715
|
}
|
716
|
+
///
|
717
|
+
// return the relative route
|
718
|
+
//
|
599
719
|
static getRelativeRoute(sendActivatedRoute) {
|
600
720
|
let currentActiveRoute = sendActivatedRoute;
|
601
721
|
if (currentActiveRoute.snapshot.routeConfig !== null && currentActiveRoute.snapshot.routeConfig.path === '') {
|
@@ -605,13 +725,16 @@ class SubformMagicService {
|
|
605
725
|
}
|
606
726
|
return currentActiveRoute;
|
607
727
|
}
|
608
|
-
static ɵfac = function SubformMagicService_Factory(
|
609
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
728
|
+
/** @nocollapse */ static ɵfac = function SubformMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SubformMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(i2.ActivatedRoute), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(CommandsCollectorMagicService), i0.ɵɵinject(i2.Router), i0.ɵɵinject(RouterCommandsMagicService), i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler)); };
|
729
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: SubformMagicService, factory: SubformMagicService.ɵfac });
|
610
730
|
}
|
611
731
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubformMagicService, [{
|
612
732
|
type: Injectable
|
613
733
|
}], () => [{ type: TaskMagicService }, { type: i2.ActivatedRoute }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: i2.Router }, { type: RouterCommandsMagicService }, { type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.Compiler }], null); })();
|
614
734
|
|
735
|
+
/**
|
736
|
+
* Mock component, implements routing by connecting the requested URL with the appropriate Magic task
|
737
|
+
*/
|
615
738
|
class RouterContainerMagicComponent {
|
616
739
|
activatedRoute;
|
617
740
|
router;
|
@@ -627,6 +750,16 @@ class RouterContainerMagicComponent {
|
|
627
750
|
static get LastRoute() {
|
628
751
|
return RouterContainerMagicComponent.lastRoute;
|
629
752
|
}
|
753
|
+
/**
|
754
|
+
*
|
755
|
+
* @param changeDetectorRef
|
756
|
+
* @param activatedRoute
|
757
|
+
* @param magic
|
758
|
+
* @param componentFactoryResolver
|
759
|
+
* @param viewContainerRef
|
760
|
+
* @param componentList
|
761
|
+
* @param pendingCommandsCollector
|
762
|
+
*/
|
630
763
|
constructor(activatedRoute, router, magic, containerTaskService, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
|
631
764
|
this.activatedRoute = activatedRoute;
|
632
765
|
this.router = router;
|
@@ -637,6 +770,9 @@ class RouterContainerMagicComponent {
|
|
637
770
|
this.pendingCommandsCollector = pendingCommandsCollector;
|
638
771
|
this.routerCommandsMagicService = routerCommandsMagicService;
|
639
772
|
}
|
773
|
+
/**
|
774
|
+
* Initialization
|
775
|
+
*/
|
640
776
|
ngOnInit() {
|
641
777
|
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
642
778
|
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
@@ -654,7 +790,10 @@ class RouterContainerMagicComponent {
|
|
654
790
|
guiEvent.RouterPath = currentActiveRoute.snapshot.routeConfig.path;
|
655
791
|
if (currentActiveRoute.snapshot.outlet !== 'primary')
|
656
792
|
guiEvent.RouterOutletName = currentActiveRoute.snapshot.outlet;
|
793
|
+
// if this is LoadOnDemandModuleMagicComponent it's mean that this is load on demand module and we
|
794
|
+
// need to take the path form routeConfig.path
|
657
795
|
let calcRouterPath = currentActiveRoute.routeConfig.path;
|
796
|
+
// add the RouterPath only if exist
|
658
797
|
if (calcRouterPath.length > 0) {
|
659
798
|
let routerPath = calcRouterPath;
|
660
799
|
let tokens = StrUtil.tokenize(routerPath, "/:");
|
@@ -667,6 +806,7 @@ class RouterContainerMagicComponent {
|
|
667
806
|
this.containerTaskService.insertEvent(guiEvent);
|
668
807
|
}
|
669
808
|
initializeComponent() {
|
809
|
+
// re-init subformMagicService since it may change after executing "RouterNavigate" event.
|
670
810
|
let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
|
671
811
|
if (subformMagicService.currentRouteDefinition !== null) {
|
672
812
|
let comp = this.componentList.getComponent(subformMagicService.currentRouteDefinition.formName);
|
@@ -678,6 +818,9 @@ class RouterContainerMagicComponent {
|
|
678
818
|
this.parentMgSubformService = subformMagicService;
|
679
819
|
subformMagicService.currentRouteDefinition = null;
|
680
820
|
SubformMagicService.currentCallerMgSubformServiceRef = null;
|
821
|
+
//When the component is initialized, then also we get the notification for paramMap subscription.
|
822
|
+
//But in this case, we do not have to raise the event, because magic engine itself has initiated the route with the same parameters.
|
823
|
+
//So, control it via ignoreParamChange flag.
|
681
824
|
let ignoreParamChange = true;
|
682
825
|
myActiveRoute.paramMap.subscribe(params => {
|
683
826
|
if (!ignoreParamChange)
|
@@ -688,7 +831,12 @@ class RouterContainerMagicComponent {
|
|
688
831
|
this.routerCommandsMagicService.ExecuteNextCommand();
|
689
832
|
}
|
690
833
|
}
|
834
|
+
/**
|
835
|
+
* Cleanup
|
836
|
+
*/
|
691
837
|
ngOnDestroy() {
|
838
|
+
// TODO Routing: Call close() only if the task is not already closed.
|
839
|
+
// Task can be closed when a router is overlayed by another task via call operation.
|
692
840
|
if (this.componentRef != null) {
|
693
841
|
this.componentRef.instance.task.close();
|
694
842
|
let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
|
@@ -696,25 +844,30 @@ class RouterContainerMagicComponent {
|
|
696
844
|
RouterContainerMagicComponent.lastRoute = this.router.url;
|
697
845
|
}
|
698
846
|
}
|
699
|
-
static ɵfac = function RouterContainerMagicComponent_Factory(
|
700
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
847
|
+
/** @nocollapse */ static ɵfac = function RouterContainerMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RouterContainerMagicComponent)(i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(RouterCommandsMagicService)); };
|
848
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: RouterContainerMagicComponent, selectors: [["magic-route-outlet"]], standalone: false, decls: 0, vars: 0, template: function RouterContainerMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
701
849
|
}
|
702
850
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouterContainerMagicComponent, [{
|
703
851
|
type: Component,
|
704
852
|
args: [{
|
705
853
|
selector: 'magic-route-outlet',
|
706
854
|
template: `
|
707
|
-
|
855
|
+
`,
|
856
|
+
standalone: false
|
708
857
|
}]
|
709
858
|
}], () => [{ type: i2.ActivatedRoute }, { type: i2.Router }, { type: EngineMagicService }, { type: TaskMagicService }, { type: i0.ViewContainerRef }, { type: ComponentListMagicService }, { type: CommandsCollectorMagicService }, { type: RouterCommandsMagicService }], null); })();
|
710
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RouterContainerMagicComponent, { className: "RouterContainerMagicComponent", filePath: "src
|
859
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RouterContainerMagicComponent, { className: "RouterContainerMagicComponent", filePath: "src/ui/router-container.magic.component.ts", lineNumber: 23 }); })();
|
711
860
|
|
861
|
+
/**
|
862
|
+
* @ignore
|
863
|
+
*/
|
712
864
|
class GuiInteractiveExecutor {
|
713
865
|
command;
|
714
866
|
component;
|
715
867
|
task;
|
716
868
|
overlayService;
|
717
869
|
Run() {
|
870
|
+
// Sets the currentContextID
|
718
871
|
try {
|
719
872
|
switch (this.command._commandType) {
|
720
873
|
case InteractiveCommandType.GET_VALUE:
|
@@ -751,6 +904,7 @@ class GuiInteractiveExecutor {
|
|
751
904
|
}
|
752
905
|
catch (ex) {
|
753
906
|
throw ex;
|
907
|
+
//want to see all the exceptions for now
|
754
908
|
}
|
755
909
|
}
|
756
910
|
static executeInteractiveCommand(task, guiIntactiveCommand, overlayService) {
|
@@ -769,6 +923,7 @@ class GuiInteractiveExecutor {
|
|
769
923
|
}
|
770
924
|
else if (this.task.isTableControl(this.command.controlName))
|
771
925
|
val = this.task.getValue(this.command.controlName, guiRowId.toString());
|
926
|
+
// If this is Three State Checkbox, then check if value is indeterminate.
|
772
927
|
if (this.command._boolVal) {
|
773
928
|
const indeterminate = this.task.getProperty(this.command.controlName, HtmlProperties.CheckBoxIndeterminate, guiRowId.toString());
|
774
929
|
if (indeterminate)
|
@@ -839,20 +994,25 @@ BaseMagicOverlayContainer = __decorate([
|
|
839
994
|
Output()
|
840
995
|
], BaseMagicOverlayContainer);
|
841
996
|
|
997
|
+
/**
|
998
|
+
* Directive for setting ViewContainerRef on element
|
999
|
+
*/
|
842
1000
|
class MagicViewContainerRef {
|
843
1001
|
vcRef;
|
844
1002
|
constructor(vcRef) {
|
845
1003
|
this.vcRef = vcRef;
|
1004
|
+
// For angular 10 - find the component from the views
|
846
1005
|
let comp = (this.vcRef._hostLView).find(v => v != null && !isNullOrUndefined(v.setViewContainerRef));
|
847
1006
|
comp.setViewContainerRef(vcRef);
|
848
1007
|
}
|
849
|
-
static ɵfac = function MagicViewContainerRef_Factory(
|
850
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]] });
|
1008
|
+
/** @nocollapse */ static ɵfac = function MagicViewContainerRef_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicViewContainerRef)(i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
|
1009
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicViewContainerRef, selectors: [["", "magicViewContainerRef", ""]], standalone: false });
|
851
1010
|
}
|
852
1011
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicViewContainerRef, [{
|
853
1012
|
type: Directive,
|
854
1013
|
args: [{
|
855
1014
|
selector: '[magicViewContainerRef]',
|
1015
|
+
standalone: false
|
856
1016
|
}]
|
857
1017
|
}], () => [{ type: i0.ViewContainerRef }], null); })();
|
858
1018
|
|
@@ -878,17 +1038,46 @@ function MagicOverlayContainer_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
878
1038
|
i0.ɵɵadvance(2);
|
879
1039
|
i0.ɵɵtextInterpolate1(" ", ctx_r2.getText(), " ");
|
880
1040
|
} }
|
1041
|
+
/**
|
1042
|
+
* Creates a modal window for Magic modal window components
|
1043
|
+
*/
|
881
1044
|
class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
1045
|
+
/**
|
1046
|
+
* HTML to be displayed in the modal window
|
1047
|
+
*/
|
882
1048
|
modalbodyViewContainerRef;
|
1049
|
+
/**
|
1050
|
+
* Header of the modal window
|
1051
|
+
*/
|
883
1052
|
headerElementRef;
|
1053
|
+
/**
|
1054
|
+
* Foreground of the modal window
|
1055
|
+
*/
|
884
1056
|
foregroundElementRef;
|
1057
|
+
/**
|
1058
|
+
*
|
1059
|
+
*/
|
885
1060
|
ModalComp = null;
|
1061
|
+
/**
|
1062
|
+
*
|
1063
|
+
*/
|
886
1064
|
ModalCompParameters = {};
|
887
1065
|
onClose = new EventEmitter();
|
1066
|
+
/**
|
1067
|
+
*
|
1068
|
+
*/
|
888
1069
|
componentRef = null;
|
1070
|
+
/**
|
1071
|
+
*
|
1072
|
+
* @param injector
|
1073
|
+
* @param componentFactoryResolver
|
1074
|
+
*/
|
889
1075
|
constructor() {
|
890
1076
|
super();
|
891
1077
|
}
|
1078
|
+
/**
|
1079
|
+
*
|
1080
|
+
*/
|
892
1081
|
ngOnInit() {
|
893
1082
|
this.componentRef = this.modalbodyViewContainerRef.createComponent(this.ModalComp);
|
894
1083
|
Object.assign(this.componentRef.instance, this.ModalCompParameters);
|
@@ -896,6 +1085,10 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
896
1085
|
setViewContainerRef(vcRef) {
|
897
1086
|
this.modalbodyViewContainerRef = vcRef;
|
898
1087
|
}
|
1088
|
+
/**
|
1089
|
+
* Returns the form name
|
1090
|
+
* @returns
|
1091
|
+
*/
|
899
1092
|
getText() {
|
900
1093
|
if (this.componentRef !== null) {
|
901
1094
|
let comp = this.componentRef.instance;
|
@@ -904,6 +1097,10 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
904
1097
|
else
|
905
1098
|
return '';
|
906
1099
|
}
|
1100
|
+
/**
|
1101
|
+
* Returns CSS styles for the window
|
1102
|
+
* @returns
|
1103
|
+
*/
|
907
1104
|
getStyle() {
|
908
1105
|
let styles = {};
|
909
1106
|
if (this.componentRef != undefined) {
|
@@ -920,6 +1117,10 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
920
1117
|
}
|
921
1118
|
return styles;
|
922
1119
|
}
|
1120
|
+
/**
|
1121
|
+
* Returns the CSS styles for the client area
|
1122
|
+
* @returns
|
1123
|
+
*/
|
923
1124
|
getClientAreaStyles() {
|
924
1125
|
let styles = {};
|
925
1126
|
if (this.componentRef != undefined) {
|
@@ -934,29 +1135,39 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
934
1135
|
}
|
935
1136
|
return styles;
|
936
1137
|
}
|
1138
|
+
/**
|
1139
|
+
* Should the title bar be displayed
|
1140
|
+
* @returns
|
1141
|
+
*/
|
937
1142
|
getShowTitleBar() {
|
938
1143
|
if (this.componentRef != undefined) {
|
939
1144
|
let comp = this.componentRef.instance;
|
940
1145
|
return comp.ShowTitleBar();
|
941
1146
|
}
|
942
1147
|
}
|
1148
|
+
/**
|
1149
|
+
*
|
1150
|
+
*/
|
943
1151
|
OnClose() {
|
944
1152
|
this.onClose.emit();
|
945
1153
|
}
|
1154
|
+
/**
|
1155
|
+
* Handles click in the background window
|
1156
|
+
*/
|
946
1157
|
OnBackgroundClick() {
|
947
1158
|
let comp = this.componentRef.instance;
|
948
1159
|
if (comp.ShouldCloseOnBackgroundClick())
|
949
1160
|
this.OnClose();
|
950
1161
|
}
|
951
|
-
static ɵfac = function MagicOverlayContainer_Factory(
|
952
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
|
1162
|
+
/** @nocollapse */ static ɵfac = function MagicOverlayContainer_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainer)(); };
|
1163
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainer, selectors: [["app-magic-overlay-container"]], viewQuery: function MagicOverlayContainer_Query(rf, ctx) { if (rf & 1) {
|
953
1164
|
i0.ɵɵviewQuery(_c0$3, 5);
|
954
1165
|
i0.ɵɵviewQuery(_c1$1, 5);
|
955
1166
|
} if (rf & 2) {
|
956
1167
|
let _t;
|
957
1168
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerElementRef = _t.first);
|
958
1169
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.foregroundElementRef = _t.first);
|
959
|
-
} }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [["modalForeground", ""], ["modalbody", ""], ["modalheader", ""], [1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], [1, "modal-foreground", 3, "ngStyle"], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
|
1170
|
+
} }, inputs: { ModalComp: "ModalComp", ModalCompParameters: "ModalCompParameters" }, outputs: { onClose: "onClose" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 9, vars: 4, consts: [["modalForeground", ""], ["modalbody", ""], ["modalheader", ""], [1, "modal-background", 3, "click"], ["tabindex", "-1", "style", "float:right; border: none; background-color: transparent; outline: none; color: white", 3, "click", 4, "ngIf"], [1, "modal-foreground", 3, "ngStyle"], ["class", "modal-header", 4, "ngIf"], [3, "ngStyle"], ["magicViewContainerRef", ""], ["tabindex", "-1", 2, "float", "right", "border", "none", "background-color", "transparent", "outline", "none", "color", "white", 3, "click"], [1, "modal-header"], ["tabindex", "-1", 2, "float", "right", 3, "click"]], template: function MagicOverlayContainer_Template(rf, ctx) { if (rf & 1) {
|
960
1171
|
const _r1 = i0.ɵɵgetCurrentView();
|
961
1172
|
i0.ɵɵelementStart(0, "div")(1, "div", 3);
|
962
1173
|
i0.ɵɵlistener("click", function MagicOverlayContainer_Template_div_click_1_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnBackgroundClick()); });
|
@@ -996,7 +1207,7 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
996
1207
|
</div>
|
997
1208
|
</div>
|
998
1209
|
</div>
|
999
|
-
`, styles: [".modal-foreground{position:fixed;inset:0;background-color:#fff}.modal-background{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header{background-color:beige;border-bottom:2px solid red}\n"] }]
|
1210
|
+
`, standalone: false, styles: [".modal-foreground{position:fixed;inset:0;background-color:#fff}.modal-background{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header{background-color:beige;border-bottom:2px solid red}\n"] }]
|
1000
1211
|
}], () => [], { headerElementRef: [{
|
1001
1212
|
type: ViewChild,
|
1002
1213
|
args: ['modalheader', { static: false }]
|
@@ -1010,32 +1221,54 @@ class MagicOverlayContainer extends BaseMagicOverlayContainer {
|
|
1010
1221
|
}], onClose: [{
|
1011
1222
|
type: Output
|
1012
1223
|
}] }); })();
|
1013
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src
|
1224
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainer, { className: "MagicOverlayContainer", filePath: "src/ui/magic-modal/magic-overlay-container.ts", lineNumber: 41 }); })();
|
1014
1225
|
|
1226
|
+
/**
|
1227
|
+
* Service managing overlay windows
|
1228
|
+
* This is Magic's default provider
|
1229
|
+
*/
|
1015
1230
|
class OverlayContainerMagicProvider {
|
1016
1231
|
getComponent() {
|
1017
1232
|
return MagicOverlayContainer;
|
1018
1233
|
}
|
1019
|
-
static ɵfac = function OverlayContainerMagicProvider_Factory(
|
1020
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
|
1234
|
+
/** @nocollapse */ static ɵfac = function OverlayContainerMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OverlayContainerMagicProvider)(); };
|
1235
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayContainerMagicProvider, factory: OverlayContainerMagicProvider.ɵfac });
|
1021
1236
|
}
|
1022
1237
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayContainerMagicProvider, [{
|
1023
1238
|
type: Injectable
|
1024
1239
|
}], null, null); })();
|
1025
1240
|
|
1241
|
+
/**
|
1242
|
+
* This is a base class for the magic confirm components
|
1243
|
+
*/
|
1026
1244
|
class BaseMagicConfirmComponent {
|
1245
|
+
/**
|
1246
|
+
* title of the component
|
1247
|
+
*/
|
1027
1248
|
title;
|
1249
|
+
/**
|
1250
|
+
* message of the component
|
1251
|
+
*/
|
1028
1252
|
message;
|
1253
|
+
/**
|
1254
|
+
* onClose Event - to be raised when the component is closed
|
1255
|
+
* should pass true when OK is pressed and false when cancel is pressed
|
1256
|
+
*/
|
1029
1257
|
onClose = new EventEmitter();
|
1258
|
+
/**
|
1259
|
+
* raises close Event
|
1260
|
+
* @param result true when OK is pressed and false when cancel is pressed
|
1261
|
+
*
|
1262
|
+
*/
|
1030
1263
|
OnClose(result) {
|
1031
1264
|
this.onClose.emit(result);
|
1032
1265
|
}
|
1033
|
-
static ɵfac = function BaseMagicConfirmComponent_Factory(
|
1034
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { } });
|
1266
|
+
/** @nocollapse */ static ɵfac = function BaseMagicConfirmComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicConfirmComponent)(); };
|
1267
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-confirm"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
1035
1268
|
}
|
1036
1269
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
|
1037
1270
|
type: Component,
|
1038
|
-
args: [{ selector: 'mg-base-confirm', template: '' }]
|
1271
|
+
args: [{ selector: 'mg-base-confirm', template: '', standalone: false }]
|
1039
1272
|
}], null, { title: [{
|
1040
1273
|
type: Input
|
1041
1274
|
}], message: [{
|
@@ -1043,21 +1276,37 @@ class BaseMagicConfirmComponent {
|
|
1043
1276
|
}], onClose: [{
|
1044
1277
|
type: Output
|
1045
1278
|
}] }); })();
|
1046
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src
|
1279
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicConfirmComponent, { className: "BaseMagicConfirmComponent", filePath: "src/ui/components/base-magic-confirm.component.ts", lineNumber: 13 }); })();
|
1047
1280
|
|
1281
|
+
/**
|
1282
|
+
* This is a base class for the magic alert components
|
1283
|
+
*/
|
1048
1284
|
class BaseMagicAlertComponent {
|
1285
|
+
/**
|
1286
|
+
* title of the component
|
1287
|
+
*/
|
1049
1288
|
title;
|
1289
|
+
/**
|
1290
|
+
* message of the component
|
1291
|
+
*/
|
1050
1292
|
message;
|
1293
|
+
/**
|
1294
|
+
* onClose Event - to be raised when the component is closed
|
1295
|
+
|
1296
|
+
*/
|
1051
1297
|
onClose = new EventEmitter();
|
1298
|
+
/**
|
1299
|
+
* close magic alert
|
1300
|
+
*/
|
1052
1301
|
OnClose() {
|
1053
1302
|
this.onClose.emit();
|
1054
1303
|
}
|
1055
|
-
static ɵfac = function BaseMagicAlertComponent_Factory(
|
1056
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { } });
|
1304
|
+
/** @nocollapse */ static ɵfac = function BaseMagicAlertComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BaseMagicAlertComponent)(); };
|
1305
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: BaseMagicAlertComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, standalone: false, decls: 0, vars: 0, template: function BaseMagicAlertComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
1057
1306
|
}
|
1058
1307
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
|
1059
1308
|
type: Component,
|
1060
|
-
args: [{ selector: 'mg-base-alert', template: '' }]
|
1309
|
+
args: [{ selector: 'mg-base-alert', template: '', standalone: false }]
|
1061
1310
|
}], null, { title: [{
|
1062
1311
|
type: Input
|
1063
1312
|
}], message: [{
|
@@ -1065,8 +1314,11 @@ class BaseMagicAlertComponent {
|
|
1065
1314
|
}], onClose: [{
|
1066
1315
|
type: Output
|
1067
1316
|
}] }); })();
|
1068
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src
|
1317
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BaseMagicAlertComponent, { className: "BaseMagicAlertComponent", filePath: "src/ui/components/base-magic-alert.component.ts", lineNumber: 14 }); })();
|
1069
1318
|
|
1319
|
+
/**
|
1320
|
+
* Directive for setting focus on element
|
1321
|
+
*/
|
1070
1322
|
class MagicFocusDirective {
|
1071
1323
|
hostElement;
|
1072
1324
|
constructor(hostElement) {
|
@@ -1075,13 +1327,14 @@ class MagicFocusDirective {
|
|
1075
1327
|
ngAfterViewInit() {
|
1076
1328
|
this.hostElement.nativeElement.focus();
|
1077
1329
|
}
|
1078
|
-
static ɵfac = function MagicFocusDirective_Factory(
|
1079
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]] });
|
1330
|
+
/** @nocollapse */ static ɵfac = function MagicFocusDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicFocusDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
1331
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicFocusDirective, selectors: [["", "magicFocus", ""]], standalone: false });
|
1080
1332
|
}
|
1081
1333
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicFocusDirective, [{
|
1082
1334
|
type: Directive,
|
1083
1335
|
args: [{
|
1084
|
-
selector: '[magicFocus]'
|
1336
|
+
selector: '[magicFocus]',
|
1337
|
+
standalone: false
|
1085
1338
|
}]
|
1086
1339
|
}], () => [{ type: i0.ElementRef }], null); })();
|
1087
1340
|
|
@@ -1092,17 +1345,34 @@ class MagicOverlayContainerWrapper {
|
|
1092
1345
|
injector;
|
1093
1346
|
changeDetectorRef;
|
1094
1347
|
compiler;
|
1348
|
+
/**
|
1349
|
+
*
|
1350
|
+
*/
|
1095
1351
|
Component = null;
|
1352
|
+
/**
|
1353
|
+
*
|
1354
|
+
*/
|
1096
1355
|
Parameters = {};
|
1097
1356
|
OverlayTypeParam;
|
1098
1357
|
onClose = new EventEmitter();
|
1358
|
+
/**
|
1359
|
+
* HTML to be displayed in the modal window
|
1360
|
+
*/
|
1099
1361
|
overlayContentViewContainerRef;
|
1100
1362
|
overlayContainerWrapperElementRef;
|
1363
|
+
/**
|
1364
|
+
* @ignore
|
1365
|
+
* contais data of allowed base components to use
|
1366
|
+
*/
|
1101
1367
|
static allowedBaseComps = new Map([
|
1102
1368
|
[OverlayType.Overlay, { comp: BaseMagicOverlayContainer, error: 'BaseMagicOverlayContainer . Overlay ' }],
|
1103
1369
|
[OverlayType.Alert, { comp: BaseMagicAlertComponent, error: 'BaseMagicAlertComponent. Alert ' }],
|
1104
1370
|
[OverlayType.ConfirmationBox, { comp: BaseMagicConfirmComponent, error: 'BaseMagicConfirmComponent. Confirmation ' }]
|
1105
1371
|
]);
|
1372
|
+
/**
|
1373
|
+
*
|
1374
|
+
* @param componentFactoryResolver
|
1375
|
+
*/
|
1106
1376
|
constructor(componentListMagicService, magicLazyModuleLoader, injector, changeDetectorRef, compiler) {
|
1107
1377
|
this.componentListMagicService = componentListMagicService;
|
1108
1378
|
this.magicLazyModuleLoader = magicLazyModuleLoader;
|
@@ -1110,6 +1380,9 @@ class MagicOverlayContainerWrapper {
|
|
1110
1380
|
this.changeDetectorRef = changeDetectorRef;
|
1111
1381
|
this.compiler = compiler;
|
1112
1382
|
}
|
1383
|
+
/**
|
1384
|
+
*
|
1385
|
+
*/
|
1113
1386
|
ngOnInit() {
|
1114
1387
|
let moduleRef = this.componentListMagicService.getModuleRef(this.Parameters.MagicFormName);
|
1115
1388
|
if (moduleRef == null) {
|
@@ -1117,6 +1390,7 @@ class MagicOverlayContainerWrapper {
|
|
1117
1390
|
if (lazyLoadModule != null) {
|
1118
1391
|
const Magic = 'Magic';
|
1119
1392
|
const Module = 'Module';
|
1393
|
+
// extract name of module(XX) from 'MagicXXModule'
|
1120
1394
|
const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
|
1121
1395
|
this.magicLazyModuleLoader.Load(moduleName).then(m => {
|
1122
1396
|
const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
|
@@ -1155,13 +1429,13 @@ class MagicOverlayContainerWrapper {
|
|
1155
1429
|
DetectChanges() {
|
1156
1430
|
this.changeDetectorRef.detectChanges();
|
1157
1431
|
}
|
1158
|
-
static ɵfac = function MagicOverlayContainerWrapper_Factory(
|
1159
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
|
1432
|
+
/** @nocollapse */ static ɵfac = function MagicOverlayContainerWrapper_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicOverlayContainerWrapper)(i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(MagicLazyLoaderService), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.Compiler)); };
|
1433
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicOverlayContainerWrapper, selectors: [["app-magic-overlay-container-wrapper"]], viewQuery: function MagicOverlayContainerWrapper_Query(rf, ctx) { if (rf & 1) {
|
1160
1434
|
i0.ɵɵviewQuery(_c0$2, 7);
|
1161
1435
|
} if (rf & 2) {
|
1162
1436
|
let _t;
|
1163
1437
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.overlayContainerWrapperElementRef = _t.first);
|
1164
|
-
} }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, decls: 7, vars: 0, consts: [["overlayContainerWrapper", ""], ["overlayContent", ""], ["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["magicViewContainerRef", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
|
1438
|
+
} }, inputs: { Component: "Component", Parameters: "Parameters", OverlayTypeParam: "OverlayTypeParam" }, outputs: { onClose: "onClose" }, standalone: false, decls: 7, vars: 0, consts: [["overlayContainerWrapper", ""], ["overlayContent", ""], ["tabIndex", "0", "magicFocus", "", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"], [1, "overlay-container-wrapper-background"], ["magicViewContainerRef", ""], ["tabIndex", "0", 1, "overlay-container-wrapper-background", 2, "width", "0px", "height", "0px"]], template: function MagicOverlayContainerWrapper_Template(rf, ctx) { if (rf & 1) {
|
1165
1439
|
i0.ɵɵelementStart(0, "div");
|
1166
1440
|
i0.ɵɵelement(1, "div", 2);
|
1167
1441
|
i0.ɵɵelementStart(2, "div", 3, 0);
|
@@ -1182,7 +1456,7 @@ class MagicOverlayContainerWrapper {
|
|
1182
1456
|
</div>
|
1183
1457
|
<div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" ></div>
|
1184
1458
|
</div>
|
1185
|
-
`, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
|
1459
|
+
`, standalone: false, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
|
1186
1460
|
}], () => [{ type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.ChangeDetectorRef }, { type: i0.Compiler }], { Component: [{
|
1187
1461
|
type: Input
|
1188
1462
|
}], Parameters: [{
|
@@ -1195,11 +1469,14 @@ class MagicOverlayContainerWrapper {
|
|
1195
1469
|
type: ViewChild,
|
1196
1470
|
args: ['overlayContainerWrapper', { static: true }]
|
1197
1471
|
}] }); })();
|
1198
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src
|
1472
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicOverlayContainerWrapper, { className: "MagicOverlayContainerWrapper", filePath: "src/ui/magic-modal/magic-overlay-container-wrapper.ts", lineNumber: 46 }); })();
|
1199
1473
|
|
1474
|
+
/***
|
1475
|
+
* This is sample component for the alert message
|
1476
|
+
*/
|
1200
1477
|
class MagicAlertComponent extends BaseMagicAlertComponent {
|
1201
|
-
static ɵfac = (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(
|
1202
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
|
1478
|
+
/** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicAlertComponent_BaseFactory; return function MagicAlertComponent_Factory(__ngFactoryType__) { return (ɵMagicAlertComponent_BaseFactory || (ɵMagicAlertComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicAlertComponent)))(__ngFactoryType__ || MagicAlertComponent); }; })();
|
1479
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicAlertComponent, selectors: [["sample-magic-alert-component"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 8, vars: 2, consts: [[1, "mg-message-background"], [3, "click"]], template: function MagicAlertComponent_Template(rf, ctx) { if (rf & 1) {
|
1203
1480
|
i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
|
1204
1481
|
i0.ɵɵtext(3);
|
1205
1482
|
i0.ɵɵelementEnd();
|
@@ -1226,13 +1503,16 @@ class MagicAlertComponent extends BaseMagicAlertComponent {
|
|
1226
1503
|
|
1227
1504
|
<button (click)="OnClose()">OK</button>
|
1228
1505
|
</div>
|
1229
|
-
</div>`, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
|
1506
|
+
</div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
|
1230
1507
|
}], null, null); })();
|
1231
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src
|
1508
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicAlertComponent, { className: "MagicAlertComponent", filePath: "src/ui/components/magic-alert.component.ts", lineNumber: 49 }); })();
|
1232
1509
|
|
1510
|
+
/***
|
1511
|
+
* This is sample component for the confirmation box
|
1512
|
+
*/
|
1233
1513
|
class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
|
1234
|
-
static ɵfac = (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(
|
1235
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "mg-message-background"], [3, "click"], [1, "cancel", 3, "click"]], template: function MagicConfirmationBoxComponent_Template(rf, ctx) { if (rf & 1) {
|
1514
|
+
/** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicConfirmationBoxComponent_BaseFactory; return function MagicConfirmationBoxComponent_Factory(__ngFactoryType__) { return (ɵMagicConfirmationBoxComponent_BaseFactory || (ɵMagicConfirmationBoxComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MagicConfirmationBoxComponent)))(__ngFactoryType__ || MagicConfirmationBoxComponent); }; })();
|
1515
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicConfirmationBoxComponent, selectors: [["sample-magic-confirmation-box"]], standalone: false, features: [i0.ɵɵ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) {
|
1236
1516
|
i0.ɵɵelementStart(0, "div")(1, "div", 0)(2, "h2");
|
1237
1517
|
i0.ɵɵtext(3);
|
1238
1518
|
i0.ɵɵelementEnd();
|
@@ -1265,29 +1545,56 @@ class MagicConfirmationBoxComponent extends BaseMagicConfirmComponent {
|
|
1265
1545
|
<button (click)="OnClose(true)">OK</button>
|
1266
1546
|
<button class="cancel" (click)="OnClose(false)">Cancel</button>
|
1267
1547
|
</div>
|
1268
|
-
</div>`, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
|
1548
|
+
</div>`, standalone: false, styles: [".mg-message-background{background-color:#f5f5f5;width:40%;font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;padding:17px;border-radius:5px;text-align:center;margin-top:10%;margin-left:auto;margin-right:auto;border:1px solid gray}button{background-color:#8cd4f5;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
|
1269
1549
|
}], null, null); })();
|
1270
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src
|
1550
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicConfirmationBoxComponent, { className: "MagicConfirmationBoxComponent", filePath: "src/ui/components/magic-confirmation-box.component.ts", lineNumber: 55 }); })();
|
1271
1551
|
|
1552
|
+
/**
|
1553
|
+
* Service managing overlay windows
|
1554
|
+
* This is Magic's default provider
|
1555
|
+
*/
|
1556
|
+
/**
|
1557
|
+
* Service managing alert and confirmation windows
|
1558
|
+
* This is Magic's default provider
|
1559
|
+
*/
|
1272
1560
|
class ConfirmationComponentsMagicProvider {
|
1561
|
+
/**
|
1562
|
+
* Return true when use default javascript alert and confirmation or return false to provide custom components
|
1563
|
+
* @returns true is we want to use default javascript alert and confirmation
|
1564
|
+
*/
|
1273
1565
|
showDefaultConfirmations() {
|
1274
1566
|
return true;
|
1275
1567
|
}
|
1568
|
+
/**
|
1569
|
+
* Returns component that will replace javascript alert. The component will be used only if showDefaultConfirmations = false
|
1570
|
+
* @returns component that will replace javascript Alert
|
1571
|
+
*/
|
1276
1572
|
getAlertComponent() {
|
1277
1573
|
return MagicAlertComponent;
|
1278
1574
|
}
|
1575
|
+
/**
|
1576
|
+
* Returns component that will replace javascript confirmation box. The component will be used only if showDefaultConfirmations = false
|
1577
|
+
* @returns component that will replace javascript confirmation box
|
1578
|
+
*/
|
1279
1579
|
getConfirmtionComponent() {
|
1280
1580
|
return MagicConfirmationBoxComponent;
|
1281
1581
|
}
|
1282
|
-
static ɵfac = function ConfirmationComponentsMagicProvider_Factory(
|
1283
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
|
1582
|
+
/** @nocollapse */ static ɵfac = function ConfirmationComponentsMagicProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ConfirmationComponentsMagicProvider)(); };
|
1583
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ConfirmationComponentsMagicProvider, factory: ConfirmationComponentsMagicProvider.ɵfac });
|
1284
1584
|
}
|
1285
1585
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfirmationComponentsMagicProvider, [{
|
1286
1586
|
type: Injectable
|
1287
1587
|
}], null, null); })();
|
1288
1588
|
|
1589
|
+
/**
|
1590
|
+
* Displays a message-box
|
1591
|
+
*/
|
1289
1592
|
class confirmationBox {
|
1593
|
+
/**
|
1594
|
+
* @ignore
|
1595
|
+
*/
|
1290
1596
|
static isConfirmBox(style) {
|
1597
|
+
// button format mask is in first nibble from right
|
1291
1598
|
let buttonMode = style & 0x0F;
|
1292
1599
|
var isConfirm = (buttonMode === Styles.MSGBOX_BUTTON_OK_CANCEL) ||
|
1293
1600
|
(buttonMode === Styles.MSGBOX_BUTTON_ABORT_RETRY_IGNORE) ||
|
@@ -1296,7 +1603,14 @@ class confirmationBox {
|
|
1296
1603
|
(buttonMode === Styles.MSGBOX_BUTTON_RETRY_CANCEL);
|
1297
1604
|
return (isConfirm);
|
1298
1605
|
}
|
1606
|
+
/**
|
1607
|
+
* Converts the result from the HTML window to the expected result type
|
1608
|
+
* @param style Result received from HTML window
|
1609
|
+
* @param okWasPressed Was the "OK" pressed
|
1610
|
+
* @returns MessageBox result type
|
1611
|
+
*/
|
1299
1612
|
static convertToExcpectedResultBox(style, okWasPressed) {
|
1613
|
+
// button format mask is in first nibble from right
|
1300
1614
|
let buttonMode = style & 0x0F;
|
1301
1615
|
let retValue = Styles.MSGBOX_RESULT_OK;
|
1302
1616
|
if (buttonMode === Styles.MSGBOX_BUTTON_OK)
|
@@ -1313,9 +1627,18 @@ class confirmationBox {
|
|
1313
1627
|
retValue = okWasPressed ? Styles.MSGBOX_RESULT_RETRY : Styles.MSGBOX_RESULT_CANCEL;
|
1314
1628
|
return retValue;
|
1315
1629
|
}
|
1630
|
+
/**
|
1631
|
+
* Show a message box as an HTML window
|
1632
|
+
* @param title Title of the message box
|
1633
|
+
* @param message Message that will be display in the message box
|
1634
|
+
* @param style Style that include buttons \ Icons
|
1635
|
+
* @returns MessageBox result
|
1636
|
+
*/
|
1316
1637
|
static showConfirmationBox(title, message, style) {
|
1317
1638
|
let okWasPressed = false;
|
1639
|
+
// check if it is confirmation box
|
1318
1640
|
let isConfirm = this.isConfirmBox(style);
|
1641
|
+
// the title will be added to the string and we will add new line after the title
|
1319
1642
|
let titleAndString = title + '\n' + '\n' + message;
|
1320
1643
|
if (isConfirm)
|
1321
1644
|
okWasPressed = confirm(titleAndString);
|
@@ -1323,10 +1646,14 @@ class confirmationBox {
|
|
1323
1646
|
alert(titleAndString);
|
1324
1647
|
okWasPressed = true;
|
1325
1648
|
}
|
1649
|
+
// return the result from the user
|
1326
1650
|
return okWasPressed;
|
1327
1651
|
}
|
1328
1652
|
}
|
1329
1653
|
|
1654
|
+
/**
|
1655
|
+
* Service managing overlay windows
|
1656
|
+
*/
|
1330
1657
|
class OverlayWindowService {
|
1331
1658
|
componentList;
|
1332
1659
|
engineMagicService;
|
@@ -1344,6 +1671,7 @@ class OverlayWindowService {
|
|
1344
1671
|
this.overlayContainerMagicProvider = overlayContainerMagicProvider;
|
1345
1672
|
this.confirmationComponentsMagicProvider = confirmationComponentsMagicProvider;
|
1346
1673
|
}
|
1674
|
+
// The view reference of container of overlay window
|
1347
1675
|
overlayWindowsContainerViewRef;
|
1348
1676
|
overlayWindowFocusManager = null;
|
1349
1677
|
changeDetectorRef = null;
|
@@ -1359,6 +1687,7 @@ class OverlayWindowService {
|
|
1359
1687
|
if (lazyLoadModule != null) {
|
1360
1688
|
const Magic = 'Magic';
|
1361
1689
|
const Module = 'Module';
|
1690
|
+
// extract name of module(XX) from 'MagicXXModule'
|
1362
1691
|
const moduleName = lazyLoadModule.moduleName.slice(Magic.length, -Module.length);
|
1363
1692
|
this.magicLazyModuleLoader.Load(moduleName).then(m => {
|
1364
1693
|
const compiled = this.compiler.compileModuleAndAllComponentsSync(m[lazyLoadModule.moduleName]);
|
@@ -1374,6 +1703,7 @@ class OverlayWindowService {
|
|
1374
1703
|
}
|
1375
1704
|
}
|
1376
1705
|
open(formName, taskId, taskDescription) {
|
1706
|
+
// for overlay which are lazy loaded don't find data in component-list
|
1377
1707
|
let comp = this.componentList.lazyLoadModulesMap != null && this.componentList.lazyLoadModulesMap.hasOwnProperty(formName) ? null : this.componentList.getComponent(formName);
|
1378
1708
|
let parameters = { taskIdParam: taskId, taskDescription: taskDescription };
|
1379
1709
|
let componentRef = this.createModalComponent({ MagicFormName: formName, ModalComp: comp, ModalCompParameters: parameters }, this.overlayContainerMagicProvider.getComponent(), OverlayType.Overlay);
|
@@ -1382,21 +1712,31 @@ class OverlayWindowService {
|
|
1382
1712
|
guiEvent.TaskID = taskId;
|
1383
1713
|
this.engineMagicService.insertEvent(guiEvent);
|
1384
1714
|
});
|
1715
|
+
//using the same changeDetectorRef from root-component
|
1385
1716
|
this.changeDetectorRef.detectChanges();
|
1386
1717
|
}
|
1387
1718
|
close(commandStr) {
|
1719
|
+
// Close the overlay by removing the overlay window from its container
|
1388
1720
|
this.overlayWindowsContainerViewRef.remove();
|
1389
1721
|
this.overlayWindowFocusManager.popDialog();
|
1390
1722
|
let guiEvent1 = getGuiEventObj("dispose", null, 0);
|
1391
1723
|
guiEvent1.TaskID = commandStr;
|
1392
1724
|
this.engineMagicService.insertEvent(guiEvent1);
|
1393
1725
|
}
|
1726
|
+
/**
|
1727
|
+
* Open Confirmation box
|
1728
|
+
* @param title title of the box
|
1729
|
+
* @param msg message
|
1730
|
+
* @param style Magic style
|
1731
|
+
*/
|
1394
1732
|
openConfirmationBox(title, msg, style) {
|
1733
|
+
//show default confirmations
|
1395
1734
|
if (this.confirmationComponentsMagicProvider.showDefaultConfirmations()) {
|
1396
1735
|
let res = confirmationBox.showConfirmationBox(title, msg, style);
|
1397
1736
|
this.finishConfirmation(style, res);
|
1398
1737
|
}
|
1399
1738
|
else {
|
1739
|
+
//show custom confirmations
|
1400
1740
|
let comp = confirmationBox.isConfirmBox(style) ? this.confirmationComponentsMagicProvider.getConfirmtionComponent() : this.confirmationComponentsMagicProvider.getAlertComponent();
|
1401
1741
|
let overlayType = confirmationBox.isConfirmBox(style) ? OverlayType.ConfirmationBox : OverlayType.Alert;
|
1402
1742
|
let componentRef = this.createModalComponent({ title: title, message: msg }, comp, overlayType);
|
@@ -1407,11 +1747,21 @@ class OverlayWindowService {
|
|
1407
1747
|
});
|
1408
1748
|
}
|
1409
1749
|
}
|
1750
|
+
/**
|
1751
|
+
* This method is called on close of the confirmation
|
1752
|
+
* @param style Magic style
|
1753
|
+
* @param result
|
1754
|
+
*/
|
1410
1755
|
finishConfirmation(style, result) {
|
1411
1756
|
let guiEvent = getGuiEventObj("confirmationClosed", null, 0);
|
1412
1757
|
guiEvent.keyCode = confirmationBox.convertToExcpectedResultBox(style, result);
|
1413
1758
|
this.engineMagicService.insertEvent(guiEvent);
|
1414
1759
|
}
|
1760
|
+
/**
|
1761
|
+
* creates a modal component. Can be used for overlay, message box or confirmation box
|
1762
|
+
* @param parameters component's parameters
|
1763
|
+
* @param component components to create
|
1764
|
+
*/
|
1415
1765
|
createModalComponent(parameters, component, overlayType) {
|
1416
1766
|
let componentRef;
|
1417
1767
|
let magicModalContainerParameters = {
|
@@ -1419,15 +1769,17 @@ class OverlayWindowService {
|
|
1419
1769
|
Parameters: parameters,
|
1420
1770
|
OverlayTypeParam: overlayType
|
1421
1771
|
};
|
1772
|
+
// Create the UI component of modal window
|
1422
1773
|
let viewCRef = this.overlayWindowsContainerViewRef;
|
1423
1774
|
componentRef = viewCRef.createComponent(MagicOverlayContainerWrapper);
|
1775
|
+
// Set the data to newly created component
|
1424
1776
|
Object.assign(componentRef.instance, magicModalContainerParameters);
|
1425
1777
|
this.overlayWindowFocusManager.pushDialog(componentRef.instance.GetRootElement());
|
1426
1778
|
componentRef.instance.DetectChanges();
|
1427
1779
|
return componentRef;
|
1428
1780
|
}
|
1429
|
-
static ɵfac = function OverlayWindowService_Factory(
|
1430
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
|
1781
|
+
/** @nocollapse */ static ɵfac = function OverlayWindowService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || OverlayWindowService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(MagicLazyLoaderService), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(OverlayContainerMagicProvider), i0.ɵɵinject(ConfirmationComponentsMagicProvider)); };
|
1782
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: OverlayWindowService, factory: OverlayWindowService.ɵfac, providedIn: 'root' });
|
1431
1783
|
}
|
1432
1784
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(OverlayWindowService, [{
|
1433
1785
|
type: Injectable,
|
@@ -1555,50 +1907,135 @@ class DialogInfo {
|
|
1555
1907
|
}
|
1556
1908
|
}
|
1557
1909
|
|
1910
|
+
/**
|
1911
|
+
* Main service to connect the UI with the Magic WebCLient
|
1912
|
+
*/
|
1558
1913
|
class TaskMagicService {
|
1559
1914
|
magic;
|
1560
1915
|
overlayWindowService;
|
1916
|
+
/**
|
1917
|
+
* Service to provide table-related functionalities
|
1918
|
+
*/
|
1561
1919
|
tableService;
|
1920
|
+
/**
|
1921
|
+
* Collection of data for all controls
|
1922
|
+
*/
|
1562
1923
|
Records = new Records();
|
1924
|
+
/**
|
1925
|
+
* FormGroup collection for line mode
|
1926
|
+
*/
|
1563
1927
|
formGroups = [];
|
1928
|
+
/**
|
1929
|
+
* FormGroup for all controls in screen mode
|
1930
|
+
*/
|
1564
1931
|
ScreenModeControls;
|
1932
|
+
/**
|
1933
|
+
* @ignore
|
1934
|
+
*/
|
1565
1935
|
refreshDom = new Subject();
|
1936
|
+
/**
|
1937
|
+
* @ignore
|
1938
|
+
*/
|
1566
1939
|
subscribeRefreshDom;
|
1940
|
+
/**
|
1941
|
+
* @ignore
|
1942
|
+
*/
|
1567
1943
|
detectChanges = new Subject();
|
1944
|
+
/**
|
1945
|
+
* @ignore
|
1946
|
+
*/
|
1568
1947
|
subscribeInteractiveCommands;
|
1948
|
+
/**
|
1949
|
+
* @ignore
|
1950
|
+
*/
|
1569
1951
|
interactiveCommands = new Subject();
|
1952
|
+
/**
|
1953
|
+
* @ignore
|
1954
|
+
* This event is emitted when the selected row in a table changes.
|
1955
|
+
*/
|
1570
1956
|
OnSelectedRowChanged = new EventEmitter();
|
1957
|
+
/**
|
1958
|
+
* @ignore
|
1959
|
+
*/
|
1571
1960
|
customPropertiesSubject = new Subject();
|
1961
|
+
/**
|
1962
|
+
* @ignore
|
1963
|
+
*/
|
1572
1964
|
recordsCountChangeSubject = new Subject();
|
1573
1965
|
mgLoadSubject = new Subject();
|
1966
|
+
/**
|
1967
|
+
* @ignore
|
1968
|
+
*/
|
1574
1969
|
template;
|
1970
|
+
/**
|
1971
|
+
* Service to provide subform-related functionalities
|
1972
|
+
*/
|
1575
1973
|
mgSubformService;
|
1974
|
+
/**
|
1975
|
+
* Service to provide the title-change functionality
|
1976
|
+
*/
|
1576
1977
|
mgTitleService;
|
1978
|
+
/**
|
1979
|
+
* Service which enables getting/setting values from/to the Magic WebClient engine
|
1980
|
+
*/
|
1577
1981
|
mgAccessorService;
|
1578
1982
|
mgInputDateFormat;
|
1983
|
+
/**
|
1984
|
+
* @ignore
|
1985
|
+
*/
|
1579
1986
|
oldPageSize = 0;
|
1987
|
+
/**
|
1988
|
+
*
|
1989
|
+
* @param magic
|
1990
|
+
*/
|
1580
1991
|
constructor(magic, overlayWindowService) {
|
1581
1992
|
this.magic = magic;
|
1582
1993
|
this.overlayWindowService = overlayWindowService;
|
1583
1994
|
this.Records.setGuiTopIndex(0);
|
1584
1995
|
this.mgInputDateFormat = null;
|
1585
1996
|
}
|
1997
|
+
/**
|
1998
|
+
* returns true if used is logged in
|
1999
|
+
* @returns
|
2000
|
+
*/
|
1586
2001
|
getIsLoggenIn() {
|
1587
2002
|
return this.magic.getIsLoggedIn();
|
1588
2003
|
}
|
2004
|
+
/**
|
2005
|
+
* Id of task to which this service refers
|
2006
|
+
*/
|
1589
2007
|
_taskId;
|
2008
|
+
/**
|
2009
|
+
* returns the task Id
|
2010
|
+
* @returns
|
2011
|
+
*/
|
1590
2012
|
get taskId() {
|
1591
2013
|
return this._taskId;
|
1592
2014
|
}
|
2015
|
+
/**
|
2016
|
+
* Sets the task Id
|
2017
|
+
* @param value the task id to set
|
2018
|
+
*/
|
1593
2019
|
set taskId(value) {
|
2020
|
+
// debugger;
|
1594
2021
|
this._taskId = value;
|
1595
2022
|
}
|
2023
|
+
/**
|
2024
|
+
* Returns the task's data in Screen mode
|
2025
|
+
* @returns
|
2026
|
+
*/
|
1596
2027
|
get ScreenControlsData() {
|
1597
2028
|
return this.Records.list['0'];
|
1598
2029
|
}
|
2030
|
+
/**
|
2031
|
+
* @ignore
|
2032
|
+
*/
|
1599
2033
|
settemplate(value) {
|
1600
2034
|
this.template = value;
|
1601
2035
|
}
|
2036
|
+
/**
|
2037
|
+
* Builds the FormControl for each and every control
|
2038
|
+
*/
|
1602
2039
|
buildScreenModeControls() {
|
1603
2040
|
const group = new FormGroup({});
|
1604
2041
|
for (const key in this.template) {
|
@@ -1610,10 +2047,21 @@ class TaskMagicService {
|
|
1610
2047
|
}
|
1611
2048
|
this.ScreenModeControls = group;
|
1612
2049
|
}
|
2050
|
+
/**
|
2051
|
+
* Is the control a table control
|
2052
|
+
* @param id Id of the control
|
2053
|
+
* @returns
|
2054
|
+
*/
|
1613
2055
|
isTableControl(id) {
|
1614
2056
|
return this.template[id] == '1';
|
1615
2057
|
}
|
1616
2058
|
getMgInputDateFormat() { return this.mgInputDateFormat; }
|
2059
|
+
/**
|
2060
|
+
* Returns the FormControl of a control
|
2061
|
+
* @param guiRowid Id of the requested row
|
2062
|
+
* @param id Id of the control
|
2063
|
+
* @returns
|
2064
|
+
*/
|
1617
2065
|
getFormControl(guiRowid, id) {
|
1618
2066
|
let c;
|
1619
2067
|
let group = this.isTableControl(id) ? this.formGroups[guiRowid] : this.ScreenModeControls;
|
@@ -1623,12 +2071,21 @@ class TaskMagicService {
|
|
1623
2071
|
}
|
1624
2072
|
return c;
|
1625
2073
|
}
|
2074
|
+
/**
|
2075
|
+
* handle the change of text for input control inside table
|
2076
|
+
* @param guiRowId Id of the row for which the FormControls are built
|
2077
|
+
* set the new value of the formcontrol
|
2078
|
+
*/
|
1626
2079
|
setInputTextValue(controlId, guiRowid, val) {
|
1627
2080
|
this.setValue(controlId, guiRowid, this.ConvertValToNative(controlId, 0, val));
|
1628
2081
|
const fc = this.getFormControl(guiRowid, controlId);
|
1629
2082
|
if (!isNullOrUndefined(val))
|
1630
2083
|
fc.setValue(val);
|
1631
2084
|
}
|
2085
|
+
/**
|
2086
|
+
* Build the FormControls for a table row
|
2087
|
+
* @param guiRowId Id of the row for which the FormControls are built
|
2088
|
+
*/
|
1632
2089
|
buildTableRowControls(guiRowId) {
|
1633
2090
|
const group = new FormGroup({});
|
1634
2091
|
for (const key in this.template) {
|
@@ -1640,30 +2097,58 @@ class TaskMagicService {
|
|
1640
2097
|
}
|
1641
2098
|
this.formGroups[guiRowId] = group;
|
1642
2099
|
}
|
2100
|
+
/**
|
2101
|
+
*
|
2102
|
+
* @ignore
|
2103
|
+
*/
|
1643
2104
|
updateRecordsBeforeCurrentView(value) {
|
1644
2105
|
this.Records.recordsBeforeCurrentView = value;
|
1645
2106
|
}
|
2107
|
+
/**
|
2108
|
+
* @ignore
|
2109
|
+
*/
|
1646
2110
|
setIncludesFirst(value) {
|
1647
2111
|
this.Records.includesFirst = value;
|
1648
2112
|
}
|
2113
|
+
/**
|
2114
|
+
* @ignore
|
2115
|
+
*/
|
1649
2116
|
setIncludesLast(value) {
|
1650
2117
|
this.Records.includesLast = value;
|
1651
2118
|
}
|
2119
|
+
/**
|
2120
|
+
* @ignore
|
2121
|
+
*/
|
1652
2122
|
markRowAsCreated(guiRowId) {
|
1653
2123
|
this.Records.markRowAsCreated(guiRowId);
|
1654
2124
|
}
|
2125
|
+
/**
|
2126
|
+
* @ignore
|
2127
|
+
*/
|
1655
2128
|
markRowAsNotCreated(guiRowId) {
|
1656
2129
|
this.Records.markRowAsNotCreated(guiRowId);
|
1657
2130
|
}
|
2131
|
+
/**
|
2132
|
+
* @ignore
|
2133
|
+
*/
|
1658
2134
|
startRowEditing(guiRowId) {
|
1659
2135
|
this.Records.startRowEditing(guiRowId);
|
1660
2136
|
}
|
2137
|
+
/**
|
2138
|
+
* @ignore
|
2139
|
+
*/
|
1661
2140
|
stopRowEditing(guiRowId) {
|
1662
2141
|
this.Records.stopRowEditing(guiRowId);
|
1663
2142
|
}
|
2143
|
+
/**
|
2144
|
+
* @ignore
|
2145
|
+
*/
|
1664
2146
|
isRowInRowEditing(guiRowId) {
|
1665
2147
|
return this.Records.isRowInRowEditing(guiRowId);
|
1666
2148
|
}
|
2149
|
+
/**
|
2150
|
+
* @ignore
|
2151
|
+
*/
|
1667
2152
|
setIsEmptyDataView(isEmpty) {
|
1668
2153
|
if (this.Records.isEmptyDataView !== isEmpty) {
|
1669
2154
|
if (isEmpty)
|
@@ -1673,6 +2158,11 @@ class TaskMagicService {
|
|
1673
2158
|
this.refreshView();
|
1674
2159
|
}
|
1675
2160
|
}
|
2161
|
+
/**
|
2162
|
+
* Initialize the service to work with the task
|
2163
|
+
* @param taskId Id of the task
|
2164
|
+
* @param taskDescription
|
2165
|
+
*/
|
1676
2166
|
initTask(taskId, taskDescription) {
|
1677
2167
|
this.Records.createFirst();
|
1678
2168
|
this.oldPageSize = 0;
|
@@ -1684,39 +2174,71 @@ class TaskMagicService {
|
|
1684
2174
|
this.settemplate(taskDescription);
|
1685
2175
|
}
|
1686
2176
|
this.buildScreenModeControls();
|
2177
|
+
// remove previous subscriptions
|
1687
2178
|
if (!isNullOrUndefined(this.subscribeRefreshDom))
|
1688
2179
|
this.subscribeRefreshDom.unsubscribe();
|
1689
2180
|
if (!isNullOrUndefined(this.subscribeInteractiveCommands))
|
1690
2181
|
this.subscribeInteractiveCommands.unsubscribe();
|
1691
2182
|
this.subscribeRefreshDom = this.magic.refreshDom.pipe(filter(command => command.TaskTag === this.taskId))
|
1692
2183
|
.subscribe(command => {
|
2184
|
+
// console.log("Task " + command.TaskTag + "command " + command.CommandType);
|
1693
2185
|
this.executeCommand(command);
|
1694
2186
|
});
|
1695
2187
|
this.subscribeInteractiveCommands = this.magic.interactiveCommands
|
1696
2188
|
.pipe(filter(command => command.TaskTag === this.taskId))
|
1697
2189
|
.subscribe(command => {
|
2190
|
+
// console.log("Task " + command.TaskTag + "command " + command.CommandType);
|
1698
2191
|
this.executeInteractiveCommand(command);
|
1699
2192
|
});
|
1700
2193
|
}
|
2194
|
+
/**
|
2195
|
+
* @ignore
|
2196
|
+
*/
|
1701
2197
|
refreshView() {
|
1702
2198
|
this.detectChanges.next('');
|
1703
2199
|
}
|
2200
|
+
/**
|
2201
|
+
* Insert an event to the Magic WebClient event queue
|
2202
|
+
* @param guiEvent The event to insert
|
2203
|
+
*/
|
1704
2204
|
insertEvent(guiEvent) {
|
1705
2205
|
guiEvent.TaskID = this.taskId;
|
1706
2206
|
this.magic.insertEvent(guiEvent);
|
1707
2207
|
}
|
2208
|
+
/**
|
2209
|
+
* @ignore
|
2210
|
+
*/
|
1708
2211
|
GetControlPictureMask(controlName) {
|
1709
2212
|
return this.magic.GetControlPictureMask(this.taskId, controlName);
|
1710
2213
|
}
|
2214
|
+
/**
|
2215
|
+
* Validates the control value, using the Magic WebClient
|
2216
|
+
* @param controlName Id of validated control
|
2217
|
+
* @param value value to be validated
|
2218
|
+
* @returns If validation fails, returns error message, else returns null
|
2219
|
+
*/
|
1711
2220
|
ValidateControlValue(controlName, value) {
|
1712
2221
|
return this.magic.ValidateControlValue(this.taskId, controlName, value);
|
1713
2222
|
}
|
2223
|
+
/**
|
2224
|
+
* @ignore
|
2225
|
+
*/
|
1714
2226
|
GetRangedValue(controlName, value) {
|
1715
2227
|
return this.magic.GetRangedValue(this.taskId, controlName, value);
|
1716
2228
|
}
|
2229
|
+
/**
|
2230
|
+
* @ignore
|
2231
|
+
*/
|
1717
2232
|
GetFldRanges(controlName) {
|
1718
2233
|
return this.magic.GetFldRanges(this.taskId, controlName);
|
1719
2234
|
}
|
2235
|
+
/**
|
2236
|
+
* returns the value of a property of the control
|
2237
|
+
* @param controlId Id of control
|
2238
|
+
* @param prop Property
|
2239
|
+
* @param guiRowId Row Id, if applicable
|
2240
|
+
* @returns Property value
|
2241
|
+
*/
|
1720
2242
|
getProperty(controlId, prop, guiRowId) {
|
1721
2243
|
if (isNullOrUndefined(guiRowId))
|
1722
2244
|
guiRowId = '0';
|
@@ -1730,6 +2252,9 @@ class TaskMagicService {
|
|
1730
2252
|
return this.Records.list[guiRowId].getProperty(controlId, prop);
|
1731
2253
|
}
|
1732
2254
|
}
|
2255
|
+
/**
|
2256
|
+
* @ignore
|
2257
|
+
*/
|
1733
2258
|
getPropertyStub(ControlsProperties, controlId, prop) {
|
1734
2259
|
ControlsProperties = ControlsProperties.ControlsProperties;
|
1735
2260
|
if (controlId in ControlsProperties) {
|
@@ -1739,15 +2264,31 @@ class TaskMagicService {
|
|
1739
2264
|
}
|
1740
2265
|
return '';
|
1741
2266
|
}
|
2267
|
+
/**
|
2268
|
+
* @ignore
|
2269
|
+
*/
|
1742
2270
|
getStyleStub(ControlsProperties, controlId, styleName) {
|
1743
2271
|
ControlsProperties = ControlsProperties.ControlsProperties;
|
1744
2272
|
return ControlsProperties[controlId].stylesMap.get(styleName);
|
1745
2273
|
}
|
2274
|
+
/**
|
2275
|
+
* Return the CSS classes used for this control
|
2276
|
+
* @param controlId Id of control
|
2277
|
+
* @param guiRowId Row Id, if applicable
|
2278
|
+
* @returns String containing the classes currently defined for this control
|
2279
|
+
*/
|
1746
2280
|
getClasses(controlId, guiRowId) {
|
1747
2281
|
if (isNullOrUndefined(guiRowId))
|
1748
2282
|
guiRowId = '0';
|
1749
2283
|
return this.Records.list[guiRowId].getControlMetadata(controlId).classes;
|
1750
2284
|
}
|
2285
|
+
/**
|
2286
|
+
* Return the value of a style used for a control
|
2287
|
+
* @param controlId Id of control
|
2288
|
+
* @param styleName Name of style
|
2289
|
+
* @param guiRowId Row Id, if applicable
|
2290
|
+
* @returns value of style of the control
|
2291
|
+
*/
|
1751
2292
|
getStyle(controlId, styleName, guiRowId) {
|
1752
2293
|
if (isNullOrUndefined(guiRowId))
|
1753
2294
|
guiRowId = '0';
|
@@ -1758,21 +2299,45 @@ class TaskMagicService {
|
|
1758
2299
|
return StylesMapManager.magicValueGetStyle(styleName, magicValue);
|
1759
2300
|
}
|
1760
2301
|
}
|
2302
|
+
/**
|
2303
|
+
* Return the value of a control
|
2304
|
+
* @param controlId Id of control
|
2305
|
+
* @param guiRowId Row Id, if applicable
|
2306
|
+
* @returns value of the control
|
2307
|
+
*/
|
1761
2308
|
getValue(controlId, guiRowId) {
|
1762
2309
|
if (isNullOrUndefined(guiRowId))
|
1763
2310
|
guiRowId = '0';
|
1764
2311
|
return this.Records.list.length > +guiRowId ? this.Records.list[guiRowId].values[controlId] : '';
|
1765
2312
|
}
|
2313
|
+
/**
|
2314
|
+
* Return the formatted value of a control
|
2315
|
+
* @param controlId Id of control
|
2316
|
+
* @param guiRowId Row Id, if applicable
|
2317
|
+
* @returns value of the control
|
2318
|
+
*/
|
1766
2319
|
getFormattedValue(controlName, val, rowId) {
|
1767
2320
|
return this.magic.GetFormattedValue(this.taskId, controlName, val, rowId);
|
1768
2321
|
}
|
2322
|
+
/**
|
2323
|
+
* Sets the value of a control
|
2324
|
+
* @param controlId Id of control
|
2325
|
+
* @param guiRowId Row Id, if applicable
|
2326
|
+
* @param value Value to set
|
2327
|
+
*/
|
1769
2328
|
setValue(controlId, guiRowId, value) {
|
1770
2329
|
return this.Records.list[guiRowId].setValue(controlId, value);
|
1771
2330
|
}
|
2331
|
+
/**
|
2332
|
+
* @ignore
|
2333
|
+
*/
|
1772
2334
|
executeInteractiveCommand(guiInteractiveCommand) {
|
1773
2335
|
GuiInteractiveExecutor.executeInteractiveCommand(this, guiInteractiveCommand, this.overlayWindowService);
|
1774
2336
|
this.interactiveCommands.next(guiInteractiveCommand);
|
1775
2337
|
}
|
2338
|
+
/**
|
2339
|
+
* @ignore
|
2340
|
+
*/
|
1776
2341
|
handleSetProperty(command, isTableChild) {
|
1777
2342
|
let controlId = command.CtrlName;
|
1778
2343
|
let dvRowId = (command.line || 0);
|
@@ -1809,6 +2374,7 @@ class TaskMagicService {
|
|
1809
2374
|
let controlId = command.CtrlName;
|
1810
2375
|
let properties;
|
1811
2376
|
let isTableChild = this.isTableControl(controlId);
|
2377
|
+
// For non-input type controls on table.
|
1812
2378
|
if (command.obj !== null)
|
1813
2379
|
isTableChild = isTableChild || command.obj.IsTableChild;
|
1814
2380
|
guiRowId = this.getGuiRowId(dvRowId, isTableChild);
|
@@ -1871,8 +2437,10 @@ class TaskMagicService {
|
|
1871
2437
|
break;
|
1872
2438
|
case CommandType.PROP_SET_USER_PROPERTY:
|
1873
2439
|
properties = this.Records.list[guiRowId].getControlMetadata(controlId);
|
2440
|
+
// if the property has changed, set the property and raise the subject
|
1874
2441
|
if (properties.userProperties.get(command.Operation) !== command.obj1) {
|
1875
2442
|
properties.userProperties.set(command.Operation, command.obj1);
|
2443
|
+
// the property name is of format <controlName>~<propertyName>
|
1876
2444
|
this.customPropertiesSubject.next({ propertyName: controlId + '~' + command.Operation, value: command.obj1, rowId: guiRowId });
|
1877
2445
|
}
|
1878
2446
|
break;
|
@@ -1926,6 +2494,9 @@ class TaskMagicService {
|
|
1926
2494
|
break;
|
1927
2495
|
}
|
1928
2496
|
}
|
2497
|
+
/**
|
2498
|
+
custom validator
|
2499
|
+
*/
|
1929
2500
|
customValidator(rowid, id) {
|
1930
2501
|
return (control) => {
|
1931
2502
|
let controlMetadata;
|
@@ -1939,6 +2510,13 @@ class TaskMagicService {
|
|
1939
2510
|
return null;
|
1940
2511
|
};
|
1941
2512
|
}
|
2513
|
+
/**
|
2514
|
+
* COnvert a value from Magic format to native format
|
2515
|
+
* @param controlId Id of control
|
2516
|
+
* @param rowId Row Id, if applicable
|
2517
|
+
* @param val Value to convert
|
2518
|
+
* @returns Converted value
|
2519
|
+
*/
|
1942
2520
|
ConvertValToNative(controlId, rowId, val) {
|
1943
2521
|
let properties;
|
1944
2522
|
properties = this.Records.list[0].getControlMetadata(controlId);
|
@@ -1990,6 +2568,13 @@ class TaskMagicService {
|
|
1990
2568
|
return val;
|
1991
2569
|
}
|
1992
2570
|
}
|
2571
|
+
/**
|
2572
|
+
* Convert a value from native to Magic format
|
2573
|
+
* @param controlId Id of control
|
2574
|
+
* @param rowId Row Id, if applicable
|
2575
|
+
* @param val Value to convert
|
2576
|
+
* @returns Converted value
|
2577
|
+
*/
|
1993
2578
|
ConvertValFromNative(controlId, rowId, val) {
|
1994
2579
|
let properties;
|
1995
2580
|
properties = this.Records.list[0].getControlMetadata(controlId);
|
@@ -2032,12 +2617,22 @@ class TaskMagicService {
|
|
2032
2617
|
return val;
|
2033
2618
|
}
|
2034
2619
|
}
|
2620
|
+
/**
|
2621
|
+
* Handle resize and also fetch chunk of records if having an empty view.
|
2622
|
+
* @ignore
|
2623
|
+
* @param pageSize : PageSize
|
2624
|
+
* @param topGuiRowId : GuiRowId of first record in view.
|
2625
|
+
*/
|
2035
2626
|
resize(pageSize, topGuiRowId) {
|
2036
2627
|
let guiEvent = getGuiEventObj('resize', 'table', 0);
|
2037
2628
|
guiEvent.PageSize = pageSize;
|
2629
|
+
//As 'getRows' event also gets executed, set the guiEvent.Line parameter.
|
2038
2630
|
guiEvent.Line = topGuiRowId;
|
2039
2631
|
this.insertEvent(guiEvent);
|
2040
2632
|
}
|
2633
|
+
/**
|
2634
|
+
* Fetches data for new table rows when scrolling done
|
2635
|
+
*/
|
2041
2636
|
onScrollDown() {
|
2042
2637
|
if (!this.Records.includesLast) {
|
2043
2638
|
let guiEvent = getGuiEventObj('getRows', '', 0);
|
@@ -2045,15 +2640,29 @@ class TaskMagicService {
|
|
2045
2640
|
this.insertEvent(guiEvent);
|
2046
2641
|
}
|
2047
2642
|
}
|
2643
|
+
/**
|
2644
|
+
* Sets the new browser window title
|
2645
|
+
* @param newTitle New window title
|
2646
|
+
*/
|
2048
2647
|
setTitle(newTitle) {
|
2049
2648
|
this.mgTitleService.setTitle(newTitle);
|
2050
2649
|
}
|
2650
|
+
/**
|
2651
|
+
* @ignore
|
2652
|
+
*/
|
2051
2653
|
getGuiRowId(dvRowId, isTableControl) {
|
2052
2654
|
return (isTableControl ? dvRowId + this.Records.recordsBeforeCurrentView : 0);
|
2053
2655
|
}
|
2656
|
+
/**
|
2657
|
+
*
|
2658
|
+
* @ignore
|
2659
|
+
*/
|
2054
2660
|
getDvRowId(guiRowId) {
|
2055
2661
|
return (guiRowId - this.Records.recordsBeforeCurrentView);
|
2056
2662
|
}
|
2663
|
+
/**
|
2664
|
+
* Clean up the service when it is no longer needed
|
2665
|
+
*/
|
2057
2666
|
dispose() {
|
2058
2667
|
this.refreshDom.complete();
|
2059
2668
|
this.detectChanges.complete();
|
@@ -2063,6 +2672,14 @@ class TaskMagicService {
|
|
2063
2672
|
this.customPropertiesSubject.complete();
|
2064
2673
|
this.OnSelectedRowChanged.complete();
|
2065
2674
|
}
|
2675
|
+
///////////////////////////////
|
2676
|
+
//Events:
|
2677
|
+
/**
|
2678
|
+
* Handle the Combobox "change" event
|
2679
|
+
* @param event The event received from the UI
|
2680
|
+
* @param idx Id of the control raising the event
|
2681
|
+
* @param line Row Id, if applicable
|
2682
|
+
*/
|
2066
2683
|
onComboboxSelectionChanged(event, idx, line) {
|
2067
2684
|
let guiEvent = getGuiEventObj('selectionchanged', idx, line);
|
2068
2685
|
if (typeof (event) == 'number') {
|
@@ -2081,6 +2698,11 @@ class TaskMagicService {
|
|
2081
2698
|
}
|
2082
2699
|
this.insertEvent(guiEvent);
|
2083
2700
|
}
|
2701
|
+
/**
|
2702
|
+
* Handle the Listbox "change" event
|
2703
|
+
* @param event The event received from the UI
|
2704
|
+
* @param idx Id of the control raising the event
|
2705
|
+
*/
|
2084
2706
|
onListBoxSelectionChanged(event, idx) {
|
2085
2707
|
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
2086
2708
|
let selectedOptions;
|
@@ -2096,9 +2718,15 @@ class TaskMagicService {
|
|
2096
2718
|
else
|
2097
2719
|
indexes[i] = (selectedOptions[i]).value;
|
2098
2720
|
}
|
2099
|
-
guiEvent.Value = indexes;
|
2721
|
+
guiEvent.Value = indexes; // TODO: fix
|
2100
2722
|
this.insertEvent(guiEvent);
|
2101
2723
|
}
|
2724
|
+
/**
|
2725
|
+
* Handle the Checkbox "change" event
|
2726
|
+
* @param event The event received from the UI
|
2727
|
+
* @param idx Id of the control raising the event
|
2728
|
+
* @param rowId Row Id, if applicable
|
2729
|
+
*/
|
2102
2730
|
onCheckChanged(event, idx, rowId) {
|
2103
2731
|
if (typeof rowId === 'undefined')
|
2104
2732
|
rowId = 0;
|
@@ -2107,12 +2735,12 @@ class TaskMagicService {
|
|
2107
2735
|
guiEvent.Value = event;
|
2108
2736
|
}
|
2109
2737
|
else if (typeof (event) == 'string') {
|
2110
|
-
if (event == "unchecked") {
|
2738
|
+
if (event == "unchecked") { // @ts-ignore
|
2111
2739
|
guiEvent.Value = false;
|
2112
2740
|
}
|
2113
2741
|
else if (event == 'indeterminate')
|
2114
2742
|
guiEvent.Value = null;
|
2115
|
-
else if (event == 'checked') {
|
2743
|
+
else if (event == 'checked') { // @ts-ignore
|
2116
2744
|
guiEvent.Value = true;
|
2117
2745
|
}
|
2118
2746
|
}
|
@@ -2124,11 +2752,21 @@ class TaskMagicService {
|
|
2124
2752
|
}
|
2125
2753
|
this.insertEvent(guiEvent);
|
2126
2754
|
}
|
2755
|
+
/**
|
2756
|
+
* Handle tab selection change, caused by UI events
|
2757
|
+
* @param idx Id of the control raising the event
|
2758
|
+
* @param layer Id of selected tabpage
|
2759
|
+
*/
|
2127
2760
|
mgOnTabSelectionChanged(idx, layer) {
|
2128
2761
|
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
2129
2762
|
guiEvent.Value = layer.toString();
|
2130
2763
|
this.insertEvent(guiEvent);
|
2131
2764
|
}
|
2765
|
+
/**
|
2766
|
+
* Handle the Radio button "change" event
|
2767
|
+
* @param event The event received from the UI
|
2768
|
+
* @param idx Id of the control raising the event
|
2769
|
+
*/
|
2132
2770
|
mgOnRadioSelectionChanged(idx) {
|
2133
2771
|
let result = this.getFormControl('0', idx);
|
2134
2772
|
let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
|
@@ -2138,16 +2776,34 @@ class TaskMagicService {
|
|
2138
2776
|
guiEvent.Value = result.value.toString();
|
2139
2777
|
this.insertEvent(guiEvent);
|
2140
2778
|
}
|
2779
|
+
/**
|
2780
|
+
* Inserts the "close" event to the magic WebClient event queue
|
2781
|
+
*/
|
2141
2782
|
close() {
|
2142
2783
|
this.insertEvent(getGuiEventObj('close', null, 0));
|
2143
2784
|
}
|
2785
|
+
///////////////////////////////
|
2786
|
+
/**
|
2787
|
+
* @ignore
|
2788
|
+
*/
|
2144
2789
|
IsStub() {
|
2145
2790
|
return this.magic.isStub;
|
2146
2791
|
}
|
2792
|
+
//////////////////////////////////////////////////////////////
|
2793
|
+
///Stub handling
|
2794
|
+
/**
|
2795
|
+
* @ignore
|
2796
|
+
*/
|
2147
2797
|
jsonData;
|
2798
|
+
/**
|
2799
|
+
* @ignore
|
2800
|
+
*/
|
2148
2801
|
saveData(data) {
|
2149
2802
|
this.magic.saveData(data);
|
2150
2803
|
}
|
2804
|
+
/**
|
2805
|
+
* @ignore
|
2806
|
+
*/
|
2151
2807
|
createData() {
|
2152
2808
|
let myData = {
|
2153
2809
|
records: this.Records,
|
@@ -2159,6 +2815,9 @@ class TaskMagicService {
|
|
2159
2815
|
console.log(text);
|
2160
2816
|
this.saveData(text);
|
2161
2817
|
}
|
2818
|
+
/**
|
2819
|
+
* @ignore
|
2820
|
+
*/
|
2162
2821
|
loadStubData(stubData) {
|
2163
2822
|
this.Records = stubData.records;
|
2164
2823
|
this.settemplate(stubData.template);
|
@@ -2166,9 +2825,15 @@ class TaskMagicService {
|
|
2166
2825
|
for (let i = 0; i < this.Records.list.length; i++)
|
2167
2826
|
this.buildTableRowControls(i);
|
2168
2827
|
}
|
2828
|
+
/**
|
2829
|
+
* @ignore
|
2830
|
+
*/
|
2169
2831
|
loadData() {
|
2170
2832
|
alert('Please, overwrite method loadData');
|
2171
2833
|
}
|
2834
|
+
/**
|
2835
|
+
* @ignore
|
2836
|
+
*/
|
2172
2837
|
setStubValue(guiRowId, fc, name) {
|
2173
2838
|
if (this.IsStub()) {
|
2174
2839
|
try {
|
@@ -2179,45 +2844,79 @@ class TaskMagicService {
|
|
2179
2844
|
}
|
2180
2845
|
}
|
2181
2846
|
}
|
2182
|
-
static ɵfac = function TaskMagicService_Factory(
|
2183
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
2847
|
+
/** @nocollapse */ static ɵfac = function TaskMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskMagicService)(i0.ɵɵinject(EngineMagicService), i0.ɵɵinject(OverlayWindowService)); };
|
2848
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TaskMagicService, factory: TaskMagicService.ɵfac });
|
2184
2849
|
}
|
2185
2850
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskMagicService, [{
|
2186
2851
|
type: Injectable
|
2187
2852
|
}], () => [{ type: EngineMagicService }, { type: OverlayWindowService }], null); })();
|
2188
2853
|
|
2854
|
+
/**
|
2855
|
+
* Implements various table-related functionalities
|
2856
|
+
*/
|
2189
2857
|
class TableMagicService {
|
2190
2858
|
componentList;
|
2191
2859
|
task;
|
2192
2860
|
selectedItem;
|
2193
2861
|
chunkSize;
|
2862
|
+
/**
|
2863
|
+
*
|
2864
|
+
* @param componentList Component-mapping service
|
2865
|
+
* @param task Magic task service
|
2866
|
+
*/
|
2194
2867
|
constructor(componentList, task) {
|
2195
2868
|
this.componentList = componentList;
|
2196
2869
|
this.task = task;
|
2197
2870
|
}
|
2198
2871
|
shouldOpenFieldTextEditor = true;
|
2872
|
+
/**
|
2873
|
+
* Refreshes the DataSource
|
2874
|
+
*/
|
2199
2875
|
refreshDataSource() {
|
2200
2876
|
}
|
2877
|
+
/**
|
2878
|
+
* Returns the table page size
|
2879
|
+
* chunkSize as default value for non-paginated tables.
|
2880
|
+
*/
|
2201
2881
|
getPageSize() {
|
2202
2882
|
return this.chunkSize;
|
2203
2883
|
}
|
2204
2884
|
setChunkSize(size) {
|
2205
2885
|
this.chunkSize = size;
|
2206
2886
|
}
|
2887
|
+
/**
|
2888
|
+
* Returns max no of rows in the table.
|
2889
|
+
*/
|
2207
2890
|
getMaxRowsInTable() {
|
2208
2891
|
return this.task.Records.list.length;
|
2209
2892
|
}
|
2893
|
+
/**
|
2894
|
+
* Selects the specified row
|
2895
|
+
* @param rowId The row to select
|
2896
|
+
*/
|
2210
2897
|
selectRow(rowId) {
|
2211
2898
|
this.selectedItem = rowId;
|
2212
2899
|
}
|
2213
2900
|
getSelectedRow() {
|
2214
2901
|
return this.selectedItem;
|
2215
2902
|
}
|
2903
|
+
/**
|
2904
|
+
* Returns the selected row
|
2905
|
+
*/
|
2216
2906
|
selectedRow() {
|
2217
2907
|
return null;
|
2218
2908
|
}
|
2909
|
+
/**
|
2910
|
+
* Selects the specified page
|
2911
|
+
* @param pageId The page to select
|
2912
|
+
*/
|
2219
2913
|
selectPage(pageId) {
|
2220
2914
|
}
|
2915
|
+
/**
|
2916
|
+
* Returns whether a dialog should be opened for the HTML element
|
2917
|
+
* @param element The HTML element for which a dialog may be needed
|
2918
|
+
* @returns
|
2919
|
+
*/
|
2221
2920
|
OpenDialogForControl(element) {
|
2222
2921
|
if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
|
2223
2922
|
element.tagName === "INPUT" ||
|
@@ -2225,17 +2924,34 @@ class TableMagicService {
|
|
2225
2924
|
return false;
|
2226
2925
|
return true;
|
2227
2926
|
}
|
2927
|
+
/**
|
2928
|
+
* Returns the dialog used to edit values
|
2929
|
+
*/
|
2228
2930
|
getDialog() {
|
2229
2931
|
return null;
|
2230
2932
|
}
|
2933
|
+
/**
|
2934
|
+
* Handles the table "scrolled" event
|
2935
|
+
*/
|
2231
2936
|
onScrollDown() {
|
2232
2937
|
this.task.onScrollDown();
|
2233
2938
|
}
|
2939
|
+
/**
|
2940
|
+
* To be overwitten in specific implelemtations
|
2941
|
+
*/
|
2234
2942
|
sortData(e) { }
|
2943
|
+
/**
|
2944
|
+
* To be overwitten in specific implelemtations
|
2945
|
+
*/
|
2235
2946
|
mgOnPaginateChange(e, changeSelectedRow) { }
|
2236
2947
|
mgOptionChanged(e) { }
|
2948
|
+
/**
|
2949
|
+
* Change the number of lines in a table
|
2950
|
+
* @param size New number of lines in table
|
2951
|
+
*/
|
2237
2952
|
updateTableSize(size) {
|
2238
|
-
if (size === 0)
|
2953
|
+
if (size === 0) // never remove row 0 for now
|
2954
|
+
{
|
2239
2955
|
size = 1;
|
2240
2956
|
this.task.Records.clearFirstTableRecord(this.task.template);
|
2241
2957
|
}
|
@@ -2243,34 +2959,51 @@ class TableMagicService {
|
|
2243
2959
|
this.task.Records.updateSize(size);
|
2244
2960
|
this.task.setIncludesFirst(false);
|
2245
2961
|
}
|
2962
|
+
/**
|
2963
|
+
* @ignore
|
2964
|
+
*/
|
2246
2965
|
setTableTopIndex(value) {
|
2247
2966
|
if (!this.task.Records.includesFirst)
|
2248
2967
|
value++;
|
2249
2968
|
this.task.Records.setGuiTopIndex(value);
|
2250
2969
|
}
|
2970
|
+
/**
|
2971
|
+
* @ignore
|
2972
|
+
*/
|
2251
2973
|
getTableTopIndex() {
|
2252
2974
|
let topIndex = this.task.Records.getGuiTopIndex();
|
2253
2975
|
if (!this.task.Records.includesFirst)
|
2254
2976
|
topIndex--;
|
2255
2977
|
return topIndex;
|
2256
2978
|
}
|
2257
|
-
static ɵfac = function TableMagicService_Factory(
|
2258
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
|
2979
|
+
/** @nocollapse */ static ɵfac = function TableMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TableMagicService)(i0.ɵɵinject(ComponentListMagicService), i0.ɵɵinject(TaskMagicService)); };
|
2980
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TableMagicService, factory: TableMagicService.ɵfac });
|
2259
2981
|
}
|
2260
2982
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableMagicService, [{
|
2261
2983
|
type: Injectable
|
2262
2984
|
}], () => [{ type: ComponentListMagicService }, { type: TaskMagicService }], null); })();
|
2263
2985
|
|
2986
|
+
/**
|
2987
|
+
* Enables changing the browser title using Magic expression (SetTitle)
|
2988
|
+
*/
|
2264
2989
|
class TitleMagicService {
|
2265
2990
|
titleService;
|
2991
|
+
/**
|
2992
|
+
*
|
2993
|
+
* @param titleService Angular's title-changing class
|
2994
|
+
*/
|
2266
2995
|
constructor(titleService) {
|
2267
2996
|
this.titleService = titleService;
|
2268
2997
|
}
|
2998
|
+
/**
|
2999
|
+
* Set the new title of the window
|
3000
|
+
* @param newTitle New title of the window
|
3001
|
+
*/
|
2269
3002
|
setTitle(newTitle) {
|
2270
3003
|
this.titleService.setTitle(newTitle);
|
2271
3004
|
}
|
2272
|
-
static ɵfac = function TitleMagicService_Factory(
|
2273
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
|
3005
|
+
/** @nocollapse */ static ɵfac = function TitleMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TitleMagicService)(i0.ɵɵinject(i1$1.Title)); };
|
3006
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: TitleMagicService, factory: TitleMagicService.ɵfac });
|
2274
3007
|
}
|
2275
3008
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TitleMagicService, [{
|
2276
3009
|
type: Injectable
|
@@ -2294,6 +3027,7 @@ class MagicColorService {
|
|
2294
3027
|
}
|
2295
3028
|
colorsData;
|
2296
3029
|
fileNotFound = false;
|
3030
|
+
// public static FILE_NAME;
|
2297
3031
|
constructor(http, colorFile1 = 'clr_rnt.eng') {
|
2298
3032
|
this.http = http;
|
2299
3033
|
if (colorFile1)
|
@@ -2313,6 +3047,7 @@ class MagicColorService {
|
|
2313
3047
|
}
|
2314
3048
|
hexToRgba(hex, isTransperent) {
|
2315
3049
|
let shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i;
|
3050
|
+
// convert it to format : aarrggbb
|
2316
3051
|
hex = hex.replace(shorthandRegex, function (m, r, g, b, a) {
|
2317
3052
|
return a + a + r + r + g + g + b + b;
|
2318
3053
|
});
|
@@ -2327,16 +3062,24 @@ class MagicColorService {
|
|
2327
3062
|
rgb.alpha = 0;
|
2328
3063
|
return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + rgb.alpha + ')';
|
2329
3064
|
}
|
3065
|
+
/**
|
3066
|
+
* Returns the rgba value of specified color
|
3067
|
+
* @returns : value in format rgba(128,128,128,1)
|
3068
|
+
* @param : colorNumber -0 based index of color for which RGBA values are returned
|
3069
|
+
* @param: colorType : 1-MAGIC_FG_COLOR, 2-MAGIC_BG_COLOR
|
3070
|
+
*/
|
2330
3071
|
getColor(colorIndex, colorType) {
|
2331
3072
|
let isTransperent = false;
|
2332
3073
|
if (!this.colorsData && !this.fileNotFound)
|
2333
3074
|
this.getColorData();
|
2334
|
-
if (this.colorsData) {
|
3075
|
+
if (this.colorsData) { // color exists
|
2335
3076
|
if (this.colorsData[colorIndex - 1]) {
|
2336
3077
|
const grayHashCode = '00808080';
|
2337
3078
|
let hex = grayHashCode;
|
2338
|
-
let color = this.colorsData[colorIndex - 1].split(',');
|
3079
|
+
let color = this.colorsData[colorIndex - 1].split(','); // get the color details
|
2339
3080
|
let colorAtrributes = +color[3];
|
3081
|
+
// color[0] - name, color[1] - FG color, color[2] - BG color
|
3082
|
+
// color[3] - attr flags (1 - transperent, 2 - system FG, 4 - system bg)
|
2340
3083
|
switch (colorType) {
|
2341
3084
|
case MAGIC_FG_COLOR:
|
2342
3085
|
if (colorAtrributes != SYSTEM_FG && colorAtrributes != SYSTEM_FG_AND_SYSTEM_BG)
|
@@ -2360,8 +3103,8 @@ class MagicColorService {
|
|
2360
3103
|
}
|
2361
3104
|
return '';
|
2362
3105
|
}
|
2363
|
-
static ɵfac = function MagicColorService_Factory(
|
2364
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
|
3106
|
+
/** @nocollapse */ static ɵfac = function MagicColorService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicColorService)(i0.ɵɵinject(i1$2.HttpClient), i0.ɵɵinject(COLOR_FILE_NAME)); };
|
3107
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicColorService, factory: MagicColorService.ɵfac, providedIn: 'root' });
|
2365
3108
|
}
|
2366
3109
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicColorService, [{
|
2367
3110
|
type: Injectable,
|
@@ -2373,17 +3116,29 @@ class MagicColorService {
|
|
2373
3116
|
args: [COLOR_FILE_NAME]
|
2374
3117
|
}] }], null); })();
|
2375
3118
|
|
3119
|
+
/**
|
3120
|
+
* Provides the UI with values calculated by the Magic WebClient
|
3121
|
+
*/
|
2376
3122
|
class AccessorMagicService {
|
2377
3123
|
task;
|
2378
3124
|
magicColor;
|
2379
3125
|
Logger = null;
|
2380
3126
|
hhmm = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
|
2381
3127
|
hhmmss = maskitoTimeOptionsGenerator({ mode: 'HH:MM:SS' });
|
3128
|
+
/**
|
3129
|
+
* @ignore
|
3130
|
+
*/
|
2382
3131
|
constructor(task, magicColor) {
|
2383
3132
|
this.task = task;
|
2384
3133
|
this.magicColor = magicColor;
|
2385
3134
|
this.Logger = Logger.Instance;
|
2386
3135
|
}
|
3136
|
+
/**
|
3137
|
+
* Checks if the control is read-only
|
3138
|
+
* @param controlId Id of control
|
3139
|
+
* @returns Is the control not read-only
|
3140
|
+
*/
|
3141
|
+
// CheckReadOnly
|
2387
3142
|
checkIsReadOnly(controlId) {
|
2388
3143
|
let properties;
|
2389
3144
|
properties = this.task.Records.list[0].getControlMetadata(controlId);
|
@@ -2392,34 +3147,91 @@ class AccessorMagicService {
|
|
2392
3147
|
else
|
2393
3148
|
return false;
|
2394
3149
|
}
|
3150
|
+
/**
|
3151
|
+
* Returns the text of the control
|
3152
|
+
* @param controlId Id of control
|
3153
|
+
* @param rowId Id of row, if applicable
|
3154
|
+
* @returns The text of the control
|
3155
|
+
*/
|
3156
|
+
// mgGetText
|
2395
3157
|
getText(controlId, rowId) {
|
2396
3158
|
return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
|
2397
3159
|
}
|
3160
|
+
/**
|
3161
|
+
* Gets the text of the tab page
|
3162
|
+
* @param controlId Id of control
|
3163
|
+
* @param layer Id of tabpage
|
3164
|
+
* @returns Text of tabpage
|
3165
|
+
*/
|
3166
|
+
// mgGetTabpageText
|
2398
3167
|
getTabpageText(controlId, layer) {
|
2399
3168
|
const items = this.task.getProperty(controlId, HtmlProperties.ItemsList);
|
2400
3169
|
if (typeof items !== "undefined")
|
2401
3170
|
return items[layer].displayValue;
|
2402
3171
|
return "";
|
2403
3172
|
}
|
3173
|
+
/**
|
3174
|
+
* Gets the image defined for the control
|
3175
|
+
* @param controlId Id of control
|
3176
|
+
* @param rowId Id of row, if applicable
|
3177
|
+
* @returns Image set on control
|
3178
|
+
*/
|
3179
|
+
// mgGetImage
|
2404
3180
|
getImage(controlId, rowId) {
|
2405
3181
|
let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
|
2406
3182
|
return result;
|
2407
3183
|
}
|
3184
|
+
/**
|
3185
|
+
* Returns whether an image is set for this control
|
3186
|
+
* @param controlId Id of control
|
3187
|
+
* @param rowId Id of row, if applicable
|
3188
|
+
* @returns returns true if control has an image set on it
|
3189
|
+
*/
|
3190
|
+
// mgIsImageExists
|
2408
3191
|
isImageExists(controlId, rowId) {
|
2409
3192
|
let result = this.task.getProperty(controlId, HtmlProperties.Image, rowId);
|
2410
3193
|
return !isNullOrUndefined(result);
|
2411
3194
|
}
|
3195
|
+
/**
|
3196
|
+
* Gets the CSS classes set on the control
|
3197
|
+
* @param controlId Id of control
|
3198
|
+
* @param rowId Id of row, if applicable
|
3199
|
+
* @returns The classes for this control
|
3200
|
+
*/
|
3201
|
+
// mgGetClasses
|
2412
3202
|
getClasses(controlId, rowId) {
|
2413
3203
|
return this.task.getClasses(controlId, rowId);
|
2414
3204
|
}
|
3205
|
+
/**
|
3206
|
+
* Gets the CSS styles set on the control
|
3207
|
+
* @param controlId Id of control
|
3208
|
+
* @param styleName NAme of style requested
|
3209
|
+
* @param rowId Id of row, if applicable
|
3210
|
+
* @returns The style set on the control
|
3211
|
+
*/
|
3212
|
+
// mgGetStyle
|
2415
3213
|
getStyle(controlId, styleName, rowId) {
|
2416
3214
|
let style = this.task.getStyle(controlId, styleName, rowId);
|
2417
3215
|
return style;
|
2418
3216
|
}
|
3217
|
+
/**
|
3218
|
+
* Returns whether a control is visible or not
|
3219
|
+
* @param controlId Id of control
|
3220
|
+
* @param rowId Id of row, if applicable
|
3221
|
+
* @returns Is the control visible or hidden
|
3222
|
+
*/
|
3223
|
+
// mgGetVisible
|
2419
3224
|
getVisible(controlId, rowId) {
|
2420
3225
|
let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
|
2421
3226
|
return vis ? 'visible' : 'hidden';
|
2422
3227
|
}
|
3228
|
+
/**
|
3229
|
+
* Returns alpha mask of a control
|
3230
|
+
* @param controlId Id of control
|
3231
|
+
* @param rowId Id of row, if applicable
|
3232
|
+
* @returns alpha mask of the control
|
3233
|
+
*/
|
3234
|
+
// getAlphaMask
|
2423
3235
|
getAlphaMask(controlId, rowId) {
|
2424
3236
|
if (isNullOrUndefined(controlId))
|
2425
3237
|
return null;
|
@@ -2443,6 +3255,12 @@ class AccessorMagicService {
|
|
2443
3255
|
}
|
2444
3256
|
return (pic != null) ? valueStr.toString() : null;
|
2445
3257
|
}
|
3258
|
+
/**
|
3259
|
+
* Returns object representing numeric picture
|
3260
|
+
* @param picture string which is defined in magic
|
3261
|
+
* @returns object representing numeric picture
|
3262
|
+
*/
|
3263
|
+
// mgGetNumericPicture
|
2446
3264
|
getNumericPicture(picture) {
|
2447
3265
|
var obj = {};
|
2448
3266
|
if (isNullOrUndefined(picture))
|
@@ -2475,51 +3293,140 @@ class AccessorMagicService {
|
|
2475
3293
|
obj['wholes'] = pic.getWholes();
|
2476
3294
|
return obj;
|
2477
3295
|
}
|
3296
|
+
/**
|
3297
|
+
* Returns whether a control should have the "required" attribute set on it
|
3298
|
+
* @param controlId Id of control
|
3299
|
+
* @param rowId Id of row, if applicable
|
3300
|
+
* @returns
|
3301
|
+
*/
|
3302
|
+
// mgGetMustInput
|
2478
3303
|
getMustInput(controlId, rowId) {
|
2479
3304
|
let vis = this.getProperty(controlId, HtmlProperties.MustInput, rowId);
|
2480
3305
|
return vis ? 'true' : 'false';
|
2481
3306
|
}
|
3307
|
+
/**
|
3308
|
+
* Returns whether a control is disabled
|
3309
|
+
* @param controlId Id of control
|
3310
|
+
* @param rowId Id of row, if applicable
|
3311
|
+
* @returns
|
3312
|
+
*/
|
3313
|
+
// mgIsDisabled
|
2482
3314
|
isDisabled(controlId, rowId) {
|
2483
3315
|
let result = this.getProperty(controlId, HtmlProperties.Enabled, rowId);
|
2484
3316
|
return result === true ? null : true;
|
2485
3317
|
}
|
3318
|
+
/**
|
3319
|
+
* @ignore
|
3320
|
+
*/
|
3321
|
+
// getProperty (not changed)
|
2486
3322
|
getProperty(controlId, prop, rowId) {
|
2487
3323
|
return this.task.getProperty(controlId, prop, rowId);
|
2488
3324
|
}
|
3325
|
+
/**
|
3326
|
+
* Returns the title (tooltip) text of the control
|
3327
|
+
* @param controlId Id of control
|
3328
|
+
* @param rowId Id of row, if applicable
|
3329
|
+
* @returns
|
3330
|
+
*/
|
3331
|
+
// mgGetTitle
|
2489
3332
|
getTitle(controlId, rowId) {
|
2490
3333
|
return this.task.getProperty(controlId, HtmlProperties.Tooltip, rowId);
|
2491
3334
|
}
|
3335
|
+
/**
|
3336
|
+
* Returns the title (tooltip) text of the control
|
3337
|
+
* @param controlId Id of control
|
3338
|
+
* @param rowId Id of row, if applicable
|
3339
|
+
* @returns
|
3340
|
+
*/
|
3341
|
+
// mgGetTitle for zoom button
|
2492
3342
|
getZoomButtonTitle(controlId, rowId) {
|
2493
3343
|
return this.task.getProperty(controlId, HtmlProperties.ZoomButtonTooltip, rowId);
|
2494
3344
|
}
|
3345
|
+
/**
|
3346
|
+
* Gets the selection control's selected value
|
3347
|
+
* @param controlId Id of control
|
3348
|
+
* @param rowId Id of row, if applicable
|
3349
|
+
* @returns
|
3350
|
+
*/
|
3351
|
+
// getSelectedValue
|
2495
3352
|
getSelectedValue(controlId, rowId) {
|
2496
3353
|
return this.task.getProperty(controlId, HtmlProperties.SelectedValue, rowId);
|
2497
3354
|
}
|
3355
|
+
/**
|
3356
|
+
* Gets the place-holder text of the control
|
3357
|
+
* @param controlId Id of control
|
3358
|
+
* @param rowId Id of row, if applicable
|
3359
|
+
* @returns
|
3360
|
+
*/
|
3361
|
+
// mgGetPlaceholder
|
2498
3362
|
getPlaceholder(controlId, rowId) {
|
2499
3363
|
return this.task.getProperty(controlId, HtmlProperties.PlaceHolder, rowId);
|
2500
3364
|
}
|
3365
|
+
/**
|
3366
|
+
* Returns a type for input controls - should the control be a simple text or a password control
|
3367
|
+
* @param controlId Id of control
|
3368
|
+
* @param rowId Id of row, if applicable
|
3369
|
+
* @returns
|
3370
|
+
*/
|
3371
|
+
// mgGetType
|
2501
3372
|
getType(controlId, rowId) {
|
2502
3373
|
let result = this.task.getProperty(controlId, HtmlProperties.Password, rowId);
|
2503
3374
|
return result ? "password" : "text";
|
2504
3375
|
}
|
3376
|
+
/**
|
3377
|
+
* Returns the tab-index of the control
|
3378
|
+
* @param controlId Id of control
|
3379
|
+
* @param rowId Id of row, if applicable
|
3380
|
+
* @returns
|
3381
|
+
*/
|
3382
|
+
// mgGetTabIndex
|
2505
3383
|
getTabIndex(controlId, rowId) {
|
2506
3384
|
return this.task.getProperty(controlId, HtmlProperties.TabIndex, rowId);
|
2507
3385
|
}
|
3386
|
+
/**
|
3387
|
+
* Returns the value of the control
|
3388
|
+
* @param controlId Id of control
|
3389
|
+
* @param rowId Id of row, if applicable
|
3390
|
+
* @returns
|
3391
|
+
*/
|
3392
|
+
/// mgGetValue -->
|
2508
3393
|
getValue(controlId, rowId) {
|
2509
3394
|
let val = this.task.getValue(controlId, rowId);
|
2510
3395
|
return val;
|
2511
3396
|
}
|
3397
|
+
/**
|
3398
|
+
* Returns the formatted value of the control
|
3399
|
+
* @param controlId Id of control
|
3400
|
+
* @param rowId Id of row, if applicable
|
3401
|
+
* @returns
|
3402
|
+
*/
|
3403
|
+
/// mgGetValue -->
|
2512
3404
|
getFormattedValue(controlId, rowId) {
|
2513
3405
|
let val = this.task.getValue(controlId, rowId);
|
2514
3406
|
val = this.task.getFormattedValue(controlId, val, rowId);
|
2515
3407
|
return val;
|
2516
3408
|
}
|
3409
|
+
/**
|
3410
|
+
* Returns the Picture of the control
|
3411
|
+
* @param controlId Id of control
|
3412
|
+
* @param rowId Id of row, if applicable
|
3413
|
+
* @returns
|
3414
|
+
*/
|
3415
|
+
/// getPicture -->
|
2517
3416
|
getPicture(controlId, rowId) {
|
2518
3417
|
if (isNullOrUndefined(controlId))
|
2519
3418
|
return null;
|
2520
3419
|
let pic = this.task.GetControlPictureMask(controlId);
|
2521
3420
|
return (pic != null) ? pic.getFormat().toString() : null;
|
2522
3421
|
}
|
3422
|
+
/**
|
3423
|
+
* Returns the custom (user) properties of the control
|
3424
|
+
* @param controlId Id of control
|
3425
|
+
* @param propertyName Name of requested property
|
3426
|
+
* @param rowId Id of row, if applicable
|
3427
|
+
* @returns
|
3428
|
+
*/
|
3429
|
+
// mgGetCustomProperty
|
2523
3430
|
getCustomProperty(controlId, propertyNameOrRowID, rowId) {
|
2524
3431
|
if (controlId.indexOf('~') == -1)
|
2525
3432
|
return this.getCustomProperty_1(controlId, propertyNameOrRowID, rowId);
|
@@ -2544,9 +3451,22 @@ class AccessorMagicService {
|
|
2544
3451
|
}
|
2545
3452
|
return userProperties;
|
2546
3453
|
}
|
3454
|
+
/**
|
3455
|
+
* Gets the values of the items of a selection control
|
3456
|
+
* @param id Id of control
|
3457
|
+
* @param rowId Id of row, if applicable
|
3458
|
+
* @returns
|
3459
|
+
*/
|
3460
|
+
// mgGetItemListValues
|
2547
3461
|
getItemListValues(id, rowId) {
|
2548
3462
|
return this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
2549
3463
|
}
|
3464
|
+
/**
|
3465
|
+
* Gets the filtered items list based on the current value of the control
|
3466
|
+
* @param controlId Id of control
|
3467
|
+
* @param rowId Id of row, if applicable
|
3468
|
+
* @returns
|
3469
|
+
*/
|
2550
3470
|
getFilteredList(controlId, rowId) {
|
2551
3471
|
if (isNullOrUndefined(rowId))
|
2552
3472
|
rowId = '0';
|
@@ -2559,6 +3479,12 @@ class AccessorMagicService {
|
|
2559
3479
|
else
|
2560
3480
|
return items;
|
2561
3481
|
}
|
3482
|
+
/**
|
3483
|
+
* Gets the display value of the item from items of a selection control
|
3484
|
+
* @param id Id of control
|
3485
|
+
* @param rowId Id of row, if applicable
|
3486
|
+
* @returns
|
3487
|
+
*/
|
2562
3488
|
getDisplayValue(id, rowId) {
|
2563
3489
|
let displayValue = "";
|
2564
3490
|
let o = this.getProperty(id, HtmlProperties.ItemsList, rowId);
|
@@ -2567,6 +3493,12 @@ class AccessorMagicService {
|
|
2567
3493
|
displayValue = o[value].displayValue;
|
2568
3494
|
return displayValue;
|
2569
3495
|
}
|
3496
|
+
/**
|
3497
|
+
* Returns whether a tab page is selected or not
|
3498
|
+
* @param index of current option in iterarotr
|
3499
|
+
* @param control Id of list control
|
3500
|
+
* @returns
|
3501
|
+
*/ // isOptionSelected
|
2570
3502
|
isOptionSelected(index, controlId) {
|
2571
3503
|
let val = this.task.getValue(controlId, "0");
|
2572
3504
|
for (let item of val) {
|
@@ -2575,18 +3507,40 @@ class AccessorMagicService {
|
|
2575
3507
|
}
|
2576
3508
|
return false;
|
2577
3509
|
}
|
3510
|
+
/**
|
3511
|
+
* Returns whether a tab page is selected or not - used for the tab buttons
|
3512
|
+
* @param controlId Id of control
|
3513
|
+
* @param layer Id of the tab page
|
3514
|
+
* @returns
|
3515
|
+
*/ // mgIsTabPageSelected
|
2578
3516
|
isTabPageSelected(controlId, layer) {
|
2579
3517
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
|
2580
|
-
return val == (layer - 1);
|
2581
|
-
}
|
3518
|
+
return val == (layer - 1); // comparing string to number!
|
3519
|
+
}
|
3520
|
+
/**
|
3521
|
+
* Returns whether a tab page layer is selected or not - used for the div which represents the tab page
|
3522
|
+
* @param controlId Id of control
|
3523
|
+
* @param layer Id of the tab page
|
3524
|
+
* @returns
|
3525
|
+
*/ // mgIsTabLayerSelected
|
2582
3526
|
isTabPageLayerSelected(controlId, layer) {
|
2583
3527
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedLayer);
|
2584
|
-
return val == (layer - 1);
|
3528
|
+
return val == (layer - 1); // comparing string to number!
|
2585
3529
|
}
|
3530
|
+
/**
|
3531
|
+
* Returns the index of the selected tab page
|
3532
|
+
* @param controlId Id of control
|
3533
|
+
* @returns
|
3534
|
+
*/
|
2586
3535
|
getTabSelectedIndex(controlId) {
|
2587
3536
|
let val = this.task.getProperty(controlId, HtmlProperties.SelectedValue);
|
2588
|
-
return val;
|
3537
|
+
return val; // comparing string to number!
|
2589
3538
|
}
|
3539
|
+
// private methodes
|
3540
|
+
/**
|
3541
|
+
* @ignore
|
3542
|
+
*/
|
3543
|
+
// mgIfRowCreated
|
2590
3544
|
ifRowCreated(row) {
|
2591
3545
|
if (row == null)
|
2592
3546
|
return false;
|
@@ -2594,59 +3548,83 @@ class AccessorMagicService {
|
|
2594
3548
|
let result = this.getFormGroupByRow(rowId);
|
2595
3549
|
return !isNullOrUndefined(result);
|
2596
3550
|
}
|
3551
|
+
/**
|
3552
|
+
* @ignore
|
3553
|
+
*/
|
3554
|
+
// mgGetFormGroupByRow
|
2597
3555
|
getFormGroupByRow(id) {
|
2598
3556
|
return this.task.formGroups[id];
|
2599
3557
|
}
|
3558
|
+
/**
|
3559
|
+
* @ignore
|
3560
|
+
*/
|
3561
|
+
// isRowSelected (not changed)
|
2600
3562
|
isRowSelected(controlId, rowId) {
|
2601
3563
|
const selectedRow = this.task.getProperty(controlId, HtmlProperties.SelectedRow, "0");
|
2602
3564
|
return selectedRow == rowId;
|
2603
3565
|
}
|
3566
|
+
/**
|
3567
|
+
* Returns whether a row is in edit state
|
3568
|
+
* @param row
|
3569
|
+
*/
|
2604
3570
|
isRowInRowEditing(row) {
|
2605
3571
|
let guiRowId = '0';
|
2606
3572
|
guiRowId = typeof row == "number" ? row.toString() : row.rowId;
|
2607
3573
|
return this.task.isRowInRowEditing(guiRowId);
|
2608
3574
|
}
|
3575
|
+
/**
|
3576
|
+
* Returns whether a row is in edit state, use this method while control outside table control
|
3577
|
+
* @param row
|
3578
|
+
*/
|
2609
3579
|
isCurrentInRowEditing() {
|
2610
3580
|
let row = this.task.tableService.getSelectedRow();
|
2611
3581
|
return this.task.isRowInRowEditing(row);
|
2612
3582
|
}
|
3583
|
+
/**
|
3584
|
+
* @ignore
|
3585
|
+
*/
|
3586
|
+
// GetGuiTopIndex
|
2613
3587
|
guiTopIndex() {
|
2614
3588
|
return this.task.tableService.getTableTopIndex();
|
2615
3589
|
}
|
3590
|
+
/**
|
3591
|
+
* @ignore
|
3592
|
+
*/
|
2616
3593
|
getErrMsg(id, rowId) {
|
2617
3594
|
let c = this.task.getFormControl(rowId, id);
|
2618
3595
|
if (c.hasError('required'))
|
2619
|
-
return
|
3596
|
+
return Events.GetMessageString(MsgInterface.RT_STR_FLD_MUST_UPDATED);
|
2620
3597
|
if (c.hasError('pattern')) {
|
3598
|
+
//To check whether the numeric field allowed only positive values or not.
|
2621
3599
|
if (c.errors.pattern.actualValue < 0 && !c.errors.pattern.requiredPattern.includes('-'))
|
2622
|
-
return
|
3600
|
+
return Events.GetMessageString(MsgInterface.STR_ERR_NEGETIVE);
|
2623
3601
|
if (c.errors.pattern.requiredPattern.includes('.')) {
|
2624
3602
|
const numericFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[0];
|
2625
3603
|
const decimalFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[1];
|
2626
3604
|
const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
|
2627
3605
|
const actualDecimalLimit = c.errors.pattern.requiredPattern.match(/(?:[^,]+,){2}(\d+)/)[1];
|
2628
3606
|
if (numericFormat.length > actualNumericLimit || decimalFormat.length > actualDecimalLimit) {
|
2629
|
-
return
|
3607
|
+
return this.getNumericFormatErrorString(actualNumericLimit, actualDecimalLimit);
|
2630
3608
|
}
|
2631
3609
|
}
|
2632
3610
|
else if (!c.errors.pattern.requiredPattern.includes('.') && !Number.isInteger(c.errors.pattern.actualValue)) {
|
2633
3611
|
const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
|
2634
|
-
return
|
3612
|
+
return this.getNumericFormatErrorString(actualNumericLimit, 0);
|
2635
3613
|
}
|
2636
3614
|
else {
|
2637
3615
|
const numericFormat = Math.abs(c.errors.pattern.actualValue).toString();
|
2638
3616
|
const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
|
2639
3617
|
if (numericFormat.length > actualNumericLimit) {
|
2640
|
-
return
|
3618
|
+
return this.getNumericFormatErrorString(actualNumericLimit, 0);
|
2641
3619
|
}
|
2642
3620
|
}
|
2643
3621
|
}
|
2644
3622
|
if (c.hasError('rangevalidator'))
|
2645
3623
|
return c.errors.rangevalidator.errorMsg;
|
2646
3624
|
if (c.hasError('maxlength'))
|
2647
|
-
return
|
3625
|
+
return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_LENGTH) + c.errors.maxlength.requiredLength;
|
2648
3626
|
if (c.hasError('max'))
|
2649
|
-
return
|
3627
|
+
return Events.GetMessageString(MsgInterface.STR_ERR_MAX_ALLOWED_VALUE) + c.errors.max.max;
|
2650
3628
|
let controlMetadata = this.task.Records.list[rowId].getControlMetadata(id);
|
2651
3629
|
for (let key of controlMetadata.customValidators.keys()) {
|
2652
3630
|
if (c.hasError(key)) {
|
@@ -2656,6 +3634,19 @@ class AccessorMagicService {
|
|
2656
3634
|
}
|
2657
3635
|
return 'unknown error';
|
2658
3636
|
}
|
3637
|
+
getNumericFormatErrorString(wholeLimit, decimalLimit) {
|
3638
|
+
let token = "%d";
|
3639
|
+
let messageString = Events.GetMessageString(MsgInterface.EDT_ERR_STR_1);
|
3640
|
+
messageString = StrUtil.replaceStringTokens(messageString, token, 1, wholeLimit.toString());
|
3641
|
+
messageString = StrUtil.replaceStringTokens(messageString, token, 1, decimalLimit.toString());
|
3642
|
+
return messageString;
|
3643
|
+
}
|
3644
|
+
/**
|
3645
|
+
* Sets a user-supplied value to the specified control
|
3646
|
+
* @param controlName
|
3647
|
+
* @param value
|
3648
|
+
* @param refreshDisplay
|
3649
|
+
*/
|
2659
3650
|
setValueToControl(controlName, value, refreshDisplay) {
|
2660
3651
|
if (typeof refreshDisplay === "undefined")
|
2661
3652
|
refreshDisplay = true;
|
@@ -2664,28 +3655,44 @@ class AccessorMagicService {
|
|
2664
3655
|
guiEvent.param = refreshDisplay;
|
2665
3656
|
this.task.insertEvent(guiEvent);
|
2666
3657
|
}
|
3658
|
+
/**
|
3659
|
+
* @ignore
|
3660
|
+
*/
|
2667
3661
|
isDataviewEmpty() {
|
2668
3662
|
return this.task.Records.isEmptyDataView;
|
2669
3663
|
}
|
3664
|
+
/**
|
3665
|
+
* simulates a click event on the specified control, for the Magic engine
|
3666
|
+
* @param controlName
|
3667
|
+
* @param rowId
|
3668
|
+
*/
|
2670
3669
|
simulateClick(controlName, rowId) {
|
2671
3670
|
if (typeof rowId === "undefined")
|
2672
3671
|
rowId = 0;
|
2673
3672
|
this.task.insertEvent(getGuiEventObj('click', controlName, rowId));
|
2674
3673
|
}
|
3674
|
+
/**
|
3675
|
+
* Return Boolean TRUE if user logged in Else it will return FALSE
|
3676
|
+
*/
|
2675
3677
|
isLoggedIn() {
|
2676
3678
|
return this.task.getIsLoggenIn();
|
2677
3679
|
}
|
3680
|
+
/**
|
3681
|
+
* Returns JS object containing the records with all table fields.
|
3682
|
+
*/
|
2678
3683
|
GetFormRecords() {
|
2679
3684
|
let rowId = 0;
|
2680
3685
|
let recArray;
|
2681
3686
|
if (!isNullOrUndefined(this.task.Records) && this.task.Records.list.length > 0) {
|
2682
3687
|
let recList = this.task.Records.list;
|
2683
3688
|
let tableControls = new Array();
|
3689
|
+
//Generate list of table fields names
|
2684
3690
|
for (const key in this.task.template) {
|
2685
3691
|
if (this.task.template[key] == '1')
|
2686
3692
|
tableControls.push(key);
|
2687
3693
|
}
|
2688
3694
|
recArray = new Array();
|
3695
|
+
//Update the records as list of objects with values for table fields.
|
2689
3696
|
if (tableControls.length > 0) {
|
2690
3697
|
recList.forEach((ctrlMetaData) => {
|
2691
3698
|
if (this.task.Records.isRowCreated(rowId)) {
|
@@ -2701,31 +3708,54 @@ class AccessorMagicService {
|
|
2701
3708
|
}
|
2702
3709
|
return recArray;
|
2703
3710
|
}
|
3711
|
+
/**
|
3712
|
+
* SetCookie : set the cookie with specified name and value in browser
|
3713
|
+
* expires - expiration time
|
3714
|
+
* path - path which much exists in order so that cookie is sent as header
|
3715
|
+
* domain - specifies which hosts are allowed to receive the cookie
|
3716
|
+
* secure - specifies if cookie is secure ( works only with HTTPS)
|
3717
|
+
* sameSite - lets servers specify whether/when cookies are sent with cross-site requests
|
3718
|
+
*/
|
2704
3719
|
SetCookie(name, value, expires, path, domain, secure, sameSite) {
|
2705
3720
|
CookieService.setCookie(name, value, expires, path, domain, secure, sameSite);
|
2706
3721
|
}
|
3722
|
+
/**
|
3723
|
+
* GetCookie : get the cookie with specified name and value in browser
|
3724
|
+
*/
|
2707
3725
|
GetCookie(name) {
|
2708
3726
|
return CookieService.getCookie(name);
|
2709
3727
|
}
|
3728
|
+
/**
|
3729
|
+
* DeleteCookie : deletes the cookie
|
3730
|
+
*/
|
2710
3731
|
DeleteCookie(name) {
|
2711
3732
|
return CookieService.deleteCookie(name);
|
2712
3733
|
}
|
3734
|
+
/**
|
3735
|
+
* get RGBA color from color file
|
3736
|
+
*/
|
2713
3737
|
getColor(colorNumber, colorType) {
|
2714
3738
|
return this.magicColor.getColor(colorNumber, colorType);
|
2715
3739
|
}
|
2716
|
-
static ɵfac = function AccessorMagicService_Factory(
|
2717
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
|
3740
|
+
/** @nocollapse */ static ɵfac = function AccessorMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || AccessorMagicService)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MagicColorService)); };
|
3741
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: AccessorMagicService, factory: AccessorMagicService.ɵfac });
|
2718
3742
|
}
|
2719
3743
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AccessorMagicService, [{
|
2720
3744
|
type: Injectable
|
2721
3745
|
}], () => [{ type: TaskMagicService }, { type: MagicColorService }], null); })();
|
2722
3746
|
|
3747
|
+
/**
|
3748
|
+
* Central place for adding the Magic services
|
3749
|
+
*/
|
2723
3750
|
class MagicServices {
|
2724
3751
|
task;
|
2725
3752
|
subformService;
|
2726
3753
|
tableService;
|
2727
3754
|
titleService;
|
2728
3755
|
mgAccessorService;
|
3756
|
+
/**
|
3757
|
+
* @ignore
|
3758
|
+
*/
|
2729
3759
|
constructor(task, subformService, tableService, titleService, mgAccessorService) {
|
2730
3760
|
this.task = task;
|
2731
3761
|
this.subformService = subformService;
|
@@ -2737,41 +3767,85 @@ class MagicServices {
|
|
2737
3767
|
task.mgTitleService = titleService;
|
2738
3768
|
task.mgAccessorService = mgAccessorService;
|
2739
3769
|
}
|
2740
|
-
static ɵfac = function MagicServices_Factory(
|
2741
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
|
3770
|
+
/** @nocollapse */ static ɵfac = function MagicServices_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicServices)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(SubformMagicService), i0.ɵɵinject(TableMagicService), i0.ɵɵinject(TitleMagicService), i0.ɵɵinject(AccessorMagicService)); };
|
3771
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MagicServices, factory: MagicServices.ɵfac });
|
2742
3772
|
}
|
2743
3773
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicServices, [{
|
2744
3774
|
type: Injectable
|
2745
3775
|
}], () => [{ type: TaskMagicService }, { type: SubformMagicService }, { type: TableMagicService }, { type: TitleMagicService }, { type: AccessorMagicService }], null); })();
|
2746
3776
|
|
3777
|
+
/**
|
3778
|
+
* Base component representing a Magic task
|
3779
|
+
*/
|
2747
3780
|
class TaskBaseMagicComponent {
|
2748
3781
|
ref;
|
2749
3782
|
magicServices;
|
3783
|
+
/**
|
3784
|
+
* Id of task, used for initializing the task service
|
3785
|
+
*/
|
2750
3786
|
taskIdParam;
|
3787
|
+
/**
|
3788
|
+
* @ignore
|
3789
|
+
*/
|
2751
3790
|
taskDescription;
|
3791
|
+
/**
|
3792
|
+
* @ignore
|
3793
|
+
*/
|
2752
3794
|
magicProperties = MagicProperties;
|
3795
|
+
/**
|
3796
|
+
*
|
3797
|
+
* @param ref changes-detector object
|
3798
|
+
* @param magicServices Access point for all Magic services
|
3799
|
+
*/
|
2753
3800
|
constructor(ref, magicServices) {
|
2754
3801
|
this.ref = ref;
|
2755
3802
|
this.magicServices = magicServices;
|
2756
3803
|
}
|
3804
|
+
/**
|
3805
|
+
* Returns the Magic task service
|
3806
|
+
* @returns
|
3807
|
+
*/
|
2757
3808
|
get task() {
|
2758
3809
|
return this.magicServices.task;
|
2759
3810
|
}
|
3811
|
+
/**
|
3812
|
+
* Returns the Magic subform service
|
3813
|
+
* @returns
|
3814
|
+
*/
|
2760
3815
|
get mgSub() {
|
2761
3816
|
return this.magicServices.subformService;
|
2762
3817
|
}
|
3818
|
+
/**
|
3819
|
+
* Returns the Magic table service
|
3820
|
+
* @returns
|
3821
|
+
*/
|
2763
3822
|
get tableService() {
|
2764
3823
|
return this.magicServices.tableService;
|
2765
3824
|
}
|
3825
|
+
/**
|
3826
|
+
* Returns the Magic accessor service
|
3827
|
+
* @returns
|
3828
|
+
*/
|
2766
3829
|
get mg() {
|
2767
3830
|
return this.magicServices.mgAccessorService;
|
2768
3831
|
}
|
3832
|
+
/**
|
3833
|
+
* Returns the task Id
|
3834
|
+
* @returns
|
3835
|
+
*/
|
2769
3836
|
get taskId() {
|
2770
3837
|
return this.task.taskId;
|
2771
3838
|
}
|
3839
|
+
/**
|
3840
|
+
* Returns the FormGroup for screen-mode forms
|
3841
|
+
* @returns
|
3842
|
+
*/
|
2772
3843
|
get screenFormGroup() {
|
2773
3844
|
return this.task.ScreenModeControls;
|
2774
3845
|
}
|
3846
|
+
/**
|
3847
|
+
* Interface implementation
|
3848
|
+
*/
|
2775
3849
|
ngOnInit() {
|
2776
3850
|
this.task.detectChanges.pipe().subscribe(c => {
|
2777
3851
|
this.ref.detectChanges();
|
@@ -2779,24 +3853,61 @@ class TaskBaseMagicComponent {
|
|
2779
3853
|
this.task.initTask(this.taskIdParam, this.taskDescription);
|
2780
3854
|
this.createFormControlsAccessor(this.screenFormGroup);
|
2781
3855
|
this.setInputDateFormat();
|
3856
|
+
// subcribe to custom property changes
|
2782
3857
|
this.task.customPropertiesSubject.pipe().subscribe(property => {
|
2783
3858
|
this.PropertyChanged(property.propertyName, property.rowId, property.value);
|
2784
3859
|
});
|
3860
|
+
// subcribe to records count changes
|
2785
3861
|
this.task.recordsCountChangeSubject.pipe().subscribe(value => {
|
2786
3862
|
this.RecordsCountChanged(value);
|
2787
3863
|
});
|
3864
|
+
// subcribe to mgLoad change
|
2788
3865
|
this.task.mgLoadSubject.pipe().subscribe(value => {
|
2789
3866
|
this.mgOnLoad();
|
2790
3867
|
});
|
2791
3868
|
}
|
3869
|
+
/**
|
3870
|
+
* @ignore
|
3871
|
+
*/
|
2792
3872
|
createFormControlsAccessor(formGroup) { }
|
3873
|
+
/**
|
3874
|
+
* @ignore
|
3875
|
+
*/
|
2793
3876
|
setInputDateFormat() { }
|
3877
|
+
/**
|
3878
|
+
* This method is called when the value of any custom property is updated in Magic
|
3879
|
+
* propertyName : name of property which is updated. The format is <controlname>~<propertyname>
|
3880
|
+
* rowId : row number of the updated property for controls in table control (0 for controls outside table)
|
3881
|
+
* value : updated value of the property
|
3882
|
+
* @returns : void
|
3883
|
+
* To use the method override it in your component and check the property name and write you code ..for eg
|
3884
|
+
* if(propertyName == 'controlname~propertyName') {// your code}
|
3885
|
+
* else { // your code}
|
3886
|
+
*/
|
2794
3887
|
PropertyChanged(propertyName, rowId, value) {
|
2795
|
-
|
3888
|
+
// intentionally left blank because the implementation should be in the derived class
|
3889
|
+
}
|
3890
|
+
/**
|
3891
|
+
* Records count change subject is subscribed to change in its value. This method will be called
|
3892
|
+
* as the value of records count is received at from server.
|
3893
|
+
* @returns : void
|
3894
|
+
* To use the method override it in your component.
|
3895
|
+
*/
|
2796
3896
|
RecordsCountChanged(recordsCount) {
|
2797
|
-
|
3897
|
+
// intentionally left blank because the implementation should be in the derived class
|
3898
|
+
}
|
3899
|
+
/**
|
3900
|
+
* This method will be called once engine informs UI about loading of first set of data is sent to client
|
3901
|
+
* and client has reached its first idle time.
|
3902
|
+
* @returns : void
|
3903
|
+
* To use the method override it in your component.
|
3904
|
+
*/
|
2798
3905
|
mgOnLoad() {
|
3906
|
+
// intentionally left blank because the implementation should be in the derived class
|
2799
3907
|
}
|
3908
|
+
/**
|
3909
|
+
* Interface implementation
|
3910
|
+
*/
|
2800
3911
|
ngAfterViewInit() {
|
2801
3912
|
this.mgSub.init();
|
2802
3913
|
}
|
@@ -2806,37 +3917,53 @@ class TaskBaseMagicComponent {
|
|
2806
3917
|
this.task.oldPageSize = this.tableService.getPageSize();
|
2807
3918
|
}
|
2808
3919
|
}
|
3920
|
+
/**
|
3921
|
+
* Interface implementation
|
3922
|
+
*/
|
2809
3923
|
ngOnDestroy() {
|
2810
3924
|
this.task.dispose();
|
2811
3925
|
}
|
2812
|
-
static ɵfac = function TaskBaseMagicComponent_Factory(
|
2813
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, features: [i0.ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
3926
|
+
/** @nocollapse */ static ɵfac = function TaskBaseMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TaskBaseMagicComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(MagicServices)); };
|
3927
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: TaskBaseMagicComponent, selectors: [["task-magic"]], inputs: { taskIdParam: "taskIdParam", taskDescription: "taskDescription" }, standalone: false, features: [i0.ɵɵProvidersFeature([TaskMagicService, SubformMagicService, TableMagicService])], decls: 0, vars: 0, template: function TaskBaseMagicComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
2814
3928
|
}
|
2815
3929
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TaskBaseMagicComponent, [{
|
2816
3930
|
type: Component,
|
2817
3931
|
args: [{
|
2818
3932
|
selector: 'task-magic',
|
2819
3933
|
providers: [TaskMagicService, SubformMagicService, TableMagicService],
|
2820
|
-
template: ''
|
3934
|
+
template: '',
|
3935
|
+
standalone: false
|
2821
3936
|
}]
|
2822
3937
|
}], () => [{ type: i0.ChangeDetectorRef }, { type: MagicServices }], { taskIdParam: [{
|
2823
3938
|
type: Input
|
2824
3939
|
}], taskDescription: [{
|
2825
3940
|
type: Input
|
2826
3941
|
}] }); })();
|
2827
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src
|
3942
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TaskBaseMagicComponent, { className: "TaskBaseMagicComponent", filePath: "src/ui/task-base.magic.component.ts", lineNumber: 21 }); })();
|
2828
3943
|
|
3944
|
+
/**
|
3945
|
+
* @ignore
|
3946
|
+
*/
|
2829
3947
|
class RowMagicDirective {
|
2830
3948
|
_task;
|
2831
3949
|
element;
|
2832
3950
|
rowId;
|
3951
|
+
/**
|
3952
|
+
* The HTML element connected to this directive
|
3953
|
+
*/
|
2833
3954
|
htmlElement;
|
3955
|
+
/**
|
3956
|
+
* @ignore
|
3957
|
+
*/
|
2834
3958
|
rowChangedSubscriber = null;
|
2835
3959
|
constructor(_task, element) {
|
2836
3960
|
this._task = _task;
|
2837
3961
|
this.element = element;
|
2838
3962
|
this.htmlElement = this.element.nativeElement;
|
2839
3963
|
}
|
3964
|
+
/**
|
3965
|
+
* Initializes this object
|
3966
|
+
*/
|
2840
3967
|
ngOnInit() {
|
2841
3968
|
this.rowChangedSubscriber = this._task
|
2842
3969
|
.OnSelectedRowChanged.pipe(filter(rowId => rowId === this.rowId))
|
@@ -2851,7 +3978,16 @@ class RowMagicDirective {
|
|
2851
3978
|
return (rect.top >= parentRect.top &&
|
2852
3979
|
rect.bottom <= parentRect.bottom);
|
2853
3980
|
}
|
3981
|
+
/**
|
3982
|
+
* Cleanup
|
3983
|
+
*/
|
2854
3984
|
ngOnDestroy() {
|
3985
|
+
// Don't know why, but when the table is loaded for the first time, we
|
3986
|
+
// get ngOnInit() for the 1st row (rowId = "0") and then ngOnDestroy()
|
3987
|
+
// for number of rows in the page but here this.rowId is undefined.
|
3988
|
+
// Since ngOnInit() was not called for all these rows, this.rowChangedSubscriber
|
3989
|
+
// is null and hence crashes.
|
3990
|
+
// So, the condition to check nulity is added.
|
2855
3991
|
if (this.rowChangedSubscriber !== null) {
|
2856
3992
|
this.rowChangedSubscriber.unsubscribe();
|
2857
3993
|
}
|
@@ -2863,15 +3999,16 @@ class RowMagicDirective {
|
|
2863
3999
|
event.cancelBubble = true;
|
2864
4000
|
}
|
2865
4001
|
}
|
2866
|
-
static ɵfac = function RowMagicDirective_Factory(
|
2867
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
4002
|
+
/** @nocollapse */ static ɵfac = function RowMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RowMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
4003
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RowMagicDirective, selectors: [["", "magicRow", ""]], hostBindings: function RowMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
2868
4004
|
i0.ɵɵlistener("click", function RowMagicDirective_click_HostBindingHandler($event) { return ctx.onClick($event); });
|
2869
|
-
} }, inputs: { rowId: [
|
4005
|
+
} }, inputs: { rowId: [0, "magicRow", "rowId"] }, standalone: false });
|
2870
4006
|
}
|
2871
4007
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RowMagicDirective, [{
|
2872
4008
|
type: Directive,
|
2873
4009
|
args: [{
|
2874
|
-
selector: '[magicRow]'
|
4010
|
+
selector: '[magicRow]',
|
4011
|
+
standalone: false
|
2875
4012
|
}]
|
2876
4013
|
}], () => [{ type: TaskMagicService }, { type: i0.ElementRef }], { rowId: [{
|
2877
4014
|
type: Input,
|
@@ -2881,6 +4018,9 @@ class RowMagicDirective {
|
|
2881
4018
|
args: ['click', ['$event']]
|
2882
4019
|
}] }); })();
|
2883
4020
|
|
4021
|
+
/**
|
4022
|
+
* Connects HTML elements to the Magic Web Client engine
|
4023
|
+
*/
|
2884
4024
|
class MagicDirective {
|
2885
4025
|
_task;
|
2886
4026
|
element;
|
@@ -2893,24 +4033,64 @@ class MagicDirective {
|
|
2893
4033
|
this.selector = "magic";
|
2894
4034
|
}
|
2895
4035
|
;
|
4036
|
+
/**
|
4037
|
+
* This flag is used when we only want to register to events, but do not want to execute commands sent from server
|
4038
|
+
*/
|
2896
4039
|
set eventsOnly(val) {
|
2897
4040
|
console.log("eventsOnly");
|
2898
4041
|
this.eventsOnlyVal = true;
|
2899
4042
|
}
|
2900
4043
|
;
|
4044
|
+
/**
|
4045
|
+
* pollTime: after which value will be sent to magic
|
4046
|
+
*/
|
2901
4047
|
pollTime = 200;
|
4048
|
+
/**
|
4049
|
+
* Row id of the control, for when it is on a table
|
4050
|
+
*/
|
2902
4051
|
rowId;
|
4052
|
+
/**
|
4053
|
+
*
|
4054
|
+
*/
|
4055
|
+
//@Input() events: any[] = [];
|
4056
|
+
/**
|
4057
|
+
* The HTML element connected to this directive
|
4058
|
+
*/
|
2903
4059
|
htmlElement;
|
4060
|
+
/**
|
4061
|
+
* Magic's component handling this control
|
4062
|
+
*/
|
2904
4063
|
component;
|
4064
|
+
/**
|
4065
|
+
* Collection of event handlers for this element
|
4066
|
+
*/
|
2905
4067
|
eventHandlers = {};
|
4068
|
+
/**
|
4069
|
+
* Id of this element
|
4070
|
+
*/
|
2906
4071
|
id;
|
4072
|
+
/**
|
4073
|
+
* @ignore
|
4074
|
+
*/
|
2907
4075
|
selector;
|
4076
|
+
/**
|
4077
|
+
* @ignore
|
4078
|
+
*/
|
2908
4079
|
subscribeRefreshDom;
|
2909
4080
|
focusUnlistener;
|
2910
4081
|
eventsOnlyVal = false;
|
2911
4082
|
static opened = false;
|
2912
4083
|
static noOfAutoCompleteBoxesOpened = 0;
|
2913
4084
|
subscribeInteractiveCommands;
|
4085
|
+
/**
|
4086
|
+
*
|
4087
|
+
* @param _task The task service
|
4088
|
+
* @param element The element for which the directive is applied
|
4089
|
+
* @param renderer Renderer for the element
|
4090
|
+
* @param vcRef
|
4091
|
+
* @param platform
|
4092
|
+
* @param magicRow
|
4093
|
+
*/
|
2914
4094
|
constructor(_task, element, renderer, vcRef, platform, magicRow) {
|
2915
4095
|
this._task = _task;
|
2916
4096
|
this.element = element;
|
@@ -2919,23 +4099,43 @@ class MagicDirective {
|
|
2919
4099
|
this.platform = platform;
|
2920
4100
|
this.magicRow = magicRow;
|
2921
4101
|
this.htmlElement = this.element.nativeElement;
|
4102
|
+
//let c = (<any>this.vcRef)._view;
|
4103
|
+
//while (!(c instanceof TaskBaseMagicComponent)) {
|
4104
|
+
// c = c.component;
|
4105
|
+
//}
|
4106
|
+
//this.component = c;
|
2922
4107
|
if (!(typeof magicRow === "undefined" || magicRow === null))
|
2923
4108
|
this.rowId = magicRow.rowId;
|
2924
4109
|
}
|
4110
|
+
/**
|
4111
|
+
* Get the task service
|
4112
|
+
* @returns
|
4113
|
+
*/
|
2925
4114
|
get task() {
|
2926
4115
|
return this._task;
|
2927
4116
|
}
|
4117
|
+
/**
|
4118
|
+
* Register to the events this element may need to handle
|
4119
|
+
*/
|
2928
4120
|
regEvents() {
|
4121
|
+
// Handle events for which event handler may be removed and restored
|
2929
4122
|
this.eventHandlers["focusin"] = this.OnFocus.bind(this);
|
2930
4123
|
Object.keys(this.eventHandlers).forEach((key) => {
|
2931
4124
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
2932
4125
|
});
|
2933
|
-
|
4126
|
+
// Handle events with anonymous event handlers
|
4127
|
+
let events = ["click", "mousedown", "dblclick"]; // ,'resize', 'load', 'unload'
|
2934
4128
|
events.forEach(event => {
|
2935
4129
|
this.renderer.listen(this.htmlElement, event, (e) => {
|
4130
|
+
// check if the event is fired from zoom button ( to identify the connected zoom button in engine)
|
2936
4131
|
let fromButton = false;
|
2937
4132
|
if (this.htmlElement instanceof HTMLButtonElement)
|
2938
4133
|
fromButton = true;
|
4134
|
+
/**
|
4135
|
+
* In the case of Safari or Chrome browser on IOS, when a button is clicked, the browser does not receive
|
4136
|
+
* focus event hence the zoom action is not executed. So in order to receive focus event, enabling it exclusively
|
4137
|
+
* in the case of Safari or Chrome browser on IOS and Safari browser on Mac.
|
4138
|
+
*/
|
2939
4139
|
if (fromButton && (this.platform.IOS || this.platform.SAFARI))
|
2940
4140
|
this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
|
2941
4141
|
this.task.insertEvent(getGuiEventObj(event, this.id, +this.rowId, fromButton));
|
@@ -2951,10 +4151,13 @@ class MagicDirective {
|
|
2951
4151
|
this.task.insertEvent(guiEvent);
|
2952
4152
|
}
|
2953
4153
|
});
|
4154
|
+
// handle the input event
|
2954
4155
|
fromEvent(this.htmlElement, "input").pipe(map((event) => {
|
2955
4156
|
return event.target.value;
|
2956
|
-
}), debounceTime(this.pollTime)
|
4157
|
+
}), debounceTime(this.pollTime) // time after which value will be sent to magic
|
4158
|
+
).subscribe((x) => {
|
2957
4159
|
if (this.task.getProperty(this.id, HtmlProperties.BindingLevel, this.rowId) === BindingLevel.Character) {
|
4160
|
+
// Don't support character binding for date/time values
|
2958
4161
|
let attribute = this.task.Records.list[0].getControlMetadata(this.id).dataType;
|
2959
4162
|
if (attribute !== StorageAttributeType.Date && attribute != StorageAttributeType.Time)
|
2960
4163
|
this.task.mgAccessorService.setValueToControl(this.id, x, true);
|
@@ -2980,16 +4183,25 @@ class MagicDirective {
|
|
2980
4183
|
(e.keyCode >= GuiConstants.KEY_F1 && e.keyCode <= GuiConstants.KEY_F12);
|
2981
4184
|
if (guiEvent.modifiers !== Modifiers.MODIFIER_NONE || supportedKey) {
|
2982
4185
|
guiEvent.keyCode = e.keyCode;
|
4186
|
+
// Defect 160021 fixed - don't set e.cancelBubble when combobox is opened and esc key is pressed
|
2983
4187
|
if (e.keyCode !== GuiConstants.KEY_ESC || e.keyCode === GuiConstants.KEY_ESC && (!MagicDirective.opened && MagicDirective.noOfAutoCompleteBoxesOpened < 1))
|
2984
4188
|
e.cancelBubble = true;
|
2985
4189
|
this.task.insertEvent(guiEvent);
|
2986
4190
|
}
|
2987
4191
|
});
|
2988
4192
|
}
|
4193
|
+
/**
|
4194
|
+
* Handle focus event
|
4195
|
+
*/
|
2989
4196
|
OnFocus() {
|
2990
4197
|
this.task.insertEvent(getGuiEventObj("focus", this.id, +this.rowId));
|
2991
4198
|
event.cancelBubble = true;
|
2992
4199
|
}
|
4200
|
+
/**
|
4201
|
+
* Is the command's element the same as this directive's element
|
4202
|
+
* @param command
|
4203
|
+
* @returns true/false
|
4204
|
+
*/
|
2993
4205
|
IsSameElement(command) {
|
2994
4206
|
let line = command.line;
|
2995
4207
|
if (this.task.isTableControl(command.CtrlName))
|
@@ -2998,9 +4210,17 @@ class MagicDirective {
|
|
2998
4210
|
(line === +this.rowId ||
|
2999
4211
|
(line === 0 && isNullOrUndefined(this.rowId))));
|
3000
4212
|
}
|
4213
|
+
/**
|
4214
|
+
* Is the command's element the same as this directive's component
|
4215
|
+
* @param command
|
4216
|
+
* @returns true/false
|
4217
|
+
*/
|
3001
4218
|
IsSameComponent(command) {
|
3002
4219
|
return (command.controlName === this.id);
|
3003
4220
|
}
|
4221
|
+
/**
|
4222
|
+
* @ignore
|
4223
|
+
*/
|
3004
4224
|
regUpdatesUI() {
|
3005
4225
|
this.subscribeRefreshDom = this.task
|
3006
4226
|
.refreshDom.pipe(filter(c => this.IsSameElement(c)))
|
@@ -3022,10 +4242,17 @@ class MagicDirective {
|
|
3022
4242
|
this.handleInteractiveCommands(command);
|
3023
4243
|
});
|
3024
4244
|
}
|
4245
|
+
/**
|
4246
|
+
* Initializes this object
|
4247
|
+
*/
|
3025
4248
|
ngOnInit() {
|
3026
4249
|
this.regEvents();
|
3027
4250
|
this.regUpdatesUI();
|
3028
4251
|
}
|
4252
|
+
/**
|
4253
|
+
* Handles the commands received from the Magic WebClient engine
|
4254
|
+
* @param command
|
4255
|
+
*/
|
3029
4256
|
handleCommand(command) {
|
3030
4257
|
switch (command.CommandType) {
|
3031
4258
|
case CommandType.SET_PROPERTY:
|
@@ -3033,12 +4260,16 @@ class MagicDirective {
|
|
3033
4260
|
break;
|
3034
4261
|
case CommandType.SET_FOCUS:
|
3035
4262
|
this.focusUnlistener();
|
4263
|
+
// Do not set focus on connected zoom button
|
3036
4264
|
if (!(command.obj.ConnectedControl && this.htmlElement instanceof HTMLButtonElement))
|
3037
4265
|
this.htmlElement.focus();
|
3038
4266
|
this.focusUnlistener = this.renderer.listen(this.htmlElement, "focusin", this.eventHandlers["focusin"]);
|
3039
4267
|
break;
|
3040
4268
|
}
|
3041
4269
|
}
|
4270
|
+
/**
|
4271
|
+
* handle the interactive commands like CallJS
|
4272
|
+
*/
|
3042
4273
|
handleInteractiveCommands(command) {
|
3043
4274
|
switch (command._commandType) {
|
3044
4275
|
case InteractiveCommandType.CALL_JS:
|
@@ -3048,18 +4279,24 @@ class MagicDirective {
|
|
3048
4279
|
let resultString = "";
|
3049
4280
|
try {
|
3050
4281
|
if (!isNullOrUndefined(magicComponent[methodName])) {
|
4282
|
+
// invoke the method on instance of magic componenet
|
3051
4283
|
resultString = magicComponent[methodName].apply(magicComponent, args);
|
3052
4284
|
}
|
3053
4285
|
else
|
3054
|
-
console.error("Instance method " + methodName + " does not exists");
|
4286
|
+
console.error("Instance method " + methodName + " does not exists"); // when method is not found
|
3055
4287
|
}
|
3056
4288
|
catch (e) {
|
4289
|
+
// any other exception
|
3057
4290
|
console.error(e.message);
|
3058
4291
|
}
|
3059
|
-
command.resultString = resultString;
|
4292
|
+
command.resultString = resultString; // update the return value
|
3060
4293
|
break;
|
3061
4294
|
}
|
3062
4295
|
}
|
4296
|
+
/**
|
4297
|
+
* Handle the Magic set-property command
|
4298
|
+
* @param command
|
4299
|
+
*/
|
3063
4300
|
handleSetProperty(command) {
|
3064
4301
|
switch (command.Operation) {
|
3065
4302
|
case HtmlProperties.ReadOnly:
|
@@ -3073,16 +4310,20 @@ class MagicDirective {
|
|
3073
4310
|
break;
|
3074
4311
|
}
|
3075
4312
|
}
|
4313
|
+
/**
|
4314
|
+
* Cleanup
|
4315
|
+
*/
|
3076
4316
|
ngOnDestroy() {
|
3077
4317
|
this.subscribeRefreshDom.unsubscribe();
|
3078
4318
|
}
|
3079
|
-
static ɵfac = function MagicDirective_Factory(
|
3080
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", pollTime: "pollTime", rowId: "rowId" } });
|
4319
|
+
/** @nocollapse */ static ɵfac = function MagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
4320
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicDirective, selectors: [["", "magic", ""]], inputs: { magic: "magic", eventsOnly: "eventsOnly", pollTime: "pollTime", rowId: "rowId" }, standalone: false });
|
3081
4321
|
}
|
3082
4322
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDirective, [{
|
3083
4323
|
type: Directive,
|
3084
4324
|
args: [{
|
3085
|
-
selector: "[magic]"
|
4325
|
+
selector: "[magic]",
|
4326
|
+
standalone: false
|
3086
4327
|
}]
|
3087
4328
|
}], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
|
3088
4329
|
type: Optional
|
@@ -3098,6 +4339,9 @@ class MagicDirective {
|
|
3098
4339
|
type: Input
|
3099
4340
|
}] }); })();
|
3100
4341
|
|
4342
|
+
/**
|
4343
|
+
* @ignore
|
4344
|
+
*/
|
3101
4345
|
class NoControlMagicDirective extends MagicDirective {
|
3102
4346
|
set magic(val) { this.id = val; this.selector = 'magicnc'; }
|
3103
4347
|
;
|
@@ -3131,10 +4375,12 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3131
4375
|
}
|
3132
4376
|
}
|
3133
4377
|
}
|
4378
|
+
// is the div a tab control
|
3134
4379
|
isTabControl() {
|
3135
4380
|
return this.htmlElement instanceof HTMLDivElement &&
|
3136
4381
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicTabControl";
|
3137
4382
|
}
|
4383
|
+
// is the div a radio buttons wrapper
|
3138
4384
|
isRadio() {
|
3139
4385
|
return this.htmlElement instanceof HTMLDivElement &&
|
3140
4386
|
this.htmlElement.children[0].getAttribute('magicMark') === "magicRadio";
|
@@ -3143,6 +4389,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3143
4389
|
super.handleCommand(command);
|
3144
4390
|
switch (command.CommandType) {
|
3145
4391
|
case CommandType.SET_CLASS:
|
4392
|
+
//remove the class which was replaced by this new one, as registered in the ControlMetadata
|
3146
4393
|
const controlMetadata = this._task.Records.list[0].getControlMetadata(this.id);
|
3147
4394
|
if (controlMetadata.removedClass != '') {
|
3148
4395
|
this.htmlElement.classList.remove(controlMetadata.removedClass);
|
@@ -3155,7 +4402,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3155
4402
|
this.htmlElement.innerText = command.value;
|
3156
4403
|
if (this.htmlElement instanceof HTMLSelectElement)
|
3157
4404
|
this.htmlElement.value = command.value;
|
3158
|
-
if (this.htmlElement instanceof HTMLAnchorElement)
|
4405
|
+
if (this.htmlElement instanceof HTMLAnchorElement) //hyper-text button
|
3159
4406
|
this.htmlElement.text = command.value;
|
3160
4407
|
if (this.htmlElement instanceof HTMLInputElement) {
|
3161
4408
|
if (this.htmlElement.type === "checkbox") {
|
@@ -3179,6 +4426,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3179
4426
|
break;
|
3180
4427
|
}
|
3181
4428
|
}
|
4429
|
+
// handle set-property commands
|
3182
4430
|
handleSetProperty(command) {
|
3183
4431
|
super.handleSetProperty(command);
|
3184
4432
|
switch (command.Operation) {
|
@@ -3194,6 +4442,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3194
4442
|
break;
|
3195
4443
|
case HtmlProperties.ItemsList:
|
3196
4444
|
if (this.htmlElement instanceof HTMLSelectElement) {
|
4445
|
+
// clear the list
|
3197
4446
|
var len = this.htmlElement.length;
|
3198
4447
|
for (var i = len - 1; i >= 0; i--) {
|
3199
4448
|
this.htmlElement.remove(i);
|
@@ -3235,7 +4484,8 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3235
4484
|
let child = tabControl.children[i];
|
3236
4485
|
const layer = child.getAttribute('layer') - 1;
|
3237
4486
|
if (child instanceof HTMLButtonElement) {
|
3238
|
-
|
4487
|
+
// set button style
|
4488
|
+
if (layer == command.obj1) { // compare int to string
|
3239
4489
|
child.classList.add('tab_button_active');
|
3240
4490
|
}
|
3241
4491
|
else {
|
@@ -3243,6 +4493,7 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3243
4493
|
}
|
3244
4494
|
}
|
3245
4495
|
else {
|
4496
|
+
// not a buton - hide unselected tabpages
|
3246
4497
|
let style = (layer == command.obj1) ? 'display: inline' : 'display: none';
|
3247
4498
|
child.setAttribute('style', style);
|
3248
4499
|
}
|
@@ -3263,13 +4514,14 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3263
4514
|
break;
|
3264
4515
|
}
|
3265
4516
|
}
|
3266
|
-
static ɵfac = function NoControlMagicDirective_Factory(
|
3267
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: [
|
4517
|
+
/** @nocollapse */ static ɵfac = function NoControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NoControlMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i2$1.Platform), i0.ɵɵdirectiveInject(RowMagicDirective, 8)); };
|
4518
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NoControlMagicDirective, selectors: [["", "magicnc", ""]], inputs: { magic: [0, "magicnc", "magic"] }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature] });
|
3268
4519
|
}
|
3269
4520
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NoControlMagicDirective, [{
|
3270
4521
|
type: Directive,
|
3271
4522
|
args: [{
|
3272
|
-
selector: '[magicnc]'
|
4523
|
+
selector: '[magicnc]',
|
4524
|
+
standalone: false
|
3273
4525
|
}]
|
3274
4526
|
}], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i2$1.Platform }, { type: RowMagicDirective, decorators: [{
|
3275
4527
|
type: Optional
|
@@ -3278,9 +4530,15 @@ class NoControlMagicDirective extends MagicDirective {
|
|
3278
4530
|
args: ['magicnc']
|
3279
4531
|
}] }); })();
|
3280
4532
|
|
4533
|
+
/**
|
4534
|
+
* @ignore
|
4535
|
+
*/
|
3281
4536
|
class Constants {
|
3282
4537
|
static DATE_FMT = 'dd/MMM/yyyy';
|
3283
4538
|
}
|
4539
|
+
/**
|
4540
|
+
* @ignore
|
4541
|
+
*/
|
3284
4542
|
class DateMagicPipe extends DatePipe {
|
3285
4543
|
_task;
|
3286
4544
|
constructor(_task) {
|
@@ -3293,6 +4551,7 @@ class DateMagicPipe extends DatePipe {
|
|
3293
4551
|
let mgDateFormatter = new MgDateFormatter();
|
3294
4552
|
if (!isNullOrUndefined(value) && mask !== null) {
|
3295
4553
|
formatStr = mgDateFormatter.ConvertMgDateFormatToAngular(mask);
|
4554
|
+
// If control is label control of table, due to query mode, then save the format here.
|
3296
4555
|
if (formatStr != null && this._task.isTableControl(controlId)) {
|
3297
4556
|
if (this._task.mgInputDateFormat == null)
|
3298
4557
|
this._task.mgInputDateFormat = formatStr;
|
@@ -3305,13 +4564,14 @@ class DateMagicPipe extends DatePipe {
|
|
3305
4564
|
value = "";
|
3306
4565
|
return value;
|
3307
4566
|
}
|
3308
|
-
static ɵfac = function DateMagicPipe_Factory(
|
3309
|
-
static ɵpipe = i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true });
|
4567
|
+
/** @nocollapse */ static ɵfac = function DateMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DateMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
|
4568
|
+
/** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicDate", type: DateMagicPipe, pure: true, standalone: false });
|
3310
4569
|
}
|
3311
4570
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateMagicPipe, [{
|
3312
4571
|
type: Pipe,
|
3313
4572
|
args: [{
|
3314
|
-
name: 'magicDate'
|
4573
|
+
name: 'magicDate',
|
4574
|
+
standalone: false
|
3315
4575
|
}]
|
3316
4576
|
}], () => [{ type: TaskMagicService }], null); })();
|
3317
4577
|
class MgDateFormatter {
|
@@ -3373,14 +4633,20 @@ class MgDateFormatter {
|
|
3373
4633
|
return formatStr.ToString();
|
3374
4634
|
}
|
3375
4635
|
else
|
3376
|
-
return "dd-mm-yyyy";
|
4636
|
+
return "dd-mm-yyyy"; // return default format.
|
3377
4637
|
}
|
3378
4638
|
}
|
3379
4639
|
|
4640
|
+
/**
|
4641
|
+
* Perform Magic validation on input controls which hold alphanumeric strings
|
4642
|
+
*/
|
3380
4643
|
class MgformatMagicDirective {
|
3381
4644
|
magicDir;
|
3382
4645
|
_task;
|
3383
4646
|
datePasteFlag = false;
|
4647
|
+
/**
|
4648
|
+
* @ignore
|
4649
|
+
*/
|
3384
4650
|
constructor(magicDir, _task) {
|
3385
4651
|
this.magicDir = magicDir;
|
3386
4652
|
this._task = _task;
|
@@ -3388,16 +4654,30 @@ class MgformatMagicDirective {
|
|
3388
4654
|
ngAfterViewInit() {
|
3389
4655
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3390
4656
|
if (control != null && this._task.mgInputDateFormat == null) {
|
4657
|
+
// get the first date control's format.
|
3391
4658
|
let pic = this._task.GetControlPictureMask(this.magicDir.id);
|
3392
4659
|
if (pic.getAttr() == StorageAttribute.DATE) {
|
3393
4660
|
this.formatDate(pic);
|
3394
4661
|
}
|
3395
4662
|
}
|
3396
4663
|
}
|
4664
|
+
/**
|
4665
|
+
* @ignore
|
4666
|
+
*/
|
4667
|
+
/**
|
4668
|
+
* This can be used to set pattern
|
4669
|
+
* On input, verifies the input matches the required mask
|
4670
|
+
*/
|
3397
4671
|
onFocusEvent($event) {
|
3398
4672
|
this.calculatePattern();
|
3399
4673
|
}
|
3400
4674
|
onPaste(event) {
|
4675
|
+
/**
|
4676
|
+
* This flag is needed to skip execution of dateMasking() method when user paste date in input control.
|
4677
|
+
* This is only needed when "StorageAttribute" is DATE. But to check type of "StorageAttribute", we
|
4678
|
+
need to execute getControlMetadata() method. So, to reduce this execution overload we set
|
4679
|
+
"datePasteFlag" directly.
|
4680
|
+
*/
|
3401
4681
|
this.datePasteFlag = true;
|
3402
4682
|
}
|
3403
4683
|
onInputEvent(event) {
|
@@ -3409,6 +4689,8 @@ class MgformatMagicDirective {
|
|
3409
4689
|
}
|
3410
4690
|
this.calculatePattern();
|
3411
4691
|
}
|
4692
|
+
//This method inserts '/' as a separator while entering date in the textbox.
|
4693
|
+
//Example: 10/10/2023
|
3412
4694
|
dateMasking(event) {
|
3413
4695
|
const input = event.target;
|
3414
4696
|
let cursorPos = event.target.selectionStart;
|
@@ -3561,6 +4843,10 @@ class MgformatMagicDirective {
|
|
3561
4843
|
input.setSelectionRange(start, end);
|
3562
4844
|
}
|
3563
4845
|
}
|
4846
|
+
/**
|
4847
|
+
* @ignore
|
4848
|
+
*/
|
4849
|
+
// This can be used to implement uppercase/lower case
|
3564
4850
|
onChangeEvent(event) {
|
3565
4851
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3566
4852
|
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
@@ -3582,6 +4868,7 @@ class MgformatMagicDirective {
|
|
3582
4868
|
this.formatDateWithCentury(event.target.value, century, control);
|
3583
4869
|
}
|
3584
4870
|
}
|
4871
|
+
/** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
|
3585
4872
|
formatDateWithCentury(userInput, century, control) {
|
3586
4873
|
const dateFormat = this._task.mgInputDateFormat;
|
3587
4874
|
const separator = userInput.includes('/') ? '/' : "-";
|
@@ -3739,6 +5026,9 @@ class MgformatMagicDirective {
|
|
3739
5026
|
const year = Number(dateArray[0]);
|
3740
5027
|
return [day, month, year];
|
3741
5028
|
}
|
5029
|
+
/**
|
5030
|
+
* @ignore
|
5031
|
+
*/
|
3742
5032
|
calculatePattern() {
|
3743
5033
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3744
5034
|
if (control != null) {
|
@@ -3757,6 +5047,7 @@ class MgformatMagicDirective {
|
|
3757
5047
|
if (control.validator == null)
|
3758
5048
|
control.setValidators(Validators.maxLength(pic.getMaskLength()));
|
3759
5049
|
else {
|
5050
|
+
// re-set all validators again
|
3760
5051
|
if (pic.isFormatExp()) {
|
3761
5052
|
control.setValidators(Validators.maxLength(pic.getMaskLength()));
|
3762
5053
|
if (isUndefined(this.magicDir.rowId))
|
@@ -3766,6 +5057,7 @@ class MgformatMagicDirective {
|
|
3766
5057
|
else
|
3767
5058
|
control.setValidators([control.validator, Validators.maxLength(pic.getMaskLength())]);
|
3768
5059
|
}
|
5060
|
+
// control.setValidators(Validators.maxLength(pic.getMaskLength()));
|
3769
5061
|
control.updateValueAndValidity();
|
3770
5062
|
}
|
3771
5063
|
}
|
@@ -3776,6 +5068,9 @@ class MgformatMagicDirective {
|
|
3776
5068
|
let mgDateFormatter = new MgDateFormatter();
|
3777
5069
|
this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
|
3778
5070
|
}
|
5071
|
+
/**
|
5072
|
+
* @ignore
|
5073
|
+
*/
|
3779
5074
|
formatAlphaUnicode(control) {
|
3780
5075
|
let value = control.value;
|
3781
5076
|
if (value !== null && value.length > 0) {
|
@@ -3801,6 +5096,9 @@ class MgformatMagicDirective {
|
|
3801
5096
|
control.setValue(valueStr.ToString());
|
3802
5097
|
}
|
3803
5098
|
}
|
5099
|
+
/**
|
5100
|
+
* @ignore
|
5101
|
+
*/
|
3804
5102
|
formatBoolean(control) {
|
3805
5103
|
let value = control.value;
|
3806
5104
|
if (value !== null && value.length > 0) {
|
@@ -3813,6 +5111,12 @@ class MgformatMagicDirective {
|
|
3813
5111
|
}
|
3814
5112
|
}
|
3815
5113
|
}
|
5114
|
+
/**
|
5115
|
+
* @ignore
|
5116
|
+
*/
|
5117
|
+
/// <summary>
|
5118
|
+
/// generate pattern from fld's format
|
5119
|
+
/// </summary>
|
3816
5120
|
generatePattern(attribute, pic) {
|
3817
5121
|
let pattern = '';
|
3818
5122
|
switch (attribute) {
|
@@ -3826,6 +5130,12 @@ class MgformatMagicDirective {
|
|
3826
5130
|
}
|
3827
5131
|
return pattern;
|
3828
5132
|
}
|
5133
|
+
/**
|
5134
|
+
* @ignore
|
5135
|
+
*/
|
5136
|
+
/// <summary>
|
5137
|
+
/// generate pattern for Alpha
|
5138
|
+
/// </summary>
|
3829
5139
|
generatePatternForNumber(pic) {
|
3830
5140
|
let patternStr = new StringBuilder();
|
3831
5141
|
patternStr.Append('^');
|
@@ -3838,6 +5148,9 @@ class MgformatMagicDirective {
|
|
3838
5148
|
patternStr.Append('$');
|
3839
5149
|
return patternStr.ToString();
|
3840
5150
|
}
|
5151
|
+
/**
|
5152
|
+
* @ignore
|
5153
|
+
*/
|
3841
5154
|
isPatternGenerationNeeded(attr, pic) {
|
3842
5155
|
switch (attr) {
|
3843
5156
|
case StorageAttribute.NUMERIC:
|
@@ -3847,6 +5160,12 @@ class MgformatMagicDirective {
|
|
3847
5160
|
return (pic.getMaskChars() > 0) ? true : false;
|
3848
5161
|
}
|
3849
5162
|
}
|
5163
|
+
/**
|
5164
|
+
* @ignore
|
5165
|
+
*/
|
5166
|
+
/// <summary>
|
5167
|
+
/// generate pattern for Alpha
|
5168
|
+
/// </summary>
|
3850
5169
|
generatePatternForAlpha(pic) {
|
3851
5170
|
let cnt = 0;
|
3852
5171
|
let inputAllChars = false;
|
@@ -3855,6 +5174,7 @@ class MgformatMagicDirective {
|
|
3855
5174
|
let pattern = new StringBuilder();
|
3856
5175
|
pattern.Append('^');
|
3857
5176
|
for (let i = 0; i < mask.length;) {
|
5177
|
+
//start new subset , if mask[i] is one of these.
|
3858
5178
|
if (inputAllChars && (mask.charCodeAt(i) == PICInterface.PIC_N || mask.charCodeAt(i) == PICInterface.PIC_U || mask.charCodeAt(i) == PICInterface.PIC_L
|
3859
5179
|
|| mask.charCodeAt(i) == PICInterface.PIC_X)) {
|
3860
5180
|
pattern.Append('(');
|
@@ -3900,9 +5220,13 @@ class MgformatMagicDirective {
|
|
3900
5220
|
pattern.Append('$');
|
3901
5221
|
return pattern.ToString();
|
3902
5222
|
}
|
5223
|
+
/**
|
5224
|
+
* @ignore
|
5225
|
+
*/
|
3903
5226
|
getDirectiveCount(mask, idx, pattern, changeInPattern) {
|
3904
5227
|
changeInPattern.value = false;
|
3905
5228
|
let patternCount = 0;
|
5229
|
+
// find max chars
|
3906
5230
|
while (idx < mask.length && this.IsPatternMatches(mask.charCodeAt(idx).toString(), pattern)) {
|
3907
5231
|
patternCount++;
|
3908
5232
|
idx++;
|
@@ -3911,21 +5235,25 @@ class MgformatMagicDirective {
|
|
3911
5235
|
changeInPattern.value = true;
|
3912
5236
|
return patternCount;
|
3913
5237
|
}
|
5238
|
+
/**
|
5239
|
+
* @ignore
|
5240
|
+
*/
|
3914
5241
|
IsPatternMatches(mask, pattern) {
|
3915
5242
|
for (let i = 0; i < pattern.length; i++)
|
3916
5243
|
if (mask == pattern[i])
|
3917
5244
|
return true;
|
3918
5245
|
return false;
|
3919
5246
|
}
|
3920
|
-
static ɵfac = function MgformatMagicDirective_Factory(
|
3921
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
5247
|
+
/** @nocollapse */ static ɵfac = function MgformatMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
5248
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
3922
5249
|
i0.ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("paste", function MgformatMagicDirective_paste_HostBindingHandler($event) { return ctx.onPaste($event); })("input", function MgformatMagicDirective_input_HostBindingHandler($event) { return ctx.onInputEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); })("blur", function MgformatMagicDirective_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
|
3923
|
-
} } });
|
5250
|
+
} }, standalone: false });
|
3924
5251
|
}
|
3925
5252
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
|
3926
5253
|
type: Directive,
|
3927
5254
|
args: [{
|
3928
|
-
selector: '[mgFormat]'
|
5255
|
+
selector: '[mgFormat]',
|
5256
|
+
standalone: false
|
3929
5257
|
}]
|
3930
5258
|
}], () => [{ type: MagicDirective }, { type: TaskMagicService }], { onFocusEvent: [{
|
3931
5259
|
type: HostListener,
|
@@ -3944,6 +5272,9 @@ class MgformatMagicDirective {
|
|
3944
5272
|
args: ['blur', ['$event']]
|
3945
5273
|
}] }); })();
|
3946
5274
|
|
5275
|
+
/**
|
5276
|
+
* @ignore
|
5277
|
+
*/
|
3947
5278
|
class TimeMagicPipe extends DatePipe {
|
3948
5279
|
_task;
|
3949
5280
|
constructor(_task) {
|
@@ -3979,23 +5310,37 @@ class TimeMagicPipe extends DatePipe {
|
|
3979
5310
|
}
|
3980
5311
|
return value;
|
3981
5312
|
}
|
3982
|
-
static ɵfac = function TimeMagicPipe_Factory(
|
3983
|
-
static ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true });
|
5313
|
+
/** @nocollapse */ static ɵfac = function TimeMagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TimeMagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
|
5314
|
+
/** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime", type: TimeMagicPipe, pure: true, standalone: false });
|
3984
5315
|
}
|
3985
5316
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimeMagicPipe, [{
|
3986
5317
|
type: Pipe,
|
3987
5318
|
args: [{
|
3988
|
-
name: 'magicTime'
|
5319
|
+
name: 'magicTime',
|
5320
|
+
standalone: false
|
3989
5321
|
}]
|
3990
5322
|
}], () => [{ type: TaskMagicService }], null); })();
|
3991
5323
|
|
5324
|
+
/**
|
5325
|
+
* Validates the field range.
|
5326
|
+
*/
|
3992
5327
|
class RangeValidatorMagicDirective {
|
3993
5328
|
_task;
|
3994
5329
|
vcRef;
|
5330
|
+
/**
|
5331
|
+
*
|
5332
|
+
* @param _task The task service
|
5333
|
+
* @param vcRef
|
5334
|
+
*/
|
3995
5335
|
constructor(_task, vcRef) {
|
3996
5336
|
this._task = _task;
|
3997
5337
|
this.vcRef = vcRef;
|
3998
5338
|
}
|
5339
|
+
/**
|
5340
|
+
* Validation method
|
5341
|
+
* @param c FormControl to validate
|
5342
|
+
* @returns If validation fails, return error message, else returns null
|
5343
|
+
*/
|
3999
5344
|
validate(c) {
|
4000
5345
|
let controlName;
|
4001
5346
|
controlName = this.getControlName(c);
|
@@ -4017,12 +5362,15 @@ class RangeValidatorMagicDirective {
|
|
4017
5362
|
};
|
4018
5363
|
}
|
4019
5364
|
}
|
5365
|
+
/**
|
5366
|
+
* @ignore
|
5367
|
+
*/
|
4020
5368
|
getControlName(c) {
|
4021
5369
|
const formGroup = c.parent.controls;
|
4022
5370
|
return Object.keys(formGroup).find(name => c === formGroup[name]) || null;
|
4023
5371
|
}
|
4024
|
-
static ɵfac = function RangeValidatorMagicDirective_Factory(
|
4025
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], features: [i0.ɵɵProvidersFeature([
|
5372
|
+
/** @nocollapse */ static ɵfac = function RangeValidatorMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || RangeValidatorMagicDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
|
5373
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: RangeValidatorMagicDirective, selectors: [["", "rangevalidator", ""]], standalone: false, features: [i0.ɵɵProvidersFeature([
|
4026
5374
|
{
|
4027
5375
|
provide: NG_VALIDATORS,
|
4028
5376
|
useExisting: RangeValidatorMagicDirective,
|
@@ -4040,7 +5388,8 @@ class RangeValidatorMagicDirective {
|
|
4040
5388
|
useExisting: RangeValidatorMagicDirective,
|
4041
5389
|
multi: true,
|
4042
5390
|
}
|
4043
|
-
]
|
5391
|
+
],
|
5392
|
+
standalone: false
|
4044
5393
|
}]
|
4045
5394
|
}], () => [{ type: TaskMagicService }, { type: i0.ViewContainerRef }], null); })();
|
4046
5395
|
|
@@ -4050,26 +5399,48 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) { if (rf & 1) {
|
|
4050
5399
|
const ctx_r0 = i0.ɵɵnextContext();
|
4051
5400
|
i0.ɵɵproperty("ndcDynamicComponent", ctx_r0.Component)("ndcDynamicInputs", ctx_r0.Parameters);
|
4052
5401
|
} }
|
5402
|
+
/**
|
5403
|
+
* Represents a Magic subform
|
5404
|
+
*/
|
4053
5405
|
class SubformMagicComponent {
|
4054
5406
|
vcRef;
|
4055
5407
|
mgSub;
|
5408
|
+
/**
|
5409
|
+
* @ignore
|
5410
|
+
*/
|
4056
5411
|
id;
|
5412
|
+
/**
|
5413
|
+
* @ignore
|
5414
|
+
*/
|
4057
5415
|
set magic(val) { this.id = val; }
|
4058
5416
|
;
|
5417
|
+
/**
|
5418
|
+
* @ignore
|
5419
|
+
*/
|
4059
5420
|
component = null;
|
5421
|
+
/**
|
5422
|
+
* @ignore
|
5423
|
+
*/
|
4060
5424
|
constructor(vcRef, mgSub) {
|
4061
5425
|
this.vcRef = vcRef;
|
4062
5426
|
this.mgSub = mgSub;
|
5427
|
+
// For angular 13 - find the component from _hostLView
|
4063
5428
|
this.component = (this.vcRef._hostLView).find(v => !isNullOrUndefined(v));
|
4064
5429
|
}
|
5430
|
+
/**
|
5431
|
+
* @ignore
|
5432
|
+
*/
|
4065
5433
|
get Component() {
|
4066
5434
|
return this.mgSub.mgGetComp(this.id);
|
4067
5435
|
}
|
5436
|
+
/**
|
5437
|
+
* @ignore
|
5438
|
+
*/
|
4068
5439
|
get Parameters() {
|
4069
5440
|
return this.mgSub.mgGetParameters(this.id);
|
4070
5441
|
}
|
4071
|
-
static ɵfac = function SubformMagicComponent_Factory(
|
4072
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) { if (rf & 1) {
|
5442
|
+
/** @nocollapse */ static ɵfac = function SubformMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SubformMagicComponent)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(SubformMagicService)); };
|
5443
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: SubformMagicComponent, selectors: [["magic-subform"]], inputs: { magic: "magic" }, standalone: false, decls: 1, vars: 1, consts: [[3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"]], template: function SubformMagicComponent_Template(rf, ctx) { if (rf & 1) {
|
4073
5444
|
i0.ɵɵtemplate(0, SubformMagicComponent_ndc_dynamic_0_Template, 1, 2, "ndc-dynamic", 0);
|
4074
5445
|
} if (rf & 2) {
|
4075
5446
|
i0.ɵɵproperty("ngIf", ctx.Component);
|
@@ -4085,13 +5456,14 @@ class SubformMagicComponent {
|
|
4085
5456
|
[ndcDynamicComponent]="Component"
|
4086
5457
|
[ndcDynamicInputs]="Parameters">
|
4087
5458
|
</ndc-dynamic>
|
4088
|
-
|
5459
|
+
`,
|
5460
|
+
standalone: false
|
4089
5461
|
}]
|
4090
5462
|
}], () => [{ type: i0.ViewContainerRef }, { type: SubformMagicService }], { magic: [{
|
4091
5463
|
type: Input,
|
4092
5464
|
args: ['magic']
|
4093
5465
|
}] }); })();
|
4094
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src
|
5466
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SubformMagicComponent, { className: "SubformMagicComponent", filePath: "src/ui/subform.magic.component.ts", lineNumber: 22 }); })();
|
4095
5467
|
|
4096
5468
|
const _c0$1 = ["customContent"];
|
4097
5469
|
const _c1 = ["*"];
|
@@ -4115,12 +5487,21 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) { if (rf & 1) {
|
|
4115
5487
|
i0.ɵɵadvance(4);
|
4116
5488
|
i0.ɵɵproperty("ngIf", ctx_r0.defaultDisplay);
|
4117
5489
|
} }
|
5490
|
+
/**
|
5491
|
+
* Represents a Magic subform
|
5492
|
+
*/
|
4118
5493
|
class ErrorMagicComponent {
|
4119
5494
|
_task;
|
4120
5495
|
mgService;
|
4121
5496
|
changeDetectorRef;
|
5497
|
+
/**
|
5498
|
+
* @ignore
|
5499
|
+
*/
|
4122
5500
|
id;
|
4123
5501
|
rowId;
|
5502
|
+
/**
|
5503
|
+
* @ignore
|
5504
|
+
*/
|
4124
5505
|
set magic(val) {
|
4125
5506
|
this.id = val;
|
4126
5507
|
}
|
@@ -4129,18 +5510,26 @@ class ErrorMagicComponent {
|
|
4129
5510
|
this.rowId = val;
|
4130
5511
|
}
|
4131
5512
|
;
|
5513
|
+
// if true - display standard magic error message, if false - customer has provides his own content and we'll use it
|
4132
5514
|
defaultDisplay = true;
|
4133
5515
|
set CustomContent(innerComponent) {
|
4134
5516
|
this.defaultDisplay = innerComponent == undefined || this.isEmpty(innerComponent.nativeElement);
|
4135
5517
|
this.changeDetectorRef.detectChanges();
|
4136
5518
|
}
|
4137
5519
|
;
|
5520
|
+
/**
|
5521
|
+
* @ignore
|
5522
|
+
*/
|
4138
5523
|
constructor(_task, mgService, changeDetectorRef) {
|
4139
5524
|
this._task = _task;
|
4140
5525
|
this.mgService = mgService;
|
4141
5526
|
this.changeDetectorRef = changeDetectorRef;
|
4142
5527
|
this.rowId = "0";
|
4143
5528
|
}
|
5529
|
+
/**
|
5530
|
+
* returns true if the html element has no children
|
5531
|
+
* @param element
|
5532
|
+
*/
|
4144
5533
|
isEmpty(element) {
|
4145
5534
|
const nodes = element.childNodes;
|
4146
5535
|
for (let i = 0; i < nodes.length; i++) {
|
@@ -4151,6 +5540,9 @@ class ErrorMagicComponent {
|
|
4151
5540
|
}
|
4152
5541
|
return true;
|
4153
5542
|
}
|
5543
|
+
/**
|
5544
|
+
* @ignore
|
5545
|
+
*/
|
4154
5546
|
HasErrors(id) {
|
4155
5547
|
if (!isUndefined(id)) {
|
4156
5548
|
let control = this._task.getFormControl(this.rowId, id);
|
@@ -4171,13 +5563,13 @@ class ErrorMagicComponent {
|
|
4171
5563
|
}
|
4172
5564
|
return false;
|
4173
5565
|
}
|
4174
|
-
static ɵfac = function ErrorMagicComponent_Factory(
|
4175
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
|
5566
|
+
/** @nocollapse */ static ɵfac = function ErrorMagicComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ErrorMagicComponent)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(AccessorMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
|
5567
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: ErrorMagicComponent, selectors: [["mgError"]], viewQuery: function ErrorMagicComponent_Query(rf, ctx) { if (rf & 1) {
|
4176
5568
|
i0.ɵɵviewQuery(_c0$1, 5);
|
4177
5569
|
} if (rf & 2) {
|
4178
5570
|
let _t;
|
4179
5571
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.CustomContent = _t.first);
|
4180
|
-
} }, inputs: { magic: "magic", rowId1: [
|
5572
|
+
} }, inputs: { magic: "magic", rowId1: [0, "rowId", "rowId1"] }, standalone: false, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [["customContent", ""], [4, "ngIf"]], template: function ErrorMagicComponent_Template(rf, ctx) { if (rf & 1) {
|
4181
5573
|
i0.ɵɵprojectionDef();
|
4182
5574
|
i0.ɵɵtemplate(0, ErrorMagicComponent_div_0_Template, 5, 1, "div", 1);
|
4183
5575
|
} if (rf & 2) {
|
@@ -4196,7 +5588,8 @@ class ErrorMagicComponent {
|
|
4196
5588
|
{{mgService.getErrMsg(id, rowId)}}
|
4197
5589
|
</span>
|
4198
5590
|
</div>
|
4199
|
-
|
5591
|
+
`,
|
5592
|
+
standalone: false
|
4200
5593
|
}]
|
4201
5594
|
}], () => [{ type: TaskMagicService }, { type: AccessorMagicService }, { type: i0.ChangeDetectorRef }], { magic: [{
|
4202
5595
|
type: Input,
|
@@ -4208,8 +5601,11 @@ class ErrorMagicComponent {
|
|
4208
5601
|
type: ViewChild,
|
4209
5602
|
args: ['customContent', { static: false }]
|
4210
5603
|
}] }); })();
|
4211
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src
|
5604
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ErrorMagicComponent, { className: "ErrorMagicComponent", filePath: "src/ui/mgerror.magic.component.ts", lineNumber: 24 }); })();
|
4212
5605
|
|
5606
|
+
/**
|
5607
|
+
* Directive for checkboxes, to handle the 'change' event
|
5608
|
+
*/
|
4213
5609
|
class CheckboxMagicDirective {
|
4214
5610
|
magicDirective;
|
4215
5611
|
el;
|
@@ -4217,11 +5613,17 @@ class CheckboxMagicDirective {
|
|
4217
5613
|
threeState = false;
|
4218
5614
|
subscribeRefreshDom = null;
|
4219
5615
|
isIndeterminate = false;
|
5616
|
+
/**
|
5617
|
+
* @ignore
|
5618
|
+
*/
|
4220
5619
|
constructor(magicDirective, el, task) {
|
4221
5620
|
this.magicDirective = magicDirective;
|
4222
5621
|
this.el = el;
|
4223
5622
|
this.task = task;
|
4224
5623
|
}
|
5624
|
+
/**
|
5625
|
+
* Handles the Checkbox 'change' event - pass it to the Magic engine
|
5626
|
+
*/
|
4225
5627
|
onChange($event) {
|
4226
5628
|
if (this.threeState) {
|
4227
5629
|
this.handleThreeState();
|
@@ -4276,16 +5678,20 @@ class CheckboxMagicDirective {
|
|
4276
5678
|
checkbox.indeterminate = false;
|
4277
5679
|
value = 'checked';
|
4278
5680
|
}
|
5681
|
+
// @ts-ignore
|
4279
5682
|
this.magicDirective.task.onCheckChanged(value, this.magicDirective.id, +this.magicDirective.rowId);
|
4280
5683
|
}
|
5684
|
+
/**
|
5685
|
+
* Cleanup
|
5686
|
+
*/
|
4281
5687
|
ngOnDestroy() {
|
4282
5688
|
if (this.subscribeRefreshDom !== null)
|
4283
5689
|
this.subscribeRefreshDom.unsubscribe();
|
4284
5690
|
}
|
4285
|
-
static ɵfac = function CheckboxMagicDirective_Factory(
|
4286
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
5691
|
+
/** @nocollapse */ static ɵfac = function CheckboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
5692
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
4287
5693
|
i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
4288
|
-
} }, inputs: { threeState: "threeState" } });
|
5694
|
+
} }, inputs: { threeState: "threeState" }, standalone: false });
|
4289
5695
|
}
|
4290
5696
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
|
4291
5697
|
type: Directive,
|
@@ -4293,6 +5699,7 @@ class CheckboxMagicDirective {
|
|
4293
5699
|
selector: `
|
4294
5700
|
input[type=checkbox][magic]:not([noFormControl])
|
4295
5701
|
`,
|
5702
|
+
standalone: false
|
4296
5703
|
}]
|
4297
5704
|
}], () => [{ type: MagicDirective }, { type: i0.ElementRef }, { type: TaskMagicService }], { threeState: [{
|
4298
5705
|
type: Input
|
@@ -4301,43 +5708,62 @@ class CheckboxMagicDirective {
|
|
4301
5708
|
args: ['change', ['$event']]
|
4302
5709
|
}] }); })();
|
4303
5710
|
|
5711
|
+
/**
|
5712
|
+
* Directive for comboboxes, to handle the 'change' event
|
5713
|
+
*/
|
4304
5714
|
class ComboboxMagicDirective {
|
4305
5715
|
magicDirective;
|
4306
5716
|
constructor(magicDirective) {
|
4307
5717
|
this.magicDirective = magicDirective;
|
5718
|
+
// subcribe to refreshDom. This is a special case for native select HTML control.
|
5719
|
+
// to refresh the selected property. Else by default, HTML element doesn't get refreshed as per
|
5720
|
+
// selected value and 1st element remains selected.
|
4308
5721
|
this.magicDirective.task.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c))).subscribe(value => {
|
4309
5722
|
let command = value;
|
4310
5723
|
if (command.Operation === HtmlProperties.ItemsList)
|
4311
5724
|
this.onComboboxItemsListChanged();
|
4312
5725
|
});
|
4313
5726
|
}
|
5727
|
+
/**
|
5728
|
+
* Handles the Combobox 'change' event - pass it to the Magic engine
|
5729
|
+
*/
|
4314
5730
|
onChange($event) {
|
4315
5731
|
this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
4316
5732
|
}
|
5733
|
+
/**
|
5734
|
+
* To refresh Combobox selection as per selected property.
|
5735
|
+
*/
|
4317
5736
|
onComboboxItemsListChanged() {
|
4318
5737
|
this.magicDirective.task.refreshView();
|
4319
5738
|
}
|
4320
|
-
static ɵfac = function ComboboxMagicDirective_Factory(
|
4321
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
5739
|
+
/** @nocollapse */ static ɵfac = function ComboboxMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
|
5740
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
4322
5741
|
i0.ɵɵlistener("change", function ComboboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
4323
|
-
} } });
|
5742
|
+
} }, standalone: false });
|
4324
5743
|
}
|
4325
5744
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ComboboxMagicDirective, [{
|
4326
5745
|
type: Directive,
|
4327
5746
|
args: [{
|
4328
5747
|
selector: `select[magic]:not([multiple])`,
|
5748
|
+
standalone: false
|
4329
5749
|
}]
|
4330
5750
|
}], () => [{ type: MagicDirective }], { onChange: [{
|
4331
5751
|
type: HostListener,
|
4332
5752
|
args: ['change', ['$event']]
|
4333
5753
|
}] }); })();
|
4334
5754
|
|
5755
|
+
/**
|
5756
|
+
* This service supports custom actions on magic exit
|
5757
|
+
*/
|
4335
5758
|
class ExitMagicService {
|
5759
|
+
/**
|
5760
|
+
* Override this method to implement custom logic on magic exit
|
5761
|
+
*/
|
4336
5762
|
exitMagic() {
|
4337
5763
|
console.log("Magic application terminated");
|
4338
5764
|
}
|
4339
|
-
static ɵfac = function ExitMagicService_Factory(
|
4340
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
|
5765
|
+
/** @nocollapse */ static ɵfac = function ExitMagicService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ExitMagicService)(); };
|
5766
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: ExitMagicService, factory: ExitMagicService.ɵfac });
|
4341
5767
|
}
|
4342
5768
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExitMagicService, [{
|
4343
5769
|
type: Injectable
|
@@ -4363,6 +5789,9 @@ function MagicShellComponent_div_5_Template(rf, ctx) { if (rf & 1) {
|
|
4363
5789
|
function MagicShellComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
|
4364
5790
|
i0.ɵɵelement(0, "div", 9);
|
4365
5791
|
} }
|
5792
|
+
/**
|
5793
|
+
* Root Magic component
|
5794
|
+
*/
|
4366
5795
|
class MagicShellComponent {
|
4367
5796
|
engineMagicService;
|
4368
5797
|
componentList;
|
@@ -4374,13 +5803,28 @@ class MagicShellComponent {
|
|
4374
5803
|
route;
|
4375
5804
|
router;
|
4376
5805
|
exitMagicService;
|
5806
|
+
/**
|
5807
|
+
* Root component to be displayed in the window
|
5808
|
+
*/
|
4377
5809
|
RootComponent = null;
|
5810
|
+
/**
|
5811
|
+
* parameters for the Root Component
|
5812
|
+
*/
|
4378
5813
|
RootComponentParameters;
|
4379
5814
|
overlayWindowsContainerViewRef;
|
4380
5815
|
rootMagicElementRef;
|
4381
5816
|
SpinnerTemplate;
|
4382
5817
|
showSpinner;
|
4383
5818
|
magicEngineTerminated = false;
|
5819
|
+
/**
|
5820
|
+
*
|
5821
|
+
* @param magic Magic's service
|
5822
|
+
* @param componentList Magic component list
|
5823
|
+
* @param changeDetectorRef Changes detector
|
5824
|
+
* @param titleService Title setting service
|
5825
|
+
* @param httpClient The native httpClient instance
|
5826
|
+
* @param exitMagicService Magic exit service
|
5827
|
+
*/
|
4384
5828
|
constructor(engineMagicService, componentList, changeDetectorRef, titleService, overlayWindowService, httpClient, pendingCommandsCollector, route, router, exitMagicService) {
|
4385
5829
|
this.engineMagicService = engineMagicService;
|
4386
5830
|
this.componentList = componentList;
|
@@ -4395,17 +5839,24 @@ class MagicShellComponent {
|
|
4395
5839
|
this.initialize();
|
4396
5840
|
this.setTitle();
|
4397
5841
|
}
|
5842
|
+
/**
|
5843
|
+
* Before-unload event listener
|
5844
|
+
* @param event
|
5845
|
+
*/
|
4398
5846
|
onBeforeUnload(event) {
|
4399
5847
|
if (this.engineMagicService.TransCacheExists()) {
|
5848
|
+
// Show the confirmation box before unloading the browser
|
4400
5849
|
event.returnValue = 'Are you sure?';
|
4401
5850
|
return 'Are you sure?';
|
4402
5851
|
}
|
4403
5852
|
else {
|
5853
|
+
// terminate the magic server context using fetch API with keep-alive
|
4404
5854
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
4405
5855
|
this.magicEngineTerminated = true;
|
4406
5856
|
}
|
4407
5857
|
}
|
4408
5858
|
onUnload(event) {
|
5859
|
+
// Chrome provides an opportunity to terminate the context after user approves the browser unload alert
|
4409
5860
|
if (!this.magicEngineTerminated)
|
4410
5861
|
this.engineMagicService.TerminateContextUsingFetchAPI();
|
4411
5862
|
}
|
@@ -4417,6 +5868,7 @@ class MagicShellComponent {
|
|
4417
5868
|
if (this.router.navigated) {
|
4418
5869
|
const queryParams = this.route.snapshot.queryParams;
|
4419
5870
|
const queryParamsMap = new Map();
|
5871
|
+
// Iterate over the queryParams object and populate the Map
|
4420
5872
|
for (const key in queryParams) {
|
4421
5873
|
if (queryParams.hasOwnProperty(key)) {
|
4422
5874
|
queryParamsMap.set(key, queryParams[key].toString());
|
@@ -4430,13 +5882,26 @@ class MagicShellComponent {
|
|
4430
5882
|
setViewContainerRef(vcRef) {
|
4431
5883
|
this.overlayWindowsContainerViewRef = vcRef;
|
4432
5884
|
}
|
5885
|
+
/**
|
5886
|
+
* Initialization of Magic mechanisms
|
5887
|
+
*/
|
4433
5888
|
initialize() {
|
4434
5889
|
this.registerUICommands();
|
4435
5890
|
}
|
5891
|
+
/**
|
5892
|
+
* Set the title
|
5893
|
+
*/
|
4436
5894
|
setTitle() {
|
4437
5895
|
const newTitle = this.componentList.title;
|
4438
5896
|
this.titleService.setTitle(newTitle);
|
4439
5897
|
}
|
5898
|
+
/**
|
5899
|
+
* Set the component according to requested form
|
5900
|
+
* @param formName Name of the form to open
|
5901
|
+
* @param taskId Id of opening task
|
5902
|
+
* @param taskDescription TODO
|
5903
|
+
* @param isModal whether modal window is being opened
|
5904
|
+
*/
|
4440
5905
|
setComponent(formName, taskId, taskDescription, isModal) {
|
4441
5906
|
this.pendingCommandsCollector.startCollecting();
|
4442
5907
|
if (isModal) {
|
@@ -4448,6 +5913,9 @@ class MagicShellComponent {
|
|
4448
5913
|
}
|
4449
5914
|
this.changeDetectorRef.detectChanges();
|
4450
5915
|
}
|
5916
|
+
/**
|
5917
|
+
* @ignore
|
5918
|
+
*/
|
4451
5919
|
registerUICommands() {
|
4452
5920
|
this.engineMagicService.refreshDom.pipe(filter(command => command.TaskTag === '0'))
|
4453
5921
|
.subscribe(command => {
|
@@ -4459,6 +5927,10 @@ class MagicShellComponent {
|
|
4459
5927
|
GuiInteractiveExecutor.executeInteractiveCommand(null, command, this.overlayWindowService);
|
4460
5928
|
});
|
4461
5929
|
}
|
5930
|
+
/**
|
5931
|
+
* Execute commands received from the Magic WebClient engine
|
5932
|
+
* @param command
|
5933
|
+
*/
|
4462
5934
|
executeCommand(command) {
|
4463
5935
|
switch (command.CommandType) {
|
4464
5936
|
case CommandType.OPEN_FORM:
|
@@ -4473,7 +5945,7 @@ class MagicShellComponent {
|
|
4473
5945
|
this.RootComponentParameters = {};
|
4474
5946
|
this.changeDetectorRef.detectChanges();
|
4475
5947
|
}
|
4476
|
-
else {
|
5948
|
+
else { // Close modal window
|
4477
5949
|
this.overlayWindowService.close(command.str);
|
4478
5950
|
this.changeDetectorRef.detectChanges();
|
4479
5951
|
}
|
@@ -4496,15 +5968,17 @@ class MagicShellComponent {
|
|
4496
5968
|
break;
|
4497
5969
|
}
|
4498
5970
|
}
|
4499
|
-
static ɵfac = function MagicShellComponent_Factory(
|
4500
|
-
static ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
|
5971
|
+
/** @nocollapse */ static ɵfac = function MagicShellComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicShellComponent)(i0.ɵɵdirectiveInject(EngineMagicService), i0.ɵɵdirectiveInject(ComponentListMagicService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1$1.Title), i0.ɵɵdirectiveInject(OverlayWindowService), i0.ɵɵdirectiveInject(i1$2.HttpClient), i0.ɵɵdirectiveInject(CommandsCollectorMagicService), i0.ɵɵdirectiveInject(i2.ActivatedRoute), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(ExitMagicService, 8)); };
|
5972
|
+
/** @nocollapse */ static ɵcmp = /** @pureOrBreakMyCode */ i0.ɵɵdefineComponent({ type: MagicShellComponent, selectors: [["magic-root"]], viewQuery: function MagicShellComponent_Query(rf, ctx) { if (rf & 1) {
|
4501
5973
|
i0.ɵɵviewQuery(_c0, 7);
|
4502
5974
|
} if (rf & 2) {
|
4503
5975
|
let _t;
|
4504
5976
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.rootMagicElementRef = _t.first);
|
4505
5977
|
} }, hostBindings: function MagicShellComponent_HostBindings(rf, ctx) { if (rf & 1) {
|
4506
5978
|
i0.ɵɵlistener("beforeunload", function MagicShellComponent_beforeunload_HostBindingHandler($event) { return ctx.onBeforeUnload($event); }, false, i0.ɵɵresolveWindow)("unload", function MagicShellComponent_unload_HostBindingHandler($event) { return ctx.onUnload($event); }, false, i0.ɵɵresolveWindow);
|
4507
|
-
} }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, features: [i0.ɵɵProvidersFeature([
|
5979
|
+
} }, inputs: { SpinnerTemplate: "SpinnerTemplate" }, standalone: false, features: [i0.ɵɵProvidersFeature([
|
5980
|
+
// ExitMagicService
|
5981
|
+
])], decls: 8, vars: 2, consts: [["magicRoot", ""], ["overlayWindowsContainer", ""], ["defaultSpinner", ""], [3, "ndcDynamicComponent", "ndcDynamicInputs", 4, "ngIf"], ["magicViewContainerRef", ""], ["class", "spinner-background", 4, "ngIf"], [3, "ndcDynamicComponent", "ndcDynamicInputs"], [1, "spinner-background"], [3, "ngTemplateOutlet"], [1, "mgSpinnerClass"]], template: function MagicShellComponent_Template(rf, ctx) { if (rf & 1) {
|
4508
5982
|
i0.ɵɵelementStart(0, "div", null, 0);
|
4509
5983
|
i0.ɵɵtemplate(2, MagicShellComponent_ndc_dynamic_2_Template, 1, 2, "ndc-dynamic", 3);
|
4510
5984
|
i0.ɵɵelement(3, "div", 4, 1);
|
@@ -4519,7 +5993,9 @@ class MagicShellComponent {
|
|
4519
5993
|
}
|
4520
5994
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
|
4521
5995
|
type: Component,
|
4522
|
-
args: [{ selector: 'magic-root', providers: [
|
5996
|
+
args: [{ selector: 'magic-root', providers: [
|
5997
|
+
// ExitMagicService
|
5998
|
+
], template: `
|
4523
5999
|
<div #magicRoot>
|
4524
6000
|
<ndc-dynamic
|
4525
6001
|
*ngIf = "RootComponent !== null"
|
@@ -4538,7 +6014,7 @@ class MagicShellComponent {
|
|
4538
6014
|
<ng-template #defaultSpinner>
|
4539
6015
|
<div class="mgSpinnerClass"></div>
|
4540
6016
|
</ng-template>
|
4541
|
-
`, styles: [".mgSpinnerClass{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;inset:0;width:100px;height:100px;animation:spin 2s linear infinite}.spinner-background{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
6017
|
+
`, standalone: false, styles: [".mgSpinnerClass{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;inset:0;width:100px;height:100px;animation:spin 2s linear infinite}.spinner-background{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"] }]
|
4542
6018
|
}], () => [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: i0.ChangeDetectorRef }, { type: i1$1.Title }, { type: OverlayWindowService }, { type: i1$2.HttpClient }, { type: CommandsCollectorMagicService }, { type: i2.ActivatedRoute }, { type: i2.Router }, { type: ExitMagicService, decorators: [{
|
4543
6019
|
type: Optional
|
4544
6020
|
}] }], { rootMagicElementRef: [{
|
@@ -4553,18 +6029,24 @@ class MagicShellComponent {
|
|
4553
6029
|
type: HostListener,
|
4554
6030
|
args: ['window:unload', ['$event']]
|
4555
6031
|
}] }); })();
|
4556
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src
|
6032
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MagicShellComponent, { className: "MagicShellComponent", filePath: "src/ui/magic-root.component.ts", lineNumber: 86 }); })();
|
4557
6033
|
|
6034
|
+
/**
|
6035
|
+
* @ignore
|
6036
|
+
*/
|
4558
6037
|
const CHECKBOX_VALUE_ACCESSOR = {
|
4559
6038
|
provide: NG_VALUE_ACCESSOR,
|
4560
6039
|
useExisting: forwardRef(() => MagicCheckboxControlValueAccessor),
|
4561
6040
|
multi: true,
|
4562
6041
|
};
|
6042
|
+
/**
|
6043
|
+
* Value accessor for Checkbox without a FormControl
|
6044
|
+
*/
|
4563
6045
|
class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
|
4564
|
-
static ɵfac = (() => { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(
|
4565
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MagicCheckboxControlValueAccessor, selectors: [["input", "type", "checkbox", "magic", "", 3, "formControlName", "", 3, "no-form-control", ""], ["input", "type", "checkbox", "magic", "", 3, "formControl", ""], ["input", "type", "checkbox", "magic", "", 3, "ngModel", ""]], hostBindings: function MagicCheckboxControlValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
6046
|
+
/** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicCheckboxControlValueAccessor_BaseFactory; return function MagicCheckboxControlValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicCheckboxControlValueAccessor_BaseFactory || (ɵMagicCheckboxControlValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicCheckboxControlValueAccessor)))(__ngFactoryType__ || MagicCheckboxControlValueAccessor); }; })();
|
6047
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicCheckboxControlValueAccessor, selectors: [["input", "type", "checkbox", "magic", "", 3, "formControlName", "", 3, "no-form-control", ""], ["input", "type", "checkbox", "magic", "", 3, "formControl", ""], ["input", "type", "checkbox", "magic", "", 3, "ngModel", ""]], hostBindings: function MagicCheckboxControlValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
4566
6048
|
i0.ɵɵlistener("change", function MagicCheckboxControlValueAccessor_change_HostBindingHandler($event) { return ctx.onChange($event.target.checked); })("blur", function MagicCheckboxControlValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
|
4567
|
-
} }, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
|
6049
|
+
} }, standalone: false, features: [i0.ɵɵProvidersFeature([CHECKBOX_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
|
4568
6050
|
}
|
4569
6051
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicCheckboxControlValueAccessor, [{
|
4570
6052
|
type: Directive,
|
@@ -4575,20 +6057,27 @@ class MagicCheckboxControlValueAccessor extends CheckboxControlValueAccessor {
|
|
4575
6057
|
input[type=checkbox][magic]:not([ngModel])
|
4576
6058
|
`,
|
4577
6059
|
host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
|
4578
|
-
providers: [CHECKBOX_VALUE_ACCESSOR]
|
6060
|
+
providers: [CHECKBOX_VALUE_ACCESSOR],
|
6061
|
+
standalone: false
|
4579
6062
|
}]
|
4580
6063
|
}], null, null); })();
|
4581
6064
|
|
6065
|
+
/**
|
6066
|
+
* @ignore
|
6067
|
+
*/
|
4582
6068
|
const MAGIC_DEFAULT_VALUE_ACCESSOR = {
|
4583
6069
|
provide: NG_VALUE_ACCESSOR,
|
4584
6070
|
useExisting: forwardRef(() => MagicDefaultValueAccessor),
|
4585
6071
|
multi: true
|
4586
6072
|
};
|
6073
|
+
/**
|
6074
|
+
* @ignore
|
6075
|
+
*/
|
4587
6076
|
class MagicDefaultValueAccessor extends DefaultValueAccessor {
|
4588
|
-
static ɵfac = (() => { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(
|
4589
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: MagicDefaultValueAccessor, selectors: [["input", "magic", "", 3, "type", "checkbox", 3, "formControlName", "", 3, "no-form-control", ""], ["textarea", "magic", "", 3, "formControlName", "", 3, "noFormControl", "", 3, "no-form-control", ""]], hostBindings: function MagicDefaultValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
6077
|
+
/** @nocollapse */ static ɵfac = /** @pureOrBreakMyCode */ (() => { let ɵMagicDefaultValueAccessor_BaseFactory; return function MagicDefaultValueAccessor_Factory(__ngFactoryType__) { return (ɵMagicDefaultValueAccessor_BaseFactory || (ɵMagicDefaultValueAccessor_BaseFactory = i0.ɵɵgetInheritedFactory(MagicDefaultValueAccessor)))(__ngFactoryType__ || MagicDefaultValueAccessor); }; })();
|
6078
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: MagicDefaultValueAccessor, selectors: [["input", "magic", "", 3, "type", "checkbox", 3, "formControlName", "", 3, "no-form-control", ""], ["textarea", "magic", "", 3, "formControlName", "", 3, "noFormControl", "", 3, "no-form-control", ""]], hostBindings: function MagicDefaultValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
4590
6079
|
i0.ɵɵlistener("input", function MagicDefaultValueAccessor_input_HostBindingHandler($event) { return ctx._handleInput($event.target.value); })("blur", function MagicDefaultValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); })("compositionstart", function MagicDefaultValueAccessor_compositionstart_HostBindingHandler() { return ctx._compositionStart(); })("compositionend", function MagicDefaultValueAccessor_compositionend_HostBindingHandler($event) { return ctx._compositionEnd($event.target.value); });
|
4591
|
-
} }, exportAs: ["magic"], features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
|
6080
|
+
} }, exportAs: ["magic"], standalone: false, features: [i0.ɵɵProvidersFeature([MAGIC_DEFAULT_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
|
4592
6081
|
}
|
4593
6082
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicDefaultValueAccessor, [{
|
4594
6083
|
type: Directive,
|
@@ -4604,22 +6093,29 @@ class MagicDefaultValueAccessor extends DefaultValueAccessor {
|
|
4604
6093
|
'(compositionend)': '$any(this)._compositionEnd($event.target.value)'
|
4605
6094
|
},
|
4606
6095
|
providers: [MAGIC_DEFAULT_VALUE_ACCESSOR],
|
4607
|
-
exportAs: 'magic'
|
6096
|
+
exportAs: 'magic',
|
6097
|
+
standalone: false
|
4608
6098
|
}]
|
4609
6099
|
}], null, null); })();
|
4610
6100
|
|
6101
|
+
/**
|
6102
|
+
* Directive for checkboxes which should not have a form control
|
6103
|
+
*/
|
4611
6104
|
class CheckboxNoFormControlMagicDirective {
|
4612
6105
|
magicDirective;
|
4613
6106
|
constructor(magicDirective) {
|
4614
6107
|
this.magicDirective = magicDirective;
|
4615
6108
|
}
|
6109
|
+
/**
|
6110
|
+
* Handle the 'Checkbox' change event - pass it to the Magic engine
|
6111
|
+
*/
|
4616
6112
|
onChange($event) {
|
4617
6113
|
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
4618
6114
|
}
|
4619
|
-
static ɵfac = function CheckboxNoFormControlMagicDirective_Factory(
|
4620
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
6115
|
+
/** @nocollapse */ static ɵfac = function CheckboxNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CheckboxNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
|
6116
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: CheckboxNoFormControlMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", "noFormControl", ""]], hostBindings: function CheckboxNoFormControlMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
4621
6117
|
i0.ɵɵlistener("change", function CheckboxNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
4622
|
-
} } });
|
6118
|
+
} }, standalone: false });
|
4623
6119
|
}
|
4624
6120
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxNoFormControlMagicDirective, [{
|
4625
6121
|
type: Directive,
|
@@ -4627,30 +6123,38 @@ class CheckboxNoFormControlMagicDirective {
|
|
4627
6123
|
selector: `
|
4628
6124
|
input[type=checkbox][magic]:([noFormControl])
|
4629
6125
|
`,
|
6126
|
+
standalone: false
|
4630
6127
|
}]
|
4631
6128
|
}], () => [{ type: MagicDirective }], { onChange: [{
|
4632
6129
|
type: HostListener,
|
4633
6130
|
args: ['change', ['$event']]
|
4634
6131
|
}] }); })();
|
4635
6132
|
|
6133
|
+
/**
|
6134
|
+
* Directive for non-checkbox input controls which do not have a form control
|
6135
|
+
*/
|
4636
6136
|
class InputNoFormControlMagicDirective {
|
4637
6137
|
magicDirective;
|
4638
6138
|
constructor(magicDirective) {
|
4639
6139
|
this.magicDirective = magicDirective;
|
4640
6140
|
}
|
6141
|
+
/**
|
6142
|
+
* Handles the 'change' event - pass it to the Magic engine
|
6143
|
+
*/
|
4641
6144
|
onChange($event) {
|
4642
6145
|
this.magicDirective.task.setInputTextValue(this.magicDirective.id, this.magicDirective.rowId, event.srcElement.value);
|
4643
6146
|
}
|
4644
|
-
static ɵfac = function InputNoFormControlMagicDirective_Factory(
|
4645
|
-
static ɵdir = i0.ɵɵ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) {
|
6147
|
+
/** @nocollapse */ static ɵfac = function InputNoFormControlMagicDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || InputNoFormControlMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
|
6148
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵ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) {
|
4646
6149
|
i0.ɵɵlistener("change", function InputNoFormControlMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
4647
|
-
} } });
|
6150
|
+
} }, standalone: false });
|
4648
6151
|
}
|
4649
6152
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputNoFormControlMagicDirective, [{
|
4650
6153
|
type: Directive,
|
4651
6154
|
args: [{
|
4652
6155
|
selector: `input[magic]:([noFormControl]):not([type=checkbox]),
|
4653
|
-
textarea[magic]:([noFormControl]):not([type=checkbox])
|
6156
|
+
textarea[magic]:([noFormControl]):not([type=checkbox])`,
|
6157
|
+
standalone: false
|
4654
6158
|
}]
|
4655
6159
|
}], () => [{ type: MagicDirective }], { onChange: [{
|
4656
6160
|
type: HostListener,
|
@@ -4662,6 +6166,14 @@ const DATE_VALUE_ACCESSOR = {
|
|
4662
6166
|
useExisting: forwardRef(() => DateValueAccessor),
|
4663
6167
|
multi: true
|
4664
6168
|
};
|
6169
|
+
/**
|
6170
|
+
* The accessor for writing a value and listening to changes on a date input element
|
6171
|
+
*
|
6172
|
+
* ### Example
|
6173
|
+
* `<input type="date" name="birthday" ngModel dateInput>`
|
6174
|
+
* OR
|
6175
|
+
* `<input type="date" formControlName="birthday" dateInput>`
|
6176
|
+
*/
|
4665
6177
|
class DateValueAccessor {
|
4666
6178
|
renderer;
|
4667
6179
|
elementRef;
|
@@ -4680,6 +6192,7 @@ class DateValueAccessor {
|
|
4680
6192
|
this.magicDir = magicDir;
|
4681
6193
|
this._task = _task;
|
4682
6194
|
}
|
6195
|
+
/** Format year, if user enters 2 digits instead of 4 digits as per the century given in Magic.ini file */
|
4683
6196
|
formatDateWithCentury(userInput, century, control) {
|
4684
6197
|
const separator = userInput.includes('/') ? '/' : "-";
|
4685
6198
|
let centuryVal = parseInt(century.toString().slice(0, 2));
|
@@ -4694,6 +6207,7 @@ class DateValueAccessor {
|
|
4694
6207
|
year;
|
4695
6208
|
control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
|
4696
6209
|
}
|
6210
|
+
/** Writes a new value to the element (model -> view) */
|
4697
6211
|
writeValue(value) {
|
4698
6212
|
if (!value) {
|
4699
6213
|
this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
|
@@ -4701,27 +6215,31 @@ class DateValueAccessor {
|
|
4701
6215
|
}
|
4702
6216
|
this.renderer.setProperty(this.elementRef.nativeElement, "valueAsDate", new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate())));
|
4703
6217
|
}
|
6218
|
+
/** Registers a callback function, called when value changes (view -> model) */
|
4704
6219
|
registerOnChange(fn) {
|
4705
6220
|
this.onChange = v => fn(v instanceof Date
|
4706
6221
|
? new Date(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate())
|
4707
6222
|
: v);
|
4708
6223
|
}
|
6224
|
+
/** Registers a callback function, called when the control is blurred */
|
4709
6225
|
registerOnTouched(fn) {
|
4710
6226
|
this.onTouched = fn;
|
4711
6227
|
}
|
6228
|
+
/** Enables or disables the element when the control status changes */
|
4712
6229
|
setDisabledState(isDisabled) {
|
4713
6230
|
this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
|
4714
6231
|
}
|
4715
|
-
static ɵfac = function DateValueAccessor_Factory(
|
4716
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
6232
|
+
/** @nocollapse */ static ɵfac = function DateValueAccessor_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
6233
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
4717
6234
|
i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
|
4718
|
-
} }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
|
6235
|
+
} }, standalone: false, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
|
4719
6236
|
}
|
4720
6237
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateValueAccessor, [{
|
4721
6238
|
type: Directive,
|
4722
6239
|
args: [{
|
4723
6240
|
selector: "[dateInput]",
|
4724
|
-
providers: [DATE_VALUE_ACCESSOR]
|
6241
|
+
providers: [DATE_VALUE_ACCESSOR],
|
6242
|
+
standalone: false
|
4725
6243
|
}]
|
4726
6244
|
}], () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: MagicDirective }, { type: TaskMagicService }], { onChange: [{
|
4727
6245
|
type: HostListener,
|
@@ -4734,6 +6252,9 @@ class DateValueAccessor {
|
|
4734
6252
|
args: ['blur', ['$event']]
|
4735
6253
|
}] }); })();
|
4736
6254
|
|
6255
|
+
/**
|
6256
|
+
* 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
|
6257
|
+
*/
|
4737
6258
|
class NonMagicControlDirective {
|
4738
6259
|
_task;
|
4739
6260
|
element;
|
@@ -4744,13 +6265,38 @@ class NonMagicControlDirective {
|
|
4744
6265
|
this.selector = 'NonMagicControl';
|
4745
6266
|
}
|
4746
6267
|
;
|
6268
|
+
/**
|
6269
|
+
* The HTML element connected to this directive
|
6270
|
+
*/
|
4747
6271
|
htmlElement;
|
6272
|
+
/**
|
6273
|
+
* Magic's component handling this control
|
6274
|
+
*/
|
4748
6275
|
component;
|
6276
|
+
/**
|
6277
|
+
* Collection of event handlers for this element
|
6278
|
+
*/
|
4749
6279
|
eventHandlers = {};
|
6280
|
+
/**
|
6281
|
+
* Id of this element
|
6282
|
+
*/
|
4750
6283
|
id;
|
6284
|
+
/**
|
6285
|
+
* @ignore
|
6286
|
+
*/
|
4751
6287
|
selector;
|
6288
|
+
/**
|
6289
|
+
* @ignore
|
6290
|
+
*/
|
4752
6291
|
subscribeRefreshDom;
|
4753
6292
|
eventsOnlyVal = false;
|
6293
|
+
/**
|
6294
|
+
*
|
6295
|
+
* @param _task The task service
|
6296
|
+
* @param element The element for which the directive is applied
|
6297
|
+
* @param renderer Renderer for the element
|
6298
|
+
* @param vcRef
|
6299
|
+
*/
|
4754
6300
|
constructor(_task, element, renderer, vcRef) {
|
4755
6301
|
this._task = _task;
|
4756
6302
|
this.element = element;
|
@@ -4758,29 +6304,44 @@ class NonMagicControlDirective {
|
|
4758
6304
|
this.vcRef = vcRef;
|
4759
6305
|
this.htmlElement = this.element.nativeElement;
|
4760
6306
|
}
|
6307
|
+
/**
|
6308
|
+
* Get the task service
|
6309
|
+
* @returns
|
6310
|
+
*/
|
4761
6311
|
get task() {
|
4762
6312
|
return this._task;
|
4763
6313
|
}
|
6314
|
+
/**
|
6315
|
+
* Register to the events this element may need to handle
|
6316
|
+
*/
|
4764
6317
|
regEvents() {
|
6318
|
+
// Handle events for which event handler may be removed and restored
|
4765
6319
|
this.eventHandlers['focusin'] = this.OnFocus.bind(this);
|
4766
6320
|
Object.keys(this.eventHandlers).forEach((key) => {
|
4767
6321
|
this.renderer.listen(this.htmlElement, key, this.eventHandlers[key]);
|
4768
6322
|
});
|
4769
6323
|
}
|
6324
|
+
/**
|
6325
|
+
* Handle focus event
|
6326
|
+
*/
|
4770
6327
|
OnFocus() {
|
4771
6328
|
this.task.insertEvent(getGuiEventObj('focusOnNonMagicControl', '', -1));
|
4772
6329
|
event.cancelBubble = true;
|
4773
6330
|
}
|
6331
|
+
/**
|
6332
|
+
* Initialize this object
|
6333
|
+
*/
|
4774
6334
|
ngOnInit() {
|
4775
6335
|
this.regEvents();
|
4776
6336
|
}
|
4777
|
-
static ɵfac = function NonMagicControlDirective_Factory(
|
4778
|
-
static ɵdir = i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: [
|
6337
|
+
/** @nocollapse */ static ɵfac = function NonMagicControlDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || NonMagicControlDirective)(i0.ɵɵdirectiveInject(TaskMagicService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
|
6338
|
+
/** @nocollapse */ static ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: NonMagicControlDirective, selectors: [["", "NonMagicControl", ""]], inputs: { magic: [0, "NonMagicControl", "magic"] }, standalone: false });
|
4779
6339
|
}
|
4780
6340
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NonMagicControlDirective, [{
|
4781
6341
|
type: Directive,
|
4782
6342
|
args: [{
|
4783
|
-
selector: '[NonMagicControl]'
|
6343
|
+
selector: '[NonMagicControl]',
|
6344
|
+
standalone: false
|
4784
6345
|
}]
|
4785
6346
|
}], () => [{ type: TaskMagicService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }], { magic: [{
|
4786
6347
|
type: Input,
|
@@ -4808,16 +6369,20 @@ class Time24MagicPipe {
|
|
4808
6369
|
}
|
4809
6370
|
return value;
|
4810
6371
|
}
|
4811
|
-
static ɵfac = function Time24MagicPipe_Factory(
|
4812
|
-
static ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true });
|
6372
|
+
/** @nocollapse */ static ɵfac = function Time24MagicPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
|
6373
|
+
/** @nocollapse */ static ɵpipe = /** @pureOrBreakMyCode */ i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true, standalone: false });
|
4813
6374
|
}
|
4814
6375
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Time24MagicPipe, [{
|
4815
6376
|
type: Pipe,
|
4816
6377
|
args: [{
|
4817
|
-
name: 'magicTime24'
|
6378
|
+
name: 'magicTime24',
|
6379
|
+
standalone: false
|
4818
6380
|
}]
|
4819
6381
|
}], () => [{ type: TaskMagicService }], null); })();
|
4820
6382
|
|
6383
|
+
/**
|
6384
|
+
* @ignore
|
6385
|
+
*/
|
4821
6386
|
const decs = [
|
4822
6387
|
MagicDirective,
|
4823
6388
|
CheckboxMagicDirective,
|
@@ -4849,30 +6414,29 @@ const decs = [
|
|
4849
6414
|
MagicViewContainerRef,
|
4850
6415
|
Time24MagicPipe
|
4851
6416
|
];
|
6417
|
+
/**
|
6418
|
+
* @ignore
|
6419
|
+
*/
|
4852
6420
|
class MagicModule {
|
4853
|
-
static ɵfac = function MagicModule_Factory(
|
4854
|
-
static ɵmod = i0.ɵɵdefineNgModule({ type: MagicModule });
|
4855
|
-
static ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [CommonModule,
|
6421
|
+
/** @nocollapse */ static ɵfac = function MagicModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MagicModule)(); };
|
6422
|
+
/** @nocollapse */ static ɵmod = /** @pureOrBreakMyCode */ i0.ɵɵdefineNgModule({ type: MagicModule });
|
6423
|
+
/** @nocollapse */ static ɵinj = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())], imports: [CommonModule,
|
4856
6424
|
FormsModule,
|
4857
6425
|
ReactiveFormsModule,
|
4858
6426
|
RouterModule,
|
4859
|
-
DynamicModule,
|
4860
|
-
HttpClientModule, MaskitoModule] });
|
6427
|
+
DynamicModule, MaskitoModule] });
|
4861
6428
|
}
|
4862
6429
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicModule, [{
|
4863
6430
|
type: NgModule,
|
4864
6431
|
args: [{
|
4865
6432
|
declarations: [...decs],
|
4866
6433
|
exports: [...decs, MaskitoModule],
|
4867
|
-
imports: [
|
4868
|
-
CommonModule,
|
6434
|
+
imports: [CommonModule,
|
4869
6435
|
FormsModule,
|
4870
6436
|
ReactiveFormsModule,
|
4871
6437
|
RouterModule,
|
4872
|
-
DynamicModule,
|
4873
|
-
|
4874
|
-
],
|
4875
|
-
providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider]
|
6438
|
+
DynamicModule],
|
6439
|
+
providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider, provideHttpClient(withInterceptorsFromDi())]
|
4876
6440
|
}]
|
4877
6441
|
}], null, null); })();
|
4878
6442
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MagicModule, { declarations: [MagicDirective,
|
@@ -4907,8 +6471,7 @@ class MagicModule {
|
|
4907
6471
|
FormsModule,
|
4908
6472
|
ReactiveFormsModule,
|
4909
6473
|
RouterModule,
|
4910
|
-
DynamicModule,
|
4911
|
-
HttpClientModule], exports: [MagicDirective,
|
6474
|
+
DynamicModule], exports: [MagicDirective,
|
4912
6475
|
CheckboxMagicDirective,
|
4913
6476
|
CheckboxNoFormControlMagicDirective,
|
4914
6477
|
InputNoFormControlMagicDirective,
|
@@ -5023,15 +6586,15 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
5023
6586
|
this.mgdtfmt = this.task.mgInputDateFormat;
|
5024
6587
|
if (displayFormat === 'input') {
|
5025
6588
|
if (this.mgdtfmt == null)
|
5026
|
-
this.mgdtfmt = 'M/d/yyyy';
|
6589
|
+
this.mgdtfmt = 'M/d/yyyy'; //default format
|
5027
6590
|
return formatDate(date, this.mgdtfmt, this.locale);
|
5028
6591
|
}
|
5029
6592
|
else {
|
5030
6593
|
return date.toDateString();
|
5031
6594
|
}
|
5032
6595
|
}
|
5033
|
-
static ɵfac = function MgDateAdapter_Factory(
|
5034
|
-
static ɵprov = i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
|
6596
|
+
/** @nocollapse */ static ɵfac = function MgDateAdapter_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MgDateAdapter)(i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
|
6597
|
+
/** @nocollapse */ static ɵprov = /** @pureOrBreakMyCode */ i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
|
5035
6598
|
}
|
5036
6599
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgDateAdapter, [{
|
5037
6600
|
type: Injectable
|
@@ -5044,6 +6607,9 @@ const matDateProviders = [
|
|
5044
6607
|
{ provide: DateAdapter, useClass: MgDateAdapter },
|
5045
6608
|
{ provide: MAT_DATE_FORMATS, useValue: MG_FORMATS }
|
5046
6609
|
];
|
6610
|
+
/**
|
6611
|
+
* Magic service providers
|
6612
|
+
*/
|
5047
6613
|
const basicMagicProviders = [
|
5048
6614
|
MagicServices,
|
5049
6615
|
TaskMagicService,
|
@@ -5057,7 +6623,16 @@ const magicProviders = [
|
|
5057
6623
|
TableMagicService
|
5058
6624
|
];
|
5059
6625
|
|
6626
|
+
/**
|
6627
|
+
* @ignore
|
6628
|
+
*/
|
6629
|
+
///////////////////////////////////////////////////////////
|
6630
|
+
// class to hold gui-related helper methods
|
6631
|
+
///////////////////////////////////////////////////////////
|
5060
6632
|
class utils {
|
6633
|
+
///////////////////////////////////////////////////////////
|
6634
|
+
// Calculate the distance between the control and the supplied x,y coordinates
|
6635
|
+
///////////////////////////////////////////////////////////
|
5061
6636
|
static getDistance(control, x, y) {
|
5062
6637
|
let left = control.clientLeft, top = control.clientTop;
|
5063
6638
|
let dx, dy;
|
@@ -5084,6 +6659,9 @@ class utils {
|
|
5084
6659
|
const ret = (dx * dx + dy * dy);
|
5085
6660
|
return ret;
|
5086
6661
|
}
|
6662
|
+
///////////////////////////////////////////////////////////
|
6663
|
+
//
|
6664
|
+
///////////////////////////////////////////////////////////
|
5087
6665
|
static getDimentions(el) {
|
5088
6666
|
let xPos = 0;
|
5089
6667
|
let yPos = 0;
|
@@ -5091,12 +6669,14 @@ class utils {
|
|
5091
6669
|
let height = el.height;
|
5092
6670
|
while (el) {
|
5093
6671
|
if (el.tagName == "BODY") {
|
6672
|
+
// deal with browser quirks with body/window/document and page scroll
|
5094
6673
|
let xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
5095
6674
|
let yScroll = el.scrollTop || document.documentElement.scrollTop;
|
5096
6675
|
xPos += (el.offsetLeft - xScroll + el.clientLeft);
|
5097
6676
|
yPos += (el.offsetTop - yScroll + el.clientTop);
|
5098
6677
|
}
|
5099
6678
|
else {
|
6679
|
+
// for all other non-BODY elements
|
5100
6680
|
xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
|
5101
6681
|
yPos += (el.offsetTop - el.scrollTop + el.clientTop);
|
5102
6682
|
}
|
@@ -5111,11 +6691,22 @@ class utils {
|
|
5111
6691
|
}
|
5112
6692
|
}
|
5113
6693
|
|
6694
|
+
/**
|
6695
|
+
* @ignore
|
6696
|
+
*/
|
5114
6697
|
class ModalFormDefinition {
|
5115
6698
|
taskId = "";
|
5116
6699
|
comp = null;
|
5117
6700
|
parameters = {};
|
5118
6701
|
}
|
5119
6702
|
|
6703
|
+
/**
|
6704
|
+
* @file Automatically generated by barrelsby.
|
6705
|
+
*/
|
6706
|
+
|
6707
|
+
/**
|
6708
|
+
* Generated bundle index. Do not edit.
|
6709
|
+
*/
|
6710
|
+
|
5120
6711
|
export { AccessorMagicService, BaseMagicAlertComponent, BaseMagicConfirmComponent, BaseMagicOverlayContainer, CHECKBOX_VALUE_ACCESSOR, COLOR_FILE_NAME, CheckboxMagicDirective, CheckboxNoFormControlMagicDirective, ComboboxMagicDirective, CommandsCollectorMagicService, ComponentListMagicService, ConfirmationComponentsMagicProvider, Constants, ControlMetadata, ControlsMetadata, DATE_VALUE_ACCESSOR, DateMagicPipe, DateValueAccessor, EngineMagicService, ErrorMagicComponent, ExitMagicService, GuiInteractiveExecutor, HtmlClasses, InputNoFormControlMagicDirective, MAGIC_BG_COLOR, MAGIC_DEFAULT_VALUE_ACCESSOR, MAGIC_FG_COLOR, MG_FORMATS, MagicAlertComponent, MagicCheckboxControlValueAccessor, MagicColorService, MagicConfirmationBoxComponent, MagicDefaultValueAccessor, MagicDirective, MagicFocusDirective, MagicLazyLoaderService, MagicModule, MagicOverlayContainer, MagicOverlayContainerWrapper, MagicServices, MagicShellComponent, MagicViewContainerRef, MgDateAdapter, MgDateFormatter, MgformatMagicDirective, ModalFormDefinition, NoControlMagicDirective, NonMagicControlDirective, OverlayContainerMagicProvider, OverlayWindowService, RangeValidatorMagicDirective, Records, RouteCommand, RouterCommandsMagicService, RouterContainerMagicComponent, RowMagicDirective, StylesMapManager, SubformMagicComponent, SubformMagicService, TableMagicService, TaskBaseMagicComponent, TaskMagicService, Time24MagicPipe, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
|
5121
6712
|
//# sourceMappingURL=magic-xpa-angular.mjs.map
|