ngx-ode-ui 3.12.0-dev.18 → 3.12.0-dev.19

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.
@@ -411,6 +411,7 @@ var DatepickerComponent = /** @class */ (function (_super) {
411
411
  _this.labelsService = labelsService;
412
412
  _this.innerValue = '';
413
413
  _this.disabled = false;
414
+ _this._readonly = false;
414
415
  _this.enableTime = false;
415
416
  _this.placeholder = '';
416
417
  _this.changeDate = new EventEmitter();
@@ -446,6 +447,30 @@ var DatepickerComponent = /** @class */ (function (_super) {
446
447
  enumerable: true,
447
448
  configurable: true
448
449
  });
450
+ Object.defineProperty(DatepickerComponent.prototype, "readonly", {
451
+ get: /**
452
+ * @return {?}
453
+ */
454
+ function () {
455
+ return this._readonly;
456
+ },
457
+ set: /**
458
+ * @param {?} val
459
+ * @return {?}
460
+ */
461
+ function (val) {
462
+ this._readonly = val;
463
+ if (this.datePickerInst && this.datePickerInst.altInput) {
464
+ // Apply the readonly attribute addition/removal to the visible input (wrapped)
465
+ if (val)
466
+ this.datePickerInst.altInput.setAttribute('readonly', "");
467
+ else
468
+ this.datePickerInst.altInput.removeAttribute('readonly');
469
+ }
470
+ },
471
+ enumerable: true,
472
+ configurable: true
473
+ });
449
474
  /**
450
475
  * @return {?}
451
476
  */
@@ -453,6 +478,7 @@ var DatepickerComponent = /** @class */ (function (_super) {
453
478
  * @return {?}
454
479
  */
455
480
  function () {
481
+ var _this = this;
456
482
  _super.prototype.ngAfterViewInit.call(this);
457
483
  // add attr data-input, mandatory for the picker to work in wrap mode
458
484
  this.renderer.setAttribute(this.inputElement.nativeElement, 'data-input', '');
@@ -479,12 +505,25 @@ var DatepickerComponent = /** @class */ (function (_super) {
479
505
  enableTime: this.enableTime,
480
506
  minDate: this.minDate,
481
507
  maxDate: this.maxDate,
482
- clickOpens: !this.disabled,
508
+ clickOpens: false,
483
509
  wrap: true,
484
510
  // to add input decoration (calendar icon and delete icon)
485
511
  locale: datePickerLocale
486
512
  };
487
513
  this.datePickerInst = new Flatpickr(this.datePickerElement.nativeElement, options);
514
+ if (!this.disabled) {
515
+ this.datePickerInst.altInput.addEventListener('click', (/**
516
+ * @param {?} e
517
+ * @return {?}
518
+ */
519
+ function (e) {
520
+ if (!_this.readonly) {
521
+ _this.datePickerInst.toggle();
522
+ }
523
+ }));
524
+ }
525
+ // Force updating the date input readonly attribute :
526
+ this.readonly = this._readonly;
488
527
  };
489
528
  /**
490
529
  * @return {?}
@@ -547,8 +586,9 @@ var DatepickerComponent = /** @class */ (function (_super) {
547
586
  DatepickerComponent.decorators = [
548
587
  { type: Component, args: [{
549
588
  selector: 'ode-date-picker',
550
- template: "<div class=\"flatpickr\" #datePickerElement>\n <input type=\"date\" [(ngModel)]=\"value\" [ngClass]=\"{ 'cursor-default': disabled }\" placeholder=\"{{ placeholder }}\" #inputRef>\n <a *ngIf=\"!disabled\" data-toggle [title]=\"labels('datepicker.open')\"><i class=\"fa fa-calendar open\" aria-hidden=\"true\"></i></a>\n <a *ngIf=\"!disabled\" data-clear [title]=\"labels('datepicker.delete')\"><i class=\"fa fa-times delete\" aria-hidden=\"true\"></i></a>\n</div>\n",
551
- providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR]
589
+ template: "<div class=\"flatpickr\" #datePickerElement>\n <input type=\"date\" [(ngModel)]=\"value\" [disabled]=\"disabled\" [ngClass]=\"{ 'cursor-default': disabled }\" placeholder=\"{{ placeholder }}\" #inputRef>\n <a *ngIf=\"!disabled\" [class.hidden]=\"readonly\" data-toggle [title]=\"labels('datepicker.open')\"><i class=\"fa fa-calendar open\" aria-hidden=\"true\"></i></a>\n <a *ngIf=\"!disabled\" [class.hidden]=\"readonly\" data-clear [title]=\"labels('datepicker.delete')\"><i class=\"fa fa-times delete\" aria-hidden=\"true\"></i></a>\n</div>\n",
590
+ providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
591
+ styles: [".hidden{visibility:hidden}"]
552
592
  }] }
553
593
  ];
554
594
  /** @nocollapse */
@@ -562,6 +602,7 @@ var DatepickerComponent = /** @class */ (function (_super) {
562
602
  inputElement: [{ type: ViewChild, args: ['inputRef', { static: false },] }],
563
603
  model: [{ type: ViewChild, args: [NgModel, { static: false },] }],
564
604
  disabled: [{ type: Input }],
605
+ readonly: [{ type: Input }],
565
606
  enableTime: [{ type: Input }],
566
607
  placeholder: [{ type: Input }],
567
608
  minDate: [{ type: Input }],
@@ -590,6 +631,8 @@ if (false) {
590
631
  /** @type {?} */
591
632
  DatepickerComponent.prototype.disabled;
592
633
  /** @type {?} */
634
+ DatepickerComponent.prototype._readonly;
635
+ /** @type {?} */
593
636
  DatepickerComponent.prototype.enableTime;
594
637
  /** @type {?} */
595
638
  DatepickerComponent.prototype.placeholder;