@contrail/document-table 1.0.12 → 1.0.16

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.
@@ -98,7 +98,6 @@ class TableCopyService {
98
98
  }
99
99
  newTableElement.rowIds = rowIds;
100
100
  newTableElement.columnIds = columnIds;
101
- console.log(newChildElements);
102
101
  return [newTableElement, ...newChildElements];
103
102
  }
104
103
  static createTableFromCells(element, rows, columns, cells) {
@@ -102,7 +102,10 @@ class TableMergeService {
102
102
  }
103
103
  else {
104
104
  element.style = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(table_service_1.TableService.DEFAULT_CELL_STYLE), firstCell.style);
105
- element.rotate = Object.assign({}, firstCell.rotate);
105
+ if (firstCell.rotate) {
106
+ element.rotate = Object.assign({}, firstCell.rotate);
107
+ elementUndo.rotate = elementUndo.rotate || (firstCell.rotate.angle === 270 ? { angle: 0 } : { angle: 270 });
108
+ }
106
109
  table_service_1.TableService.clearCell(element);
107
110
  }
108
111
  elementsToUpdate.push({ change: element, undo: elementUndo });
@@ -80,15 +80,16 @@ class TablePasteService {
80
80
  }
81
81
  }
82
82
  for (const [columnId, width] of columnWidthsToUpdate) {
83
- const updatedColumn = table_service_1.TableService.resizeColumn(tableElement, childElements, columnId, width).elementsToUpdate[1];
84
- const updatedRowAndCells = table_service_1.TableService.autoFitRows(tableElement, childElements, columnId).elementsToUpdate;
83
+ const updatedColumn = table_service_1.TableService.resizeColumn(tableElement, [...childElements, ...elementsToCreate], columnId, width).elementsToUpdate[1];
84
+ const updatedRowAndCells = table_service_1.TableService.autoFitRows(tableElement, [...childElements, ...elementsToCreate], columnId).elementsToUpdate;
85
85
  const uniqueUpdatedRowAndCells = (0, documents_1.uniqueElementsToUpdate)(updatedRowAndCells, elementsToUpdate);
86
86
  elementsToUpdate.push(updatedColumn);
87
87
  elementsToUpdate.push(...uniqueUpdatedRowAndCells);
88
88
  }
89
89
  for (const [rowId, height] of rowHeightsToUpdate) {
90
- const updatedRow = table_service_1.TableService.resizeRow(tableElement, childElements, rowId, height).elementsToUpdate[1];
91
- const updatedColumnAndCells = table_service_1.TableService.autoFitColumns(tableElement, childElements, rowId).elementsToUpdate;
90
+ const updatedRow = table_service_1.TableService.resizeRow(tableElement, [...childElements, ...elementsToCreate], rowId, height)
91
+ .elementsToUpdate[1];
92
+ const updatedColumnAndCells = table_service_1.TableService.autoFitColumns(tableElement, [...childElements, ...elementsToCreate], rowId).elementsToUpdate;
92
93
  const uniqueUpdatedColumnAndCells = (0, documents_1.uniqueElementsToUpdate)(updatedColumnAndCells, elementsToUpdate);
93
94
  elementsToUpdate.push(updatedRow);
94
95
  elementsToUpdate.push(...uniqueUpdatedColumnAndCells);
@@ -131,8 +132,10 @@ class TablePasteService {
131
132
  cell.style = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(table_service_1.TableService.DEFAULT_CELL_STYLE), util_1.ObjectUtil.cloneDeep(cellToPaste.style));
132
133
  cell.colspan = cellToPaste.colspan > 1 ? cellToPaste.colspan : 1;
133
134
  cell.rowspan = cellToPaste.rowspan > 1 ? cellToPaste.rowspan : 1;
134
- if (cellToPaste.rotate)
135
+ if (cellToPaste.rotate) {
135
136
  cell.rotate = Object.assign({}, cellToPaste.rotate);
137
+ cellUndo.rotate = cellUndo.rotate || (cellToPaste.rotate.angle === 270 ? { angle: 0 } : { angle: 270 });
138
+ }
136
139
  const cellMergedRanged = table_merge_service_1.TableMergeService.getMergedRange(tableElement, cell);
137
140
  if (table_service_1.TableService.isVerticalCell(cell)) {
138
141
  cell.size.height = cellMergedRanged
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-table",
3
- "version": "1.0.12",
3
+ "version": "1.0.16",
4
4
  "description": "Library for document tables",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",