@oscarpalmer/tabela 0.11.0 → 0.12.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/dist/components/column.component.js +4 -4
- package/dist/components/group.component.js +28 -0
- package/dist/helpers/dom.helpers.js +1 -1
- package/dist/managers/data.manager.js +76 -15
- package/dist/managers/event.manager.js +3 -0
- package/dist/managers/filter.manager.js +5 -0
- package/dist/managers/group.manager.js +46 -0
- package/dist/managers/navigation.manager.js +1 -1
- package/dist/managers/render.manager.js +35 -10
- package/dist/managers/selection.manager.js +32 -27
- package/dist/managers/sort.manager.js +29 -2
- package/dist/models/group.model.js +0 -0
- package/dist/models/selection.model.js +0 -0
- package/dist/tabela.full.js +364 -398
- package/dist/tabela.js +4 -1
- package/package.json +1 -1
- package/src/components/column.component.ts +6 -6
- package/src/components/group.component.ts +43 -0
- package/src/components/row.component.ts +2 -2
- package/src/helpers/dom.helpers.ts +3 -1
- package/src/managers/column.manager.ts +4 -4
- package/src/managers/data.manager.ts +155 -21
- package/src/managers/event.manager.ts +7 -3
- package/src/managers/filter.manager.ts +19 -11
- package/src/managers/group.manager.ts +79 -0
- package/src/managers/navigation.manager.ts +6 -5
- package/src/managers/render.manager.ts +55 -17
- package/src/managers/row.manager.ts +2 -2
- package/src/managers/selection.manager.ts +48 -41
- package/src/managers/sort.manager.ts +76 -13
- package/src/models/column.model.ts +2 -2
- package/src/models/data.model.ts +14 -3
- package/src/models/filter.model.ts +11 -3
- package/src/models/group.model.ts +4 -0
- package/src/models/render.model.ts +2 -2
- package/src/models/selection.model.ts +9 -0
- package/src/models/sort.model.ts +11 -3
- package/src/models/tabela.model.ts +7 -41
- package/src/models/tabela.options.ts +3 -2
- package/src/tabela.ts +11 -12
- package/types/components/column.component.d.ts +3 -3
- package/types/components/group.component.d.ts +14 -0
- package/types/components/row.component.d.ts +2 -2
- package/types/helpers/style.helper.d.ts +1 -1
- package/types/managers/column.manager.d.ts +5 -5
- package/types/managers/data.manager.d.ts +5 -3
- package/types/managers/event.manager.d.ts +3 -3
- package/types/managers/filter.manager.d.ts +11 -11
- package/types/managers/group.manager.d.ts +17 -0
- package/types/managers/navigation.manager.d.ts +3 -3
- package/types/managers/render.manager.d.ts +4 -3
- package/types/managers/row.manager.d.ts +3 -3
- package/types/managers/selection.manager.d.ts +12 -6
- package/types/managers/sort.manager.d.ts +10 -8
- package/types/models/column.model.d.ts +2 -2
- package/types/models/data.model.d.ts +13 -3
- package/types/models/filter.model.d.ts +10 -3
- package/types/models/group.model.d.ts +4 -0
- package/types/models/render.model.d.ts +2 -2
- package/types/models/selection.model.d.ts +8 -0
- package/types/models/sort.model.d.ts +10 -3
- package/types/models/tabela.model.d.ts +7 -37
- package/types/models/tabela.options.d.ts +3 -2
- package/types/tabela.d.ts +4 -1
package/src/tabela.ts
CHANGED
|
@@ -5,24 +5,21 @@ import {ColumnManager} from './managers/column.manager';
|
|
|
5
5
|
import {DataManager} from './managers/data.manager';
|
|
6
6
|
import {EventManager} from './managers/event.manager';
|
|
7
7
|
import {FilterManager} from './managers/filter.manager';
|
|
8
|
+
import {GroupManager} from './managers/group.manager';
|
|
8
9
|
import {NavigationManager} from './managers/navigation.manager';
|
|
9
10
|
import {RenderManager} from './managers/render.manager';
|
|
10
11
|
import {RowManager} from './managers/row.manager';
|
|
11
12
|
import {SelectionManager} from './managers/selection.manager';
|
|
12
13
|
import {SortManager} from './managers/sort.manager';
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
TabelaSelection,
|
|
19
|
-
TabelaSort,
|
|
20
|
-
TabelaState,
|
|
21
|
-
} from './models/tabela.model';
|
|
14
|
+
import type {TabelaData} from './models/data.model';
|
|
15
|
+
import type {TabelaFilter} from './models/filter.model';
|
|
16
|
+
import type {TabelaSelection} from './models/selection.model';
|
|
17
|
+
import type {TabelaSort} from './models/sort.model';
|
|
18
|
+
import type {Components, Managers, State} from './models/tabela.model';
|
|
22
19
|
import type {TabelaOptions} from './models/tabela.options';
|
|
23
20
|
|
|
24
21
|
export class Tabela {
|
|
25
|
-
readonly #components:
|
|
22
|
+
readonly #components: Components = {
|
|
26
23
|
header: undefined as never,
|
|
27
24
|
body: undefined as never,
|
|
28
25
|
footer: undefined as never,
|
|
@@ -34,11 +31,12 @@ export class Tabela {
|
|
|
34
31
|
|
|
35
32
|
readonly #key: string;
|
|
36
33
|
|
|
37
|
-
readonly #managers:
|
|
34
|
+
readonly #managers: Managers = {
|
|
38
35
|
column: undefined as never,
|
|
39
36
|
data: undefined as never,
|
|
40
37
|
event: undefined as never,
|
|
41
38
|
filter: undefined as never,
|
|
39
|
+
group: undefined as never,
|
|
42
40
|
navigation: undefined as never,
|
|
43
41
|
render: undefined as never,
|
|
44
42
|
row: undefined as never,
|
|
@@ -74,7 +72,7 @@ export class Tabela {
|
|
|
74
72
|
this.#components.body = new BodyComponent();
|
|
75
73
|
this.#components.footer = new FooterComponent();
|
|
76
74
|
|
|
77
|
-
const state:
|
|
75
|
+
const state: State = {
|
|
78
76
|
element,
|
|
79
77
|
options,
|
|
80
78
|
components: this.#components,
|
|
@@ -87,6 +85,7 @@ export class Tabela {
|
|
|
87
85
|
this.#managers.data = new DataManager(state);
|
|
88
86
|
this.#managers.event = new EventManager(state);
|
|
89
87
|
this.#managers.filter = new FilterManager(state);
|
|
88
|
+
this.#managers.group = new GroupManager(state);
|
|
90
89
|
this.#managers.navigation = new NavigationManager(state);
|
|
91
90
|
this.#managers.render = new RenderManager(state);
|
|
92
91
|
this.#managers.row = new RowManager(state);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Column, TabelaColumn } from '../models/column.model';
|
|
2
2
|
export declare class ColumnComponent {
|
|
3
3
|
elements: ColumnElements;
|
|
4
|
-
options:
|
|
5
|
-
constructor(
|
|
4
|
+
options: Column;
|
|
5
|
+
constructor(column: TabelaColumn);
|
|
6
6
|
destroy(): void;
|
|
7
7
|
}
|
|
8
8
|
type ColumnElements = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { State } from '../models/tabela.model';
|
|
2
|
+
export declare class GroupComponent {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly value: unknown;
|
|
6
|
+
element: HTMLElement | undefined;
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
filtered: number;
|
|
9
|
+
selected: number;
|
|
10
|
+
total: number;
|
|
11
|
+
constructor(key: string, label: string, value: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare function renderGroup(state: State, component: GroupComponent): void;
|
|
14
|
+
export declare function updateGroup(state: State, component: GroupComponent): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
2
|
import type { RenderElementPool } from '../models/render.model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { State } from '../models/tabela.model';
|
|
4
4
|
export declare function removeRow(pool: RenderElementPool, row: RowComponent): void;
|
|
5
|
-
export declare function renderRow(state:
|
|
5
|
+
export declare function renderRow(state: State, row: RowComponent): void;
|
|
6
6
|
export declare class RowComponent {
|
|
7
7
|
readonly key: Key;
|
|
8
8
|
cells: Record<string, HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const dragStyling: import("@oscarpalmer/toretto").StyleToggler;
|
|
1
|
+
export declare const dragStyling: import("@oscarpalmer/toretto/style").StyleToggler;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ColumnComponent } from '../components/column.component';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { TabelaColumn } from '../models/column.model';
|
|
3
|
+
import type { State } from '../models/tabela.model';
|
|
4
4
|
export declare class ColumnManager {
|
|
5
|
-
state:
|
|
5
|
+
state: State;
|
|
6
6
|
items: ColumnComponent[];
|
|
7
|
-
constructor(state:
|
|
7
|
+
constructor(state: State);
|
|
8
8
|
destroy(): void;
|
|
9
9
|
remove(field: string): void;
|
|
10
10
|
remove(fields: string[]): void;
|
|
11
|
-
set(columns:
|
|
11
|
+
set(columns: TabelaColumn[]): void;
|
|
12
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Key, PlainObject } from '@oscarpalmer/atoms/models';
|
|
2
2
|
import type { DataValues } from '../models/data.model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { State } from '../models/tabela.model';
|
|
4
|
+
import { GroupComponent } from '../components/group.component';
|
|
4
5
|
export declare class DataManager {
|
|
5
|
-
state:
|
|
6
|
+
state: State;
|
|
6
7
|
handlers: Readonly<{
|
|
7
8
|
add: (data: PlainObject[]) => undefined;
|
|
8
9
|
clear: () => undefined;
|
|
@@ -12,8 +13,9 @@ export declare class DataManager {
|
|
|
12
13
|
update: (data: PlainObject[]) => undefined;
|
|
13
14
|
}>;
|
|
14
15
|
values: DataValues;
|
|
16
|
+
get keys(): Array<GroupComponent | Key>;
|
|
15
17
|
get size(): number;
|
|
16
|
-
constructor(state:
|
|
18
|
+
constructor(state: State);
|
|
17
19
|
add(data: PlainObject[], render: boolean): Promise<void>;
|
|
18
20
|
clear(): void;
|
|
19
21
|
destroy(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { State } from '../models/tabela.model';
|
|
2
2
|
export declare class EventManager {
|
|
3
|
-
state:
|
|
4
|
-
constructor(state:
|
|
3
|
+
state: State;
|
|
4
|
+
constructor(state: State);
|
|
5
5
|
destroy(): void;
|
|
6
6
|
onSort(event: MouseEvent, target: HTMLElement): void;
|
|
7
7
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { TabelaFilterItem } from '../models/filter.model';
|
|
2
|
+
import type { State } from '../models/tabela.model';
|
|
3
3
|
export declare class FilterManager {
|
|
4
|
-
state:
|
|
4
|
+
state: State;
|
|
5
5
|
handlers: Readonly<{
|
|
6
|
-
add: (item:
|
|
6
|
+
add: (item: TabelaFilterItem) => void;
|
|
7
7
|
clear: () => void;
|
|
8
|
-
remove: (value: string |
|
|
9
|
-
set: (items:
|
|
8
|
+
remove: (value: string | TabelaFilterItem) => void;
|
|
9
|
+
set: (items: TabelaFilterItem[]) => void;
|
|
10
10
|
}>;
|
|
11
|
-
items: Record<string,
|
|
12
|
-
constructor(state:
|
|
13
|
-
add(item:
|
|
11
|
+
items: Record<string, TabelaFilterItem[]>;
|
|
12
|
+
constructor(state: State);
|
|
13
|
+
add(item: TabelaFilterItem): void;
|
|
14
14
|
clear(): void;
|
|
15
15
|
destroy(): void;
|
|
16
16
|
filter(): void;
|
|
17
|
-
remove(value: string |
|
|
18
|
-
set(items:
|
|
17
|
+
remove(value: string | TabelaFilterItem): void;
|
|
18
|
+
set(items: TabelaFilterItem[]): void;
|
|
19
19
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
+
import type { GroupComponent } from '../components/group.component';
|
|
3
|
+
import type { State } from '../models/tabela.model';
|
|
4
|
+
export declare class GroupManager {
|
|
5
|
+
readonly state: State;
|
|
6
|
+
collapsed: Set<Key>;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
field: string;
|
|
9
|
+
items: GroupComponent[];
|
|
10
|
+
order: Record<never, number>;
|
|
11
|
+
constructor(state: State);
|
|
12
|
+
add(group: GroupComponent): void;
|
|
13
|
+
get(value: unknown): GroupComponent | undefined;
|
|
14
|
+
handle(button: HTMLElement): void;
|
|
15
|
+
remove(group: GroupComponent): void;
|
|
16
|
+
set(items: GroupComponent[]): void;
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { State } from '../models/tabela.model';
|
|
3
3
|
export declare class NavigationManager {
|
|
4
|
-
state:
|
|
4
|
+
state: State;
|
|
5
5
|
active: Key | undefined;
|
|
6
|
-
constructor(state:
|
|
6
|
+
constructor(state: State);
|
|
7
7
|
destroy(): void;
|
|
8
8
|
handle(event: KeyboardEvent): void;
|
|
9
9
|
setActive(key: Key | undefined, scroll?: boolean): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
2
|
import type { RemovableEventListener } from '@oscarpalmer/toretto/models';
|
|
3
|
+
import { GroupComponent } from '../components/group.component';
|
|
3
4
|
import type { RenderElementPool, RenderState } from '../models/render.model';
|
|
4
|
-
import type {
|
|
5
|
+
import type { State } from '../models/tabela.model';
|
|
5
6
|
export declare class RenderManager {
|
|
6
7
|
fragment: DocumentFragment;
|
|
7
8
|
listener: RemovableEventListener;
|
|
8
9
|
pool: RenderElementPool;
|
|
9
10
|
state: RenderState;
|
|
10
|
-
visible: Map<number, Key>;
|
|
11
|
-
constructor(state:
|
|
11
|
+
visible: Map<number, GroupComponent | Key>;
|
|
12
|
+
constructor(state: State);
|
|
12
13
|
destroy(): void;
|
|
13
14
|
removeCells(fields: string[]): void;
|
|
14
15
|
getFragment(): DocumentFragment;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
2
|
import { RowComponent } from '../components/row.component';
|
|
3
|
-
import type {
|
|
3
|
+
import type { State } from '../models/tabela.model';
|
|
4
4
|
export declare class RowManager {
|
|
5
|
-
state:
|
|
5
|
+
state: State;
|
|
6
6
|
components: Map<Key, RowComponent>;
|
|
7
|
-
constructor(state:
|
|
7
|
+
constructor(state: State);
|
|
8
8
|
destroy(): void;
|
|
9
9
|
get(key: Key): RowComponent | undefined;
|
|
10
10
|
has(key: Key): boolean;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { State } from '../models/tabela.model';
|
|
3
3
|
export declare class SelectionManager {
|
|
4
|
-
state:
|
|
5
|
-
handlers: Readonly<
|
|
4
|
+
state: State;
|
|
5
|
+
handlers: Readonly<{
|
|
6
|
+
add: (keys: Key[]) => void;
|
|
7
|
+
clear: () => void;
|
|
8
|
+
remove: (keys: Key[]) => void;
|
|
9
|
+
set: (keys: Key[]) => void;
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
}>;
|
|
6
12
|
items: Set<Key>;
|
|
7
13
|
last: Key | undefined;
|
|
8
|
-
constructor(state:
|
|
14
|
+
constructor(state: State);
|
|
15
|
+
add(keys: Key[]): void;
|
|
9
16
|
clear(): void;
|
|
10
|
-
deselect(keys: Key[]): void;
|
|
11
17
|
destroy(): void;
|
|
12
18
|
handle(event: MouseEvent, target: HTMLElement): void;
|
|
13
19
|
range(from: Key | HTMLElement, to: Key | HTMLElement): void;
|
|
14
|
-
|
|
20
|
+
remove(keys: Key[]): void;
|
|
15
21
|
set(keys: Key[]): void;
|
|
16
22
|
toggle(): void;
|
|
17
23
|
update(removed: Key[]): void;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { type ArrayKeySorter } from '@oscarpalmer/atoms/array';
|
|
2
2
|
import type { PlainObject } from '@oscarpalmer/atoms/models';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
3
|
+
import { GroupComponent } from '../components/group.component';
|
|
4
|
+
import type { TabelaSortDirection, TabelaSortItem } from '../models/sort.model';
|
|
5
|
+
import type { State } from '../models/tabela.model';
|
|
5
6
|
export declare class SortManager {
|
|
6
|
-
state:
|
|
7
|
+
state: State;
|
|
7
8
|
handlers: Readonly<{
|
|
8
|
-
add: (field: string, direction:
|
|
9
|
+
add: (field: string, direction: TabelaSortDirection | undefined) => void;
|
|
9
10
|
flip: (field: string) => void;
|
|
10
11
|
clear: () => void;
|
|
11
12
|
remove: (field: string) => void;
|
|
12
|
-
set: (items:
|
|
13
|
+
set: (items: TabelaSortItem[]) => void;
|
|
13
14
|
}>;
|
|
14
15
|
items: ArrayKeySorter<PlainObject>[];
|
|
15
|
-
constructor(state:
|
|
16
|
-
add(field: string, direction?:
|
|
16
|
+
constructor(state: State);
|
|
17
|
+
add(field: string, direction?: TabelaSortDirection): void;
|
|
17
18
|
addOrSet(event: MouseEvent, field: string): void;
|
|
18
19
|
clear(): void;
|
|
19
20
|
destroy(): void;
|
|
20
21
|
flip(field: string): void;
|
|
21
22
|
remove(field: string): void;
|
|
22
23
|
removeOrClear(event: MouseEvent, field: string): void;
|
|
23
|
-
set(items:
|
|
24
|
+
set(items: TabelaSortItem[]): void;
|
|
24
25
|
sort(): void;
|
|
25
26
|
toggle(event: MouseEvent, field: string, direction?: string | null): void;
|
|
26
27
|
}
|
|
28
|
+
export declare function sortWithGroups(state: State, data: Array<GroupComponent | PlainObject>, sorters: ArrayKeySorter<PlainObject>[]): Array<GroupComponent | PlainObject>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Column = {
|
|
2
2
|
field: string;
|
|
3
3
|
title: string;
|
|
4
4
|
type: TabelaColumnType;
|
|
5
5
|
width: number;
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
7
|
+
export type TabelaColumn = {
|
|
8
8
|
field: string;
|
|
9
9
|
title: string;
|
|
10
10
|
type: TabelaColumnType;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import type { Key, PlainObject } from '@oscarpalmer/atoms/models';
|
|
2
|
+
import type { GroupComponent } from '../components/group.component';
|
|
2
3
|
export type DataValues = {
|
|
3
4
|
keys: DataValuesKeys;
|
|
4
5
|
objects: DataValuesObjects;
|
|
5
6
|
};
|
|
6
7
|
type DataValuesKeys = {
|
|
7
|
-
active?: Key
|
|
8
|
-
original: Key
|
|
8
|
+
active?: Array<GroupComponent | Key>;
|
|
9
|
+
original: Array<GroupComponent | Key>;
|
|
9
10
|
};
|
|
10
11
|
type DataValuesObjects = {
|
|
11
|
-
array: PlainObject
|
|
12
|
+
array: Array<GroupComponent | PlainObject>;
|
|
12
13
|
mapped: Map<Key, PlainObject>;
|
|
13
14
|
};
|
|
15
|
+
export type TabelaData = {
|
|
16
|
+
add(data: PlainObject[]): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
get(active?: boolean): PlainObject[];
|
|
19
|
+
remove(keys: Key[]): void;
|
|
20
|
+
remove(data: PlainObject[]): void;
|
|
21
|
+
synchronize(data: PlainObject[], remove?: boolean): void;
|
|
22
|
+
update(data: PlainObject[]): void;
|
|
23
|
+
};
|
|
14
24
|
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export type TabelaFilter = {
|
|
2
|
+
add(item: TabelaFilterItem): void;
|
|
3
|
+
clear(): void;
|
|
4
|
+
remove(field: string): void;
|
|
5
|
+
remove(item: TabelaFilterItem): void;
|
|
6
|
+
set(items: TabelaFilterItem[]): void;
|
|
7
|
+
};
|
|
8
|
+
export type TabelaFilterComparison = 'contains' | 'ends-with' | 'equals' | 'greater-than' | 'greater-than-or-equal' | 'less-than' | 'less-than-or-equal' | 'not-contains' | 'not-equals' | 'starts-with';
|
|
9
|
+
export type TabelaFilterItem = {
|
|
10
|
+
comparison: TabelaFilterComparison;
|
|
4
11
|
field: string;
|
|
5
12
|
value: unknown;
|
|
6
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { State } from './tabela.model';
|
|
2
2
|
export type RenderElementPool = {
|
|
3
3
|
cells: Record<string, HTMLDivElement[]>;
|
|
4
4
|
rows: HTMLDivElement[];
|
|
@@ -10,4 +10,4 @@ export type RenderRange = {
|
|
|
10
10
|
export type RenderState = {
|
|
11
11
|
active: boolean;
|
|
12
12
|
top: number;
|
|
13
|
-
} &
|
|
13
|
+
} & State;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export type TabelaSort = {
|
|
2
|
+
add(field: string, direction?: TabelaSortDirection): void;
|
|
3
|
+
clear(): void;
|
|
4
|
+
flip(field: string): void;
|
|
5
|
+
remove(field: string): void;
|
|
6
|
+
set(items: TabelaSortItem[]): void;
|
|
7
|
+
};
|
|
8
|
+
export type TabelaSortDirection = 'ascending' | 'descending';
|
|
9
|
+
export type TabelaSortItem = {
|
|
10
|
+
direction: TabelaSortDirection;
|
|
4
11
|
field: string;
|
|
5
12
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Key, PlainObject } from '@oscarpalmer/atoms/models';
|
|
2
1
|
import type { BodyComponent } from '../components/body.component';
|
|
3
2
|
import type { FooterComponent } from '../components/footer.component';
|
|
4
3
|
import type { HeaderComponent } from '../components/header.component';
|
|
@@ -6,64 +5,35 @@ import type { ColumnManager } from '../managers/column.manager';
|
|
|
6
5
|
import type { DataManager } from '../managers/data.manager';
|
|
7
6
|
import type { EventManager } from '../managers/event.manager';
|
|
8
7
|
import type { FilterManager } from '../managers/filter.manager';
|
|
8
|
+
import type { GroupManager } from '../managers/group.manager';
|
|
9
9
|
import type { NavigationManager } from '../managers/navigation.manager';
|
|
10
10
|
import type { RenderManager } from '../managers/render.manager';
|
|
11
11
|
import type { RowManager } from '../managers/row.manager';
|
|
12
12
|
import type { SelectionManager } from '../managers/selection.manager';
|
|
13
13
|
import type { SortManager } from '../managers/sort.manager';
|
|
14
|
-
import type { FilterItem } from './filter.model';
|
|
15
|
-
import type { SortDirection, SortItem } from './sort.model';
|
|
16
14
|
import type { TabelaOptions } from './tabela.options';
|
|
17
|
-
export type
|
|
15
|
+
export type Components = {
|
|
18
16
|
body: BodyComponent;
|
|
19
17
|
footer: FooterComponent;
|
|
20
18
|
header: HeaderComponent;
|
|
21
19
|
};
|
|
22
|
-
export type
|
|
23
|
-
add(data: PlainObject[]): void;
|
|
24
|
-
clear(): void;
|
|
25
|
-
get(active?: boolean): PlainObject[];
|
|
26
|
-
remove(keys: Key[]): void;
|
|
27
|
-
remove(data: PlainObject[]): void;
|
|
28
|
-
synchronize(data: PlainObject[], remove?: boolean): void;
|
|
29
|
-
update(data: PlainObject[]): void;
|
|
30
|
-
};
|
|
31
|
-
export type TabelaFilter = {
|
|
32
|
-
add(item: FilterItem): void;
|
|
33
|
-
clear(): void;
|
|
34
|
-
remove(field: string): void;
|
|
35
|
-
remove(item: FilterItem): void;
|
|
36
|
-
set(items: FilterItem[]): void;
|
|
37
|
-
};
|
|
38
|
-
export type TabelaManagers = {
|
|
20
|
+
export type Managers = {
|
|
39
21
|
column: ColumnManager;
|
|
40
22
|
data: DataManager;
|
|
41
23
|
event: EventManager;
|
|
42
24
|
filter: FilterManager;
|
|
25
|
+
group: GroupManager;
|
|
43
26
|
navigation: NavigationManager;
|
|
44
27
|
row: RowManager;
|
|
45
28
|
selection: SelectionManager;
|
|
46
29
|
sort: SortManager;
|
|
47
30
|
render: RenderManager;
|
|
48
31
|
};
|
|
49
|
-
export type
|
|
50
|
-
|
|
51
|
-
deselect(keys: Key[]): void;
|
|
52
|
-
select(keys: Key[]): void;
|
|
53
|
-
toggle(): void;
|
|
54
|
-
};
|
|
55
|
-
export type TabelaSort = {
|
|
56
|
-
add(field: string, direction?: SortDirection): void;
|
|
57
|
-
clear(): void;
|
|
58
|
-
flip(field: string): void;
|
|
59
|
-
remove(field: string): void;
|
|
60
|
-
set(items: SortItem[]): void;
|
|
61
|
-
};
|
|
62
|
-
export type TabelaState = {
|
|
63
|
-
readonly components: TabelaComponents;
|
|
32
|
+
export type State = {
|
|
33
|
+
readonly components: Components;
|
|
64
34
|
readonly element: HTMLElement;
|
|
65
35
|
readonly id: number;
|
|
66
36
|
readonly key: string;
|
|
67
|
-
readonly managers:
|
|
37
|
+
readonly managers: Managers;
|
|
68
38
|
readonly options: TabelaOptions;
|
|
69
39
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { PlainObject } from '@oscarpalmer/atoms/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TabelaColumn } from './column.model';
|
|
3
3
|
export type TabelaOptions = {
|
|
4
|
-
columns:
|
|
4
|
+
columns: TabelaColumn[];
|
|
5
5
|
data: PlainObject[];
|
|
6
|
+
grouping?: string;
|
|
6
7
|
key: string;
|
|
7
8
|
label: string;
|
|
8
9
|
rowHeight: number;
|
package/types/tabela.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { TabelaData
|
|
1
|
+
import type { TabelaData } from './models/data.model';
|
|
2
|
+
import type { TabelaFilter } from './models/filter.model';
|
|
3
|
+
import type { TabelaSelection } from './models/selection.model';
|
|
4
|
+
import type { TabelaSort } from './models/sort.model';
|
|
2
5
|
import type { TabelaOptions } from './models/tabela.options';
|
|
3
6
|
export declare class Tabela {
|
|
4
7
|
#private;
|