@magic-xpa/angular 4.1000.0-dev4100.43 → 4.1000.0-dev4100.431

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.
Files changed (68) hide show
  1. package/esm2020/index.mjs +2 -1
  2. package/esm2020/src/magic.core.module.mjs +16 -13
  3. package/esm2020/src/services/accessor.magic.service.mjs +28 -3
  4. package/esm2020/src/services/magic-color.service.mjs +4 -4
  5. package/esm2020/src/services/subform.magic.service.mjs +1 -1
  6. package/esm2020/src/services/table.magic.service.mjs +5 -2
  7. package/esm2020/src/services/task.magics.service.mjs +29 -5
  8. package/esm2020/src/ui/GuiInteractiveExecutor.mjs +7 -2
  9. package/esm2020/src/ui/components/base-magic-alert.component.mjs +3 -7
  10. package/esm2020/src/ui/components/base-magic-confirm.component.mjs +3 -7
  11. package/esm2020/src/ui/components/magic-alert.component.mjs +3 -35
  12. package/esm2020/src/ui/components/magic-confirmation-box.component.mjs +3 -39
  13. package/esm2020/src/ui/directives/NonMagicControlDirective.mjs +6 -6
  14. package/esm2020/src/ui/directives/magic/checkbox.magic.directive.mjs +76 -7
  15. package/esm2020/src/ui/directives/magic/combobox.magic.directive.mjs +11 -1
  16. package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +34 -5
  17. package/esm2020/src/ui/directives/magic/nocontrol.magic.directive.mjs +3 -3
  18. package/esm2020/src/ui/directives/magic.directive.mjs +11 -11
  19. package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +336 -3
  20. package/esm2020/src/ui/magic-modal/base-magic-overlay-container.mjs +1 -1
  21. package/esm2020/src/ui/magic-modal/magic-overlay-container-wrapper.mjs +4 -18
  22. package/esm2020/src/ui/magic-modal/magic-overlay-container.mjs +4 -4
  23. package/esm2020/src/ui/magic-root.component.mjs +4 -38
  24. package/esm2020/src/ui/mgerror.magic.component.mjs +9 -9
  25. package/esm2020/src/ui/pipes/time24.magic.pipe.mjs +34 -0
  26. package/esm2020/src/ui/router-container.magic.component.mjs +4 -4
  27. package/esm2020/src/ui/subform.magic.component.mjs +4 -4
  28. package/esm2020/src/ui/task-base.magic.component.mjs +8 -2
  29. package/fesm2015/magic-xpa-angular.mjs +609 -209
  30. package/fesm2015/magic-xpa-angular.mjs.map +1 -1
  31. package/fesm2020/magic-xpa-angular.mjs +607 -209
  32. package/fesm2020/magic-xpa-angular.mjs.map +1 -1
  33. package/index.d.ts +1 -0
  34. package/package.json +11 -8
  35. package/src/magic.core.module.d.ts +8 -6
  36. package/src/services/accessor.magic.service.d.ts +3 -0
  37. package/src/services/table.magic.service.d.ts +2 -0
  38. package/src/services/task.magics.service.d.ts +1 -0
  39. package/src/ui/components/base-magic-alert.component.d.ts +1 -1
  40. package/src/ui/components/base-magic-confirm.component.d.ts +1 -1
  41. package/src/ui/components/magic-alert.component.d.ts +1 -1
  42. package/src/ui/components/magic-confirmation-box.component.d.ts +1 -1
  43. package/src/ui/directives/NonMagicControlDirective.d.ts +1 -1
  44. package/src/ui/directives/magic/checkbox-noformcontrol.magic.directive.d.ts +1 -1
  45. package/src/ui/directives/magic/checkbox.magic.directive.d.ts +15 -2
  46. package/src/ui/directives/magic/combobox.magic.directive.d.ts +2 -1
  47. package/src/ui/directives/magic/form-controls/control-value-accessors/checkbox.cva.directive.d.ts +1 -1
  48. package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +9 -3
  49. package/src/ui/directives/magic/form-controls/control-value-accessors/default.cva.directive.d.ts +1 -1
  50. package/src/ui/directives/magic/input.noformcontrol.magic.directive.d.ts +1 -1
  51. package/src/ui/directives/magic/nocontrol.magic.directive.d.ts +1 -1
  52. package/src/ui/directives/magic/row.magic.directive.d.ts +1 -1
  53. package/src/ui/directives/magic-focus.directive.d.ts +1 -1
  54. package/src/ui/directives/magic.directive.d.ts +2 -2
  55. package/src/ui/directives/magicViewContainerRef.directive.d.ts +1 -1
  56. package/src/ui/directives/mgformat.magic.directive.d.ts +12 -2
  57. package/src/ui/directives/range-validator.magic.directive.d.ts +1 -1
  58. package/src/ui/magic-modal/magic-overlay-container-wrapper.d.ts +1 -1
  59. package/src/ui/magic-modal/magic-overlay-container.d.ts +1 -1
  60. package/src/ui/magic-root.component.d.ts +1 -1
  61. package/src/ui/mgerror.magic.component.d.ts +1 -1
  62. package/src/ui/pipes/date.magic.pipe.d.ts +1 -1
  63. package/src/ui/pipes/time.magic.pipe.d.ts +1 -1
  64. package/src/ui/pipes/time24.magic.pipe.d.ts +10 -0
  65. package/src/ui/router-container.magic.component.d.ts +1 -1
  66. package/src/ui/subform.magic.component.d.ts +1 -1
  67. package/src/ui/task-base.magic.component.d.ts +2 -1
  68. package/magic-xpa-angular.d.ts +0 -2
