-
Notifications
You must be signed in to change notification settings - Fork 5
ENHANCEMENT-473: add SemanticLink component support and fix DataReference duplicate refresh #142
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
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
28 changes: 28 additions & 0 deletions
28
...c/commonMain/kotlin/com/pega/constellation/sdk/kmp/core/components/fields/SemanticLink.kt
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,28 @@ | ||
| package com.pega.constellation.sdk.kmp.core.components.fields | ||
|
|
||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.setValue | ||
| import com.pega.constellation.sdk.kmp.core.api.BaseComponent | ||
| import com.pega.constellation.sdk.kmp.core.api.ComponentContext | ||
| import com.pega.constellation.sdk.kmp.core.api.HideableComponent | ||
| import com.pega.constellation.sdk.kmp.core.components.getString | ||
| import com.pega.constellation.sdk.kmp.core.components.optBoolean | ||
| import kotlinx.serialization.json.JsonObject | ||
|
|
||
| class SemanticLinkComponent(context: ComponentContext) : BaseComponent(context), HideableComponent { | ||
| var value: String by mutableStateOf("") | ||
| private set | ||
| var label: String by mutableStateOf("") | ||
| private set | ||
| override var visible: Boolean by mutableStateOf(false) | ||
| private set | ||
|
|
||
| override fun applyProps(props: JsonObject) { | ||
| with(props) { | ||
| value = getString("value") | ||
| label = getString("label") | ||
| visible = optBoolean("visible", true) | ||
| } | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
...om/pega/constellation/sdk/kmp/samples/androidcmpapp/test/cases/DataRefSemanticLinkTest.kt
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,41 @@ | ||
| package com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.cases | ||
|
|
||
| import androidx.compose.ui.test.ExperimentalTestApi | ||
| import androidx.compose.ui.test.onNodeWithText | ||
| import androidx.compose.ui.test.performClick | ||
| import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.ComposeTest | ||
| import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.runAndroidTest | ||
| import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.waitForNode | ||
| import com.pega.constellation.sdk.kmp.samples.androidcmpapp.test.waitForNodes | ||
| import com.pega.constellation.sdk.kmp.test.mock.PegaVersion | ||
| import kotlin.test.Test | ||
|
|
||
| @OptIn(ExperimentalTestApi::class) | ||
| class DataRefSemanticLinkTest : ComposeTest(PegaVersion.v25_1) { | ||
|
|
||
| @Test | ||
| fun test_data_reference_form_and_semantic_link() = runAndroidTest { | ||
| setupApp("OI1OYV-Marco2-Work-DataReferenceTest-FieldOnly") | ||
|
|
||
| // create case | ||
| onNodeWithText("New Service").performClick() | ||
|
|
||
| // Step 1: verify DataReference form with Dropdown appears | ||
| waitForNode("DataReferenceSingleCars") | ||
|
|
||
| // Select "Focus" from the dropdown | ||
| onNodeWithText("DataReferenceSingleCars").performClick() | ||
| waitForNode("Focus") | ||
| onNodeWithText("Focus").performClick() | ||
|
|
||
| // Verify refresh populated the subview with Brand and Model | ||
| waitForNodes("Focus", 2) | ||
| waitForNode("Ford") | ||
|
|
||
| // Submit step 1 → step 2 loads with SemanticLink | ||
| onNodeWithText("Next").performClick() | ||
|
|
||
| // Step 2: verify SemanticLink renders the selected car model | ||
| waitForNode("Focus") | ||
| } | ||
| } |
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
47 changes: 47 additions & 0 deletions
47
scripts/dxcomponents/components/fields/semantic-link.component.js
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,47 @@ | ||
| import { BaseComponent } from "../base.component.js"; | ||
|
|
||
| export class SemanticLinkComponent extends BaseComponent { | ||
| jsComponentPConnectData = {}; | ||
|
|
||
| props = { | ||
| value: "", | ||
| label: "", | ||
| visible: true, | ||
| }; | ||
|
|
||
| init() { | ||
| this.jsComponentPConnectData = this.jsComponentPConnect.registerAndSubscribeComponent( | ||
| this, | ||
| this.checkAndUpdate | ||
| ); | ||
| this.componentsManager.onComponentAdded(this); | ||
| this.checkAndUpdate(); | ||
| } | ||
|
|
||
| destroy() { | ||
| super.destroy(); | ||
| this.jsComponentPConnectData.unsubscribeFn?.(); | ||
| this.componentsManager.onComponentRemoved(this); | ||
| } | ||
|
|
||
| update(pConn) { | ||
| if (this.pConn !== pConn) { | ||
| this.pConn = pConn; | ||
| this.checkAndUpdate(); | ||
| } | ||
| } | ||
|
|
||
| checkAndUpdate() { | ||
| if (this.jsComponentPConnect.shouldComponentUpdate(this)) { | ||
| this.#updateSelf(); | ||
| } | ||
| } | ||
|
|
||
| #updateSelf() { | ||
| const configProps = this.pConn.resolveConfigProps(this.pConn.getConfigProps()); | ||
| this.props.label = configProps.label ?? ""; | ||
| this.props.value = configProps.text ?? configProps.value ?? ""; | ||
| this.props.visible = this.utils.getBooleanValue(configProps.visibility ?? this.props.visible); | ||
| this.componentsManager.onComponentPropsUpdate(this); | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it is worth to add some comment that we want to skip manual refreshCaseView for picklist-based children (Dropdown, AutoComplete, Checkbox).