@ckeditor/ckeditor5-table 0.0.0-nightly-next-20251230.0 → 0.0.0-nightly-20251231.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/build/table.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/ast.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/be.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/en-gb.js +1 -1
- package/build/translations/eo.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/eu.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/gu.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/hy.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/kk.js +1 -1
- package/build/translations/km.js +1 -1
- package/build/translations/kn.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/ku.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nb.js +1 -1
- package/build/translations/ne.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/oc.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/si.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sl.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/ti.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/uz.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/ckeditor5-metadata.json +2 -11
- package/dist/index-content.css +30 -30
- package/dist/index-editor.css +170 -104
- package/dist/index.css +237 -147
- package/dist/index.css.map +1 -1
- package/dist/index.js +2433 -448
- package/dist/index.js.map +1 -1
- package/lang/contexts.json +4 -2
- package/package.json +9 -9
- package/src/augmentation.d.ts +15 -0
- package/src/converters/downcast.js +13 -6
- package/src/index.d.ts +5 -2
- package/src/index.js +5 -1
- package/src/tablecellproperties/commands/tablecelltypecommand.d.ts +4 -0
- package/src/tablecellproperties/commands/tablecelltypecommand.js +1 -2
- package/src/tablecellproperties/tablecellpropertiesediting.js +8 -48
- package/src/tablecellproperties/tablecellpropertiesui.js +11 -33
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +128 -0
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +408 -0
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +0 -36
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +23 -143
- package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts +266 -0
- package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +744 -0
- package/src/tableconfig.d.ts +4 -24
- package/src/tablelayout/tablelayoutui.js +8 -2
- package/src/tableproperties/tablepropertiesediting.js +147 -14
- package/src/tableproperties/tablepropertiesuiexperimental.d.ts +136 -0
- package/src/tableproperties/tablepropertiesuiexperimental.js +375 -0
- package/src/tableproperties/ui/tablepropertiesview.d.ts +0 -8
- package/src/tableproperties/ui/tablepropertiesview.js +37 -59
- package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +216 -0
- package/src/tableproperties/ui/tablepropertiesviewexperimental.js +544 -0
- package/src/tableutils.js +23 -58
- package/src/utils/common.js +4 -4
- package/src/utils/ui/table-propertiesexperimental.d.ts +215 -0
- package/src/utils/ui/table-propertiesexperimental.js +391 -0
- package/theme/formrow-experimental.css +15 -0
- package/theme/formrow.css +0 -2
- package/theme/tablecellproperties-experimental.css +4 -0
- package/theme/tableform-experimental.css +61 -0
- package/theme/tableform.css +5 -1
- package/theme/tableproperties-experimental.css +78 -0
- package/theme/tableproperties.css +0 -60
- package/src/tablecellproperties/tablecellpropertiesutils.d.ts +0 -18
- package/src/tablecellproperties/tablecellpropertiesutils.js +0 -15
package/src/tableutils.js
CHANGED
|
@@ -145,7 +145,6 @@ export class TableUtils extends Plugin {
|
|
|
145
145
|
const isCopyStructure = options.copyStructureFromAbove !== undefined;
|
|
146
146
|
const copyStructureFrom = options.copyStructureFromAbove ? insertAt - 1 : insertAt;
|
|
147
147
|
const cellTypeEnabled = isTableCellTypeEnabled(this.editor);
|
|
148
|
-
const scopedHeaders = !!this.editor.config.get('table.tableCellProperties.scopedHeaders');
|
|
149
148
|
const rows = this.getRows(table);
|
|
150
149
|
const columns = this.getColumns(table);
|
|
151
150
|
if (insertAt > rows) {
|
|
@@ -158,6 +157,7 @@ export class TableUtils extends Plugin {
|
|
|
158
157
|
}
|
|
159
158
|
model.change(writer => {
|
|
160
159
|
let headingRows = table.getAttribute('headingRows') || 0;
|
|
160
|
+
const headingColumns = table.getAttribute('headingColumns') || 0;
|
|
161
161
|
// Inserting rows inside heading section requires to update `headingRows` attribute as the heading section will grow.
|
|
162
162
|
if (headingRows > insertAt) {
|
|
163
163
|
headingRows += rowsToInsert;
|
|
@@ -172,14 +172,10 @@ export class TableUtils extends Plugin {
|
|
|
172
172
|
for (let rowOffset = 0; rowOffset < rows.length; rowOffset++) {
|
|
173
173
|
const row = rows[rowOffset];
|
|
174
174
|
for (let columnIndex = 0; columnIndex < columns; columnIndex++) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
writer,
|
|
178
|
-
|
|
179
|
-
row: insertAt + rowOffset,
|
|
180
|
-
column: columnIndex,
|
|
181
|
-
scopedHeaders
|
|
182
|
-
});
|
|
175
|
+
const cell = row[columnIndex];
|
|
176
|
+
if (insertAt + rowOffset < headingRows || columnIndex < headingColumns) {
|
|
177
|
+
writer.setAttribute('tableCellType', 'header', cell);
|
|
178
|
+
}
|
|
183
179
|
}
|
|
184
180
|
}
|
|
185
181
|
}
|
|
@@ -214,16 +210,10 @@ export class TableUtils extends Plugin {
|
|
|
214
210
|
const insertPosition = writer.createPositionAt(tableRow, 'end');
|
|
215
211
|
// Insert the empty cell only if this slot is not row-spanned from any other cell.
|
|
216
212
|
if (colspan > 0) {
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
writer,
|
|
222
|
-
cell: insertedCell,
|
|
223
|
-
row: insertAt + rowIndex,
|
|
224
|
-
column: cellIndex,
|
|
225
|
-
scopedHeaders
|
|
226
|
-
});
|
|
213
|
+
const insertedCells = createEmptyTableCell(writer, insertPosition, colspan > 1 ? { colspan } : undefined);
|
|
214
|
+
// If we insert row in heading section, set proper cell type.
|
|
215
|
+
if (cellTypeEnabled && (insertAt + rowIndex < headingRows || cellIndex < headingColumns)) {
|
|
216
|
+
writer.setAttribute('tableCellType', 'header', insertedCells);
|
|
227
217
|
}
|
|
228
218
|
}
|
|
229
219
|
// Skip the col-spanned slots, there won't be any cells.
|
|
@@ -264,8 +254,8 @@ export class TableUtils extends Plugin {
|
|
|
264
254
|
const insertAt = options.at || 0;
|
|
265
255
|
const columnsToInsert = options.columns || 1;
|
|
266
256
|
const cellTypeEnabled = isTableCellTypeEnabled(this.editor);
|
|
267
|
-
const scopedHeaders = !!this.editor.config.get('table.tableCellProperties.scopedHeaders');
|
|
268
257
|
model.change(writer => {
|
|
258
|
+
const headingRows = table.getAttribute('headingRows') || 0;
|
|
269
259
|
let headingColumns = table.getAttribute('headingColumns');
|
|
270
260
|
// Inserting columns inside heading section requires to update `headingColumns` attribute as the heading section will grow.
|
|
271
261
|
if (insertAt < headingColumns) {
|
|
@@ -287,14 +277,9 @@ export class TableUtils extends Plugin {
|
|
|
287
277
|
if (cellTypeEnabled) {
|
|
288
278
|
// If we insert column in heading section, set proper cell type.
|
|
289
279
|
for (let columnOffset = 0; columnOffset < insertedCells.length; columnOffset++) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
cell: insertedCells[columnOffset],
|
|
294
|
-
row: rowIndex,
|
|
295
|
-
column: insertAt + columnOffset,
|
|
296
|
-
scopedHeaders
|
|
297
|
-
});
|
|
280
|
+
if (insertAt + columnOffset < headingColumns || rowIndex < headingRows) {
|
|
281
|
+
writer.setAttribute('tableCellType', 'header', insertedCells[columnOffset]);
|
|
282
|
+
}
|
|
298
283
|
}
|
|
299
284
|
}
|
|
300
285
|
rowIndex++;
|
|
@@ -325,14 +310,9 @@ export class TableUtils extends Plugin {
|
|
|
325
310
|
// If we insert column in heading section, set proper cell type.
|
|
326
311
|
if (cellTypeEnabled) {
|
|
327
312
|
for (let columnOffset = 0; columnOffset < insertedCells.length; columnOffset++) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
cell: insertedCells[columnOffset],
|
|
332
|
-
row,
|
|
333
|
-
column: insertAt + columnOffset,
|
|
334
|
-
scopedHeaders
|
|
335
|
-
});
|
|
313
|
+
if (insertAt + columnOffset < headingColumns || row < headingRows) {
|
|
314
|
+
writer.setAttribute('tableCellType', 'header', insertedCells[columnOffset]);
|
|
315
|
+
}
|
|
336
316
|
}
|
|
337
317
|
}
|
|
338
318
|
}
|
|
@@ -825,7 +805,6 @@ export class TableUtils extends Plugin {
|
|
|
825
805
|
*/
|
|
826
806
|
setHeadingRowsCount(writer, table, headingRows, options = {}) {
|
|
827
807
|
const { shallow, resetFormerHeadingCells = true, autoExpand = true } = options;
|
|
828
|
-
const scopedHeaders = !!this.editor.config.get('table.tableCellProperties.scopedHeaders');
|
|
829
808
|
const oldHeadingRows = table.getAttribute('headingRows') || 0;
|
|
830
809
|
if (headingRows === oldHeadingRows) {
|
|
831
810
|
return;
|
|
@@ -841,8 +820,7 @@ export class TableUtils extends Plugin {
|
|
|
841
820
|
writer,
|
|
842
821
|
cell,
|
|
843
822
|
row,
|
|
844
|
-
column
|
|
845
|
-
scopedHeaders
|
|
823
|
+
column
|
|
846
824
|
});
|
|
847
825
|
}
|
|
848
826
|
// If heading rows were reduced, set body type to all cells in rows that are no longer in heading section.
|
|
@@ -859,8 +837,7 @@ export class TableUtils extends Plugin {
|
|
|
859
837
|
writer,
|
|
860
838
|
cell,
|
|
861
839
|
row: cellRow,
|
|
862
|
-
column
|
|
863
|
-
scopedHeaders
|
|
840
|
+
column
|
|
864
841
|
});
|
|
865
842
|
}
|
|
866
843
|
}
|
|
@@ -891,7 +868,6 @@ export class TableUtils extends Plugin {
|
|
|
891
868
|
setHeadingColumnsCount(writer, table, headingColumns, options = {}) {
|
|
892
869
|
const { shallow, resetFormerHeadingCells = true, autoExpand = true } = options;
|
|
893
870
|
const oldHeadingColumns = table.getAttribute('headingColumns') || 0;
|
|
894
|
-
const scopedHeaders = !!this.editor.config.get('table.tableCellProperties.scopedHeaders');
|
|
895
871
|
if (headingColumns === oldHeadingColumns) {
|
|
896
872
|
return;
|
|
897
873
|
}
|
|
@@ -906,8 +882,7 @@ export class TableUtils extends Plugin {
|
|
|
906
882
|
writer,
|
|
907
883
|
cell,
|
|
908
884
|
row,
|
|
909
|
-
column
|
|
910
|
-
scopedHeaders
|
|
885
|
+
column
|
|
911
886
|
});
|
|
912
887
|
}
|
|
913
888
|
// If heading columns were reduced, set body type to all cells in columns that are no longer in heading section.
|
|
@@ -924,8 +899,7 @@ export class TableUtils extends Plugin {
|
|
|
924
899
|
writer,
|
|
925
900
|
cell,
|
|
926
901
|
row,
|
|
927
|
-
column: cellColumn
|
|
928
|
-
scopedHeaders
|
|
902
|
+
column: cellColumn
|
|
929
903
|
});
|
|
930
904
|
}
|
|
931
905
|
}
|
|
@@ -1296,22 +1270,13 @@ function getBiggestRectangleArea(rows, columns) {
|
|
|
1296
1270
|
* Updates the `tableCellType` attribute of a table cell based on its position in the table
|
|
1297
1271
|
* and the table's `headingRows` and `headingColumns` attributes.
|
|
1298
1272
|
*/
|
|
1299
|
-
function updateTableCellType({ writer, table, row, column, cell
|
|
1273
|
+
function updateTableCellType({ writer, table, row, column, cell }) {
|
|
1300
1274
|
const headingRows = table.getAttribute('headingRows') || 0;
|
|
1301
1275
|
const headingColumns = table.getAttribute('headingColumns') || 0;
|
|
1302
1276
|
if (row >= headingRows && column >= headingColumns) {
|
|
1303
1277
|
writer.removeAttribute('tableCellType', cell);
|
|
1304
|
-
return;
|
|
1305
1278
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
if (scopedHeaders) {
|
|
1309
|
-
if (row < headingRows) {
|
|
1310
|
-
headerCellType = 'header-column';
|
|
1311
|
-
}
|
|
1312
|
-
else {
|
|
1313
|
-
headerCellType = 'header-row';
|
|
1314
|
-
}
|
|
1279
|
+
else {
|
|
1280
|
+
writer.setAttribute('tableCellType', 'header', cell);
|
|
1315
1281
|
}
|
|
1316
|
-
writer.setAttribute('tableCellType', headerCellType, cell);
|
|
1317
1282
|
}
|
package/src/utils/common.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { downcastAttributeToStyle, upcastStyleToAttribute } from '../converters/tableproperties.js';
|
|
6
6
|
import { TableWalker } from '../tablewalker.js';
|
|
7
|
-
import { isTableHeaderCellType } from '../tablecellproperties/tablecellpropertiesutils.js';
|
|
8
7
|
/**
|
|
9
8
|
* A common method to update the numeric value. If a value is the default one, it will be unset.
|
|
10
9
|
*
|
|
@@ -101,7 +100,7 @@ export function isEntireCellsLineHeader({ table, row, column }) {
|
|
|
101
100
|
const tableWalker = new TableWalker(table, { row, column });
|
|
102
101
|
for (const { cell } of tableWalker) {
|
|
103
102
|
const cellType = cell.getAttribute('tableCellType');
|
|
104
|
-
if (
|
|
103
|
+
if (cellType !== 'header') {
|
|
105
104
|
return false;
|
|
106
105
|
}
|
|
107
106
|
}
|
|
@@ -113,6 +112,7 @@ export function isEntireCellsLineHeader({ table, row, column }) {
|
|
|
113
112
|
* @internal
|
|
114
113
|
*/
|
|
115
114
|
export function isTableCellTypeEnabled(editor) {
|
|
116
|
-
const { model } = editor;
|
|
117
|
-
return model.schema.checkAttribute('tableCell', 'tableCellType')
|
|
115
|
+
const { model, config } = editor;
|
|
116
|
+
return (model.schema.checkAttribute('tableCell', 'tableCellType') &&
|
|
117
|
+
config.get('experimentalFlags.tableCellTypeSupport') === true);
|
|
118
118
|
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module table/utils/ui/table-propertiesexperimental
|
|
7
|
+
*/
|
|
8
|
+
import { type ColorOption, type LabeledFieldView, type ListDropdownItemDefinition, type NormalizedColorOption, type ToolbarView, type View, type ColorPickerConfig } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { Collection, type LocaleTranslate } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import { type TableCellPropertiesViewExperimental } from '../../tablecellproperties/ui/tablecellpropertiesviewexperimental.js';
|
|
11
|
+
import { type TablePropertiesViewExperimental } from '../../tableproperties/ui/tablepropertiesviewexperimental.js';
|
|
12
|
+
import { ColorInputView } from '../../ui/colorinputview.js';
|
|
13
|
+
/**
|
|
14
|
+
* Returns an object containing pairs of CSS border style values and their localized UI
|
|
15
|
+
* labels. Used by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}
|
|
16
|
+
* and {@link module:table/tableproperties/ui/tablepropertiesview~TablePropertiesView}.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
* @param t The "t" function provided by the editor that is used to localize strings.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getBorderStyleLabels(t: LocaleTranslate): Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a localized error string that can be displayed next to color (background, border)
|
|
24
|
+
* fields that have an invalid value.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
* @param t The "t" function provided by the editor that is used to localize strings.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLocalizedColorErrorText(t: LocaleTranslate): string;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a localized error string that can be displayed next to length (padding, border width)
|
|
32
|
+
* fields that have an invalid value.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
* @param t The "t" function provided by the editor that is used to localize strings.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getLocalizedLengthErrorText(t: LocaleTranslate): string;
|
|
38
|
+
/**
|
|
39
|
+
* Returns `true` when the passed value is an empty string or a valid CSS color expression.
|
|
40
|
+
* Otherwise, `false` is returned.
|
|
41
|
+
*
|
|
42
|
+
* See {@link module:engine/view/styles/utils~isColorStyleValue}.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare function colorFieldValidator(value: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Returns `true` when the passed value is an empty string, a number without a unit or a valid CSS length expression.
|
|
49
|
+
* Otherwise, `false` is returned.
|
|
50
|
+
*
|
|
51
|
+
* See {@link module:engine/view/styles/utils~isLengthStyleValue}.
|
|
52
|
+
* See {@link module:engine/view/styles/utils~isPercentageStyleValue}.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare function lengthFieldValidator(value: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Returns `true` when the passed value is an empty string, a number without a unit or a valid CSS length expression.
|
|
59
|
+
* Otherwise, `false` is returned.
|
|
60
|
+
*
|
|
61
|
+
* See {@link module:engine/view/styles/utils~isLengthStyleValue}.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare function lineWidthFieldValidator(value: string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Generates item definitions for a UI dropdown that allows changing the border style of a table or a table cell.
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
* @param defaultStyle The default border.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBorderStyleDefinitions(view: TableCellPropertiesViewExperimental | TablePropertiesViewExperimental, defaultStyle: string): Collection<ListDropdownItemDefinition>;
|
|
73
|
+
/**
|
|
74
|
+
* A helper that fills a toolbar with buttons that:
|
|
75
|
+
*
|
|
76
|
+
* * have some labels,
|
|
77
|
+
* * have some icons,
|
|
78
|
+
* * set a certain UI view property value upon execution.
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
* @param options Configuration options
|
|
82
|
+
* @param options.view The view that has the observable property.
|
|
83
|
+
* @param options.icons Object with button icons.
|
|
84
|
+
* @param options.toolbar The toolbar to fill with buttons.
|
|
85
|
+
* @param options.labels Object with button labels.
|
|
86
|
+
* @param options.propertyName The name of the observable property in the view.
|
|
87
|
+
* @param options.nameToValue A function that maps a button name to a value. By default names are the same as values.
|
|
88
|
+
* @param options.defaultValue Default value for the property.
|
|
89
|
+
*/
|
|
90
|
+
export declare function fillToolbar<TView extends View, TPropertyName extends keyof TView>(options: {
|
|
91
|
+
view: TView;
|
|
92
|
+
icons: Record<string, string>;
|
|
93
|
+
toolbar: ToolbarView;
|
|
94
|
+
labels: Record<number, string>;
|
|
95
|
+
propertyName: TPropertyName;
|
|
96
|
+
nameToValue?: (name: string) => string;
|
|
97
|
+
defaultValue?: string;
|
|
98
|
+
}): void;
|
|
99
|
+
/**
|
|
100
|
+
* A default color palette used by various user interfaces related to tables, for instance,
|
|
101
|
+
* by {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI} or
|
|
102
|
+
* {@link module:table/tableproperties/tablepropertiesui~TablePropertiesUI}.
|
|
103
|
+
*
|
|
104
|
+
* The color palette follows the {@link module:table/tableconfig~TableColorConfig table color configuration format}
|
|
105
|
+
* and contains the following color definitions:
|
|
106
|
+
*
|
|
107
|
+
* ```ts
|
|
108
|
+
* const defaultColors = [
|
|
109
|
+
* {
|
|
110
|
+
* color: 'hsl(0, 0%, 0%)',
|
|
111
|
+
* label: 'Black'
|
|
112
|
+
* },
|
|
113
|
+
* {
|
|
114
|
+
* color: 'hsl(0, 0%, 30%)',
|
|
115
|
+
* label: 'Dim grey'
|
|
116
|
+
* },
|
|
117
|
+
* {
|
|
118
|
+
* color: 'hsl(0, 0%, 60%)',
|
|
119
|
+
* label: 'Grey'
|
|
120
|
+
* },
|
|
121
|
+
* {
|
|
122
|
+
* color: 'hsl(0, 0%, 90%)',
|
|
123
|
+
* label: 'Light grey'
|
|
124
|
+
* },
|
|
125
|
+
* {
|
|
126
|
+
* color: 'hsl(0, 0%, 100%)',
|
|
127
|
+
* label: 'White',
|
|
128
|
+
* hasBorder: true
|
|
129
|
+
* },
|
|
130
|
+
* {
|
|
131
|
+
* color: 'hsl(0, 75%, 60%)',
|
|
132
|
+
* label: 'Red'
|
|
133
|
+
* },
|
|
134
|
+
* {
|
|
135
|
+
* color: 'hsl(30, 75%, 60%)',
|
|
136
|
+
* label: 'Orange'
|
|
137
|
+
* },
|
|
138
|
+
* {
|
|
139
|
+
* color: 'hsl(60, 75%, 60%)',
|
|
140
|
+
* label: 'Yellow'
|
|
141
|
+
* },
|
|
142
|
+
* {
|
|
143
|
+
* color: 'hsl(90, 75%, 60%)',
|
|
144
|
+
* label: 'Light green'
|
|
145
|
+
* },
|
|
146
|
+
* {
|
|
147
|
+
* color: 'hsl(120, 75%, 60%)',
|
|
148
|
+
* label: 'Green'
|
|
149
|
+
* },
|
|
150
|
+
* {
|
|
151
|
+
* color: 'hsl(150, 75%, 60%)',
|
|
152
|
+
* label: 'Aquamarine'
|
|
153
|
+
* },
|
|
154
|
+
* {
|
|
155
|
+
* color: 'hsl(180, 75%, 60%)',
|
|
156
|
+
* label: 'Turquoise'
|
|
157
|
+
* },
|
|
158
|
+
* {
|
|
159
|
+
* color: 'hsl(210, 75%, 60%)',
|
|
160
|
+
* label: 'Light blue'
|
|
161
|
+
* },
|
|
162
|
+
* {
|
|
163
|
+
* color: 'hsl(240, 75%, 60%)',
|
|
164
|
+
* label: 'Blue'
|
|
165
|
+
* },
|
|
166
|
+
* {
|
|
167
|
+
* color: 'hsl(270, 75%, 60%)',
|
|
168
|
+
* label: 'Purple'
|
|
169
|
+
* }
|
|
170
|
+
* ];
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
export declare const defaultColors: Array<ColorOption>;
|
|
176
|
+
/**
|
|
177
|
+
* Returns a creator for a color input with a label.
|
|
178
|
+
*
|
|
179
|
+
* For given options, it returns a function that creates an instance of a
|
|
180
|
+
* {@link module:table/ui/colorinputview~ColorInputView color input} logically related to
|
|
181
|
+
* a {@link module:ui/labeledfield/labeledfieldview~LabeledFieldView labeled view} in the DOM.
|
|
182
|
+
*
|
|
183
|
+
* The helper does the following:
|
|
184
|
+
*
|
|
185
|
+
* * It sets the color input `id` and `ariaDescribedById` attributes.
|
|
186
|
+
* * It binds the color input `isReadOnly` to the labeled view.
|
|
187
|
+
* * It binds the color input `hasError` to the labeled view.
|
|
188
|
+
* * It enables a logic that cleans up the error when the user starts typing in the color input.
|
|
189
|
+
*
|
|
190
|
+
* Usage:
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* const colorInputCreator = getLabeledColorInputCreator( {
|
|
194
|
+
* colorConfig: [ ... ],
|
|
195
|
+
* columns: 3,
|
|
196
|
+
* } );
|
|
197
|
+
*
|
|
198
|
+
* const labeledInputView = new LabeledFieldView( locale, colorInputCreator );
|
|
199
|
+
* console.log( labeledInputView.view ); // A color input instance.
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
203
|
+
* @param options Color input options.
|
|
204
|
+
* @param options.colorConfig The configuration of the color palette displayed in the input's dropdown.
|
|
205
|
+
* @param options.columns The configuration of the number of columns the color palette consists of in the input's dropdown.
|
|
206
|
+
* @param options.defaultColorValue If specified, the color input view will replace the "Remove color" button with
|
|
207
|
+
* the "Restore default" button. Instead of clearing the input field, the default color value will be set.
|
|
208
|
+
* @param options.colorPickerConfig The configuration of the color picker. You could disable it or define your output format.
|
|
209
|
+
*/
|
|
210
|
+
export declare function getLabeledColorInputCreator(options: {
|
|
211
|
+
colorConfig: Array<NormalizedColorOption>;
|
|
212
|
+
columns: number;
|
|
213
|
+
defaultColorValue?: string;
|
|
214
|
+
colorPickerConfig: false | ColorPickerConfig;
|
|
215
|
+
}): (labeledFieldView: LabeledFieldView, viewUid: string, statusUid: string) => ColorInputView;
|