@supernova-studio/client 0.4.1 → 0.4.2

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/index.mjs CHANGED
@@ -1049,7 +1049,6 @@ var PageBlockItemTableValue = z33.object({
1049
1049
  highlightHeaderColumn: z33.boolean().optional(),
1050
1050
  highlightHeaderRow: z33.boolean().optional(),
1051
1051
  showBorder: z33.boolean().optional(),
1052
- width: z33.number().optional(),
1053
1052
  value: z33.array(PageBlockItemTableRow)
1054
1053
  });
1055
1054
  var DocumentationItemConfiguration = z34.object({
@@ -4068,30 +4067,35 @@ function serializeAsTable(input) {
4068
4067
  content: [
4069
4068
  {
4070
4069
  type: "table",
4071
- content: table.value.map((row, rowIndex) => {
4072
- const isHeaderRow = rowIndex === 0 && table.highlightHeaderRow === true;
4073
- return {
4074
- type: "tableRow",
4075
- content: row.cells.map((cell, cellIndex) => {
4076
- const isHeaderColumn = cellIndex === 0 && table.highlightHeaderColumn === true;
4077
- return {
4078
- type: isHeaderRow || isHeaderColumn ? "tableHeader" : "tableCell",
4079
- attrs: {
4080
- id: cell.id,
4081
- textAlign: serializeTableCellAlignment(cell.alignment),
4082
- colspan: 1,
4083
- rowspan: 1,
4084
- ...cell.columnWidth && { colwidth: [cell.columnWidth] }
4085
- },
4086
- content: cell.nodes.map(serializeTableNode)
4087
- };
4088
- })
4089
- };
4090
- })
4070
+ content: serializeTableRows(table)
4091
4071
  }
4092
4072
  ]
4093
4073
  };
4094
4074
  }
4075
+ function serializeTableRows(table) {
4076
+ const rows = table.value.length ? table.value : [{ cells: [] }];
4077
+ return rows.map((row, rowIndex) => {
4078
+ const isHeaderRow = rowIndex === 0 && table.highlightHeaderRow === true;
4079
+ const cells = row.cells.length ? row.cells : [{ id: "", alignment: "Left", nodes: [] }];
4080
+ return {
4081
+ type: "tableRow",
4082
+ content: cells.map((cell, cellIndex) => {
4083
+ const isHeaderColumn = cellIndex === 0 && table.highlightHeaderColumn === true;
4084
+ return {
4085
+ type: isHeaderRow || isHeaderColumn ? "tableHeader" : "tableCell",
4086
+ attrs: {
4087
+ ...cell.id && { id: cell.id },
4088
+ textAlign: serializeTableCellAlignment(cell.alignment),
4089
+ colspan: 1,
4090
+ rowspan: 1,
4091
+ ...cell.columnWidth && { colwidth: [cell.columnWidth] }
4092
+ },
4093
+ content: serializeTableCellNodes(cell)
4094
+ };
4095
+ })
4096
+ };
4097
+ });
4098
+ }
4095
4099
  function serializeTableCellAlignment(alignment) {
4096
4100
  switch (alignment) {
4097
4101
  case "Left":
@@ -4104,6 +4108,14 @@ function serializeTableCellAlignment(alignment) {
4104
4108
  return "left";
4105
4109
  }
4106
4110
  }
4111
+ function serializeTableCellNodes(cell) {
4112
+ const result = cell.nodes.map(serializeTableNode);
4113
+ if (result.length) {
4114
+ return result;
4115
+ } else {
4116
+ return [{ type: "paragraph" }];
4117
+ }
4118
+ }
4107
4119
  function serializeTableNode(node) {
4108
4120
  switch (node.type) {
4109
4121
  case "RichText":