@colijnit/corecomponents_v12 12.0.19 → 12.0.20

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 (33) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +82 -20
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12.metadata.json +1 -1
  4. package/esm2015/lib/components/base/base-input.component.js +68 -16
  5. package/esm2015/lib/components/input-text/input-text.component.js +3 -4
  6. package/esm2015/lib/components/input-textarea/input-textarea.component.js +8 -8
  7. package/esm2015/lib/components/validation-error/validation-error.component.js +13 -1
  8. package/esm2015/lib/components/validation-error/validation-error.module.js +4 -2
  9. package/fesm2015/colijnit-corecomponents_v12.js +88 -26
  10. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  11. package/lib/components/base/base-input.component.d.ts +7 -2
  12. package/lib/components/co-kanban/style/_layout.scss +4 -0
  13. package/lib/components/co-kanban/style/_material-definition.scss +2 -0
  14. package/lib/components/drop-down-list/style/_layout.scss +2 -1
  15. package/lib/components/drop-down-list/style/_material-definition.scss +2 -0
  16. package/lib/components/input-checkbox-multi-select/style/_layout.scss +5 -1
  17. package/lib/components/input-checkbox-multi-select/style/_material-definition.scss +2 -0
  18. package/lib/components/input-combo-box/style/_layout.scss +4 -2
  19. package/lib/components/input-combo-box/style/_material-definition.scss +2 -0
  20. package/lib/components/input-date-picker/style/_layout.scss +2 -1
  21. package/lib/components/input-date-picker/style/_material-definition.scss +4 -0
  22. package/lib/components/input-listbox/style/_layout.scss +0 -1
  23. package/lib/components/input-listbox/style/_material-definition.scss +2 -2
  24. package/lib/components/input-text/style/_theme.scss +5 -1
  25. package/lib/components/input-textarea/style/_theme.scss +1 -0
  26. package/lib/components/multi-select-list/style/_layout.scss +2 -1
  27. package/lib/components/multi-select-list/style/_material-definition.scss +2 -0
  28. package/lib/components/multi-select-list/style/_theme.scss +5 -1
  29. package/lib/components/validation-error/style/_layout.scss +10 -2
  30. package/lib/components/validation-error/validation-error.component.d.ts +6 -0
  31. package/lib/style/_input.mixins.scss +3 -2
  32. package/lib/style/_variables.scss +14 -1
  33. package/package.json +1 -1
@@ -3101,7 +3101,9 @@
3101
3101
  }
3102
3102
 
