swoop-common 2.2.101 → 2.2.103

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.
@@ -19,6 +19,24 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
19
19
  const syncArrayColumnLabels = () => {
20
20
  const tables = root.querySelectorAll(".MuiTable-root");
21
21
  tables.forEach((table) => {
22
+ table.removeAttribute("data-jsonforms-two-col-array");
23
+ const existingLabels = table.querySelectorAll(":scope > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root[data-column-label]");
24
+ existingLabels.forEach((cell) => cell.removeAttribute("data-column-label"));
25
+ });
26
+ tables.forEach((table) => {
27
+ const headerRows = table.querySelectorAll(":scope > .MuiTableHead-root > .MuiTableRow-root");
28
+ if (headerRows.length < 2)
29
+ return;
30
+ const firstBodyRow = table.querySelector(":scope > .MuiTableBody-root > .MuiTableRow-root");
31
+ if (!firstBodyRow)
32
+ return;
33
+ const firstBodyRowCells = firstBodyRow.querySelectorAll(":scope > .MuiTableCell-root");
34
+ if (firstBodyRowCells.length < 3)
35
+ return;
36
+ const lastCell = firstBodyRowCells[firstBodyRowCells.length - 1];
37
+ const hasActionCell = Boolean(lastCell.querySelector("button, svg"));
38
+ if (!hasActionCell)
39
+ return;
22
40
  const headerCells = table.querySelectorAll(":scope > .MuiTableHead-root > .MuiTableRow-root:last-child > .MuiTableCell-root");
23
41
  if (headerCells.length === 0)
24
42
  return;
@@ -27,6 +45,7 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
27
45
  .filter((label) => label.length > 0);
28
46
  if (labels.length === 0)
29
47
  return;
48
+ table.setAttribute("data-jsonforms-two-col-array", "true");
30
49
  const bodyRows = table.querySelectorAll(":scope > .MuiTableBody-root > .MuiTableRow-root");
31
50
  bodyRows.forEach((row) => {
32
51
  const bodyCells = row.querySelectorAll(":scope > .MuiTableCell-root");
@@ -48,7 +67,7 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
48
67
  }, [json, ui]);
49
68
  return (React.createElement(ComponentContext, { componentId: hintComponentId, stage: stage },
50
69
  React.createElement(GlobalStyles, { styles: {
51
- ".json-forms-wrapper .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root": {
70
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableBody-root > .MuiTableRow-root": {
52
71
  display: "grid",
53
72
  gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
54
73
  columnGap: "24px",
@@ -57,21 +76,21 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
57
76
  position: "relative",
58
77
  paddingRight: "52px",
59
78
  },
60
- ".json-forms-wrapper .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root": {
79
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root": {
61
80
  minWidth: 0,
62
81
  width: "100%",
63
82
  padding: 0,
64
83
  },
65
- ".json-forms-wrapper .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root[data-column-label]::before": {
84
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root[data-column-label]::before": {
66
85
  content: "attr(data-column-label)",
67
86
  display: "block",
68
87
  marginBottom: "8px",
69
88
  fontWeight: 600,
70
89
  },
71
- ".json-forms-wrapper .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root:only-child": {
90
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root:only-child": {
72
91
  gridColumn: "1 / -1",
73
92
  },
74
- ".json-forms-wrapper .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root:last-child": {
93
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root:last-child": {
75
94
  position: "absolute",
76
95
  right: 0,
77
96
  top: "50%",
@@ -79,7 +98,7 @@ export const StyledFormView = ({ initialData, schema, onChange, stage, pool, rea
79
98
  width: "auto",
80
99
  padding: 0,
81
100
  },
82
- ".json-forms-wrapper .MuiTable-root > .MuiTableHead-root > .MuiTableRow-root:last-child": {
101
+ ".json-forms-wrapper .MuiTable-root[data-jsonforms-two-col-array='true'] > .MuiTableHead-root > .MuiTableRow-root:last-child": {
83
102
  display: "none",
84
103
  },
85
104
  } }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.2.101",
3
+ "version": "2.2.103",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {