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.
@@ -353,6 +353,7 @@ class DatepickerComponent extends OdeComponent {
353
353
  this.labelsService = labelsService;
354
354
  this.innerValue = '';
355
355
  this.disabled = false;
356
+ this._readonly = false;
356
357
  this.enableTime = false;
357
358
  this.placeholder = '';
358
359
  this.changeDate = new EventEmitter();
@@ -383,6 +384,26 @@ class DatepickerComponent extends OdeComponent {
383
384
  }
384
385
  }
385
386
  }
387
+ /**
388
+ * @param {?} val
389
+ * @return {?}
390
+ */
391
+ set readonly(val) {
392
+ this._readonly = val;
393
+ if (this.datePickerInst && this.datePickerInst.altInput) {
394
+ // Apply the readonly attribute addition/removal to the visible input (wrapped)
395
+ if (val)
396
+ this.datePickerInst.altInput.setAttribute('readonly', "");
397
+ else
398
+ this.datePickerInst.altInput.removeAttribute('readonly');
399
+ }
400
+ }
401
+ /**
402
+ * @return {?}
403
+ */
404
+ get readonly() {
405
+ return this._readonly;
406
+ }
386
407
  /**
387
408
  * @return {?}
388
409
  */
@@ -413,12 +434,25 @@ class DatepickerComponent extends OdeComponent {
413
434
  enableTime: this.enableTime,
414
435
  minDate: this.minDate,
415
436
  maxDate: this.maxDate,
416
- clickOpens: !this.disabled,
437
+ clickOpens: false,
417
438
  wrap: true,
418
439
  // to add input decoration (calendar icon and delete icon)
419
440
  locale: datePickerLocale
420
441
  };
421
442
  this.datePickerInst = new Flatpickr(this.datePickerElement.nativeElement, options);
443
+ if (!this.disabled) {
444
+ this.datePickerInst.altInput.addEventListener('click', (/**
445
+ * @param {?} e
446
+ * @return {?}
447
+ */
448
+ e => {
449
+ if (!this.readonly) {
450
+ this.datePickerInst.toggle();
451
+ }
452
+ }));
453
+ }
454
+ // Force updating the date input readonly attribute :
455
+ this.readonly = this._readonly;
422
456
  }
423
457
  /**
424
458
  * @return {?}
@@ -463,8 +497,9 @@ class DatepickerComponent extends OdeComponent {
463
497
  DatepickerComponent.decorators = [
464
498
  { type: Component, args: [{
465
499
  selector: 'ode-date-picker',
466
- 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",
467
- providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR]
500
+ 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",
501
+ providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
502
+ styles: [".hidden{visibility:hidden}"]
468
503
  }] }
469
504
  ];
470
505
  /** @nocollapse */
