UNPKG

1.98 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module table/ui/inserttableview
7 */
8import { View, ButtonView, type ViewCollection } from 'ckeditor5/src/ui';
9import { KeystrokeHandler, FocusTracker, type Locale } from 'ckeditor5/src/utils';
10import './../../theme/inserttable.css';
11/**
12 * The table size view.
13 *
14 * It renders a 10x10 grid to choose the inserted table size.
15 */
16export default class InsertTableView extends View {
17 /**
18 * A collection of table size box items.
19 */
20 readonly items: ViewCollection<ButtonView>;
21 /**
22 * Listen to `keydown` events fired in this view's main element.
23 */
24 readonly keystrokes: KeystrokeHandler;
25 /**
26 * Tracks information about the DOM focus in the grid.
27 */
28 readonly focusTracker: FocusTracker;
29 /**
30 * The currently selected number of rows of the new table.
31 *
32 * @observable
33 */
34 rows: number;
35 /**
36 * The currently selected number of columns of the new table.
37 *
38 * @observable
39 */
40 columns: number;
41 /**
42 * The label text displayed under the boxes.
43 *
44 * @observable
45 */
46 label: string;
47 /**
48 * @inheritDoc
49 */
50 constructor(locale: Locale);
51 render(): void;
52 /**
53 * @inheritDoc
54 */
55 focus(): void;
56 /**
57 * @inheritDoc
58 */
59 focusLast(): void;
60 /**
61 * Highlights grid boxes depending on rows and columns selected.
62 */
63 private _highlightGridBoxes;
64 /**
65 * Creates a new Button for the grid.
66 *
67 * @param locale The locale instance.
68 * @param row Row number.
69 * @param column Column number.
70 * @param label The grid button label.
71 */
72 private _createGridButton;
73 /**
74 * @returns A view collection containing boxes to be placed in a table grid.
75 */
76 private _createGridCollection;
77}