@progress/kendo-react-editor 5.16.0-dev.202307211637 → 5.16.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.
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-editor',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1689955755,
8
+ publishDate: 1690290162,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -0,0 +1,36 @@
1
+ import { EditorState, Transaction } from '@progress/kendo-editor-common';
2
+ /**
3
+ * @hidden
4
+ */
5
+ interface CellData {
6
+ applyToAll: boolean;
7
+ cellWidth: number | null;
8
+ widthUnit: string;
9
+ cellHeight: number | null;
10
+ heightUnit: string;
11
+ alignment: {
12
+ x: string;
13
+ y: string;
14
+ };
15
+ textControl: string;
16
+ backgroundColor?: string;
17
+ cellPadding: number | null;
18
+ borderWidth: number | null;
19
+ borderColor?: string;
20
+ borderStyle: string | null;
21
+ id: string;
22
+ className: string;
23
+ }
24
+ /**
25
+ * @hidden
26
+ */
27
+ declare const initialCellData: CellData;
28
+ /**
29
+ * @hidden
30
+ */
31
+ declare const cellsDefaultData: (state: EditorState) => CellData;
32
+ /**
33
+ * @hidden
34
+ */
35
+ declare const applyCellsData: (state: EditorState, data: CellData) => Transaction;
36
+ export { CellData, initialCellData, cellsDefaultData, applyCellsData };
@@ -0,0 +1,203 @@
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
+ import { htmlToFragment } from '@progress/kendo-editor-common';
13
+ import { getUnit, parseStyle, selectedCells, setNodeStyle, tableCells } from './utils';
14
+ import { parentNode } from '../utils';
15
+ var colgroupAttr = 'k-colgroup-data';
16
+ var cellsWidth = function (cells, table, $pos) {
17
+ var result = {
18
+ cellWidth: null,
19
+ widthUnit: ''
20
+ };
21
+ var tableNode = table.node;
22
+ var tablePos = $pos.start(table.depth);
23
+ if (!tableNode.attrs[colgroupAttr]) {
24
+ return result;
25
+ }
26
+ var width = new Set();
27
+ var value = '';
28
+ var colgroup = htmlToFragment(tableNode.attrs[colgroupAttr]).firstChild;
29
+ cells.forEach(function (cell) {
30
+ var $cell = tableNode.resolve(cell.pos - tablePos);
31
+ var row = $cell.parent;
32
+ var cellIndex = $cell.index();
33
+ var colSpan = 0;
34
+ for (var i = 0; i <= cellIndex; i++) {
35
+ colSpan += row.child(i).attrs.colspan;
36
+ }
37
+ var col = colgroup.children[colSpan - 1];
38
+ if (col) {
39
+ value = col.style.width;
40
+ width.add(value);
41
+ }
42
+ });
43
+ if (width.size === 1 && value) {
44
+ result.cellWidth = parseFloat(value) || null;
45
+ result.widthUnit = getUnit(value);
46
+ }
47
+ return result;
48
+ };
49
+ var cellsHeight = function (cells, table, $pos) {
50
+ var result = {
51
+ cellHeight: null,
52
+ heightUnit: ''
53
+ };
54
+ var tableNode = table.node;
55
+ var tablePos = $pos.start(table.depth);
56
+ var height = new Set();
57
+ var value = '';
58
+ cells.forEach(function (cell) {
59
+ var _a;
60
+ var $cell = tableNode.resolve(cell.pos - tablePos);
61
+ var row = $cell.parent;
62
+ value = parseStyle(((_a = row.attrs) === null || _a === void 0 ? void 0 : _a.style) || '').height || '';
63
+ height.add(value);
64
+ });
65
+ if (height.size === 1 && value) {
66
+ result.cellHeight = parseFloat(value) || null;
67
+ result.heightUnit = getUnit(value);
68
+ }
69
+ return result;
70
+ };
71
+ var cellsStyle = function (cells, style) {
72
+ var values = new Set();
73
+ var value = '';
74
+ cells.forEach(function (cell) {
75
+ var _a;
76
+ value = parseStyle(((_a = cell.node.attrs) === null || _a === void 0 ? void 0 : _a.style) || '')[style] || '';
77
+ values.add(value);
78
+ });
79
+ if (values.size === 1 && value) {
80
+ return value;
81
+ }
82
+ return '';
83
+ };
84
+ var cellsProp = function (cells, prop) {
85
+ var values = new Set();
86
+ var value = '';
87
+ cells.forEach(function (cell) {
88
+ value = (cell.node.attrs || {})[prop] || '';
89
+ values.add(value);
90
+ });
91
+ if (values.size === 1 && value) {
92
+ return value;
93
+ }
94
+ return '';
95
+ };
96
+ /**
97
+ * @hidden
98
+ */
99
+ var initialCellData = {
100
+ applyToAll: false,
101
+ cellWidth: null,
102
+ widthUnit: '',
103
+ cellHeight: null,
104
+ heightUnit: '',
105
+ alignment: { x: '', y: '' },
106
+ textControl: '',
107
+ backgroundColor: undefined,
108
+ cellPadding: null,
109
+ borderWidth: null,
110
+ borderColor: undefined,
111
+ borderStyle: null,
112
+ id: '',
113
+ className: ''
114
+ };
115
+ /**
116
+ * @hidden
117
+ */
118
+ var cellsDefaultData = function (state) {
119
+ var cells = selectedCells(state);
120
+ var $pos = state.selection.$from;
121
+ var table = cells.length ? parentNode($pos, function (n) { return n.type.spec.tableRole === 'table'; }) : null;
122
+ if (!table) {
123
+ return initialCellData;
124
+ }
125
+ return __assign(__assign(__assign(__assign({}, initialCellData), cellsWidth(cells, table, $pos)), cellsHeight(cells, table, $pos)), { alignment: { x: cellsStyle(cells, 'text-align'), y: cellsStyle(cells, 'vertical-align') }, textControl: cellsStyle(cells, 'white-space'), backgroundColor: cellsStyle(cells, 'background-color') || undefined, cellPadding: parseFloat(cellsStyle(cells, 'padding')) || null, borderWidth: parseFloat(cellsStyle(cells, 'border-width')) || null, borderColor: cellsStyle(cells, 'border-color') || undefined, borderStyle: cellsStyle(cells, 'border-style') || null, id: cellsProp(cells, 'id'), className: cellsProp(cells, 'class') });
126
+ };
127
+ var setCellWidth = function (tr, pos, width) {
128
+ var _a, _b;
129
+ var $cell = tr.doc.resolve(pos);
130
+ var row = $cell.parent;
131
+ var cellIndex = $cell.index();
132
+ var colSpan = 0;
133
+ for (var i = 0; i <= cellIndex; i++) {
134
+ colSpan += row.child(i).attrs.colspan;
135
+ }
136
+ var tableNode = $cell.node($cell.depth - 1);
137
+ var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
138
+ var attrs = tableNode.attrs;
139
+ var col;
140
+ if (attrs && attrs[colgroupAttr]) {
141
+ // const colgroup = parseStrColgroup(tableNode.attrs[colgroupAttr]);
142
+ var colgroup = htmlToFragment(attrs[colgroupAttr]).firstChild;
143
+ col = colgroup.children[colSpan - 1];
144
+ col.style.width = width;
145
+ attrs = __assign(__assign({}, attrs), (_a = {}, _a[colgroupAttr] = colgroup.outerHTML, _a));
146
+ tr.setNodeMarkup(tablePos, null, attrs);
147
+ }
148
+ else {
149
+ var total = 0;
150
+ for (var i = 0; i < row.childCount; i++) {
151
+ total += row.child(i).attrs.colspan;
152
+ }
153
+ var colgroup = document.createElement('colgroup');
154
+ var cols = new Array(total);
155
+ for (var i = 0; i < total; i++) {
156
+ cols[i] = document.createElement('col');
157
+ colgroup.appendChild(cols[i]);
158
+ }
159
+ col = cols[cellIndex];
160
+ col.style.width = width;
161
+ attrs = __assign(__assign({}, attrs), (_b = {}, _b[colgroupAttr] = '<colgroup>' + cols.reduce(function (acc, cur) { return acc + cur.outerHTML; }, '') + '</colgroup>', _b));
162
+ tr.setNodeMarkup(tablePos, null, attrs);
163
+ }
164
+ };
165
+ var setCellHeight = function (tr, pos, height) {
166
+ var $cell = tr.doc.resolve(pos);
167
+ var row = $cell.parent;
168
+ var rowPos = $cell.posAtIndex(0) - 1;
169
+ tr.setNodeMarkup(rowPos, null, setNodeStyle(row.attrs, 'height', height));
170
+ };
171
+ var applyOnCell = function (tr, data, cells) {
172
+ cells.forEach(function (_a) {
173
+ var node = _a.node, pos = _a.pos;
174
+ var attrs = __assign({}, node.attrs);
175
+ attrs = setNodeStyle(attrs, 'border-color', data.borderColor || '');
176
+ attrs = setNodeStyle(attrs, 'border-style', data.borderStyle || '');
177
+ attrs = setNodeStyle(attrs, 'border-width', typeof data.borderWidth === 'number' ? data.borderWidth + 'px' : '');
178
+ attrs = setNodeStyle(attrs, 'padding', typeof data.cellPadding === 'number' ? data.cellPadding + 'px' : '');
179
+ attrs = setNodeStyle(attrs, 'background-color', data.backgroundColor || '');
180
+ attrs = setNodeStyle(attrs, 'text-align', data.alignment.x || '');
181
+ attrs = setNodeStyle(attrs, 'vertical-align', data.alignment.y || '');
182
+ attrs = setNodeStyle(attrs, 'white-space', data.textControl || '');
183
+ attrs.id = data.id || null;
184
+ attrs.class = data.className || null;
185
+ tr.setNodeMarkup(pos, null, attrs);
186
+ if (typeof data.cellWidth === 'number') {
187
+ setCellWidth(tr, pos, data.cellWidth + (data.widthUnit || 'px'));
188
+ }
189
+ if (typeof data.cellHeight === 'number') {
190
+ setCellHeight(tr, pos, data.cellHeight + (data.heightUnit || 'px'));
191
+ }
192
+ });
193
+ };
194
+ /**
195
+ * @hidden
196
+ */
197
+ var applyCellsData = function (state, data) {
198
+ var tr = state.tr;
199
+ var cells = data.applyToAll ? tableCells(state) : selectedCells(state);
200
+ applyOnCell(tr, data, cells);
201
+ return tr;
202
+ };
203
+ export { initialCellData, cellsDefaultData, applyCellsData };
@@ -1,21 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ListItemProps } from '@progress/kendo-react-dropdowns';
3
3
  import { ToolProps } from '../ToolProps';
