- {#if idx === 0 && !componentInstance._component.endsWith("/layout") && !isScreen}
+ {#if idx === 0 && !componentInstance._component.endsWith("/layout") && !isScreen && showInstanceName}
{/if}
{/each}
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/InfoDisplay.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/InfoDisplay.svelte
new file mode 100644
index 0000000000..03bf771beb
--- /dev/null
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/InfoDisplay.svelte
@@ -0,0 +1,66 @@
+
+
+
+ {#if title}
+
+
+ {title || ""}
+
+
+ {@html body}
+ {:else}
+
+
+
+
+ {@html body}
+ {/if}
+
+
+
diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts
index 6fa5822986..62ce0dc4d9 100644
--- a/packages/cli/src/constants.ts
+++ b/packages/cli/src/constants.ts
@@ -1,4 +1,4 @@
export { CommandWord, InitType, AnalyticsEvent } from "@budibase/types"
-export const POSTHOG_TOKEN = "phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS"
+export const POSTHOG_TOKEN = "phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU"
export const GENERATED_USER_EMAIL = "admin@admin.com"
diff --git a/packages/client/manifest.json b/packages/client/manifest.json
index 4c3b432de0..9194ac0838 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -4737,7 +4737,7 @@
]
},
{
- "label": "Fields",
+ "label": "",
"type": "fieldConfiguration",
"key": "sidePanelFields",
"nested": true,
@@ -4747,17 +4747,7 @@
}
},
{
- "label": "Show delete",
- "type": "boolean",
- "key": "sidePanelShowDelete",
- "nested": true,
- "dependsOn": {
- "setting": "clickBehaviour",
- "value": "details"
- }
- },
- {
- "label": "Save label",
+ "label": "Save button",
"type": "text",
"key": "sidePanelSaveLabel",
"defaultValue": "Save",
@@ -4768,7 +4758,7 @@
}
},
{
- "label": "Delete label",
+ "label": "Delete button",
"type": "text",
"key": "sidePanelDeleteLabel",
"defaultValue": "Delete",
@@ -5284,17 +5274,6 @@
"label": "Table",
"key": "dataSource"
},
- {
- "type": "text",
- "label": "Row ID",
- "key": "rowId",
- "nested": true,
- "dependsOn": {
- "setting": "actionType",
- "value": "Create",
- "invert": true
- }
- },
{
"type": "text",
"label": "Title",
@@ -5302,116 +5281,55 @@
"nested": true
},
{
- "type": "select",
- "label": "Size",
- "key": "size",
- "options": [
- {
- "label": "Medium",
- "value": "spectrum--medium"
- },
- {
- "label": "Large",
- "value": "spectrum--large"
- }
- ],
- "defaultValue": "spectrum--medium"
- },
- {
- "type": "text",
- "label": "Empty text",
- "key": "noRowsMessage",
- "defaultValue": "We couldn't find a row to display",
+ "section": true,
"dependsOn": {
"setting": "actionType",
"value": "Create",
"invert": true
- }
- },
- {
- "section": true,
- "name": "Fields",
+ },
+ "name": "Row details",
+ "info": "
How to pass a row ID using bindings",
"settings": [
{
- "type": "fieldConfiguration",
- "label": "Fields",
- "key": "fields",
- "selectAllFields": true
+ "type": "text",
+ "label": "Row ID",
+ "key": "rowId",
+ "nested": true
},
{
- "type": "select",
- "label": "Field labels",
- "key": "labelPosition",
- "defaultValue": "left",
- "options": [
- {
- "label": "Left",
- "value": "left"
- },
- {
- "label": "Above",
- "value": "above"
- }
- ]
- },
- {
- "type": "boolean",
- "label": "Disabled",
- "key": "disabled",
- "defaultValue": false,
- "dependsOn": {
- "setting": "actionType",
- "value": "View",
- "invert": true
- }
+ "type": "text",
+ "label": "Empty text",
+ "key": "noRowsMessage",
+ "defaultValue": "We couldn't find a row to display",
+ "nested": true
}
]
},
{
"section": true,
"name": "Buttons",
+ "dependsOn": {
+ "setting": "actionType",
+ "value": "View",
+ "invert": true
+ },
"settings": [
- {
- "type": "boolean",
- "label": "Show save button",
- "key": "showSaveButton",
- "defaultValue": true,
- "dependsOn": {
- "setting": "actionType",
- "value": "View",
- "invert": true
- }
- },
{
"type": "text",
"key": "saveButtonLabel",
- "label": "Save button label",
+ "label": "Save button",
"nested": true,
- "defaultValue": "Save",
- "dependsOn": {
- "setting": "showSaveButton",
- "value": true
- }
- },
- {
- "type": "boolean",
- "label": "Allow delete",
- "key": "showDeleteButton",
- "defaultValue": false,
- "dependsOn": {
- "setting": "actionType",
- "value": "Update"
- }
+ "defaultValue": "Save"
},
{
"type": "text",
"key": "deleteButtonLabel",
- "label": "Delete button label",
+ "label": "Delete button",
"nested": true,
"defaultValue": "Delete",
"dependsOn": {
- "setting": "showDeleteButton",
- "value": true
+ "setting": "actionType",
+ "value": "Update"
}
},
{
@@ -5429,7 +5347,67 @@
"type": "boolean",
"label": "Hide notifications",
"key": "notificationOverride",
- "defaultValue": false
+ "defaultValue": false,
+ "dependsOn": {
+ "setting": "actionType",
+ "value": "View",
+ "invert": true
+ }
+ }
+ ]
+ },
+ {
+ "section": true,
+ "name": "Fields",
+ "settings": [
+ {
+ "type": "select",
+ "label": "Align labels",
+ "key": "labelPosition",
+ "defaultValue": "left",
+ "options": [
+ {
+ "label": "Left",
+ "value": "left"
+ },
+ {
+ "label": "Above",
+ "value": "above"
+ }
+ ]
+ },
+ {
+ "type": "select",
+ "label": "Size",
+ "key": "size",
+ "options": [
+ {
+ "label": "Medium",
+ "value": "spectrum--medium"
+ },
+ {
+ "label": "Large",
+ "value": "spectrum--large"
+ }
+ ],
+ "defaultValue": "spectrum--medium"
+ },
+ {
+ "type": "fieldConfiguration",
+ "key": "fields",
+ "nested": true,
+ "selectAllFields": true
+ },
+ {
+ "type": "boolean",
+ "label": "Disabled",
+ "key": "disabled",
+ "defaultValue": false,
+ "dependsOn": {
+ "setting": "actionType",
+ "value": "View",
+ "invert": true
+ }
}
]
}
diff --git a/packages/client/src/components/app/blocks/TableBlock.svelte b/packages/client/src/components/app/blocks/TableBlock.svelte
index efc83fd5ac..e07c26544c 100644
--- a/packages/client/src/components/app/blocks/TableBlock.svelte
+++ b/packages/client/src/components/app/blocks/TableBlock.svelte
@@ -45,6 +45,9 @@
let enrichedSearchColumns
let schemaLoaded = false
+ // Accommodate old config to ensure delete button does not reappear
+ $: deleteLabel = sidePanelShowDelete === false ? "" : sidePanelDeleteLabel
+
$: fetchSchema(dataSource)
$: enrichSearchColumns(searchColumns, schema).then(
val => (enrichedSearchColumns = val)
@@ -245,10 +248,8 @@
bind:id={detailsFormBlockId}
props={{
dataSource,
- showSaveButton: true,
- showDeleteButton: sidePanelShowDelete,
- saveButtonLabel: sidePanelSaveLabel,
- deleteButtonLabel: sidePanelDeleteLabel,
+ saveButtonLabel: sidePanelSaveLabel || "Save", //always show
+ deleteButtonLabel: deleteLabel, //respect config
actionType: "Update",
rowId: `{{ ${safe("state")}.${safe(stateKey)} }}`,
fields: sidePanelFields || normalFields,
diff --git a/packages/client/src/components/app/blocks/form/FormBlock.svelte b/packages/client/src/components/app/blocks/form/FormBlock.svelte
index 20faee9013..5d57d10ab6 100644
--- a/packages/client/src/components/app/blocks/form/FormBlock.svelte
+++ b/packages/client/src/components/app/blocks/form/FormBlock.svelte
@@ -12,42 +12,59 @@
export let fields
export let labelPosition
export let title
+ export let showDeleteButton
+ export let showSaveButton
export let saveButtonLabel
export let deleteButtonLabel
- export let showSaveButton
- export let showDeleteButton
export let rowId
export let actionUrl
export let noRowsMessage
export let notificationOverride
+ // Accommodate old config to ensure delete button does not reappear
+ $: deleteLabel = showDeleteButton === false ? "" : deleteButtonLabel?.trim()
+ $: saveLabel = showSaveButton === false ? "" : saveButtonLabel?.trim()
+
const { fetchDatasourceSchema } = getContext("sdk")
const convertOldFieldFormat = fields => {
- if (typeof fields?.[0] === "string") {
- return fields.map(field => ({ name: field, displayName: field }))
+ if (!fields) {
+ return []
}
-
- return fields
+ return fields.map(field => {
+ if (typeof field === "string") {
+ // existed but was a string
+ return {
+ name: field,
+ active: true,
+ }
+ } else {
+ // existed but had no state
+ return {
+ ...field,
+ active: typeof field?.active != "boolean" ? true : field?.active,
+ }
+ }
+ })
}
const getDefaultFields = (fields, schema) => {
- if (schema && (!fields || fields.length === 0)) {
- const defaultFields = []
-
- Object.values(schema).forEach(field => {
- if (field.autocolumn) return
-
- defaultFields.push({
- name: field.name,
- displayName: field.name,
- })
- })
-
- return defaultFields
+ if (!schema) {
+ return []
}
+ let defaultFields = []
- return fields
+ if (!fields || fields.length === 0) {
+ Object.values(schema)
+ .filter(field => !field.autocolumn)
+ .forEach(field => {
+ defaultFields.push({
+ name: field.name,
+ active: true,
+ })
+ })
+ }
+ return [...fields, ...defaultFields].filter(field => field.active)
}
let schema
@@ -56,7 +73,6 @@
$: formattedFields = convertOldFieldFormat(fields)
$: fieldsOrDefault = getDefaultFields(formattedFields, schema)
-
$: fetchSchema(dataSource)
$: dataProvider = `{{ literal ${safe(providerId)} }}`
$: filter = [
@@ -82,15 +98,12 @@
fields: fieldsOrDefault,
labelPosition,
title,
- saveButtonLabel,
- deleteButtonLabel,
- showSaveButton,
- showDeleteButton,
+ saveButtonLabel: saveLabel,
+ deleteButtonLabel: deleteLabel,
schema,
repeaterId,
notificationOverride,
}
-
const fetchSchema = async () => {
schema = (await fetchDatasourceSchema(dataSource)) || {}
}
diff --git a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
index c638d58737..3c194e0f82 100644
--- a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
+++ b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
@@ -13,8 +13,6 @@
export let title
export let saveButtonLabel
export let deleteButtonLabel
- export let showSaveButton
- export let showDeleteButton
export let schema
export let repeaterId
export let notificationOverride
@@ -100,18 +98,33 @@
},
]
- $: renderDeleteButton = showDeleteButton && actionType === "Update"
- $: renderSaveButton = showSaveButton && actionType !== "View"
+ $: renderDeleteButton = deleteButtonLabel && actionType === "Update"
+ $: renderSaveButton = saveButtonLabel && actionType !== "View"
$: renderButtons = renderDeleteButton || renderSaveButton
$: renderHeader = renderButtons || title
const getComponentForField = field => {
- if (!field || !schema?.[field]) {
+ const fieldSchemaName = field.field || field.name
+ if (!fieldSchemaName || !schema?.[fieldSchemaName]) {
return null
}
- const type = schema[field].type
+ const type = schema[fieldSchemaName].type
return FieldTypeToComponentMap[type]
}
+
+ const getPropsForField = field => {
+ let fieldProps = field._component
+ ? {
+ ...field,
+ }
+ : {
+ field: field.name,
+ label: field.name,
+ placeholder: field.name,
+ _instanceName: field.name,
+ }
+ return fieldProps
+ }
{#if fields?.length}
@@ -175,7 +188,7 @@
{#each fields as field, idx}
- {#if getComponentForField(field.name)}
+ {#if getComponentForField(field) && field.active}
{/if}