| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent db7058e commit 24146d1
202 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
| 6 | 6 | ||
| 7 | 7 | ## [Unreleased] | |
| 8 | 8 | ||
| 9 | + ### Added | ||
| 10 | + | ||
| 11 | + - Add OUIA support to all sub-components: every sub-component now renders `data-ouia-component-type` (e.g., `PF6/Component/Card/CardHeader`) and `data-ouia-safe="true"`, with an `ouiaId(String)` method for setting `data-ouia-component-id` | ||
| 12 | + | ||
| 9 | 13 | ## [0.7.7] - 2026-05-19 | |
| 10 | 14 | ||
| 11 | 15 | ### Changed | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,10 +76,10 @@ static <E extends HTMLElement, B extends TypedBuilder<E, B>> void storeComponent | |||
| 76 | 76 | static <E extends HTMLElement, B extends TypedBuilder<E, B>> void storeSubComponent(SubComponent<E, B> subComponent) { | |
| 77 | 77 | String uuid = uuid(); | |
| 78 | 78 | subComponents.put(uuid, subComponent); | |
| 79 | - subComponent.element().dataset.set(key(subComponent.componentType, subComponent.name), uuid); | ||
| 79 | + subComponent.element().dataset.set(key(subComponent.componentType, subComponent.subComponentId), uuid); | ||
| 80 | 80 | onDetach(subComponent.element(), mr -> remove(uuid, "sub component", subComponents::remove)); | |
| 81 | 81 | if (logger.isEnabled(DEBUG)) { | |
| 82 | - logger.debug("Store subcomponent %s/%s as %s on %o%s", subComponent.componentType.componentName, subComponent.name, | ||
| 82 | + logger.debug("Store subcomponent %s/%s as %s on %o%s", subComponent.componentType.componentName, subComponent.subComponentId, | ||
| 83 | 83 | uuid, subComponent.element(), count()); | |
| 84 | 84 | } | |
| 85 | 85 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | 34 | import static java.util.Objects.requireNonNull; | |
| 35 | 35 | import static org.patternfly.component.ComponentRegistry.componentRegistry; | |
| 36 | + import static org.patternfly.core.Ouia.ouia; | ||
| 36 | 37 | ||
| 37 | 38 | public abstract class SubComponent<E extends HTMLElement, B extends TypedBuilder<E, B>> implements | |
| 38 | 39 | ElementAttributeMethods<E, B>, | |
@@ -48,17 +49,25 @@ public abstract class SubComponent<E extends HTMLElement, B extends TypedBuilder | |||
| 48 | 49 | HTMLElementVisibilityMethods<E, B> { | |
| 49 | 50 | ||
| 50 | 51 | final ComponentType componentType; | |
| 51 | - final String name; | ||
| 52 | + final String subComponentId; | ||
| 53 | + final String subComponentName; | ||
| 52 | 54 | private final E element; | |
| 53 | 55 | ||
| 54 | - protected SubComponent(ComponentType componentType, String name, E element) { | ||
| 56 | + protected SubComponent(ComponentType componentType, String subComponentId, String subComponentName, E element) { | ||
| 55 | 57 | this.componentType = requireNonNull(componentType, "component type required"); | |
| 56 | - this.name = requireNonNull(name, "name required"); | ||
| 58 | + this.subComponentId = requireNonNull(subComponentId, "sub-component ID required"); | ||
| 59 | + this.subComponentName = requireNonNull(subComponentName, "sub-component name required"); | ||
| 57 | 60 | this.element = requireNonNull(element, "element required"); | |
| 61 | + ouia(element, componentType.componentName + "/" + subComponentName); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public B ouiaId(String id) { | ||
| 65 | + ouia(element(), id, componentType.componentName + "/" + subComponentName); | ||
| 66 | + return that(); | ||
| 58 | 67 | } | |
| 59 | 68 | ||
| 60 | 69 | protected String subComponentId() { | |
| 61 | - return Id.build(componentType.id, name); | ||
| 70 | + return Id.build(componentType.id, subComponentId); | ||
| 62 | 71 | } | |
| 63 | 72 | ||
| 64 | 73 | @Override | |
@@ -67,7 +76,7 @@ public E element() { | |||
| 67 | 76 | } | |
| 68 | 77 | ||
| 69 | 78 | public B registerSubComponent() { | |
| 70 | - componentRegistry().registerSubComponent(componentType, name, this); | ||
| 79 | + componentRegistry().registerSubComponent(componentType, subComponentId, this); | ||
| 71 | 80 | return that(); | |
| 72 | 81 | } | |
| 73 | 82 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,8 @@ public static AccordionItem accordionItem(String identifier, String text) { | |||
| 81 | 81 | ||
| 82 | 82 | // ------------------------------------------------------ instance | |
| 83 | 83 | ||
| 84 | - public static final String SUB_COMPONENT_NAME = "aci"; | ||
| 84 | + public static final String SUB_COMPONENT_ID = "aci"; | ||
| 85 | + public static final String SUB_COMPONENT_NAME = "AccordionItem"; | ||
| 85 | 86 | private final String identifier; | |
| 86 | 87 | private final Map<String, Object> data; | |
| 87 | 88 | private final HTMLElement textElement; | |
@@ -92,7 +93,7 @@ public static AccordionItem accordionItem(String identifier, String text) { | |||
| 92 | 93 | private HTMLElement contentElement; | |
| 93 | 94 | ||
| 94 | 95 | AccordionItem(String identifier) { | |
| 95 | - super(SUB_COMPONENT_NAME, div().css(component(accordion, item)).element()); | ||
| 96 | + super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, div().css(component(accordion, item)).element()); | ||
| 96 | 97 | this.identifier = identifier; | |
| 97 | 98 | this.data = new HashMap<>(); | |
| 98 | 99 | this.expanded = false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,10 +36,11 @@ public static AccordionItemBody accordionItemBody() { | |||
| 36 | 36 | ||
| 37 | 37 | // ------------------------------------------------------ instance | |
| 38 | 38 | ||
| 39 | - public static final String SUB_COMPONENT_NAME = "acicb"; | ||
| 39 | + public static final String SUB_COMPONENT_ID = "acicb"; | ||
| 40 | + public static final String SUB_COMPONENT_NAME = "AccordionItemBody"; | ||
| 40 | 41 | ||
| 41 | 42 | AccordionItemBody() { | |
| 42 | - super(SUB_COMPONENT_NAME, div().css(component(accordion, expandableContent, body)).element()); | ||
| 43 | + super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, div().css(component(accordion, expandableContent, body)).element()); | ||
| 43 | 44 | } | |
| 44 | 45 | ||
| 45 | 46 | // ------------------------------------------------------ builder | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | abstract class AccordionSubComponent<E extends HTMLElement, B extends TypedBuilder<E, B>> extends SubComponent<E, B> { | |
| 25 | 25 | ||
| 26 | - AccordionSubComponent(String name, E element) { | ||
| 27 | - super(ComponentType.Accordion, name, element); | ||
| 26 | + AccordionSubComponent(String subComponentId, String subComponentName, E element) { | ||
| 27 | + super(ComponentType.Accordion, subComponentId, subComponentName, element); | ||
| 28 | 28 | } | |
| 29 | 29 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,10 +37,11 @@ public static AlertActionGroup alertActionGroup() { | |||
| 37 | 37 | ||
| 38 | 38 | // ------------------------------------------------------ instance | |
| 39 | 39 | ||
| 40 | - public static final String SUB_COMPONENT_NAME = "aag"; | ||
| 40 | + public static final String SUB_COMPONENT_ID = "aag"; | ||
| 41 | + public static final String SUB_COMPONENT_NAME = "AlertActionGroup"; | ||
| 41 | 42 | ||
| 42 | 43 | AlertActionGroup() { | |
| 43 | - super(SUB_COMPONENT_NAME, div().css(component(Classes.alert, actionGroup)).element()); | ||
| 44 | + super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, div().css(component(Classes.alert, actionGroup)).element()); | ||
| 44 | 45 | } | |
| 45 | 46 | ||
| 46 | 47 | // ------------------------------------------------------ add | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,10 +39,11 @@ public static AlertDescription alertDescription(String text) { | |||
| 39 | 39 | ||
| 40 | 40 | // ------------------------------------------------------ instance | |
| 41 | 41 | ||
| 42 | - public static final String SUB_COMPONENT_NAME = "ad"; | ||
| 42 | + public static final String SUB_COMPONENT_ID = "ad"; | ||
| 43 | + public static final String SUB_COMPONENT_NAME = "AlertDescription"; | ||
| 43 | 44 | ||
| 44 | 45 | AlertDescription() { | |
| 45 | - super(SUB_COMPONENT_NAME, div().css(component(alert, description)).element()); | ||
| 46 | + super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, div().css(component(alert, description)).element()); | ||
| 46 | 47 | } | |
| 47 | 48 | ||
| 48 | 49 | // ------------------------------------------------------ builder | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | abstract class AlertSubComponent<E extends HTMLElement, B extends TypedBuilder<E, B>> extends SubComponent<E, B> { | |
| 25 | 25 | ||
| 26 | - AlertSubComponent(String name, E element) { | ||
| 27 | - super(ComponentType.Alert, name, element); | ||
| 26 | + AlertSubComponent(String subComponentId, String subComponentName, E element) { | ||
| 27 | + super(ComponentType.Alert, subComponentId, subComponentName, element); | ||
| 28 | 28 | } | |
| 29 | 29 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,14 +64,15 @@ public static BreadcrumbItem breadcrumbItem(String identifier, String text, Stri | |||
| 64 | 64 | ||
| 65 | 65 | // ------------------------------------------------------ instance | |
| 66 | 66 | ||
| 67 | - public static final String SUB_COMPONENT_NAME = "bci"; | ||
| 67 | + public static final String SUB_COMPONENT_ID = "bci"; | ||
| 68 | + public static final String SUB_COMPONENT_NAME = "BreadcrumbItem"; | ||
| 68 | 69 | private final String identifier; | |
| 69 | 70 | private final Map<String, Object> data; | |
| 70 | 71 | private final HTMLElement textElement; | |
| 71 | 72 | private HTMLAnchorElement anchorElement; | |
| 72 | 73 | ||
| 73 | 74 | <E extends HTMLElement> BreadcrumbItem(String identifier) { | |
| 74 | - super(SUB_COMPONENT_NAME, li().css(component(breadcrumb, item)) | ||
| 75 | + super(SUB_COMPONENT_ID, SUB_COMPONENT_NAME, li().css(component(breadcrumb, item)) | ||
| 75 | 76 | .data(Dataset.identifier, identifier) | |
| 76 | 77 | .element()); | |
| 77 | 78 | this.identifier = identifier; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments