- {#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/client/manifest.json b/packages/client/manifest.json
index ec1dcadc86..015d32ce2d 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -4738,7 +4738,7 @@
]
},
{
- "label": "Fields",
+ "label": "",
"type": "fieldConfiguration",
"key": "sidePanelFields",
"nested": true,
@@ -4748,17 +4748,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",
@@ -4769,7 +4759,7 @@
}
},
{
- "label": "Delete label",
+ "label": "Delete button",
"type": "text",
"key": "sidePanelDeleteLabel",
"defaultValue": "Delete",
@@ -5285,17 +5275,6 @@
"label": "Data",
"key": "dataSource"
},
- {
- "type": "text",
- "label": "Row ID",
- "key": "rowId",
- "nested": true,
- "dependsOn": {
- "setting": "actionType",
- "value": "Create",
- "invert": true
- }
- },
{
"type": "text",
"label": "Title",
@@ -5303,116 +5282,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"
}
},
{
@@ -5430,7 +5348,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 a72a0f812b..190f005a36 100644
--- a/packages/client/src/components/app/blocks/TableBlock.svelte
+++ b/packages/client/src/components/app/blocks/TableBlock.svelte
@@ -45,6 +45,8 @@
let enrichedSearchColumns
let schemaLoaded = false
+ // Accommodate old config to ensure delete button does not reappear
+ $: deleteLabel = sidePanelShowDelete === false ? "" : sidePanelDeleteLabel
$: isDSPlus = dataSource?.type === "table" || dataSource?.type === "viewV2"
$: fetchSchema(dataSource)
$: enrichSearchColumns(searchColumns, schema).then(
@@ -246,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 741015b5be..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
@@ -81,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 f223ad8f37..bca6c21cdb 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}