3103
3103
  var ValidationErrorComponent = /** @class */ (function () {
3104
- function ValidationErrorComponent() {
3104
+ function ValidationErrorComponent(icons) {
3105
+ this.icons = icons;
3106
+ this.Icons = exports.CoreComponentsIcon;
3105
3107
  }
3106
3108
  ValidationErrorComponent.prototype.showClass = function () {
3107
3109
  return true;
@@ -3111,13 +3113,18 @@
3111
3113
  ValidationErrorComponent.decorators = [
3112
3114
  { type: core.Component, args: [{
3113
3115
  selector: "co-validation-error",
3114
- template: "\n <div class=\"validation-error-content\">\n <div class=\"validation-error-message\" [textContent]=\"error\"></div>\n </div>\n ",
3116
+ template: "\n <div class=\"validation-error-content\">\n <co-icon [iconData]=\"icons.getIcon(Icons.InformationRoundOpen)\"></co-icon>\n <div class=\"validation-error-message\" [textContent]=\"error\"></div>\n </div>\n ",
3115
3117
  animations: [],
3116
3118
  encapsulation: core.ViewEncapsulation.None
3117
3119
  },] }
3118
3120
  ];
3121
+ ValidationErrorComponent.ctorParameters = function () { return [
3122
+ { type: IconCacheService }
3123
+ ]; };
3119
3124
  ValidationErrorComponent.propDecorators = {
3120
3125
  error: [{ type: core.Input }],
3126
+ top: [{ type: core.HostBinding, args: ['style.top.px',] }, { type: core.Input }],
3127
+ left: [{ type: core.HostBinding, args: ['style.left.px',] }, { type: core.Input }],
3121
3128
  showClass: [{ type: core.HostBinding, args: ['class.co-validation-error',] }]
3122
3129
  };
3123
3130
 
@@ -3435,27 +3442,27 @@
3435
3442
  enumerable: false,
3436
3443
  configurable: true
3437
3444
  });
3438
- BaseInputComponent.prototype.showValidationError = function (error) {
3439
- if (this.validationErrorContainer) {
3440
- if (this._errorValidationComponent) {
3441
- this._clearErrorComponent();
3442
- }
3443
- var componentFactory = this.componentFactoryResolver.resolveComponentFactory(ValidationErrorComponent);
3444
- this._errorValidationComponent = this.validationErrorContainer.createComponent(componentFactory);
3445
- this._errorValidationComponent.instance.error = error;
3446
- }
3447
- };
3448
3445
  BaseInputComponent.prototype.ngOnInit = function () {
3449
3446
  var _this = this;
3450
3447
  this._modelChangeSub = this.modelChange.subscribe(function (val) {
3451
3448
  _this.model = val;
3452
3449
  });
3450
+ var iOptions = {
3451
+ trackVisibility: true,
3452
+ // 🆕 Set a minimum delay between notifications
3453
+ delay: 100,
3454
+ // root: document,
3455
+ // rootMargin: "1px",
3456
+ threshold: 1
3457
+ };
3458
+ this.intersectionObserver = new IntersectionObserver(function (entries, observer) { return _this._handleElementPositionChange(entries, observer); }, iOptions);
3453
3459
  // if (this.speechInput) {
3454
3460
  // this._subscribeToSpeechInput();
3455
3461
  // }
3456
3462
  };
3457
3463
  BaseInputComponent.prototype.ngAfterViewInit = function () {
3458
3464
  var _this = this;
3465
+ this._prepareInput();
3459
3466
  this._updateControlValidatorsAndOwnFlags();
3460
3467
  this._addOrRemoveSelfFromForm();
3461
3468
  if (this.formComponent) {
@@ -3469,6 +3476,11 @@
3469
3476
  }
3470
3477
  };
3471
3478
  BaseInputComponent.prototype.ngOnDestroy = function () {
3479
+ var _this = this;
3480
+ if (this.input) {
3481
+ this.input.removeEventListener('blur', function () { return _this.doBlur(); });
3482
+ this.input.removeEventListener('focus', function () { return _this.doFocus(); });
3483
+ }
3472
3484
  this._destroyed = true;
3473
3485
  this._clearErrorComponent();
3474
3486
  // if (this.tooltipManager && this.elementRef) {
@@ -3492,7 +3504,21 @@
3492
3504
  // this._removeSelfFromForm();
3493
3505
  this.elementRef = undefined;
3494
3506
  this.changeDetector = undefined;
3495
- // this.input = undefined;
3507
+ this.input = undefined;
3508
+ };
3509
+ BaseInputComponent.prototype.showValidationError = function (error) {
3510
+ if (this.validationErrorContainer) {
3511
+ if (this._errorValidationComponent) {
3512
+ this._clearErrorComponent();
3513
+ }
3514
+ var clientRect = this.elementRef.nativeElement.getBoundingClientRect();
3515
+ var componentFactory = this.componentFactoryResolver.resolveComponentFactory(ValidationErrorComponent);
3516
+ this._errorValidationComponent = this.validationErrorContainer.createComponent(componentFactory);
3517
+ this._errorValidationComponent.instance.top = clientRect.bottom;
3518
+ this._errorValidationComponent.instance.left = clientRect.left;
3519
+ this._errorValidationComponent.instance.error = error;
3520
+ this.intersectionObserver.observe(this.elementRef.nativeElement);
3521
+ }
3496
3522
  };
3497
3523
  /**
3498
3524
  * Emits a modelChange event with given value, indicating that the model of this form input
@@ -3528,9 +3554,13 @@
3528
3554
  this.focused = true;
3529
3555
  }
3530
3556
  };
3557
+ BaseInputComponent.prototype.doFocus = function () {
3558
+ this.focused = true;
3559
+ this.focus.next();
3560
+ };
3531
3561
  BaseInputComponent.prototype.doBlur = function () {
3532
- this.input.blur();
3533
3562
  this.focused = false;
3563
+ this.blur.next();
3534
3564
  };
3535
3565
  BaseInputComponent.prototype.detectChanges = function () {
3536
3566
  if (!this._destroyed) {
@@ -3583,7 +3613,7 @@
3583
3613
  if (notNill(this.forcedMaxLength) || maxLength === this._maxLength) {
3584
3614
  return;
3585
3615
  }
3586
- if (maxLength > 0) { // not maxLength is 0
3616
+ if (!isNaN(maxLength)) {
3587
3617
  this._maxLength = maxLength;
3588
3618
  this._updateControlValidatorsAndOwnFlags();
3589
3619
  }
@@ -3648,6 +3678,9 @@
3648
3678
  this._errorValidationComponent.destroy();
3649
3679
  this._errorValidationComponent = undefined;
3650
3680
  }
3681
+ if (this.elementRef && this.elementRef.nativeElement) {
3682
+ this.intersectionObserver.unobserve(this.elementRef.nativeElement);
3683
+ }
3651
3684
  }
3652
3685
  };
3653
3686
  // whether this.ngModel.control has safe access
@@ -3663,7 +3696,7 @@
3663
3696
  }
3664
3697
  };
3665
3698
  BaseInputComponent.prototype._setNativeMaxLength = function (maxlength) {
3666
- if (this.input) {
3699
+ if (this.input && !isNaN(maxlength)) {
3667
3700
  this.input.maxLength = maxlength;
3668
3701
  }
3669
3702
  };
@@ -3709,6 +3742,34 @@
3709
3742
  this.formComponent.addFormInput(this.myFormInputInstance ? this.myFormInputInstance : this);
3710
3743
  }
3711
3744
  };
3745
+ BaseInputComponent.prototype._prepareInput = function () {
3746
+ var _this = this;
3747
+ if (this.elementRef && this.elementRef.nativeElement) {
3748
+ //try to find input element
3749
+ this.input = this._findInputNode(this.elementRef.nativeElement.children);
3750
+ if (this.input) {
3751
+ this.input.addEventListener('blur', function () { return _this.doBlur(); });
3752
+ this.input.addEventListener('focus', function () { return _this.doFocus(); });
3753
+ }
3754
+ }
3755
+ };
3756
+ BaseInputComponent.prototype._findInputNode = function (nodes) {
3757
+ for (var i = 0; i < nodes.length; i++) {
3758
+ var node = nodes[i];
3759
+ if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
3760
+ return node;
3761
+ }
3762
+ else if (node.children.length > 0) {
3763
+ return this._findInputNode(node.children);
3764
+ }
3765
+ }
3766
+ };
3767
+ BaseInputComponent.prototype._handleElementPositionChange = function (entries, observer) {
3768
+ if (this._errorValidationComponent && entries && entries.length > 0) {
3769
+ this._errorValidationComponent.instance.top = entries[0].boundingClientRect.bottom;
3770
+ this._errorValidationComponent.instance.left = entries[0].boundingClientRect.left;
3771
+ }
3772
+ };
3712
3773
  return BaseInputComponent;
3713
3774
  }());
3714
3775
  BaseInputComponent.BaseFormInputComponentIndex = 0;
@@ -3726,6 +3787,7 @@
3726
3787
  ]; };
3727
3788
  BaseInputComponent.propDecorators = {
3728
3789
  validationErrorContainer: [{ type: core.ViewChild, args: ["validationError", { read: core.ViewContainerRef },] }],
3790
+ _ngModel: [{ type: core.ViewChild, args: [forms.NgModel, { static: true },] }],
3729
3791
  model: [{ type: core.Input }],
3730
3792
  label: [{ type: core.Input }],
3731
3793
  noValidation: [{ type: core.Input }],
@@ -3755,7 +3817,6 @@
3755
3817
  modelChange: [{ type: core.Output }],
3756
3818
  userModelChange: [{ type: core.Output }],
3757
3819
  hiddenChange: [{ type: core.Output }],
3758
- _ngModel: [{ type: core.ViewChild, args: [forms.NgModel, { static: true },] }],
3759
3820
  focused: [{ type: core.HostBinding, args: ["class.cc-input-focused",] }],
3760
3821
  formInput: [{ type: core.HostBinding, args: ["class.form-input",] }],
3761
3822
  customWidth: [{ type: core.Input }, { type: core.HostBinding, args: ["class.custom-width",] }],
@@ -5287,7 +5348,7 @@
5287
5348
  InputTextComponent.decorators = [
5288
5349
  { type: core.Component, args: [{
5289
5350
  selector: "co-input-text",
5290
- template: "\n <label [textContent]=\"placeholder\"></label>\n <input [type]=\"type\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n (focus)=\"focused = true\"\n (blur)=\"focused = false\"\n >\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
5351
+ template: "\n <label [textContent]=\"placeholder\"></label>\n <input #input\n [type]=\"type\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n >\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
5291
5352
  providers: [{
5292
5353
  provide: COMPONENT_INTERFACE_NAME,
5293
5354
  useExisting: core.forwardRef(function () { return InputTextComponent; })
@@ -5617,7 +5678,8 @@
5617
5678
  ValidationErrorModule.decorators = [
5618
5679
  { type: core.NgModule, args: [{
5619
5680
  imports: [
5620
- common.CommonModule
5681
+ common.CommonModule,
5682
+ IconModule
5621
5683
  ],
5622
5684
  declarations: [
5623
5685
  ValidationErrorComponent
@@ -5764,7 +5826,7 @@
5764
5826
  InputTextareaComponent.decorators = [
5765
5827
  { type: core.Component, args: [{
5766
5828
  selector: "co-input-textarea",
5767
- template: "\n <label [textContent]=\"placeholder\"></label>\n <textarea type=\"textarea\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n (focus)=\"focused = true\"\n (blur)=\"focused = false\"\n ></textarea>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
5829
+ template: "\n <label [textContent]=\"placeholder\"></label>\n <textarea\n #input\n type=\"textarea\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n (ngModelChange)=\"modelChange.emit($event)\"\n ></textarea>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
5768
5830
  providers: [{
5769
5831
  provide: COMPONENT_INTERFACE_NAME,
5770
5832
  useExisting: core.forwardRef(function () { return InputTextareaComponent; })