diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index ff52882188..f35a0422b0 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -326,6 +326,12 @@ export default { key: "datasource", control: ModelViewSelect, }, + { + label: "Editable", + key: "editable", + valueKey: "checked", + control: Checkbox, + }, ], }, children: [], diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.json b/packages/builder/src/components/userInterface/temporaryPanelStructure.json deleted file mode 100644 index fe166e2470..0000000000 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "categories": [ - { - "name": "Basic", - "components": [ - { - "component": "Container", - "description": "This component contains things within itself", - "icon": "ri-layout-row-fill", - "commonProps": {}, - "type": [] - }, - { - "component": "Text", - "description": "This is a simple text component", - "icon": "ri-t-box-fill", - "commonProps": { - }, - "type": [ - { - "_component": "@budibase/standard-components/header", - "name": "Headline", - "icon": "headline", - "props": { - "type": { - "type": "options", - "options": [ - "h1", - "h2" - ], - "default": "h1" - } - } - }, - { - "_component": "@budibase/standard-components/text", - "name": "Paragraph", - "icon": "paragraph", - "props": { - } - } - ] - }, - { - "component": "Button", - "description": "A basic html button that is ready for styling", - "icon": "ri-radio-button-fill", - "commonProps": {}, - "type": [] - }, - { - "component": "Icon", - "description": "A basic component for displaying icons", - "icon": "ri-sun-fill", - "commonProps": {}, - "type": [] - }, - { - "component": "Avatar", - "description": "A basic component for rendering an avatar", - "icon": "ri-user-smile-fill", - "commonProps": {}, - "type": [] - }, - { - "component": "Link", - "description": "A basic link component for internal and external links", - "icon": "ri-link", - "commonProps": {}, - "type": [] - } - ] - } - ] -} \ No newline at end of file diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index a78fd5ec5e..12ce6aeae4 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -225,7 +225,8 @@ "description": "a datagrid component with functionality to add, remove and edit rows.", "data": true, "props": { - "datasource": "models" + "datasource": "models", + "editable": "bool" } }, "dataform": { diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/DataGrid/Component.svelte index 83ed9c0ef2..280f62a066 100644 --- a/packages/standard-components/src/DataGrid/Component.svelte +++ b/packages/standard-components/src/DataGrid/Component.svelte @@ -16,12 +16,22 @@ export let _bb export let datasource = {} + export let editable let dataLoaded = false let data let columnDefs let selectedRows = [] let model + let options = { + defaultColDef: { + flex: 1, + minWidth: 150, + filter: true, + }, + rowSelection: editable ? "multiple" : "single", + suppressRowClickSelection: !editable, + } onMount(async () => { if (datasource.modelId) { @@ -39,11 +49,13 @@ field: key, hide: shouldHideField(key), sortable: true, - editable: isEditable(schema[key].type), - cellRenderer: getRenderer( - schema[key].type, // type - schema[key].constraints // options - ), + editable: editable && isEditable(schema[key].type), + cellRenderer: + editable && + getRenderer( + schema[key].type, // type + schema[key].constraints // options + ), autoHeight: true, } }) @@ -97,16 +109,19 @@