From d85c04acbfabeb04320a4ac7b1b7efb865f453d1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 24 Mar 2020 11:35:46 +0000 Subject: [PATCH 1/3] reactive model data table --- packages/builder/rollup.config.js | 4 +- packages/builder/src/PackageRoot.svelte | 2 +- .../builder/src/builderStore/store/backend.js | 7 +- .../ModelDataTable/ModelDataTable.svelte | 66 +++++++++++-------- .../ModelDataTable/modals/CreateUser.svelte | 6 +- 5 files changed, 52 insertions(+), 33 deletions(-) diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 2ec676b0e8..2ebde91183 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -105,7 +105,9 @@ const lodash_fp_exports = [ "toPairs", "remove", "findIndex", - "compose" + "compose", + "get", + "tap" ] const lodash_exports = [ diff --git a/packages/builder/src/PackageRoot.svelte b/packages/builder/src/PackageRoot.svelte index fcdc2d5c71..ab07f2bac1 100644 --- a/packages/builder/src/PackageRoot.svelte +++ b/packages/builder/src/PackageRoot.svelte @@ -4,7 +4,7 @@ import UserInterfaceRoot from "./userInterface/UserInterfaceRoot.svelte" import BackendRoot from "./BackendRoot.svelte" import { fade } from "svelte/transition" - import { SettingsIcon, PreviewIcon, HelpIcon } from "./common/Icons/" + import { SettingsIcon, PreviewIcon } from "./common/Icons/" const TABS = { BACKEND: "backend", diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 1fff326d46..5fa14b5c5f 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -23,7 +23,6 @@ export const getBackendUiStore = () => { name: "" }, breadcrumbs: [], - selectedRecord: {}, selectedDatabase: {}, selectedModel: {}, } @@ -49,6 +48,12 @@ export const getBackendUiStore = () => { return state }), }, + views: { + select: view => store.update(state => { + state.selectedView = { ...state.selectedView, ...view } + return state + }) + }, modals: { show: modal => store.update(state => ({ ...state, visibleModal: modal })), hide: () => store.update(state => ({ ...state, visibleModal: null })) diff --git a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte index 126b4f6cce..4a59d11298 100644 --- a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte @@ -1,7 +1,7 @@
-

- {last($backendUiStore.breadcrumbs)} -

+

{last($backendUiStore.breadcrumbs)}

+
+ + + + + +
Cancel - - Save - + Save
-
+