@oscarpalmer/tabela 0.10.0 → 0.11.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/row.component.js +11 -8
- package/dist/managers/column.manager.js +9 -8
- package/dist/managers/data.manager.js +26 -22
- package/dist/managers/event.manager.js +39 -23
- package/dist/managers/filter.manager.js +11 -10
- package/dist/managers/navigation.manager.js +73 -0
- package/dist/managers/render.manager.js +30 -25
- package/dist/managers/row.manager.js +7 -7
- package/dist/managers/selection.manager.js +19 -21
- package/dist/managers/sort.manager.js +9 -8
- package/dist/tabela.full.js +535 -410
- package/dist/tabela.js +27 -9
- package/package.json +1 -1
- package/src/components/body.component.ts +2 -0
- package/src/components/row.component.ts +14 -9
- package/src/managers/column.manager.ts +11 -13
- package/src/managers/data.manager.ts +31 -27
- package/src/managers/event.manager.ts +65 -42
- package/src/managers/filter.manager.ts +12 -11
- package/src/managers/navigation.manager.ts +145 -0
- package/src/managers/render.manager.ts +34 -28
- package/src/managers/row.manager.ts +9 -14
- package/src/managers/selection.manager.ts +24 -30
- package/src/managers/sort.manager.ts +14 -14
- package/src/models/render.model.ts +3 -1
- package/src/models/tabela.model.ts +12 -0
- package/src/tabela.ts +34 -9
- package/types/components/row.component.d.ts +2 -2
- package/types/managers/column.manager.d.ts +4 -5
- package/types/managers/data.manager.d.ts +5 -6
- package/types/managers/event.manager.d.ts +3 -6
- package/types/managers/filter.manager.d.ts +3 -3
- package/types/managers/navigation.manager.d.ts +10 -0
- package/types/managers/render.manager.d.ts +4 -6
- package/types/managers/row.manager.d.ts +4 -5
- package/types/managers/selection.manager.d.ts +3 -4
- package/types/managers/sort.manager.d.ts +4 -4
- package/types/models/render.model.d.ts +2 -1
- package/types/models/tabela.model.d.ts +11 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ColumnComponent } from '../components/column.component';
|
|
2
2
|
import type { TabelaColumnOptions } from '../models/column.model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
4
4
|
export declare class ColumnManager {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(managers: TabelaManagers, components: TabelaComponents, columns: TabelaColumnOptions[]);
|
|
5
|
+
state: TabelaState;
|
|
6
|
+
items: ColumnComponent[];
|
|
7
|
+
constructor(state: TabelaState);
|
|
9
8
|
destroy(): void;
|
|
10
9
|
remove(field: string): void;
|
|
11
10
|
remove(fields: string[]): void;
|
|
@@ -1,10 +1,8 @@
|
|
|
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 { TabelaState } from '../models/tabela.model';
|
|
4
4
|
export declare class DataManager {
|
|
5
|
-
|
|
6
|
-
components: TabelaComponents;
|
|
7
|
-
field: string;
|
|
5
|
+
state: TabelaState;
|
|
8
6
|
handlers: Readonly<{
|
|
9
7
|
add: (data: PlainObject[]) => undefined;
|
|
10
8
|
clear: () => undefined;
|
|
@@ -13,13 +11,14 @@ export declare class DataManager {
|
|
|
13
11
|
synchronize: (data: PlainObject[], remove: boolean | undefined) => undefined;
|
|
14
12
|
update: (data: PlainObject[]) => undefined;
|
|
15
13
|
}>;
|
|
16
|
-
|
|
14
|
+
values: DataValues;
|
|
17
15
|
get size(): number;
|
|
18
|
-
constructor(
|
|
16
|
+
constructor(state: TabelaState);
|
|
19
17
|
add(data: PlainObject[], render: boolean): Promise<void>;
|
|
20
18
|
clear(): void;
|
|
21
19
|
destroy(): void;
|
|
22
20
|
get(active?: boolean): PlainObject[];
|
|
21
|
+
getIndex(key: Key): number;
|
|
23
22
|
remove(items: Array<Key | PlainObject>, render: boolean): Promise<void>;
|
|
24
23
|
render(): void;
|
|
25
24
|
set(data: PlainObject[]): void;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { TabelaManagers } from '../models/tabela.model';
|
|
1
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
3
2
|
export declare class EventManager {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor(element: HTMLElement, managers: TabelaManagers);
|
|
3
|
+
state: TabelaState;
|
|
4
|
+
constructor(state: TabelaState);
|
|
7
5
|
destroy(): void;
|
|
8
|
-
onClick(event: MouseEvent): void;
|
|
9
6
|
onSort(event: MouseEvent, target: HTMLElement): void;
|
|
10
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FilterItem } from '../models/filter.model';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
3
3
|
export declare class FilterManager {
|
|
4
|
-
|
|
4
|
+
state: TabelaState;
|
|
5
5
|
handlers: Readonly<{
|
|
6
6
|
add: (item: FilterItem) => void;
|
|
7
7
|
clear: () => void;
|
|
@@ -9,7 +9,7 @@ export declare class FilterManager {
|
|
|
9
9
|
set: (items: FilterItem[]) => void;
|
|
10
10
|
}>;
|
|
11
11
|
items: Record<string, FilterItem[]>;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(state: TabelaState);
|
|
13
13
|
add(item: FilterItem): void;
|
|
14
14
|
clear(): void;
|
|
15
15
|
destroy(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
3
|
+
export declare class NavigationManager {
|
|
4
|
+
state: TabelaState;
|
|
5
|
+
active: Key | undefined;
|
|
6
|
+
constructor(state: TabelaState);
|
|
7
|
+
destroy(): void;
|
|
8
|
+
handle(event: KeyboardEvent): void;
|
|
9
|
+
setActive(key: Key | undefined, scroll?: boolean): void;
|
|
10
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
2
|
import type { RemovableEventListener } from '@oscarpalmer/toretto/models';
|
|
3
3
|
import type { RenderElementPool, RenderState } from '../models/render.model';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
5
5
|
export declare class RenderManager {
|
|
6
|
-
managers: TabelaManagers;
|
|
7
|
-
components: TabelaComponents;
|
|
8
6
|
fragment: DocumentFragment;
|
|
9
7
|
listener: RemovableEventListener;
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
pool: RenderElementPool;
|
|
9
|
+
state: RenderState;
|
|
12
10
|
visible: Map<number, Key>;
|
|
13
|
-
constructor(
|
|
11
|
+
constructor(state: TabelaState);
|
|
14
12
|
destroy(): void;
|
|
15
13
|
removeCells(fields: string[]): void;
|
|
16
14
|
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 { TabelaState } from '../models/tabela.model';
|
|
4
4
|
export declare class RowManager {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor(managers: TabelaManagers, rowHeight: number);
|
|
5
|
+
state: TabelaState;
|
|
6
|
+
components: Map<Key, RowComponent>;
|
|
7
|
+
constructor(state: TabelaState);
|
|
9
8
|
destroy(): void;
|
|
10
9
|
get(key: Key): RowComponent | undefined;
|
|
11
10
|
has(key: Key): boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Key } from '@oscarpalmer/atoms/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TabelaSelection, TabelaState } from '../models/tabela.model';
|
|
3
3
|
export declare class SelectionManager {
|
|
4
|
-
|
|
5
|
-
readonly managers: TabelaManagers;
|
|
4
|
+
state: TabelaState;
|
|
6
5
|
handlers: Readonly<TabelaSelection>;
|
|
7
6
|
items: Set<Key>;
|
|
8
7
|
last: Key | undefined;
|
|
9
|
-
constructor(
|
|
8
|
+
constructor(state: TabelaState);
|
|
10
9
|
clear(): void;
|
|
11
10
|
deselect(keys: Key[]): void;
|
|
12
11
|
destroy(): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ArrayKeySorter } from '@oscarpalmer/atoms/array';
|
|
2
2
|
import type { PlainObject } from '@oscarpalmer/atoms/models';
|
|
3
3
|
import type { SortDirection, SortItem } from '../models/sort.model';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TabelaState } from '../models/tabela.model';
|
|
5
5
|
export declare class SortManager {
|
|
6
|
-
|
|
6
|
+
state: TabelaState;
|
|
7
7
|
handlers: Readonly<{
|
|
8
8
|
add: (field: string, direction: SortDirection | undefined) => void;
|
|
9
9
|
flip: (field: string) => void;
|
|
@@ -11,8 +11,8 @@ export declare class SortManager {
|
|
|
11
11
|
remove: (field: string) => void;
|
|
12
12
|
set: (items: SortItem[]) => void;
|
|
13
13
|
}>;
|
|
14
|
-
|
|
15
|
-
constructor(
|
|
14
|
+
items: ArrayKeySorter<PlainObject>[];
|
|
15
|
+
constructor(state: TabelaState);
|
|
16
16
|
add(field: string, direction?: SortDirection): void;
|
|
17
17
|
addOrSet(event: MouseEvent, field: string): void;
|
|
18
18
|
clear(): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TabelaState } 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
|
+
} & TabelaState;
|
|
@@ -6,12 +6,14 @@ import type { ColumnManager } from '../managers/column.manager';
|
|
|
6
6
|
import type { DataManager } from '../managers/data.manager';
|
|
7
7
|
import type { EventManager } from '../managers/event.manager';
|
|
8
8
|
import type { FilterManager } from '../managers/filter.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
14
|
import type { FilterItem } from './filter.model';
|
|
14
15
|
import type { SortDirection, SortItem } from './sort.model';
|
|
16
|
+
import type { TabelaOptions } from './tabela.options';
|
|
15
17
|
export type TabelaComponents = {
|
|
16
18
|
body: BodyComponent;
|
|
17
19
|
footer: FooterComponent;
|
|
@@ -38,6 +40,7 @@ export type TabelaManagers = {
|
|
|
38
40
|
data: DataManager;
|
|
39
41
|
event: EventManager;
|
|
40
42
|
filter: FilterManager;
|
|
43
|
+
navigation: NavigationManager;
|
|
41
44
|
row: RowManager;
|
|
42
45
|
selection: SelectionManager;
|
|
43
46
|
sort: SortManager;
|
|
@@ -56,3 +59,11 @@ export type TabelaSort = {
|
|
|
56
59
|
remove(field: string): void;
|
|
57
60
|
set(items: SortItem[]): void;
|
|
58
61
|
};
|
|
62
|
+
export type TabelaState = {
|
|
63
|
+
readonly components: TabelaComponents;
|
|
64
|
+
readonly element: HTMLElement;
|
|
65
|
+
readonly id: number;
|
|
66
|
+
readonly key: string;
|
|
67
|
+
readonly managers: TabelaManagers;
|
|
68
|
+
readonly options: TabelaOptions;
|
|
69
|
+
};
|