@magic-xpa/angular 4.801.7 → 4.900.0-dev4100.11
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/esm2020/src/services/accessor.magic.service.mjs +29 -6
- package/esm2020/src/services/mg-date-adapter.mjs +13 -8
- package/esm2020/src/services/task.magics.service.mjs +2 -2
- package/esm2020/src/ui/directives/magic.directive.mjs +9 -9
- package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +36 -17
- package/esm2020/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +1 -1
- package/esm2020/src/ui/magic-modal/magic-overlay-container.mjs +2 -2
- package/esm2020/src/ui/magic-root.component.mjs +1 -1
- package/fesm2015/magic-xpa-angular.mjs +86 -38
- package/fesm2015/magic-xpa-angular.mjs.map +1 -1
- package/fesm2020/magic-xpa-angular.mjs +84 -38
- package/fesm2020/magic-xpa-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/src/services/accessor.magic.service.d.ts +1 -0
- package/src/services/mg-date-adapter.d.ts +2 -1
- package/src/ui/directives/mgformat.magic.directive.d.ts +2 -0
@@ -10,14 +10,14 @@ import * as i3 from 'ng-dynamic-component';
|
|
10
10
|
import { DynamicModule } from 'ng-dynamic-component';
|
11
11
|
import { InteractiveCommandType, OverlayType, Styles, HtmlProperties, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
|
12
12
|
import { MagicBridge, getGuiEventObj, CookieService } from '@magic-xpa/engine';
|
13
|
-
import { MagicProperties, Logger, StrUtil, StorageAttribute, BindingLevel, StorageAttributeType, MgControlType
|
13
|
+
import { MagicProperties, Logger, StrUtil, StorageAttribute, PICInterface, BindingLevel, StorageAttributeType, MgControlType } from '@magic-xpa/utils';
|
14
14
|
import { filter, map, debounceTime } from 'rxjs/operators';
|
15
15
|
import { Subject, 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
19
|
import { HttpClientModule } from '@angular/common/http';
|
20
|
-
import { NativeDateAdapter, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
20
|
+
import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
21
21
|
import * as i1$3 from '@angular/cdk/platform';
|
22
22
|
|
23
23
|
class ControlMetadata {
|
@@ -934,7 +934,7 @@ MagicOverlayContainer.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContain
|
|
934
934
|
i0.ɵɵproperty("ngIf", ctx.getShowTitleBar());
|
935
935
|
i0.ɵɵadvance(1);
|
936
936
|
i0.ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
|
937
|
-
} }, directives: [i1.NgIf, i1.NgStyle, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{position:fixed;
|
937
|
+
} }, directives: [i1.NgIf, i1.NgStyle, MagicViewContainerRef], styles: [".modal-foreground[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#fff}.modal-background[_ngcontent-%COMP%]{position:fixed;inset:0;background-color:#000;opacity:.75}.modal-header[_ngcontent-%COMP%]{background-color:beige;border-bottom:2px solid red}"] });
|
938
938
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainer, [{
|
939
939
|
type: Component,
|
940
940
|
args: [{ selector: 'app-magic-overlay-container', template: `
|
@@ -953,7 +953,7 @@ MagicOverlayContainer.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContain
|
|
953
953
|
</div>
|
954
954
|
</div>
|
955
955
|
</div>
|
956
|
-
`, styles: [".modal-foreground{position:fixed;
|
956
|
+
`, 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"] }]
|
957
957
|
}], function () { return [{ type: i0.ComponentFactoryResolver }]; }, { headerElementRef: [{
|
958
958
|
type: ViewChild,
|
959
959
|
args: ['modalheader', { static: false }]
|
@@ -1128,7 +1128,7 @@ MagicOverlayContainerWrapper.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlay
|
|
1128
1128
|
i0.ɵɵelementEnd();
|
1129
1129
|
i0.ɵɵelement(6, "div", 5);
|
1130
1130
|
i0.ɵɵelementEnd();
|
1131
|
-
} }, directives: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%]{position:fixed;
|
1131
|
+
} }, directives: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%]{position:fixed;z-index:999;inset:0}"] });
|
1132
1132
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainerWrapper, [{
|
1133
1133
|
type: Component,
|
1134
1134
|
args: [{
|
@@ -1961,7 +1961,7 @@ class TaskMagicService {
|
|
1961
1961
|
return val;
|
1962
1962
|
}
|
1963
1963
|
case StorageAttribute.NUMERIC:
|
1964
|
-
return val;
|
1964
|
+
return +val;
|
1965
1965
|
default:
|
1966
1966
|
return val;
|
1967
1967
|
}
|
@@ -2339,9 +2339,9 @@ class AccessorMagicService {
|
|
2339
2339
|
let properties;
|
2340
2340
|
properties = this.task.Records.list[0].getControlMetadata(controlId);
|
2341
2341
|
if (properties.properties.get(HtmlProperties.ReadOnly) !== null && properties.properties.get(HtmlProperties.ReadOnly) === true)
|
2342
|
-
return false;
|
2343
|
-
else
|
2344
2342
|
return true;
|
2343
|
+
else
|
2344
|
+
return false;
|
2345
2345
|
}
|
2346
2346
|
getText(controlId, rowId) {
|
2347
2347
|
return this.task.getProperty(controlId, HtmlProperties.Text, rowId);
|
@@ -2371,6 +2371,29 @@ class AccessorMagicService {
|
|
2371
2371
|
let vis = this.getProperty(controlId, HtmlProperties.Visible, rowId);
|
2372
2372
|
return vis ? 'visible' : 'hidden';
|
2373
2373
|
}
|
2374
|
+
getAlphaMask(controlId, rowId) {
|
2375
|
+
if (isNullOrUndefined(controlId))
|
2376
|
+
return null;
|
2377
|
+
let pic = this.task.GetControlPictureMask(controlId);
|
2378
|
+
let mask = pic.getMask();
|
2379
|
+
let valueStr = new StringBuilder();
|
2380
|
+
for (let i = 0; i < mask.length; i++) {
|
2381
|
+
switch (mask.charCodeAt(i)) {
|
2382
|
+
case PICInterface.PIC_N:
|
2383
|
+
valueStr.Append("0");
|
2384
|
+
break;
|
2385
|
+
case PICInterface.PIC_U:
|
2386
|
+
case PICInterface.PIC_L:
|
2387
|
+
case PICInterface.PIC_X:
|
2388
|
+
valueStr.Append("A");
|
2389
|
+
break;
|
2390
|
+
default:
|
2391
|
+
valueStr.Append(mask.charAt(i));
|
2392
|
+
break;
|
2393
|
+
}
|
2394
|
+
}
|
2395
|
+
return (pic != null) ? valueStr.toString() : null;
|
2396
|
+
}
|
2374
2397
|
getNumericPicture(picture) {
|
2375
2398
|
var obj = {};
|
2376
2399
|
if (isNullOrUndefined(picture))
|
@@ -2552,7 +2575,7 @@ class AccessorMagicService {
|
|
2552
2575
|
if (c.hasError('maxlength'))
|
2553
2576
|
return 'Max length allowed is : ' + c.errors.maxlength.requiredLength;
|
2554
2577
|
if (c.hasError('max'))
|
2555
|
-
return 'Max value
|
2578
|
+
return 'Max value allowed is : ' + c.errors.max.max;
|
2556
2579
|
let controlMetadata = this.task.Records.list[rowId].getControlMetadata(id);
|
2557
2580
|
for (let key of controlMetadata.customValidators.keys()) {
|
2558
2581
|
if (c.hasError(key)) {
|
@@ -2929,15 +2952,15 @@ class MagicDirective {
|
|
2929
2952
|
}
|
2930
2953
|
handleSetProperty(command) {
|
2931
2954
|
switch (command.Operation) {
|
2932
|
-
case HtmlProperties.ReadOnly:
|
2933
|
-
|
2934
|
-
if (command.
|
2935
|
-
|
2936
|
-
|
2937
|
-
|
2955
|
+
case HtmlProperties.ReadOnly:
|
2956
|
+
{
|
2957
|
+
if (command.obj.Type == MgControlType.CTRL_TYPE_TEXT)
|
2958
|
+
if (command.obj1 != true)
|
2959
|
+
this.renderer.removeAttribute(this.htmlElement, command.Operation);
|
2960
|
+
else
|
2961
|
+
this.renderer.setAttribute(this.htmlElement, command.Operation, command.str);
|
2938
2962
|
}
|
2939
2963
|
break;
|
2940
|
-
}
|
2941
2964
|
}
|
2942
2965
|
}
|
2943
2966
|
ngOnDestroy() {
|
@@ -3258,6 +3281,25 @@ class MgformatMagicDirective {
|
|
3258
3281
|
}
|
3259
3282
|
}
|
3260
3283
|
onFocusEvent($event) {
|
3284
|
+
this.calculatePattern();
|
3285
|
+
}
|
3286
|
+
onInputEvent($event) {
|
3287
|
+
this.calculatePattern();
|
3288
|
+
}
|
3289
|
+
onChangeEvent($event) {
|
3290
|
+
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3291
|
+
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
3292
|
+
switch (attr) {
|
3293
|
+
case StorageAttribute.ALPHA:
|
3294
|
+
case StorageAttribute.UNICODE:
|
3295
|
+
this.formatAlphaUnicode(control);
|
3296
|
+
break;
|
3297
|
+
case StorageAttribute.BOOLEAN:
|
3298
|
+
this.formatBoolean(control);
|
3299
|
+
break;
|
3300
|
+
}
|
3301
|
+
}
|
3302
|
+
calculatePattern() {
|
3261
3303
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3262
3304
|
if (control != null) {
|
3263
3305
|
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
@@ -3274,26 +3316,22 @@ class MgformatMagicDirective {
|
|
3274
3316
|
if (attr == StorageAttribute.ALPHA || attr == StorageAttribute.UNICODE) {
|
3275
3317
|
if (control.validator == null)
|
3276
3318
|
control.setValidators(Validators.maxLength(pic.getMaskLength()));
|
3277
|
-
else
|
3278
|
-
|
3319
|
+
else {
|
3320
|
+
if (pic.isFormatExp()) {
|
3321
|
+
control.setValidators(Validators.maxLength(pic.getMaskLength()));
|
3322
|
+
if (isUndefined(this.magicDir.rowId))
|
3323
|
+
this.magicDir.rowId = '0';
|
3324
|
+
control.setValidators([control.validator, this._task.customValidator(this.magicDir.rowId, this.magicDir.id)]);
|
3325
|
+
}
|
3326
|
+
else
|
3327
|
+
control.setValidators([control.validator, Validators.maxLength(pic.getMaskLength())]);
|
3328
|
+
}
|
3329
|
+
control.updateValueAndValidity();
|
3279
3330
|
}
|
3280
3331
|
}
|
3281
3332
|
}
|
3282
3333
|
}
|
3283
3334
|
}
|
3284
|
-
onChangeEvent($event) {
|
3285
|
-
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3286
|
-
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
3287
|
-
switch (attr) {
|
3288
|
-
case StorageAttribute.ALPHA:
|
3289
|
-
case StorageAttribute.UNICODE:
|
3290
|
-
this.formatAlphaUnicode(control);
|
3291
|
-
break;
|
3292
|
-
case StorageAttribute.BOOLEAN:
|
3293
|
-
this.formatBoolean(control);
|
3294
|
-
break;
|
3295
|
-
}
|
3296
|
-
}
|
3297
3335
|
formatDate(pic) {
|
3298
3336
|
let mgDateFormatter = new MgDateFormatter();
|
3299
3337
|
this._task.mgInputDateFormat = mgDateFormatter.ConvertMgDateFormatToAngular(pic.getMask());
|
@@ -3442,7 +3480,7 @@ class MgformatMagicDirective {
|
|
3442
3480
|
}
|
3443
3481
|
MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
3444
3482
|
MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
3445
|
-
i0.ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
|
3483
|
+
i0.ɵɵlistener("focus", function MgformatMagicDirective_focus_HostBindingHandler($event) { return ctx.onFocusEvent($event); })("input", function MgformatMagicDirective_input_HostBindingHandler($event) { return ctx.onInputEvent($event); })("change", function MgformatMagicDirective_change_HostBindingHandler($event) { return ctx.onChangeEvent($event); });
|
3446
3484
|
} } });
|
3447
3485
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
|
3448
3486
|
type: Directive,
|
@@ -3452,6 +3490,9 @@ MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirec
|
|
3452
3490
|
}], function () { return [{ type: MagicDirective }, { type: TaskMagicService }]; }, { onFocusEvent: [{
|
3453
3491
|
type: HostListener,
|
3454
3492
|
args: ['focus', ['$event']]
|
3493
|
+
}], onInputEvent: [{
|
3494
|
+
type: HostListener,
|
3495
|
+
args: ['input', ['$event']]
|
3455
3496
|
}], onChangeEvent: [{
|
3456
3497
|
type: HostListener,
|
3457
3498
|
args: ['change', ['$event']]
|
@@ -3910,7 +3951,7 @@ MagicShellComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent,
|
|
3910
3951
|
i0.ɵɵproperty("ngIf", ctx.RootComponent !== null);
|
3911
3952
|
i0.ɵɵadvance(3);
|
3912
3953
|
i0.ɵɵproperty("ngIf", ctx.showSpinner);
|
3913
|
-
} }, directives: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective, MagicViewContainerRef, i1.NgTemplateOutlet], styles: [".mgSpinnerClass[_ngcontent-%COMP%]{border:10px solid #cccccc;border-top:10px solid black;border-radius:50%;position:fixed;margin:auto;
|
3954
|
+
} }, directives: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective, MagicViewContainerRef, i1.NgTemplateOutlet], styles: [".mgSpinnerClass[_ngcontent-%COMP%]{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[_ngcontent-%COMP%]{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"] });
|
3914
3955
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
|
3915
3956
|
type: Component,
|
3916
3957
|
args: [{
|
@@ -4305,11 +4346,13 @@ const MG_FORMATS = {
|
|
4305
4346
|
}
|
4306
4347
|
};
|
4307
4348
|
class MgDateAdapter extends NativeDateAdapter {
|
4308
|
-
constructor(platform, task) {
|
4309
|
-
super(
|
4349
|
+
constructor(platform, task, localeId) {
|
4350
|
+
super(localeId, platform);
|
4310
4351
|
this.platform = platform;
|
4311
4352
|
this.task = task;
|
4353
|
+
this.localeId = localeId;
|
4312
4354
|
this.mgdtfmt = null;
|
4355
|
+
this.setLocale(localeId);
|
4313
4356
|
}
|
4314
4357
|
parse(value) {
|
4315
4358
|
let valueStr = value;
|
@@ -4369,7 +4412,7 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
4369
4412
|
}
|
4370
4413
|
if (month == 0 && year == 0 && date == 0)
|
4371
4414
|
return null;
|
4372
|
-
return new Date(
|
4415
|
+
return new Date(year, month, date);
|
4373
4416
|
}
|
4374
4417
|
}
|
4375
4418
|
format(date, displayFormat) {
|
@@ -4385,11 +4428,14 @@ class MgDateAdapter extends NativeDateAdapter {
|
|
4385
4428
|
}
|
4386
4429
|
}
|
4387
4430
|
}
|
4388
|
-
MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(i0.ɵɵinject(i1$3.Platform), i0.ɵɵinject(TaskMagicService)); };
|
4431
|
+
MgDateAdapter.ɵfac = function MgDateAdapter_Factory(t) { return new (t || MgDateAdapter)(i0.ɵɵinject(i1$3.Platform), i0.ɵɵinject(TaskMagicService), i0.ɵɵinject(MAT_DATE_LOCALE)); };
|
4389
4432
|
MgDateAdapter.ɵprov = i0.ɵɵdefineInjectable({ token: MgDateAdapter, factory: MgDateAdapter.ɵfac });
|
4390
4433
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgDateAdapter, [{
|
4391
4434
|
type: Injectable
|
4392
|
-
}], function () { return [{ type: i1$3.Platform }, { type: TaskMagicService }
|
4435
|
+
}], function () { return [{ type: i1$3.Platform }, { type: TaskMagicService }, { type: undefined, decorators: [{
|
4436
|
+
type: Inject,
|
4437
|
+
args: [MAT_DATE_LOCALE]
|
4438
|
+
}] }]; }, null); })();
|
4393
4439
|
|
4394
4440
|
const matDateProviders = [
|
4395
4441
|
{ provide: DateAdapter, useClass: MgDateAdapter },
|