4
- import { EditorState, Node } from '@progress/kendo-editor-common';
5
- /**
6
- * @hidden
7
- */
8
- export declare const selectedCells: (state: EditorState) => Array<{
9
- node: Node;
10
- pos: number;
11
- }>;
12
- /**
13
- * @hidden
14
- */
15
- export declare const tableCells: (state: EditorState) => Array<{
16
- node: Node;
17
- pos: number;
18
- }>;
19
4
  /**
20
5
  * @hidden
21
6
  */
@@ -36,132 +36,10 @@ import { AutoComplete, DropDownList } from '@progress/kendo-react-dropdowns';
36
36
  import { Window, WindowActionsBar } from '@progress/kendo-react-dialogs';
37
37
  import { tableAlignBottomCenterIcon, tableAlignBottomLeftIcon, tableAlignBottomRightIcon, tableAlignMiddleCenterIcon, tableAlignMiddleLeftIcon, tableAlignMiddleRightIcon, tableAlignTopCenterIcon, tableAlignTopLeftIcon, tableAlignTopRightIcon, tableAlignRemoveIcon, tableCellPropertiesIcon, textWrapIcon, parameterStringIcon } from '@progress/kendo-svg-icons';
38
38
  import { borderStyles as borderStylesData, onDownPreventDefault, popupSettings, units, parentNode } from '../utils';
