@ckeditor/ckeditor5-table 41.3.0 → 41.4.0-alpha.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.
Files changed (205) hide show
  1. package/dist/index-content.css +55 -0
  2. package/dist/index-editor.css +150 -0
  3. package/dist/index.css +362 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +10464 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/translations/ar.d.ts +8 -0
  8. package/dist/translations/ar.js +5 -0
  9. package/dist/translations/az.d.ts +8 -0
  10. package/dist/translations/az.js +5 -0
  11. package/dist/translations/bg.d.ts +8 -0
  12. package/dist/translations/bg.js +5 -0
  13. package/dist/translations/bn.d.ts +8 -0
  14. package/dist/translations/bn.js +5 -0
  15. package/dist/translations/ca.d.ts +8 -0
  16. package/dist/translations/ca.js +5 -0
  17. package/dist/translations/cs.d.ts +8 -0
  18. package/dist/translations/cs.js +5 -0
  19. package/dist/translations/da.d.ts +8 -0
  20. package/dist/translations/da.js +5 -0
  21. package/dist/translations/de-ch.d.ts +8 -0
  22. package/dist/translations/de-ch.js +5 -0
  23. package/dist/translations/de.d.ts +8 -0
  24. package/dist/translations/de.js +5 -0
  25. package/dist/translations/el.d.ts +8 -0
  26. package/dist/translations/el.js +5 -0
  27. package/dist/translations/en-au.d.ts +8 -0
  28. package/dist/translations/en-au.js +5 -0
  29. package/dist/translations/en-gb.d.ts +8 -0
  30. package/dist/translations/en-gb.js +5 -0
  31. package/dist/translations/en.d.ts +8 -0
  32. package/dist/translations/en.js +5 -0
  33. package/dist/translations/es.d.ts +8 -0
  34. package/dist/translations/es.js +5 -0
  35. package/dist/translations/et.d.ts +8 -0
  36. package/dist/translations/et.js +5 -0
  37. package/dist/translations/fa.d.ts +8 -0
  38. package/dist/translations/fa.js +5 -0
  39. package/dist/translations/fi.d.ts +8 -0
  40. package/dist/translations/fi.js +5 -0
  41. package/dist/translations/fr.d.ts +8 -0
  42. package/dist/translations/fr.js +5 -0
  43. package/dist/translations/gl.d.ts +8 -0
  44. package/dist/translations/gl.js +5 -0
  45. package/dist/translations/he.d.ts +8 -0
  46. package/dist/translations/he.js +5 -0
  47. package/dist/translations/hi.d.ts +8 -0
  48. package/dist/translations/hi.js +5 -0
  49. package/dist/translations/hr.d.ts +8 -0
  50. package/dist/translations/hr.js +5 -0
  51. package/dist/translations/hu.d.ts +8 -0
  52. package/dist/translations/hu.js +5 -0
  53. package/dist/translations/hy.d.ts +8 -0
  54. package/dist/translations/hy.js +5 -0
  55. package/dist/translations/id.d.ts +8 -0
  56. package/dist/translations/id.js +5 -0
  57. package/dist/translations/it.d.ts +8 -0
  58. package/dist/translations/it.js +5 -0
  59. package/dist/translations/ja.d.ts +8 -0
  60. package/dist/translations/ja.js +5 -0
  61. package/dist/translations/ko.d.ts +8 -0
  62. package/dist/translations/ko.js +5 -0
  63. package/dist/translations/ku.d.ts +8 -0
  64. package/dist/translations/ku.js +5 -0
  65. package/dist/translations/lt.d.ts +8 -0
  66. package/dist/translations/lt.js +5 -0
  67. package/dist/translations/lv.d.ts +8 -0
  68. package/dist/translations/lv.js +5 -0
  69. package/dist/translations/ms.d.ts +8 -0
  70. package/dist/translations/ms.js +5 -0
  71. package/dist/translations/nb.d.ts +8 -0
  72. package/dist/translations/nb.js +5 -0
  73. package/dist/translations/ne.d.ts +8 -0
  74. package/dist/translations/ne.js +5 -0
  75. package/dist/translations/nl.d.ts +8 -0
  76. package/dist/translations/nl.js +5 -0
  77. package/dist/translations/no.d.ts +8 -0
  78. package/dist/translations/no.js +5 -0
  79. package/dist/translations/pl.d.ts +8 -0
  80. package/dist/translations/pl.js +5 -0
  81. package/dist/translations/pt-br.d.ts +8 -0
  82. package/dist/translations/pt-br.js +5 -0
  83. package/dist/translations/pt.d.ts +8 -0
  84. package/dist/translations/pt.js +5 -0
  85. package/dist/translations/ro.d.ts +8 -0
  86. package/dist/translations/ro.js +5 -0
  87. package/dist/translations/ru.d.ts +8 -0
  88. package/dist/translations/ru.js +5 -0
  89. package/dist/translations/sk.d.ts +8 -0
  90. package/dist/translations/sk.js +5 -0
  91. package/dist/translations/sl.d.ts +8 -0
  92. package/dist/translations/sl.js +5 -0
  93. package/dist/translations/sq.d.ts +8 -0
  94. package/dist/translations/sq.js +5 -0
  95. package/dist/translations/sr-latn.d.ts +8 -0
  96. package/dist/translations/sr-latn.js +5 -0
  97. package/dist/translations/sr.d.ts +8 -0
  98. package/dist/translations/sr.js +5 -0
  99. package/dist/translations/sv.d.ts +8 -0
  100. package/dist/translations/sv.js +5 -0
  101. package/dist/translations/th.d.ts +8 -0
  102. package/dist/translations/th.js +5 -0
  103. package/dist/translations/tk.d.ts +8 -0
  104. package/dist/translations/tk.js +5 -0
  105. package/dist/translations/tr.d.ts +8 -0
  106. package/dist/translations/tr.js +5 -0
  107. package/dist/translations/tt.d.ts +8 -0
  108. package/dist/translations/tt.js +5 -0
  109. package/dist/translations/ug.d.ts +8 -0
  110. package/dist/translations/ug.js +5 -0
  111. package/dist/translations/uk.d.ts +8 -0
  112. package/dist/translations/uk.js +5 -0
  113. package/dist/translations/ur.d.ts +8 -0
  114. package/dist/translations/ur.js +5 -0
  115. package/dist/translations/uz.d.ts +8 -0
  116. package/dist/translations/uz.js +5 -0
  117. package/dist/translations/vi.d.ts +8 -0
  118. package/dist/translations/vi.js +5 -0
  119. package/dist/translations/zh-cn.d.ts +8 -0
  120. package/dist/translations/zh-cn.js +5 -0
  121. package/dist/translations/zh.d.ts +8 -0
  122. package/dist/translations/zh.js +5 -0
  123. package/dist/types/augmentation.d.ts +80 -0
  124. package/dist/types/commands/insertcolumncommand.d.ts +59 -0
  125. package/dist/types/commands/insertrowcommand.d.ts +58 -0
  126. package/dist/types/commands/inserttablecommand.d.ts +48 -0
  127. package/dist/types/commands/mergecellcommand.d.ts +72 -0
  128. package/dist/types/commands/mergecellscommand.d.ts +32 -0
  129. package/dist/types/commands/removecolumncommand.d.ts +33 -0
  130. package/dist/types/commands/removerowcommand.d.ts +33 -0
  131. package/dist/types/commands/selectcolumncommand.d.ts +37 -0
  132. package/dist/types/commands/selectrowcommand.d.ts +37 -0
  133. package/dist/types/commands/setheadercolumncommand.d.ts +54 -0
  134. package/dist/types/commands/setheaderrowcommand.d.ts +57 -0
  135. package/dist/types/commands/splitcellcommand.d.ts +47 -0
  136. package/dist/types/converters/downcast.d.ts +67 -0
  137. package/dist/types/converters/table-caption-post-fixer.d.ts +24 -0
  138. package/dist/types/converters/table-cell-paragraph-post-fixer.d.ts +36 -0
  139. package/dist/types/converters/table-cell-refresh-handler.d.ts +22 -0
  140. package/dist/types/converters/table-headings-refresh-handler.d.ts +21 -0
  141. package/dist/types/converters/table-layout-post-fixer.d.ts +230 -0
  142. package/dist/types/converters/tableproperties.d.ts +58 -0
  143. package/dist/types/converters/upcasttable.d.ts +53 -0
  144. package/dist/types/index.d.ts +64 -0
  145. package/dist/types/plaintableoutput.d.ts +30 -0
  146. package/dist/types/table.d.ts +44 -0
  147. package/dist/types/tablecaption/tablecaptionediting.d.ts +67 -0
  148. package/dist/types/tablecaption/tablecaptionui.d.ts +25 -0
  149. package/dist/types/tablecaption/toggletablecaptioncommand.d.ts +72 -0
  150. package/dist/types/tablecaption/utils.d.ts +42 -0
  151. package/dist/types/tablecaption.d.ts +28 -0
  152. package/dist/types/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +36 -0
  153. package/dist/types/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +41 -0
  154. package/dist/types/tablecellproperties/commands/tablecellborderstylecommand.d.ts +41 -0
  155. package/dist/types/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +55 -0
  156. package/dist/types/tablecellproperties/commands/tablecellheightcommand.d.ts +50 -0
  157. package/dist/types/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +36 -0
  158. package/dist/types/tablecellproperties/commands/tablecellpaddingcommand.d.ts +55 -0
  159. package/dist/types/tablecellproperties/commands/tablecellpropertycommand.d.ts +66 -0
  160. package/dist/types/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +44 -0
  161. package/dist/types/tablecellproperties/tablecellpropertiesediting.d.ts +47 -0
  162. package/dist/types/tablecellproperties/tablecellpropertiesui.d.ts +116 -0
  163. package/dist/types/tablecellproperties/ui/tablecellpropertiesview.d.ts +232 -0
  164. package/dist/types/tablecellproperties.d.ts +34 -0
  165. package/dist/types/tablecellwidth/commands/tablecellwidthcommand.d.ts +50 -0
  166. package/dist/types/tablecellwidth/tablecellwidthediting.d.ts +33 -0
  167. package/dist/types/tableclipboard.d.ts +74 -0
  168. package/dist/types/tablecolumnresize/constants.d.ts +24 -0
  169. package/dist/types/tablecolumnresize/converters.d.ts +22 -0
  170. package/dist/types/tablecolumnresize/tablecolumnresizeediting.d.ts +143 -0
  171. package/dist/types/tablecolumnresize/tablewidthscommand.d.ts +42 -0
  172. package/dist/types/tablecolumnresize/utils.d.ts +152 -0
  173. package/dist/types/tablecolumnresize.d.ts +30 -0
  174. package/dist/types/tableconfig.d.ts +347 -0
  175. package/dist/types/tableediting.d.ts +102 -0
  176. package/dist/types/tablekeyboard.d.ts +72 -0
  177. package/dist/types/tablemouse/mouseeventsobserver.d.ts +66 -0
  178. package/dist/types/tablemouse.d.ts +52 -0
  179. package/dist/types/tableproperties/commands/tablealignmentcommand.d.ts +36 -0
  180. package/dist/types/tableproperties/commands/tablebackgroundcolorcommand.d.ts +36 -0
  181. package/dist/types/tableproperties/commands/tablebordercolorcommand.d.ts +41 -0
  182. package/dist/types/tableproperties/commands/tableborderstylecommand.d.ts +41 -0
  183. package/dist/types/tableproperties/commands/tableborderwidthcommand.d.ts +55 -0
  184. package/dist/types/tableproperties/commands/tableheightcommand.d.ts +50 -0
  185. package/dist/types/tableproperties/commands/tablepropertycommand.d.ts +65 -0
  186. package/dist/types/tableproperties/commands/tablewidthcommand.d.ts +50 -0
  187. package/dist/types/tableproperties/tablepropertiesediting.d.ts +44 -0
  188. package/dist/types/tableproperties/tablepropertiesui.d.ts +118 -0
  189. package/dist/types/tableproperties/ui/tablepropertiesview.d.ts +211 -0
  190. package/dist/types/tableproperties.d.ts +34 -0
  191. package/dist/types/tableselection.d.ts +111 -0
  192. package/dist/types/tabletoolbar.d.ts +36 -0
  193. package/dist/types/tableui.d.ts +58 -0
  194. package/dist/types/tableutils.d.ts +452 -0
  195. package/dist/types/tablewalker.d.ts +366 -0
  196. package/dist/types/ui/colorinputview.d.ts +144 -0
  197. package/dist/types/ui/formrowview.d.ts +65 -0
  198. package/dist/types/ui/inserttableview.d.ts +85 -0
  199. package/dist/types/utils/common.d.ts +50 -0
  200. package/dist/types/utils/structure.d.ts +249 -0
  201. package/dist/types/utils/table-properties.d.ts +71 -0
  202. package/dist/types/utils/ui/contextualballoon.d.ts +38 -0
  203. package/dist/types/utils/ui/table-properties.d.ts +199 -0
  204. package/dist/types/utils/ui/widget.d.ts +24 -0
  205. package/package.json +3 -2
