@adobe/helix-md2jcr 1.1.37 → 1.1.38
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.1.38](https://github.com/adobe/helix-md2jcr/compare/v1.1.37...v1.1.38) (2025-10-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* table support ([#157](https://github.com/adobe/helix-md2jcr/issues/157)) ([1815a04](https://github.com/adobe/helix-md2jcr/commit/1815a043a0ed2ae8fbb8c07b007f6354e0ab9edb))
|
|
7
|
+
|
|
1
8
|
## [1.1.37](https://github.com/adobe/helix-md2jcr/compare/v1.1.36...v1.1.37) (2025-09-29)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { getComponentById, getComponentByTitle } from './Definitions.js';
|
|
13
|
+
import { getComponentById, getComponentByTitle, getAllComponents } from './Definitions.js';
|
|
14
14
|
import FieldGroup from './FieldGroup.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -99,6 +99,18 @@ class ModelHelper {
|
|
|
99
99
|
this.groups.push({ modelId: filtersModel.id, fieldGroup: new FieldGroup(filtersModel) });
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
// // special case for the table component where the component is dynamically selected
|
|
104
|
+
// // therefore we are going to add all the models that start with 'table-col-'
|
|
105
|
+
// // so that we can find the associated model for each column.
|
|
106
|
+
if (component.name.toLowerCase() === 'table') {
|
|
107
|
+
// add all the models that start with 'table-col-'
|
|
108
|
+
this.models.forEach((m) => {
|
|
109
|
+
if (m.id.startsWith('table-col-')) {
|
|
110
|
+
this.groups.push({ modelId: m.id, fieldGroup: new FieldGroup(m) });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
/**
|
|
@@ -112,6 +124,27 @@ class ModelHelper {
|
|
|
112
124
|
// no need to pass the fieldGroup just return the fields in the group
|
|
113
125
|
return (result) ? result.fieldGroup : null;
|
|
114
126
|
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Return the allowed components for the component.
|
|
130
|
+
* @param {Component} component The component.
|
|
131
|
+
* @return {Array<string>} The allowed components.
|
|
132
|
+
*/
|
|
133
|
+
getAllowedComponents(component) {
|
|
134
|
+
const base = this.filters.find((f) => f.id === component.filterId)?.components || [];
|
|
135
|
+
|
|
136
|
+
// special case for the table component where the component is dynamically selected
|
|
137
|
+
// therefore we are going to add all the models that start with 'table-col-'
|
|
138
|
+
// so that we can find the associated model for each column.
|
|
139
|
+
if (component.name.toLowerCase() === 'table') {
|
|
140
|
+
const components = getAllComponents(this.definition);
|
|
141
|
+
components
|
|
142
|
+
.filter((c) => c.id.startsWith('table-col-'))
|
|
143
|
+
.forEach((c) => base.push(c.id));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return base;
|
|
147
|
+
}
|
|
115
148
|
}
|
|
116
149
|
|
|
117
150
|
export default ModelHelper;
|
|
@@ -549,7 +549,8 @@ function gridTablePartial(context) {
|
|
|
549
549
|
// 1. In this section attempt to locate the associated model for the block.
|
|
550
550
|
// 2. Trim the mdast nodes to only be relevant for the child block.
|
|
551
551
|
// 3. Then getBlockitems will process the mdast nodes and return the block items.
|
|
552
|
-
const allowedComponents =
|
|
552
|
+
const allowedComponents = modelHelper.getAllowedComponents(component);
|
|
553
|
+
|
|
553
554
|
// collect all rows
|
|
554
555
|
const blockRows = findAll(mdast, (node) => node.type === 'gtRow', true);
|
|
555
556
|
// the fieldGroup (parent model) determines the expected number of rows in the table
|