@den4ik92/ng2-smart-table 19.6.48 → 20.0.0
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 +252 -252
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
- package/index.d.ts +626 -5
- package/package.json +5 -5
- package/lib/components/cell/cell-edit-mode/build-in-editor.component.d.ts +0 -8
- package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +0 -11
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +0 -9
- package/lib/components/cell/cell-editors/base-editor.component.d.ts +0 -12
- package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +0 -11
- package/lib/components/cell/cell-editors/input-editor.component.d.ts +0 -6
- package/lib/components/cell/cell-editors/select-editor.component.d.ts +0 -6
- package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +0 -6
- package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +0 -11
- package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +0 -7
- package/lib/components/cell/cell.component.d.ts +0 -8
- package/lib/components/filter/build-in-filter.component.d.ts +0 -12
- package/lib/components/filter/custom-filter.component.d.ts +0 -16
- package/lib/components/filter/filter-types/base-filter.component.d.ts +0 -32
- package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +0 -11
- package/lib/components/filter/filter-types/input-filter.component.d.ts +0 -6
- package/lib/components/filter/filter-types/select-filter.component.d.ts +0 -12
- package/lib/components/filter/filter.component.d.ts +0 -12
- package/lib/components/pager/pager.component.d.ts +0 -24
- package/lib/components/table-columns-editor/column-editor.directive.d.ts +0 -19
- package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +0 -19
- package/lib/components/tbody/create-cancel/create-cancel.component.d.ts +0 -13
- package/lib/components/tbody/row-actions/row-actions.component.d.ts +0 -23
- package/lib/components/tbody/tbody.component.d.ts +0 -25
- package/lib/components/tbody/trow/trow.component.d.ts +0 -23
- package/lib/components/thead/cells/actions-title.component.d.ts +0 -8
- package/lib/components/thead/cells/add-button.component.d.ts +0 -11
- package/lib/components/thead/cells/checkbox-select-all.component.d.ts +0 -7
- package/lib/components/thead/cells/title/title.component.d.ts +0 -13
- package/lib/components/thead/mobile-filters/mobile-filters.component.d.ts +0 -21
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +0 -12
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +0 -12
- package/lib/components/thead/thead.component.d.ts +0 -26
- package/lib/lib/data-set/cell.d.ts +0 -17
- package/lib/lib/data-set/column.d.ts +0 -30
- package/lib/lib/data-set/data-set.d.ts +0 -39
- package/lib/lib/data-set/row.d.ts +0 -18
- package/lib/lib/data-source/data-source.d.ts +0 -37
- package/lib/lib/data-source/local/local.data-source.d.ts +0 -17
- package/lib/lib/data-source/local/local.filter.d.ts +0 -2
- package/lib/lib/data-source/local/local.pager.d.ts +0 -1
- package/lib/lib/data-source/local/local.sorter.d.ts +0 -3
- package/lib/lib/data-source/server/server.data-source.d.ts +0 -24
- package/lib/lib/grid.d.ts +0 -45
- package/lib/lib/helpers.d.ts +0 -25
- package/lib/lib/interfaces/smart-table.models.d.ts +0 -266
- package/lib/ng2-smart-table.component.d.ts +0 -91
- package/public-api.d.ts +0 -12
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import { Observable, Subject } from 'rxjs';
|
|
3
|
-
import { BaseDataType, SmartTableFilterItem, SmartTableOnChangedEvent, SmartTableOnChangedEventToEmit, SmartTablePagerSettings, SmartTableSortItem } from '../interfaces/smart-table.models';
|
|
4
|
-
export declare abstract class DataSource<T extends BaseDataType = any> {
|
|
5
|
-
protected readonly onChangedSource: Subject<SmartTableOnChangedEvent>;
|
|
6
|
-
protected readonly sortConf: import("@angular/core").WritableSignal<SmartTableSortItem | null>;
|
|
7
|
-
protected readonly filters: import("@angular/core").WritableSignal<SmartTableFilterItem[]>;
|
|
8
|
-
readonly pagingConf: import("@angular/core").WritableSignal<SmartTablePagerSettings>;
|
|
9
|
-
protected readonly data: import("@angular/core").WritableSignal<T[]>;
|
|
10
|
-
/**
|
|
11
|
-
* return all elements
|
|
12
|
-
*/
|
|
13
|
-
abstract getAll(): Promise<T[]>;
|
|
14
|
-
abstract count(): number;
|
|
15
|
-
readonly getSort: Signal<SmartTableSortItem | null>;
|
|
16
|
-
readonly getFilters: Signal<SmartTableFilterItem[]>;
|
|
17
|
-
refresh(): void;
|
|
18
|
-
columnRefresh(): void;
|
|
19
|
-
onChanged(): Observable<SmartTableOnChangedEvent>;
|
|
20
|
-
prepend(element: T): Promise<true>;
|
|
21
|
-
appendMany(elements: 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 | null, doEmit?: boolean): void;
|
|
27
|
-
addFilter(newFilter: SmartTableFilterItem, doEmit?: boolean): Promise<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;
|
|
32
|
-
/**
|
|
33
|
-
* @param difference number to plus total
|
|
34
|
-
* @example -2 or 2
|
|
35
|
-
*/
|
|
36
|
-
private updateTotal;
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SmartTableOnChangedEventToEmit } from '../../interfaces/smart-table.models';
|
|
2
|
-
import { DataSource } from '../data-source';
|
|
3
|
-
export declare class LocalDataSource<T extends Record<string, any> = any> extends DataSource<T> {
|
|
4
|
-
private readonly filteredAndSorted;
|
|
5
|
-
readonly paginatedList: import("@angular/core").Signal<T[]>;
|
|
6
|
-
readonly count: import("@angular/core").Signal<number>;
|
|
7
|
-
constructor(data?: T[]);
|
|
8
|
-
load(data: T[]): Promise<true>;
|
|
9
|
-
prepend(element: T): Promise<true>;
|
|
10
|
-
appendMany(elements: T[]): Promise<true>;
|
|
11
|
-
add(element: T): Promise<true>;
|
|
12
|
-
getAll(): Promise<T[]>;
|
|
13
|
-
reset(silent?: boolean): void;
|
|
14
|
-
emitOnChanged(event: SmartTableOnChangedEventToEmit, newElements?: T[]): Promise<void>;
|
|
15
|
-
protected paginate(data: T[]): T[];
|
|
16
|
-
private isPageOutOfBounce;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function paginateList(data: any[], page: number, perPage: number): any[];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SmartTableCompareFunction } from '../../interfaces/smart-table.models';
|
|
2
|
-
export declare function compareValues(direction: number, a: any, b: any): number;
|
|
3
|
-
export declare function localSort<T extends Record<string, any>>(data: T[], field: string, direction: string, customCompare?: SmartTableCompareFunction): T[];
|
|
@@ -1,24 +0,0 @@
|
|
|
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 | null;
|
|
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
|
-
paramPrepareFunction: ParamsPrepareFunction;
|
|
18
|
-
requestFunction: RequestFunction<T>;
|
|
19
|
-
readonly count: import("@angular/core").Signal<number>;
|
|
20
|
-
readonly pending: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
-
constructor(paramPrepareFunction: ParamsPrepareFunction, requestFunction: RequestFunction<T>, initPagingConf?: Partial<SmartTablePagerSettings> | undefined);
|
|
22
|
-
getAll(): Promise<T[]>;
|
|
23
|
-
emitOnChanged(eventData: SmartTableOnChangedEventToEmit, newElements?: T[] | undefined): void;
|
|
24
|
-
}
|
package/lib/lib/grid.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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 { BaseDataType, ColumnPositionState, SmartTableConfirmDeleteEvent, SmartTableSettings } from './interfaces/smart-table.models';
|
|
6
|
-
export declare class Grid {
|
|
7
|
-
source: DataSource;
|
|
8
|
-
dataSet: DataSet;
|
|
9
|
-
currentColumnsSortState: ColumnPositionState[];
|
|
10
|
-
private columnsSortedEmitter;
|
|
11
|
-
private sourceOnChangedSubscription;
|
|
12
|
-
readonly settings: import("@angular/core").WritableSignal<SmartTableSettings<any>>;
|
|
13
|
-
readonly createFormShown: import("@angular/core").WritableSignal<boolean>;
|
|
14
|
-
readonly isMultiSelectVisible: import("@angular/core").Signal<boolean>;
|
|
15
|
-
readonly isActionsVisible: import("@angular/core").Signal<boolean>;
|
|
16
|
-
readonly actionIsOnLeft: import("@angular/core").Signal<boolean>;
|
|
17
|
-
readonly actionIsOnRight: import("@angular/core").Signal<boolean>;
|
|
18
|
-
readonly columnSortDragDelay: import("@angular/core").Signal<number>;
|
|
19
|
-
private readonly columnStateStorageKey;
|
|
20
|
-
constructor(source: DataSource | undefined, settings: SmartTableSettings);
|
|
21
|
-
setColumnsSortedEmitter(emitter: OutputEmitterRef<ColumnPositionState[]>): void;
|
|
22
|
-
detach(): void;
|
|
23
|
-
getNewRow(): Row;
|
|
24
|
-
setSettings(settings: SmartTableSettings): void;
|
|
25
|
-
getDataSet(): DataSet;
|
|
26
|
-
getSetting<T>(name: string, defaultValue?: any): T;
|
|
27
|
-
selectRow(row: Row, state: boolean): void;
|
|
28
|
-
multipleSelectRow(row: Row): void;
|
|
29
|
-
edit(row: Row): void;
|
|
30
|
-
create(row: Row, confirmEmitter: EventEmitter<any> | OutputEmitterRef<any>): void;
|
|
31
|
-
save(row: Row, confirmEmitter: EventEmitter<any> | OutputEmitterRef<any>): void;
|
|
32
|
-
delete<T extends BaseDataType = BaseDataType>(row: Row, confirmEmitter: EventEmitter<SmartTableConfirmDeleteEvent<T>> | OutputEmitterRef<SmartTableConfirmDeleteEvent<T>>): void;
|
|
33
|
-
private processDataChange;
|
|
34
|
-
private prepareSource;
|
|
35
|
-
private getInitialSort;
|
|
36
|
-
getSelectedRowsData(): any[];
|
|
37
|
-
selectAllRows(status: boolean): void;
|
|
38
|
-
private updateSettingsAndDataSet;
|
|
39
|
-
private setSource;
|
|
40
|
-
private getSortedTableColumns;
|
|
41
|
-
applyColumnsSortState(state: ColumnPositionState[], emitEvent?: boolean): Promise<void>;
|
|
42
|
-
private setColumnsSortState;
|
|
43
|
-
private getColumnsStateFromSettings;
|
|
44
|
-
private getMergedColumnStates;
|
|
45
|
-
}
|
package/lib/lib/helpers.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extending object that entered in first argument.
|
|
3
|
-
*
|
|
4
|
-
* Returns extended object or false if have no target object or incorrect type.
|
|
5
|
-
*
|
|
6
|
-
* If you wish to clone source object (without modify it), just use empty new
|
|
7
|
-
* object as first argument, like this:
|
|
8
|
-
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
9
|
-
*/
|
|
10
|
-
export declare const deepExtend: (...objects: any[]) => any;
|
|
11
|
-
export declare class Deferred<T> {
|
|
12
|
-
promise: Promise<T>;
|
|
13
|
-
resolve: (value?: T) => void;
|
|
14
|
-
reject: (reason?: string) => void;
|
|
15
|
-
constructor();
|
|
16
|
-
}
|
|
17
|
-
export declare function getDeepFromObject(object: {} | undefined, name: string, defaultValue?: any): any;
|
|
18
|
-
export declare function getPageForRowIndex(index: number, perPage: number): number;
|
|
19
|
-
export declare function cloneArrayOfObject<T>(array: T[]): T[];
|
|
20
|
-
export declare function getRandomId(prefix?: string, suffix?: string): string;
|
|
21
|
-
export declare function setLocalStorage(key: string, value: string | object | boolean): void;
|
|
22
|
-
export declare function getLocalStorage<T = string>(key: string): T | null;
|
|
23
|
-
export declare function compareObjectsAsJSON<T extends Record<string, unknown>>(a: T, b: T): boolean;
|
|
24
|
-
export declare function isObjectsIdentical<T extends Record<string, unknown>>(a: T, b: T): boolean;
|
|
25
|
-
export declare function CheckParentElementClassRecursive(element: HTMLElement | null, className: string): boolean;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from '@angular/cdk/portal';
|
|
2
|
-
import { InputSignal } from '@angular/core';
|
|
3
|
-
import { Cell } from '../data-set/cell';
|
|
4
|
-
import { DataSource } from '../data-source/data-source';
|
|
5
|
-
import { Deferred } from '../helpers';
|
|
6
|
-
interface SelectOption {
|
|
7
|
-
title: string;
|
|
8
|
-
value: any;
|
|
9
|
-
}
|
|
10
|
-
export type BaseDataType = Record<string, any>;
|
|
11
|
-
export interface ViewCell<V = any, R extends BaseDataType = BaseDataType> {
|
|
12
|
-
value: InputSignal<V>;
|
|
13
|
-
rowData: InputSignal<R>;
|
|
14
|
-
}
|
|
15
|
-
export type ActionPosition = 'left' | 'right';
|
|
16
|
-
export interface ColumnPositionState {
|
|
17
|
-
key: string;
|
|
18
|
-
title: string;
|
|
19
|
-
hide: boolean;
|
|
20
|
-
moveDisabled: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface SmartTableSettings<T extends BaseDataType = any> {
|
|
23
|
-
selectMode?: 'single' | 'multi';
|
|
24
|
-
mode?: 'inline' | 'external';
|
|
25
|
-
resetSortOnThirdClick?: boolean;
|
|
26
|
-
columnSort?: {
|
|
27
|
-
/**
|
|
28
|
-
* @description save table columns state in local storage and use it after init
|
|
29
|
-
*/
|
|
30
|
-
stateStorageKey?: string;
|
|
31
|
-
/**
|
|
32
|
-
* @description delay to start move column card
|
|
33
|
-
* @default 0
|
|
34
|
-
*/
|
|
35
|
-
dragDelay?: number;
|
|
36
|
-
active: boolean;
|
|
37
|
-
};
|
|
38
|
-
hideHeader?: boolean;
|
|
39
|
-
hideSubHeader?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* @description Breakpoint for mobile table width in pixels if table width is less than this value, table will be displayed in mobile mode
|
|
42
|
-
* @example 768
|
|
43
|
-
*/
|
|
44
|
-
tableWidthMobileBreakpoint?: number;
|
|
45
|
-
actions?: SmartTableAction<T> | false;
|
|
46
|
-
actionsPosition?: ActionPosition;
|
|
47
|
-
filter?: {
|
|
48
|
-
inputClass: string;
|
|
49
|
-
};
|
|
50
|
-
edit?: {
|
|
51
|
-
inputClass?: string;
|
|
52
|
-
editButtonContent?: string;
|
|
53
|
-
saveButtonContent?: string;
|
|
54
|
-
cancelButtonContent?: string;
|
|
55
|
-
confirmSave?: boolean;
|
|
56
|
-
hasPermissionFunction?: (row: T) => boolean;
|
|
57
|
-
} | false;
|
|
58
|
-
add?: {
|
|
59
|
-
inputClass?: string;
|
|
60
|
-
addButtonContent?: string;
|
|
61
|
-
createButtonContent?: string;
|
|
62
|
-
cancelButtonContent?: string;
|
|
63
|
-
confirmCreate?: boolean;
|
|
64
|
-
} | false;
|
|
65
|
-
delete?: {
|
|
66
|
-
deleteButtonContent?: string;
|
|
67
|
-
confirmDelete?: boolean;
|
|
68
|
-
hasPermissionFunction?: (row: T) => boolean;
|
|
69
|
-
} | false;
|
|
70
|
-
attr?: {
|
|
71
|
-
id?: string;
|
|
72
|
-
class?: string;
|
|
73
|
-
};
|
|
74
|
-
noDataMessage?: string;
|
|
75
|
-
columns: SmartTableColumnSettings<T>[];
|
|
76
|
-
pager?: Omit<SmartTablePagerSettings, 'total' | 'page'> | false;
|
|
77
|
-
rowClassFunction?: (rowData: T) => string;
|
|
78
|
-
}
|
|
79
|
-
export interface SmartTableAction<T extends BaseDataType = any> {
|
|
80
|
-
columnTitle?: string;
|
|
81
|
-
add?: boolean;
|
|
82
|
-
edit?: boolean;
|
|
83
|
-
delete?: boolean;
|
|
84
|
-
custom?: SmartTableCustomAction<T>[];
|
|
85
|
-
}
|
|
86
|
-
export interface SmartTableCustomAction<T extends BaseDataType = any> {
|
|
87
|
-
name: string;
|
|
88
|
-
title: string;
|
|
89
|
-
hasPermissionFunction?: (row: T) => boolean;
|
|
90
|
-
}
|
|
91
|
-
export type SmartTableColumnSettingsTypes = 'text' | 'html' | 'custom';
|
|
92
|
-
export type SmartTableColumnSettings<T extends BaseDataType = any> = SmartTableTextHtmlColumn<T> | SmartTableCustomColumn<T>;
|
|
93
|
-
export type SmartTableCompareFunction = (direction: number, a: any, b: any) => number;
|
|
94
|
-
export type SmartTableValuePrepareFunction<T extends BaseDataType = any> = (columnData: any, rowData: T, cell: Cell) => any;
|
|
95
|
-
export type SmartTableFilterFunction = (columnData: any, search: string) => boolean;
|
|
96
|
-
interface SmartTableDefaultColumn<T extends BaseDataType> {
|
|
97
|
-
key: keyof T;
|
|
98
|
-
title: string;
|
|
99
|
-
style?: Partial<CSSStyleDeclaration>;
|
|
100
|
-
width?: string;
|
|
101
|
-
class?: string;
|
|
102
|
-
editable?: boolean;
|
|
103
|
-
hide?: boolean;
|
|
104
|
-
moveDisabled?: boolean;
|
|
105
|
-
sort?: boolean;
|
|
106
|
-
addable?: boolean;
|
|
107
|
-
sortDirection?: SmartTableSortDirection | false;
|
|
108
|
-
editor?: SmartTableEditorAndFilter;
|
|
109
|
-
filter?: SmartTableEditorAndFilter | false;
|
|
110
|
-
compareFunction?: SmartTableCompareFunction;
|
|
111
|
-
valuePrepareFunction?: SmartTableValuePrepareFunction<T>;
|
|
112
|
-
filterFunction?: SmartTableFilterFunction;
|
|
113
|
-
}
|
|
114
|
-
interface SmartTableTextHtmlColumn<T extends BaseDataType> extends SmartTableDefaultColumn<T> {
|
|
115
|
-
type: 'text' | 'html';
|
|
116
|
-
}
|
|
117
|
-
interface SmartTableCustomColumn<T extends BaseDataType> extends SmartTableDefaultColumn<T> {
|
|
118
|
-
type: 'custom';
|
|
119
|
-
renderComponent: ComponentType<any>;
|
|
120
|
-
/**
|
|
121
|
-
* @description you can set any component inputs.
|
|
122
|
-
* inputs value is not updated when changed. set once onInit.
|
|
123
|
-
* make sure to set the correct input name to prevent setInput error
|
|
124
|
-
*/
|
|
125
|
-
inputs?: Record<string, any>;
|
|
126
|
-
}
|
|
127
|
-
export type SmartTableEditorAndFilterTypes = 'text' | 'textarea' | 'list' | 'custom' | 'checkbox';
|
|
128
|
-
export type SmartTableEditorAndFilter = SmartTableTextEditor | SmartTableEditorList | SmartTableEditorCheckbox | SmartTableEditorCustom;
|
|
129
|
-
interface SmartTableTextEditor {
|
|
130
|
-
type: 'text' | 'textarea';
|
|
131
|
-
config?: {
|
|
132
|
-
placeholder?: string;
|
|
133
|
-
} & Record<string, any>;
|
|
134
|
-
}
|
|
135
|
-
interface SmartTableEditorList {
|
|
136
|
-
type: 'list';
|
|
137
|
-
config: {
|
|
138
|
-
placeholder?: string;
|
|
139
|
-
selectText?: string;
|
|
140
|
-
list: SelectOption[];
|
|
141
|
-
} & Record<string, any>;
|
|
142
|
-
}
|
|
143
|
-
interface SmartTableEditorCheckbox {
|
|
144
|
-
type: 'checkbox';
|
|
145
|
-
config?: {
|
|
146
|
-
true: any;
|
|
147
|
-
false: any;
|
|
148
|
-
resetText?: string;
|
|
149
|
-
} & Record<string, any>;
|
|
150
|
-
}
|
|
151
|
-
export interface SmartTableEditorCustom {
|
|
152
|
-
type: 'custom';
|
|
153
|
-
component: ComponentType<any>;
|
|
154
|
-
config?: {
|
|
155
|
-
placeholder?: string;
|
|
156
|
-
/**
|
|
157
|
-
* @description you can set any component inputs.
|
|
158
|
-
* inputs value is not updated when changed. set once onInit.
|
|
159
|
-
* make sure to set the correct input name to prevent setInput error
|
|
160
|
-
*/
|
|
161
|
-
inputs?: Record<string, any>;
|
|
162
|
-
} & Record<string, any>;
|
|
163
|
-
}
|
|
164
|
-
export interface SmartTablePagerSettings {
|
|
165
|
-
display: boolean;
|
|
166
|
-
nextButtonText?: string;
|
|
167
|
-
previewButtonText?: string;
|
|
168
|
-
showTotal?: boolean;
|
|
169
|
-
page: number;
|
|
170
|
-
perPage: number;
|
|
171
|
-
perPageSelect?: number[];
|
|
172
|
-
total: number;
|
|
173
|
-
}
|
|
174
|
-
export interface SmartTableFilterItem {
|
|
175
|
-
/**
|
|
176
|
-
* key of column to filter
|
|
177
|
-
*/
|
|
178
|
-
type: SmartTableEditorAndFilterTypes;
|
|
179
|
-
field: string;
|
|
180
|
-
search: string;
|
|
181
|
-
filter?: SmartTableFilterFunction;
|
|
182
|
-
}
|
|
183
|
-
export type SmartTableSortDirection = 'asc' | 'desc';
|
|
184
|
-
export interface SmartTableSortItem {
|
|
185
|
-
field: string;
|
|
186
|
-
title: string;
|
|
187
|
-
direction: SmartTableSortDirection;
|
|
188
|
-
compare?: SmartTableCompareFunction;
|
|
189
|
-
}
|
|
190
|
-
interface SmartTableDefaultEvent<T extends BaseDataType = any> {
|
|
191
|
-
confirm: Deferred<T>;
|
|
192
|
-
data: T;
|
|
193
|
-
source: DataSource<T>;
|
|
194
|
-
}
|
|
195
|
-
export type SmartTableConfirmDeleteEvent<T extends BaseDataType = any> = SmartTableDefaultEvent<T>;
|
|
196
|
-
export type SmartTableRowClickedEvent<T extends BaseDataType = any> = Omit<SmartTableDefaultEvent<T>, 'confirm'>;
|
|
197
|
-
export interface SmartTableCustomEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
|
|
198
|
-
action: string;
|
|
199
|
-
}
|
|
200
|
-
export interface SmartTableRowSelectEvent<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'confirm'> {
|
|
201
|
-
isSelected: boolean;
|
|
202
|
-
selected: T[];
|
|
203
|
-
}
|
|
204
|
-
export interface SmartTableConfirmEditEvent<T extends BaseDataType = any, N = T> extends SmartTableDefaultEvent<T> {
|
|
205
|
-
newData: N;
|
|
206
|
-
}
|
|
207
|
-
export interface SmartTableCreateConfirm<T extends BaseDataType = any> extends Omit<SmartTableDefaultEvent<T>, 'data'> {
|
|
208
|
-
newData: T;
|
|
209
|
-
}
|
|
210
|
-
export declare enum SmartTableOnChangedEventName {
|
|
211
|
-
'load' = "load",
|
|
212
|
-
'paging' = "paging",
|
|
213
|
-
'update' = "update",
|
|
214
|
-
'page' = "page",
|
|
215
|
-
'filter' = "filter",
|
|
216
|
-
'empty' = "empty",
|
|
217
|
-
'sort' = "sort",
|
|
218
|
-
'add' = "add",
|
|
219
|
-
'remove' = "remove",
|
|
220
|
-
'appendMany' = "appendMany",
|
|
221
|
-
'prepend' = "prepend",
|
|
222
|
-
'refresh' = "refresh",
|
|
223
|
-
'columnRefresh' = "columnRefresh"
|
|
224
|
-
}
|
|
225
|
-
export type SmartTableOnChangedEventType = `${SmartTableOnChangedEventName}`;
|
|
226
|
-
interface SmartTableOnChangedEventBase<T extends BaseDataType = any> {
|
|
227
|
-
elements: T[];
|
|
228
|
-
filters: SmartTableFilterItem[];
|
|
229
|
-
paging: SmartTablePagerSettings;
|
|
230
|
-
sort: SmartTableSortItem | null;
|
|
231
|
-
}
|
|
232
|
-
interface SmartTableOnChangedEventAll {
|
|
233
|
-
action: Exclude<SmartTableOnChangedEventType, 'remove' | 'update' | 'append' | 'prepend' | 'appendMany' | 'add'>;
|
|
234
|
-
}
|
|
235
|
-
interface SmartTableAddEvent<T extends BaseDataType = any> {
|
|
236
|
-
action: SmartTableOnChangedEventName.add | SmartTableOnChangedEventName.prepend | SmartTableOnChangedEventName.appendMany;
|
|
237
|
-
newItems: T[];
|
|
238
|
-
}
|
|
239
|
-
interface SmartTableUpdateEvent<T extends BaseDataType = any> {
|
|
240
|
-
action: SmartTableOnChangedEventName.update;
|
|
241
|
-
newItem: T;
|
|
242
|
-
oldItem: T;
|
|
243
|
-
}
|
|
244
|
-
interface SmartTableRemoveEvent<T extends BaseDataType = any> {
|
|
245
|
-
action: SmartTableOnChangedEventName.remove;
|
|
246
|
-
item: T;
|
|
247
|
-
}
|
|
248
|
-
export type SmartTableOnChangedEventToEmit<T extends BaseDataType = any> = SmartTableAddEvent<T> | SmartTableUpdateEvent<T> | SmartTableRemoveEvent<T> | SmartTableOnChangedEventAll;
|
|
249
|
-
export type SmartTableOnChangedEvent<T extends BaseDataType = any> = SmartTableOnChangedEventToEmit<T> & SmartTableOnChangedEventBase<T>;
|
|
250
|
-
export interface SmartTableConfirmEvent<T extends BaseDataType = any> {
|
|
251
|
-
confirm: {
|
|
252
|
-
resolve: (data?: T) => void;
|
|
253
|
-
reject: () => void;
|
|
254
|
-
};
|
|
255
|
-
data: T;
|
|
256
|
-
source: DataSource<T>;
|
|
257
|
-
}
|
|
258
|
-
export interface SmartTableBaseEvent<T extends BaseDataType = any> {
|
|
259
|
-
data: T | null;
|
|
260
|
-
source: DataSource<T>;
|
|
261
|
-
}
|
|
262
|
-
export type SmartTableCreateEvent<T extends BaseDataType = any> = SmartTableBaseEvent<T>;
|
|
263
|
-
export type SmartTableEditEvent<T extends BaseDataType = any> = SmartTableBaseEvent<T>;
|
|
264
|
-
export type SmartTableDeleteEvent<T extends BaseDataType = any> = SmartTableConfirmEvent<T>;
|
|
265
|
-
export type SmartTableEditCancelEvent<T extends BaseDataType = any> = SmartTableBaseEvent<T>;
|
|
266
|
-
export {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, ElementRef, Injector, NgZone, OnChanges, OnDestroy, SimpleChange, TemplateRef, ViewContainerRef } 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 { BaseDataType, ColumnPositionState, SmartTableBaseEvent, SmartTableConfirmDeleteEvent, SmartTableConfirmEditEvent, SmartTableCreateConfirm, SmartTableCustomEvent, SmartTableRowClickedEvent, SmartTableRowSelectEvent, SmartTableSettings } from './lib/interfaces/smart-table.models';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class Ng2SmartTableComponent<T extends BaseDataType = any> implements OnChanges, OnDestroy, AfterViewInit {
|
|
8
|
-
private elementRef;
|
|
9
|
-
private ngZone;
|
|
10
|
-
private injector;
|
|
11
|
-
readonly source: import("@angular/core").InputSignal<DataSource<T>>;
|
|
12
|
-
readonly settings: import("@angular/core").InputSignal<SmartTableSettings<T>>;
|
|
13
|
-
/**
|
|
14
|
-
* @description If you want to display pagination in your custom container, you can pass it to "paginationSlot".
|
|
15
|
-
* @example
|
|
16
|
-
* <ng2-smart-table
|
|
17
|
-
* [paginationSlot]="paginationContainerRef()">
|
|
18
|
-
* </ng2-smart-table>
|
|
19
|
-
* <div #paginationSlot>
|
|
20
|
-
* </div>
|
|
21
|
-
* inside component
|
|
22
|
-
* readonly paginationContainerRef = viewChild('paginationSlot', {
|
|
23
|
-
* read: ViewContainerRef,
|
|
24
|
-
* });
|
|
25
|
-
*/
|
|
26
|
-
readonly paginationSlot: import("@angular/core").InputSignal<ViewContainerRef | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* @description if you want to render custom data inside a container with pagination you can pass a TemplateRef
|
|
29
|
-
* @example
|
|
30
|
-
* <ng2-smart-table
|
|
31
|
-
* [paginationTemplateData]="paginationData"
|
|
32
|
-
* >
|
|
33
|
-
* </ng2-smart-table>
|
|
34
|
-
* <ng-template #paginationData
|
|
35
|
-
* >
|
|
36
|
-
* any data
|
|
37
|
-
* </ng-template>
|
|
38
|
-
* ----- or another option, will work only if you do not use paginationSlot
|
|
39
|
-
* <ng2-smart-table
|
|
40
|
-
* [paginationTemplateData]="paginationData"
|
|
41
|
-
* >
|
|
42
|
-
* <ng-container pager-content>
|
|
43
|
-
* some content will be rendered in the pager
|
|
44
|
-
* </ng-container>
|
|
45
|
-
* </ng2-smart-table>
|
|
46
|
-
*/
|
|
47
|
-
readonly paginationTemplateData: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
48
|
-
readonly multiRowSelect: import("@angular/core").OutputEmitterRef<SmartTableRowSelectEvent<T>>;
|
|
49
|
-
readonly rowClicked: import("@angular/core").OutputEmitterRef<SmartTableRowClickedEvent<T>>;
|
|
50
|
-
readonly columnsSorted: import("@angular/core").OutputEmitterRef<ColumnPositionState[]>;
|
|
51
|
-
readonly deleteEmitter: import("@angular/core").OutputEmitterRef<SmartTableBaseEvent<T>>;
|
|
52
|
-
readonly deleteConfirm: import("@angular/core").OutputEmitterRef<SmartTableConfirmDeleteEvent<T>>;
|
|
53
|
-
readonly edit: import("@angular/core").OutputEmitterRef<SmartTableBaseEvent<T>>;
|
|
54
|
-
readonly editConfirm: import("@angular/core").OutputEmitterRef<SmartTableConfirmEditEvent<T, T>>;
|
|
55
|
-
readonly editCancel: import("@angular/core").OutputEmitterRef<SmartTableBaseEvent<T>>;
|
|
56
|
-
readonly create: import("@angular/core").OutputEmitterRef<SmartTableBaseEvent<T>>;
|
|
57
|
-
readonly createConfirm: import("@angular/core").OutputEmitterRef<SmartTableCreateConfirm<T>>;
|
|
58
|
-
readonly custom: import("@angular/core").OutputEmitterRef<SmartTableCustomEvent<T>>;
|
|
59
|
-
protected readonly tableClass: import("@angular/core").Signal<string>;
|
|
60
|
-
protected readonly tableId: import("@angular/core").Signal<string>;
|
|
61
|
-
protected readonly isPagerDisplay: import("@angular/core").Signal<boolean>;
|
|
62
|
-
protected readonly rowClassFunction: import("@angular/core").Signal<(rowData: T) => string>;
|
|
63
|
-
protected readonly isMobileView: import("@angular/core").WritableSignal<boolean>;
|
|
64
|
-
protected readonly tableWidthMobileBreakpoint: import("@angular/core").Signal<number | undefined>;
|
|
65
|
-
grid: Grid;
|
|
66
|
-
private readonly isExternalMode;
|
|
67
|
-
private resizeObserver;
|
|
68
|
-
private resizeDebounceTimer;
|
|
69
|
-
private paginationComponentRef;
|
|
70
|
-
constructor(elementRef: ElementRef, ngZone: NgZone, injector: Injector);
|
|
71
|
-
ngOnChanges({ settings }: Record<string, SimpleChange>): void;
|
|
72
|
-
ngAfterViewInit(): void;
|
|
73
|
-
ngOnDestroy(): void;
|
|
74
|
-
protected multipleSelectRow(row: Row): void;
|
|
75
|
-
protected onSelectAllRows(): void;
|
|
76
|
-
protected onSelectRow(row: Row, state: boolean): void;
|
|
77
|
-
protected emitUserRowClicked(row: Row): void;
|
|
78
|
-
protected customActionEmitted(event: SmartTableCustomEvent<T>): void;
|
|
79
|
-
protected editEmitted(row: Row): void;
|
|
80
|
-
protected editConfirmed(row: Row): void;
|
|
81
|
-
protected editCanceled(row: Row): void;
|
|
82
|
-
protected createEmitted(): void;
|
|
83
|
-
protected createConfirmed(): void;
|
|
84
|
-
protected deleEmitted(row: Row): void;
|
|
85
|
-
private initGrid;
|
|
86
|
-
private emitUserSelectRow;
|
|
87
|
-
private setupResizeObserver;
|
|
88
|
-
private destroyResizeObserver;
|
|
89
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<Ng2SmartTableComponent<any>, never>;
|
|
90
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Ng2SmartTableComponent<any>, "ng2-smart-table", never, { "source": { "alias": "source"; "required": true; "isSignal": true; }; "settings": { "alias": "settings"; "required": true; "isSignal": true; }; "paginationSlot": { "alias": "paginationSlot"; "required": false; "isSignal": true; }; "paginationTemplateData": { "alias": "paginationTemplateData"; "required": false; "isSignal": true; }; }, { "multiRowSelect": "multiRowSelect"; "rowClicked": "rowClicked"; "columnsSorted": "columnsSorted"; "deleteEmitter": "deleteEmitter"; "deleteConfirm": "deleteConfirm"; "edit": "edit"; "editConfirm": "editConfirm"; "editCancel": "editCancel"; "create": "create"; "createConfirm": "createConfirm"; "custom": "custom"; }, never, ["[pager-content]"], true, never>;
|
|
91
|
-
}
|
package/public-api.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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';
|