@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.
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.applyCellsData = exports.cellsDefaultData = exports.initialCellData = void 0;
15
+ var kendo_editor_common_1 = require("@progress/kendo-editor-common");
16
+ var utils_1 = require("./utils");
17
+ var utils_2 = require("../utils");
18
+ var colgroupAttr = 'k-colgroup-data';
19
+ var cellsWidth = function (cells, table, $pos) {
20
+ var result = {
21
+ cellWidth: null,
22
+ widthUnit: ''
23
+ };
24
+ var tableNode = table.node;
25
+ var tablePos = $pos.start(table.depth);
26
+ if (!tableNode.attrs[colgroupAttr]) {
27
+ return result;
28
+ }
29
+ var width = new Set();
30
+ var value = '';
31
+ var colgroup = (0, kendo_editor_common_1.htmlToFragment)(tableNode.attrs[colgroupAttr]).firstChild;
32
+ cells.forEach(function (cell) {
33
+ var $cell = tableNode.resolve(cell.pos - tablePos);
34
+ var row = $cell.parent;
35
+ var cellIndex = $cell.index();
36
+ var colSpan = 0;
37
+ for (var i = 0; i <= cellIndex; i++) {
38
+ colSpan += row.child(i).attrs.colspan;
39
+ }
40
+ var col = colgroup.children[colSpan - 1];
41
+ if (col) {
42
+ value = col.style.width;
43
+ width.add(value);
44
+ }
45
+ });
46
+ if (width.size === 1 && value) {
47
+ result.cellWidth = parseFloat(value) || null;
48
+ result.widthUnit = (0, utils_1.getUnit)(value);
49
+ }
50
+ return result;
51
+ };
52
+ var cellsHeight = function (cells, table, $pos) {
53
+ var result = {
54
+ cellHeight: null,
55
+ heightUnit: ''
56
+ };
57
+ var tableNode = table.node;
58
+ var tablePos = $pos.start(table.depth);
59
+ var height = new Set();
60
+ var value = '';
61
+ cells.forEach(function (cell) {
62
+ var _a;
63
+ var $cell = tableNode.resolve(cell.pos - tablePos);
64
+ var row = $cell.parent;
65
+ value = (0, utils_1.parseStyle)(((_a = row.attrs) === null || _a === void 0 ? void 0 : _a.style) || '').height || '';
66
+ height.add(value);
67
+ });
68
+ if (height.size === 1 && value) {
69
+ result.cellHeight = parseFloat(value) || null;
70
+ result.heightUnit = (0, utils_1.getUnit)(value);
71
+ }
72
+ return result;
73
+ };
74
+ var cellsStyle = function (cells, style) {
75
+ var values = new Set();
76
+ var value = '';
77
+ cells.forEach(function (cell) {
78
+ var _a;
79
+ value = (0, utils_1.parseStyle)(((_a = cell.node.attrs) === null || _a === void 0 ? void 0 : _a.style) || '')[style] || '';
80
+ values.add(value);
81
+ });
82
+ if (values.size === 1 && value) {
83
+ return value;
84
+ }
85
+ return '';
86
+ };
87
+ var cellsProp = function (cells, prop) {
88
+ var values = new Set();
89
+ var value = '';
90
+ cells.forEach(function (cell) {
91
+ value = (cell.node.attrs || {})[prop] || '';
92
+ values.add(value);
93
+ });
94
+ if (values.size === 1 && value) {
95
+ return value;
96
+ }
97
+ return '';
98
+ };
99
+ /**
100
+ * @hidden
101
+ */
102
+ var initialCellData = {
103
+ applyToAll: false,
104
+ cellWidth: null,
105
+ widthUnit: '',
106
+ cellHeight: null,
107
+ heightUnit: '',
108
+ alignment: { x: '', y: '' },
109
+ textControl: '',
110
+ backgroundColor: undefined,
111
+ cellPadding: null,
112
+ borderWidth: null,
113
+ borderColor: undefined,
114
+ borderStyle: null,
115
+ id: '',
116
+ className: ''
117
+ };
118
+ exports.initialCellData = initialCellData;
119
+ /**
120
+ * @hidden
121
+ */
122
+ var cellsDefaultData = function (state) {
123
+ var cells = (0, utils_1.selectedCells)(state);
124
+ var $pos = state.selection.$from;
125
+ var table = cells.length ? (0, utils_2.parentNode)($pos, function (n) { return n.type.spec.tableRole === 'table'; }) : null;
126
+ if (!table) {
127
+ return initialCellData;
128
+ }
129
+ 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') });
130
+ };
131
+ exports.cellsDefaultData = cellsDefaultData;
132
+ var setCellWidth = function (tr, pos, width) {
133
+ var _a, _b;
134
+ var $cell = tr.doc.resolve(pos);
135
+ var row = $cell.parent;
136
+ var cellIndex = $cell.index();
137
+ var colSpan = 0;
138
+ for (var i = 0; i <= cellIndex; i++) {
139
+ colSpan += row.child(i).attrs.colspan;
140
+ }
141
+ var tableNode = $cell.node($cell.depth - 1);
142
+ var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
143
+ var attrs = tableNode.attrs;
144
+ var col;
145
+ if (attrs && attrs[colgroupAttr]) {
146
+ // const colgroup = parseStrColgroup(tableNode.attrs[colgroupAttr]);
147
+ var colgroup = (0, kendo_editor_common_1.htmlToFragment)(attrs[colgroupAttr]).firstChild;
148
+ col = colgroup.children[colSpan - 1];
149
+ col.style.width = width;
150
+ attrs = __assign(__assign({}, attrs), (_a = {}, _a[colgroupAttr] = colgroup.outerHTML, _a));
151
+ tr.setNodeMarkup(tablePos, null, attrs);
152
+ }
153
+ else {
154
+ var total = 0;
155
+ for (var i = 0; i < row.childCount; i++) {
156
+ total += row.child(i).attrs.colspan;
157
+ }
158
+ var colgroup = document.createElement('colgroup');
159
+ var cols = new Array(total);
160
+ for (var i = 0; i < total; i++) {
161
+ cols[i] = document.createElement('col');
162
+ colgroup.appendChild(cols[i]);
163
+ }
164
+ col = cols[cellIndex];
165
+ col.style.width = width;
166
+ attrs = __assign(__assign({}, attrs), (_b = {}, _b[colgroupAttr] = '<colgroup>' + cols.reduce(function (acc, cur) { return acc + cur.outerHTML; }, '') + '</colgroup>', _b));
167
+ tr.setNodeMarkup(tablePos, null, attrs);
168
+ }
169
+ };
170
+ var setCellHeight = function (tr, pos, height) {
171
+ var $cell = tr.doc.resolve(pos);
172
+ var row = $cell.parent;
173
+ var rowPos = $cell.posAtIndex(0) - 1;
174
+ tr.setNodeMarkup(rowPos, null, (0, utils_1.setNodeStyle)(row.attrs, 'height', height));
175
+ };
176
+ var applyOnCell = function (tr, data, cells) {
177
+ cells.forEach(function (_a) {
178
+ var node = _a.node, pos = _a.pos;
179
+ var attrs = __assign({}, node.attrs);
180
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'border-color', data.borderColor || '');
181
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'border-style', data.borderStyle || '');
182
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'border-width', typeof data.borderWidth === 'number' ? data.borderWidth + 'px' : '');
183
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'padding', typeof data.cellPadding === 'number' ? data.cellPadding + 'px' : '');
184
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'background-color', data.backgroundColor || '');
185
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'text-align', data.alignment.x || '');
186
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'vertical-align', data.alignment.y || '');
187
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'white-space', data.textControl || '');
188
+ attrs.id = data.id || null;
189
+ attrs.class = data.className || null;
190
+ tr.setNodeMarkup(pos, null, attrs);
191
+ if (typeof data.cellWidth === 'number') {
192
+ setCellWidth(tr, pos, data.cellWidth + (data.widthUnit || 'px'));
193
+ }
194
+ if (typeof data.cellHeight === 'number') {
195
+ setCellHeight(tr, pos, data.cellHeight + (data.heightUnit || 'px'));
196
+ }
197
+ });
198
+ };
199
+ /**
200
+ * @hidden
201
+ */
202
+ var applyCellsData = function (state, data) {
203
+ var tr = state.tr;
204
+ var cells = data.applyToAll ? (0, utils_1.tableCells)(state) : (0, utils_1.selectedCells)(state);
205
+ applyOnCell(tr, data, cells);
206
+ return tr;
207
+ };
208
+ exports.applyCellsData = 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
  */
