ngx-ode-ui 3.12.0-dev.16 → 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;
@@ -1384,6 +1427,7 @@ var ListComponent = /** @class */ (function (_super) {
1384
1427
  _this.noResultsLabel = 'list.results.no.items';
1385
1428
  _this.placeholder = 'list.placeholder';
1386
1429
  _this.isSearchActive = true;
1430
+ _this.isSearchButtonDisabled = false;
1387
1431
  _this.searchInput = false;
1388
1432
  _this.inputChange = new EventEmitter();
1389
1433
  _this.onSelect = new EventEmitter();
@@ -1427,7 +1471,7 @@ var ListComponent = /** @class */ (function (_super) {
1427
1471
  ListComponent.decorators = [
1428
1472
  { type: Component, args: [{
1429
1473
  selector: 'ode-list',
1430
- template: "<ode-search-input\n *ngIf=\"isSearchActive\"\n [searchInput]=\"searchInput\"\n [searchSubmit]=\"searchSubmit\"\n [attr.placeholder]=\"searchPlaceholder | translate\"\n (onChange)=\"inputChange.emit($event)\"></ode-search-input>\n<div class=\"toolbar\">\n <ng-content select=\"[toolbar]\"></ng-content>\n</div>\n<div class=\"list-wrapper\"\n infiniteScroll\n [scrollWindow]=\"false\"\n (scrolled)=\"scrolledDown.emit()\"\n [infiniteScrollThrottle]=\"50\">\n <ul>\n <li *ngFor=\"let item of model | filter: filters | filter: inputFilter | store:self:'storedElements' | orderBy: sort | slice: 0:limit\"\n (click)=\"onSelect.emit(item)\"\n [class.selected]=\"isSelected(item)\"\n [class.disabled]=\"isDisabled(item)\"\n [ngClass]=\"ngClass(item)\"\n class=\"lct-list-item\">\n <ng-template [ngTemplateOutlet]=\"templateRef\" [ngTemplateOutletContext]=\"{$implicit: item}\">\n </ng-template>\n </li>\n </ul>\n <ul *ngIf=\"storedElements && storedElements.length === 0\">\n <li class=\"no-results\">{{ noResultsLabel | translate }}</li>\n </ul>\n <ul *ngIf=\"!model\">\n <li class=\"placeholder\">{{ placeholder | translate }}</li>\n </ul>\n</div>\n",
1474
+ template: "<ode-search-input\n *ngIf=\"isSearchActive\"\n [isSearchButtonDisabled]=\"isSearchButtonDisabled\"\n [searchInput]=\"searchInput\"\n [searchSubmit]=\"searchSubmit\"\n [delay]=\"searchDelay\"\n [attr.placeholder]=\"searchPlaceholder | translate\"\n (onChange)=\"inputChange.emit($event)\"\n>\n</ode-search-input>\n\n<div class=\"toolbar\">\n <ng-content select=\"[toolbar]\"></ng-content>\n</div>\n\n<div\n class=\"list-wrapper\"\n infiniteScroll\n [scrollWindow]=\"false\"\n (scrolled)=\"scrolledDown.emit()\"\n [infiniteScrollThrottle]=\"50\"\n>\n <ul>\n <li\n *ngFor=\"let item of model | filter: filters | filter: inputFilter | store:self:'storedElements' | orderBy: sort | slice: 0:limit\"\n (click)=\"onSelect.emit(item)\"\n [class.selected]=\"isSelected(item)\"\n [class.disabled]=\"isDisabled(item)\"\n [ngClass]=\"ngClass(item)\"\n class=\"lct-list-item\"\n >\n <ng-template [ngTemplateOutlet]=\"templateRef\" [ngTemplateOutletContext]=\"{$implicit: item}\">\n </ng-template>\n </li>\n </ul>\n\n <ul *ngIf=\"storedElements && storedElements.length === 0\">\n <li class=\"no-results\">{{ noResultsLabel | translate }}</li>\n </ul>\n\n <ul *ngIf=\"!model\">\n <li class=\"placeholder\">{{ placeholder | translate }}</li>\n </ul>\n</div>\n",
1431
1475
  styles: ["ul{margin:0;padding:0;font-size:.9em}ul li{cursor:pointer;border-top:1px solid #ddd;padding:10px}ul li.no-results{padding:50px;text-align:center;font-style:italic}ul li.no-results:hover{cursor:default!important;background-color:inherit!important}ul li.placeholder{color:#aaa;padding:2rem;text-align:left}ul li.placeholder:hover{cursor:default!important;background-color:inherit!important}ul li.disabled{pointer-events:none}"]
1432
1476
  }] }
1433
1477
  ];
@@ -1445,7 +1489,9 @@ var ListComponent = /** @class */ (function (_super) {
1445
1489
  noResultsLabel: [{ type: Input }],
1446
1490
  placeholder: [{ type: Input }],
1447
1491
  isSearchActive: [{ type: Input }],
1492
+ isSearchButtonDisabled: [{ type: Input }],
1448
1493
  searchInput: [{ type: Input }],
1494
+ searchDelay: [{ type: Input }],
1449
1495
  searchSubmit: [{ type: Input }],
1450
1496
  inputChange: [{ type: Output }],
1451
1497
  onSelect: [{ type: Output }],
@@ -1482,8 +1528,12 @@ if (false) {
1482
1528
  /** @type {?} */
1483
1529
  ListComponent.prototype.isSearchActive;
1484
1530
  /** @type {?} */
1531
+ ListComponent.prototype.isSearchButtonDisabled;
1532
+ /** @type {?} */
1485
1533
  ListComponent.prototype.searchInput;
1486
1534
  /** @type {?} */
1535
+ ListComponent.prototype.searchDelay;
1536
+ /** @type {?} */
1487
1537
  ListComponent.prototype.searchSubmit;
1488
1538
  /** @type {?} */
1489
1539
  ListComponent.prototype.inputChange;
@@ -2951,6 +3001,7 @@ var SearchInputComponent = /** @class */ (function (_super) {
2951
3001
  _this._renderer = _renderer;
2952
3002
  /* Inputs / Outputs / View */
2953
3003
  _this.isSearchActive = false;
3004
+ _this.isSearchButtonDisabled = false;
2954
3005
  _this.searchInput = false;
2955
3006
  _this._delay = 200;
2956
3007
  _this.onChange = new EventEmitter();
@@ -3055,7 +3106,7 @@ var SearchInputComponent = /** @class */ (function (_super) {
3055
3106
  SearchInputComponent.decorators = [
3056
3107
  { type: Component, args: [{
3057
3108
  selector: 'ode-search-input',
3058
- template: "<form\n class=\"search-container\"\n (ngSubmit)=\"searchInput && searchSubmit()\">\n <input\n #searchBox\n class=\"search-input\"\n name=\"searchTerm\"\n type=\"search\"\n (input)=\"search(searchBox.value)\" />\n <button class=\"search-button\" *ngIf=\"searchInput\">\n <i class=\"fa fa-search is-size-4 search-icon\"></i>\n </button>\n</form>\n\n<!-- <input *ngIf=\"!searchInput\" type=\"search\" #searchBox (input)=\"search(searchBox.value)\"/> -->",
3109
+ template: "<form\n class=\"search-container\"\n (ngSubmit)=\"searchInput && searchSubmit()\">\n <input\n #searchBox\n class=\"search-input\"\n name=\"searchTerm\"\n type=\"search\"\n (input)=\"search(searchBox.value)\" />\n <button class=\"search-button\" *ngIf=\"searchInput\" [attr.disabled]=\"isSearchButtonDisabled ? true : null\">\n <i class=\"fa fa-search is-size-4 search-icon\"></i>\n </button>\n</form>\n\n<!-- <input *ngIf=\"!searchInput\" type=\"search\" #searchBox (input)=\"search(searchBox.value)\"/> -->",
3059
3110
  styles: [":host .search-container{margin:0;display:flex}:host .search-icon{padding-left:0}:host .search-button{margin:0;background:#ff8352;color:#fff}"]
3060
3111
  }] }
3061
3112
  ];
@@ -3067,6 +3118,7 @@ var SearchInputComponent = /** @class */ (function (_super) {
3067
3118
  ]; };
3068
3119
  SearchInputComponent.propDecorators = {
3069
3120
  isSearchActive: [{ type: Input }],
3121
+ isSearchButtonDisabled: [{ type: Input }],
3070
3122
  searchInput: [{ type: Input }],
3071
3123
  searchSubmit: [{ type: Input }],
3072
3124
  delay: [{ type: Input }],
@@ -3079,6 +3131,8 @@ if (false) {
3079
3131
  /** @type {?} */
3080
3132
  SearchInputComponent.prototype.isSearchActive;
3081
3133
  /** @type {?} */
3134
+ SearchInputComponent.prototype.isSearchButtonDisabled;
3135
+ /** @type {?} */
3082
3136
  SearchInputComponent.prototype.searchInput;
3083
3137
  /** @type {?} */
3084
3138
  SearchInputComponent.prototype.searchSubmit;