@@ -0,0 +1,452 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import type { DocumentSelection, Element, Range, Selection, Writer } from 'ckeditor5/src/engine.js';
11
+ import TableWalker, { type TableWalkerOptions } from './tablewalker.js';
12
+ type IndexesObject = {
13
+ first: number;
14
+ last: number;
15
+ };
16
+ /**
17
+ * The table utilities plugin.
18
+ */
19
+ export default class TableUtils extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): "TableUtils";
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ init(): void;
28
+ /**
29
+ * Returns the table cell location as an object with table row and table column indexes.
30
+ *
31
+ * For instance, in the table below:
32
+ *
33
+ * 0 1 2 3
34
+ * +---+---+---+---+
35
+ * 0 | a | b | c |
36
+ * + + +---+
37
+ * 1 | | | d |
38
+ * +---+---+ +---+
39
+ * 2 | e | | f |
40
+ * +---+---+---+---+
41
+ *
42
+ * the method will return:
43
+ *
44
+ * ```ts
45
+ * const cellA = table.getNodeByPath( [ 0, 0 ] );
46
+ * editor.plugins.get( 'TableUtils' ).getCellLocation( cellA );
47
+ * // will return { row: 0, column: 0 }
48
+ *
49
+ * const cellD = table.getNodeByPath( [ 1, 0 ] );
50
+ * editor.plugins.get( 'TableUtils' ).getCellLocation( cellD );
51
+ * // will return { row: 1, column: 3 }
52
+ * ```
53
+ *
54
+ * @returns Returns a `{row, column}` object.
55
+ */
56
+ getCellLocation(tableCell: Element): {
57
+ row: number;
58
+ column: number;
59
+ };
60
+ /**
61
+ * Creates an empty table with a proper structure. The table needs to be inserted into the model,
62
+ * for example, by using the {@link module:engine/model/model~Model#insertContent} function.
63
+ *
64
+ * ```ts
65
+ * model.change( ( writer ) => {
66
+ * // Create a table of 2 rows and 7 columns:
67
+ * const table = tableUtils.createTable( writer, { rows: 2, columns: 7 } );
68
+ *
69
+ * // Insert a table to the model at the best position taking the current selection:
70
+ * model.insertContent( table );
71
+ * }
72
+ * ```
73
+ *
74
+ * @param writer The model writer.
75
+ * @param options.rows The number of rows to create. Default value is 2.
76
+ * @param options.columns The number of columns to create. Default value is 2.
77
+ * @param options.headingRows The number of heading rows. Default value is 0.
78
+ * @param options.headingColumns The number of heading columns. Default value is 0.
79
+ * @returns The created table element.
80
+ */
81
+ createTable(writer: Writer, options: {
82
+ rows?: number;
83
+ columns?: number;
84
+ headingRows?: number;
85
+ headingColumns?: number;
86
+ }): Element;
87
+ /**
88
+ * Inserts rows into a table.
89
+ *
90
+ * ```ts
91
+ * editor.plugins.get( 'TableUtils' ).insertRows( table, { at: 1, rows: 2 } );
92
+ * ```
93
+ *
94
+ * Assuming the table on the left, the above code will transform it to the table on the right:
95
+ *
96
+ * row index
97
+ * 0 +---+---+---+ `at` = 1, +---+---+---+ 0
98
+ * | a | b | c | `rows` = 2, | a | b | c |
99
+ * 1 + +---+---+ <-- insert here + +---+---+ 1
100
+ * | | d | e | | | | |
101
+ * 2 + +---+---+ will give: + +---+---+ 2
102
+ * | | f | g | | | | |
103
+ * 3 +---+---+---+ + +---+---+ 3
104
+ * | | d | e |
105
+ * + +---+---+ 4
106
+ * + + f | g |
107
+ * +---+---+---+ 5
108
+ *
109
+ * @param table The table model element where the rows will be inserted.
110
+ * @param options.at The row index at which the rows will be inserted. Default value is 0.
111
+ * @param options.rows The number of rows to insert. Default value is 1.
112
+ * @param options.copyStructureFromAbove The flag for copying row structure. Note that
113
+ * the row structure will not be copied if this option is not provided.
114
+ */
115
+ insertRows(table: Element, options?: {
116
+ at?: number;
117
+ rows?: number;
118
+ copyStructureFromAbove?: boolean;
119
+ }): void;
120
+ /**
121
+ * Inserts columns into a table.
122
+ *
123
+ * ```ts
124
+ * editor.plugins.get( 'TableUtils' ).insertColumns( table, { at: 1, columns: 2 } );
125
+ * ```
126
+ *
127
+ * Assuming the table on the left, the above code will transform it to the table on the right:
128
+ *
129
+ * 0 1 2 3 0 1 2 3 4 5
130
+ * +---+---+---+ +---+---+---+---+---+
131
+ * | a | b | | a | b |
132
+ * + +---+ + +---+
133
+ * | | c | | | c |
134
+ * +---+---+---+ will give: +---+---+---+---+---+
135
+ * | d | e | f | | d | | | e | f |
136
+ * +---+ +---+ +---+---+---+ +---+
137
+ * | g | | h | | g | | | | h |
138
+ * +---+---+---+ +---+---+---+---+---+
139
+ * | i | | i |
140
+ * +---+---+---+ +---+---+---+---+---+
141
+ * ^---- insert here, `at` = 1, `columns` = 2
142
+ *
143
+ * @param table The table model element where the columns will be inserted.
144
+ * @param options.at The column index at which the columns will be inserted. Default value is 0.
145
+ * @param options.columns The number of columns to insert. Default value is 1.
146
+ */
147
+ insertColumns(table: Element, options?: {
148
+ at?: number;
149
+ columns?: number;
150
+ }): void;
151
+ /**
152
+ * Removes rows from the given `table`.
153
+ *
154
+ * This method re-calculates the table geometry including `rowspan` attribute of table cells overlapping removed rows
155
+ * and table headings values.
156
+ *
157
+ * ```ts
158
+ * editor.plugins.get( 'TableUtils' ).removeRows( table, { at: 1, rows: 2 } );
159
+ * ```
160
+ *
161
+ * Executing the above code in the context of the table on the left will transform its structure as presented on the right:
162
+ *
163
+ * row index
164
+ * ┌───┬───┬───┐ `at` = 1 ┌───┬───┬───┐
165
+ * 0 │ a │ b │ c │ `rows` = 2 │ a │ b │ c │ 0
166
+ * │ ├───┼───┤ │ ├───┼───┤
167
+ * 1 │ │ d │ e │ <-- remove from here │ │ d │ g │ 1
168
+ * │ │ ├───┤ will give: ├───┼───┼───┤
169
+ * 2 │ │ │ f │ │ h │ i │ j │ 2
170
+ * │ │ ├───┤ └───┴───┴───┘
171
+ * 3 │ │ │ g │
172
+ * ├───┼───┼───┤
173
+ * 4 │ h │ i │ j │
174
+ * └───┴───┴───┘
175
+ *
176
+ * @param options.at The row index at which the removing rows will start.
177
+ * @param options.rows The number of rows to remove. Default value is 1.
178
+ */
179
+ removeRows(table: Element, options: {
180
+ at: number;
181
+ rows?: number;
182
+ }): void;
183
+ /**
184
+ * Removes columns from the given `table`.
185
+ *
186
+ * This method re-calculates the table geometry including the `colspan` attribute of table cells overlapping removed columns
187
+ * and table headings values.
188
+ *
189
+ * ```ts
190
+ * editor.plugins.get( 'TableUtils' ).removeColumns( table, { at: 1, columns: 2 } );
191
+ * ```
192
+ *
193
+ * Executing the above code in the context of the table on the left will transform its structure as presented on the right:
194
+ *
195
+ * 0 1 2 3 4 0 1 2
196
+ * ┌───────────────┬───┐ ┌───────┬───┐
197
+ * │ a │ b │ │ a │ b │
198
+ * │ ├───┤ │ ├───┤
199
+ * │ │ c │ │ │ c │
200
+ * ├───┬───┬───┬───┼───┤ will give: ├───┬───┼───┤
201
+ * │ d │ e │ f │ g │ h │ │ d │ g │ h │
202
+ * ├───┼───┼───┤ ├───┤ ├───┤ ├───┤
203
+ * │ i │ j │ k │ │ l │ │ i │ │ l │
204
+ * ├───┴───┴───┴───┴───┤ ├───┴───┴───┤
205
+ * │ m │ │ m │
206
+ * └───────────────────┘ └───────────┘
207
+ * ^---- remove from here, `at` = 1, `columns` = 2
208
+ *
209
+ * @param options.at The row index at which the removing columns will start.
210
+ * @param options.columns The number of columns to remove.
211
+ */
212
+ removeColumns(table: Element, options: {
213
+ at: number;
214
+ columns?: number;
215
+ }): void;
216
+ /**
217
+ * Divides a table cell vertically into several ones.
218
+ *
219
+ * The cell will be visually split into more cells by updating colspans of other cells in a column
220
+ * and inserting cells (columns) after that cell.
221
+ *
222
+ * In the table below, if cell "a" is split into 3 cells:
223
+ *
224
+ * +---+---+---+
225
+ * | a | b | c |
226
+ * +---+---+---+
227
+ * | d | e | f |
228
+ * +---+---+---+
229
+ *
230
+ * it will result in the table below:
231
+ *
232
+ * +---+---+---+---+---+
233
+ * | a | | | b | c |
234
+ * +---+---+---+---+---+
235
+ * | d | e | f |
236
+ * +---+---+---+---+---+
237
+ *
238
+ * So cell "d" will get its `colspan` updated to `3` and 2 cells will be added (2 columns will be created).
239
+ *
240
+ * Splitting a cell that already has a `colspan` attribute set will distribute the cell `colspan` evenly and the remainder
241
+ * will be left to the original cell:
242
+ *
243
+ * +---+---+---+
244
+ * | a |
245
+ * +---+---+---+
246
+ * | b | c | d |
247
+ * +---+---+---+
248
+ *
249
+ * Splitting cell "a" with `colspan=3` into 2 cells will create 1 cell with a `colspan=a` and cell "a" that will have `colspan=2`:
250
+ *
251
+ * +---+---+---+
252
+ * | a | |
253
+ * +---+---+---+
254
+ * | b | c | d |
255
+ * +---+---+---+
256
+ */
257
+ splitCellVertically(tableCell: Element, numberOfCells?: number): void;
258
+ /**
259
+ * Divides a table cell horizontally into several ones.
260
+ *
261
+ * The cell will be visually split into more cells by updating rowspans of other cells in the row and inserting rows with a single cell
262
+ * below.
263
+ *
264
+ * If in the table below cell "b" is split into 3 cells:
265
+ *
266
+ * +---+---+---+
267
+ * | a | b | c |
268
+ * +---+---+---+
269
+ * | d | e | f |
270
+ * +---+---+---+
271
+ *
272
+ * It will result in the table below:
273
+ *
274
+ * +---+---+---+
275
+ * | a | b | c |
276
+ * + +---+ +
277
+ * | | | |
278
+ * + +---+ +
279
+ * | | | |
280
+ * +---+---+---+
281
+ * | d | e | f |
282
+ * +---+---+---+
283
+ *
284
+ * So cells "a" and "b" will get their `rowspan` updated to `3` and 2 rows with a single cell will be added.
285
+ *
286
+ * Splitting a cell that already has a `rowspan` attribute set will distribute the cell `rowspan` evenly and the remainder
287
+ * will be left to the original cell:
288
+ *
289
+ * +---+---+---+
290
+ * | a | b | c |
291
+ * + +---+---+
292
+ * | | d | e |
293
+ * + +---+---+
294
+ * | | f | g |
295
+ * + +---+---+
296
+ * | | h | i |
297
+ * +---+---+---+
298
+ *
299
+ * Splitting cell "a" with `rowspan=4` into 3 cells will create 2 cells with a `rowspan=1` and cell "a" will have `rowspan=2`:
300
+ *
301
+ * +---+---+---+
302
+ * | a | b | c |
303
+ * + +---+---+
304
+ * | | d | e |
305
+ * +---+---+---+
306
+ * | | f | g |
307
+ * +---+---+---+
308
+ * | | h | i |
309
+ * +---+---+---+
310
+ */
311
+ splitCellHorizontally(tableCell: Element, numberOfCells?: number): void;
312
+ /**
313
+ * Returns the number of columns for a given table.
314
+ *
315
+ * ```ts
316
+ * editor.plugins.get( 'TableUtils' ).getColumns( table );
317
+ * ```
318
+ *
319
+ * @param table The table to analyze.
320
+ */
321
+ getColumns(table: Element): number;
322
+ /**
323
+ * Returns the number of rows for a given table. Any other element present in the table model is omitted.
324
+ *
325
+ * ```ts
326
+ * editor.plugins.get( 'TableUtils' ).getRows( table );
327
+ * ```
328
+ *
329
+ * @param table The table to analyze.
330
+ */
331
+ getRows(table: Element): number;
332
+ /**
333
+ * Creates an instance of the table walker.
334
+ *
335
+ * The table walker iterates internally by traversing the table from row index = 0 and column index = 0.
336
+ * It walks row by row and column by column in order to output values defined in the options.
337
+ * By default it will output only the locations that are occupied by a cell. To include also spanned rows and columns,
338
+ * pass the `includeAllSlots` option.
339
+ *
340
+ * @internal
341
+ * @param table A table over which the walker iterates.
342
+ * @param options An object with configuration.
343
+ */
344
+ createTableWalker(table: Element, options?: TableWalkerOptions): TableWalker;
345
+ /**
346
+ * Returns all model table cells that are fully selected (from the outside)
347
+ * within the provided model selection's ranges.
348
+ *
349
+ * To obtain the cells selected from the inside, use
350
+ * {@link #getTableCellsContainingSelection}.
351
+ */
352
+ getSelectedTableCells(selection: Selection | DocumentSelection): Array<Element>;
353
+ /**
354
+ * Returns all model table cells that the provided model selection's ranges
355
+ * {@link module:engine/model/range~Range#start} inside.
356
+ *
357
+ * To obtain the cells selected from the outside, use
358
+ * {@link #getSelectedTableCells}.
359
+ */
360
+ getTableCellsContainingSelection(selection: Selection | DocumentSelection): Array<Element>;
361
+ /**
362
+ * Returns all model table cells that are either completely selected
363
+ * by selection ranges or host selection range
364
+ * {@link module:engine/model/range~Range#start start positions} inside them.
365
+ *
366
+ * Combines {@link #getTableCellsContainingSelection} and
367
+ * {@link #getSelectedTableCells}.
368
+ */
369
+ getSelectionAffectedTableCells(selection: Selection | DocumentSelection): Array<Element>;
370
+ /**
371
+ * Returns an object with the `first` and `last` row index contained in the given `tableCells`.
372
+ *
373
+ * ```ts
374
+ * const selectedTableCells = getSelectedTableCells( editor.model.document.selection );
375
+ *
376
+ * const { first, last } = getRowIndexes( selectedTableCells );
377
+ *
378
+ * console.log( `Selected rows: ${ first } to ${ last }` );
379
+ * ```
380
+ *
381
+ * @returns Returns an object with the `first` and `last` table row indexes.
382
+ */
383
+ getRowIndexes(tableCells: Array<Element>): IndexesObject;
384
+ /**
385
+ * Returns an object with the `first` and `last` column index contained in the given `tableCells`.
386
+ *
387
+ * ```ts
388
+ * const selectedTableCells = getSelectedTableCells( editor.model.document.selection );
389
+ *
390
+ * const { first, last } = getColumnIndexes( selectedTableCells );
391
+ *
392
+ * console.log( `Selected columns: ${ first } to ${ last }` );
393
+ * ```
394
+ *
395
+ * @returns Returns an object with the `first` and `last` table column indexes.
396
+ */
397
+ getColumnIndexes(tableCells: Array<Element>): IndexesObject;
398
+ /**
399
+ * Checks if the selection contains cells that do not exceed rectangular selection.
400
+ *
401
+ * In a table below:
402
+ *
403
+ * ┌───┬───┬───┬───┐
404
+ * │ a │ b │ c │ d │
405
+ * ├───┴───┼───┤ │
406
+ * │ e │ f │ │
407
+ * │ ├───┼───┤
408
+ * │ │ g │ h │
409
+ * └───────┴───┴───┘
410
+ *
411
+ * Valid selections are these which create a solid rectangle (without gaps), such as:
412
+ * - a, b (two horizontal cells)
413
+ * - c, f (two vertical cells)
414
+ * - a, b, e (cell "e" spans over four cells)
415
+ * - c, d, f (cell d spans over a cell in the row below)
416
+ *
417
+ * While an invalid selection would be:
418
+ * - a, c (the unselected cell "b" creates a gap)
419
+ * - f, g, h (cell "d" spans over a cell from the row of "f" cell - thus creates a gap)
420
+ */
421
+ isSelectionRectangular(selectedTableCells: Array<Element>): boolean;
422
+ /**
423
+ * Returns array of sorted ranges.
424
+ */
425
+ sortRanges(ranges: Iterable<Range>): Array<Range>;
426
+ /**
427
+ * Helper method to get an object with `first` and `last` indexes from an unsorted array of indexes.
428
+ */
429
+ private _getFirstLastIndexesObject;
430
+ /**
431
+ * Checks if the selection does not mix a header (column or row) with other cells.
432
+ *
433
+ * For instance, in the table below valid selections consist of cells with the same letter only.
434
+ * So, a-a (same heading row and column) or d-d (body cells) are valid while c-d or a-b are not.
435
+ *
436
+ * header columns
437
+ * ↓ ↓
438
+ * ┌───┬───┬───┬───┐
439
+ * │ a │ a │ b │ b │ ← header row
440
+ * ├───┼───┼───┼───┤
441
+ * │ c │ c │ d │ d │
442
+ * ├───┼───┼───┼───┤
443
+ * │ c │ c │ d │ d │
444
+ * └───┴───┴───┴───┘
445
+ */
446
+ private _areCellInTheSameTableSection;
447
+ /**
448
+ * Unified check if table rows/columns indexes are in the same heading/body section.
449
+ */
450
+ private _areIndexesInSameSection;
451
+ }
452
+ export {};