@@ -478,6 +513,7 @@ DatepickerComponent.propDecorators = {
478
513
  inputElement: [{ type: ViewChild, args: ['inputRef', { static: false },] }],
479
514
  model: [{ type: ViewChild, args: [NgModel, { static: false },] }],
480
515
  disabled: [{ type: Input }],
516
+ readonly: [{ type: Input }],
481
517
  enableTime: [{ type: Input }],
482
518
  placeholder: [{ type: Input }],
483
519
  minDate: [{ type: Input }],
@@ -504,6 +540,8 @@ if (false) {
504
540
  /** @type {?} */
505
541
  DatepickerComponent.prototype.disabled;
506
542
  /** @type {?} */
543
+ DatepickerComponent.prototype._readonly;
544
+ /** @type {?} */
507
545
  DatepickerComponent.prototype.enableTime;
508
546
  /** @type {?} */
509
547
  DatepickerComponent.prototype.placeholder;
@@ -1225,6 +1263,7 @@ class ListComponent extends OdeComponent {
1225
1263
  this.noResultsLabel = 'list.results.no.items';
1226
1264
  this.placeholder = 'list.placeholder';
1227
1265
  this.isSearchActive = true;
1266
+ this.isSearchButtonDisabled = false;
1228
1267
  this.searchInput = false;
1229
1268
  this.inputChange = new EventEmitter();
1230
1269
  this.onSelect = new EventEmitter();
@@ -1264,7 +1303,7 @@ class ListComponent extends OdeComponent {
1264
1303
  ListComponent.decorators = [
1265
1304
  { type: Component, args: [{
1266
1305
  selector: 'ode-list',
1267
- 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",
1306
+ 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",
1268
1307
  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}"]
1269
1308
  }] }
1270
1309
  ];
@@ -1282,7 +1321,9 @@ ListComponent.propDecorators = {
1282
1321
  noResultsLabel: [{ type: Input }],
1283
1322
  placeholder: [{ type: Input }],
1284
1323
  isSearchActive: [{ type: Input }],
1324
+ isSearchButtonDisabled: [{ type: Input }],
1285
1325
  searchInput: [{ type: Input }],
1326
+ searchDelay: [{ type: Input }],
1286
1327
  searchSubmit: [{ type: Input }],
1287
1328
  inputChange: [{ type: Output }],
1288
1329
  onSelect: [{ type: Output }],
@@ -1317,8 +1358,12 @@ if (false) {
1317
1358
  /** @type {?} */
1318
1359
  ListComponent.prototype.isSearchActive;
1319
1360
  /** @type {?} */
1361
+ ListComponent.prototype.isSearchButtonDisabled;
1362
+ /** @type {?} */
1320
1363
  ListComponent.prototype.searchInput;
1321
1364
  /** @type {?} */
1365
+ ListComponent.prototype.searchDelay;
1366
+ /** @type {?} */
1322
1367
  ListComponent.prototype.searchSubmit;
1323
1368
  /** @type {?} */
1324
1369
  ListComponent.prototype.inputChange;
@@ -2612,6 +2657,7 @@ class SearchInputComponent extends OdeComponent {
2612
2657
  this._renderer = _renderer;
2613
2658
  /* Inputs / Outputs / View */
2614
2659
  this.isSearchActive = false;
2660
+ this.isSearchButtonDisabled = false;
2615
2661
  this.searchInput = false;
2616
2662
  this._delay = 200;
2617
2663
  this.onChange = new EventEmitter();
@@ -2696,7 +2742,7 @@ class SearchInputComponent extends OdeComponent {
2696
2742
  SearchInputComponent.decorators = [
2697
2743
  { type: Component, args: [{
2698
2744
  selector: 'ode-search-input',
2699
- 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)\"/> -->",
2745
+ 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)\"/> -->",
2700
2746
  styles: [":host .search-container{margin:0;display:flex}:host .search-icon{padding-left:0}:host .search-button{margin:0;background:#ff8352;color:#fff}"]
2701
2747
  }] }
2702
2748
  ];
@@ -2708,6 +2754,7 @@ SearchInputComponent.ctorParameters = () => [
2708
2754
  ];
2709
2755
  SearchInputComponent.propDecorators = {
2710
2756
  isSearchActive: [{ type: Input }],
2757
+ isSearchButtonDisabled: [{ type: Input }],
2711
2758
  searchInput: [{ type: Input }],
2712
2759
  searchSubmit: [{ type: Input }],
2713
2760
  delay: [{ type: Input }],
@@ -2718,6 +2765,8 @@ if (false) {
2718
2765
  /** @type {?} */
2719
2766
  SearchInputComponent.prototype.isSearchActive;
2720
2767
  /** @type {?} */
2768
+ SearchInputComponent.prototype.isSearchButtonDisabled;
2769
+ /** @type {?} */
2721
2770
  SearchInputComponent.prototype.searchInput;
2722
2771
  /** @type {?} */
2723
2772
  SearchInputComponent.prototype.searchSubmit;