-
Notifications
You must be signed in to change notification settings - Fork 61
Added Table component support in Core Components #1879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
752a3a1
added basic config files for the table component
b464ca6
added .content.xml for the table component
6fd9256
added edit toolbar for the table component _cq_editConfig.xml
48751d0
added table.html
7babc5a
added basic css and js for the table authoring currently refering the…
b63f728
added site clientlibs for the table component
d724101
added basic config files for the tableheader
e155b60
added basic config files for the tablerow
5141c84
added site clientlibs for tableheader
5bd372e
added clientlibs folder in the tablerow
e1bd831
added the table component in examples folder along with cq_template
defbeac
added runtime dependencies in the runtime all for the table component
db6f972
replaced the tr elements from the div elements to fix the selecting i…
8a42612
added action configs in the edit toolbar for the table component
025f692
added action configs for the table row and the tableroweditorhook.js …
d15d30a
removed the add row option from the tableHeaderRow
cbcaf58
updated the header cells from the textinput to text type in the templ…
0bc9b74
added the addCol and deleteCol actions and also there handlers
6d01f3e
removed cell numbers from dynamic addition of the table cols and rows
17dc15c
added the feature of repeatable panels to the table row at runtime
be9945e
added the replace feature for the tablecell to any component which is…
6d844a4
removed the delete options from the table cells in the table row
4ea970a
in this commit table tags have gone -> repeatable panels not working …
3fc4874
added files to fix the repeatative panels with the table tags
2aa3dc8
fixed the repeatable rows with indexing
532f899
changed the authoring from divs to tabletags sacirificing the touch u…
982808a
fixed the touch ui with the table tags
87b0ab5
fixed the tablecell css having controls
e3a8833
removed the tableeditor.css file
148b696
added replace feature to the components of the table Header also
09cac75
fixed the refresh issue by adding authoring dialogs for table row and…
dd3c4ac
added cypress tests and collaterals for testing
cea9fa0
added sling folder for collaterals
020afda
fixed the test cases
aa30cf1
fixed the content.xml
e2eee6e
fixed the failing testcases
2f48dc1
updated the year to 2026
6115300
fixed the short and long description for the table component
1fdb4e1
removed unsupported authoring from the table component
34811d0
refactored the table.html
bde84da
updated README for the table Component
73885d2
Resolved Conflicts
aa80923
added sorting feature for the table component
8943627
enabled sorting button during authoring too
7ae0472
added feature to disable/enable sorting on a particular column of the…
27d8616
added authoring options for sorting and column width
34a709b
added dor support for table component
0b10178
added dor testing
3a18898
added the feature of merge and split cell during runtime by adding co…
3345d7c
updated README for table, tableheader, tablerow
5aa26dd
added the feature for merge row cells and commented out the header ce…
92e9463
added testing for second phase features
d83e9b1
fixed review comments 1
c284c02
fixed review comments 2
9a01916
fixed cypress tests
6bc6311
fixed coverage
b78572c
fixed the sorting behaviour to improve the archaic behavior
da43f30
fixed cypress testing mergesplit feature
02bb9c8
fixed cypress testing
a259485
moved .css changes from core component to theme canvas
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TableHeaderImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ~ Copyright 2026 Adobe | ||
| ~ | ||
| ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| ~ you may not use this file except in compliance with the License. | ||
| ~ You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | ||
| package com.adobe.cq.forms.core.components.internal.models.v1.form; | ||
|
|
||
| import org.apache.sling.api.SlingHttpServletRequest; | ||
| import org.apache.sling.api.resource.Resource; | ||
| import org.apache.sling.models.annotations.Exporter; | ||
| import org.apache.sling.models.annotations.Model; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import com.adobe.cq.export.json.ComponentExporter; | ||
| import com.adobe.cq.export.json.ExporterConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.FormConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; | ||
| import com.adobe.cq.forms.core.components.models.form.Panel; | ||
|
|
||
| @Model( | ||
| adaptables = { SlingHttpServletRequest.class, Resource.class }, | ||
| adapters = { Panel.class, ComponentExporter.class }, | ||
| resourceType = { FormConstants.RT_FD_FORM_TABLE_HEADER_V1 }) | ||
| @Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) | ||
| public class TableHeaderImpl extends PanelImpl { | ||
|
|
||
| @Override | ||
| @NotNull | ||
| public String getExportedType() { | ||
| return ReservedProperties.VT_TABLE_HEADER; | ||
| } | ||
| } |
142 changes: 142 additions & 0 deletions
142
...e/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TableImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ~ Copyright 2026 Adobe | ||
| ~ | ||
| ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| ~ you may not use this file except in compliance with the License. | ||
| ~ You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | ||
| package com.adobe.cq.forms.core.components.internal.models.v1.form; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import javax.annotation.Nullable; | ||
|
|
||
| import org.apache.sling.api.SlingHttpServletRequest; | ||
| import org.apache.sling.api.resource.Resource; | ||
| import org.apache.sling.models.annotations.Exporter; | ||
| import org.apache.sling.models.annotations.Model; | ||
| import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy; | ||
| import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import com.adobe.cq.export.json.ComponentExporter; | ||
| import com.adobe.cq.export.json.ExporterConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.FormConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; | ||
| import com.adobe.cq.forms.core.components.models.form.Panel; | ||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| @Model( | ||
| adaptables = { SlingHttpServletRequest.class, Resource.class }, | ||
| adapters = { Panel.class, ComponentExporter.class }, | ||
| resourceType = { FormConstants.RT_FD_FORM_TABLE_V1 }) | ||
| @Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) | ||
| public class TableImpl extends PanelImpl { | ||
|
|
||
| @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_DOR_COLUMN_WIDTHS) | ||
| @Nullable | ||
| protected String columnWidth; | ||
|
|
||
| @ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_ENABLE_SORTING) | ||
| @Nullable | ||
| protected Boolean enableSorting; | ||
|
|
||
| /** | ||
| * When {@code true}, runtime (publish) enables client-side column sorting. | ||
| * Omitted from JSON when {@code false} (see {@link JsonInclude.Include#NON_DEFAULT}). | ||
| */ | ||
| @JsonProperty("enableSorting") | ||
| @JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
| public boolean isEnableSorting() { | ||
| return Boolean.TRUE.equals(enableSorting); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the raw comma-separated column width string from JCR (e.g. "1,1,4"). | ||
| * Used in edit mode as the {@code data-column-widths} attribute. | ||
| */ | ||
| @JsonIgnore | ||
| public String getColumnWidth() { | ||
| return columnWidth; | ||
| } | ||
|
|
||
| /** | ||
| * True when {@link #getColumnWidthColStyles()} would return a non-empty list (valid authored widths). | ||
| */ | ||
| @JsonIgnore | ||
| public boolean isColumnWidthsConfigured() { | ||
| return !getColumnWidthColStyles().isEmpty(); | ||
| } | ||
|
|
||
| @Override | ||
| @NotNull | ||
| public String getExportedType() { | ||
| return ReservedProperties.VT_TABLE; | ||
| } | ||
|
|
||
| @Override | ||
| @JsonIgnore | ||
| @NotNull | ||
| public Map<String, Object> getDorProperties() { | ||
|
armaang1729 marked this conversation as resolved.
|
||
| Map<String, Object> props = new LinkedHashMap<>(super.getDorProperties()); | ||
| if (columnWidth != null && !columnWidth.isEmpty()) { | ||
| // Pass authored proportional widths into fd:dor so DoRTableElement can compute | ||
| // proportional XFA column widths (e.g. "1,2,1" → relative pixel widths). | ||
| props.put(ReservedProperties.PN_DOR_COLUMN_WIDTHS, columnWidth); | ||
| } | ||
| return props; | ||
| } | ||
|
|
||
| /** | ||
| * One entry per column for {@code <col style="...">}: {@code width: N%} (no HTL string concatenation). | ||
| * For example, proportional {@code "1,1,4"} becomes {@code width: 16%}, {@code width: 16%}, {@code width: 66%}. | ||
| * Negative or non-numeric values are treated as 1. The last column absorbs any rounding remainder so widths sum to 100%. | ||
| */ | ||
| @JsonIgnore | ||
| public List<String> getColumnWidthColStyles() { | ||
| if (columnWidth == null || columnWidth.isEmpty()) { | ||
| return Collections.emptyList(); | ||
| } | ||
| String[] parts = columnWidth.split(","); | ||
| int[] values = new int[parts.length]; | ||
| int sum = 0; | ||
| for (int i = 0; i < parts.length; i++) { | ||
| try { | ||
| values[i] = Integer.parseInt(parts[i].trim()); | ||
| } catch (NumberFormatException e) { | ||
| values[i] = 1; | ||
| } | ||
| if (values[i] < 0) { | ||
| values[i] = 0; | ||
| } | ||
| sum += values[i]; | ||
| } | ||
| if (sum == 0) { | ||
| return Collections.emptyList(); | ||
| } | ||
| List<String> result = new ArrayList<>(); | ||
| int allocated = 0; | ||
| for (int i = 0; i < values.length; i++) { | ||
| int pct = (i == values.length - 1) | ||
| ? (100 - allocated) | ||
| : (int) Math.floor((values[i] * 100.0) / sum); | ||
| allocated += pct; | ||
| result.add("width: " + pct + "%"); | ||
| } | ||
| return result; | ||
| } | ||
| } | ||
42 changes: 42 additions & 0 deletions
42
...rc/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/TableRowImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ~ Copyright 2026 Adobe | ||
| ~ | ||
| ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| ~ you may not use this file except in compliance with the License. | ||
| ~ You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | ||
| package com.adobe.cq.forms.core.components.internal.models.v1.form; | ||
|
|
||
| import org.apache.sling.api.SlingHttpServletRequest; | ||
| import org.apache.sling.api.resource.Resource; | ||
| import org.apache.sling.models.annotations.Exporter; | ||
| import org.apache.sling.models.annotations.Model; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import com.adobe.cq.export.json.ComponentExporter; | ||
| import com.adobe.cq.export.json.ExporterConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.FormConstants; | ||
| import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; | ||
| import com.adobe.cq.forms.core.components.models.form.Panel; | ||
|
|
||
| @Model( | ||
| adaptables = { SlingHttpServletRequest.class, Resource.class }, | ||
| adapters = { Panel.class, ComponentExporter.class }, | ||
| resourceType = { FormConstants.RT_FD_FORM_TABLE_ROW_V1 }) | ||
| @Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION) | ||
| public class TableRowImpl extends PanelImpl { | ||
|
|
||
| @Override | ||
| @NotNull | ||
| public String getExportedType() { | ||
| return ReservedProperties.VT_TABLE_ROW; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.