39
- import { TableMap, htmlToFragment } from '@progress/kendo-editor-common';
40
- import { getUnit, parseStyle, setNodeStyle } from './utils';
41
39
  import { IconWrap } from '@progress/kendo-react-common';
42
40
  import { useLocalization } from '@progress/kendo-react-intl';
43
41
  import { messages, keys } from './../../messages';
44
- var colgroupAttr = 'k-colgroup-data';
45
- var getCells = function (state) {
46
- var doc = state.doc, selection = state.selection;
47
- var result = [];
48
- selection.ranges.forEach(function (range) {
49
- var from = range.$from.pos;
50
- var to = range.$to.pos;
51
- doc.nodesBetween(from, to, function (node, pos, _parent, _index) {
52
- if (node.type.name === 'table_cell' || node.type.name === 'table_header') {
53
- result.push({ node: node, pos: pos });
54
- }
55
- });
56
- });
57
- return result;
58
- };
59
- /**
60
- * @hidden
61
- */
62
- export var selectedCells = function (state) {
63
- var startNodeTable = parentNode(state.selection.$from, function (n) { return n.type.name === 'table'; });
64
- var endNodeTable = parentNode(state.selection.$to, function (n) { return n.type.name === 'table'; });
65
- if (startNodeTable && endNodeTable && startNodeTable.depth === endNodeTable.depth && startNodeTable.node.eq(endNodeTable.node)) {
66
- var cells = getCells(state).filter(function (_a) {
67
- var pos = _a.pos;
68
- var parentTable = parentNode(state.doc.resolve(pos), function (n) { return n.type.name === 'table'; });
69
- return parentTable && parentTable.depth === startNodeTable.depth && startNodeTable.node.eq(parentTable.node);
70
- });
71
- return cells;
72
- }
73
- return [];
74
- };
75
- /**
76
- * @hidden
77
- */
78
- export var tableCells = function (state) {
79
- var cells = [];
80
- if (selectedCells(state).length) {
81
- var $pos = state.selection.$from;
82
- var parentTable = parentNode($pos, function (n) { return n.type.spec.tableRole === 'table'; });
83
- if (parentTable === null) {
84
- return cells;
85
- }
86
- var tablePos_1 = $pos.start(parentTable.depth);
87
- var tableNode = parentTable.node;
88
- var map = TableMap.get(tableNode);
89
- var doc_1 = state.doc;
90
- map.map.forEach(function (m) {
91
- var pos = m + tablePos_1;
92
- cells.push({ pos: pos, node: doc_1.nodeAt(pos) });
93
- });
94
- }
95
- return cells;
96
- };
97
- var setCellWidth = function (tr, pos, width) {
98
- var _a, _b;
99
- var $cell = tr.doc.resolve(pos);
100
- var row = $cell.parent;
101
- var cellIndex = $cell.index();
102
- var colSpan = 0;
103
- for (var i = 0; i <= cellIndex; i++) {
104
- colSpan += row.child(i).attrs.colspan;
105
- }
106
- var tableNode = $cell.node($cell.depth - 1);
107
- var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
108
- var attrs = tableNode.attrs;
109
- var col;
110
- if (attrs && attrs[colgroupAttr]) {
111
- // const colgroup = parseStrColgroup(tableNode.attrs[colgroupAttr]);
112
- var colgroup = htmlToFragment(attrs[colgroupAttr]).firstChild;
113
- col = colgroup.children[colSpan - 1];
114
- col.style.width = width;
115
- attrs = __assign(__assign({}, attrs), (_a = {}, _a[colgroupAttr] = colgroup.outerHTML, _a));
116
- tr.setNodeMarkup(tablePos, null, attrs);
117
- }
118
- else {
119
- var total = 0;
120
- for (var i = 0; i < row.childCount; i++) {
121
- total += row.child(i).attrs.colspan;
122
- }
123
- var colgroup = document.createElement('colgroup');
124
- var cols = new Array(total);
125
- for (var i = 0; i < total; i++) {
126
- cols[i] = document.createElement('col');
127
- colgroup.appendChild(cols[i]);
128
- }
129
- col = cols[cellIndex];
130
- col.style.width = width;
131
- attrs = __assign(__assign({}, attrs), (_b = {}, _b[colgroupAttr] = '<colgroup>' + cols.reduce(function (acc, cur) { return acc + cur.outerHTML; }, '') + '</colgroup>', _b));
132
- tr.setNodeMarkup(tablePos, null, attrs);
133
- }
134
- };
135
- var setCellHeight = function (tr, pos, height) {
136
- var $cell = tr.doc.resolve(pos);
137
- var row = $cell.parent;
138
- var rowPos = $cell.posAtIndex(0) - 1;
139
- tr.setNodeMarkup(rowPos, null, setNodeStyle(row.attrs, 'height', height));
140
- };
141
- var applyOnCell = function (tr, data, cells) {
142
- cells.forEach(function (_a) {
143
- var _b, _c, _d;
144
- var node = _a.node, pos = _a.pos;
145
- var attrs = __assign({}, node.attrs);
146
- attrs = setNodeStyle(attrs, 'border-color', data.borderColor || '');
147
- attrs = setNodeStyle(attrs, 'border-style', ((_b = data.borderStyle) === null || _b === void 0 ? void 0 : _b.value) || '');
148
- attrs = setNodeStyle(attrs, 'border-width', typeof data.borderWidth === 'number' ? data.borderWidth + 'px' : '');
149
- attrs = setNodeStyle(attrs, 'padding', typeof data.cellPadding === 'number' ? data.cellPadding + 'px' : '');
150
- attrs = setNodeStyle(attrs, 'background-color', data.backgroundColor || '');
151
- attrs = setNodeStyle(attrs, 'text-align', ((_c = data.alignment) === null || _c === void 0 ? void 0 : _c.value.x) || '');
152
- attrs = setNodeStyle(attrs, 'vertical-align', ((_d = data.alignment) === null || _d === void 0 ? void 0 : _d.value.y) || '');
153
- attrs = setNodeStyle(attrs, 'white-space', data.textControl || '');
154
- attrs.id = data.id || null;
155
- attrs.class = data.className || null;
156
- tr.setNodeMarkup(pos, null, attrs);
157
- if (typeof data.cellWidth === 'number') {
158
- setCellWidth(tr, pos, data.cellWidth + (data.widthUnit || 'px'));
159
- }
160
- if (typeof data.cellHeight === 'number') {
161
- setCellHeight(tr, pos, data.cellHeight + (data.heightUnit || 'px'));
162
- }
163
- });
164
- };
42
+ import { applyCellsData, cellsDefaultData } from './cellPropsUtils';
165
43
  /**
166
44
  * @hidden
167
45
  */
