@oscarpalmer/tabela 0.10.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/body.component.js +1 -0
- package/dist/components/column.component.js +4 -4
- package/dist/components/group.component.js +28 -0
- package/dist/components/row.component.js +11 -8
- package/dist/helpers/dom.helpers.js +1 -1
- package/dist/managers/column.manager.js +9 -8
- package/dist/managers/data.manager.js +95 -30
- package/dist/managers/event.manager.js +42 -23
- package/dist/managers/filter.manager.js +16 -10
- package/dist/managers/group.manager.js +46 -0
- package/dist/managers/navigation.manager.js +73 -0
- package/dist/managers/render.manager.js +61 -31
- package/dist/managers/row.manager.js +7 -7
- package/dist/managers/selection.manager.js +49 -46
- package/dist/managers/sort.manager.js +37 -9
- package/dist/models/group.model.js +0 -0
- package/dist/models/selection.model.js +0 -0
- package/dist/tabela.full.js +682 -591
- package/dist/tabela.js +31 -10
- package/package.json +1 -1
- package/src/components/body.component.ts +2 -0
- package/src/components/column.component.ts +6 -6
- package/src/components/group.component.ts +43 -0
- package/src/components/row.component.ts +14 -9
- package/src/helpers/dom.helpers.ts +3 -1
- package/src/managers/column.manager.ts +13 -15
- package/src/managers/data.manager.ts +176 -38
- package/src/managers/event.manager.ts +68 -41
- package/src/managers/filter.manager.ts +29 -20
- package/src/managers/group.manager.ts +79 -0
- package/src/managers/navigation.manager.ts +146 -0
- package/src/managers/render.manager.ts +84 -40
- package/src/managers/row.manager.ts +9 -14
- package/src/managers/selection.manager.ts +68 -67
- package/src/managers/sort.manager.ts +85 -22
- 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 +3 -1
- package/src/models/selection.model.ts +9 -0
- package/src/models/sort.model.ts +11 -3
- package/src/models/tabela.model.ts +14 -36
- package/src/models/tabela.options.ts +3 -2
- package/src/tabela.ts +43 -19
- 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 +6 -7
- package/types/managers/data.manager.d.ts +7 -6
- package/types/managers/event.manager.d.ts +3 -6
- 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 +10 -0
- package/types/managers/render.manager.d.ts +6 -7
- package/types/managers/row.manager.d.ts +4 -5
- package/types/managers/selection.manager.d.ts +12 -7
- package/types/managers/sort.manager.d.ts +11 -9
- 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 -1
- 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 +14 -33
- package/types/models/tabela.options.d.ts +3 -2
- package/types/tabela.d.ts +4 -1
package/src/tabela.ts
CHANGED
|
@@ -5,22 +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';
|
|
9
|
+
import {NavigationManager} from './managers/navigation.manager';
|
|
10
|
+
import {RenderManager} from './managers/render.manager';
|
|
8
11
|
import {RowManager} from './managers/row.manager';
|
|
9
12
|
import {SelectionManager} from './managers/selection.manager';
|
|
10
13
|
import {SortManager} from './managers/sort.manager';
|
|
11
|
-
import {
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
TabelaManagers,
|
|
17
|
-
TabelaSelection,
|
|
18
|
-
TabelaSort,
|
|
19
|
-
} 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';
|
|
20
19
|
import type {TabelaOptions} from './models/tabela.options';
|
|
21
20
|
|
|
22
21
|
export class Tabela {
|
|
23
|
-
readonly #components:
|
|
22
|
+
readonly #components: Components = {
|
|
24
23
|
header: undefined as never,
|
|
25
24
|
body: undefined as never,
|
|
26
25
|
footer: undefined as never,
|
|
@@ -28,13 +27,17 @@ export class Tabela {
|
|
|
28
27
|
|
|
29
28
|
#element: HTMLElement;
|
|
30
29
|
|
|
30
|
+
#id = getId();
|
|
31
|
+
|
|
31
32
|
readonly #key: string;
|
|
32
33
|
|
|
33
|
-
readonly #managers:
|
|
34
|
+
readonly #managers: Managers = {
|
|
34
35
|
column: undefined as never,
|
|
35
36
|
data: undefined as never,
|
|
36
37
|
event: undefined as never,
|
|
37
38
|
filter: undefined as never,
|
|
39
|
+
group: undefined as never,
|
|
40
|
+
navigation: undefined as never,
|
|
38
41
|
render: undefined as never,
|
|
39
42
|
row: undefined as never,
|
|
40
43
|
selection: undefined as never,
|
|
@@ -69,14 +72,25 @@ export class Tabela {
|
|
|
69
72
|
this.#components.body = new BodyComponent();
|
|
70
73
|
this.#components.footer = new FooterComponent();
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
const state: State = {
|
|
76
|
+
element,
|
|
77
|
+
options,
|
|
78
|
+
components: this.#components,
|
|
79
|
+
id: this.#id,
|
|
80
|
+
key: this.#key,
|
|
81
|
+
managers: this.#managers,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
this.#managers.column = new ColumnManager(state);
|
|
85
|
+
this.#managers.data = new DataManager(state);
|
|
86
|
+
this.#managers.event = new EventManager(state);
|
|
87
|
+
this.#managers.filter = new FilterManager(state);
|
|
88
|
+
this.#managers.group = new GroupManager(state);
|
|
89
|
+
this.#managers.navigation = new NavigationManager(state);
|
|
90
|
+
this.#managers.render = new RenderManager(state);
|
|
91
|
+
this.#managers.row = new RowManager(state);
|
|
92
|
+
this.#managers.selection = new SelectionManager(state);
|
|
93
|
+
this.#managers.sort = new SortManager(state);
|
|
80
94
|
|
|
81
95
|
element.append(
|
|
82
96
|
this.#components.header.elements.group,
|
|
@@ -105,8 +119,10 @@ export class Tabela {
|
|
|
105
119
|
managers.data.destroy();
|
|
106
120
|
managers.event.destroy();
|
|
107
121
|
managers.filter.destroy();
|
|
122
|
+
// managers.navigation.destroy();
|
|
108
123
|
managers.render.destroy();
|
|
109
124
|
managers.row.destroy();
|
|
125
|
+
managers.selection.destroy();
|
|
110
126
|
managers.sort.destroy();
|
|
111
127
|
|
|
112
128
|
element.innerHTML = '';
|
|
@@ -119,3 +135,11 @@ export class Tabela {
|
|
|
119
135
|
this.#element = undefined as never;
|
|
120
136
|
}
|
|
121
137
|
}
|
|
138
|
+
|
|
139
|
+
function getId(): number {
|
|
140
|
+
id += 1;
|
|
141
|
+
|
|
142
|
+
return id;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let id = 0;
|
|
@@ -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(
|
|
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,13 +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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(managers: TabelaManagers, components: TabelaComponents, columns: TabelaColumnOptions[]);
|
|
5
|
+
state: State;
|
|
6
|
+
items: ColumnComponent[];
|
|
7
|
+
constructor(state: State);
|
|
9
8
|
destroy(): void;
|
|
10
9
|
remove(field: string): void;
|
|
11
10
|
remove(fields: string[]): void;
|
|
12
|
-
set(columns:
|
|
11
|
+
set(columns: TabelaColumn[]): void;
|
|
13
12
|
}
|
|
@@ -1,10 +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
|
-
|
|
6
|
-
components: TabelaComponents;
|
|
7
|
-
field: string;
|
|
6
|
+
state: State;
|
|
8
7
|
handlers: Readonly<{
|
|
9
8
|
add: (data: PlainObject[]) => undefined;
|
|
10
9
|
clear: () => undefined;
|
|
@@ -13,13 +12,15 @@ export declare class DataManager {
|
|
|
13
12
|
synchronize: (data: PlainObject[], remove: boolean | undefined) => undefined;
|
|
14
13
|
update: (data: PlainObject[]) => undefined;
|
|
15
14
|
}>;
|
|
16
|
-
|
|
15
|
+
values: DataValues;
|
|
16
|
+
get keys(): Array<GroupComponent | Key>;
|
|
17
17
|
get size(): number;
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(state: State);
|
|
19
19
|
add(data: PlainObject[], render: boolean): Promise<void>;
|
|
20
20
|
clear(): void;
|
|
21
21
|
destroy(): void;
|
|
22
22
|
get(active?: boolean): PlainObject[];
|
|
23
|
+
getIndex(key: Key): number;
|
|
23
24
|
remove(items: Array<Key | PlainObject>, render: boolean): Promise<void>;
|
|
24
25
|
render(): void;
|
|
25
26
|
set(data: PlainObject[]): void;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { TabelaManagers } from '../models/tabela.model';
|
|
1
|
+
import type { State } from '../models/tabela.model';
|
|
3
2
|
export declare class EventManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(element: HTMLElement, managers: TabelaManagers);
|
|
3
|
+
state: State;
|
|
4
|
+
constructor(state: State);
|
|
7
5
|
destroy(): void;
|
|
8
|
-
onClick(event: MouseEvent): void;
|
|
9
6
|
onSort(event: MouseEvent, target: HTMLElement): void;
|
|
10
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
|
-
|
|
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(
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
+
import type { State } from '../models/tabela.model';
|
|
3
|
+
export declare class NavigationManager {
|
|
4
|
+
state: State;
|
|
5
|
+
active: Key | undefined;
|
|
6
|
+
constructor(state: State);
|
|
7
|
+
destroy(): void;
|
|
8
|
+
handle(event: KeyboardEvent): void;
|
|
9
|
+
setActive(key: Key | undefined, scroll?: boolean): void;
|
|
10
|
+
}
|
|
@@ -1,16 +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
|
-
managers: TabelaManagers;
|
|
7
|
-
components: TabelaComponents;
|
|
8
7
|
fragment: DocumentFragment;
|
|
9
8
|
listener: RemovableEventListener;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
visible: Map<number, Key>;
|
|
13
|
-
constructor(
|
|
9
|
+
pool: RenderElementPool;
|
|
10
|
+
state: RenderState;
|
|
11
|
+
visible: Map<number, GroupComponent | Key>;
|
|
12
|
+
constructor(state: State);
|
|
14
13
|
destroy(): void;
|
|
15
14
|
removeCells(fields: string[]): void;
|
|
16
15
|
getFragment(): DocumentFragment;
|
|
@@ -1,11 +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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(managers: TabelaManagers, rowHeight: number);
|
|
5
|
+
state: State;
|
|
6
|
+
components: Map<Key, RowComponent>;
|
|
7
|
+
constructor(state: State);
|
|
9
8
|
destroy(): void;
|
|
10
9
|
get(key: Key): RowComponent | undefined;
|
|
11
10
|
has(key: Key): boolean;
|
|
@@ -1,18 +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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
}>;
|
|
7
12
|
items: Set<Key>;
|
|
8
13
|
last: Key | undefined;
|
|
9
|
-
constructor(
|
|
14
|
+
constructor(state: State);
|
|
15
|
+
add(keys: Key[]): void;
|
|
10
16
|
clear(): void;
|
|
11
|
-
deselect(keys: Key[]): void;
|
|
12
17
|
destroy(): void;
|
|
13
18
|
handle(event: MouseEvent, target: HTMLElement): void;
|
|
14
19
|
range(from: Key | HTMLElement, to: Key | HTMLElement): void;
|
|
15
|
-
|
|
20
|
+
remove(keys: Key[]): void;
|
|
16
21
|
set(keys: Key[]): void;
|
|
17
22
|
toggle(): void;
|
|
18
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
|
-
|
|
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
|
-
constructor(
|
|
16
|
-
add(field: string, direction?:
|
|
15
|
+
items: ArrayKeySorter<PlainObject>[];
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import type { State } from './tabela.model';
|
|
1
2
|
export type RenderElementPool = {
|
|
2
3
|
cells: Record<string, HTMLDivElement[]>;
|
|
3
4
|
rows: HTMLDivElement[];
|
|
@@ -9,4 +10,4 @@ export type RenderRange = {
|
|
|
9
10
|
export type RenderState = {
|
|
10
11
|
active: boolean;
|
|
11
12
|
top: number;
|
|
12
|
-
};
|
|
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,53 +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
|
+
import type { NavigationManager } from '../managers/navigation.manager';
|
|
9
10
|
import type { RenderManager } from '../managers/render.manager';
|
|
10
11
|
import type { RowManager } from '../managers/row.manager';
|
|
11
12
|
import type { SelectionManager } from '../managers/selection.manager';
|
|
12
13
|
import type { SortManager } from '../managers/sort.manager';
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
export type TabelaComponents = {
|
|
14
|
+
import type { TabelaOptions } from './tabela.options';
|
|
15
|
+
export type Components = {
|
|
16
16
|
body: BodyComponent;
|
|
17
17
|
footer: FooterComponent;
|
|
18
18
|
header: HeaderComponent;
|
|
19
19
|
};
|
|
20
|
-
export type
|
|
21
|
-
add(data: PlainObject[]): void;
|
|
22
|
-
clear(): void;
|
|
23
|
-
get(active?: boolean): PlainObject[];
|
|
24
|
-
remove(keys: Key[]): void;
|
|
25
|
-
remove(data: PlainObject[]): void;
|
|
26
|
-
synchronize(data: PlainObject[], remove?: boolean): void;
|
|
27
|
-
update(data: PlainObject[]): void;
|
|
28
|
-
};
|
|
29
|
-
export type TabelaFilter = {
|
|
30
|
-
add(item: FilterItem): void;
|
|
31
|
-
clear(): void;
|
|
32
|
-
remove(field: string): void;
|
|
33
|
-
remove(item: FilterItem): void;
|
|
34
|
-
set(items: FilterItem[]): void;
|
|
35
|
-
};
|
|
36
|
-
export type TabelaManagers = {
|
|
20
|
+
export type Managers = {
|
|
37
21
|
column: ColumnManager;
|
|
38
22
|
data: DataManager;
|
|
39
23
|
event: EventManager;
|
|
40
24
|
filter: FilterManager;
|
|
25
|
+
group: GroupManager;
|
|
26
|
+
navigation: NavigationManager;
|
|
41
27
|
row: RowManager;
|
|
42
28
|
selection: SelectionManager;
|
|
43
29
|
sort: SortManager;
|
|
44
30
|
render: RenderManager;
|
|
45
31
|
};
|
|
46
|
-
export type
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
add(field: string, direction?: SortDirection): void;
|
|
54
|
-
clear(): void;
|
|
55
|
-
flip(field: string): void;
|
|
56
|
-
remove(field: string): void;
|
|
57
|
-
set(items: SortItem[]): void;
|
|
32
|
+
export type State = {
|
|
33
|
+
readonly components: Components;
|
|
34
|
+
readonly element: HTMLElement;
|
|
35
|
+
readonly id: number;
|
|
36
|
+
readonly key: string;
|
|
37
|
+
readonly managers: Managers;
|
|
38
|
+
readonly options: TabelaOptions;
|
|
58
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;
|