@kris701/ez-ui 1.1.2 → 1.1.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.
@@ -3404,6 +3404,16 @@ class EzUITable {
3404
3404
  <div class="ezui-table">
3405
3405
  <tui-loader [inheritColor]="true" [overlay]="true" size="xxl" [loading]="isLoading()">
3406
3406
  @if(values.length == 0){
3407
+ @if(showAdd || showRefresh){
3408
+ <div class="ezui-table-header">
3409
+ @if(showRefresh){
3410
+ <button tuiButton iconStart="rotate-cw" size="s" appearance="info" (click)="onLoadItems.emit()" tuiHint="Refresh the table"></button>
3411
+ }
3412
+ @if(showAdd){
3413
+ <button tuiButton iconStart="plus" size="s" appearance="info" (click)="onAddItem.emit()" tuiHint="Add new item"></button>
3414
+ }
3415
+ </div>
3416
+ }
3407
3417
  <tui-block-status>
3408
3418
  <tui-icon tuiSlot="top" icon="grid-2x2-x" />
3409
3419
 
@@ -3497,6 +3507,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
3497
3507
  <div class="ezui-table">
3498
3508
  <tui-loader [inheritColor]="true" [overlay]="true" size="xxl" [loading]="isLoading()">
3499
3509
  @if(values.length == 0){
3510
+ @if(showAdd || showRefresh){
3511
+ <div class="ezui-table-header">
3512
+ @if(showRefresh){
3513
+ <button tuiButton iconStart="rotate-cw" size="s" appearance="info" (click)="onLoadItems.emit()" tuiHint="Refresh the table"></button>
3514
+ }
3515
+ @if(showAdd){
3516
+ <button tuiButton iconStart="plus" size="s" appearance="info" (click)="onAddItem.emit()" tuiHint="Add new item"></button>
3517
+ }
3518
+ </div>
3519
+ }
3500
3520
  <tui-block-status>
3501
3521
  <tui-icon tuiSlot="top" icon="grid-2x2-x" />
3502
3522
 
@@ -4558,6 +4578,8 @@ class BaseListInterface {
4558
4578
  ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
4559
4579
  getAllEndpoint = '';
4560
4580
  getEndpoint = '';
4581
+ canGetAll = true;
4582
+ canGet = true;
4561
4583
  isLoaded = false;
4562
4584
  isLoading = false;
4563
4585
  onUpdated = new EventEmitter();
@@ -4565,7 +4587,7 @@ class BaseListInterface {
4565
4587
  this.http = http;
4566
4588
  }
4567
4589
  async Load() {
4568
- if (!this.isLoading) {
4590
+ if (!this.isLoading && this.canGetAll) {
4569
4591
  this.isLoaded = false;
4570
4592
  this.isLoading = true;
4571
4593
  const value = await firstValueFrom(this.http.get(this.getAllEndpoint));
@@ -4574,6 +4596,9 @@ class BaseListInterface {
4574
4596
  this.isLoaded = true;
4575
4597
  this.onUpdated.emit();
4576
4598
  }
4599
+ else {
4600
+ this.isLoaded = true;
4601
+ }
4577
4602
  }
4578
4603
  async List() {
4579
4604
  if (!this.isLoaded)
@@ -4589,6 +4614,8 @@ class BaseListInterface {
4589
4614
  return null;
4590
4615
  }
4591
4616
  async Get(id) {
4617
+ if (!this.canGet)
4618
+ return null;
4592
4619
  const item = await firstValueFrom(this.http.get(this.getEndpoint + "?ID=" + id));
4593
4620
  return item;
4594
4621
  }