+
+ Configure a condition to be evaluated which can stop further actions from
+ being executed.
+
+
+ (parameters.value = e.detail)}
+ {bindings}
+ />
+
+ (parameters.referenceValue = e.detail)}
+ {bindings}
+ />
+
+
+
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/index.js b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/index.js
index 6593c9cbd4..2306d4a548 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/index.js
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/index.js
@@ -13,3 +13,4 @@ export { default as RefreshDataProvider } from "./RefreshDataProvider.svelte"
export { default as DuplicateRow } from "./DuplicateRow.svelte"
export { default as S3Upload } from "./S3Upload.svelte"
export { default as ExportData } from "./ExportData.svelte"
+export { default as ContinueIf } from "./ContinueIf.svelte"
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/manifest.json b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/manifest.json
index 0f6d3344b2..80464b281f 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/manifest.json
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/manifest.json
@@ -84,6 +84,11 @@
{
"name": "Export Data",
"component": "ExportData"
+ },
+ {
+ "name": "Continue if / Stop if",
+ "component": "ContinueIf",
+ "dependsOnFeature": "continueIfAction"
}
]
-}
\ No newline at end of file
+}
diff --git a/packages/client/manifest.json b/packages/client/manifest.json
index b8fa824762..037ceec996 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -7,7 +7,8 @@
"customThemes": true,
"devicePreview": true,
"messagePassing": true,
- "rowSelection": true
+ "rowSelection": true,
+ "continueIfAction": true
},
"layout": {
"name": "Layout",
diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js
index ff649faf93..cf1082503e 100644
--- a/packages/client/src/utils/buttonActions.js
+++ b/packages/client/src/utils/buttonActions.js
@@ -261,6 +261,26 @@ const exportDataHandler = async action => {
}
}
+const continueIfHandler = action => {
+ const { type, value, operator, referenceValue } = action.parameters
+ if (!type || !operator) {
+ return
+ }
+ let match = false
+ if (value == null && referenceValue == null) {
+ match = true
+ } else if (value === referenceValue) {
+ match = true
+ } else {
+ match = JSON.stringify(value) === JSON.stringify(referenceValue)
+ }
+ if (type === "continue") {
+ return operator === "equal" ? match : !match
+ } else {
+ return operator === "equal" ? !match : match
+ }
+}
+
const handlerMap = {
["Save Row"]: saveRowHandler,
["Duplicate Row"]: duplicateRowHandler,
@@ -277,6 +297,7 @@ const handlerMap = {
["Update State"]: updateStateHandler,
["Upload File to S3"]: s3UploadHandler,
["Export Data"]: exportDataHandler,
+ ["Continue if / Stop if"]: continueIfHandler,
}
const confirmTextMap = {