@@ -175,9 +53,7 @@ export var TableCellProperties = function (props) {
175
53
  }, []);
176
54
  var onSave = React.useCallback(function (data) {
177
55
  if (view && data) {
178
- var tr = view.state.tr;
179
- var cells = data.applyToAll ? tableCells(view.state) : selectedCells(view.state);
180
- applyOnCell(tr, data, cells);
56
+ var tr = applyCellsData(view.state, data);
181
57
  if (tr.docChanged) {
182
58
  view.dispatch(tr);
183
59
  }
@@ -219,102 +95,6 @@ var textControlData = [
219
95
  { textKey: keys.cellPropertiesFitToCell, text: messages[keys.cellPropertiesFitToCell],
220
96
  value: 'nowrap', icon: 'parameter-string', svgIcon: parameterStringIcon }
221
97
  ];
222
- var cellsWidth = function (cells, table, $pos) {
223
- var result = {
224
- cellWidth: null,
225
- widthUnit: null
226
- };
227
- var tableNode = table.node;
228
- var tablePos = $pos.start(table.depth);
229
- if (!tableNode.attrs[colgroupAttr]) {
230
- return result;
231
- }
232
- var width = new Set();
233
- var value = '';
234
- var colgroup = htmlToFragment(tableNode.attrs[colgroupAttr]).firstChild;
235
- cells.forEach(function (cell) {
236
- var $cell = tableNode.resolve(cell.pos - tablePos);
237
- var row = $cell.parent;
238
- var cellIndex = $cell.index();
239
- var colSpan = 0;
240
- for (var i = 0; i <= cellIndex; i++) {
241
- colSpan += row.child(i).attrs.colspan;
242
- }
243
- var col = colgroup.children[colSpan - 1];
244
- if (col) {
245
- value = col.style.width;
246
- width.add(value);
247
- }
248
- });
249
- if (width.size === 1 && value) {
250
- result.cellWidth = parseFloat(value) || null;
251
- result.widthUnit = getUnit(value);
252
- }
253
- return result;
254
- };
255
- var cellsHeight = function (cells, table, $pos) {
256
- var result = {
257
- cellHeight: null,
258
- heightUnit: null
259
- };
260
- var tableNode = table.node;
261
- var tablePos = $pos.start(table.depth);
262
- var height = new Set();
263
- var value = '';
264
- cells.forEach(function (cell) {
265
- var _a;
266
- var $cell = tableNode.resolve(cell.pos - tablePos);
267
- var row = $cell.parent;
268
- value = parseStyle(((_a = row.attrs) === null || _a === void 0 ? void 0 : _a.style) || '').height || '';
269
- height.add(value);
270
- });
271
- if (height.size === 1 && value) {
272
- result.cellHeight = parseFloat(value) || null;
273
- result.heightUnit = getUnit(value);
274
- }
275
- return result;
276
- };
277
- var cellsStyle = function (cells, style) {
278
- var values = new Set();
279
- var value = '';
280
- cells.forEach(function (cell) {
281
- var _a;
282
- value = parseStyle(((_a = cell.node.attrs) === null || _a === void 0 ? void 0 : _a.style) || '')[style] || '';
283
- values.add(value);
284
- });
285
- if (values.size === 1 && value) {
286
- return value;
287
- }
288
- return '';
289
- };
290
- var cellsProp = function (cells, prop) {
291
- var values = new Set();
292
- var value = '';
293
- cells.forEach(function (cell) {
294
- value = (cell.node.attrs || {})[prop] || '';
295
- values.add(value);
296
- });
297
- if (values.size === 1 && value) {
298
- return value;
299
- }
300
- return '';
301
- };
302
- var initialData = {
303
- applyToAll: false,
304
- cellWidth: null,
305
- widthUnit: null,
306
- cellHeight: null,
307
- heightUnit: null,
308
- alignment: { x: '', y: '' },
309
- textControl: '',
310
- backgroundColor: null,
311
- cellPadding: '',
312
- borderWidth: null,
313
- borderColor: null,
314
- borderStyle: '',
315
- id: '',
316
- class: ''
317
- };
318
98
  /**
319
99
  * @hidden
320
100
  */
@@ -339,13 +119,7 @@ export var itemRenderWithIcon = function (li, itemProps) {
339
119
  };
340
120
  var TableCellPropertiesDialog = function (props) {
341
121
  var defaults = React.useMemo(function () {
342
- var cells = selectedCells(props.view.state);
343
- var $pos = props.view.state.selection.$from;
344
- var table = cells.length ? parentNode($pos, function (n) { return n.type.spec.tableRole === 'table'; }) : null;
345
- if (!table) {
346
- return initialData;
347
- }
348
- return __assign(__assign(__assign(__assign({}, initialData), cellsWidth(cells, table, $pos)), cellsHeight(cells, table, $pos)), { alignment: { x: cellsStyle(cells, 'text-align'), y: cellsStyle(cells, 'vertical-align') }, textControl: cellsStyle(cells, 'white-space'), backgroundColor: cellsStyle(cells, 'background-color') || undefined, cellPadding: parseFloat(cellsStyle(cells, 'padding')) || null, borderWidth: parseFloat(cellsStyle(cells, 'border-width')) || null, borderColor: cellsStyle(cells, 'border-color') || undefined, borderStyle: cellsStyle(cells, 'border-style'), id: cellsProp(cells, 'id'), className: cellsProp(cells, 'class') });
122
+ return cellsDefaultData(props.view.state);
349
123
  }, [props.view]);
350
124
  var loc = useLocalization();
351
125
  var applyToAll = React.useRef(null);
@@ -365,7 +139,8 @@ var TableCellPropertiesDialog = function (props) {
365
139
  }
366
140
  var heightUnitDef = defaults.heightUnit || '';
367
141
  var alignment = React.useRef(null);
368
- var alignmentDef = alignData.find(function (al) { return al.value.x !== undefined && al.value.x === defaults.alignment.x && al.value.y === defaults.alignment.y; }) || null;
142
+ var alignmentDef = alignData.find(function (al) { return al.value.x !== undefined && defaults.alignment &&
143
+ al.value.x === defaults.alignment.x && al.value.y === defaults.alignment.y; }) || null;
369
144
  var textControl = React.useRef(null);
370
145
  var textControlDef = textControlData.find(function (d) { return d.value === defaults.textControl; });
371
146
  var backgroundColor = React.useRef(null);
@@ -377,28 +152,28 @@ var TableCellPropertiesDialog = function (props) {
377
152
  var borderColor = React.useRef(null);
378
153
  var borderColorDef = defaults.borderColor;
379
154
  var borderStyle = React.useRef(null);
380
- var borderStyleDef = defaults.borderStyle;
155
+ var borderStyleDef = borderStylesData.find(function (s) { return s.value === defaults.borderStyle; });
381
156
  var id = React.useRef(null);
382
157
  var idDef = defaults.id;
383
158
  var className = React.useRef(null);
384
159
  var classNameDef = defaults.className;
385
160
  var onSave = React.useCallback(function () {
386
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
161
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
387
162
  var data = {
388
- applyToAll: (_b = (_a = applyToAll.current) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.checked,
389
- cellWidth: (_c = cellWidth.current) === null || _c === void 0 ? void 0 : _c.value,
390
- widthUnit: (_d = widthUnit.current) === null || _d === void 0 ? void 0 : _d.value,
391
- cellHeight: (_e = cellHeight.current) === null || _e === void 0 ? void 0 : _e.value,
392
- heightUnit: (_f = heightUnit.current) === null || _f === void 0 ? void 0 : _f.value,
393
- alignment: (_g = alignment.current) === null || _g === void 0 ? void 0 : _g.value,
394
- textControl: (_j = (_h = textControl.current) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.value,
395
- backgroundColor: (_k = backgroundColor.current) === null || _k === void 0 ? void 0 : _k.value,
396
- cellPadding: (_l = cellPadding.current) === null || _l === void 0 ? void 0 : _l.value,
397
- borderWidth: (_m = borderWidth.current) === null || _m === void 0 ? void 0 : _m.value,
398
- borderColor: (_o = borderColor.current) === null || _o === void 0 ? void 0 : _o.value,
399
- borderStyle: (_p = borderStyle.current) === null || _p === void 0 ? void 0 : _p.value,
400
- id: (_q = id.current) === null || _q === void 0 ? void 0 : _q.value,
401
- className: (_r = className.current) === null || _r === void 0 ? void 0 : _r.value
163
+ applyToAll: Boolean((_b = (_a = applyToAll.current) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.checked),
164
+ cellWidth: ((_c = cellWidth.current) === null || _c === void 0 ? void 0 : _c.value) || null,
165
+ widthUnit: ((_d = widthUnit.current) === null || _d === void 0 ? void 0 : _d.value) || '',
166
+ cellHeight: ((_e = cellHeight.current) === null || _e === void 0 ? void 0 : _e.value) || null,
167
+ heightUnit: ((_f = heightUnit.current) === null || _f === void 0 ? void 0 : _f.value) || '',
168
+ alignment: (_h = (_g = alignment.current) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.value,
169
+ textControl: (_k = (_j = textControl.current) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.value,
170
+ backgroundColor: (_l = backgroundColor.current) === null || _l === void 0 ? void 0 : _l.value,
171
+ cellPadding: typeof ((_m = cellPadding.current) === null || _m === void 0 ? void 0 : _m.value) === 'number' ? (_o = cellPadding.current) === null || _o === void 0 ? void 0 : _o.value : null,
172
+ borderWidth: typeof ((_p = borderWidth.current) === null || _p === void 0 ? void 0 : _p.value) === 'number' ? (_q = borderWidth.current) === null || _q === void 0 ? void 0 : _q.value : null,
173
+ borderColor: (_r = borderColor.current) === null || _r === void 0 ? void 0 : _r.value,
174
+ borderStyle: ((_t = (_s = borderStyle.current) === null || _s === void 0 ? void 0 : _s.value) === null || _t === void 0 ? void 0 : _t.value) || null,
175
+ id: String(((_u = id.current) === null || _u === void 0 ? void 0 : _u.value) || ''),
176
+ className: String(((_v = className.current) === null || _v === void 0 ? void 0 : _v.value) || '')
402
177
  };
403
178
  props.onSave.call(undefined, data);
404
179
  }, [props.onSave]);