@progress/kendo-react-editor 5.15.0-dev.202307180734 → 5.15.0-dev.202307181521
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/dist/cdn/js/kendo-react-editor.js +1 -1
- package/dist/es/Editor.js +7 -0
- package/dist/es/messages/index.d.ts +162 -0
- package/dist/es/messages/index.js +487 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/tools/insertTable/tool.js +3 -2
- package/dist/es/tools/main.d.ts +20 -0
- package/dist/es/tools/main.js +12 -0
- package/dist/es/tools/table-wizard/tableCellProperties.d.ts +35 -0
- package/dist/es/tools/table-wizard/tableCellProperties.js +471 -0
- package/dist/es/tools/table-wizard/tableProperties.d.ts +11 -0
- package/dist/es/tools/table-wizard/tableProperties.js +701 -0
- package/dist/es/tools/table-wizard/utils.d.ts +25 -0
- package/dist/es/tools/table-wizard/utils.js +90 -0
- package/dist/es/tools/tableEdit.d.ts +9 -0
- package/dist/es/tools/tableEdit.js +2 -2
- package/dist/es/tools/utils.d.ts +30 -1
- package/dist/es/tools/utils.js +39 -1
- package/dist/npm/Editor.js +7 -0
- package/dist/npm/messages/index.d.ts +162 -0
- package/dist/npm/messages/index.js +487 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/tools/insertTable/tool.js +2 -1
- package/dist/npm/tools/main.d.ts +20 -0
- package/dist/npm/tools/main.js +12 -0
- package/dist/npm/tools/table-wizard/tableCellProperties.d.ts +35 -0
- package/dist/npm/tools/table-wizard/tableCellProperties.js +479 -0
- package/dist/npm/tools/table-wizard/tableProperties.d.ts +11 -0
- package/dist/npm/tools/table-wizard/tableProperties.js +705 -0
- package/dist/npm/tools/table-wizard/utils.d.ts +25 -0
- package/dist/npm/tools/table-wizard/utils.js +97 -0
- package/dist/npm/tools/tableEdit.d.ts +9 -0
- package/dist/npm/tools/tableEdit.js +5 -3
- package/dist/npm/tools/utils.d.ts +30 -1
- package/dist/npm/tools/utils.js +43 -1
- package/dist/systemjs/kendo-react-editor.js +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
32
|
+
import * as React from 'react';
|
|
33
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
34
|
+
import { Checkbox, ColorPicker, NumericTextBox, TextBox } from '@progress/kendo-react-inputs';
|
|
35
|
+
import { AutoComplete, DropDownList } from '@progress/kendo-react-dropdowns';
|
|
36
|
+
import { Window, WindowActionsBar } from '@progress/kendo-react-dialogs';
|
|
37
|
+
import { TabStrip, TabStripTab } from '@progress/kendo-react-layout';
|
|
38
|
+
import { tableAlignMiddleCenterIcon, tableAlignMiddleLeftIcon, tableAlignMiddleRightIcon, tableAlignRemoveIcon, tablePropertiesIcon, tablePositionStartIcon, tablePositionCenterIcon, tablePositionEndIcon, positionTopIcon, positionBottomIcon } from '@progress/kendo-svg-icons';
|
|
39
|
+
import { borderStyles, onDownPreventDefault, popupSettings, units, parentNode } from './../utils';
|
|
40
|
+
import { nodeSize, parseStyle, setNodeStyle } from './utils';
|
|
41
|
+
import { itemRenderWithIcon, selectedCells, tableCells, valueRenderWithIcon } from './tableCellProperties';
|
|
42
|
+
import { Selection, TableMap, TextSelection, addColumnAfter, addRowAfter, pmDocToFragment, fragmentToHtml, parseContent, CellSelection } from '@progress/kendo-editor-common';
|
|
43
|
+
import { deleteColumnCmd, deleteRowCmd } from '../tableEdit';
|
|
44
|
+
import { useLocalization } from '@progress/kendo-react-intl';
|
|
45
|
+
import { messages, keys } from './../../messages';
|
|
46
|
+
var lastCell = function (table) {
|
|
47
|
+
var lastRow = table.lastChild;
|
|
48
|
+
var cell = lastRow.lastChild;
|
|
49
|
+
return { node: cell, pos: table.content.size - cell.nodeSize };
|
|
50
|
+
};
|
|
51
|
+
var addTableNodes = function (state, tablePos, table, toAdd, command) {
|
|
52
|
+
var last = lastCell(table);
|
|
53
|
+
var cellPos = tablePos + last.pos;
|
|
54
|
+
var cell = state.doc.nodeAt(cellPos);
|
|
55
|
+
if (!cell) {
|
|
56
|
+
return state;
|
|
57
|
+
}
|
|
58
|
+
var res = state.doc.resolve(cellPos);
|
|
59
|
+
var sel = new CellSelection(res, res);
|
|
60
|
+
var selTr = state.tr.setSelection(sel);
|
|
61
|
+
var resultState = state.apply(selTr);
|
|
62
|
+
for (var i = 0; i < toAdd; i++) {
|
|
63
|
+
command(resultState, function (tr) {
|
|
64
|
+
resultState = resultState.apply(tr);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return resultState;
|
|
68
|
+
};
|
|
69
|
+
var removeTableNodes = function (state, tablePos, toDelete, command) {
|
|
70
|
+
var resultState = state;
|
|
71
|
+
for (var i = 0; i < toDelete; i++) {
|
|
72
|
+
var table = resultState.doc.nodeAt(tablePos);
|
|
73
|
+
if (table) {
|
|
74
|
+
var last = lastCell(table);
|
|
75
|
+
var cellPos = tablePos + last.pos;
|
|
76
|
+
var res = resultState.doc.resolve(cellPos);
|
|
77
|
+
var selection = new CellSelection(res, res);
|
|
78
|
+
var selTr = resultState.tr.setSelection(selection);
|
|
79
|
+
resultState = resultState.apply(selTr);
|
|
80
|
+
command(resultState, function (tr) {
|
|
81
|
+
resultState = resultState.apply(tr);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return resultState;
|
|
86
|
+
};
|
|
87
|
+
var resizeTable = function (state, tablePos, rows, columns) {
|
|
88
|
+
var nextState = state;
|
|
89
|
+
var table = nextState.doc.nodeAt(tablePos);
|
|
90
|
+
if (!table) {
|
|
91
|
+
return nextState;
|
|
92
|
+
}
|
|
93
|
+
var map = TableMap.get(table);
|
|
94
|
+
if (map.width === columns && map.height === rows) {
|
|
95
|
+
return nextState;
|
|
96
|
+
}
|
|
97
|
+
if (columns > map.width) {
|
|
98
|
+
nextState = addTableNodes(nextState, tablePos, table, columns - map.width, addColumnAfter);
|
|
99
|
+
}
|
|
100
|
+
else if (columns < map.width) {
|
|
101
|
+
nextState = removeTableNodes(nextState, tablePos, map.width - columns, deleteColumnCmd);
|
|
102
|
+
}
|
|
103
|
+
table = nextState.doc.nodeAt(tablePos);
|
|
104
|
+
if (!table) {
|
|
105
|
+
return nextState;
|
|
106
|
+
}
|
|
107
|
+
map = TableMap.get(table);
|
|
108
|
+
if (rows > map.height) {
|
|
109
|
+
nextState = addTableNodes(nextState, tablePos, table, rows - map.height, addRowAfter);
|
|
110
|
+
}
|
|
111
|
+
else if (rows < map.height) {
|
|
112
|
+
nextState = removeTableNodes(nextState, tablePos, map.height - rows, deleteRowCmd);
|
|
113
|
+
}
|
|
114
|
+
return nextState;
|
|
115
|
+
};
|
|
116
|
+
var setTableStyles = function (state, data, tablePos) {
|
|
117
|
+
var _a;
|
|
118
|
+
var table = state.doc.nodeAt(tablePos);
|
|
119
|
+
if (!table) {
|
|
120
|
+
return state;
|
|
121
|
+
}
|
|
122
|
+
var attrs = __assign({}, table.attrs);
|
|
123
|
+
attrs = setNodeStyle(attrs, 'width', data.width !== null ? data.width + data.widthUnit : '');
|
|
124
|
+
attrs = setNodeStyle(attrs, 'height', data.height !== null ? data.height + data.heightUnit : '');
|
|
125
|
+
attrs = setNodeStyle(attrs, 'text-align', data.textAlign || '');
|
|
126
|
+
attrs = setNodeStyle(attrs, 'background-color', data.backgroundColor || '');
|
|
127
|
+
attrs = setNodeStyle(attrs, 'border-width', data.borderWidth ? data.borderWidth + 'px' : '');
|
|
128
|
+
attrs = setNodeStyle(attrs, 'border-style', data.borderStyle || '');
|
|
129
|
+
attrs = setNodeStyle(attrs, 'border-color', data.borderColor || '');
|
|
130
|
+
attrs = setNodeStyle(attrs, 'border-spacing', data.cellSpacing !== null ? data.cellSpacing + 'px' : '');
|
|
131
|
+
if (data.cellSpacing !== null) {
|
|
132
|
+
attrs = setNodeStyle(attrs, 'border-collapse', 'unset');
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
attrs = setNodeStyle(attrs, 'border-collapse', data.collapseBorders ? 'collapse' : '');
|
|
136
|
+
}
|
|
137
|
+
var posStyles = ((_a = data.position) === null || _a === void 0 ? void 0 : _a.style) || {};
|
|
138
|
+
Object.keys(posStyles).forEach(function (style) {
|
|
139
|
+
attrs = setNodeStyle(attrs, style, posStyles[style]);
|
|
140
|
+
});
|
|
141
|
+
attrs.id = data.id || null;
|
|
142
|
+
attrs.class = data.className || null;
|
|
143
|
+
var tr = state.tr.setNodeMarkup(tablePos, null, attrs);
|
|
144
|
+
state = state.apply(tr);
|
|
145
|
+
return state;
|
|
146
|
+
};
|
|
147
|
+
var toCellsMap = function (map) {
|
|
148
|
+
var cells = [];
|
|
149
|
+
for (var h = 0; h < map.height; h++) {
|
|
150
|
+
var start = h * map.width;
|
|
151
|
+
var end = start + map.width;
|
|
152
|
+
cells.push(map.map.slice(start, end));
|
|
153
|
+
}
|
|
154
|
+
return cells;
|
|
155
|
+
};
|
|
156
|
+
var headerCellsCount = function (table, map) {
|
|
157
|
+
var headerRows = 0;
|
|
158
|
+
var headerColumns = 0;
|
|
159
|
+
var cells = toCellsMap(map);
|
|
160
|
+
cells.forEach(function (row) {
|
|
161
|
+
var headerCells = true;
|
|
162
|
+
row.forEach(function (cellPos) {
|
|
163
|
+
var cell = table.nodeAt(cellPos);
|
|
164
|
+
if (cell && cell.type.name !== 'table_header') {
|
|
165
|
+
headerCells = false;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
if (headerCells) {
|
|
169
|
+
headerRows++;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
for (var col = 0; col < map.width; col++) {
|
|
173
|
+
var headerCells = true;
|
|
174
|
+
for (var row = 0; row < map.height; row++) {
|
|
175
|
+
var cellPos = cells[row] && cells[row][col];
|
|
176
|
+
var cell = typeof cellPos === 'number' && table.nodeAt(cellPos);
|
|
177
|
+
if (cell && cell.type.name !== 'table_header') {
|
|
178
|
+
headerCells = false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (headerCells) {
|
|
182
|
+
headerColumns++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { rows: headerRows, columns: headerColumns };
|
|
186
|
+
};
|
|
187
|
+
var setCellType = function (state, cell, pos, type, attrs) {
|
|
188
|
+
if (cell.type.name !== type.name || Object.keys(attrs).length > 0) {
|
|
189
|
+
var tr = state.tr.setNodeMarkup(pos, type, __assign(__assign({}, cell.attrs), attrs));
|
|
190
|
+
return state.apply(tr);
|
|
191
|
+
}
|
|
192
|
+
return state;
|
|
193
|
+
};
|
|
194
|
+
var resetId = function (cell, attrs) {
|
|
195
|
+
if (/^cell-[0-9]+-[0-9]+$/.test(cell.attrs.id || '')) {
|
|
196
|
+
attrs.id = null;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
var setTableHeaderCells = function (state, data, tablePos) {
|
|
200
|
+
var table = state.doc.nodeAt(tablePos);
|
|
201
|
+
var map = table && TableMap.get(table);
|
|
202
|
+
if (!table || !map) {
|
|
203
|
+
return state;
|
|
204
|
+
}
|
|
205
|
+
// const headerCells = headerCellsCount(table, map);
|
|
206
|
+
// if (data.headerRows === headerCells.rows && data.headerColumns === headerCells.columns) {
|
|
207
|
+
// return state;
|
|
208
|
+
// }
|
|
209
|
+
var cells = toCellsMap(map);
|
|
210
|
+
var newState = state;
|
|
211
|
+
var _a = state.schema.nodes, table_header = _a.table_header, table_cell = _a.table_cell;
|
|
212
|
+
var id = String(new Date().getTime());
|
|
213
|
+
var ids = [];
|
|
214
|
+
var cellId = function (row, col) {
|
|
215
|
+
var result = "cell-".concat(row).concat(col, "-").concat(id);
|
|
216
|
+
if (!ids[row]) {
|
|
217
|
+
ids.push([]);
|
|
218
|
+
}
|
|
219
|
+
if (!ids[row][col]) {
|
|
220
|
+
ids[row].push([]);
|
|
221
|
+
}
|
|
222
|
+
ids[row][col] = result;
|
|
223
|
+
return result;
|
|
224
|
+
};
|
|
225
|
+
var headers = function (row, col, colHeader, rowHeader) {
|
|
226
|
+
var result = [];
|
|
227
|
+
if (rowHeader) {
|
|
228
|
+
for (var r = 0; r < row; r++) {
|
|
229
|
+
if (ids[r] && ids[r][col]) {
|
|
230
|
+
result.push(ids[r][col]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (colHeader) {
|
|
235
|
+
for (var c = 0; c < col; c++) {
|
|
236
|
+
if (ids[row] && ids[row][c]) {
|
|
237
|
+
result.push(ids[row][c]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return result.join(' ');
|
|
242
|
+
};
|
|
243
|
+
cells.forEach(function (row, rowIndex) {
|
|
244
|
+
row.forEach(function (cellPos, cellIndex) {
|
|
245
|
+
var cell = table.nodeAt(cellPos);
|
|
246
|
+
if (cell) {
|
|
247
|
+
var colHeader = cellIndex < data.headerColumns;
|
|
248
|
+
var rowHeader = rowIndex < data.headerRows;
|
|
249
|
+
var attrs = __assign({}, cell.attrs);
|
|
250
|
+
resetId(cell, attrs);
|
|
251
|
+
attrs.headers = null;
|
|
252
|
+
attrs.scope = null;
|
|
253
|
+
if (rowHeader || colHeader) {
|
|
254
|
+
if (data.associateHeaders === 'scope') {
|
|
255
|
+
attrs.scope = rowHeader ? 'col' : 'row';
|
|
256
|
+
}
|
|
257
|
+
if (data.associateHeaders === 'id') {
|
|
258
|
+
attrs.id = cellId(rowIndex, cellIndex);
|
|
259
|
+
if (cellIndex > 0 || rowIndex > 0) {
|
|
260
|
+
attrs.headers = headers(rowIndex, cellIndex, colHeader, rowHeader) || null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
newState = setCellType(newState, cell, tablePos + cellPos + 1, table_header, attrs);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
if (data.associateHeaders === 'id') {
|
|
267
|
+
attrs.headers = headers(rowIndex, cellIndex, data.headerColumns > 0, data.headerRows > 0) || null;
|
|
268
|
+
}
|
|
269
|
+
newState = setCellType(newState, cell, tablePos + cellPos + 1, table_cell, attrs);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
return newState;
|
|
275
|
+
};
|
|
276
|
+
var setTablePosition = function (state, wrapperNode, wrapperPos, styles) {
|
|
277
|
+
var attrs = __assign({}, wrapperNode.attrs);
|
|
278
|
+
attrs = setNodeStyle(attrs, 'margin-left', '');
|
|
279
|
+
attrs = setNodeStyle(attrs, 'margin-right', '');
|
|
280
|
+
Object.keys(styles || {}).forEach(function (s) {
|
|
281
|
+
attrs = setNodeStyle(attrs, s, (styles || {})[s] || '');
|
|
282
|
+
});
|
|
283
|
+
return state.apply(state.tr.setNodeMarkup(wrapperPos, null, attrs));
|
|
284
|
+
};
|
|
285
|
+
var parseCaptionContent = function (content, schema) {
|
|
286
|
+
var doc = parseContent('<p>' + content + '</p>', schema);
|
|
287
|
+
return doc.content.firstChild.content;
|
|
288
|
+
};
|
|
289
|
+
var createCaption = function (data, schema) {
|
|
290
|
+
if (!data.caption) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
var captAttrs = { caption: '', style: 'display: table-caption' };
|
|
294
|
+
if (data.captionAlignment) {
|
|
295
|
+
captAttrs = setNodeStyle(captAttrs, 'text-align', data.captionAlignment);
|
|
296
|
+
}
|
|
297
|
+
if (data.captionPosition) {
|
|
298
|
+
captAttrs = setNodeStyle(captAttrs, 'caption-side', data.captionPosition);
|
|
299
|
+
}
|
|
300
|
+
var captionContent = parseCaptionContent(data.caption, schema);
|
|
301
|
+
var captionNode = (captionContent && schema.nodes.table_caption_external.createAndFill(captAttrs, captionContent)) || undefined;
|
|
302
|
+
return captionNode;
|
|
303
|
+
};
|
|
304
|
+
var hasCaption = function (wrapperNode) {
|
|
305
|
+
return wrapperNode.firstChild && wrapperNode.firstChild.type.name === 'table_caption_external';
|
|
306
|
+
};
|
|
307
|
+
var setTableCaption = function (state, wrapperNode, wrapperPos, data) {
|
|
308
|
+
var nextState = state;
|
|
309
|
+
var captionNode;
|
|
310
|
+
var captContentPos = wrapperPos + 2;
|
|
311
|
+
var captPos = wrapperPos + 1;
|
|
312
|
+
var schema = nextState.schema;
|
|
313
|
+
if (hasCaption(wrapperNode)) {
|
|
314
|
+
captionNode = wrapperNode.firstChild;
|
|
315
|
+
if (data.caption) {
|
|
316
|
+
var captionContent = parseCaptionContent(data.caption, schema);
|
|
317
|
+
nextState = nextState.apply(nextState.tr.replaceWith(captContentPos, captContentPos + captionNode.content.size, captionContent));
|
|
318
|
+
captionNode = nextState.doc.nodeAt(captPos);
|
|
319
|
+
if (captionNode) {
|
|
320
|
+
var captAttrs = __assign({}, captionNode.attrs);
|
|
321
|
+
captAttrs = setNodeStyle(captAttrs, 'text-align', data.captionAlignment || '');
|
|
322
|
+
captAttrs = setNodeStyle(captAttrs, 'caption-side', data.captionPosition || '');
|
|
323
|
+
nextState = nextState.apply(nextState.tr.setNodeAttribute(captPos, 'style', captAttrs.style));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
nextState = nextState.apply(nextState.tr.deleteRange(captContentPos, captContentPos + captionNode.content.size));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
captionNode = createCaption(data, schema);
|
|
332
|
+
if (captionNode) {
|
|
333
|
+
nextState = nextState.apply(nextState.tr.replaceWith(captContentPos, captContentPos, captionNode));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return nextState;
|
|
337
|
+
};
|
|
338
|
+
var updateWrapper = function (state, data, tablePos, tableWrapper, tableWrapperPos) {
|
|
339
|
+
if (!tableWrapper && (data.position || data.caption)) {
|
|
340
|
+
var wrapperAttrs_1 = { table: '', style: 'display: table' };
|
|
341
|
+
var children = [];
|
|
342
|
+
if (data.position) {
|
|
343
|
+
Object.keys(data.position.style).forEach(function (s) {
|
|
344
|
+
wrapperAttrs_1 = setNodeStyle(wrapperAttrs_1, s, data.position.style[s] || '');
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
var captionNode = createCaption(data, state.schema);
|
|
348
|
+
if (captionNode) {
|
|
349
|
+
children.push(captionNode);
|
|
350
|
+
}
|
|
351
|
+
var table = state.doc.nodeAt(tablePos);
|
|
352
|
+
children.push(table);
|
|
353
|
+
var createdWrapper = state.schema.nodes.table_wrapper.createAndFill(wrapperAttrs_1, children);
|
|
354
|
+
if (createdWrapper) {
|
|
355
|
+
var tr = state.tr.replaceWith(tablePos, tablePos + table.content.size, createdWrapper);
|
|
356
|
+
state = state.apply(tr);
|
|
357
|
+
return { state: state, pos: tablePos };
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else if (tableWrapper && (data.position || data.caption || (!data.caption && hasCaption(tableWrapper.node)))) {
|
|
361
|
+
state = setTablePosition(state, tableWrapper.node, tableWrapperPos, data.position && data.position.style);
|
|
362
|
+
state = setTableCaption(state, tableWrapper.node, tableWrapperPos, data);
|
|
363
|
+
return { state: state, pos: tableWrapperPos };
|
|
364
|
+
}
|
|
365
|
+
else if (tableWrapper && !(data.position || data.caption)) {
|
|
366
|
+
return { state: state, node: tableWrapper.node, pos: state.selection.$from.start(tableWrapper.depth) - 1 };
|
|
367
|
+
}
|
|
368
|
+
return { state: state, pos: tablePos };
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* @hidden
|
|
372
|
+
*/
|
|
373
|
+
export var TableProperties = function (props) {
|
|
374
|
+
var view = props.view, buttonProps = __rest(props, ["view"]);
|
|
375
|
+
var loc = useLocalization();
|
|
376
|
+
var _a = React.useState(false), showDialog = _a[0], setShowDialog = _a[1];
|
|
377
|
+
var inTable = Boolean(view && parentNode(view.state.selection.$from, function (n) { return n.type.spec.tableRole === 'table'; }));
|
|
378
|
+
var onClick = React.useCallback(function () {
|
|
379
|
+
setShowDialog(true);
|
|
380
|
+
}, []);
|
|
381
|
+
var onClose = React.useCallback(function () {
|
|
382
|
+
setShowDialog(false);
|
|
383
|
+
}, []);
|
|
384
|
+
var onSave = React.useCallback(function (data) {
|
|
385
|
+
if (view && data) {
|
|
386
|
+
var $from = view.state.selection.$from;
|
|
387
|
+
var table = parentNode($from, function (n) { return n.type.spec.tableRole === 'table'; });
|
|
388
|
+
if (!table) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
var tablePos = $from.start(table.depth) - 1;
|
|
392
|
+
var state = resizeTable(view.state, tablePos, data.rows, data.columns);
|
|
393
|
+
if (!state) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
var transaction_1 = state.tr;
|
|
397
|
+
tableCells(state).forEach(function (cell) {
|
|
398
|
+
var attrs = __assign({}, cell.node.attrs);
|
|
399
|
+
attrs = setNodeStyle(attrs, 'padding', typeof data.cellPadding === 'number' ? data.cellPadding + 'px' : '');
|
|
400
|
+
transaction_1.setNodeMarkup(cell.pos, null, attrs);
|
|
401
|
+
});
|
|
402
|
+
state = state.apply(transaction_1);
|
|
403
|
+
state = setTableStyles(state, data, tablePos);
|
|
404
|
+
state = setTableHeaderCells(state, data, tablePos);
|
|
405
|
+
var tableParent = parentNode($from, function (n) { return n.type.name === 'table_wrapper'; });
|
|
406
|
+
var tableParentPos = $from.start((tableParent === null || tableParent === void 0 ? void 0 : tableParent.depth) || 0) - 1;
|
|
407
|
+
var result = updateWrapper(state, data, tablePos, tableParent, tableParentPos);
|
|
408
|
+
state = result.state;
|
|
409
|
+
var from = result.pos;
|
|
410
|
+
var node = state.doc.nodeAt(result.pos);
|
|
411
|
+
if (!node) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
var to = from + (tableParent || table).node.content.size;
|
|
415
|
+
var tr = view.state.tr.replaceWith(from, to, node);
|
|
416
|
+
var atEnd = Selection.atEnd(node);
|
|
417
|
+
var selection = TextSelection.create(tr.doc, from + atEnd.to);
|
|
418
|
+
tr.setSelection(selection);
|
|
419
|
+
view.dispatch(tr);
|
|
420
|
+
}
|
|
421
|
+
setShowDialog(false);
|
|
422
|
+
}, [view]);
|
|
423
|
+
return (React.createElement(React.Fragment, null,
|
|
424
|
+
React.createElement(Button, __assign({ type: "button", title: loc.toLanguageString(keys.tableProperties, messages[keys.tableProperties]), icon: 'table-properties', svgIcon: tablePropertiesIcon, onClick: onClick, disabled: !inTable }, onDownPreventDefault, buttonProps)),
|
|
425
|
+
showDialog && React.createElement(TablePropertiesDialog, { onClose: onClose, onSave: onSave, view: view })));
|
|
426
|
+
};
|
|
427
|
+
var alignData = [
|
|
428
|
+
{ textKey: keys.tablePropertiesAlignLeft, text: messages[keys.tablePropertiesAlignLeft],
|
|
429
|
+
value: 'left', icon: 'table-align-middle-left', svgIcon: tableAlignMiddleLeftIcon },
|
|
430
|
+
{ textKey: keys.tablePropertiesAlignCenter, text: messages[keys.tablePropertiesAlignCenter],
|
|
431
|
+
value: 'center', icon: 'table-align-middle-center', svgIcon: tableAlignMiddleCenterIcon },
|
|
432
|
+
{ textKey: keys.tablePropertiesAlignRight, text: messages[keys.tablePropertiesAlignRight],
|
|
433
|
+
value: 'right', icon: 'table-align-middle-right', svgIcon: tableAlignMiddleRightIcon },
|
|
434
|
+
{ textKey: keys.tablePropertiesNoAlignment, text: messages[keys.tablePropertiesNoAlignment],
|
|
435
|
+
value: '', icon: 'align-remove', svgIcon: tableAlignRemoveIcon }
|
|
436
|
+
];
|
|
437
|
+
var tablePosition = [{
|
|
438
|
+
textKey: keys.tablePropertiesLeft,
|
|
439
|
+
text: messages[keys.tablePropertiesLeft],
|
|
440
|
+
value: 'left',
|
|
441
|
+
style: { 'margin-left': '', 'margin-right': 'auto' },
|
|
442
|
+
icon: 'table-position-left',
|
|
443
|
+
svgIcon: tablePositionStartIcon
|
|
444
|
+
}, {
|
|
445
|
+
textKey: keys.tablePropertiesCenter,
|
|
446
|
+
text: messages[keys.tablePropertiesCenter],
|
|
447
|
+
value: 'center',
|
|
448
|
+
style: { 'margin-left': 'auto', 'margin-right': 'auto' },
|
|
449
|
+
icon: 'table-position-center',
|
|
450
|
+
svgIcon: tablePositionCenterIcon
|
|
451
|
+
}, {
|
|
452
|
+
textKey: keys.tablePropertiesRight,
|
|
453
|
+
text: messages[keys.tablePropertiesRight],
|
|
454
|
+
value: 'right',
|
|
455
|
+
style: { 'margin-left': 'auto', 'margin-right': '' },
|
|
456
|
+
icon: 'table-position-right',
|
|
457
|
+
svgIcon: tablePositionEndIcon
|
|
458
|
+
}];
|
|
459
|
+
var captionPositionData = [{
|
|
460
|
+
textKey: keys.tablePropertiesTop,
|
|
461
|
+
text: messages[keys.tablePropertiesTop],
|
|
462
|
+
value: 'top',
|
|
463
|
+
icon: 'position-top',
|
|
464
|
+
svgIcon: positionTopIcon
|
|
465
|
+
}, {
|
|
466
|
+
textKey: keys.tablePropertiesBottom,
|
|
467
|
+
text: messages[keys.tablePropertiesBottom],
|
|
468
|
+
value: 'bottom',
|
|
469
|
+
icon: 'position-bottom',
|
|
470
|
+
svgIcon: positionBottomIcon
|
|
471
|
+
}];
|
|
472
|
+
var associateHeadersData = [
|
|
473
|
+
{ textKey: keys.tablePropertiesNone, text: messages[keys.tablePropertiesNone], value: 'none' },
|
|
474
|
+
{ textKey: keys.tablePropertiesUsingScopeAttribute, text: messages[keys.tablePropertiesUsingScopeAttribute], value: 'scope' },
|
|
475
|
+
{ textKey: keys.tablePropertiesUsingIdAttributes, text: messages[keys.tablePropertiesUsingIdAttributes], value: 'id' }
|
|
476
|
+
];
|
|
477
|
+
var initialData = {
|
|
478
|
+
rows: 0,
|
|
479
|
+
columns: 0,
|
|
480
|
+
width: null,
|
|
481
|
+
widthUnit: '',
|
|
482
|
+
height: null,
|
|
483
|
+
heightUnit: '',
|
|
484
|
+
position: null,
|
|
485
|
+
textAlign: '',
|
|
486
|
+
cellPadding: null,
|
|
487
|
+
cellSpacing: null,
|
|
488
|
+
backgroundColor: undefined,
|
|
489
|
+
borderWidth: null,
|
|
490
|
+
borderColor: undefined,
|
|
491
|
+
borderStyle: null,
|
|
492
|
+
collapseBorders: false,
|
|
493
|
+
id: '',
|
|
494
|
+
className: '',
|
|
495
|
+
caption: '',
|
|
496
|
+
captionAlignment: null,
|
|
497
|
+
captionPosition: null,
|
|
498
|
+
headerRows: 0,
|
|
499
|
+
headerColumns: 0,
|
|
500
|
+
associateHeaders: 'none'
|
|
501
|
+
};
|
|
502
|
+
var TablePropertiesDialog = function (props) {
|
|
503
|
+
var defaults = React.useMemo(function () {
|
|
504
|
+
var _a, _b, _c;
|
|
505
|
+
var cells = selectedCells(props.view.state);
|
|
506
|
+
var $pos = props.view.state.selection.$from;
|
|
507
|
+
var table = cells.length ? parentNode($pos, function (n) { return n.type.spec.tableRole === 'table'; }) : null;
|
|
508
|
+
if (!table) {
|
|
509
|
+
return initialData;
|
|
510
|
+
}
|
|
511
|
+
var tableParent = parentNode($pos, function (n) { return n.type.name === 'table_wrapper'; });
|
|
512
|
+
var captionStr = '';
|
|
513
|
+
var captionStyles = {};
|
|
514
|
+
var parentStyles = {};
|
|
515
|
+
if (tableParent) {
|
|
516
|
+
parentStyles = parseStyle(tableParent.node.attrs.style);
|
|
517
|
+
tableParent.node.content.forEach(function (node) {
|
|
518
|
+
if (node.type.name === 'table_caption_external') {
|
|
519
|
+
var fr = pmDocToFragment(node);
|
|
520
|
+
captionStr = fragmentToHtml(fr);
|
|
521
|
+
captionStyles = parseStyle(node.attrs.style);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
var styles = parseStyle(((_a = table.node.attrs) === null || _a === void 0 ? void 0 : _a.style) || '');
|
|
526
|
+
var map = TableMap.get(table.node);
|
|
527
|
+
var pos = (parentStyles['margin-left'] === 'auto' && parentStyles['margin-right'] === 'auto') ? tablePosition.find(function (p) { return p.value === 'center'; }) :
|
|
528
|
+
parentStyles['margin-right'] === 'auto' ? tablePosition.find(function (p) { return p.value === 'left'; }) :
|
|
529
|
+
parentStyles['margin-left'] === 'auto' ? tablePosition.find(function (p) { return p.value === 'right'; }) : null;
|
|
530
|
+
var headerCells = headerCellsCount(table.node, map);
|
|
531
|
+
return __assign(__assign(__assign(__assign(__assign({}, initialData), { columns: map.width, rows: map.height }), nodeSize(table.node, 'width')), nodeSize(table.node, 'height')), { textAlign: styles['text-align'] || '', position: pos || null, cellPadding: styles.padding ? parseFloat(styles.padding) : null, cellSpacing: styles['border-spacing'] ? parseFloat(styles['border-spacing']) : null, backgroundColor: styles['background-color'], borderWidth: styles['border-width'] ? parseFloat(styles['border-width']) : null, borderColor: styles['border-color'], borderStyle: styles['border-style'], collapseBorders: styles['border-collapse'] === 'collapse', caption: captionStr, captionAlignment: captionStyles['text-align'], captionPosition: captionStyles['caption-side'], headerRows: headerCells.rows, headerColumns: headerCells.columns,
|
|
532
|
+
// associateHeaders
|
|
533
|
+
id: (_b = table.node.attrs) === null || _b === void 0 ? void 0 : _b.id, className: (_c = table.node.attrs) === null || _c === void 0 ? void 0 : _c.class });
|
|
534
|
+
}, [props.view]);
|
|
535
|
+
var loc = useLocalization();
|
|
536
|
+
var _a = React.useState(0), selected = _a[0], setSelected = _a[1];
|
|
537
|
+
var onSelect = React.useCallback(function (event) {
|
|
538
|
+
setSelected(event.selected);
|
|
539
|
+
}, []);
|
|
540
|
+
// General tab refs
|
|
541
|
+
var rows = React.useRef(null);
|
|
542
|
+
var columns = React.useRef(null);
|
|
543
|
+
var width = React.useRef(null);
|
|
544
|
+
var height = React.useRef(null);
|
|
545
|
+
var cellSpacing = React.useRef(null);
|
|
546
|
+
var cellPadding = React.useRef(null);
|
|
547
|
+
var borderWidth = React.useRef(null);
|
|
548
|
+
var widthUnit = React.useRef(null);
|
|
549
|
+
var heightUnit = React.useRef(null);
|
|
550
|
+
var position = React.useRef(null);
|
|
551
|
+
var alignment = React.useRef(null);
|
|
552
|
+
var borderStyle = React.useRef(null);
|
|
553
|
+
var backgroundColor = React.useRef(null);
|
|
554
|
+
var borderColor = React.useRef(null);
|
|
555
|
+
var collapseBorders = React.useRef(null);
|
|
556
|
+
// Advanced tab refs
|
|
557
|
+
var id = React.useRef(null);
|
|
558
|
+
var className = React.useRef(null);
|
|
559
|
+
var caption = React.useRef(null);
|
|
560
|
+
var headerRows = React.useRef(null);
|
|
561
|
+
var headerColumns = React.useRef(null);
|
|
562
|
+
var captionAlignment = React.useRef(null);
|
|
563
|
+
var captionPosition = React.useRef(null);
|
|
564
|
+
var associateHeaders = React.useRef(null);
|
|
565
|
+
var onSave = React.useCallback(function () {
|
|
566
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
567
|
+
var data = {
|
|
568
|
+
rows: ((_a = rows.current) === null || _a === void 0 ? void 0 : _a.value) || 0,
|
|
569
|
+
columns: ((_b = columns.current) === null || _b === void 0 ? void 0 : _b.value) || 0,
|
|
570
|
+
width: width.current ? width.current.value : null,
|
|
571
|
+
height: height.current ? height.current.value : null,
|
|
572
|
+
cellSpacing: cellSpacing.current ? cellSpacing.current.value : null,
|
|
573
|
+
cellPadding: cellPadding.current ? cellPadding.current.value : null,
|
|
574
|
+
borderWidth: borderWidth.current ? borderWidth.current.value : null,
|
|
575
|
+
widthUnit: ((_c = widthUnit.current) === null || _c === void 0 ? void 0 : _c.value) || '',
|
|
576
|
+
heightUnit: ((_d = heightUnit.current) === null || _d === void 0 ? void 0 : _d.value) || '',
|
|
577
|
+
position: ((_e = position.current) === null || _e === void 0 ? void 0 : _e.value) || null,
|
|
578
|
+
textAlign: ((_f = alignment.current) === null || _f === void 0 ? void 0 : _f.value) ? alignment.current.value.value : null,
|
|
579
|
+
borderStyle: ((_g = borderStyle.current) === null || _g === void 0 ? void 0 : _g.value) ? borderStyle.current.value.value : null,
|
|
580
|
+
backgroundColor: (_h = backgroundColor.current) === null || _h === void 0 ? void 0 : _h.value,
|
|
581
|
+
borderColor: (_j = borderColor.current) === null || _j === void 0 ? void 0 : _j.value,
|
|
582
|
+
collapseBorders: Boolean((_l = (_k = collapseBorders.current) === null || _k === void 0 ? void 0 : _k.element) === null || _l === void 0 ? void 0 : _l.checked),
|
|
583
|
+
id: String(((_m = id.current) === null || _m === void 0 ? void 0 : _m.value) || ''),
|
|
584
|
+
className: String(((_o = className.current) === null || _o === void 0 ? void 0 : _o.value) || ''),
|
|
585
|
+
caption: String(((_p = caption.current) === null || _p === void 0 ? void 0 : _p.value) || ''),
|
|
586
|
+
headerRows: ((_q = headerRows.current) === null || _q === void 0 ? void 0 : _q.value) || 0,
|
|
587
|
+
headerColumns: ((_r = headerColumns.current) === null || _r === void 0 ? void 0 : _r.value) || 0,
|
|
588
|
+
captionAlignment: ((_s = captionAlignment.current) === null || _s === void 0 ? void 0 : _s.value) ? captionAlignment.current.value.value : null,
|
|
589
|
+
captionPosition: ((_t = captionPosition.current) === null || _t === void 0 ? void 0 : _t.value) ? captionPosition.current.value.value : null,
|
|
590
|
+
associateHeaders: ((_u = associateHeaders.current) === null || _u === void 0 ? void 0 : _u.value) ? associateHeaders.current.value.value : 'none'
|
|
591
|
+
};
|
|
592
|
+
props.onSave.call(undefined, data);
|
|
593
|
+
}, [props.onSave]);
|
|
594
|
+
var general = (React.createElement("div", { className: "k-form k-form-md" },
|
|
595
|
+
React.createElement("fieldset", { className: "k-form-fieldset" },
|
|
596
|
+
React.createElement("div", { className: "k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4" },
|
|
597
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
598
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesRows, messages[keys.tablePropertiesRows])),
|
|
599
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
600
|
+
React.createElement(NumericTextBox, { ref: rows, defaultValue: defaults.rows, min: 1 }))),
|
|
601
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
602
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesColumns, messages[keys.tablePropertiesColumns])),
|
|
603
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
604
|
+
React.createElement(NumericTextBox, { ref: columns, defaultValue: defaults.columns, min: 1 }))),
|
|
605
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
606
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesWidth, messages[keys.tablePropertiesWidth])),
|
|
607
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
608
|
+
React.createElement(NumericTextBox, { ref: width, defaultValue: defaults.width, min: 0, placeholder: loc.toLanguageString(keys.sizeAuto, messages[keys.sizeAuto]) }))),
|
|
609
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
610
|
+
React.createElement("label", { className: "k-label k-form-label" }, "\u00A0"),
|
|
611
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
612
|
+
React.createElement(AutoComplete, { ref: widthUnit, defaultValue: defaults.widthUnit, data: units, popupSettings: popupSettings }))),
|
|
613
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
614
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesHeight, messages[keys.tablePropertiesHeight])),
|
|
615
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
616
|
+
React.createElement(NumericTextBox, { ref: height, defaultValue: defaults.height, min: 0, placeholder: loc.toLanguageString(keys.sizeAuto, messages[keys.sizeAuto]) }))),
|
|
617
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
618
|
+
React.createElement("label", { className: "k-label k-form-label" }, "\u00A0"),
|
|
619
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
620
|
+
React.createElement(AutoComplete, { ref: heightUnit, defaultValue: defaults.heightUnit, data: units, popupSettings: popupSettings }))),
|
|
621
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
622
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesPosition, messages[keys.tablePropertiesPosition])),
|
|
623
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
624
|
+
React.createElement(DropDownList, { ref: position, defaultValue: defaults.position, popupSettings: popupSettings, data: tablePosition.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), textField: 'text', dataItemKey: 'value', valueRender: valueRenderWithIcon, itemRender: itemRenderWithIcon }))),
|
|
625
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
626
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesAlignment, messages[keys.tablePropertiesAlignment])),
|
|
627
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
628
|
+
React.createElement(DropDownList, { ref: alignment, defaultValue: alignData.find(function (a) { return a.value === defaults.textAlign; }), data: alignData.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), textField: 'text', dataItemKey: 'value', popupSettings: popupSettings, valueRender: valueRenderWithIcon, itemRender: itemRenderWithIcon }))),
|
|
629
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
630
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCellSpacing, messages[keys.tablePropertiesCellSpacing])),
|
|
631
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
632
|
+
React.createElement(NumericTextBox, { ref: cellSpacing, defaultValue: defaults.cellSpacing, placeholder: loc.toLanguageString(keys.sizeAuto, messages[keys.sizeAuto]), min: 0 }))),
|
|
633
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
634
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCellPadding, messages[keys.tablePropertiesCellPadding])),
|
|
635
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
636
|
+
React.createElement(NumericTextBox, { ref: cellPadding, defaultValue: defaults.cellPadding, placeholder: loc.toLanguageString(keys.sizeAuto, messages[keys.sizeAuto]), min: 0 }))),
|
|
637
|
+
React.createElement("div", { className: "k-form-field k-col-span-full" },
|
|
638
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesTableBackground, messages[keys.tablePropertiesTableBackground])),
|
|
639
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
640
|
+
React.createElement(ColorPicker, { ref: backgroundColor, defaultValue: defaults.backgroundColor }))),
|
|
641
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
642
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesBorderWidth, messages[keys.tablePropertiesBorderWidth])),
|
|
643
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
644
|
+
React.createElement(NumericTextBox, { ref: borderWidth, defaultValue: defaults.borderWidth, min: 0 }))),
|
|
645
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
646
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesBorderColor, messages[keys.tablePropertiesBorderColor])),
|
|
647
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
648
|
+
React.createElement(ColorPicker, { ref: borderColor, defaultValue: defaults.borderColor }))),
|
|
649
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
650
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesBorderStyle, messages[keys.tablePropertiesBorderStyle])),
|
|
651
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
652
|
+
React.createElement(DropDownList, { ref: borderStyle, defaultValue: borderStyles.find(function (s) { return s.value === defaults.borderStyle; }), popupSettings: popupSettings, data: borderStyles.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), textField: 'text', dataItemKey: 'value' }))),
|
|
653
|
+
React.createElement("div", { className: "k-form-field k-col-span-full" },
|
|
654
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
655
|
+
React.createElement(Checkbox, { ref: collapseBorders, className: "k-checkbox-wrap", label: loc.toLanguageString(keys.tablePropertiesCollapseBorders, messages[keys.tablePropertiesCollapseBorders]), defaultChecked: defaults.collapseBorders })))))));
|
|
656
|
+
var advanced = (React.createElement("div", { className: "k-form k-form-md" },
|
|
657
|
+
React.createElement("fieldset", { className: "k-form-fieldset" },
|
|
658
|
+
React.createElement("div", { className: "k-form-layout k-d-grid" },
|
|
659
|
+
React.createElement("div", { className: "k-form-field" },
|
|
660
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesId, messages[keys.tablePropertiesId])),
|
|
661
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
662
|
+
React.createElement(TextBox, { ref: id, defaultValue: defaults.id }))),
|
|
663
|
+
React.createElement("div", { className: "k-form-field" },
|
|
664
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCssClass, messages[keys.tablePropertiesCssClass])),
|
|
665
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
666
|
+
React.createElement(TextBox, { ref: className, defaultValue: defaults.className }))),
|
|
667
|
+
React.createElement("fieldset", { className: "k-form-fieldset" },
|
|
668
|
+
React.createElement("legend", { className: "k-form-legend" }, loc.toLanguageString(keys.tablePropertiesAccessibility, messages[keys.tablePropertiesAccessibility])),
|
|
669
|
+
React.createElement("div", { className: "k-d-grid k-grid-cols-4 k-gap-x-4" },
|
|
670
|
+
React.createElement("div", { className: "k-form-field k-col-span-full" },
|
|
671
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCaption, messages[keys.tablePropertiesCaption])),
|
|
672
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
673
|
+
React.createElement(TextBox, { ref: caption, defaultValue: defaults.caption }))),
|
|
674
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
675
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCaptionPosition, messages[keys.tablePropertiesCaptionPosition])),
|
|
676
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
677
|
+
React.createElement(DropDownList, { ref: captionPosition, defaultValue: captionPositionData.find(function (i) { return i.value === defaults.captionPosition; }), data: captionPositionData.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), popupSettings: popupSettings, textField: 'text', dataItemKey: 'value', valueRender: valueRenderWithIcon, itemRender: itemRenderWithIcon }))),
|
|
678
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
679
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesCaptionAlignment, messages[keys.tablePropertiesCaptionAlignment])),
|
|
680
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
681
|
+
React.createElement(DropDownList, { ref: captionAlignment, defaultValue: alignData.find(function (i) { return i.value === defaults.captionAlignment; }), data: alignData.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), popupSettings: popupSettings, textField: 'text', dataItemKey: 'value', valueRender: valueRenderWithIcon, itemRender: itemRenderWithIcon }))),
|
|
682
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
683
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesHeaderRows, messages[keys.tablePropertiesHeaderRows])),
|
|
684
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
685
|
+
React.createElement(NumericTextBox, { ref: headerRows, defaultValue: defaults.headerRows, min: 0 }))),
|
|
686
|
+
React.createElement("div", { className: "k-form-field k-col-span-1" },
|
|
687
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesHeaderCols, messages[keys.tablePropertiesHeaderCols])),
|
|
688
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
689
|
+
React.createElement(NumericTextBox, { ref: headerColumns, defaultValue: defaults.headerColumns, min: 0 }))),
|
|
690
|
+
React.createElement("div", { className: "k-form-field k-col-span-2" },
|
|
691
|
+
React.createElement("label", { className: "k-label k-form-label" }, loc.toLanguageString(keys.tablePropertiesAssociateHeaders, messages[keys.tablePropertiesAssociateHeaders])),
|
|
692
|
+
React.createElement("div", { className: "k-form-field-wrap" },
|
|
693
|
+
React.createElement(DropDownList, { ref: associateHeaders, defaultValue: associateHeadersData[0], data: associateHeadersData.map(function (i) { return (__assign(__assign({}, i), { text: loc.toLanguageString(i.textKey, i.text) })); }), popupSettings: popupSettings, textField: 'text', dataItemKey: 'value' })))))))));
|
|
694
|
+
var content = (React.createElement(TabStrip, { selected: selected, onSelect: onSelect, animation: false, keepTabsMounted: true },
|
|
695
|
+
React.createElement(TabStripTab, { title: loc.toLanguageString(keys.tablePropertiesGeneral, messages[keys.tablePropertiesGeneral]) }, general),
|
|
696
|
+
React.createElement(TabStripTab, { title: loc.toLanguageString(keys.tablePropertiesAdvanced, messages[keys.tablePropertiesAdvanced]) }, advanced)));
|
|
697
|
+
var actionButtons = [(React.createElement(Button, { themeColor: 'primary', key: "save", onClick: onSave }, loc.toLanguageString(keys.tablePropertiesSave, messages[keys.tablePropertiesSave]))), (React.createElement(Button, { onClick: props.onClose, key: "cancel" }, loc.toLanguageString(keys.tablePropertiesCancel, messages[keys.tablePropertiesCancel])))];
|
|
698
|
+
return (React.createElement(Window, { className: 'k-editor-window k-editor-table-wizard-window', title: loc.toLanguageString(keys.tableProperties, messages[keys.tableProperties]), onClose: props.onClose, key: "dialog", style: { userSelect: 'none' }, width: 480, height: 630, modal: true, minimizeButton: function () { return null; }, maximizeButton: function () { return null; }, resizable: false },
|
|
699
|
+
content,
|
|
700
|
+
React.createElement.apply(React, __spreadArray([WindowActionsBar, { layout: 'start' }], actionButtons, false))));
|
|
701
|
+
};
|