@den4ik92/ng2-smart-table 19.5.4 → 19.5.42

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.
@@ -771,7 +771,10 @@ class PagerComponent {
771
771
  this.pagingConf = computed(() => this.source().pagingConf());
772
772
  this.currentPerPage = computed(() => this.pagingConf().perPage);
773
773
  this.currentPage = computed(() => this.pagingConf().page);
774
+ this.isShowTotal = computed(() => !!this.pagingConf().showTotal);
774
775
  this.count = computed(() => this.source().count());
776
+ this.nextButtonText = computed(() => this.pagingConf().nextButtonText);
777
+ this.prevButtonText = computed(() => this.pagingConf().nextButtonText);
775
778
  this.lastPage = computed(() => Math.ceil(this.count() / this.currentPerPage()));
776
779
  this.pages = computed(() => this.getPages(this.currentPage(), this.lastPage()));
777
780
  }
@@ -816,11 +819,11 @@ class PagerComponent {
816
819
  this.source().setPaging(1, +target.value);
817
820
  }
818
821
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
819
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"$event.preventDefault(); paginate(page)\">{{\n page\n }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
822
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"ng2-smart-table-pagination__wrap\">\n <div>\n @if (isShowTotal()) {\n Total: {{ count() }}\n }\n </div>\n <nav class=\"ng2-smart-table-pagination__nav\">\n <ul class=\"ng2-smart-table-pagination__list\">\n <li class=\"ng2-smart-table-pagination__list-item\" [class.disabled]=\"currentPage() === 1\">\n <a (click)=\"currentPage() === 1 ? false : prev()\" aria-label=\"Prev\">\n @if (prevButtonText(); as text) {\n {{ text }}\n } @else {\n &laquo; Previous\n }\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-table-pagination__list-item\" [class.active]=\"currentPage() === page\">\n @if (isString(page) || currentPage() === page) {\n <span [class.active]=\"currentPage() === page\">\n {{ page }}\n </span>\n } @else {\n <a (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-table-pagination__list-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a (click)=\"currentPage() === lastPage() ? false : next()\" aria-label=\"Next\">\n @if (nextButtonText(); as text) {\n {{ text }}\n } @else {\n Next &raquo;\n }\n </a>\n </li>\n </ul>\n </nav>\n <div>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n </div>\n</div>\n", styles: [".ng2-smart-table-pagination__wrap{width:100%;display:inline-flex;align-items:center;font-size:.875em;padding:1rem}.ng2-smart-table-pagination__nav{margin:0 auto}.ng2-smart-table-pagination__list{margin:0;list-style:none;display:flex}.ng2-smart-table-pagination__list-item span,.ng2-smart-table-pagination__list-item a{color:var(--layout-text-color);padding:.2rem .5rem}.ng2-smart-table-pagination__list-item a{cursor:pointer}.ng2-smart-table-pagination__list-item a:hover{background-color:var(--layout-background-color);color:var(--layout-text-color)}.ng2-smart-table-pagination__list-item .active{background-color:var(--card-header-primary-background-color);color:var(--card-header-primary-text-color)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
820
823
  }
821
824
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, decorators: [{
822
825
  type: Component,
823
- args: [{ selector: 'ng2-smart-table-pager', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], template: "<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"$event.preventDefault(); paginate(page)\">{{\n page\n }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"$event.preventDefault(); currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"] }]
826
+ args: [{ selector: 'ng2-smart-table-pager', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], template: "<div class=\"ng2-smart-table-pagination__wrap\">\n <div>\n @if (isShowTotal()) {\n Total: {{ count() }}\n }\n </div>\n <nav class=\"ng2-smart-table-pagination__nav\">\n <ul class=\"ng2-smart-table-pagination__list\">\n <li class=\"ng2-smart-table-pagination__list-item\" [class.disabled]=\"currentPage() === 1\">\n <a (click)=\"currentPage() === 1 ? false : prev()\" aria-label=\"Prev\">\n @if (prevButtonText(); as text) {\n {{ text }}\n } @else {\n &laquo; Previous\n }\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-table-pagination__list-item\" [class.active]=\"currentPage() === page\">\n @if (isString(page) || currentPage() === page) {\n <span [class.active]=\"currentPage() === page\">\n {{ page }}\n </span>\n } @else {\n <a (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-table-pagination__list-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a (click)=\"currentPage() === lastPage() ? false : next()\" aria-label=\"Next\">\n @if (nextButtonText(); as text) {\n {{ text }}\n } @else {\n Next &raquo;\n }\n </a>\n </li>\n </ul>\n </nav>\n <div>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n </div>\n</div>\n", styles: [".ng2-smart-table-pagination__wrap{width:100%;display:inline-flex;align-items:center;font-size:.875em;padding:1rem}.ng2-smart-table-pagination__nav{margin:0 auto}.ng2-smart-table-pagination__list{margin:0;list-style:none;display:flex}.ng2-smart-table-pagination__list-item span,.ng2-smart-table-pagination__list-item a{color:var(--layout-text-color);padding:.2rem .5rem}.ng2-smart-table-pagination__list-item a{cursor:pointer}.ng2-smart-table-pagination__list-item a:hover{background-color:var(--layout-background-color);color:var(--layout-text-color)}.ng2-smart-table-pagination__list-item .active{background-color:var(--card-header-primary-background-color);color:var(--card-header-primary-text-color)}\n"] }]
824
827
  }] });
825
828
 
826
829
  class CheckboxEditorComponent extends BaseEditorComponent {
@@ -2322,10 +2325,7 @@ class Grid {
2322
2325
  if (!columns || !columns.length) {
2323
2326
  return false;
2324
2327
  }
2325
- let initialSortColumn = columns?.find((column) => column?.sortDirection);
2326
- if (!initialSortColumn) {
2327
- initialSortColumn = columns?.find((column) => column.sort);
2328
- }
2328
+ const initialSortColumn = columns?.find((column) => column?.sortDirection);
2329
2329
  if (!initialSortColumn) {
2330
2330
  return false;
2331
2331
  }