@acorex/components 3.0.0 → 3.0.4

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.
@@ -483,6 +483,9 @@
483
483
  this.__nativeElement = elementRef.nativeElement;
484
484
  this.__valueField = valueField;
485
485
  this.__validation = validation;
486
+ var value = this[this.__valueField];
487
+ if ((!Array.isArray(value) && value) || (Array.isArray(value) && value.length > 0))
488
+ this.validate();
486
489
  };
487
490
  Object.defineProperty(AXValidatableComponent.prototype, "validation", {
488
491
  get: function () {
@@ -493,7 +496,7 @@
493
496
  });
494
497
  AXValidatableComponent.prototype.validate = function () {
495
498
  var _this = this;
496
- if (this.__validation !== undefined) {
499
+ if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
497
500
  var result = this.__validation.validate(this[this.__valueField]);
498
501
  result.then(function (c) {
499
502
  if (c.result) {
@@ -512,40 +515,44 @@
512
515
  AXValidatableComponent.prototype.clearValidationStyle = function (element, clear) {
513
516
  if (clear === void 0) { clear = false; }
514
517
  var _a, _b, _c, _d, _e, _f, _g;
515
- var formGroup = element.closest('.form-group');
516
- var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
517
- ;
518
- var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
519
- var parent = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
520
- (_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.remove('success-state');
521
- (_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('error-state');
522
- //formItem?.classList.remove('required-state');
523
- if (!clear) {
524
- (_f = formItem) === null || _f === void 0 ? void 0 : _f.classList.add('success-state');
525
- }
526
- (_g = label) === null || _g === void 0 ? void 0 : _g.classList.remove('error-text');
527
- if (parent.querySelector('span.error-text')) {
528
- parent.removeChild(parent.querySelector('span.error-text'));
518
+ if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
519
+ var formGroup = element.closest('.form-group');
520
+ var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
521
+ ;
522
+ var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
523
+ var parent_1 = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
524
+ (_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.remove('success-state');
525
+ (_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('error-state');
526
+ //formItem?.classList.remove('required-state');
527
+ if (!clear) {
528
+ (_f = formItem) === null || _f === void 0 ? void 0 : _f.classList.add('success-state');
529
+ }
530
+ (_g = label) === null || _g === void 0 ? void 0 : _g.classList.remove('error-text');
531
+ if (parent_1.querySelector('span.error-text')) {
532
+ parent_1.removeChild(parent_1.querySelector('span.error-text'));
533
+ }
529
534
  }
530
535
  };
531
536
  AXValidatableComponent.prototype.applyValidationStyle = function (element, v) {
532
537
  var _a, _b, _c, _d, _e, _f;
533
- var formGroup = element.closest('.form-group');
534
- var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
535
- var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
536
- var parent = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
537
- (_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.add('error-state');
538
- (_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('success-state');
539
- if (parent.querySelector('span.error-text')) {
540
- parent.removeChild(parent.querySelector('span.error-text'));
541
- }
542
- if (this.__validation.showMessage) {
543
- var span = document.createElement('span');
544
- span.innerText = v.message;
545
- span.classList.add('ax', 'error-text');
546
- parent.appendChild(span);
538
+ if (this.__validation !== undefined && (this.__validation.rules || []).length > 0) {
539
+ var formGroup = element.closest('.form-group');
540
+ var formItem = ((_a = formGroup) === null || _a === void 0 ? void 0 : _a.querySelector('.form-item')) || element.closest('.form-item') || element.querySelector('.form-item');
541
+ var label = (_b = formGroup) === null || _b === void 0 ? void 0 : _b.querySelector('.form-group-label');
542
+ var parent_2 = ((_c = formItem) === null || _c === void 0 ? void 0 : _c.parentElement) || element.parentElement;
543
+ (_d = formItem) === null || _d === void 0 ? void 0 : _d.classList.add('error-state');
544
+ (_e = formItem) === null || _e === void 0 ? void 0 : _e.classList.remove('success-state');
545
+ if (parent_2.querySelector('span.error-text')) {
546
+ parent_2.removeChild(parent_2.querySelector('span.error-text'));
547
+ }
548
+ if (this.__validation.showMessage) {
549
+ var span = document.createElement('span');
550
+ span.innerText = v.message;
551
+ span.classList.add('ax', 'error-text');
552
+ parent_2.appendChild(span);
553
+ }
554
+ (_f = label) === null || _f === void 0 ? void 0 : _f.classList.add('error-text');
547
555
  }
548
- (_f = label) === null || _f === void 0 ? void 0 : _f.classList.add('error-text');
549
556
  };
550
557
  __decorate([
551
558
  core.Input(),
@@ -624,7 +631,6 @@
624
631
  isUserChange: this.userChange
625
632
  });
626
633
  this.userChange = false;
627
- debugger;
628
634
  this.clearValidationStyle(this.input.nativeElement, v ? false : true);
629
635
  this.cdr.detectChanges();
630
636
  }
@@ -3680,7 +3686,7 @@
3680
3686
  AXCheckBoxComponent = __decorate([
3681
3687
  core.Component({
3682
3688
  selector: 'ax-check-box',
3683
- template: "<!-- <label class=\"ax checkbox {{size}}\" for=\"{{uid}}\" [ngClass]=\"{ 'disabled': disabled, 'readonly': readonly }\"\r\n (click)=\"handleClick($event)\">\r\n {{ label }}\r\n <input #input type=\"checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"\r\n [disabled]=\"disabled || readonly\" />\r\n <span class=\"checkmark\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"></span>\r\n\r\n</label> -->\r\n\r\n<label for=\"{{uid}}\" class=\"ax-checkbox-container\" (click)=\"handleClick($event)\">\r\n <input #input type=\"checkbox\" class=\"ax-checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"\r\n [(ngModel)]=\"value\" [disabled]=\"disabled || readonly\" />\r\n <span>{{ label ? label : '&nbsp;' }}</span>\r\n</label>",
3689
+ template: "<!-- <label class=\"ax checkbox {{size}}\" for=\"{{uid}}\" [ngClass]=\"{ 'disabled': disabled, 'readonly': readonly }\"\r\n (click)=\"handleClick($event)\">\r\n {{ label }}\r\n <input #input type=\"checkbox\" id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\"\r\n [disabled]=\"disabled || readonly\" />\r\n <span class=\"checkmark\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"></span>\r\n\r\n</label> -->\r\n\r\n<label for=\"{{uid}}\" class=\"ax-checkbox-container\" (click)=\"handleClick($event)\">\r\n <input #input type=\"checkbox\" class=\"ax-checkbox\" [ngClass]=\"{'indeterminate': indeterminate && value == null}\"\r\n id=\"{{uid}}\" [readonly]=\"readonly\" [checked]=\"value\" [(ngModel)]=\"value\" [disabled]=\"disabled || readonly\" />\r\n <span>{{ label ? label : '&nbsp;' }}</span>\r\n</label>",
3684
3690
  encapsulation: core.ViewEncapsulation.None,
3685
3691
  changeDetection: core.ChangeDetectionStrategy.OnPush
3686
3692
  }),
@@ -8916,11 +8922,11 @@
8916
8922
  // this.clearValidationStyle(this.ref.nativeElement);
8917
8923
  }
8918
8924
  // this.text = '';
8925
+ this.validate();
8919
8926
  this.cdr.markForCheck();
8920
8927
  };
8921
8928
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
8922
8929
  AXSelectBoxComponent.prototype.onTextBoxClick = function (e) {
8923
- debugger;
8924
8930
  if (this.disabled == false && this.readonly == false) {
8925
8931
  this.dropdown.open();
8926
8932
  }
@@ -12699,7 +12705,7 @@
12699
12705
  AXTimePickerComponent = AXTimePickerComponent_1 = __decorate([
12700
12706
  core.Component({
12701
12707
  selector: 'ax-time-picker',
12702
- template: "<div class=\"ax form-item\" [class.disabled]=\"disabled\" [attr.id]=\"uid\" #fc>\r\n <div class=\"ax items-wrapper\">\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </div>\r\n <div class=\"content\" #content>\r\n <div class=\"ax form-control input {{size}}\" [class.disabled]=\"disabled\" [class.readonly]=\"readonly\"\r\n [class.icon]=\"icon\">\r\n <input #input type=\"text\" class=\"ax {{size}}\" [textMask]=\"timeType\" [(ngModel)]=\"textValue\"\r\n placeholder=\"{{placeholder}}\" [readonly]=\"readonly\" [disabled]=\"disabled\" [ngClass]=\"setTextAlign()\"\r\n [class.clear]=\"value && allowClear\" (focus)=\"handleInputFocus()\" (blur)=\"handleInputBlur($event)\"\r\n (keypress)='handleKeyPress($event)' (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\"\r\n (click)=\"handleClick($event)\">\r\n <i class=\"{{icon}}\" *ngIf=\"icon\"></i>\r\n </div>\r\n </div>\r\n <div class=\"ax items-wrapper\">\r\n <ax-button *ngIf=\"value && allowClear\" icon=\"far fa-times\" type=\"danger blank\" (click)=\"clear()\" [tabIndex]=\"-1\"></ax-button>\r\n <ng-content select=\"[end]\">\r\n </ng-content>\r\n </div>\r\n</div>\r\n<!-- [textMask]=\"{mask: mask , showMask:showMask , guid: maskGuid , keepCharPositions: maskKeepCharPositions}\" -->\r\n<!-- <input #input id=\"timePickerValue\" [textMask]=\"timeType\" type=\"text\" [(ngModel)]=\"value\" (keypress)='handleKeyPress($event)'\r\n (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\" (click)=\"handleClick($event)\"> -->",
12708
+ template: "<div class=\"ax form-item\" [class.disabled]=\"disabled\" [attr.id]=\"uid\" #fc>\r\n <div class=\"ax items-wrapper\">\r\n <ng-content select=\"[start]\">\r\n </ng-content>\r\n </div>\r\n <div class=\"content\" #content>\r\n <div class=\"ax form-control input {{size}}\" [class.disabled]=\"disabled\" [class.readonly]=\"readonly\" [class.icon]=\"icon\">\r\n <input #input type=\"text\" class=\"ax {{size}}\" [textMask]=\"timeType\" [(ngModel)]=\"textValue\" placeholder=\"{{placeholder}}\" [readonly]=\"readonly\" [disabled]=\"disabled\" [ngClass]=\"setTextAlign()\" [class.clear]=\"value && allowClear\" (focus)=\"handleInputFocus()\"\r\n (blur)=\"handleInputBlur($event)\" (keypress)='handleKeyPress($event)' (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\" (click)=\"handleClick($event)\">\r\n <i class=\"{{icon}}\" *ngIf=\"icon\"></i>\r\n </div>\r\n </div>\r\n <div class=\"ax items-wrapper\">\r\n <ax-button *ngIf=\"value && allowClear\" icon=\"far fa-times\" type=\"danger blank\" (click)=\"clear()\" [disabled]=\"disabled\" [tabIndex]=\"-1\"></ax-button>\r\n <ng-content select=\"[end]\">\r\n </ng-content>\r\n </div>\r\n</div>\r\n<!-- [textMask]=\"{mask: mask , showMask:showMask , guid: maskGuid , keepCharPositions: maskKeepCharPositions}\" -->\r\n<!-- <input #input id=\"timePickerValue\" [textMask]=\"timeType\" type=\"text\" [(ngModel)]=\"value\" (keypress)='handleKeyPress($event)'\r\n (keyup)=\"handleKeyUp($event)\" (keydown)=\"handleKeyDown($event)\" (click)=\"handleClick($event)\"> -->",
12703
12709
  changeDetection: core.ChangeDetectionStrategy.OnPush,
12704
12710
  host: { style: 'display: contents;' },
12705
12711
  providers: [{ provide: AXValidatableComponent, useExisting: AXTimePickerComponent_1 }]