From ce99054f91aeccf0dbcfdb988fb81a7746fb3e6f Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Wed, 1 Jul 2020 13:19:14 +0100 Subject: [PATCH] Added recordDetail component --- .../userInterface/temporaryPanelStructure.js | 13 ++++- packages/client/src/render/screenRouter.js | 4 +- packages/standard-components/components.json | 17 +++--- .../src/RecordDetail.svelte | 52 +++++++++++++++++++ packages/standard-components/src/index.js | 1 + 5 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 packages/standard-components/src/RecordDetail.svelte diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index ae39ce3ee2..7a8b336563 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -406,7 +406,7 @@ export default { { name: "List", _component: "@budibase/standard-components/list", - description: "Shiny list", + description: "Renders all children once per record, of a given model", icon: "ri-file-list-fill", properties: { design: { ...all }, @@ -414,6 +414,17 @@ export default { }, children: [], }, + { + name: "Record Detail", + _component: "@budibase/standard-components/recorddetail", + description: "Loads a record, using an id from the URL, which can be used with {{ context }}, in children", + icon: "ri-profile-line", + properties: { + design: { ...all }, + settings: [{ label: "Model", key: "model", control: ModelSelect }], + }, + children: [], + }, { name: "Map", _component: "@budibase/standard-components/datamap", diff --git a/packages/client/src/render/screenRouter.js b/packages/client/src/render/screenRouter.js index fb0b005096..4f4256f9fe 100644 --- a/packages/client/src/render/screenRouter.js +++ b/packages/client/src/render/screenRouter.js @@ -56,13 +56,13 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => { const screenIndex = current !== -1 ? current : fallback - onScreenSelected(screens[screenIndex], _url) - try { !url.state && history.pushState(_url, null, _url) } catch (_) { // ignoring an exception here as the builder runs an iframe, which does not like this } + + onScreenSelected(screens[screenIndex], _url) } function click(e) { diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index 8df7756499..2c24c02615 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -235,15 +235,14 @@ "description": "A configurable data list that attaches to your backend models.", "data": true, "props": { - "model": "models", - "layout": { - "type": "options", - "default": "list", - "options": [ - "list", - "grid" - ] - } + "model": "models" + } + }, + "recorddetail": { + "description": "Loads a record, using an ID in the url", + "data": true, + "props": { + "model": "models" } }, "datamap": { diff --git a/packages/standard-components/src/RecordDetail.svelte b/packages/standard-components/src/RecordDetail.svelte new file mode 100644 index 0000000000..1ebd89e6f0 --- /dev/null +++ b/packages/standard-components/src/RecordDetail.svelte @@ -0,0 +1,52 @@ + + +
+
diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index 37d6abab74..a0c6ee025d 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -23,3 +23,4 @@ export { default as list } from "./List.svelte" export { default as datasearch } from "./DataSearch.svelte" export { default as datamap } from "./DataMap.svelte" export { default as embed } from "./Embed.svelte" +export { default as recorddetail } from "./RecordDetail.svelte"