@@ -8,15 +8,17 @@ import { 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, OverlayType, Styles, HtmlProperties, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
12
- import { MagicBridge, getGuiEventObj, CookieService } from '@magic-xpa/engine';
11
+ import { InteractiveCommandType, HtmlProperties, OverlayType, Styles, GuiConstants, CommandType, PIC, GuiEnvironment, Modifiers } from '@magic-xpa/gui';
12
+ import { MagicBridge, getGuiEventObj, CookieService, Environment, LastFocusedManager } from '@magic-xpa/engine';
13
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 { __awaiter, __decorate, __metadata } from 'tslib';
17
17
  import * as i1$1 from '@angular/platform-browser';
18
+ import { maskitoTimeOptionsGenerator } from '@maskito/kit';
18
19
  import * as i1$2 from '@angular/common/http';
19
20
  import { HttpClientModule } from '@angular/common/http';
21
+ import { MaskitoModule } from '@maskito/angular';
20
22
  import { NativeDateAdapter, MAT_DATE_LOCALE, DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
21
23
  import * as i1$3 from '@angular/cdk/platform';
22
24
 
@@ -610,6 +612,9 @@ SubformMagicService.ɵprov = i0.ɵɵdefineInjectable({ token: SubformMagicServic
610
612
  })();
611
613
 
612
614
  class RouterContainerMagicComponent {
615
+ static get LastRoute() {
616
+ return RouterContainerMagicComponent.lastRoute;
617
+ }
613
618
  constructor(activatedRoute, router, magic, containerTaskService, componentFactoryResolver, viewContainerRef, componentList, pendingCommandsCollector, routerCommandsMagicService) {
614
619
  this.activatedRoute = activatedRoute;
615
620
  this.router = router;
@@ -623,9 +628,6 @@ class RouterContainerMagicComponent {
623
628
  this.componentRef = null;
624
629
  this.parentMgSubformService = null;
625
630
  }
626
- static get LastRoute() {
627
- return RouterContainerMagicComponent.lastRoute;
628
- }
629
631
  ngOnInit() {
630
632
  let subformMagicService = SubformMagicService.currentCallerMgSubformServiceRef;
631
633
  let currentActiveRoute = SubformMagicService.getRelativeRoute(this.activatedRoute);
@@ -754,6 +756,11 @@ class GuiInteractiveExecutor {
754
756
  }
755
757
  else if (this.task.isTableControl(this.command.controlName))
756
758
  val = this.task.getValue(this.command.controlName, guiRowId.toString());
759
+ if (this.command._boolVal) {
760
+ const indeterminate = this.task.getProperty(this.command.controlName, HtmlProperties.CheckBoxIndeterminate, guiRowId.toString());
761
+ if (indeterminate)
762
+ val = null;
763
+ }
757
764
  val = this.task.ConvertValToNative(this.command.controlName, guiRowId, val);
758
765
  this.command._mgValue.obj = val;
759
766
  }
@@ -824,15 +831,11 @@ class BaseMagicConfirmComponent {
824
831
  }
825
832
  }
826
833
  BaseMagicConfirmComponent.ɵfac = function BaseMagicConfirmComponent_Factory(t) { return new (t || BaseMagicConfirmComponent)(); };
827
- BaseMagicConfirmComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { }, styles: [""] });
834
+ BaseMagicConfirmComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BaseMagicConfirmComponent, selectors: [["mg-base-alert"]], inputs: { title: "title", message: "message" }, outputs: { onClose: "onClose" }, decls: 0, vars: 0, template: function BaseMagicConfirmComponent_Template(rf, ctx) { } });
828
835
  (function () {
829
836
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicConfirmComponent, [{
830
837
  type: Component,
831
- args: [{
832
- selector: 'mg-base-alert',
833
- template: '',
834
- styles: ['']
835
- }]
838
+ args: [{ selector: 'mg-base-alert', template: '' }]
836
839
  }], null, { title: [{
837
840
  type: Input
838
841
  }], message: [{
@@ -851,15 +854,11 @@ class BaseMagicAlertComponent {
851
854
  }
852
855
  }
853
856
  BaseMagicAlertComponent.ɵfac = function BaseMagicAlertComponent_Factory(t) { return new (t || BaseMagicAlertComponent)(); };
854
- BaseMagicAlertComponent.ɵ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) { }, styles: [""] });
857
+ BaseMagicAlertComponent.ɵ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) { } });
855
858
  (function () {
856
859
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseMagicAlertComponent, [{
857
860
  type: Component,
858
- args: [{
859
- selector: 'mg-base-alert',
860
- template: '',
861
- styles: ['']
862
- }]
861
+ args: [{ selector: 'mg-base-alert', template: '' }]
863
862
  }], null, { title: [{
864
863
  type: Input
865
864
  }], message: [{
@@ -993,13 +992,11 @@ MagicOverlayContainerWrapper.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlay
993
992
  i0.ɵɵelement(6, "div", 5);
994
993
  i0.ɵɵelementEnd();
995
994
  }
996
- }, directives: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%]{position:fixed;z-index:999;inset:0}"] });
995
+ }, dependencies: [MagicFocusDirective, MagicViewContainerRef], styles: [".overlay-container-wrapper-background[_ngcontent-%COMP%]{position:fixed;z-index:999;inset:0}"] });
997
996
  (function () {
998
997
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainerWrapper, [{
999
998
  type: Component,
1000
- args: [{
1001
- selector: 'app-magic-overlay-container-wrapper',
1002
- template: `
999
+ args: [{ selector: 'app-magic-overlay-container-wrapper', template: `
1003
1000
  <div>
1004
1001
  <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" magicFocus></div>
1005
1002
  <div class="overlay-container-wrapper-background" #overlayContainerWrapper>
@@ -1008,19 +1005,7 @@ MagicOverlayContainerWrapper.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlay
1008
1005
  </div>
1009
1006
  <div class="overlay-container-wrapper-background" tabIndex="0" style="width: 0px; height: 0px;" ></div>
1010
1007
  </div>
1011
- `,
1012
- styles: [`
1013
- .overlay-container-wrapper-background {
1014
- /* modal background fixed across whole screen */
1015
- position: fixed;
1016
- top: 0;
1017
- z-index: 999;
1018
- right: 0;
1019
- bottom: 0;
1020
- left: 0;
1021
- }
1022
- `]
1023
- }]
1008
+ `, styles: [".overlay-container-wrapper-background{position:fixed;z-index:999;inset:0}\n"] }]
1024
1009
  }], function () { return [{ type: ComponentListMagicService }, { type: MagicLazyLoaderService }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i0.ChangeDetectorRef }, { type: i0.Compiler }]; }, { Component: [{
1025
1010
  type: Input
1026
1011
  }], Parameters: [{
@@ -1082,7 +1067,7 @@ function MagicOverlayContainer_button_2_Template(rf, ctx) {
1082
1067
  if (rf & 1) {
1083
1068
  const _r5 = i0.ɵɵgetCurrentView();
1084
1069
  i0.ɵɵelementStart(0, "button", 8);
1085
- i0.ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return ctx_r4.OnClose(); });
1070
+ i0.ɵɵlistener("click", function MagicOverlayContainer_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.OnClose()); });
1086
1071
  i0.ɵɵtext(1, "X");
1087
1072
  i0.ɵɵelementEnd();
1088
1073
  }
@@ -1093,7 +1078,7 @@ function MagicOverlayContainer_div_5_Template(rf, ctx) {
1093
1078
  i0.ɵɵelementStart(0, "div", 9, 10);
1094
1079
  i0.ɵɵtext(2);
1095
1080
  i0.ɵɵelementStart(3, "button", 11);
1096
- i0.ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return ctx_r7.OnClose(); });
1081
+ i0.ɵɵlistener("click", function MagicOverlayContainer_div_5_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.OnClose()); });
1097
1082
  i0.ɵɵtext(4, "X");
1098
1083
  i0.ɵɵelementEnd()();
1099
1084
  }
