ENHANCEMENT-473: add SemanticLink component support and fix DataReference duplicate refresh#142
Conversation
ef3ccda to
bfeb7dd
Compare
|
|
||
| import com.pega.constellation.sdk.kmp.core.api.ComponentContext | ||
|
|
||
| class SemanticLinkComponent(context: ComponentContext) : FieldComponent(context) No newline at end of file |
There was a problem hiding this comment.
Despite SemanticLink is a "field" it cannot extend FieldComponent because it lacks many field props. It is always kid of "readonly" and It also don't support updateValue and updateFocus. I think it is better to extend just BaseComponent.
| @@ -0,0 +1,11 @@ | |||
| import { FieldBaseComponent } from "./field-base.component.js"; | |||
|
|
|||
| export class SemanticLinkComponent extends FieldBaseComponent { | |||
There was a problem hiding this comment.
Despite SemanticLink is a "field" it cannot extend FieldBaseComponent because it lacks many field props. It is always readonly and It also don't support FieldChange and FieldChangeWithFocus.
| const configProps = this.pConn.resolveConfigProps(this.pConn.getConfigProps()); | ||
| this.props.value = configProps.text ?? configProps.value ?? ""; | ||
| this.props.readOnly = true; | ||
| this.props.disabled = true; |
There was a problem hiding this comment.
if we don't extend FieldBaseComponent then we will not have to hardcode these props (we will not use them at all)
| @Composable | ||
| override fun SemanticLinkComponent.Render() { | ||
| WithFieldHelpers( | ||
| editable = { FieldValue(label, value) } |
There was a problem hiding this comment.
it looks weird now that we use editable and put FieldValue into it
if we don't extend FieldComponent in SemanticLinkComponent then we will just render it as FieldValue
|
|
||
| // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value | ||
| const propValue = event?.id || event?.target?.value; | ||
| const propValue = selectionValue; |
There was a problem hiding this comment.
unnecessary variable, we could use selectionValue
| }); | ||
| } | ||
|
|
||
| // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value |
There was a problem hiding this comment.
this comment should be moved before creation of selectionValue
| }); | ||
| PCore.getDeferLoadManager().refreshActiveComponents(this.pConn.getContextName()); | ||
| } else { | ||
| } else if (hasAssociatedViewConfigured) { |
There was a problem hiding this comment.
maybe it is worth to add some comment that we want to skip manual refreshCaseView for picklist-based children (Dropdown, AutoComplete, Checkbox).
| "OI1OYV-Marco2-Work-DetailsTemplateTest" -> Asset("responses/dx/cases/DetailsTest-POST.json") | ||
| "OFV0MW-Marco-Work-EmbeddedDataTest-SingleRecord" -> Asset("responses/dx/cases/EmbeddedDataTest-SingleRecord.json") | ||
| "OFV0MW-Marco-Work-EmbeddedDataTest-Combobox" -> Asset("responses/dx/cases/EmbeddedDataTest-Combobox-POST.json") | ||
| "OI1OYV-Marco2-Work-DataReferenceTest" -> Asset("responses/dx/cases/DataRefSemanticLinkTest-POST.json") |
There was a problem hiding this comment.
its better to include our use case in the name so e.g.: "OI1OYV-Marco2-Work-DataReferenceTest-FieldOnly"
bfeb7dd to
2567fab
Compare
| class DataRefSemanticLinkTest : ComposeTest(PegaVersion.v25_1) { | ||
|
|
||
| @Test | ||
| fun test_data_reference_form_and_semantic_link() = runComposeUiTest { |
There was a problem hiding this comment.
please use runAndroidTest instead of runComposeUiTest - it will is a new way of running tests with collecting screenshots on failures
…h logic - Add SemanticLink component support - Fix DataReference refresh: use hasAssociatedViewConfigured check (matching web implementation) instead of blanket-skipping picklist types Co-authored-by: Copilot <[email protected]>
2567fab to
ee58db9
Compare
Add SemanticLink as a display-only field component across JS bridge, core, and renderer layers. Fix DataReference duplicate refresh issue by skipping manual refreshCaseView for picklist-based children (Dropdown, AutoComplete, Checkbox). Add instrumented UI test covering DataReference selection, refresh, and SemanticLink rendering after step transition.