From 4549e8e5b27bcd478504d43222f3ea6d5d34d7ae Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Sun, 25 Oct 2020 17:05:11 +0000 Subject: [PATCH] reinstating relationships --- .vscode/settings.json | 2 +- .../components/backend/DataTable/Table.svelte | 25 +++---- .../DataTable/cells/BooleanCell.svelte | 0 .../DataTable/cells/RelationshipCell.svelte | 74 +++---------------- .../backend/DataTable/cells/cellRenderers.js | 32 +------- 5 files changed, 26 insertions(+), 107 deletions(-) delete mode 100644 packages/builder/src/components/backend/DataTable/cells/BooleanCell.svelte diff --git a/.vscode/settings.json b/.vscode/settings.json index 53fbb0d221..ebd97e844f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,7 +5,7 @@ "source.fixAll": true }, "[svelte]": { - "editor.defaultFormatter": "JamesBirtles.svelte-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.defaultFormatter": "esbenp.prettier-vscode" } diff --git a/packages/builder/src/components/backend/DataTable/Table.svelte b/packages/builder/src/components/backend/DataTable/Table.svelte index 0f4eddb3f3..fd3d11598a 100644 --- a/packages/builder/src/components/backend/DataTable/Table.svelte +++ b/packages/builder/src/components/backend/DataTable/Table.svelte @@ -1,5 +1,6 @@
diff --git a/packages/builder/src/components/backend/DataTable/cells/BooleanCell.svelte b/packages/builder/src/components/backend/DataTable/cells/BooleanCell.svelte deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/builder/src/components/backend/DataTable/cells/RelationshipCell.svelte b/packages/builder/src/components/backend/DataTable/cells/RelationshipCell.svelte index 578630248e..f5d0baa87f 100644 --- a/packages/builder/src/components/backend/DataTable/cells/RelationshipCell.svelte +++ b/packages/builder/src/components/backend/DataTable/cells/RelationshipCell.svelte @@ -1,80 +1,28 @@ -
- {#if linkedRows && linkedRows.length && displayColumn} - {#each linkedRows as linkedRow} - {#if linkedRow[displayColumn] != null && linkedRow[displayColumn] !== ''} -
{linkedRow[displayColumn]}
- {/if} - {/each} - {:else}{count} related row(s){/if} +
selectRelationship(row, columnName)}> + {count} + related row(s)
diff --git a/packages/builder/src/components/backend/DataTable/cells/cellRenderers.js b/packages/builder/src/components/backend/DataTable/cells/cellRenderers.js index 2c1463b6d1..463123d577 100644 --- a/packages/builder/src/components/backend/DataTable/cells/cellRenderers.js +++ b/packages/builder/src/components/backend/DataTable/cells/cellRenderers.js @@ -6,7 +6,6 @@ import RelationshipDisplay from "./RelationshipCell.svelte" const renderers = { attachment: attachmentRenderer, link: linkedRowRenderer, - boolean: booleanRenderer, } export function getRenderer(schema, editable) { @@ -30,33 +29,6 @@ export function editRowRenderer(params) { return container } -/* eslint-disable no-unused-vars */ -function booleanRenderer(options, constraints) { - return params => { - let container = document.createElement("input") - - // TODO: implement - - return container - - // const toggle = e => { - // params.value = !params.value - // params.setValue(e.currentTarget.checked) - // } - // let input = document.createElement("input") - // input.style.display = "grid" - // input.style.placeItems = "center" - // input.style.height = "100%" - // input.type = "checkbox" - // input.checked = params.value - // if (editable) { - // input.addEventListener("click", toggle) - // } else { - // input.disabled = true - // } - // return input - } -} /* eslint-disable no-unused-vars */ function attachmentRenderer(options, constraints, editable) { @@ -82,11 +54,10 @@ function attachmentRenderer(options, constraints, editable) { } /* eslint-disable no-unused-vars */ -function linkedRowRenderer(options, constraints, editable) { +function linkedRowRenderer() { return params => { let container = document.createElement("div") container.style.display = "grid" - container.style.placeItems = "center" container.style.height = "100%" new RelationshipDisplay({ @@ -94,6 +65,7 @@ function linkedRowRenderer(options, constraints, editable) { props: { row: params.data, columnName: params.column.colId, + selectRelationship: params.selectRelationship }, })