@@ -31,7 +31,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
31
31
  return to.concat(ar || Array.prototype.slice.call(from));
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.itemRenderWithIcon = exports.valueRenderWithIcon = exports.TableCellProperties = exports.tableCells = exports.selectedCells = void 0;
34
+ exports.itemRenderWithIcon = exports.valueRenderWithIcon = exports.TableCellProperties = void 0;
35
35
  var React = require("react");
36
36
  var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
37
37
  var kendo_react_inputs_1 = require("@progress/kendo-react-inputs");
@@ -39,134 +39,10 @@ var kendo_react_dropdowns_1 = require("@progress/kendo-react-dropdowns");
39
39
  var kendo_react_dialogs_1 = require("@progress/kendo-react-dialogs");
40
40
  var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
41
41
  var utils_1 = require("../utils");
42
- var kendo_editor_common_1 = require("@progress/kendo-editor-common");
43
- var utils_2 = require("./utils");
44
42
  var kendo_react_common_1 = require("@progress/kendo-react-common");
45
43
  var kendo_react_intl_1 = require("@progress/kendo-react-intl");
46
44
  var messages_1 = require("./../../messages");
47
- var colgroupAttr = 'k-colgroup-data';
48
- var getCells = function (state) {
49
- var doc = state.doc, selection = state.selection;
50
- var result = [];
51
- selection.ranges.forEach(function (range) {
52
- var from = range.$from.pos;
53
- var to = range.$to.pos;
54
- doc.nodesBetween(from, to, function (node, pos, _parent, _index) {
55
- if (node.type.name === 'table_cell' || node.type.name === 'table_header') {
56
- result.push({ node: node, pos: pos });
57
- }
58
- });
59
- });
60
- return result;
61
- };
62
- /**
63
- * @hidden
64
- */
65
- var selectedCells = function (state) {
66
- var startNodeTable = (0, utils_1.parentNode)(state.selection.$from, function (n) { return n.type.name === 'table'; });
67
- var endNodeTable = (0, utils_1.parentNode)(state.selection.$to, function (n) { return n.type.name === 'table'; });
68
- if (startNodeTable && endNodeTable && startNodeTable.depth === endNodeTable.depth && startNodeTable.node.eq(endNodeTable.node)) {
69
- var cells = getCells(state).filter(function (_a) {
70
- var pos = _a.pos;
71
- var parentTable = (0, utils_1.parentNode)(state.doc.resolve(pos), function (n) { return n.type.name === 'table'; });
72
- return parentTable && parentTable.depth === startNodeTable.depth && startNodeTable.node.eq(parentTable.node);
73
- });
74
- return cells;
75
- }
76
- return [];
77
- };
78
- exports.selectedCells = selectedCells;
79
- /**
80
- * @hidden
81
- */
82
- var tableCells = function (state) {
83
- var cells = [];
84
- if ((0, exports.selectedCells)(state).length) {
85
- var $pos = state.selection.$from;
86
- var parentTable = (0, utils_1.parentNode)($pos, function (n) { return n.type.spec.tableRole === 'table'; });
87
- if (parentTable === null) {
88
- return cells;
89
- }
90
- var tablePos_1 = $pos.start(parentTable.depth);
91
- var tableNode = parentTable.node;
92
- var map = kendo_editor_common_1.TableMap.get(tableNode);
93
- var doc_1 = state.doc;
94
- map.map.forEach(function (m) {
95
- var pos = m + tablePos_1;
96
- cells.push({ pos: pos, node: doc_1.nodeAt(pos) });
97
- });
98
- }
99
- return cells;
100
- };
101
- exports.tableCells = tableCells;
102
- var setCellWidth = function (tr, pos, width) {
103
- var _a, _b;
104
- var $cell = tr.doc.resolve(pos);
105
- var row = $cell.parent;
106
- var cellIndex = $cell.index();
107
- var colSpan = 0;
108
- for (var i = 0; i <= cellIndex; i++) {
109
- colSpan += row.child(i).attrs.colspan;
110
- }
111
- var tableNode = $cell.node($cell.depth - 1);
112
- var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
113
- var attrs = tableNode.attrs;
114
- var col;
115
- if (attrs && attrs[colgroupAttr]) {
116
- // const colgroup = parseStrColgroup(tableNode.attrs[colgroupAttr]);
117
- var colgroup = (0, kendo_editor_common_1.htmlToFragment)(attrs[colgroupAttr]).firstChild;
118
- col = colgroup.children[colSpan - 1];
119
- col.style.width = width;
120
- attrs = __assign(__assign({}, attrs), (_a = {}, _a[colgroupAttr] = colgroup.outerHTML, _a));
121
- tr.setNodeMarkup(tablePos, null, attrs);
122
- }
123
- else {
124
- var total = 0;
125
- for (var i = 0; i < row.childCount; i++) {
126
- total += row.child(i).attrs.colspan;
127
- }
128
- var colgroup = document.createElement('colgroup');
129
- var cols = new Array(total);
130
- for (var i = 0; i < total; i++) {
131
- cols[i] = document.createElement('col');
132
- colgroup.appendChild(cols[i]);
133
- }
134
- col = cols[cellIndex];
135
- col.style.width = width;
136
- attrs = __assign(__assign({}, attrs), (_b = {}, _b[colgroupAttr] = '<colgroup>' + cols.reduce(function (acc, cur) { return acc + cur.outerHTML; }, '') + '</colgroup>', _b));
137
- tr.setNodeMarkup(tablePos, null, attrs);
138
- }
139
- };
140
- var setCellHeight = function (tr, pos, height) {
141
- var $cell = tr.doc.resolve(pos);
142
- var row = $cell.parent;
143
- var rowPos = $cell.posAtIndex(0) - 1;
144
- tr.setNodeMarkup(rowPos, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', height));
145
- };
146
- var applyOnCell = function (tr, data, cells) {
147
- cells.forEach(function (_a) {
148
- var _b, _c, _d;
149
- var node = _a.node, pos = _a.pos;
150
- var attrs = __assign({}, node.attrs);
151
- attrs = (0, utils_2.setNodeStyle)(attrs, 'border-color', data.borderColor || '');
152
- attrs = (0, utils_2.setNodeStyle)(attrs, 'border-style', ((_b = data.borderStyle) === null || _b === void 0 ? void 0 : _b.value) || '');
153
- attrs = (0, utils_2.setNodeStyle)(attrs, 'border-width', typeof data.borderWidth === 'number' ? data.borderWidth + 'px' : '');
154
- attrs = (0, utils_2.setNodeStyle)(attrs, 'padding', typeof data.cellPadding === 'number' ? data.cellPadding + 'px' : '');
155
- attrs = (0, utils_2.setNodeStyle)(attrs, 'background-color', data.backgroundColor || '');
156
- attrs = (0, utils_2.setNodeStyle)(attrs, 'text-align', ((_c = data.alignment) === null || _c === void 0 ? void 0 : _c.value.x) || '');
157
- attrs = (0, utils_2.setNodeStyle)(attrs, 'vertical-align', ((_d = data.alignment) === null || _d === void 0 ? void 0 : _d.value.y) || '');
158
- attrs = (0, utils_2.setNodeStyle)(attrs, 'white-space', data.textControl || '');
159
- attrs.id = data.id || null;
160
- attrs.class = data.className || null;
161
- tr.setNodeMarkup(pos, null, attrs);
162
- if (typeof data.cellWidth === 'number') {
163
- setCellWidth(tr, pos, data.cellWidth + (data.widthUnit || 'px'));
164
- }
165
- if (typeof data.cellHeight === 'number') {
166
- setCellHeight(tr, pos, data.cellHeight + (data.heightUnit || 'px'));
167
- }
168
- });
169
- };
45
+ var cellPropsUtils_1 = require("./cellPropsUtils");
170
46
  /**
171
47
  * @hidden
172
48
  */
@@ -180,9 +56,7 @@ var TableCellProperties = function (props) {
180
56
  }, []);
