@den4ik92/ng2-smart-table 19.1.6 → 19.2.1
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.
- package/fesm2022/den4ik92-ng2-smart-table.mjs +797 -1412
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
- package/lib/components/cell/cell-edit-mode/build-in-editor.component.d.ts +8 -0
- package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +3 -3
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +2 -2
- package/lib/components/cell/cell-editors/base-editor.component.d.ts +13 -0
- package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +2 -2
- package/lib/components/cell/cell-editors/input-editor.component.d.ts +2 -3
- package/lib/components/cell/cell-editors/select-editor.component.d.ts +2 -3
- package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +2 -3
- package/lib/components/filter/build-in-filter.component.d.ts +12 -0
- package/lib/components/filter/custom-filter.component.d.ts +14 -6
- package/lib/components/filter/filter-types/base-filter.component.d.ts +31 -0
- package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +7 -6
- package/lib/components/filter/filter-types/input-filter.component.d.ts +2 -8
- package/lib/components/filter/filter-types/select-filter.component.d.ts +2 -7
- package/lib/components/filter/filter.component.d.ts +12 -7
- package/lib/components/pager/pager.component.d.ts +17 -32
- package/lib/components/table-columns-editor/column-editor.directive.d.ts +4 -4
- package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +3 -3
- package/lib/components/tbody/cells/custom.component.d.ts +5 -5
- package/lib/components/tbody/cells/edit-delete.component.d.ts +5 -5
- package/lib/components/tbody/tbody.component.d.ts +4 -6
- package/lib/components/thead/cells/actions-title.component.d.ts +1 -1
- package/lib/components/thead/cells/actions.component.d.ts +2 -2
- package/lib/components/thead/cells/add-button.component.d.ts +3 -3
- package/lib/components/thead/cells/column-title.component.d.ts +4 -5
- package/lib/components/thead/cells/title/title.component.d.ts +11 -15
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +5 -8
- package/lib/components/thead/rows/thead-form-row.component.d.ts +3 -3
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +5 -8
- package/lib/components/thead/thead.component.d.ts +6 -8
- package/lib/lib/data-set/cell.d.ts +1 -1
- package/lib/lib/data-set/column.d.ts +6 -12
- package/lib/lib/data-set/data-set.d.ts +8 -7
- package/lib/lib/data-set/row.d.ts +5 -5
- package/lib/lib/data-source/data-source.d.ts +25 -28
- package/lib/lib/data-source/local/local.data-source.d.ts +8 -45
- package/lib/lib/data-source/local/local.filter.d.ts +2 -4
- package/lib/lib/data-source/local/local.pager.d.ts +1 -3
- package/lib/lib/data-source/server/server.data-source.d.ts +25 -0
- package/lib/lib/grid.d.ts +7 -15
- package/lib/lib/interfaces/smart-table.models.d.ts +41 -26
- package/lib/ng2-smart-table.component.d.ts +6 -7
- package/package.json +1 -1
- package/public-api.d.ts +12 -11
- package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +0 -9
- package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +0 -8
- package/lib/components/cell/cell-editors/default-editor.d.ts +0 -13
- package/lib/components/filter/default-filter.component.d.ts +0 -6
- package/lib/components/filter/filter-default.d.ts +0 -13
- package/lib/components/filter/filter-types/default-filter.d.ts +0 -27
|
@@ -5,17 +5,16 @@ export declare class Column {
|
|
|
5
5
|
id: string;
|
|
6
6
|
private settings;
|
|
7
7
|
protected dataSet: DataSet;
|
|
8
|
-
title: string;
|
|
9
|
-
type: SmartTableColumnSettingsTypes;
|
|
10
|
-
class: string;
|
|
11
|
-
width: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
readonly type: SmartTableColumnSettingsTypes;
|
|
10
|
+
readonly class: string;
|
|
11
|
+
readonly width: string;
|
|
12
12
|
hide: boolean;
|
|
13
13
|
isSortable: boolean;
|
|
14
14
|
isEditable: boolean;
|
|
15
15
|
isAddable: boolean;
|
|
16
16
|
isFilterable: boolean;
|
|
17
17
|
sortDirection: SmartTableSortDirection;
|
|
18
|
-
defaultSortDirection: SmartTableSortDirection | false;
|
|
19
18
|
editor: SmartTableEditorAndFilter | false;
|
|
20
19
|
filter: SmartTableEditorAndFilter | false;
|
|
21
20
|
renderComponent: any;
|
|
@@ -23,12 +22,7 @@ export declare class Column {
|
|
|
23
22
|
valuePrepareFunction?: SmartTableValuePrepareFunction;
|
|
24
23
|
filterFunction?: SmartTableFilterFunction;
|
|
25
24
|
constructor(id: string, settings: SmartTableColumnSettings, dataSet: DataSet);
|
|
26
|
-
|
|
27
|
-
getValuePrepareFunction(): SmartTableValuePrepareFunction | undefined;
|
|
28
|
-
getFilterFunction(): SmartTableFilterFunction | undefined;
|
|
29
|
-
getConfig(): any;
|
|
25
|
+
getEditorConfig(): SmartTableEditorAndFilter['config'] | false;
|
|
30
26
|
getFilterType(): false | "text" | "custom" | "textarea" | "list" | "checkbox";
|
|
31
|
-
getFilterConfig():
|
|
32
|
-
protected process(settings: SmartTableColumnSettings): void;
|
|
33
|
-
prepareSortDirection(): SmartTableSortDirection;
|
|
27
|
+
getFilterConfig(): SmartTableEditorAndFilter['config'] | false;
|
|
34
28
|
}
|
|
@@ -4,14 +4,16 @@ import { Row } from "./row";
|
|
|
4
4
|
export declare class DataSet {
|
|
5
5
|
protected columnSettings: SmartTableColumnSettings[];
|
|
6
6
|
newRow: Row;
|
|
7
|
-
protected data: any[]
|
|
8
|
-
protected columns: Column[]
|
|
9
|
-
protected rows: Row[]
|
|
10
|
-
protected selectedRows: Set<Row>;
|
|
7
|
+
protected readonly data: import("@angular/core").WritableSignal<any[]>;
|
|
8
|
+
protected readonly columns: import("@angular/core").WritableSignal<Column[]>;
|
|
9
|
+
protected readonly rows: import("@angular/core").WritableSignal<Row[]>;
|
|
10
|
+
protected readonly selectedRows: Set<Row>;
|
|
11
|
+
readonly getColumns: import("@angular/core").Signal<Column[]>;
|
|
12
|
+
readonly getVisibleColumns: import("@angular/core").Signal<Column[]>;
|
|
13
|
+
readonly getRows: import("@angular/core").Signal<Row[]>;
|
|
14
|
+
readonly isAllSelected: import("@angular/core").Signal<boolean>;
|
|
11
15
|
constructor(data: any[] | undefined, columnSettings: SmartTableColumnSettings[]);
|
|
12
16
|
setData(data: any[]): void;
|
|
13
|
-
getColumns(): Column[];
|
|
14
|
-
getRows(): Row[];
|
|
15
17
|
getFirstRow(): Row;
|
|
16
18
|
getLastRow(): Row;
|
|
17
19
|
findRowByData(data: any): Row | undefined;
|
|
@@ -32,6 +34,5 @@ export declare class DataSet {
|
|
|
32
34
|
* @private
|
|
33
35
|
*/
|
|
34
36
|
createRows(): void;
|
|
35
|
-
get isAllSelected(): boolean;
|
|
36
37
|
private storeSelectedRow;
|
|
37
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cell } from
|
|
2
|
-
import { Column } from
|
|
3
|
-
import { DataSet } from
|
|
1
|
+
import { Cell } from "./cell";
|
|
2
|
+
import { Column } from "./column";
|
|
3
|
+
import { DataSet } from "./data-set";
|
|
4
4
|
export declare class Row {
|
|
5
5
|
index: number;
|
|
6
6
|
private data;
|
|
@@ -8,10 +8,10 @@ export declare class Row {
|
|
|
8
8
|
readonly pending: import("@angular/core").WritableSignal<boolean>;
|
|
9
9
|
readonly isSelected: import("@angular/core").WritableSignal<boolean>;
|
|
10
10
|
readonly isInEditing: import("@angular/core").WritableSignal<boolean>;
|
|
11
|
-
cells: Cell[]
|
|
11
|
+
readonly cells: import("@angular/core").WritableSignal<Cell[]>;
|
|
12
|
+
readonly visibleCells: import("@angular/core").Signal<Cell[]>;
|
|
12
13
|
constructor(index: number, data: any, _dataSet: DataSet);
|
|
13
14
|
getCell(column: Column): Cell | undefined;
|
|
14
|
-
getCells(): Cell[];
|
|
15
15
|
getData(): any;
|
|
16
16
|
getNewData(): any;
|
|
17
17
|
setData<T = any>(data: T): void;
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import { Observable, Subject } from 'rxjs';
|
|
2
|
-
import {
|
|
2
|
+
import { SmartTableFilterItem, SmartTableOnChangedEvent, SmartTableOnChangedEventToEmit, SmartTablePagerSettings, SmartTableSortItem } from '../interfaces/smart-table.models';
|
|
3
3
|
export declare abstract class DataSource<T = any> {
|
|
4
|
-
protected onChangedSource: Subject<SmartTableOnChangedEvent
|
|
5
|
-
protected
|
|
6
|
-
protected
|
|
7
|
-
|
|
4
|
+
protected onChangedSource: Subject<SmartTableOnChangedEvent>;
|
|
5
|
+
protected sortConf: SmartTableSortItem;
|
|
6
|
+
protected filters: SmartTableFilterItem[];
|
|
7
|
+
readonly pagingConf: import("@angular/core").WritableSignal<SmartTablePagerSettings>;
|
|
8
|
+
protected data: T[];
|
|
9
|
+
/**
|
|
10
|
+
* return all elements
|
|
11
|
+
*/
|
|
8
12
|
abstract getAll(): Promise<T[]>;
|
|
9
|
-
abstract
|
|
10
|
-
abstract
|
|
11
|
-
abstract getFilter(): SmartTableFilterConf;
|
|
12
|
-
abstract getPaging(): SmartTablePagingItem | false;
|
|
13
|
+
abstract getSort(): SmartTableSortItem;
|
|
14
|
+
abstract getFilters(): SmartTableFilterItem[];
|
|
13
15
|
abstract count(): number;
|
|
14
16
|
refresh(): void;
|
|
15
|
-
|
|
17
|
+
columnRefresh(): void;
|
|
16
18
|
onChanged(): Observable<SmartTableOnChangedEvent>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
setPageEmit(): void;
|
|
31
|
-
protected emitOnRemoved(element: T): void;
|
|
32
|
-
protected emitOnUpdated(element: T): void;
|
|
33
|
-
protected emitOnAdded(element: T): void;
|
|
34
|
-
protected emitOnChanged(action: SmartTableOnChangedEventType): void;
|
|
19
|
+
prepend(element: T): Promise<true>;
|
|
20
|
+
appendMany(elements: T[]): Promise<true>;
|
|
21
|
+
append(element: T): Promise<true>;
|
|
22
|
+
add(element: T): Promise<true>;
|
|
23
|
+
remove(element: T): Promise<true>;
|
|
24
|
+
update(oldItem: T, newItem: T): Promise<true>;
|
|
25
|
+
empty(): Promise<true>;
|
|
26
|
+
setSort(conf: SmartTableSortItem, doEmit?: boolean): void;
|
|
27
|
+
addFilter(newFilter: SmartTableFilterItem, doEmit?: boolean): void;
|
|
28
|
+
setFilters(newFilters: SmartTableFilterItem[], doEmit?: boolean): void;
|
|
29
|
+
setPaging(page: number | undefined, perPage: number, doEmit?: boolean): void;
|
|
30
|
+
setPage(page: number, doEmit?: boolean): void;
|
|
31
|
+
emitOnChanged(eventData: SmartTableOnChangedEventToEmit, newElements?: T[]): void;
|
|
35
32
|
}
|
|
@@ -1,57 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SmartTableFilterItem, SmartTableOnChangedEventToEmit, SmartTableSortItem } from '../../interfaces/smart-table.models';
|
|
2
2
|
import { DataSource } from '../data-source';
|
|
3
3
|
export declare class LocalDataSource<T extends Record<string, any> = any> extends DataSource<T> {
|
|
4
|
-
|
|
5
|
-
protected filteredAndSorted: T[];
|
|
6
|
-
protected sortConf: SmartTableSortItem[];
|
|
7
|
-
protected filterConf: SmartTableFilterConf;
|
|
8
|
-
protected pagingConf: SmartTablePagingItem | false;
|
|
4
|
+
private readonly filteredAndSorted;
|
|
9
5
|
constructor(data?: T[]);
|
|
10
|
-
load(data:
|
|
6
|
+
load(data: T[]): Promise<true>;
|
|
11
7
|
prepend(element: T): Promise<true>;
|
|
12
8
|
appendMany(elements: T[]): Promise<true>;
|
|
13
9
|
append(element: T): Promise<true>;
|
|
14
|
-
add(element: T): Promise<true>;
|
|
15
|
-
remove(element: T): Promise<true>;
|
|
16
|
-
update(element: T, values: T): Promise<true>;
|
|
17
|
-
find(element: T): Promise<T>;
|
|
18
|
-
getElements(): Promise<T[]>;
|
|
19
|
-
getFilteredAndSorted(): Promise<T[]>;
|
|
20
10
|
getAll(): Promise<T[]>;
|
|
21
11
|
reset(silent?: boolean): void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Array of conf objects
|
|
27
|
-
* [
|
|
28
|
-
* {field: string, direction: asc|desc|null, compare: Function|null},
|
|
29
|
-
* ]
|
|
30
|
-
* @param conf
|
|
31
|
-
* @param doEmit
|
|
32
|
-
* @returns {LocalDataSource}
|
|
33
|
-
*/
|
|
34
|
-
setSort(conf: SmartTableSortItem[], doEmit?: boolean): LocalDataSource;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* Array of conf objects
|
|
38
|
-
* [
|
|
39
|
-
* {field: string, search: string, filter: Function|null},
|
|
40
|
-
* ]
|
|
41
|
-
* @param conf
|
|
42
|
-
* @param andOperator
|
|
43
|
-
* @param doEmit
|
|
44
|
-
* @returns {LocalDataSource}
|
|
45
|
-
*/
|
|
46
|
-
setFilter(conf: SmartTableFilterItem[], andOperator?: boolean, doEmit?: boolean): LocalDataSource;
|
|
47
|
-
addFilter(fieldConf: SmartTableFilterItem, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
|
|
48
|
-
setPaging(page: number | undefined, perPage: number, doEmit?: boolean): void;
|
|
49
|
-
setPage(page: number, doEmit?: boolean): void;
|
|
50
|
-
getSort(): SmartTableSortItem[];
|
|
51
|
-
getFilter(): SmartTableFilterConf;
|
|
52
|
-
getPaging(): SmartTablePagingItem | false;
|
|
53
|
-
protected prepareData(data: T[]): T[];
|
|
12
|
+
readonly count: import("@angular/core").Signal<number>;
|
|
13
|
+
getSort(): SmartTableSortItem;
|
|
14
|
+
getFilters(): SmartTableFilterItem[];
|
|
15
|
+
emitOnChanged(event: SmartTableOnChangedEventToEmit): void;
|
|
54
16
|
protected sort(data: T[]): T[];
|
|
55
17
|
protected filter(data: T[]): T[];
|
|
56
18
|
protected paginate(data: T[]): T[];
|
|
19
|
+
private isPageOutOfBounce;
|
|
57
20
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
static filter(data: any[], field: string, search: string, customFilter?: Function): any[];
|
|
4
|
-
}
|
|
1
|
+
import { SmartTableFilterItem } from "../../interfaces/smart-table.models";
|
|
2
|
+
export declare function isElementSatisfied<T extends Record<string, unknown>>(element: T, filters: SmartTableFilterItem[]): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { SmartTableFilterItem, SmartTableOnChangedEventToEmit, SmartTablePagerSettings, SmartTableSortItem } from '../../interfaces/smart-table.models';
|
|
4
|
+
import { DataSource } from '../data-source';
|
|
5
|
+
export type ParamsPrepareFunction = (options: {
|
|
6
|
+
sort: SmartTableSortItem;
|
|
7
|
+
filters: SmartTableFilterItem[];
|
|
8
|
+
page: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
}) => Observable<HttpParams>;
|
|
11
|
+
export type RequestFunction<T extends Record<string, any> = any> = (params: HttpParams) => Observable<{
|
|
12
|
+
total: number;
|
|
13
|
+
data: T[];
|
|
14
|
+
}>;
|
|
15
|
+
export declare class ServerDataSource<T extends Record<string, any> = any> extends DataSource<T> {
|
|
16
|
+
private initPagingConf?;
|
|
17
|
+
readonly count: import("@angular/core").Signal<number>;
|
|
18
|
+
paramPrepareFunction: ParamsPrepareFunction;
|
|
19
|
+
requestFunction: RequestFunction<T>;
|
|
20
|
+
constructor(paramPrepareFunction: ParamsPrepareFunction, requestFunction: RequestFunction<T>, initPagingConf?: Partial<SmartTablePagerSettings> | undefined);
|
|
21
|
+
getAll(): Promise<T[]>;
|
|
22
|
+
getSort(): SmartTableSortItem;
|
|
23
|
+
getFilters(): SmartTableFilterItem[];
|
|
24
|
+
emitOnChanged(eventData: SmartTableOnChangedEventToEmit, newElements?: T[] | undefined): void;
|
|
25
|
+
}
|
package/lib/lib/grid.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { EventEmitter, OutputEmitterRef } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Row } from "./data-set/row";
|
|
7
|
-
import { ColumnPositionState, SmartTableSettings } from "./interfaces/smart-table.models";
|
|
1
|
+
import { EventEmitter, OutputEmitterRef } from '@angular/core';
|
|
2
|
+
import { DataSet } from './data-set/data-set';
|
|
3
|
+
import { Row } from './data-set/row';
|
|
4
|
+
import { DataSource } from './data-source/data-source';
|
|
5
|
+
import { ColumnPositionState, SmartTableSettings } from './interfaces/smart-table.models';
|
|
8
6
|
export declare class Grid {
|
|
9
7
|
createFormShown: boolean;
|
|
10
|
-
source:
|
|
8
|
+
source: DataSource;
|
|
11
9
|
dataSet: DataSet;
|
|
12
|
-
onSelectRowSource: Subject<any>;
|
|
13
|
-
onDeselectRowSource: Subject<any>;
|
|
14
10
|
currentColumnsSortState: ColumnPositionState[];
|
|
15
11
|
private columnsSortedEmitter;
|
|
16
12
|
private sourceOnChangedSubscription;
|
|
@@ -20,19 +16,15 @@ export declare class Grid {
|
|
|
20
16
|
readonly isActionsVisible: import("@angular/core").Signal<boolean>;
|
|
21
17
|
readonly actionIsOnLeft: import("@angular/core").Signal<boolean>;
|
|
22
18
|
readonly actionIsOnRight: import("@angular/core").Signal<boolean>;
|
|
23
|
-
constructor(source:
|
|
19
|
+
constructor(source: DataSource | undefined, settings: SmartTableSettings);
|
|
24
20
|
setColumnsSortedEmitter(emitter: OutputEmitterRef<ColumnPositionState[]>): void;
|
|
25
21
|
detach(): void;
|
|
26
22
|
getNewRow(): Row;
|
|
27
23
|
setSettings(settings: SmartTableSettings): void;
|
|
28
24
|
getDataSet(): DataSet;
|
|
29
25
|
getSetting<T>(name: string, defaultValue?: any): T;
|
|
30
|
-
getColumns(): Column[];
|
|
31
|
-
getRows(): Row[];
|
|
32
26
|
selectRow(row: Row, state: boolean): void;
|
|
33
27
|
multipleSelectRow(row: Row): void;
|
|
34
|
-
onSelectRow(): Observable<any>;
|
|
35
|
-
onDeselectRow(): Observable<any>;
|
|
36
28
|
edit(row: Row): void;
|
|
37
29
|
create(row: Row, confirmEmitter: EventEmitter<any> | OutputEmitterRef<any>): void;
|
|
38
30
|
save(row: Row, confirmEmitter: EventEmitter<any> | OutputEmitterRef<any>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Cell } from
|
|
2
|
-
import {
|
|
3
|
-
import { Deferred } from
|
|
1
|
+
import { Cell } from '../data-set/cell';
|
|
2
|
+
import { DataSource } from '../data-source/data-source';
|
|
3
|
+
import { Deferred } from '../helpers';
|
|
4
4
|
interface SelectOption {
|
|
5
5
|
title: string;
|
|
6
6
|
value: any;
|
|
@@ -18,7 +18,7 @@ export interface ColumnPositionState {
|
|
|
18
18
|
}
|
|
19
19
|
export interface SmartTableSettings<T extends Record<string, any> = any> {
|
|
20
20
|
selectMode?: 'single' | 'multi';
|
|
21
|
-
mode?:
|
|
21
|
+
mode?: 'inline' | 'external';
|
|
22
22
|
columnSortStorageKey?: string;
|
|
23
23
|
columnSort?: boolean;
|
|
24
24
|
hideHeader?: boolean;
|
|
@@ -52,7 +52,7 @@ export interface SmartTableSettings<T extends Record<string, any> = any> {
|
|
|
52
52
|
};
|
|
53
53
|
noDataMessage?: string;
|
|
54
54
|
columns: SmartTableColumnSettings<T>[];
|
|
55
|
-
pager?: SmartTablePagerSettings | false;
|
|
55
|
+
pager?: (Omit<SmartTablePagerSettings, 'total' | 'page'>) | false;
|
|
56
56
|
rowClassFunction?: (row: {
|
|
57
57
|
data: T;
|
|
58
58
|
}) => string;
|
|
@@ -123,20 +123,20 @@ interface SmartTableEditorCustom {
|
|
|
123
123
|
component: any;
|
|
124
124
|
config?: any;
|
|
125
125
|
}
|
|
126
|
-
interface SmartTablePagerSettings {
|
|
126
|
+
export interface SmartTablePagerSettings {
|
|
127
127
|
display: boolean;
|
|
128
|
-
page
|
|
128
|
+
page: number;
|
|
129
129
|
perPage: number;
|
|
130
130
|
perPageSelect?: number[];
|
|
131
|
+
total: number;
|
|
131
132
|
}
|
|
132
133
|
export interface SmartTableFilterItem {
|
|
134
|
+
/**
|
|
135
|
+
* key of column to filter
|
|
136
|
+
*/
|
|
133
137
|
field: string;
|
|
134
138
|
search: string;
|
|
135
|
-
filter?:
|
|
136
|
-
}
|
|
137
|
-
export interface SmartTablePagingItem {
|
|
138
|
-
page: number;
|
|
139
|
-
perPage: number;
|
|
139
|
+
filter?: SmartTableFilterFunction;
|
|
140
140
|
}
|
|
141
141
|
export type SmartTableSortDirection = 'asc' | 'desc';
|
|
142
142
|
export interface SmartTableSortItem {
|
|
@@ -147,21 +147,21 @@ export interface SmartTableSortItem {
|
|
|
147
147
|
interface SmartTableDefaultEvent<T> {
|
|
148
148
|
confirm: Deferred<T>;
|
|
149
149
|
data: T;
|
|
150
|
-
source:
|
|
150
|
+
source: DataSource<T>;
|
|
151
151
|
}
|
|
152
152
|
export type SmartTableConfirmDeleteEvent<T = any> = SmartTableDefaultEvent<T>;
|
|
153
|
-
export type SmartTableRowClickedEvent<T = any> = Omit<SmartTableDefaultEvent<T>,
|
|
154
|
-
export interface SmartTableCustomEvent<T = any> extends Omit<SmartTableDefaultEvent<T>,
|
|
153
|
+
export type SmartTableRowClickedEvent<T = any> = Omit<SmartTableDefaultEvent<T>, 'confirm'>;
|
|
154
|
+
export interface SmartTableCustomEvent<T = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
|
|
155
155
|
action: string;
|
|
156
156
|
}
|
|
157
|
-
export interface SmartTableRowSelectEvent<T = any> extends Omit<SmartTableDefaultEvent<T>,
|
|
157
|
+
export interface SmartTableRowSelectEvent<T = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
|
|
158
158
|
isSelected: boolean;
|
|
159
159
|
selected: T[];
|
|
160
160
|
}
|
|
161
161
|
export interface SmartTableConfirmEditEvent<T = any, N = T> extends SmartTableDefaultEvent<T> {
|
|
162
162
|
newData: N;
|
|
163
163
|
}
|
|
164
|
-
export interface SmartTableCreateConfirm<T = any> extends Omit<SmartTableDefaultEvent<T>,
|
|
164
|
+
export interface SmartTableCreateConfirm<T = any> extends Omit<SmartTableDefaultEvent<T>, 'data'> {
|
|
165
165
|
newData: T;
|
|
166
166
|
}
|
|
167
167
|
export type ObjectStringString = Record<string, string>;
|
|
@@ -176,19 +176,34 @@ export declare enum SmartTableOnChangedEventName {
|
|
|
176
176
|
'add' = "add",
|
|
177
177
|
'remove' = "remove",
|
|
178
178
|
'append' = "append",
|
|
179
|
+
'appendMany' = "appendMany",
|
|
179
180
|
'prepend' = "prepend",
|
|
180
|
-
'refresh' = "refresh"
|
|
181
|
+
'refresh' = "refresh",
|
|
182
|
+
'columnRefresh' = "columnRefresh"
|
|
181
183
|
}
|
|
182
184
|
export type SmartTableOnChangedEventType = `${SmartTableOnChangedEventName}`;
|
|
183
|
-
|
|
184
|
-
action: SmartTableOnChangedEventType;
|
|
185
|
+
interface SmartTableOnChangedEventBase<T extends Record<string, any> = any> {
|
|
185
186
|
elements: T[];
|
|
186
|
-
filter: SmartTableFilterConf;
|
|
187
|
-
paging: SmartTablePagingItem | false;
|
|
188
|
-
sort: SmartTableSortItem[];
|
|
189
|
-
}
|
|
190
|
-
export interface SmartTableFilterConf {
|
|
191
187
|
filters: SmartTableFilterItem[];
|
|
192
|
-
|
|
188
|
+
paging: SmartTablePagerSettings;
|
|
189
|
+
sort: SmartTableSortItem;
|
|
190
|
+
}
|
|
191
|
+
interface SmartTableOnChangedEventAll<T extends Record<string, any> = any> {
|
|
192
|
+
action: Exclude<SmartTableOnChangedEventType, 'remove' | 'update' | 'append' | 'prepend' | 'appendMany' | 'add'>;
|
|
193
|
+
}
|
|
194
|
+
interface SmartTableAddEvent<T extends Record<string, any> = any> {
|
|
195
|
+
action: SmartTableOnChangedEventName.add | SmartTableOnChangedEventName.prepend | SmartTableOnChangedEventName.append | SmartTableOnChangedEventName.appendMany;
|
|
196
|
+
newItems: T[];
|
|
197
|
+
}
|
|
198
|
+
interface SmartTableUpdateEvent<T extends Record<string, any> = any> {
|
|
199
|
+
action: SmartTableOnChangedEventName.update;
|
|
200
|
+
newItem: T;
|
|
201
|
+
oldItem: T;
|
|
202
|
+
}
|
|
203
|
+
interface SmartTableRemoveEvent<T extends Record<string, any> = any> {
|
|
204
|
+
action: SmartTableOnChangedEventName.remove;
|
|
205
|
+
item: T;
|
|
193
206
|
}
|
|
207
|
+
export type SmartTableOnChangedEventToEmit<T extends Record<string, any> = any> = SmartTableAddEvent<T> | SmartTableUpdateEvent<T> | SmartTableRemoveEvent<T> | SmartTableOnChangedEventAll<T>;
|
|
208
|
+
export type SmartTableOnChangedEvent<T extends Record<string, any> = any> = SmartTableOnChangedEventToEmit<T> & SmartTableOnChangedEventBase<T>;
|
|
194
209
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { OnChanges, OnDestroy, SimpleChange } from
|
|
2
|
-
import { Row } from
|
|
3
|
-
import {
|
|
4
|
-
import { Grid } from
|
|
5
|
-
import { ColumnPositionState, SmartTableConfirmDeleteEvent, SmartTableConfirmEditEvent, SmartTableCreateConfirm, SmartTableCustomEvent, SmartTableRowClickedEvent, SmartTableRowSelectEvent, SmartTableSettings } from
|
|
1
|
+
import { OnChanges, OnDestroy, SimpleChange } from '@angular/core';
|
|
2
|
+
import { Row } from './lib/data-set/row';
|
|
3
|
+
import { DataSource } from './lib/data-source/data-source';
|
|
4
|
+
import { Grid } from './lib/grid';
|
|
5
|
+
import { ColumnPositionState, SmartTableConfirmDeleteEvent, SmartTableConfirmEditEvent, SmartTableCreateConfirm, SmartTableCustomEvent, SmartTableRowClickedEvent, SmartTableRowSelectEvent, SmartTableSettings } from './lib/interfaces/smart-table.models';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class Ng2SmartTableComponent implements OnChanges, OnDestroy {
|
|
8
|
-
readonly source: import("@angular/core").InputSignal<
|
|
8
|
+
readonly source: import("@angular/core").InputSignal<DataSource<any>>;
|
|
9
9
|
readonly settings: import("@angular/core").InputSignal<SmartTableSettings<any>>;
|
|
10
10
|
readonly multiRowSelect: import("@angular/core").OutputEmitterRef<SmartTableRowSelectEvent<any>>;
|
|
11
11
|
readonly rowClicked: import("@angular/core").OutputEmitterRef<SmartTableRowClickedEvent>;
|
|
@@ -20,7 +20,6 @@ export declare class Ng2SmartTableComponent implements OnChanges, OnDestroy {
|
|
|
20
20
|
readonly createConfirm: import("@angular/core").OutputEmitterRef<SmartTableCreateConfirm<any>>;
|
|
21
21
|
protected readonly tableClass: import("@angular/core").Signal<string>;
|
|
22
22
|
protected readonly tableId: import("@angular/core").Signal<string>;
|
|
23
|
-
protected readonly perPageSelect: import("@angular/core").Signal<number[]>;
|
|
24
23
|
protected readonly isPagerDisplay: import("@angular/core").Signal<boolean>;
|
|
25
24
|
protected readonly rowClassFunction: import("@angular/core").Signal<(row: any) => string>;
|
|
26
25
|
grid: Grid;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { SmartTableColumnEditorDirective } from
|
|
4
|
-
export { Cell } from
|
|
5
|
-
export { Column } from
|
|
6
|
-
export { Row } from
|
|
7
|
-
export { DataSource } from
|
|
8
|
-
export { LocalDataSource } from
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export * from
|
|
1
|
+
export { BaseEditorComponent, Editor } from './lib/components/cell/cell-editors/base-editor.component';
|
|
2
|
+
export { BaseFilterComponent, FilterComponent } from './lib/components/filter/filter-types/base-filter.component';
|
|
3
|
+
export { SmartTableColumnEditorDirective } from './lib/components/table-columns-editor/column-editor.directive';
|
|
4
|
+
export { Cell } from './lib/lib/data-set/cell';
|
|
5
|
+
export { Column } from './lib/lib/data-set/column';
|
|
6
|
+
export { Row } from './lib/lib/data-set/row';
|
|
7
|
+
export { DataSource } from './lib/lib/data-source/data-source';
|
|
8
|
+
export { LocalDataSource } from './lib/lib/data-source/local/local.data-source';
|
|
9
|
+
export { ParamsPrepareFunction, RequestFunction, ServerDataSource } from './lib/lib/data-source/server/server.data-source';
|
|
10
|
+
export { Deferred } from './lib/lib/helpers';
|
|
11
|
+
export * from './lib/lib/interfaces/smart-table.models';
|
|
12
|
+
export * from './lib/ng2-smart-table.component';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SmartTableEditorAndFilterTypes } from "../../../lib/interfaces/smart-table.models";
|
|
2
|
-
import { EditCellDefaultComponent } from "./edit-cell-default";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class DefaultEditComponent extends EditCellDefaultComponent {
|
|
5
|
-
constructor();
|
|
6
|
-
getEditorType(): SmartTableEditorAndFilterTypes;
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultEditComponent, never>;
|
|
8
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultEditComponent, "ng2-table-cell-default-editor", never, {}, {}, never, never, true, never>;
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Cell } from '../../../lib/data-set/cell';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class EditCellDefaultComponent {
|
|
4
|
-
readonly cell: import("@angular/core").InputSignal<Cell>;
|
|
5
|
-
readonly inputClass: import("@angular/core").InputSignal<string>;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<EditCellDefaultComponent, never>;
|
|
7
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EditCellDefaultComponent, "ng2-edit-cell-default-base-component", never, { "cell": { "alias": "cell"; "required": true; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
8
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { InputSignal } from "@angular/core";
|
|
2
|
-
import { Cell } from "../../../lib/data-set/cell";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class DefaultEditor implements Editor {
|
|
5
|
-
readonly cell: InputSignal<Cell>;
|
|
6
|
-
readonly inputClass: InputSignal<string>;
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultEditor, never>;
|
|
8
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultEditor, "ng2-default-editor-base-component", never, { "cell": { "alias": "cell"; "required": true; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
|
-
}
|
|
10
|
-
export interface Editor {
|
|
11
|
-
cell: InputSignal<Cell>;
|
|
12
|
-
inputClass: InputSignal<string>;
|
|
13
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FilterDefault } from "./filter-default";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class DefaultFilterComponent extends FilterDefault {
|
|
4
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultFilterComponent, never>;
|
|
5
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultFilterComponent, "ng2-default-table-filter", never, {}, {}, never, never, true, never>;
|
|
6
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Column } from '../../lib/data-set/column';
|
|
2
|
-
import { LocalDataSource } from '../../lib/data-source/local/local.data-source';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class FilterDefault {
|
|
5
|
-
readonly column: import("@angular/core").InputSignal<Column>;
|
|
6
|
-
readonly source: import("@angular/core").InputSignal<LocalDataSource<any>>;
|
|
7
|
-
readonly inputClass: import("@angular/core").InputSignal<string>;
|
|
8
|
-
query: string;
|
|
9
|
-
readonly filter: import("@angular/core").OutputEmitterRef<any>;
|
|
10
|
-
onFilter(query: string): void;
|
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FilterDefault, never>;
|
|
12
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FilterDefault, "ng2-filter-default-component", never, { "column": { "alias": "column"; "required": true; "isSignal": true; }; "source": { "alias": "source"; "required": true; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; }; }, { "filter": "filter"; }, never, never, true, never>;
|
|
13
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, InputSignal, OnDestroy, OutputEmitterRef } from '@angular/core';
|
|
2
|
-
import { Subscription } from 'rxjs';
|
|
3
|
-
import { LocalDataSource } from 'ng2-smart-table';
|
|
4
|
-
import { Column } from '../../../lib/data-set/column';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class DefaultFilter implements Filter, OnDestroy {
|
|
7
|
-
delay: number;
|
|
8
|
-
changesSubscription?: Subscription;
|
|
9
|
-
query: string;
|
|
10
|
-
readonly inputClass: InputSignal<string>;
|
|
11
|
-
readonly source: InputSignal<LocalDataSource<any>>;
|
|
12
|
-
readonly column: InputSignal<Column>;
|
|
13
|
-
readonly filter: OutputEmitterRef<string>;
|
|
14
|
-
ngOnDestroy(): void;
|
|
15
|
-
setFilter(): void;
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultFilter, never>;
|
|
17
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultFilter, "ng2-default-base-filter-component", never, { "query": { "alias": "query"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "source": { "alias": "source"; "required": true; "isSignal": true; }; "column": { "alias": "column"; "required": true; "isSignal": true; }; }, { "filter": "filter"; }, never, never, true, never>;
|
|
18
|
-
}
|
|
19
|
-
export interface Filter {
|
|
20
|
-
delay?: number;
|
|
21
|
-
changesSubscription?: Subscription;
|
|
22
|
-
query: string;
|
|
23
|
-
inputClass: InputSignal<string>;
|
|
24
|
-
source: InputSignal<LocalDataSource>;
|
|
25
|
-
column: InputSignal<Column>;
|
|
26
|
-
filter: EventEmitter<string> | OutputEmitterRef<any>;
|
|
27
|
-
}
|