@@ -1206,7 +1191,7 @@ MagicOverlayContainer.ɵcmp = i0.ɵɵdefineComponent({ type: MagicOverlayContain
1206
1191
  i0.ɵɵadvance(1);
1207
1192
  i0.ɵɵproperty("ngStyle", ctx.getClientAreaStyles());
1208
1193
  }
1209
- }, 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}"] });
1194
+ }, dependencies: [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}"] });
1210
1195
  (function () {
1211
1196
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicOverlayContainer, [{
1212
1197
  type: Component,
@@ -1281,46 +1266,14 @@ MagicAlertComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicAlertComponent,
1281
1266
  (function () {
1282
1267
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicAlertComponent, [{
1283
1268
  type: Component,
1284
- args: [{
1285
- selector: 'sample-magic-alert-component',
1286
- template: `<div>
1269
+ args: [{ selector: 'sample-magic-alert-component', template: `<div>
1287
1270
  <div class="mg-message-background">
1288
1271
  <h2> {{title}}</h2>
1289
1272
  <p>{{message}} </p>
1290
1273
 
1291
1274
  <button (click)="OnClose()">OK</button>
1292
1275
  </div>
1293
- </div>`,
1294
- styles: [`
1295
- .mg-message-background {
1296
- background-color: #F5F5F5;
1297
- text-align: center;
1298
- width: 40%;
1299
- font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
1300
- padding: 17px;
1301
- border-radius: 5px;
1302
- text-align: center;
1303
- margin-top: 10% ;
1304
- margin-left: auto;
1305
- margin-right: auto;
1306
- border: 1px solid gray;
1307
- }
1308
-
1309
- button {
1310
- background-color: #8CD4F5;
1311
- color: white;
1312
- border: none;
1313
- box-shadow: none;
1314
- font-size: 17px;
1315
- font-weight: 500;
1316
- -webkit-border-radius: 4px;
1317
- border-radius: 5px;
1318
- padding: 10px 32px;
1319
- margin: 26px 5px 0 5px;
1320
- cursor: pointer;
1321
- }
1322
- `]
1323
- }]
1276
+ </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;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}\n"] }]
1324
1277
  }], null, null);
1325
1278
  })();
1326
1279
 
@@ -1353,9 +1306,7 @@ MagicConfirmationBoxComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicConfir
1353
1306
  (function () {
1354
1307
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicConfirmationBoxComponent, [{
1355
1308
  type: Component,
1356
- args: [{
1357
- selector: 'sample-magic-confirmation-box',
1358
- template: `<div>
1309
+ args: [{ selector: 'sample-magic-confirmation-box', template: `<div>
1359
1310
  <div class="mg-message-background">
1360
1311
  <h2> {{title}}</h2>
1361
1312
  {{message}}
@@ -1365,41 +1316,7 @@ MagicConfirmationBoxComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicConfir
1365
1316
  <button (click)="OnClose(true)">OK</button>
1366
1317
  <button class="cancel" (click)="OnClose(false)">Cancel</button>
1367
1318
  </div>
1368
- </div>`,
1369
- styles: [`
1370
- .mg-message-background {
1371
- background-color: #F5F5F5;
1372
- text-align: center;
1373
- width: 40%;
1374
- font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
1375
- padding: 17px;
1376
- border-radius: 5px;
1377
- text-align: center;
1378
- margin-top: 10% ;
1379
- margin-left: auto;
1380
- margin-right: auto;
1381
- border: 1px solid gray;
1382
- }
1383
-
1384
- button {
1385
- background-color: #8CD4F5;
1386
- color: white;
1387
- border: none;
1388
- box-shadow: none;
1389
- font-size: 17px;
1390
- font-weight: 500;
1391
- -webkit-border-radius: 4px;
1392
- border-radius: 5px;
1393
- padding: 10px 32px;
1394
- margin: 26px 5px 0 5px;
1395
- cursor: pointer;
1396
- }
1397
-
1398
- button.cancel {
1399
- background-color: #C1C1C1;
1400
- }
1401
- `]
1402
- }]
1319
+ </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;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}button.cancel{background-color:#c1c1c1}\n"] }]
1403
1320
  }], null, null);
1404
1321
  })();
1405
1322
 
@@ -1629,6 +1546,7 @@ class TaskMagicService {
1629
1546
  this.OnSelectedRowChanged = new EventEmitter();
1630
1547
  this.customPropertiesSubject = new Subject();
1631
1548
  this.recordsCountChangeSubject = new Subject();
1549
+ this.mgLoadSubject = new Subject();
1632
1550
  this.oldPageSize = 0;
1633
1551
  this.Records.setGuiTopIndex(0);
1634
1552
  this.mgInputDateFormat = null;
@@ -1881,6 +1799,11 @@ class TaskMagicService {
1881
1799
  }
1882
1800
  }
1883
1801
  break;
1802
+ case CommandType.SET_CHUNK_SIZE:
1803
+ if (!isUndefined(command.number)) {
1804
+ this.tableService.setChunkSize(command.number);
1805
+ }
1806
+ break;
1884
1807
  case CommandType.SET_RECORDS_BEFORE_CURRENT_VIEW:
1885
1808
  this.updateRecordsBeforeCurrentView(command.number);
1886
1809
  break;
@@ -1908,7 +1831,9 @@ class TaskMagicService {
1908
1831
  break;
1909
1832
  case CommandType.SET_PROPERTY:
1910
1833
  this.handleSetProperty(command, isTableChild);
1911
- if (command.Operation == HtmlProperties.ReadOnly)
1834
+ if (command.Operation == HtmlProperties.ReadOnly ||
1835
+ command.Operation == HtmlProperties.ItemsList ||
1836
+ command.Operation == HtmlProperties.CheckBoxIndeterminate)
1912
1837
  this.refreshDom.next(command);
1913
1838
  break;
1914
1839
  case CommandType.PROP_SET_USER_PROPERTY:
@@ -1963,6 +1888,9 @@ class TaskMagicService {
1963
1888
  case CommandType.SET_FOCUS:
1964
1889
  this.refreshDom.next(command);
1965
1890
  break;
1891
+ case CommandType.SET_WC_IDLE:
1892
+ this.mgLoadSubject.next();
1893
+ break;
1966
1894
  }
1967
1895
  }
1968
1896
  customValidator(rowid, id) {
@@ -2021,7 +1949,10 @@ class TaskMagicService {
2021
1949
  return val;
2022
1950
  }
2023
1951
  case StorageAttribute.NUMERIC:
2024
- return +val;
1952
+ if (isUndefined(val))
1953
+ return val;
1954
+ else
1955
+ return (val != null) ? +val : null;
2025
1956
  default:
2026
1957
  return val;
2027
1958
  }
@@ -2142,6 +2073,16 @@ class TaskMagicService {
2142
2073
  if (typeof (event) == 'boolean') {
2143
2074
  guiEvent.Value = event;
2144
2075
  }
2076
+ else if (typeof (event) == 'string') {
2077
+ if (event == "unchecked") {
2078
+ guiEvent.Value = false;
2079
+ }
2080
+ else if (event == 'indeterminate')
2081
+ guiEvent.Value = null;
2082
+ else if (event == 'checked') {
2083
+ guiEvent.Value = true;
2084
+ }
2085
+ }
2145
2086
  else {
2146
2087
  if (typeof event.target === 'undefined')
2147
2088
  guiEvent.Value = (event).checked;
@@ -2158,10 +2099,10 @@ class TaskMagicService {
2158
2099
  mgOnRadioSelectionChanged(idx) {
2159
2100
  let result = this.getFormControl('0', idx);
2160
2101
  let guiEvent = getGuiEventObj('selectionchanged', idx, 0);
2161
- if (typeof result.value !== 'string')
2102
+ if (typeof result.value !== 'number')
2162
2103
  guiEvent.Value = result.value.index;
2163
2104
  else
2164
- guiEvent.Value = result.value;
2105
+ guiEvent.Value = result.value.toString();
2165
2106
  this.insertEvent(guiEvent);
2166
2107
  }
2167
2108
  close() {
@@ -2222,7 +2163,10 @@ class TableMagicService {
2222
2163
  refreshDataSource() {
2223
2164
  }
2224
2165
  getPageSize() {
2225
- return 10;
2166
+ return this.chunkSize;
2167
+ }
2168
+ setChunkSize(size) {
2169
+ this.chunkSize = size;
2226
2170
  }
2227
2171
  getMaxRowsInTable() {
2228
2172
  return this.task.Records.list.length;
@@ -2310,6 +2254,9 @@ const SYSTEM_BG = 4;
2310
2254
  const SYSTEM_FG_AND_SYSTEM_BG = 6;
2311
2255
  const TRANSPERENT_BG = 1;
2312
2256
  class MagicColorService {
2257
+ getColorFilePath() {
2258
+ return 'assets/' + this.colorFileName;
2259
+ }
2313
2260
  constructor(http, colorFile1 = 'clr_rnt.eng') {
2314
2261
  this.http = http;
2315
2262
  this.colorFileName = 'clr_rnt.eng';
@@ -2319,9 +2266,6 @@ class MagicColorService {
2319
2266
  else
2320
2267
  this.colorFileName = 'clr_rnt.eng';
2321
2268
  }
2322
- getColorFilePath() {
2323
- return 'assets/' + this.colorFileName;
2324
- }
2325
2269
  getColorData() {
2326
2270
  if (!this.colorsData) {
2327
2271
  this.http.get(this.getColorFilePath(), { responseType: 'text' }).subscribe(resp => {
@@ -2403,6 +2347,8 @@ class AccessorMagicService {
2403
2347
  this.task = task;
2404
2348
  this.magicColor = magicColor;
2405
2349
  this.Logger = null;
2350
+ this.hhmm = maskitoTimeOptionsGenerator({ mode: 'HH:MM' });
2351
+ this.hhmmss = maskitoTimeOptionsGenerator({ mode: 'HH:MM:SS' });
2406
2352
  this.Logger = Logger.Instance;
2407
2353
  }
2408
2354
  checkIsReadOnly(controlId) {
@@ -2638,8 +2584,30 @@ class AccessorMagicService {
2638
2584
  let c = this.task.getFormControl(rowId, id);
2639
2585
  if (c.hasError('required'))
2640
2586
  return 'Control must be updated.';
2641
- if (c.hasError('pattern'))
2642
- return 'Required pattern is : ' + c.errors.pattern.requiredPattern;
2587
+ if (c.hasError('pattern')) {
2588
+ if (c.errors.pattern.actualValue < 0 && !c.errors.pattern.requiredPattern.includes('-'))
2589
+ return 'Value must be non-negative';
2590
+ if (c.errors.pattern.requiredPattern.includes('.')) {
2591
+ const numericFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[0];
2592
+ const decimalFormat = Math.abs(c.errors.pattern.actualValue).toString().split('.')[1];
2593
+ const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2594
+ const actualDecimalLimit = c.errors.pattern.requiredPattern.match(/(?:[^,]+,){2}(\d+)/)[1];
2595
+ if (numericFormat.length > actualNumericLimit || decimalFormat.length > actualDecimalLimit) {
2596
+ return "Numeric format is limited to " + actualNumericLimit + "." + actualDecimalLimit + " digits";
2597
+ }
2598
+ }
2599
+ else if (!c.errors.pattern.requiredPattern.includes('.') && !Number.isInteger(c.errors.pattern.actualValue)) {
2600
+ const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2601
+ return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
2602
+ }
2603
+ else {
2604
+ const numericFormat = Math.abs(c.errors.pattern.actualValue).toString();
2605
+ const actualNumericLimit = c.errors.pattern.requiredPattern.match(/,(\d+)/)[1];
2606
+ if (numericFormat.length > actualNumericLimit) {
2607
+ return "Numeric format is limited to " + actualNumericLimit + "." + 0 + " digits";
2608
+ }
2609
+ }
2610
+ }
2643
2611
  if (c.hasError('rangevalidator'))
2644
2612
  return c.errors.rangevalidator.errorMsg;
2645
2613
  if (c.hasError('maxlength'))
@@ -2779,6 +2747,9 @@ class TaskBaseMagicComponent {
2779
2747
  this.task.recordsCountChangeSubject.pipe().subscribe(value => {
2780
2748
  this.RecordsCountChanged(value);
2781
2749
  });
2750
+ this.task.mgLoadSubject.pipe().subscribe(value => {
2751
+ this.mgOnLoad();
2752
+ });
2782
2753
  }
2783
2754
  createFormControlsAccessor(formGroup) { }
2784
2755
  setInputDateFormat() { }
@@ -2786,11 +2757,13 @@ class TaskBaseMagicComponent {
2786
2757
  }
2787
2758
  RecordsCountChanged(recordsCount) {
2788
2759
  }
2760
+ mgOnLoad() {
2761
+ }
2789
2762
  ngAfterViewInit() {
2790
2763
  this.mgSub.init();
2791
2764
  }
2792
2765
  ngAfterContentChecked() {
2793
- if (this.task.oldPageSize != this.tableService.getPageSize()) {
2766
+ if (!isNullOrUndefined(this.tableService.getPageSize()) && this.task.oldPageSize != this.tableService.getPageSize()) {
2794
2767
  this.task.resize(this.tableService.getPageSize(), 0);
2795
2768
  this.task.oldPageSize = this.tableService.getPageSize();
2796
2769
  }
@@ -2872,6 +2845,16 @@ RowMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: RowMagicDirective, sele
2872
2845
  })();
2873
2846
 
2874
2847
  class MagicDirective {
2848
+ set magic(val) {
2849
+ this.id = val;
2850
+ this.selector = "magic";
2851
+ }
2852
+ ;
2853
+ set eventsOnly(val) {
2854
+ console.log("eventsOnly");
2855
+ this.eventsOnlyVal = true;
2856
+ }
2857
+ ;
2875
2858
  constructor(_task, element, renderer, vcRef, magicRow) {
2876
2859
  this._task = _task;
2877
2860
  this.element = element;
@@ -2884,16 +2867,6 @@ class MagicDirective {
2884
2867
  if (!(typeof magicRow === "undefined" || magicRow === null))
2885
2868
  this.rowId = magicRow.rowId;
2886
2869
  }
2887
- set magic(val) {
2888
- this.id = val;
2889
- this.selector = "magic";
2890
- }
2891
- ;
2892
- set eventsOnly(val) {
2893
- console.log("eventsOnly");
2894
- this.eventsOnlyVal = true;
2895
- }
2896
- ;
2897
2870
  get task() {
2898
2871
  return this._task;
2899
2872
  }
@@ -3073,11 +3046,11 @@ MagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MagicDirective, selectors:
3073
3046
  })();
3074
3047
 
3075
3048
  class NoControlMagicDirective extends MagicDirective {
3049
+ set magic(val) { this.id = val; this.selector = 'magicnc'; }
3050
+ ;
3076
3051
  constructor(_task, element, renderer, vcRef, magicRow) {
3077
3052
  super(_task, element, renderer, vcRef, magicRow);
3078
3053
  }
3079
- set magic(val) { this.id = val; this.selector = 'magicnc'; }
3080
- ;
3081
3054
  regEvents() {
3082
3055
  super.regEvents();
3083
3056
  if (this.htmlElement instanceof HTMLSelectElement) {
@@ -3360,6 +3333,7 @@ class MgformatMagicDirective {
3360
3333
  constructor(magicDir, _task) {
3361
3334
  this.magicDir = magicDir;
3362
3335
  this._task = _task;
3336
+ this.datePasteFlag = false;
3363
3337
  }
3364
3338
  ngAfterViewInit() {
3365
3339
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
@@ -3373,9 +3347,170 @@ class MgformatMagicDirective {
3373
3347
  onFocusEvent($event) {
3374
3348
  this.calculatePattern();
3375
3349
  }
3376
- onInputEvent($event) {
3350
+ onPaste(event) {
3351
+ this.datePasteFlag = true;
3352
+ }
3353
+ onInputEvent(event) {
3354
+ let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
3355
+ if (attr == StorageAttribute.DATE) {
3356
+ if (!this.datePasteFlag)
3357
+ this.dateMasking(event);
3358
+ this.datePasteFlag = false;
3359
+ }
3377
3360
  this.calculatePattern();
3378
3361
  }
3362
+ dateMasking(event) {
3363
+ const input = event.target;
3364
+ let cursorPos = event.target.selectionStart;
3365
+ const separator = this._task.mgInputDateFormat.includes('/') ? '/' : '-';
3366
+ if (cursorPos >= input.value.length) {
3367
+ const value = input.value.replace(/[^a-zA-Z0-9/-]/g, '');
3368
+ if (this._task.mgInputDateFormat == "dd/MM/yyyy" || this._task.mgInputDateFormat == "MM/dd/yyyy" || this._task.mgInputDateFormat == "dd-MM-yyyy" || this._task.mgInputDateFormat == "MM-dd-yyyy") {
3369
+ if (value.length == 1 && value[0] == separator)
3370
+ input.value = '01' + separator;
3371
+ else if (value.length == 2 && value[1] == separator)
3372
+ input.value = 0 + value;
3373
+ else if (value.length == 3 && value[2] != separator)
3374
+ input.value = value.slice(0, 2) + separator + value.slice(2);
3375
+ else if (value.length == 4 && value[3] == separator)
3376
+ input.value = value.slice(0, 3) + '01' + value.slice(3);
3377
+ else if (value.length == 5 && value[4] == separator)
3378
+ input.value = value.slice(0, 3) + '0' + value.slice(3);
3379
+ else if (value.length == 6 && value[5] != separator)
3380
+ input.value = value.slice(0, 5) + separator + value.slice(5);
3381
+ else if (value.length >= 10)
3382
+ input.value = value.slice(0, 10);
3383
+ }
3384
+ else if (this._task.mgInputDateFormat == "yyyy/MM/dd" || this._task.mgInputDateFormat == "yyyy/dd/MM" || this._task.mgInputDateFormat == "yyyy-MM-dd" || this._task.mgInputDateFormat == "yyyy-dd-MM") {
3385
+ if (value.length == 1 && value[0] == separator)
3386
+ input.value = '0000' + separator;
3387
+ else if (value.length == 2 && value[1] == separator)
3388
+ input.value = '000' + value.slice(0);
3389
+ else if (value.length == 3 && value[2] == separator)
3390
+ input.value = '00' + value.slice(0);
3391
+ else if (value.length == 4 && value[3] == separator)
3392
+ input.value = '0' + value.slice(0);
3393
+ else if (value.length == 5 && value[4] != separator)
3394
+ input.value = value.slice(0, 4) + separator + value.slice(4);
3395
+ else if (value.length == 6 && value[5] == separator)
3396
+ input.value = value.slice(0, 5) + '01' + value.slice(5);
3397
+ else if (value.length == 7 && value[6] == separator)
3398
+ input.value = value.slice(0, 5) + '0' + value.slice(5);
3399
+ else if (value.length == 8 && value[7] != separator)
3400
+ input.value = value.slice(0, 7) + separator + value.slice(7);
3401
+ else if (value.length >= 10)
3402
+ input.value = value.slice(0, 10);
3403
+ }
3404
+ else if (this._task.mgInputDateFormat == "dd/MM/yy" || this._task.mgInputDateFormat == "yy/MM/dd" || this._task.mgInputDateFormat == "MM/dd/yy" || this._task.mgInputDateFormat == "yy/dd/MM" || this._task.mgInputDateFormat == "dd-MM-yy" || this._task.mgInputDateFormat == "yy-MM-dd" || this._task.mgInputDateFormat == "MM-dd-yy" || this._task.mgInputDateFormat == "yy-dd-MM") {
3405
+ if (value.length == 1 && value[0] == separator)
3406
+ input.value = '01' + separator;
3407
+ else if (value.length == 2 && value[1] == separator)
3408
+ input.value = 0 + value;
3409
+ else if (value.length == 3 && value[2] != separator)
3410
+ input.value = value.slice(0, 2) + separator + value.slice(2);
3411
+ else if (value.length == 4 && value[3] == separator)
3412
+ input.value = value.slice(0, 3) + '01' + value.slice(3);
3413
+ else if (value.length == 5 && value[4] == separator)
3414
+ input.value = value.slice(0, 3) + '0' + value.slice(3);
3415
+ else if (value.length == 6 && value[5] != separator)
3416
+ input.value = value.slice(0, 5) + separator + value.slice(5);
3417
+ else if (value.length >= 8)
3418
+ input.value = value.slice(0, 8);
3419
+ }
3420
+ else if (this._task.mgInputDateFormat == "dd/MMM/yy" || this._task.mgInputDateFormat == "dd-MMM-yy") {
3421
+ if (value.length == 1 && value[0] == separator)
3422
+ input.value = '01' + separator;
3423
+ else if (value.length == 2 && value[1] == separator)
3424
+ input.value = 0 + value;
3425
+ else if (value.length == 3 && value[2] != separator)
3426
+ input.value = value.slice(0, 2) + separator + value.slice(2);
3427
+ else if (value.length == 7 && value[6] != separator)
3428
+ input.value = value.slice(0, 6) + separator + value.slice(6);
3429
+ else if (value.length >= 9)
3430
+ input.value = value.slice(0, 9);
3431
+ }
3432
+ else if (this._task.mgInputDateFormat == "dd/MMM/yyyy" || this._task.mgInputDateFormat == "dd-MMM-yyyy") {
3433
+ if (value.length == 1 && value[0] == separator)
3434
+ input.value = '01' + separator;
3435
+ else if (value.length == 2 && value[1] == separator)
3436
+ input.value = 0 + value;
3437
+ else if (value.length == 3 && value[2] != separator)
3438
+ input.value = value.slice(0, 2) + separator + value.slice(2);
3439
+ else if (value.length == 7 && value[6] != separator)
3440
+ input.value = value.slice(0, 6) + separator + value.slice(6);
3441
+ else if (value.length >= 11)
3442
+ input.value = value.slice(0, 11);
3443
+ }
3444
+ else if (this._task.mgInputDateFormat == "yy/dd/MMM" || this._task.mgInputDateFormat == "yy-dd-MMM") {
3445
+ if (value.length == 1 && value[0] == separator)
3446
+ input.value = '00' + separator;
3447
+ else if (value.length == 2 && value[1] == separator)
3448
+ input.value = 0 + value;
3449
+ else if (value.length == 3 && value[2] != separator)
3450
+ input.value = value.slice(0, 2) + separator + value.slice(2);
3451
+ else if (value.length == 4 && value[3] == separator)
3452
+ input.value = value.slice(0, 3) + '01' + value.slice(3);
3453
+ else if (value.length == 5 && value[4] == separator)
3454
+ input.value = value.slice(0, 3) + '0' + value.slice(3);
3455
+ else if (value.length == 6 && value[5] != separator)
3456
+ input.value = value.slice(0, 5) + separator + value.slice(5);
3457
+ else if (value.length >= 9)
3458
+ input.value = value.slice(0, 9);
3459
+ }
3460
+ else if (this._task.mgInputDateFormat == "yyyy/dd/MMM" || this._task.mgInputDateFormat == "yyyy-dd-MMM") {
3461
+ if (value.length == 1 && value[0] == separator)
3462
+ input.value = '0000' + separator;
3463
+ else if (value.length == 2 && value[1] == separator)
3464
+ input.value = '000' + value.slice(0);
3465
+ else if (value.length == 3 && value[2] == separator)
3466
+ input.value = '00' + value.slice(0);
3467
+ else if (value.length == 4 && value[3] == separator)
3468
+ input.value = '0' + value.slice(0);
3469
+ else if (value.length == 5 && value[4] != separator)
3470
+ input.value = value.slice(0, 4) + separator + value.slice(4);
3471
+ else if (value.length == 6 && value[5] == separator)
3472
+ input.value = value.slice(0, 5) + '01' + value.slice(5);
3473
+ else if (value.length == 7 && value[6] == separator)
3474
+ input.value = value.slice(0, 5) + '0' + value.slice(5);
3475
+ else if (value.length == 8 && value[7] != separator)
3476
+ input.value = value.slice(0, 7) + separator + value.slice(7);
3477
+ else if (value.length >= 11)
3478
+ input.value = value.slice(0, 11);
3479
+ }
3480
+ else if (this._task.mgInputDateFormat == "MMM/dd/yy" || this._task.mgInputDateFormat == "MMM-dd-yy") {
3481
+ if (value.length == 4 && value[3] != separator)
3482
+ input.value = value.slice(0, 3) + separator + value.slice(3);
3483
+ else if (value.length == 5 && value[4] == separator)
3484
+ input.value = value.slice(0, 4) + '01' + value.slice(4);
3485
+ else if (value.length == 6 && value[5] == separator)
3486
+ input.value = value.slice(0, 4) + '0' + value.slice(4);
3487
+ else if (value.length == 7 && value[6] != separator)
3488
+ input.value = value.slice(0, 6) + separator + value.slice(6);
3489
+ else if (value.length >= 9)
3490
+ input.value = value.slice(0, 9);
3491
+ }
3492
+ else if (this._task.mgInputDateFormat == "MMM/dd/yyyy" || this._task.mgInputDateFormat == "MMM-dd-yyyy") {
3493
+ if (value.length == 4 && value[3] != separator)
3494
+ input.value = value.slice(0, 3) + separator + value.slice(3);
3495
+ else if (value.length == 5 && value[4] == separator)
3496
+ input.value = value.slice(0, 4) + '01' + value.slice(4);
3497
+ else if (value.length == 6 && value[5] == separator)
3498
+ input.value = value.slice(0, 4) + '0' + value.slice(4);
3499
+ else if (value.length == 7 && value[6] != separator)
3500
+ input.value = value.slice(0, 6) + separator + value.slice(6);
3501
+ else if (value.length >= 11)
3502
+ input.value = value.slice(0, 11);
3503
+ }
3504
+ }
3505
+ if (cursorPos < input.value.length && input.value.length > this._task.mgInputDateFormat.length) {
3506
+ let inputDate = input.value;
3507
+ let start = input.selectionStart - 1;
3508
+ let end = input.selectionEnd - 1;
3509
+ let indexToRemove = input.selectionStart - 1;
3510
+ input.value = inputDate.slice(0, indexToRemove) + inputDate.slice(indexToRemove + 1);
3511
+ input.setSelectionRange(start, end);
3512
+ }
3513
+ }
3379
3514
  onChangeEvent($event) {
3380
3515
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3381
3516
  let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
@@ -3389,6 +3524,170 @@ class MgformatMagicDirective {
3389
3524
  break;
3390
3525
  }
3391
3526
  }
3527
+ onBlurEvent(event) {
3528
+ let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3529
+ let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
3530
+ const century = Environment.Instance.GetCentury(LastFocusedManager.Instance.getCurrTask().getCompIdx());
3531
+ if (attr == StorageAttribute.DATE)
3532
+ this.formatDateWithCentury(event.target.value, century, control);
3533
+ }
3534
+ formatDateWithCentury(userInput, century, control) {
3535
+ const dateFormat = this._task.mgInputDateFormat;
3536
+ const separator = userInput.includes('/') ? '/' : "-";
3537
+ let centuryVal = parseInt(century.toString().slice(0, 2));
3538
+ if (userInput.length == 0)
3539
+ return;
3540
+ if ((dateFormat == 'dd/MMM/yyyy' || dateFormat == 'dd-MMM-yyyy')) {
3541
+ const dateArray = userInput.split(separator);
3542
+ const [day, month, year] = this.getDateSegments1(dateArray);
3543
+ const isMonthInNumber = !isNaN(Number(month));
3544
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3545
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3546
+ }
3547
+ }
3548
+ else if ((dateFormat == 'dd/MM/yyyy' || dateFormat == 'dd-MM-yyyy' || dateFormat == 'd/M/yyyy' || dateFormat == 'd-M-yyyy')) {
3549
+ const dateArray = userInput.split(separator);
3550
+ const [day, month, year] = this.getDateSegments1(dateArray);
3551
+ if ((day < 32 && month < 13)) {
3552
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3553
+ }
3554
+ }
3555
+ else if ((dateFormat == 'MM/dd/yyyy' || dateFormat == 'MM-dd-yyyy' || dateFormat == 'M/d/yyyy' || dateFormat == 'M-d-yyyy')) {
3556
+ const dateArray = userInput.split(separator);
3557
+ const [day, month, year] = this.getDateSegments2(dateArray);
3558
+ if ((day < 32 && month < 13)) {
3559
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3560
+ }
3561
+ }
3562
+ else if ((dateFormat == 'MMM/dd/yyyy' || dateFormat == 'MMM-dd-yyyy')) {
3563
+ const dateArray = userInput.split(separator);
3564
+ const [day, month, year] = this.getDateSegments2(dateArray);
3565
+ const isMonthInNumber = !isNaN(Number(month));
3566
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3567
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3568
+ }
3569
+ }
3570
+ else if ((dateFormat == 'yyyy/MM/dd' || dateFormat == 'yyyy-MM-dd')) {
3571
+ const dateArray = userInput.split(separator);
3572
+ const [day, month, year] = this.getDateSegments3(dateArray);
3573
+ if ((day < 32 && month < 13)) {
3574
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3575
+ }
3576
+ }
3577
+ else if ((dateFormat == 'yyyy/dd/MM' || dateFormat == 'yyyy-dd-MM')) {
3578
+ const dateArray = userInput.split(separator);
3579
+ const [day, month, year] = this.getDateSegments4(dateArray);
3580
+ if ((day < 32 && month < 13)) {
3581
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3582
+ }
3583
+ }
3584
+ else if ((dateFormat == 'yyyy/dd/MMM' || dateFormat == 'yyyy-dd-MMM')) {
3585
+ const dateArray = userInput.split(separator);
3586
+ const [day, month, year] = this.getDateSegments4(dateArray);
3587
+ const isMonthInNumber = !isNaN(Number(month));
3588
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3589
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3590
+ }
3591
+ }
3592
+ else if ((dateFormat == 'dd/MM/yy' || dateFormat == 'dd-MM-yy' || dateFormat == 'd/M/yy' || dateFormat == 'd-M-yy')) {
3593
+ const dateArray = userInput.split(separator);
3594
+ const [day, month, year] = this.getDateSegments1(dateArray);
3595
+ if ((day < 32 && month < 13)) {
3596
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3597
+ }
3598
+ }
3599
+ else if ((dateFormat == 'MM/dd/yy' || dateFormat == 'MM-dd-yy' || dateFormat == 'M/d/yy' || dateFormat == 'M-d-yy')) {
3600
+ const dateArray = userInput.split(separator);
3601
+ const [day, month, year] = this.getDateSegments2(dateArray);
3602
+ if ((day < 32 && month < 13)) {
3603
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3604
+ }
3605
+ }
3606
+ else if ((dateFormat == 'yy/MM/dd' || dateFormat == 'yy-MM-dd')) {
3607
+ const dateArray = userInput.split(separator);
3608
+ const [day, month, year] = this.getDateSegments3(dateArray);
3609
+ if ((day < 32 && month < 13)) {
3610
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3611
+ }
3612
+ }
3613
+ else if ((dateFormat == 'yy/dd/MM' || dateFormat == 'yy-dd-MM')) {
3614
+ const dateArray = userInput.split(separator);
3615
+ const [day, month, year] = this.getDateSegments4(dateArray);
3616
+ if ((day < 32 && month < 13)) {
3617
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3618
+ }
3619
+ }
3620
+ else if ((dateFormat == 'dd/MMM/yy' || dateFormat == 'dd-MMM-yy')) {
3621
+ const dateArray = userInput.split(separator);
3622
+ const [day, month, year] = this.getDateSegments1(dateArray);
3623
+ const isMonthInNumber = !isNaN(Number(month));
3624
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3625
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3626
+ }
3627
+ }
3628
+ else if ((dateFormat == 'yy/dd/MMM' || dateFormat == 'yy-dd-MMM')) {
3629
+ const dateArray = userInput.split(separator);
3630
+ const [day, month, year] = this.getDateSegments4(dateArray);
3631
+ const isMonthInNumber = !isNaN(Number(month));
3632
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3633
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3634
+ }
3635
+ }
3636
+ else if ((dateFormat == 'MMM/dd/yy' || dateFormat == 'MMM-dd-yy')) {
3637
+ const dateArray = userInput.split(separator);
3638
+ const [day, month, year] = this.getDateSegments2(dateArray);
3639
+ const isMonthInNumber = !isNaN(Number(month));
3640
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3641
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3642
+ }
3643
+ }
3644
+ else if ((dateFormat == 'yyyy/MMM/dd' || dateFormat == 'yyyy-MMM-dd' || dateFormat == 'yy/MMM/dd' || dateFormat == 'yy-MMM-dd')) {
3645
+ const dateArray = userInput.split(separator);
3646
+ const [day, month, year] = this.getDateSegments3(dateArray);
3647
+ const isMonthInNumber = !isNaN(Number(month));
3648
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3649
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3650
+ }
3651
+ }
3652
+ else if (dateFormat == 'yyyy/MM' || dateFormat == 'yyyy-MM') {
3653
+ const dateArray = userInput.split(separator);
3654
+ const month = dateArray[1];
3655
+ const year = Number(dateArray[0]);
3656
+ if (Number(month) < 13) {
3657
+ this.updateYear(1, month, year, separator, century, centuryVal, control);
3658
+ }
3659
+ }
3660
+ }
3661
+ updateYear(day, month, year, separator, century, centuryVal, control) {
3662
+ let updatedYear = year.toString().length === 2 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '' + year :
3663
+ year.toString().length === 1 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '0' + year :
3664
+ year;
3665
+ control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
3666
+ }
3667
+ getDateSegments1(dateArray) {
3668
+ const day = Number(dateArray[0]);
3669
+ const month = dateArray[1];
3670
+ const year = Number(dateArray[2]);
3671
+ return [day, month, year];
3672
+ }
3673
+ getDateSegments2(dateArray) {
3674
+ const day = Number(dateArray[1]);
3675
+ const month = dateArray[0];
3676
+ const year = Number(dateArray[2]);
3677
+ return [day, month, year];
3678
+ }
3679
+ getDateSegments3(dateArray) {
3680
+ const day = Number(dateArray[2]);
3681
+ const month = dateArray[1];
3682
+ const year = Number(dateArray[0]);
3683
+ return [day, month, year];
3684
+ }
3685
+ getDateSegments4(dateArray) {
3686
+ const day = Number(dateArray[1]);
3687
+ const month = dateArray[2];
3688
+ const year = Number(dateArray[0]);
3689
+ return [day, month, year];
3690
+ }
3392
3691
  calculatePattern() {
3393
3692
  let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
3394
3693
  if (control != null) {
@@ -3571,7 +3870,7 @@ class MgformatMagicDirective {
3571
3870
  MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
3572
3871
  MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) {
3573
3872
  if (rf & 1) {
3574
- 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); });
3873
+ 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); });
3575
3874
  }
3576
3875
  } });
3577
3876
  (function () {
@@ -3583,12 +3882,18 @@ MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirec
3583
3882
  }], function () { return [{ type: MagicDirective }, { type: TaskMagicService }]; }, { onFocusEvent: [{
3584
3883
  type: HostListener,
3585
3884
  args: ['focus', ['$event']]
3885
+ }], onPaste: [{
3886
+ type: HostListener,
3887
+ args: ['paste', ['$event']]
3586
3888
  }], onInputEvent: [{
3587
3889
  type: HostListener,
3588
3890
  args: ['input', ['$event']]
3589
3891
  }], onChangeEvent: [{
3590
3892
  type: HostListener,
3591
3893
  args: ['change', ['$event']]
3894
+ }], onBlurEvent: [{
3895
+ type: HostListener,
3896
+ args: ['blur', ['$event']]
3592
3897
  }] });
3593
3898
  })();
3594
3899
 
@@ -3703,14 +4008,14 @@ function SubformMagicComponent_ndc_dynamic_0_Template(rf, ctx) {
3703
4008
  }
3704
4009
  }
3705
4010
  class SubformMagicComponent {
4011
+ set magic(val) { this.id = val; }
4012
+ ;
3706
4013
  constructor(vcRef, mgSub) {
3707
4014
  this.vcRef = vcRef;
3708
4015
  this.mgSub = mgSub;
3709
4016
  this.component = null;
3710
4017
  this.component = (this.vcRef._hostLView).find(v => !isNullOrUndefined(v));
3711
4018
  }
3712
- set magic(val) { this.id = val; }
3713
- ;
3714
4019
  get Component() {
3715
4020
  return this.mgSub.mgGetComp(this.id);
3716
4021
  }
@@ -3726,7 +4031,7 @@ SubformMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SubformMagicCompone
3726
4031
  if (rf & 2) {
3727
4032
  i0.ɵɵproperty("ngIf", ctx.Component);
3728
4033
  }
3729
- }, directives: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective], encapsulation: 2 });
4034
+ }, dependencies: [i1.NgIf, i3.DynamicComponent, i3.DynamicIoDirective], encapsulation: 2 });
3730
4035
  (function () {
3731
4036
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SubformMagicComponent, [{
3732
4037
  type: Component,
@@ -3775,13 +4080,6 @@ function ErrorMagicComponent_div_0_Template(rf, ctx) {
3775
4080
  }
3776
4081
  const _c1 = ["*"];
3777
4082
  class ErrorMagicComponent {
3778
- constructor(_task, mgService, changeDetectorRef) {
3779
- this._task = _task;
3780
- this.mgService = mgService;
3781
- this.changeDetectorRef = changeDetectorRef;
3782
- this.defaultDisplay = true;
3783
- this.rowId = "0";
3784
- }
3785
4083
  set magic(val) {
3786
4084
  this.id = val;
3787
4085
  }
@@ -3795,6 +4093,13 @@ class ErrorMagicComponent {
3795
4093
  this.changeDetectorRef.detectChanges();
3796
4094
  }
3797
4095
  ;
4096
+ constructor(_task, mgService, changeDetectorRef) {
4097
+ this._task = _task;
4098
+ this.mgService = mgService;
4099
+ this.changeDetectorRef = changeDetectorRef;
4100
+ this.defaultDisplay = true;
4101
+ this.rowId = "0";
4102
+ }
3798
4103
  isEmpty(element) {
3799
4104
  const nodes = element.childNodes;
3800
4105
  for (let i = 0; i < nodes.length; i++) {
@@ -3843,7 +4148,7 @@ ErrorMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent,
3843
4148
  if (rf & 2) {
3844
4149
  i0.ɵɵproperty("ngIf", ctx.HasErrors(ctx.id));
3845
4150
  }
3846
- }, directives: [i1.NgIf], encapsulation: 2 });
4151
+ }, dependencies: [i1.NgIf], encapsulation: 2 });
3847
4152
  (function () {
3848
4153
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorMagicComponent, [{
3849
4154
  type: Component,
@@ -3872,19 +4177,81 @@ ErrorMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent,
3872
4177
  })();
3873
4178
 
3874
4179
  class CheckboxMagicDirective {
3875
- constructor(magicDirective) {
4180
+ constructor(magicDirective, el, task) {
3876
4181
  this.magicDirective = magicDirective;
4182
+ this.el = el;
4183
+ this.task = task;
4184
+ this.threeState = false;
4185
+ this.subscribeRefreshDom = null;
4186
+ this.isIndeterminate = false;
3877
4187
  }
3878
4188
  onChange($event) {
3879
- this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4189
+ if (this.threeState) {
4190
+ this.handleThreeState();
4191
+ }
4192
+ else {
4193
+ this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
4194
+ }
4195
+ }
4196
+ ngOnInit() {
4197
+ if (this.threeState) {
4198
+ let guiEvent = getGuiEventObj("setAsThreeState", this.magicDirective.id, +this.magicDirective.rowId);
4199
+ this.task.insertEvent(guiEvent);
4200
+ this.el.nativeElement.indeterminate = this.isIndeterminate = this.task.getProperty(this.magicDirective.id, HtmlProperties.CheckBoxIndeterminate, this.magicDirective.rowId);
4201
+ this.regUpdatesUI();
4202
+ }
4203
+ }
4204
+ regUpdatesUI() {
4205
+ this.subscribeRefreshDom = this.task
4206
+ .refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c)))
4207
+ .subscribe(a => {
4208
+ let command = a;
4209
+ try {
4210
+ this.handleCommand(command);
4211
+ }
4212
+ catch (ex) {
4213
+ console.dir(ex);
4214
+ }
4215
+ });
4216
+ }
4217
+ handleCommand(command) {
4218
+ if (command.CommandType == CommandType.SET_PROPERTY &&
4219
+ command.Operation == HtmlProperties.CheckBoxIndeterminate) {
4220
+ this.isIndeterminate = this.el.nativeElement.indeterminate = command.obj1;
4221
+ }
4222
+ }
4223
+ handleThreeState() {
4224
+ let value = '';
4225
+ let prevCheckedValue = this.task.getValue(this.magicDirective.id, this.magicDirective.rowId);
4226
+ const checkbox = this.el.nativeElement;
4227
+ if (this.isIndeterminate) {
4228
+ checkbox.checked = false;
4229
+ checkbox.indeterminate = false;
4230
+ value = 'unchecked';
4231
+ }
4232
+ else if (prevCheckedValue) {
4233
+ checkbox.checked = false;
4234
+ checkbox.indeterminate = true;
4235
+ value = 'indeterminate';
4236
+ }
4237
+ else if (!prevCheckedValue) {
4238
+ checkbox.checked = true;
4239
+ checkbox.indeterminate = false;
4240
+ value = 'checked';
4241
+ }
4242
+ this.magicDirective.task.onCheckChanged(value, this.magicDirective.id, +this.magicDirective.rowId);
4243
+ }
4244
+ ngOnDestroy() {
4245
+ if (this.subscribeRefreshDom !== null)
4246
+ this.subscribeRefreshDom.unsubscribe();
3880
4247
  }
3881
4248
  }
3882
- CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
4249
+ CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
3883
4250
  CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) {
3884
4251
  if (rf & 1) {
3885
4252
  i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
3886
4253
  }
3887
- } });
4254
+ }, inputs: { threeState: "threeState" } });
3888
4255
  (function () {
3889
4256
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
3890
4257
  type: Directive,
@@ -3893,7 +4260,9 @@ CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirec
3893
4260
  input[type=checkbox][magic]:not([noFormControl])
3894
4261
  `,
3895
4262
  }]
3896
- }], function () { return [{ type: MagicDirective }]; }, { onChange: [{
4263
+ }], function () { return [{ type: MagicDirective }, { type: i0.ElementRef }, { type: TaskMagicService }]; }, { threeState: [{
4264
+ type: Input
4265
+ }], onChange: [{
3897
4266
  type: HostListener,
3898
4267
  args: ['change', ['$event']]
3899
4268
  }] });
@@ -3902,10 +4271,18 @@ CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirec
3902
4271
  class ComboboxMagicDirective {
3903
4272
  constructor(magicDirective) {
3904
4273
  this.magicDirective = magicDirective;
4274
+ this.magicDirective.task.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c))).subscribe(value => {
4275
+ let command = value;
4276
+ if (command.Operation === HtmlProperties.ItemsList)
4277
+ this.onComboboxItemsListChanged();
4278
+ });
3905
4279
  }
3906
4280
  onChange($event) {
3907
4281
  this.magicDirective.task.onComboboxSelectionChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
3908
4282
  }
4283
+ onComboboxItemsListChanged() {
4284
+ this.magicDirective.task.refreshView();
4285
+ }
3909
4286
  }
3910
4287
  ComboboxMagicDirective.ɵfac = function ComboboxMagicDirective_Factory(t) { return new (t || ComboboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
3911
4288
  ComboboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: ComboboxMagicDirective, selectors: [["select", "magic", "", 3, "multiple", ""]], hostBindings: function ComboboxMagicDirective_HostBindings(rf, ctx) {
@@ -4097,14 +4474,11 @@ MagicShellComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent,
4097
4474
  i0.ɵɵadvance(3);
4098
4475
  i0.ɵɵproperty("ngIf", ctx.showSpinner);
4099
4476
  }
4100
- }, 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)}}"] });
4477
+ }, dependencies: [i1.NgIf, i1.NgTemplateOutlet, i3.DynamicComponent, i3.DynamicIoDirective, MagicViewContainerRef], 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:_ngcontent-%COMP%_spin 2s linear infinite}.spinner-background[_ngcontent-%COMP%]{position:fixed;z-index:1000;inset:0;opacity:.5}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}"] });
4101
4478
  (function () {
4102
4479
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicShellComponent, [{
4103
4480
  type: Component,
4104
- args: [{
4105
- selector: 'magic-root',
4106
- providers: [],
4107
- template: `
4481
+ args: [{ selector: 'magic-root', providers: [], template: `
4108
4482
  <div #magicRoot>
4109
4483
  <ndc-dynamic
4110
4484
  *ngIf = "RootComponent !== null"
@@ -4123,38 +4497,7 @@ MagicShellComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MagicShellComponent,
4123
4497
  <ng-template #defaultSpinner>
4124
4498
  <div class="mgSpinnerClass"></div>
4125
4499
  </ng-template>
4126
- `,
4127
- styles: [`
4128
- .mgSpinnerClass {
4129
- border: 10px solid #cccccc; /* Light grey */
4130
- border-top: 10px solid black; /* Blue */
4131
- border-radius: 50%;
4132
- position: fixed;
4133
- margin: auto;
4134
- top: 0;
4135
- right: 0;
4136
- bottom: 0;
4137
- left: 0;
4138
- width: 100px;
4139
- height: 100px;
4140
- animation: spin 2s linear infinite;
4141
- }
4142
- .spinner-background {
4143
- /* background fixed across whole screen */
4144
- position: fixed;
4145
- top: 0;
4146
- right: 0;
4147
- bottom: 0;
4148
- z-index: 1000;
4149
- left: 0;
4150
- opacity: 0.5;
4151
- }
4152
- @keyframes spin {
4153
- 0% { transform: rotate(0deg); }
4154
- 100% { transform: rotate(360deg); }
4155
- }
4156
- `]
4157
- }]
4500
+ `, 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"] }]
4158
4501
  }], function () {
4159
4502
  return [{ type: EngineMagicService }, { type: ComponentListMagicService }, { type: i0.ChangeDetectorRef }, { type: i1$1.Title }, { type: OverlayWindowService }, { type: i1$2.HttpClient }, { type: CommandsCollectorMagicService }, { type: ExitMagicService, decorators: [{
4160
4503
  type: Optional
@@ -4295,12 +4638,33 @@ const DATE_VALUE_ACCESSOR = {
4295
4638
  multi: true
4296
4639
  };
4297
4640
  class DateValueAccessor {
4298
- constructor(renderer, elementRef) {
4641
+ onBlurEvent(event) {
4642
+ const century = Environment.Instance.GetCentury(LastFocusedManager.Instance.getCurrTask().getCompIdx());
4643
+ let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
4644
+ this.formatDateWithCentury(event.target.value, century, control);
4645
+ }
4646
+ constructor(renderer, elementRef, magicDir, _task) {
4299
4647
  this.renderer = renderer;
4300
4648
  this.elementRef = elementRef;
4649
+ this.magicDir = magicDir;
4650
+ this._task = _task;
4301
4651
  this.onChange = (_) => { };
4302
4652
  this.onTouched = () => { };
4303
4653
  }
4654
+ formatDateWithCentury(userInput, century, control) {
4655
+ const separator = userInput.includes('/') ? '/' : "-";
4656
+ let centuryVal = parseInt(century.toString().slice(0, 2));
4657
+ if (userInput.length == 0)
4658
+ return;
4659
+ const dateArray = userInput.split(separator);
4660
+ const day = Number(dateArray[2]);
4661
+ const month = Number(dateArray[1]);
4662
+ const year = Number(dateArray[0]);
4663
+ let updatedYear = year.toString().length === 2 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '' + year :
4664
+ year.toString().length === 1 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '0' + year :
4665
+ year;
4666
+ control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
4667
+ }
4304
4668
  writeValue(value) {
4305
4669
  if (!value) {
4306
4670
  this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
@@ -4320,10 +4684,10 @@ class DateValueAccessor {
4320
4684
  this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
4321
4685
  }
4322
4686
  }
4323
- DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef)); };
4687
+ DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
4324
4688
  DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) {
4325
4689
  if (rf & 1) {
4326
- i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.onTouched(); });
4690
+ i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
4327
4691
  }
4328
4692
  }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
4329
4693
  (function () {
@@ -4333,16 +4697,24 @@ DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, sele
4333
4697
  selector: "[dateInput]",
4334
4698
  providers: [DATE_VALUE_ACCESSOR]
4335
4699
  }]
4336
- }], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, { onChange: [{
4700
+ }], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: MagicDirective }, { type: TaskMagicService }]; }, { onChange: [{
4337
4701
  type: HostListener,
4338
4702
  args: ["input", ["$event.target.valueAsDate"]]
4339
4703
  }], onTouched: [{
4340
4704
  type: HostListener,
4341
4705
  args: ["blur", []]
4706
+ }], onBlurEvent: [{
4707
+ type: HostListener,
4708
+ args: ['blur', ['$event']]
4342
4709
  }] });
4343
4710
  })();
4344
4711
 
4345
4712
  class NonMagicControlDirective {
4713
+ set magic(val) {
4714
+ this.id = val;
4715
+ this.selector = 'NonMagicControl';
4716
+ }
4717
+ ;
4346
4718
  constructor(_task, element, renderer, vcRef) {
4347
4719
  this._task = _task;
4348
4720
  this.element = element;
@@ -4352,11 +4724,6 @@ class NonMagicControlDirective {
4352
4724
  this.eventsOnlyVal = false;
4353
4725
  this.htmlElement = this.element.nativeElement;
4354
4726
  }
4355
- set magic(val) {
4356
- this.id = val;
4357
- this.selector = 'NonMagicControl';
4358
- }
4359
- ;
4360
4727
  get task() {
4361
4728
  return this._task;
4362
4729
  }
@@ -4388,6 +4755,38 @@ NonMagicControlDirective.ɵdir = i0.ɵɵdefineDirective({ type: NonMagicControlD
4388
4755
  }] });
4389
4756
  })();
4390
4757
 
4758
+ class Time24MagicPipe {
4759
+ constructor(_task) {
4760
+ this._task = _task;
4761
+ }
4762
+ transform(value, controlId) {
4763
+ let mask = this._task.GetControlPictureMask(controlId).getMask();
4764
+ if (typeof value !== "undefined" && mask !== null) {
4765
+ const date = new Date(value);
4766
+ const hours = date.getHours().toString().padStart(2, '0');
4767
+ const minutes = date.getMinutes().toString().padStart(2, '0');
4768
+ const seconds = date.getSeconds().toString().padStart(2, '0');
4769
+ if (mask.length == 5) {
4770
+ return `${hours}:${minutes}`;
4771
+ }
4772
+ else if (mask.length > 5) {
4773
+ return `${hours}:${minutes}:${seconds}`;
4774
+ }
4775
+ }
4776
+ return value;
4777
+ }
4778
+ }
4779
+ Time24MagicPipe.ɵfac = function Time24MagicPipe_Factory(t) { return new (t || Time24MagicPipe)(i0.ɵɵdirectiveInject(TaskMagicService, 16)); };
4780
+ Time24MagicPipe.ɵpipe = i0.ɵɵdefinePipe({ name: "magicTime24", type: Time24MagicPipe, pure: true });
4781
+ (function () {
4782
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Time24MagicPipe, [{
4783
+ type: Pipe,
4784
+ args: [{
4785
+ name: 'magicTime24'
4786
+ }]
4787
+ }], function () { return [{ type: TaskMagicService }]; }, null);
4788
+ })();
4789
+
4391
4790
  const decs = [
4392
4791
  MagicDirective,
4393
4792
  CheckboxMagicDirective,
@@ -4416,26 +4815,25 @@ const decs = [
4416
4815
  RangeValidatorMagicDirective,
4417
4816
  NonMagicControlDirective,
4418
4817
  MagicFocusDirective,
4419
- MagicViewContainerRef
4818
+ MagicViewContainerRef,
4819
+ Time24MagicPipe
4420
4820
  ];
4421
4821
  class MagicModule {
4422
4822
  }
4423
4823
  MagicModule.ɵfac = function MagicModule_Factory(t) { return new (t || MagicModule)(); };
4424
4824
  MagicModule.ɵmod = i0.ɵɵdefineNgModule({ type: MagicModule });
4425
- MagicModule.ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [[
4426
- CommonModule,
4427
- FormsModule,
4428
- ReactiveFormsModule,
4429
- RouterModule,
4430
- DynamicModule,
4431
- HttpClientModule
4432
- ]] });
4825
+ MagicModule.ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMagicProvider, OverlayContainerMagicProvider], imports: [CommonModule,
4826
+ FormsModule,
4827
+ ReactiveFormsModule,
4828
+ RouterModule,
4829
+ DynamicModule,
4830
+ HttpClientModule, MaskitoModule] });
4433
4831
  (function () {
4434
4832
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MagicModule, [{
4435
4833
  type: NgModule,
4436
4834
  args: [{
4437
4835
  declarations: [...decs],
4438
- exports: [...decs],
4836
+ exports: [...decs, MaskitoModule],
4439
4837
  entryComponents: [],
4440
4838
  imports: [
4441
4839
  CommonModule,
@@ -4477,7 +4875,8 @@ MagicModule.ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMa
4477
4875
  RangeValidatorMagicDirective,
4478
4876
  NonMagicControlDirective,
4479
4877
  MagicFocusDirective,
4480
- MagicViewContainerRef], imports: [CommonModule,
4878
+ MagicViewContainerRef,
4879
+ Time24MagicPipe], imports: [CommonModule,
4481
4880
  FormsModule,
4482
4881
  ReactiveFormsModule,
4483
4882
  RouterModule,
@@ -4509,7 +4908,8 @@ MagicModule.ɵinj = i0.ɵɵdefineInjector({ providers: [ConfirmationComponentsMa
4509
4908
  RangeValidatorMagicDirective,
4510
4909
  NonMagicControlDirective,
4511
4910
  MagicFocusDirective,
4512
- MagicViewContainerRef] });
4911
+ MagicViewContainerRef,
4912
+ Time24MagicPipe, MaskitoModule] });
4513
4913
  })();
4514
4914
 
4515
4915
  const MG_FORMATS = {
@@ -4696,5 +5096,5 @@ class ModalFormDefinition {
4696
5096
  }
4697
5097
  }
4698
5098
 
4699
- 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, TimeMagicPipe, TitleMagicService, basicMagicProviders, confirmationBox, magicProviders, matDateProviders, utils };
5099
+ 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 };
4700
5100
  //# sourceMappingURL=magic-xpa-angular.mjs.map