@danielgindi/dgtable.js 2.0.7 → 2.0.9
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/README.md +547 -282
- package/dist/SelectionHelper.d.ts +24 -0
- package/dist/SelectionHelper.d.ts.map +1 -0
- package/dist/by_column_filter.d.ts +14 -0
- package/dist/by_column_filter.d.ts.map +1 -0
- package/dist/cell_preview.d.ts +28 -0
- package/dist/cell_preview.d.ts.map +1 -0
- package/dist/column_collection.d.ts +41 -0
- package/dist/column_collection.d.ts.map +1 -0
- package/dist/column_resize.d.ts +25 -0
- package/dist/column_resize.d.ts.map +1 -0
- package/dist/constants.d.ts +19 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/header_events.d.ts +63 -0
- package/dist/header_events.d.ts.map +1 -0
- package/dist/helpers.d.ts +50 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/internal.d.ts +56 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/lib.cjs.js +6909 -3929
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +6912 -3932
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +9251 -4346
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/dist/private_types.d.ts +145 -0
- package/dist/private_types.d.ts.map +1 -0
- package/dist/rendering.d.ts +57 -0
- package/dist/rendering.d.ts.map +1 -0
- package/dist/row_collection.d.ts +38 -0
- package/dist/row_collection.d.ts.map +1 -0
- package/dist/types.d.ts +221 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/util.d.ts +9 -0
- package/dist/util.d.ts.map +1 -0
- package/eslint.config.mjs +1 -0
- package/package.json +26 -12
- package/src/SelectionHelper.ts +90 -0
- package/src/by_column_filter.ts +36 -0
- package/src/cell_preview.ts +325 -0
- package/src/column_collection.ts +131 -0
- package/src/column_resize.ts +363 -0
- package/src/constants.ts +22 -0
- package/src/header_events.ts +369 -0
- package/src/helpers.ts +291 -0
- package/src/index.ts +1628 -0
- package/src/internal.ts +263 -0
- package/src/private_types.ts +156 -0
- package/src/rendering.ts +771 -0
- package/src/row_collection.ts +197 -0
- package/src/types.ts +265 -0
- package/src/util.ts +27 -0
- package/tsconfig.json +38 -0
- package/src/SelectionHelper.js +0 -65
- package/src/by_column_filter.js +0 -25
- package/src/column_collection.js +0 -153
- package/src/index.js +0 -3991
- package/src/row_collection.js +0 -183
- package/src/util.js +0 -17
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection state for save/restore operations
|
|
3
|
+
*/
|
|
4
|
+
export interface SelectionState {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Helper class for saving and restoring text selections
|
|
10
|
+
* Based on Tim Down's solution with improvements
|
|
11
|
+
* @see https://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376
|
|
12
|
+
*/
|
|
13
|
+
declare class SelectionHelper {
|
|
14
|
+
/**
|
|
15
|
+
* Save the current selection relative to an element
|
|
16
|
+
*/
|
|
17
|
+
static saveSelection(el: Node): SelectionState | null;
|
|
18
|
+
/**
|
|
19
|
+
* Restore a previously saved selection
|
|
20
|
+
*/
|
|
21
|
+
static restoreSelection(el: Node, savedSel: SelectionState): void;
|
|
22
|
+
}
|
|
23
|
+
export default SelectionHelper;
|
|
24
|
+
//# sourceMappingURL=SelectionHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionHelper.d.ts","sourceRoot":"","sources":["../src/SelectionHelper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf;AAWD;;;;GAIG;AACH,cAAM,eAAe;IACjB;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,GAAG,cAAc,GAAG,IAAI;IAoBrD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;CAqCpE;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arguments for the by-column filter
|
|
3
|
+
*/
|
|
4
|
+
export interface ByColumnFilterArgs {
|
|
5
|
+
column: string;
|
|
6
|
+
keyword?: string | null;
|
|
7
|
+
caseSensitive?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Default filter function that filters rows by a column value containing a keyword
|
|
11
|
+
*/
|
|
12
|
+
declare function ByColumnFilter(row: Record<string, unknown>, args: ByColumnFilterArgs): boolean;
|
|
13
|
+
export default ByColumnFilter;
|
|
14
|
+
//# sourceMappingURL=by_column_filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"by_column_filter.d.ts","sourceRoot":"","sources":["../src/by_column_filter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,iBAAS,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAoBvF;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cell preview functionality for DGTable
|
|
3
|
+
*/
|
|
4
|
+
import type { DGTableInterface } from './private_types';
|
|
5
|
+
import { OriginalCellSymbol, PreviewCellSymbol } from './private_types';
|
|
6
|
+
interface PreviewCellElement extends HTMLDivElement {
|
|
7
|
+
rowVIndex?: number;
|
|
8
|
+
rowIndex?: number;
|
|
9
|
+
columnName?: string;
|
|
10
|
+
[OriginalCellSymbol]?: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
interface CellElement extends HTMLElement {
|
|
13
|
+
[PreviewCellSymbol]?: PreviewCellElement;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Handle cell mouse over event - show preview if content overflows
|
|
17
|
+
*/
|
|
18
|
+
export declare function cellMouseOverEvent(table: DGTableInterface, el: CellElement): void;
|
|
19
|
+
/**
|
|
20
|
+
* Handle cell mouse out event
|
|
21
|
+
*/
|
|
22
|
+
export declare function cellMouseOutEvent(table: DGTableInterface, _el: HTMLElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Hide the current cell preview
|
|
25
|
+
*/
|
|
26
|
+
export declare function hideCellPreview(table: DGTableInterface): DGTableInterface;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=cell_preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell_preview.d.ts","sourceRoot":"","sources":["../src/cell_preview.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACH,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,iBAAiB,CAAC;AAOzB,UAAU,kBAAmB,SAAQ,cAAc;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,kBAAkB,CAAC,CAAC,EAAE,WAAW,CAAC;CACtC;AAED,UAAU,WAAY,SAAQ,WAAW;IACrC,CAAC,iBAAiB,CAAC,CAAC,EAAE,kBAAkB,CAAC;CAC5C;AAaD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CA2NjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAEjF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CA8CzE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { InternalColumn } from './private_types';
|
|
2
|
+
/**
|
|
3
|
+
* A collection of columns that extends Array functionality
|
|
4
|
+
*/
|
|
5
|
+
declare class ColumnCollection extends Array<InternalColumn> {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Get the column by this name
|
|
9
|
+
*/
|
|
10
|
+
get(column: string): InternalColumn | null;
|
|
11
|
+
/**
|
|
12
|
+
* Get the index of the column by this name
|
|
13
|
+
*/
|
|
14
|
+
indexOf(column: string | InternalColumn): number;
|
|
15
|
+
/**
|
|
16
|
+
* Get the column by the specified order
|
|
17
|
+
*/
|
|
18
|
+
getByOrder(order: number): InternalColumn | null;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize order to be sequential starting from 0
|
|
21
|
+
*/
|
|
22
|
+
normalizeOrder(): this;
|
|
23
|
+
/**
|
|
24
|
+
* Get the array of columns, ordered by the order property
|
|
25
|
+
*/
|
|
26
|
+
getColumns(): InternalColumn[];
|
|
27
|
+
/**
|
|
28
|
+
* Get the array of visible columns, ordered by the order property
|
|
29
|
+
*/
|
|
30
|
+
getVisibleColumns(): InternalColumn[];
|
|
31
|
+
/**
|
|
32
|
+
* Get the maximum order currently in the array
|
|
33
|
+
*/
|
|
34
|
+
getMaxOrder(): number;
|
|
35
|
+
/**
|
|
36
|
+
* Move a column to a new spot in the collection
|
|
37
|
+
*/
|
|
38
|
+
moveColumn(src: InternalColumn, dest: InternalColumn): this;
|
|
39
|
+
}
|
|
40
|
+
export default ColumnCollection;
|
|
41
|
+
//# sourceMappingURL=column_collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column_collection.d.ts","sourceRoot":"","sources":["../src/column_collection.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACjB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,cAAM,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC;;IAKhD;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAS1C;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,MAAM;IAUhD;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAShD;;OAEG;IACH,cAAc,IAAI,IAAI;IAYtB;;OAEG;IACH,UAAU,IAAI,cAAc,EAAE;IAS9B;;OAEG;IACH,iBAAiB,IAAI,cAAc,EAAE;IAYrC;;OAEG;IACH,WAAW,IAAI,MAAM;IAWrB;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI;CAmB9D;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column resize functionality for DGTable
|
|
3
|
+
*/
|
|
4
|
+
import type { DGTableInterface } from './private_types';
|
|
5
|
+
/**
|
|
6
|
+
* Reverse-calculate the column to resize from mouse position
|
|
7
|
+
*/
|
|
8
|
+
export declare function getColumnByResizePosition(table: DGTableInterface, event: Event): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Cancel a resize in progress
|
|
11
|
+
*/
|
|
12
|
+
export declare function cancelColumnResize(table: DGTableInterface): DGTableInterface;
|
|
13
|
+
/**
|
|
14
|
+
* Handle mouse down on column header for resize
|
|
15
|
+
*/
|
|
16
|
+
export declare function onMouseDownColumnHeader(table: DGTableInterface, event: Event): boolean | void;
|
|
17
|
+
/**
|
|
18
|
+
* Handle mouse move during column resize
|
|
19
|
+
*/
|
|
20
|
+
export declare function onMouseMoveResizeArea(table: DGTableInterface, event: Event): void;
|
|
21
|
+
/**
|
|
22
|
+
* Handle pointer up after resize
|
|
23
|
+
*/
|
|
24
|
+
export declare function onResizerPointerUp(table: DGTableInterface, event: Event): void;
|
|
25
|
+
//# sourceMappingURL=column_resize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column_resize.d.ts","sourceRoot":"","sources":["../src/column_resize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAwBxD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAwC9F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CAU5E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,IAAI,CA4E7F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAyDjF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAuH9E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column width mode enumeration
|
|
3
|
+
*/
|
|
4
|
+
export declare const ColumnWidthMode: {
|
|
5
|
+
readonly AUTO: 0;
|
|
6
|
+
readonly ABSOLUTE: 1;
|
|
7
|
+
readonly RELATIVE: 2;
|
|
8
|
+
};
|
|
9
|
+
export type ColumnWidthModeType = typeof ColumnWidthMode[keyof typeof ColumnWidthMode];
|
|
10
|
+
/**
|
|
11
|
+
* Table width mode enumeration
|
|
12
|
+
*/
|
|
13
|
+
export declare const Width: {
|
|
14
|
+
readonly NONE: "none";
|
|
15
|
+
readonly AUTO: "auto";
|
|
16
|
+
readonly SCROLL: "scroll";
|
|
17
|
+
};
|
|
18
|
+
export type WidthType = typeof Width[keyof typeof Width];
|
|
19
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,KAAK;;;;CAIR,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header events functionality for DGTable
|
|
3
|
+
*/
|
|
4
|
+
import type { DGTableInterface } from './private_types';
|
|
5
|
+
import { RelatedTouchSymbol } from './private_types';
|
|
6
|
+
type PositionHost = {
|
|
7
|
+
pageX: number;
|
|
8
|
+
pageY: number;
|
|
9
|
+
clientX?: number;
|
|
10
|
+
identifier?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Handle touch start on column header
|
|
14
|
+
*/
|
|
15
|
+
export declare function onTouchStartColumnHeader(table: DGTableInterface, event: TouchEvent & {
|
|
16
|
+
[RelatedTouchSymbol]?: PositionHost;
|
|
17
|
+
}): void;
|
|
18
|
+
/**
|
|
19
|
+
* Handle mouse move on column header
|
|
20
|
+
*/
|
|
21
|
+
export declare function onMouseMoveColumnHeader(table: DGTableInterface, event: Event): void;
|
|
22
|
+
/**
|
|
23
|
+
* Handle mouse up on column header
|
|
24
|
+
*/
|
|
25
|
+
export declare function onMouseUpColumnHeader(table: DGTableInterface, event: Event): void;
|
|
26
|
+
/**
|
|
27
|
+
* Trigger context menu on column header
|
|
28
|
+
*/
|
|
29
|
+
export declare function triggerColumnHeaderContextMenu(table: DGTableInterface, event: Event): void;
|
|
30
|
+
/**
|
|
31
|
+
* Handle mouse leave on column header
|
|
32
|
+
*/
|
|
33
|
+
export declare function onMouseLeaveColumnHeader(table: DGTableInterface, event: MouseEvent): void;
|
|
34
|
+
/**
|
|
35
|
+
* Handle sort click on column header
|
|
36
|
+
*/
|
|
37
|
+
export declare function onSortOnColumnHeaderEvent(table: DGTableInterface, event: Event): void;
|
|
38
|
+
/**
|
|
39
|
+
* Handle drag start on column header
|
|
40
|
+
*/
|
|
41
|
+
export declare function onStartDragColumnHeader(table: DGTableInterface, event: DragEvent): void;
|
|
42
|
+
/**
|
|
43
|
+
* Handle drag end on column header
|
|
44
|
+
*/
|
|
45
|
+
export declare function onDragEndColumnHeader(table: DGTableInterface, event: DragEvent): void;
|
|
46
|
+
/**
|
|
47
|
+
* Handle drag enter on column header
|
|
48
|
+
*/
|
|
49
|
+
export declare function onDragEnterColumnHeader(table: DGTableInterface, event: DragEvent): void;
|
|
50
|
+
/**
|
|
51
|
+
* Handle drag over on column header
|
|
52
|
+
*/
|
|
53
|
+
export declare function onDragOverColumnHeader(_table: DGTableInterface, event: DragEvent): void;
|
|
54
|
+
/**
|
|
55
|
+
* Handle drag leave on column header
|
|
56
|
+
*/
|
|
57
|
+
export declare function onDragLeaveColumnHeader(table: DGTableInterface, event: DragEvent): void;
|
|
58
|
+
/**
|
|
59
|
+
* Handle drop on column header
|
|
60
|
+
*/
|
|
61
|
+
export declare function onDropColumnHeader(table: DGTableInterface, event: DragEvent): void;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=header_events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header_events.d.ts","sourceRoot":"","sources":["../src/header_events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAYrD,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAcF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,GAAG;IAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,YAAY,CAAA;CAAE,GAAG,IAAI,CAmFnI;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAgBnF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAKjF;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAmB1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAMzF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAuCrF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAsBvF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAMrF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CA2BvF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAEvF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CASvF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CA6BlF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for DGTable
|
|
3
|
+
* These are extracted to keep the main class focused on public API
|
|
4
|
+
*/
|
|
5
|
+
import type { InternalColumn, DGTableInterface } from './private_types';
|
|
6
|
+
/**
|
|
7
|
+
* BUGFIX: WebKit has a bug where it does not relayout
|
|
8
|
+
*/
|
|
9
|
+
export declare function webkitRenderBugfix(el: HTMLElement): HTMLElement;
|
|
10
|
+
/**
|
|
11
|
+
* Make element relative if not already positioned
|
|
12
|
+
*/
|
|
13
|
+
export declare function relativizeElement(el: HTMLElement): void;
|
|
14
|
+
/**
|
|
15
|
+
* Check if event target is an input element
|
|
16
|
+
*/
|
|
17
|
+
export declare function isInputElementEvent(event: Event): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Calculate horizontal padding of an element
|
|
20
|
+
*/
|
|
21
|
+
export declare function horizontalPadding(el: Element): number;
|
|
22
|
+
/**
|
|
23
|
+
* Calculate horizontal border width of an element
|
|
24
|
+
*/
|
|
25
|
+
export declare function horizontalBorderWidth(el: Element): number;
|
|
26
|
+
/**
|
|
27
|
+
* Disable CSS text selection on an element
|
|
28
|
+
*/
|
|
29
|
+
export declare function disableCssSelect(el: HTMLElement): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get text width by measuring in a temporary element
|
|
32
|
+
*/
|
|
33
|
+
export declare function getTextWidth(table: DGTableInterface, text: string): number;
|
|
34
|
+
/**
|
|
35
|
+
* Calculate width available for columns
|
|
36
|
+
*/
|
|
37
|
+
export declare function calculateWidthAvailableForColumns(table: DGTableInterface): number;
|
|
38
|
+
/**
|
|
39
|
+
* Calculate the size required for the table body width
|
|
40
|
+
*/
|
|
41
|
+
export declare function calculateTbodyWidth(table: DGTableInterface): number;
|
|
42
|
+
/**
|
|
43
|
+
* Check if table is RTL
|
|
44
|
+
*/
|
|
45
|
+
export declare function isTableRtl(table: DGTableInterface): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Serialize column width to string
|
|
48
|
+
*/
|
|
49
|
+
export declare function serializeColumnWidth(column: InternalColumn): string | number;
|
|
50
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,GAAG,WAAW,CAO/D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAIvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAGzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAIzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAQtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA+B1E;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAiFjF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAyEnE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAG3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,CAI5E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { DGTableOptions, RowData, FilterFunction, ColumnOptions, CellFormatter, HeaderCellFormatter, OnComparatorRequired, CustomSortingProvider, SerializedColumn, SerializedColumnSort, DGTableEventMap } from './types';
|
|
2
|
+
import type { DGTableInternalOptions, DGTablePrivateState } from './private_types';
|
|
3
|
+
declare class DGTable {
|
|
4
|
+
static VERSION: string;
|
|
5
|
+
static Width: {
|
|
6
|
+
readonly NONE: "none";
|
|
7
|
+
readonly AUTO: "auto";
|
|
8
|
+
readonly SCROLL: "scroll";
|
|
9
|
+
};
|
|
10
|
+
VERSION: string;
|
|
11
|
+
el: HTMLElement;
|
|
12
|
+
_o: DGTableInternalOptions;
|
|
13
|
+
_p: DGTablePrivateState;
|
|
14
|
+
__removed?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @param options - initialization options
|
|
17
|
+
*/
|
|
18
|
+
constructor(options?: DGTableOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Register an event handler.
|
|
21
|
+
* Built-in events have typed handlers. Custom events use `unknown` data type.
|
|
22
|
+
*/
|
|
23
|
+
on<K extends keyof DGTableEventMap>(event: K, handler: (value: DGTableEventMap[K]) => void): this;
|
|
24
|
+
on<T = unknown>(event: string & {}, handler: (value: T) => void): this;
|
|
25
|
+
/**
|
|
26
|
+
* Register a one-time event handler.
|
|
27
|
+
* Built-in events have typed handlers. Custom events use `unknown` data type.
|
|
28
|
+
*/
|
|
29
|
+
once<K extends keyof DGTableEventMap>(event: K, handler: (value: DGTableEventMap[K]) => void): this;
|
|
30
|
+
once<T = unknown>(event: string & {}, handler: (value: T) => void): this;
|
|
31
|
+
/**
|
|
32
|
+
* Remove a handler for an event, all handlers for an event, or all handlers completely.
|
|
33
|
+
* Built-in events have typed handlers. Custom events use `unknown` data type.
|
|
34
|
+
*/
|
|
35
|
+
off<K extends keyof DGTableEventMap>(event?: K, handler?: (value: DGTableEventMap[K]) => void): this;
|
|
36
|
+
off<T = unknown>(event?: string & {}, handler?: (value: T) => void): this;
|
|
37
|
+
/**
|
|
38
|
+
* Emit an event.
|
|
39
|
+
* Built-in events have typed data. Custom events accept any data type.
|
|
40
|
+
*/
|
|
41
|
+
emit<K extends keyof DGTableEventMap>(event: K, value?: DGTableEventMap[K]): this;
|
|
42
|
+
emit<T = unknown>(event: string & {}, value?: T): this;
|
|
43
|
+
/**
|
|
44
|
+
* Destroy, releasing all memory, events and DOM elements
|
|
45
|
+
*/
|
|
46
|
+
destroy(): this;
|
|
47
|
+
close(): void;
|
|
48
|
+
remove(): void;
|
|
49
|
+
/** Render the table */
|
|
50
|
+
render(): this;
|
|
51
|
+
/** Forces a full render of the table */
|
|
52
|
+
clearAndRender(render?: boolean): this;
|
|
53
|
+
/** Sets the columns of the table */
|
|
54
|
+
setColumns(columns?: ColumnOptions[] | null, render?: boolean): this;
|
|
55
|
+
/** Add a column to the table */
|
|
56
|
+
addColumn(columnData: ColumnOptions, before?: string | number, render?: boolean): this;
|
|
57
|
+
/** Remove a column from the table */
|
|
58
|
+
removeColumn(column: string, render?: boolean): this;
|
|
59
|
+
/** Set a new label to a column */
|
|
60
|
+
setColumnLabel(column: string, label: string): this;
|
|
61
|
+
/** Move a column to a new position */
|
|
62
|
+
moveColumn(src: string | number, dest: string | number, visibleOnly?: boolean): this;
|
|
63
|
+
/** Show or hide a column */
|
|
64
|
+
setColumnVisible(column: string, visible: boolean): this;
|
|
65
|
+
/** Get the visibility mode of a column */
|
|
66
|
+
isColumnVisible(column: string): boolean;
|
|
67
|
+
/** Globally set the minimum column width */
|
|
68
|
+
setMinColumnWidth(minColumnWidth: number): this;
|
|
69
|
+
/** Get the current minimum column width */
|
|
70
|
+
getMinColumnWidth(): number;
|
|
71
|
+
/** Set a new width to a column */
|
|
72
|
+
setColumnWidth(column: string, width: number | string): this;
|
|
73
|
+
/** Get the serialized width of the specified column */
|
|
74
|
+
getColumnWidth(column: string): string | number | null;
|
|
75
|
+
/** Get configuration for a specific column */
|
|
76
|
+
getColumnConfig(column: string): SerializedColumn | null;
|
|
77
|
+
/** Returns a config object for all columns */
|
|
78
|
+
getColumnsConfig(): Record<string, SerializedColumn>;
|
|
79
|
+
/** Set the limit on concurrent columns sorted */
|
|
80
|
+
setSortableColumns(sortableColumns: number): this;
|
|
81
|
+
/** Get the limit on concurrent columns sorted */
|
|
82
|
+
getSortableColumns(): number;
|
|
83
|
+
/** Set whether columns are movable */
|
|
84
|
+
setMovableColumns(movableColumns?: boolean): this;
|
|
85
|
+
/** Get whether columns are movable */
|
|
86
|
+
getMovableColumns(): boolean;
|
|
87
|
+
/** Set whether columns are resizable */
|
|
88
|
+
setResizableColumns(resizableColumns?: boolean): this;
|
|
89
|
+
/** Get whether columns are resizable */
|
|
90
|
+
getResizableColumns(): boolean;
|
|
91
|
+
/** Sets a function that supplies comparators dynamically */
|
|
92
|
+
setOnComparatorRequired(comparatorProvider: OnComparatorRequired | null): this;
|
|
93
|
+
/** Sets custom sorting function for a data set */
|
|
94
|
+
setCustomSortingProvider(customSortingProvider: CustomSortingProvider | null): this;
|
|
95
|
+
/** Sort the table by column */
|
|
96
|
+
sort(column?: string, descending?: boolean, add?: boolean): this;
|
|
97
|
+
/** Re-sort the table using current sort specifiers */
|
|
98
|
+
resort(): this;
|
|
99
|
+
/** Returns an array of the currently sorted columns */
|
|
100
|
+
getSortedColumns(): SerializedColumnSort[];
|
|
101
|
+
/** Sets a new cell formatter */
|
|
102
|
+
setCellFormatter(formatter?: CellFormatter | null): this;
|
|
103
|
+
/** Sets a new header cell formatter */
|
|
104
|
+
setHeaderCellFormatter(formatter?: HeaderCellFormatter | null): this;
|
|
105
|
+
/** Set the filter function */
|
|
106
|
+
setFilter(filterFunc?: FilterFunction | null): this;
|
|
107
|
+
/** Filter the table rows */
|
|
108
|
+
filter(args?: unknown): this;
|
|
109
|
+
/** Clear the current filter */
|
|
110
|
+
clearFilter(): this;
|
|
111
|
+
/** Returns the HTML string for a specific cell by row index */
|
|
112
|
+
getHtmlForRowCell(rowIndex: number, columnName: string): string | null;
|
|
113
|
+
/** Returns the HTML string for a specific cell by row data */
|
|
114
|
+
getHtmlForRowDataCell(rowData: RowData, columnName: string): string | null;
|
|
115
|
+
/** Returns the y position of a row by index */
|
|
116
|
+
getRowYPos(rowIndex: number): number | null;
|
|
117
|
+
/** Returns the row data for a specific row */
|
|
118
|
+
getDataForRow(row: number): RowData | null;
|
|
119
|
+
/** Gets the number of rows */
|
|
120
|
+
getRowCount(): number;
|
|
121
|
+
/** Returns the actual row index for specific row data */
|
|
122
|
+
getIndexForRow(rowData: RowData): number;
|
|
123
|
+
/** Gets the number of filtered rows */
|
|
124
|
+
getFilteredRowCount(): number;
|
|
125
|
+
/** Returns the filtered row index for specific row data */
|
|
126
|
+
getIndexForFilteredRow(rowData: RowData): number;
|
|
127
|
+
/** Returns the row data for a specific filtered row */
|
|
128
|
+
getDataForFilteredRow(row: number): RowData | null;
|
|
129
|
+
/** Returns DOM element of the header row */
|
|
130
|
+
getHeaderRowElement(): HTMLElement | undefined;
|
|
131
|
+
/** Add rows to the table */
|
|
132
|
+
addRows(data: RowData | RowData[], at?: number | boolean, resort?: boolean, render?: boolean): this;
|
|
133
|
+
/** Removes rows from the table */
|
|
134
|
+
removeRows(rowIndex: number, count: number, render?: boolean): this;
|
|
135
|
+
/** Removes a single row from the table */
|
|
136
|
+
removeRow(rowIndex: number, render?: boolean): this;
|
|
137
|
+
/** Refreshes the row specified */
|
|
138
|
+
refreshRow(rowIndex: number, render?: boolean): this;
|
|
139
|
+
/** Get the DOM element for the specified row, if it exists */
|
|
140
|
+
getRowElement(rowIndex: number): HTMLElement | null;
|
|
141
|
+
/** Refreshes all virtual rows */
|
|
142
|
+
refreshAllVirtualRows(): this;
|
|
143
|
+
/** Replace the whole dataset */
|
|
144
|
+
setRows(data: RowData[], resort?: boolean): this;
|
|
145
|
+
/** Notify the table that its width has changed */
|
|
146
|
+
tableWidthChanged(forceUpdate?: boolean, renderColumns?: boolean): this;
|
|
147
|
+
/** Notify the table that its height has changed */
|
|
148
|
+
tableHeightChanged(): this;
|
|
149
|
+
/** Hides the current cell preview */
|
|
150
|
+
hideCellPreview(): this;
|
|
151
|
+
/** A synonym for hideCellPreview() */
|
|
152
|
+
abortCellPreview(): this;
|
|
153
|
+
/** Cancel a resize in progress */
|
|
154
|
+
cancelColumnResize(): this;
|
|
155
|
+
/** Creates a URL representing the data in the specified element (for Web Workers) */
|
|
156
|
+
getUrlForElementContent(id: string): string | null;
|
|
157
|
+
/** Check if Web Workers are supported */
|
|
158
|
+
isWorkerSupported(): boolean;
|
|
159
|
+
/** Creates a Web Worker for updating the table */
|
|
160
|
+
createWebWorker(url: string, start?: boolean, resort?: boolean): Worker | null;
|
|
161
|
+
/** Unbinds a Web Worker from the table, stopping updates */
|
|
162
|
+
unbindWebWorker(worker: Worker): this;
|
|
163
|
+
}
|
|
164
|
+
export default DGTable;
|
|
165
|
+
export type { DGTableOptions, ColumnOptions, ColumnSortOptions, SerializedColumn, SerializedColumnSort, RowData, CellFormatter, HeaderCellFormatter, FilterFunction, ComparatorFunction, OnComparatorRequired, CustomSortingProvider, RowCreateEvent, RowClickEvent, CellPreviewEvent, CellPreviewDestroyEvent, HeaderContextMenuEvent, MoveColumnEvent, ColumnWidthEvent, AddRowsEvent, SortEvent, DGTableEventMap, } from './types';
|
|
166
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyEA,OAAO,EACH,cAAc,EACd,OAAO,EAEP,cAAc,EACd,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EACR,sBAAsB,EACtB,mBAAmB,EACtB,MAAM,iBAAiB,CAAC;AASzB,cAAM,OAAO;IAET,MAAM,CAAC,OAAO,SAAe;IAC7B,MAAM,CAAC,KAAK;;;;MAAS;IAGrB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAG,WAAW,CAAC;IACjB,EAAE,EAAG,sBAAsB,CAAC;IAC5B,EAAE,EAAG,mBAAmB,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;gBACS,OAAO,CAAC,EAAE,cAAc;IAwGpC;;;OAGG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IACjG,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI;IAMtE;;;OAGG;IACH,IAAI,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IACnG,IAAI,CAAC,CAAC,GAAG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,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAET,eAAe,GAClB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helper functions for DGTable
|
|
3
|
+
* These are extracted from the class to avoid exposing them on the public API
|
|
4
|
+
*/
|
|
5
|
+
import type { ColumnOptions, RowData } from './types';
|
|
6
|
+
import type { ColumnWidthModeType } from './constants';
|
|
7
|
+
import type { DGTablePrivateState, DGTableInternalOptions, InternalColumn } from './private_types';
|
|
8
|
+
/**
|
|
9
|
+
* Interface for the table instance passed to internal functions
|
|
10
|
+
*/
|
|
11
|
+
export interface DGTableInternal {
|
|
12
|
+
el: HTMLElement;
|
|
13
|
+
_o: DGTableInternalOptions;
|
|
14
|
+
_p: DGTablePrivateState;
|
|
15
|
+
emit(event: string, value?: unknown): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Setup cell hover event handlers
|
|
19
|
+
*/
|
|
20
|
+
export declare function setupHovers(table: DGTableInternal): void;
|
|
21
|
+
/**
|
|
22
|
+
* Handle horizontal scroll synchronization
|
|
23
|
+
*/
|
|
24
|
+
export declare function onTableScrolledHorizontally(table: DGTableInternal): void;
|
|
25
|
+
/**
|
|
26
|
+
* Bind event handlers to a header column element
|
|
27
|
+
*/
|
|
28
|
+
export declare function bindHeaderColumnEvents(table: DGTableInternal, columnEl: HTMLElement): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unbind cell events for a single row
|
|
31
|
+
*/
|
|
32
|
+
export declare function unbindCellEventsForRow(table: DGTableInternal, rowToClean: HTMLElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* Parse column width and determine width mode
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseColumnWidth(width: number | string | null | undefined, minWidth: number): {
|
|
37
|
+
width: number;
|
|
38
|
+
mode: ColumnWidthModeType;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Initialize a column from column options data
|
|
42
|
+
*/
|
|
43
|
+
export declare function initColumnFromData(options: DGTableInternalOptions, columnData: ColumnOptions): InternalColumn;
|
|
44
|
+
/**
|
|
45
|
+
* Ensure at least one column is visible
|
|
46
|
+
*/
|
|
47
|
+
export declare function ensureVisibleColumns(table: DGTableInternal): void;
|
|
48
|
+
/**
|
|
49
|
+
* Refilter the rows using current filter
|
|
50
|
+
*/
|
|
51
|
+
export declare function refilter(table: DGTableInternal): void;
|
|
52
|
+
/**
|
|
53
|
+
* Get HTML content for a cell
|
|
54
|
+
*/
|
|
55
|
+
export declare function getHtmlForCell(options: DGTableInternalOptions, rowData: RowData, column: InternalColumn): string;
|
|
56
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,OAAO,KAAK,EAAE,aAAa,EAAkB,OAAO,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,WAAW,CAAC;IAChB,EAAE,EAAE,sBAAsB,CAAC;IAC3B,EAAE,EAAE,mBAAmB,CAAC;IACxB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAkDxD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAIxE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,EA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