From fe99647ad109543932312f2c077426f4620fa148 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Jun 2022 10:55:32 +0100 Subject: [PATCH 1/6] Use default value from manifest --- packages/bbui/src/Table/Table.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 863dc84040..e8340263ff 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -28,7 +28,7 @@ export let rowCount = 0 export let quiet = false export let loading = false - export let allowSelectRows = true + export let allowSelectRows export let allowEditRows = true export let allowEditColumns = true export let selectedRows = [] From 08aea99c94640e531cdeba8114c6f4a61430ff12 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Jun 2022 11:24:44 +0100 Subject: [PATCH 2/6] Don't allow row selection for button/link column --- packages/bbui/src/Table/Table.svelte | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index e8340263ff..2a22236474 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -344,11 +344,7 @@ {/if} {#if sortedRows?.length} {#each sortedRows as row, idx} -
dispatch("click", row)} - on:click={() => toggleSelectRow(row)} - > +
{#if showEditColumn}
{ + if (!field.startsWith("custom-")) { + dispatch("click", row) + } + }} + on:click={() => { + if (!field.startsWith("custom-")) { + toggleSelectRow(row) + } + }} > Date: Tue, 7 Jun 2022 11:25:16 +0100 Subject: [PATCH 3/6] yarn lock --- packages/server/yarn.lock | 18 +++++++++--------- packages/worker/yarn.lock | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index c8dad37383..e8e1d3e269 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1014,10 +1014,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.194": - version "1.0.194" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.194.tgz#08b2b1aec3c88efbc7cfb14145ce6f199475c538" - integrity sha512-BbnJFtAioJeD9tQfSwc2uftFK8SagREgSfUYv06dfnf/NsmkrONzZiTon1oA57S7ifcSiu+WZf87lNX0k8pwfQ== +"@budibase/backend-core@1.0.195": + version "1.0.195" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.195.tgz#ee40c690ae4a54febab8b140c9bbb7d04221f3b9" + integrity sha512-6diWgRV9t4DU3kXteJJAhCxyta9m1wvzN7vNbflhY4kYJeg7BC+7jcvc2r8zl6s1vVeSW4ic5/ueSLRaTDySuw== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -1092,12 +1092,12 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.0.194": - version "1.0.194" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.194.tgz#fbf977b292b9a6dbf7b072b2e0379dcf4379943a" - integrity sha512-LSqVwlhKWwFNnC3acvLnCzbeBoze1Ma6GELE/b5ZxS65owsigu0KC6T/UuujEbU9xqbFJ3R6uV+4Fz4NUibLIw== +"@budibase/pro@1.0.195": + version "1.0.195" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.195.tgz#368652398d1da95f160fc0192b77144b11147ff5" + integrity sha512-zf1f1exHop4m6vda5hObUnTZa2PIBRnc4e0r9iqFbzvGBMfBLGUhGzu23JEwNYaS2xhWHj2FNv4/IVzIyLG4eA== dependencies: - "@budibase/backend-core" "1.0.194" + "@budibase/backend-core" "1.0.195" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index a5f5b6b95a..2f3313a1d9 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -293,10 +293,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.194": - version "1.0.194" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.194.tgz#08b2b1aec3c88efbc7cfb14145ce6f199475c538" - integrity sha512-BbnJFtAioJeD9tQfSwc2uftFK8SagREgSfUYv06dfnf/NsmkrONzZiTon1oA57S7ifcSiu+WZf87lNX0k8pwfQ== +"@budibase/backend-core@1.0.195": + version "1.0.195" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.195.tgz#ee40c690ae4a54febab8b140c9bbb7d04221f3b9" + integrity sha512-6diWgRV9t4DU3kXteJJAhCxyta9m1wvzN7vNbflhY4kYJeg7BC+7jcvc2r8zl6s1vVeSW4ic5/ueSLRaTDySuw== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -322,12 +322,12 @@ uuid "^8.3.2" zlib "^1.0.5" -"@budibase/pro@1.0.194": - version "1.0.194" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.194.tgz#fbf977b292b9a6dbf7b072b2e0379dcf4379943a" - integrity sha512-LSqVwlhKWwFNnC3acvLnCzbeBoze1Ma6GELE/b5ZxS65owsigu0KC6T/UuujEbU9xqbFJ3R6uV+4Fz4NUibLIw== +"@budibase/pro@1.0.195": + version "1.0.195" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.195.tgz#368652398d1da95f160fc0192b77144b11147ff5" + integrity sha512-zf1f1exHop4m6vda5hObUnTZa2PIBRnc4e0r9iqFbzvGBMfBLGUhGzu23JEwNYaS2xhWHj2FNv4/IVzIyLG4eA== dependencies: - "@budibase/backend-core" "1.0.194" + "@budibase/backend-core" "1.0.195" node-fetch "^2.6.1" "@cspotcode/source-map-consumer@0.8.0": From 12ced8cba77099b7de0c378febe5b41c75a69e3c Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Jun 2022 14:40:56 +0100 Subject: [PATCH 4/6] Added preventSelectRow prop to custom column --- packages/bbui/src/Table/Table.svelte | 44 +++++++++---------- .../src/components/app/table/Table.svelte | 1 + 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 2a22236474..b41b77353a 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -132,7 +132,7 @@ style += " auto" } fields?.forEach(field => { - const fieldSchema = schema[field] + const fieldSchema = schema[field.name] if (fieldSchema.width) { style += ` ${fieldSchema.width}` } else { @@ -204,7 +204,6 @@ return nameA < nameB ? a : b }) .concat(autoColumns) - .map(column => column.name) } const editColumn = (e, field) => { @@ -300,19 +299,19 @@ {#each fields as field}
sortBy(schema[field])} + on:click={() => sortBy(schema[field.name])} > -
{getDisplayName(schema[field])}
- {#if schema[field]?.autocolumn} +
{getDisplayName(schema[field.name])}
+ {#if schema[field.name]?.autocolumn} {/if} - {#if sortColumn === field} + {#if sortColumn === field.name} {/if} - {#if allowEditColumns && schema[field]?.editable !== false} + {#if allowEditColumns && schema[field.name]?.editable !== false} editColumn(e, field)} + on:click={e => editColumn(e, field.name)} > @@ -343,7 +342,7 @@
{/if} {#if sortedRows?.length} - {#each sortedRows as row, idx} + {#each sortedRows as row}
{#if showEditColumn}
{ - if (!field.startsWith("custom-")) { + if (!field.preventSelectRow) { dispatch("click", row) - } - }} - on:click={() => { - if (!field.startsWith("custom-")) { toggleSelectRow(row) } }} @@ -383,8 +379,8 @@ diff --git a/packages/client/src/components/app/table/Table.svelte b/packages/client/src/components/app/table/Table.svelte index 9346b3ca59..f56d91d7c8 100644 --- a/packages/client/src/components/app/table/Table.svelte +++ b/packages/client/src/components/app/table/Table.svelte @@ -86,6 +86,7 @@ sortable: false, divider: true, width: "auto", + preventSelectRow: true, } } From 543d2521e6c56b7770fc8fcb8981c5b10ed78ef5 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Jun 2022 15:14:53 +0100 Subject: [PATCH 5/6] Revert field changes --- packages/bbui/src/Table/Table.svelte | 44 +++++++++++++++------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index b41b77353a..2a22236474 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -132,7 +132,7 @@ style += " auto" } fields?.forEach(field => { - const fieldSchema = schema[field.name] + const fieldSchema = schema[field] if (fieldSchema.width) { style += ` ${fieldSchema.width}` } else { @@ -204,6 +204,7 @@ return nameA < nameB ? a : b }) .concat(autoColumns) + .map(column => column.name) } const editColumn = (e, field) => { @@ -299,19 +300,19 @@ {#each fields as field}
sortBy(schema[field.name])} + on:click={() => sortBy(schema[field])} > -
{getDisplayName(schema[field.name])}
- {#if schema[field.name]?.autocolumn} +
{getDisplayName(schema[field])}
+ {#if schema[field]?.autocolumn} {/if} - {#if sortColumn === field.name} + {#if sortColumn === field} {/if} - {#if allowEditColumns && schema[field.name]?.editable !== false} + {#if allowEditColumns && schema[field]?.editable !== false} editColumn(e, field.name)} + on:click={e => editColumn(e, field)} > @@ -342,7 +343,7 @@
{/if} {#if sortedRows?.length} - {#each sortedRows as row} + {#each sortedRows as row, idx}
{#if showEditColumn}
{ - if (!field.preventSelectRow) { + if (!field.startsWith("custom-")) { dispatch("click", row) + } + }} + on:click={() => { + if (!field.startsWith("custom-")) { toggleSelectRow(row) } }} @@ -379,8 +383,8 @@ From 2740b5502fed3402cbe357051ad9e2aa9fda85c2 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Jun 2022 15:19:48 +0100 Subject: [PATCH 6/6] using preventSelectRow property --- packages/bbui/src/Table/Table.svelte | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/bbui/src/Table/Table.svelte b/packages/bbui/src/Table/Table.svelte index 2a22236474..baa84c91e0 100644 --- a/packages/bbui/src/Table/Table.svelte +++ b/packages/bbui/src/Table/Table.svelte @@ -370,12 +370,8 @@ class:spectrum-Table-cell--divider={!!schema[field].divider} style={cellStyles[field]} on:click={() => { - if (!field.startsWith("custom-")) { + if (!schema[field]?.preventSelectRow) { dispatch("click", row) - } - }} - on:click={() => { - if (!field.startsWith("custom-")) { toggleSelectRow(row) } }}