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