diff --git a/packages/builder/src/builderStore/api.js b/packages/builder/src/builderStore/api.js index 116222409f..a33a695028 100644 --- a/packages/builder/src/builderStore/api.js +++ b/packages/builder/src/builderStore/api.js @@ -1,7 +1,8 @@ -const apiCall = method => async (url, body) => { - const headers = { - "Content-Type": "application/json", - } +const apiCall = method => async ( + url, + body, + headers = { "Content-Type": "application/json" } +) => { const response = await fetch(url, { method: method, body: body && JSON.stringify(body), diff --git a/packages/builder/src/builderStore/buildStateOrigins.js b/packages/builder/src/builderStore/buildStateOrigins.js deleted file mode 100644 index d368b3656e..0000000000 --- a/packages/builder/src/builderStore/buildStateOrigins.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * buildStateOrigins - * - * Builds an object that details all the bound state in the application, and what updates it. - * - * @param screenDefinition - the screen definition metadata. - * @returns {Object} an object with the client state values and how they are managed. - */ -export const buildStateOrigins = screenDefinition => { - const origins = {} - - function traverse(propValue) { - for (let key in propValue) { - if (!Array.isArray(propValue[key])) continue - - if (key === "_children") propValue[key].forEach(traverse) - - for (let element of propValue[key]) { - if (element["##eventHandlerType"] === "Set State") - origins[element.parameters.path] = element - } - } - } - - traverse(screenDefinition.props) - - return origins -} diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index fec21a467e..3835f44d64 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -28,6 +28,11 @@ export const getBackendUiStore = () => { }, }, records: { + save: () => + store.update(state => { + state.selectedView = state.selectedView + return state + }), delete: () => store.update(state => { state.selectedView = state.selectedView diff --git a/packages/builder/src/components/common/Dropzone.svelte b/packages/builder/src/components/common/Dropzone.svelte new file mode 100644 index 0000000000..a356ff811f --- /dev/null +++ b/packages/builder/src/components/common/Dropzone.svelte @@ -0,0 +1,299 @@ + + +
+ + + + +
+ + diff --git a/packages/builder/src/components/common/Spinner.svelte b/packages/builder/src/components/common/Spinner.svelte index a9c947915c..c719724fd8 100644 --- a/packages/builder/src/components/common/Spinner.svelte +++ b/packages/builder/src/components/common/Spinner.svelte @@ -1,5 +1,7 @@ - + diff --git a/packages/builder/src/components/database/DataTable/AttachmentList.svelte b/packages/builder/src/components/database/DataTable/AttachmentList.svelte new file mode 100644 index 0000000000..f9301823f6 --- /dev/null +++ b/packages/builder/src/components/database/DataTable/AttachmentList.svelte @@ -0,0 +1,64 @@ + + +
+ {#each files as file} +
+ {#if FILE_TYPES.IMAGE.includes(file.extension.toLowerCase())} + + {:else} + + .{file.extension} + {file.name} + {/if} +
+ {/each} +
+ + diff --git a/packages/builder/src/components/database/DataTable/ModelDataTable.svelte b/packages/builder/src/components/database/DataTable/ModelDataTable.svelte index 0804b5e8da..20f7a61c6b 100644 --- a/packages/builder/src/components/database/DataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/DataTable/ModelDataTable.svelte @@ -6,6 +6,7 @@ import { Button, Icon } from "@budibase/bbui" import ActionButton from "components/common/ActionButton.svelte" import LinkedRecord from "./LinkedRecord.svelte" + import AttachmentList from "./AttachmentList.svelte" import TablePagination from "./TablePagination.svelte" import { DeleteRecordModal, CreateEditRecordModal } from "./modals" import RowPopover from "./popovers/Row.svelte" @@ -90,6 +91,8 @@ {#if schema[header].type === 'link'} + {:else if schema[header].type === 'attachment'} + {:else}{getOr('', header, row)}{/if} {/each} @@ -108,6 +111,7 @@ section { margin-bottom: 20px; } + .title { font-size: 24px; font-weight: 600; diff --git a/packages/builder/src/components/database/DataTable/Table.svelte b/packages/builder/src/components/database/DataTable/Table.svelte index d3fdc63046..4d6563d8bd 100644 --- a/packages/builder/src/components/database/DataTable/Table.svelte +++ b/packages/builder/src/components/database/DataTable/Table.svelte @@ -6,7 +6,7 @@ import api from "builderStore/api" import { Button, Icon } from "@budibase/bbui" import ActionButton from "components/common/ActionButton.svelte" - import LinkedRecord from "./LinkedRecord.svelte" + import AttachmentList from "./AttachmentList.svelte" import TablePagination from "./TablePagination.svelte" import { DeleteRecordModal, CreateEditRecordModal } from "./modals" import RowPopover from "./popovers/Row.svelte" @@ -59,7 +59,11 @@ {#each paginatedData as row} {#each columns as header} - {getOr('', header, row)} + + {#if schema[header].type === 'attachment'} + + {:else}{getOr('', header, row)}{/if} + {/each} {/each} diff --git a/packages/builder/src/components/database/DataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/DataTable/modals/CreateEditRecord.svelte index 32df16ed7f..8edecd913c 100644 --- a/packages/builder/src/components/database/DataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/DataTable/modals/CreateEditRecord.svelte @@ -1,5 +1,5 @@ diff --git a/packages/builder/src/components/database/DataTable/modals/RecordFieldControl.svelte b/packages/builder/src/components/database/DataTable/modals/RecordFieldControl.svelte index ed56618e3e..991a5fea63 100644 --- a/packages/builder/src/components/database/DataTable/modals/RecordFieldControl.svelte +++ b/packages/builder/src/components/database/DataTable/modals/RecordFieldControl.svelte @@ -1,9 +1,10 @@