@alfresco/adf-core 9.2.0-38540765902 → 9.2.0-38587349677
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/fesm2022/adf-core.mjs +13 -7
- package/fesm2022/adf-core.mjs.map +1 -1
- package/package.json +3 -3
package/fesm2022/adf-core.mjs
CHANGED
|
@@ -26661,21 +26661,27 @@ const getFormLayoutColumnWidth = (numberOfColumns, columns, columnIndex) => {
|
|
|
26661
26661
|
const defaultColumnWidth = 100 / normalizedColumnCount;
|
|
26662
26662
|
const columnFields = columns?.[columnIndex]?.fields ?? [];
|
|
26663
26663
|
if (columnFields.length === 0) {
|
|
26664
|
-
|
|
26664
|
+
const useCoveredColumnRule = hasCoveredColumnPlaceholders(normalizedColumnCount, columns) && isColumnCoveredByPreviousField(columns, columnIndex);
|
|
26665
|
+
return useCoveredColumnRule ? '0' : `${defaultColumnWidth}`;
|
|
26665
26666
|
}
|
|
26666
|
-
const maxColspan =
|
|
26667
|
+
const maxColspan = getFieldsSpan(columnFields);
|
|
26667
26668
|
return `${Math.min(100, defaultColumnWidth * maxColspan)}`;
|
|
26668
26669
|
};
|
|
26670
|
+
const getFieldsSpan = (fields) => Math.max(1, ...fields.map((field) => field.colspan || 1));
|
|
26671
|
+
const getColumnSpan = (column) => getFieldsSpan(column?.fields ?? []);
|
|
26672
|
+
const hasCoveredColumnPlaceholders = (numberOfColumns, columns) => {
|
|
26673
|
+
if (!columns?.length) {
|
|
26674
|
+
return false;
|
|
26675
|
+
}
|
|
26676
|
+
const totalSpan = columns.reduce((sum, column) => sum + getColumnSpan(column), 0);
|
|
26677
|
+
return totalSpan > numberOfColumns;
|
|
26678
|
+
};
|
|
26669
26679
|
const isColumnCoveredByPreviousField = (columns, columnIndex) => {
|
|
26670
26680
|
if (!columns || columnIndex <= 0) {
|
|
26671
26681
|
return false;
|
|
26672
26682
|
}
|
|
26673
26683
|
for (let previousColumnIndex = 0; previousColumnIndex < columnIndex; previousColumnIndex++) {
|
|
26674
|
-
const
|
|
26675
|
-
if (previousFields.length === 0) {
|
|
26676
|
-
continue;
|
|
26677
|
-
}
|
|
26678
|
-
const previousColumnSpan = Math.max(...previousFields.map((field) => field.colspan || 1));
|
|
26684
|
+
const previousColumnSpan = getColumnSpan(columns[previousColumnIndex]);
|
|
26679
26685
|
if (previousColumnIndex + previousColumnSpan > columnIndex) {
|
|
26680
26686
|
return true;
|
|
26681
26687
|
}
|