From 6999758105a8587f703619badeef1914085ce369 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 24 Apr 2024 10:28:33 +0200 Subject: [PATCH] Display single user form --- packages/client/manifest.json | 108 ++++++++++++++++++ .../app/blocks/FormBlockComponent.svelte | 1 + .../app/forms/BBReferenceField.svelte | 5 +- .../app/forms/BBReferenceSingleField.svelte | 6 + .../app/forms/RelationshipField.svelte | 10 +- .../client/src/components/app/forms/index.js | 1 + 6 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 packages/client/src/components/app/forms/BBReferenceSingleField.svelte diff --git a/packages/client/manifest.json b/packages/client/manifest.json index bf73286933..f970e9f7c1 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -7123,5 +7123,113 @@ ] } ] + }, + "bbreferencesinglefield": { + "devComment": "As bb reference is only used for user subtype for now, we are using user for icon and labels", + "name": "User Field", + "icon": "User", + "styles": ["size"], + "requiredAncestors": ["form"], + "editable": true, + "size": { + "width": 400, + "height": 50 + }, + "settings": [ + { + "type": "field/bb_reference_single", + "label": "Field", + "key": "field", + "required": true + }, + { + "type": "text", + "label": "Label", + "key": "label" + }, + { + "type": "text", + "label": "Placeholder", + "key": "placeholder" + }, + { + "type": "text", + "label": "Default value", + "key": "defaultValue" + }, + { + "type": "text", + "label": "Help text", + "key": "helpText" + }, + { + "type": "event", + "label": "On change", + "key": "onChange", + "context": [ + { + "label": "Field Value", + "key": "value" + } + ] + }, + { + "type": "validation/link", + "label": "Validation", + "key": "validation" + }, + { + "type": "boolean", + "label": "Search", + "key": "autocomplete", + "defaultValue": true + }, + { + "type": "boolean", + "label": "Disabled", + "key": "disabled", + "defaultValue": false + }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, + { + "type": "select", + "label": "Layout", + "key": "span", + "defaultValue": 6, + "hidden": true, + "showInBar": true, + "barStyle": "buttons", + "options": [ + { + "label": "1 column", + "value": 6, + "barIcon": "Stop", + "barTitle": "1 column" + }, + { + "label": "2 columns", + "value": 3, + "barIcon": "ColumnTwoA", + "barTitle": "2 columns" + }, + { + "label": "3 columns", + "value": 2, + "barIcon": "ViewColumn", + "barTitle": "3 columns" + } + ] + } + ] } } diff --git a/packages/client/src/components/app/blocks/FormBlockComponent.svelte b/packages/client/src/components/app/blocks/FormBlockComponent.svelte index 968ed36b8b..31610f79ac 100644 --- a/packages/client/src/components/app/blocks/FormBlockComponent.svelte +++ b/packages/client/src/components/app/blocks/FormBlockComponent.svelte @@ -21,6 +21,7 @@ [FieldType.JSON]: "jsonfield", [FieldType.BARCODEQR]: "codescanner", [FieldType.BB_REFERENCE]: "bbreferencefield", + [FieldType.BB_REFERENCE_SINGLE]: "bbreferencesinglefield", } const getFieldSchema = field => { diff --git a/packages/client/src/components/app/forms/BBReferenceField.svelte b/packages/client/src/components/app/forms/BBReferenceField.svelte index 5f00c503c2..c266268275 100644 --- a/packages/client/src/components/app/forms/BBReferenceField.svelte +++ b/packages/client/src/components/app/forms/BBReferenceField.svelte @@ -1,8 +1,10 @@ + + diff --git a/packages/client/src/components/app/forms/RelationshipField.svelte b/packages/client/src/components/app/forms/RelationshipField.svelte index 1fbd0df522..39109f368a 100644 --- a/packages/client/src/components/app/forms/RelationshipField.svelte +++ b/packages/client/src/components/app/forms/RelationshipField.svelte @@ -1,9 +1,9 @@