summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/grid/grid.ts
blob: 0428e6493c78683a7a147ae9522ac58711bf0657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import { EventEmitter } from 'eventemitter3';
import type { CellValue, GridCellSetting } from '@/components/grid/cell.js';
import type { GridColumnSetting } from '@/components/grid/column.js';
import type { GridRowSetting } from '@/components/grid/row.js';

export type GridSetting = {
	root?: {
		noOverflowStyle?: boolean;
		rounded?: boolean;
		outerBorder?: boolean;
	};
	row?: GridRowSetting;
	cols: GridColumnSetting[];
	cells?: GridCellSetting;
};

export type DataSource = Record<string, CellValue>;

export type GridState = (
	'normal' |
	'cellSelecting' |
	'cellEditing' |
	'colResizing' |
	'colSelecting' |
	'rowSelecting' |
	'hidden'
);

export type Size = {
	width: number;
	height: number;
};

export type SizeStyle = number | 'auto' | undefined;

export type AdditionalStyle = {
	className?: string;
	style?: Record<string, string | number>;
};

export class GridEventEmitter extends EventEmitter<{
	'forceRefreshContentSize': void;
}> {
}