181
57
  var onSave = React.useCallback(function (data) {
182
58
  if (view && data) {
183
- var tr = view.state.tr;
184
- var cells = data.applyToAll ? (0, exports.tableCells)(view.state) : (0, exports.selectedCells)(view.state);
185
- applyOnCell(tr, data, cells);
59
+ var tr = (0, cellPropsUtils_1.applyCellsData)(view.state, data);
186
60
  if (tr.docChanged) {
187
61
  view.dispatch(tr);
188
62
  }
@@ -225,102 +99,6 @@ var textControlData = [
225
99
  { textKey: messages_1.keys.cellPropertiesFitToCell, text: messages_1.messages[messages_1.keys.cellPropertiesFitToCell],
226
100
  value: 'nowrap', icon: 'parameter-string', svgIcon: kendo_svg_icons_1.parameterStringIcon }
227
101
  ];
228
- var cellsWidth = function (cells, table, $pos) {
229
- var result = {
230
- cellWidth: null,
231
- widthUnit: null
232
- };
233
- var tableNode = table.node;
234
- var tablePos = $pos.start(table.depth);
235
- if (!tableNode.attrs[colgroupAttr]) {
236
- return result;
237
- }
238
- var width = new Set();
239
- var value = '';
240
- var colgroup = (0, kendo_editor_common_1.htmlToFragment)(tableNode.attrs[colgroupAttr]).firstChild;
241
- cells.forEach(function (cell) {
242
- var $cell = tableNode.resolve(cell.pos - tablePos);
243
- var row = $cell.parent;
244
- var cellIndex = $cell.index();
245
- var colSpan = 0;
246
- for (var i = 0; i <= cellIndex; i++) {
247
- colSpan += row.child(i).attrs.colspan;
248
- }
249
- var col = colgroup.children[colSpan - 1];
250
- if (col) {
251
- value = col.style.width;
252
- width.add(value);
253
- }
254
- });
255
- if (width.size === 1 && value) {
256
- result.cellWidth = parseFloat(value) || null;
257
- result.widthUnit = (0, utils_2.getUnit)(value);
258
- }
259
- return result;
260
- };
261
- var cellsHeight = function (cells, table, $pos) {
262
- var result = {
263
- cellHeight: null,
264
- heightUnit: null
265
- };
266
- var tableNode = table.node;
267
- var tablePos = $pos.start(table.depth);
268
- var height = new Set();
269
- var value = '';
270
- cells.forEach(function (cell) {
271
- var _a;
272
- var $cell = tableNode.resolve(cell.pos - tablePos);
273
- var row = $cell.parent;
274
- value = (0, utils_2.parseStyle)(((_a = row.attrs) === null || _a === void 0 ? void 0 : _a.style) || '').height || '';
275
- height.add(value);
276
- });
277
- if (height.size === 1 && value) {
278
- result.cellHeight = parseFloat(value) || null;
279
- result.heightUnit = (0, utils_2.getUnit)(value);
280
- }
281
- return result;
282
- };
283
- var cellsStyle = function (cells, style) {
284
- var values = new Set();
285
- var value = '';
286
- cells.forEach(function (cell) {
287
- var _a;
288
- value = (0, utils_2.parseStyle)(((_a = cell.node.attrs) === null || _a === void 0 ? void 0 : _a.style) || '')[style] || '';
289
- values.add(value);
290
- });
291
- if (values.size === 1 && value) {
292
- return value;
293
- }
294
- return '';
295
- };
296
- var cellsProp = function (cells, prop) {
297
- var values = new Set();
298
- var value = '';
299
- cells.forEach(function (cell) {
300
- value = (cell.node.attrs || {})[prop] || '';
301
- values.add(value);
302
- });
303
- if (values.size === 1 && value) {
304
- return value;
305
- }
306
- return '';
307
- };
308
- var initialData = {
309
- applyToAll: false,
310
- cellWidth: null,
311
- widthUnit: null,
312
- cellHeight: null,
313
- heightUnit: null,
314
- alignment: { x: '', y: '' },
315
- textControl: '',
316
- backgroundColor: null,
317
- cellPadding: '',
318
- borderWidth: null,
319
- borderColor: null,
320
- borderStyle: '',
321
- id: '',
322
- class: ''
323
- };
324
102
  /**
325
103
  * @hidden
326
104
  */
@@ -347,13 +125,7 @@ var itemRenderWithIcon = function (li, itemProps) {
347
125
  exports.itemRenderWithIcon = itemRenderWithIcon;
348
126
  var TableCellPropertiesDialog = function (props) {
349
127
  var defaults = React.useMemo(function () {
350
- var cells = (0, exports.selectedCells)(props.view.state);
351
- var $pos = props.view.state.selection.$from;
352
- var table = cells.length ? (0, utils_1.parentNode)($pos, function (n) { return n.type.spec.tableRole === 'table'; }) : null;
353
- if (!table) {
354
- return initialData;
355
- }
356
- 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') });
128
+ return (0, cellPropsUtils_1.cellsDefaultData)(props.view.state);
357
129
  }, [props.view]);
358
130
  var loc = (0, kendo_react_intl_1.useLocalization)();
359
131
  var applyToAll = React.useRef(null);
@@ -373,7 +145,8 @@ var TableCellPropertiesDialog = function (props) {
373
145
  }
374
146
  var heightUnitDef = defaults.heightUnit || '';
375
147
  var alignment = React.useRef(null);
376
- var alignmentDef = alignData.find(function (al) { return al.value.x !== undefined && al.value.x === defaults.alignment.x && al.value.y === defaults.alignment.y; }) || null;
148
+ var alignmentDef = alignData.find(function (al) { return al.value.x !== undefined && defaults.alignment &&
149
+ al.value.x === defaults.alignment.x && al.value.y === defaults.alignment.y; }) || null;
377
150
  var textControl = React.useRef(null);
378
151
  var textControlDef = textControlData.find(function (d) { return d.value === defaults.textControl; });
379
152
  var backgroundColor = React.useRef(null);
@@ -385,28 +158,28 @@ var TableCellPropertiesDialog = function (props) {
385
158
  var borderColor = React.useRef(null);
386
159
  var borderColorDef = defaults.borderColor;
387
160
  var borderStyle = React.useRef(null);
388
- var borderStyleDef = defaults.borderStyle;
161
+ var borderStyleDef = utils_1.borderStyles.find(function (s) { return s.value === defaults.borderStyle; });
389
162
  var id = React.useRef(null);
390
163
  var idDef = defaults.id;
391
164
  var className = React.useRef(null);
392
165
  var classNameDef = defaults.className;
393
166
  var onSave = React.useCallback(function () {
394
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
395
168
  var data = {
396
- applyToAll: (_b = (_a = applyToAll.current) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.checked,
397
- cellWidth: (_c = cellWidth.current) === null || _c === void 0 ? void 0 : _c.value,
398
- widthUnit: (_d = widthUnit.current) === null || _d === void 0 ? void 0 : _d.value,
399
- cellHeight: (_e = cellHeight.current) === null || _e === void 0 ? void 0 : _e.value,
400
- heightUnit: (_f = heightUnit.current) === null || _f === void 0 ? void 0 : _f.value,
401
- alignment: (_g = alignment.current) === null || _g === void 0 ? void 0 : _g.value,
402
- textControl: (_j = (_h = textControl.current) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.value,
403
- backgroundColor: (_k = backgroundColor.current) === null || _k === void 0 ? void 0 : _k.value,
404
- cellPadding: (_l = cellPadding.current) === null || _l === void 0 ? void 0 : _l.value,
405
- borderWidth: (_m = borderWidth.current) === null || _m === void 0 ? void 0 : _m.value,
406
- borderColor: (_o = borderColor.current) === null || _o === void 0 ? void 0 : _o.value,
407
- borderStyle: (_p = borderStyle.current) === null || _p === void 0 ? void 0 : _p.value,
408
- id: (_q = id.current) === null || _q === void 0 ? void 0 : _q.value,
409
- className: (_r = className.current) === null || _r === void 0 ? void 0 : _r.value
169
+ applyToAll: Boolean((_b = (_a = applyToAll.current) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.checked),
170
+ cellWidth: ((_c = cellWidth.current) === null || _c === void 0 ? void 0 : _c.value) || null,
171
+ widthUnit: ((_d = widthUnit.current) === null || _d === void 0 ? void 0 : _d.value) || '',
172
+ cellHeight: ((_e = cellHeight.current) === null || _e === void 0 ? void 0 : _e.value) || null,
173
+ heightUnit: ((_f = heightUnit.current) === null || _f === void 0 ? void 0 : _f.value) || '',
174
+ alignment: (_h = (_g = alignment.current) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.value,
175
+ textControl: (_k = (_j = textControl.current) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.value,
176
+ backgroundColor: (_l = backgroundColor.current) === null || _l === void 0 ? void 0 : _l.value,
177
+ 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,
178
+ 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,
179
+ borderColor: (_r = borderColor.current) === null || _r === void 0 ? void 0 : _r.value,
180
+ borderStyle: ((_t = (_s = borderStyle.current) === null || _s === void 0 ? void 0 : _s.value) === null || _t === void 0 ? void 0 : _t.value) || null,
181
+ id: String(((_u = id.current) === null || _u === void 0 ? void 0 : _u.value) || ''),
182
+ className: String(((_v = className.current) === null || _v === void 0 ? void 0 : _v.value) || '')
410
183
  };
411
184
  props.onSave.call(undefined, data);
412
185
  }, [props.onSave]);