@magic-xpa/angular 4.1000.0 → 4.1000.410-0.428
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/index.mjs +1 -1
- package/esm2020/src/services/task.magics.service.mjs +13 -2
- package/esm2020/src/ui/GuiInteractiveExecutor.mjs +7 -2
- package/esm2020/src/ui/directives/magic/checkbox.magic.directive.mjs +76 -7
- package/esm2020/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.mjs +34 -5
- package/esm2020/src/ui/directives/mgformat.magic.directive.mjs +170 -2
- package/fesm2015/magic-xpa-angular.mjs +284 -13
- package/fesm2015/magic-xpa-angular.mjs.map +1 -1
- package/fesm2020/magic-xpa-angular.mjs +284 -13
- package/fesm2020/magic-xpa-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/src/ui/directives/magic/checkbox.magic.directive.d.ts +15 -2
- package/src/ui/directives/magic/form-controls/control-value-accessors/date.cva.directive.d.ts +8 -2
- package/src/ui/directives/mgformat.magic.directive.d.ts +7 -0
@@ -8,8 +8,8 @@ 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,
|
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';
|
@@ -740,6 +740,11 @@ class GuiInteractiveExecutor {
|
|
740
740
|
}
|
741
741
|
else if (this.task.isTableControl(this.command.controlName))
|
742
742
|
val = this.task.getValue(this.command.controlName, guiRowId.toString());
|
743
|
+
if (this.command._boolVal) {
|
744
|
+
const indeterminate = this.task.getProperty(this.command.controlName, HtmlProperties.CheckBoxIndeterminate, guiRowId.toString());
|
745
|
+
if (indeterminate)
|
746
|
+
val = null;
|
747
|
+
}
|
743
748
|
val = this.task.ConvertValToNative(this.command.controlName, guiRowId, val);
|
744
749
|
this.command._mgValue.obj = val;
|
745
750
|
}
|
@@ -1767,7 +1772,8 @@ class TaskMagicService {
|
|
1767
1772
|
case CommandType.SET_PROPERTY:
|
1768
1773
|
this.handleSetProperty(command, isTableChild);
|
1769
1774
|
if (command.Operation == HtmlProperties.ReadOnly ||
|
1770
|
-
command.Operation == HtmlProperties.ItemsList
|
1775
|
+
command.Operation == HtmlProperties.ItemsList ||
|
1776
|
+
command.Operation == HtmlProperties.CheckBoxIndeterminate)
|
1771
1777
|
this.refreshDom.next(command);
|
1772
1778
|
break;
|
1773
1779
|
case CommandType.PROP_SET_USER_PROPERTY:
|
@@ -2007,6 +2013,16 @@ class TaskMagicService {
|
|
2007
2013
|
if (typeof (event) == 'boolean') {
|
2008
2014
|
guiEvent.Value = event;
|
2009
2015
|
}
|
2016
|
+
else if (typeof (event) == 'string') {
|
2017
|
+
if (event == "unchecked") {
|
2018
|
+
guiEvent.Value = false;
|
2019
|
+
}
|
2020
|
+
else if (event == 'indeterminate')
|
2021
|
+
guiEvent.Value = null;
|
2022
|
+
else if (event == 'checked') {
|
2023
|
+
guiEvent.Value = true;
|
2024
|
+
}
|
2025
|
+
}
|
2010
2026
|
else {
|
2011
2027
|
if (typeof event.target === 'undefined')
|
2012
2028
|
guiEvent.Value = (event).checked;
|
@@ -3418,6 +3434,170 @@ class MgformatMagicDirective {
|
|
3418
3434
|
break;
|
3419
3435
|
}
|
3420
3436
|
}
|
3437
|
+
onBlurEvent(event) {
|
3438
|
+
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3439
|
+
let attr = this._task.Records.list[0].getControlMetadata(this.magicDir.id).dataType;
|
3440
|
+
const century = Environment.Instance.GetCentury(LastFocusedManager.Instance.getCurrTask().getCompIdx());
|
3441
|
+
if (attr == StorageAttribute.DATE)
|
3442
|
+
this.formatDateWithCentury(event.target.value, century, control);
|
3443
|
+
}
|
3444
|
+
formatDateWithCentury(userInput, century, control) {
|
3445
|
+
const dateFormat = this._task.mgInputDateFormat;
|
3446
|
+
const separator = userInput.includes('/') ? '/' : "-";
|
3447
|
+
let centuryVal = parseInt(century.toString().slice(0, 2));
|
3448
|
+
if (userInput.length == 0)
|
3449
|
+
return;
|
3450
|
+
if ((dateFormat == 'dd/MMM/yyyy' || dateFormat == 'dd-MMM-yyyy')) {
|
3451
|
+
const dateArray = userInput.split(separator);
|
3452
|
+
const [day, month, year] = this.getDateSegments1(dateArray);
|
3453
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3454
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3455
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3456
|
+
}
|
3457
|
+
}
|
3458
|
+
else if ((dateFormat == 'dd/MM/yyyy' || dateFormat == 'dd-MM-yyyy' || dateFormat == 'd/M/yyyy' || dateFormat == 'd-M-yyyy')) {
|
3459
|
+
const dateArray = userInput.split(separator);
|
3460
|
+
const [day, month, year] = this.getDateSegments1(dateArray);
|
3461
|
+
if ((day < 32 && month < 13)) {
|
3462
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3463
|
+
}
|
3464
|
+
}
|
3465
|
+
else if ((dateFormat == 'MM/dd/yyyy' || dateFormat == 'MM-dd-yyyy' || dateFormat == 'M/d/yyyy' || dateFormat == 'M-d-yyyy')) {
|
3466
|
+
const dateArray = userInput.split(separator);
|
3467
|
+
const [day, month, year] = this.getDateSegments2(dateArray);
|
3468
|
+
if ((day < 32 && month < 13)) {
|
3469
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3470
|
+
}
|
3471
|
+
}
|
3472
|
+
else if ((dateFormat == 'MMM/dd/yyyy' || dateFormat == 'MMM-dd-yyyy')) {
|
3473
|
+
const dateArray = userInput.split(separator);
|
3474
|
+
const [day, month, year] = this.getDateSegments2(dateArray);
|
3475
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3476
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3477
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3478
|
+
}
|
3479
|
+
}
|
3480
|
+
else if ((dateFormat == 'yyyy/MM/dd' || dateFormat == 'yyyy-MM-dd')) {
|
3481
|
+
const dateArray = userInput.split(separator);
|
3482
|
+
const [day, month, year] = this.getDateSegments3(dateArray);
|
3483
|
+
if ((day < 32 && month < 13)) {
|
3484
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3485
|
+
}
|
3486
|
+
}
|
3487
|
+
else if ((dateFormat == 'yyyy/dd/MM' || dateFormat == 'yyyy-dd-MM')) {
|
3488
|
+
const dateArray = userInput.split(separator);
|
3489
|
+
const [day, month, year] = this.getDateSegments4(dateArray);
|
3490
|
+
if ((day < 32 && month < 13)) {
|
3491
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3492
|
+
}
|
3493
|
+
}
|
3494
|
+
else if ((dateFormat == 'yyyy/dd/MMM' || dateFormat == 'yyyy-dd-MMM')) {
|
3495
|
+
const dateArray = userInput.split(separator);
|
3496
|
+
const [day, month, year] = this.getDateSegments4(dateArray);
|
3497
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3498
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3499
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3500
|
+
}
|
3501
|
+
}
|
3502
|
+
else if ((dateFormat == 'dd/MM/yy' || dateFormat == 'dd-MM-yy' || dateFormat == 'd/M/yy' || dateFormat == 'd-M-yy')) {
|
3503
|
+
const dateArray = userInput.split(separator);
|
3504
|
+
const [day, month, year] = this.getDateSegments1(dateArray);
|
3505
|
+
if ((day < 32 && month < 13)) {
|
3506
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3507
|
+
}
|
3508
|
+
}
|
3509
|
+
else if ((dateFormat == 'MM/dd/yy' || dateFormat == 'MM-dd-yy' || dateFormat == 'M/d/yy' || dateFormat == 'M-d-yy')) {
|
3510
|
+
const dateArray = userInput.split(separator);
|
3511
|
+
const [day, month, year] = this.getDateSegments2(dateArray);
|
3512
|
+
if ((day < 32 && month < 13)) {
|
3513
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3514
|
+
}
|
3515
|
+
}
|
3516
|
+
else if ((dateFormat == 'yy/MM/dd' || dateFormat == 'yy-MM-dd')) {
|
3517
|
+
const dateArray = userInput.split(separator);
|
3518
|
+
const [day, month, year] = this.getDateSegments3(dateArray);
|
3519
|
+
if ((day < 32 && month < 13)) {
|
3520
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3521
|
+
}
|
3522
|
+
}
|
3523
|
+
else if ((dateFormat == 'yy/dd/MM' || dateFormat == 'yy-dd-MM')) {
|
3524
|
+
const dateArray = userInput.split(separator);
|
3525
|
+
const [day, month, year] = this.getDateSegments4(dateArray);
|
3526
|
+
if ((day < 32 && month < 13)) {
|
3527
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3528
|
+
}
|
3529
|
+
}
|
3530
|
+
else if ((dateFormat == 'dd/MMM/yy' || dateFormat == 'dd-MMM-yy')) {
|
3531
|
+
const dateArray = userInput.split(separator);
|
3532
|
+
const [day, month, year] = this.getDateSegments1(dateArray);
|
3533
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3534
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3535
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3536
|
+
}
|
3537
|
+
}
|
3538
|
+
else if ((dateFormat == 'yy/dd/MMM' || dateFormat == 'yy-dd-MMM')) {
|
3539
|
+
const dateArray = userInput.split(separator);
|
3540
|
+
const [day, month, year] = this.getDateSegments4(dateArray);
|
3541
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3542
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3543
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3544
|
+
}
|
3545
|
+
}
|
3546
|
+
else if ((dateFormat == 'MMM/dd/yy' || dateFormat == 'MMM-dd-yy')) {
|
3547
|
+
const dateArray = userInput.split(separator);
|
3548
|
+
const [day, month, year] = this.getDateSegments2(dateArray);
|
3549
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3550
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3551
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3552
|
+
}
|
3553
|
+
}
|
3554
|
+
else if ((dateFormat == 'yyyy/MMM/dd' || dateFormat == 'yyyy-MMM-dd' || dateFormat == 'yy/MMM/dd' || dateFormat == 'yy-MMM-dd')) {
|
3555
|
+
const dateArray = userInput.split(separator);
|
3556
|
+
const [day, month, year] = this.getDateSegments3(dateArray);
|
3557
|
+
const isMonthInNumber = !isNaN(Number(month));
|
3558
|
+
if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
|
3559
|
+
this.updateYear(day, month, year, separator, century, centuryVal, control);
|
3560
|
+
}
|
3561
|
+
}
|
3562
|
+
else if (dateFormat == 'yyyy/MM' || dateFormat == 'yyyy-MM') {
|
3563
|
+
const dateArray = userInput.split(separator);
|
3564
|
+
const month = dateArray[1];
|
3565
|
+
const year = Number(dateArray[0]);
|
3566
|
+
if (Number(month) < 13) {
|
3567
|
+
this.updateYear(1, month, year, separator, century, centuryVal, control);
|
3568
|
+
}
|
3569
|
+
}
|
3570
|
+
}
|
3571
|
+
updateYear(day, month, year, separator, century, centuryVal, control) {
|
3572
|
+
let updatedYear = year.toString().length === 2 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '' + year :
|
3573
|
+
year.toString().length === 1 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '0' + year :
|
3574
|
+
year;
|
3575
|
+
control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
|
3576
|
+
}
|
3577
|
+
getDateSegments1(dateArray) {
|
3578
|
+
const day = Number(dateArray[0]);
|
3579
|
+
const month = dateArray[1];
|
3580
|
+
const year = Number(dateArray[2]);
|
3581
|
+
return [day, month, year];
|
3582
|
+
}
|
3583
|
+
getDateSegments2(dateArray) {
|
3584
|
+
const day = Number(dateArray[1]);
|
3585
|
+
const month = dateArray[0];
|
3586
|
+
const year = Number(dateArray[2]);
|
3587
|
+
return [day, month, year];
|
3588
|
+
}
|
3589
|
+
getDateSegments3(dateArray) {
|
3590
|
+
const day = Number(dateArray[2]);
|
3591
|
+
const month = dateArray[1];
|
3592
|
+
const year = Number(dateArray[0]);
|
3593
|
+
return [day, month, year];
|
3594
|
+
}
|
3595
|
+
getDateSegments4(dateArray) {
|
3596
|
+
const day = Number(dateArray[1]);
|
3597
|
+
const month = dateArray[2];
|
3598
|
+
const year = Number(dateArray[0]);
|
3599
|
+
return [day, month, year];
|
3600
|
+
}
|
3421
3601
|
calculatePattern() {
|
3422
3602
|
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
3423
3603
|
if (control != null) {
|
@@ -3599,7 +3779,7 @@ class MgformatMagicDirective {
|
|
3599
3779
|
}
|
3600
3780
|
MgformatMagicDirective.ɵfac = function MgformatMagicDirective_Factory(t) { return new (t || MgformatMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
3601
3781
|
MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirective, selectors: [["", "mgFormat", ""]], hostBindings: function MgformatMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
3602
|
-
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); });
|
3782
|
+
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); });
|
3603
3783
|
} } });
|
3604
3784
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MgformatMagicDirective, [{
|
3605
3785
|
type: Directive,
|
@@ -3618,6 +3798,9 @@ MgformatMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: MgformatMagicDirec
|
|
3618
3798
|
}], onChangeEvent: [{
|
3619
3799
|
type: HostListener,
|
3620
3800
|
args: ['change', ['$event']]
|
3801
|
+
}], onBlurEvent: [{
|
3802
|
+
type: HostListener,
|
3803
|
+
args: ['blur', ['$event']]
|
3621
3804
|
}] }); })();
|
3622
3805
|
|
3623
3806
|
class TimeMagicPipe extends DatePipe {
|
@@ -3874,17 +4057,79 @@ ErrorMagicComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ErrorMagicComponent,
|
|
3874
4057
|
}] }); })();
|
3875
4058
|
|
3876
4059
|
class CheckboxMagicDirective {
|
3877
|
-
constructor(magicDirective) {
|
4060
|
+
constructor(magicDirective, el, task) {
|
3878
4061
|
this.magicDirective = magicDirective;
|
4062
|
+
this.el = el;
|
4063
|
+
this.task = task;
|
4064
|
+
this.threeState = false;
|
4065
|
+
this.subscribeRefreshDom = null;
|
4066
|
+
this.isIndeterminate = false;
|
3879
4067
|
}
|
3880
4068
|
onChange($event) {
|
3881
|
-
|
4069
|
+
if (this.threeState) {
|
4070
|
+
this.handleThreeState();
|
4071
|
+
}
|
4072
|
+
else {
|
4073
|
+
this.magicDirective.task.onCheckChanged($event, this.magicDirective.id, +this.magicDirective.rowId);
|
4074
|
+
}
|
4075
|
+
}
|
4076
|
+
ngOnInit() {
|
4077
|
+
if (this.threeState) {
|
4078
|
+
let guiEvent = getGuiEventObj("setAsThreeState", this.magicDirective.id, +this.magicDirective.rowId);
|
4079
|
+
this.task.insertEvent(guiEvent);
|
4080
|
+
this.el.nativeElement.indeterminate = this.isIndeterminate = this.task.getProperty(this.magicDirective.id, HtmlProperties.CheckBoxIndeterminate, this.magicDirective.rowId);
|
4081
|
+
this.regUpdatesUI();
|
4082
|
+
}
|
4083
|
+
}
|
4084
|
+
regUpdatesUI() {
|
4085
|
+
this.subscribeRefreshDom = this.task
|
4086
|
+
.refreshDom.pipe(filter(c => this.magicDirective.IsSameElement(c)))
|
4087
|
+
.subscribe(a => {
|
4088
|
+
let command = a;
|
4089
|
+
try {
|
4090
|
+
this.handleCommand(command);
|
4091
|
+
}
|
4092
|
+
catch (ex) {
|
4093
|
+
console.dir(ex);
|
4094
|
+
}
|
4095
|
+
});
|
4096
|
+
}
|
4097
|
+
handleCommand(command) {
|
4098
|
+
if (command.CommandType == CommandType.SET_PROPERTY &&
|
4099
|
+
command.Operation == HtmlProperties.CheckBoxIndeterminate) {
|
4100
|
+
this.isIndeterminate = this.el.nativeElement.indeterminate = command.obj1;
|
4101
|
+
}
|
4102
|
+
}
|
4103
|
+
handleThreeState() {
|
4104
|
+
let value = '';
|
4105
|
+
let prevCheckedValue = this.task.getValue(this.magicDirective.id, this.magicDirective.rowId);
|
4106
|
+
const checkbox = this.el.nativeElement;
|
4107
|
+
if (this.isIndeterminate) {
|
4108
|
+
checkbox.checked = false;
|
4109
|
+
checkbox.indeterminate = false;
|
4110
|
+
value = 'unchecked';
|
4111
|
+
}
|
4112
|
+
else if (prevCheckedValue) {
|
4113
|
+
checkbox.checked = false;
|
4114
|
+
checkbox.indeterminate = true;
|
4115
|
+
value = 'indeterminate';
|
4116
|
+
}
|
4117
|
+
else if (!prevCheckedValue) {
|
4118
|
+
checkbox.checked = true;
|
4119
|
+
checkbox.indeterminate = false;
|
4120
|
+
value = 'checked';
|
4121
|
+
}
|
4122
|
+
this.magicDirective.task.onCheckChanged(value, this.magicDirective.id, +this.magicDirective.rowId);
|
4123
|
+
}
|
4124
|
+
ngOnDestroy() {
|
4125
|
+
if (this.subscribeRefreshDom !== null)
|
4126
|
+
this.subscribeRefreshDom.unsubscribe();
|
3882
4127
|
}
|
3883
4128
|
}
|
3884
|
-
CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective)); };
|
4129
|
+
CheckboxMagicDirective.ɵfac = function CheckboxMagicDirective_Factory(t) { return new (t || CheckboxMagicDirective)(i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
3885
4130
|
CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirective, selectors: [["input", "type", "checkbox", "magic", "", 3, "noFormControl", ""]], hostBindings: function CheckboxMagicDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
3886
4131
|
i0.ɵɵlistener("change", function CheckboxMagicDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
|
3887
|
-
} } });
|
4132
|
+
} }, inputs: { threeState: "threeState" } });
|
3888
4133
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxMagicDirective, [{
|
3889
4134
|
type: Directive,
|
3890
4135
|
args: [{
|
@@ -3892,7 +4137,9 @@ CheckboxMagicDirective.ɵdir = i0.ɵɵdefineDirective({ type: CheckboxMagicDirec
|
|
3892
4137
|
input[type=checkbox][magic]:not([noFormControl])
|
3893
4138
|
`,
|
3894
4139
|
}]
|
3895
|
-
}], function () { return [{ type: MagicDirective }]; }, {
|
4140
|
+
}], function () { return [{ type: MagicDirective }, { type: i0.ElementRef }, { type: TaskMagicService }]; }, { threeState: [{
|
4141
|
+
type: Input
|
4142
|
+
}], onChange: [{
|
3896
4143
|
type: HostListener,
|
3897
4144
|
args: ['change', ['$event']]
|
3898
4145
|
}] }); })();
|
@@ -4225,12 +4472,33 @@ const DATE_VALUE_ACCESSOR = {
|
|
4225
4472
|
multi: true
|
4226
4473
|
};
|
4227
4474
|
class DateValueAccessor {
|
4228
|
-
|
4475
|
+
onBlurEvent(event) {
|
4476
|
+
const century = Environment.Instance.GetCentury(LastFocusedManager.Instance.getCurrTask().getCompIdx());
|
4477
|
+
let control = this._task.getFormControl(this.magicDir.rowId, this.magicDir.id);
|
4478
|
+
this.formatDateWithCentury(event.target.value, century, control);
|
4479
|
+
}
|
4480
|
+
constructor(renderer, elementRef, magicDir, _task) {
|
4229
4481
|
this.renderer = renderer;
|
4230
4482
|
this.elementRef = elementRef;
|
4483
|
+
this.magicDir = magicDir;
|
4484
|
+
this._task = _task;
|
4231
4485
|
this.onChange = (_) => { };
|
4232
4486
|
this.onTouched = () => { };
|
4233
4487
|
}
|
4488
|
+
formatDateWithCentury(userInput, century, control) {
|
4489
|
+
const separator = userInput.includes('/') ? '/' : "-";
|
4490
|
+
let centuryVal = parseInt(century.toString().slice(0, 2));
|
4491
|
+
if (userInput.length == 0)
|
4492
|
+
return;
|
4493
|
+
const dateArray = userInput.split(separator);
|
4494
|
+
const day = Number(dateArray[2]);
|
4495
|
+
const month = Number(dateArray[1]);
|
4496
|
+
const year = Number(dateArray[0]);
|
4497
|
+
let updatedYear = year.toString().length === 2 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '' + year :
|
4498
|
+
year.toString().length === 1 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '0' + year :
|
4499
|
+
year;
|
4500
|
+
control.setValue(new Date(`${updatedYear}${separator}${month}${separator}${day}`));
|
4501
|
+
}
|
4234
4502
|
writeValue(value) {
|
4235
4503
|
if (!value) {
|
4236
4504
|
this.renderer.setProperty(this.elementRef.nativeElement, "value", null);
|
@@ -4250,9 +4518,9 @@ class DateValueAccessor {
|
|
4250
4518
|
this.renderer.setProperty(this.elementRef.nativeElement, "disabled", isDisabled);
|
4251
4519
|
}
|
4252
4520
|
}
|
4253
|
-
DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
4521
|
+
DateValueAccessor.ɵfac = function DateValueAccessor_Factory(t) { return new (t || DateValueAccessor)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(MagicDirective), i0.ɵɵdirectiveInject(TaskMagicService)); };
|
4254
4522
|
DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, selectors: [["", "dateInput", ""]], hostBindings: function DateValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
|
4255
|
-
i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler() { return ctx.
|
4523
|
+
i0.ɵɵlistener("input", function DateValueAccessor_input_HostBindingHandler($event) { return ctx.onChange($event.target.valueAsDate); })("blur", function DateValueAccessor_blur_HostBindingHandler($event) { return ctx.onBlurEvent($event); });
|
4256
4524
|
} }, features: [i0.ɵɵProvidersFeature([DATE_VALUE_ACCESSOR])] });
|
4257
4525
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DateValueAccessor, [{
|
4258
4526
|
type: Directive,
|
@@ -4260,12 +4528,15 @@ DateValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: DateValueAccessor, sele
|
|
4260
4528
|
selector: "[dateInput]",
|
4261
4529
|
providers: [DATE_VALUE_ACCESSOR]
|
4262
4530
|
}]
|
4263
|
-
}], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, { onChange: [{
|
4531
|
+
}], function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: MagicDirective }, { type: TaskMagicService }]; }, { onChange: [{
|
4264
4532
|
type: HostListener,
|
4265
4533
|
args: ["input", ["$event.target.valueAsDate"]]
|
4266
4534
|
}], onTouched: [{
|
4267
4535
|
type: HostListener,
|
4268
4536
|
args: ["blur", []]
|
4537
|
+
}], onBlurEvent: [{
|
4538
|
+
type: HostListener,
|
4539
|
+
args: ['blur', ['$event']]
|
4269
4540
|
}] }); })();
|
4270
4541
|
|
4271
4542
|
class NonMagicControlDirective {
|