{#each helpers.filter(helper => helper.label.match(searchRgx) || helper.description.match(searchRgx)) as helper}
-
@@ -122,7 +121,7 @@
font-family: var(--font-sans);
}
.text :global(textarea) {
- min-height: 100px;
+ min-height: 150px !important;
}
.text :global(p) {
margin: 0;
@@ -130,8 +129,12 @@
.binding {
font-size: 12px;
- padding: var(--spacing-s);
- border-radius: var(--border-radius-m);
+ border: var(--border-light);
+ border-width: 1px 0 0 0;
+ padding: var(--spacing-m) 0;
+ margin: auto 0;
+ align-items: center;
+ cursor: pointer;
}
.binding:hover {
background-color: var(--grey-2);
diff --git a/packages/builder/src/components/common/bindings/utils.js b/packages/builder/src/components/common/bindings/utils.js
new file mode 100644
index 0000000000..79c496ce9f
--- /dev/null
+++ b/packages/builder/src/components/common/bindings/utils.js
@@ -0,0 +1,16 @@
+export function addToText(value, caretPos, binding) {
+ binding = typeof binding === "string" ? binding : binding.path
+ value = value == null ? "" : value
+ if (!value.includes("{{") && !value.includes("}}")) {
+ binding = `{{ ${binding} }}`
+ }
+ if (caretPos.start) {
+ value =
+ value.substring(0, caretPos.start) +
+ binding +
+ value.substring(caretPos.end, value.length)
+ } else {
+ value += binding
+ }
+ return value
+}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte
index 06e78da65f..5092ca0773 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte
@@ -3,7 +3,7 @@
import { store, currentAsset } from "builderStore"
import { tables } from "stores/backend"
import { getBindableProperties } from "builderStore/dataBinding"
- import DrawerBindableInput from "components/common/DrawerBindableInput.svelte"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let parameters
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte
index c419934fe3..d64fd1e654 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/LogIn.svelte
@@ -2,7 +2,7 @@
import { Label } from "@budibase/bbui"
import { getBindableProperties } from "builderStore/dataBinding"
import { currentAsset, store } from "builderStore"
- import DrawerBindableInput from "components/common/DrawerBindableInput.svelte"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let parameters
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte
index 14aa96e072..2b24e2fd74 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte
@@ -2,7 +2,7 @@
import { Label } from "@budibase/bbui"
import { getBindableProperties } from "builderStore/dataBinding"
import { currentAsset, store } from "builderStore"
- import DrawerBindableInput from "components/common/DrawerBindableInput.svelte"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let parameters
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte
index ef153ed78e..f6bd54ffb6 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte
@@ -3,7 +3,7 @@
import { store, currentAsset } from "builderStore"
import { getBindableProperties } from "builderStore/dataBinding"
import { createEventDispatcher } from "svelte"
- import DrawerBindableInput from "components/common/DrawerBindableInput.svelte"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
const dispatch = createEventDispatcher()
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte
index b85341bf6f..a993400c32 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/PropertyControl.svelte
@@ -6,7 +6,7 @@
readableToRuntimeBinding,
runtimeToReadableBinding,
} from "builderStore/dataBinding"
- import BindingPanel from "components/design/PropertiesPanel/BindingPanel.svelte"
+ import BindingPanel from "components/common/bindings/BindingPanel.svelte"
import { capitalise } from "../../../../helpers"
export let label = ""
diff --git a/packages/builder/src/components/integration/QueryParameterBuilder.svelte b/packages/builder/src/components/integration/QueryParameterBuilder.svelte
index 4563515ea0..618cb2b442 100644
--- a/packages/builder/src/components/integration/QueryParameterBuilder.svelte
+++ b/packages/builder/src/components/integration/QueryParameterBuilder.svelte
@@ -4,7 +4,7 @@
readableToRuntimeBinding,
runtimeToReadableBinding,
} from "builderStore/dataBinding"
- import DrawerBindableInput from "components/common/DrawerBindableInput.svelte"
+ import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let bindable = true
export let parameters = []
diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js
index f7bb77db3b..de49883cf1 100644
--- a/packages/builder/src/constants/backend/index.js
+++ b/packages/builder/src/constants/backend/index.js
@@ -80,6 +80,15 @@ export const FIELDS = {
presence: false,
},
},
+ FORMULA: {
+ name: "Formula",
+ icon: "ri-braces-line",
+ type: "formula",
+ constraints: {
+ type: "string",
+ presence: false,
+ },
+ },
}
export const AUTO_COLUMN_SUB_TYPES = {
diff --git a/packages/server/src/api/controllers/user.js b/packages/server/src/api/controllers/user.js
index b0f7761602..3b6373146e 100644
--- a/packages/server/src/api/controllers/user.js
+++ b/packages/server/src/api/controllers/user.js
@@ -88,6 +88,7 @@ exports.updateMetadata = async function (ctx) {
})
const metadata = {
...globalUser,
+ tableId: InternalTables.USER_METADATA,
_id: user._id || generateUserMetadataID(globalUser._id),
_rev: user._rev,
}
diff --git a/packages/server/src/constants/index.js b/packages/server/src/constants/index.js
index 9853676aa6..f9a72ec479 100644
--- a/packages/server/src/constants/index.js
+++ b/packages/server/src/constants/index.js
@@ -13,6 +13,7 @@ exports.FieldTypes = {
DATETIME: "datetime",
ATTACHMENT: "attachment",
LINK: "link",
+ FORMULA: "formula",
AUTO: "auto",
}
diff --git a/packages/server/src/db/linkedRows/index.js b/packages/server/src/db/linkedRows/index.js
index 386741e42a..5af10e41d7 100644
--- a/packages/server/src/db/linkedRows/index.js
+++ b/packages/server/src/db/linkedRows/index.js
@@ -10,6 +10,7 @@ const {
} = require("./linkUtils")
const { flatten } = require("lodash")
const CouchDB = require("../../db")
+const { FieldTypes } = require("../../constants")
const { getMultiIDParams } = require("../../db/utils")
/**
@@ -141,14 +142,14 @@ exports.attachLinkIDs = async (appId, rows) => {
}
/**
- * Given information about the table we can extract the display name from the linked rows, this
- * is what we do for showing the display name of each linked row when in a table format.
+ * Given a table and a list of rows this will retrieve all of the attached docs and enrich them into the row.
+ * This is required for formula fields, this may only be utilised internally (for now).
* @param {string} appId The app in which the tables/rows/links exist.
* @param {object} table The table from which the rows originated.
- * @param {array