diff --git a/lerna.json b/lerna.json index dfd2aac356..3a92bc6d9a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.6", + "version": "2.22.7", "npmClient": "yarn", "packages": [ "packages/*", diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js index 12c4c4d002..2c54427b3a 100644 --- a/packages/bbui/src/Actions/click_outside.js +++ b/packages/bbui/src/Actions/click_outside.js @@ -39,19 +39,23 @@ const handleClick = event => { return } + if (handler.allowedType && event.type !== handler.allowedType) { + return + } + handler.callback?.(event) }) } document.documentElement.addEventListener("click", handleClick, true) -document.documentElement.addEventListener("contextmenu", handleClick, true) +document.documentElement.addEventListener("mousedown", handleClick, true) /** * Adds or updates a click handler */ -const updateHandler = (id, element, anchor, callback) => { +const updateHandler = (id, element, anchor, callback, allowedType) => { let existingHandler = clickHandlers.find(x => x.id === id) if (!existingHandler) { - clickHandlers.push({ id, element, anchor, callback }) + clickHandlers.push({ id, element, anchor, callback, allowedType }) } else { existingHandler.callback = callback } @@ -77,7 +81,8 @@ export default (element, opts) => { const update = newOpts => { const callback = newOpts?.callback || newOpts const anchor = newOpts?.anchor || element - updateHandler(id, element, anchor, callback) + const allowedType = newOpts?.allowedType || "click" + updateHandler(id, element, anchor, callback, allowedType) } update(opts) return { diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index c2cda1f2d8..f2c726c8bf 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -28,7 +28,6 @@ let deleteTableName $: externalTable = table?.sourceType === DB_TYPE_EXTERNAL - $: allowDeletion = !externalTable || table?.created function showDeleteModal() { templateScreens = $screenStore.screens.filter( @@ -56,7 +55,7 @@ $goto(`./datasource/${table.datasourceId}`) } } catch (error) { - notifications.error("Error deleting table") + notifications.error(`Error deleting table - ${error.message}`) } } @@ -86,17 +85,15 @@ } -{#if allowDeletion} - -
- -
- {#if !externalTable} - Edit - {/if} - Delete -
-{/if} + +
+ +
+ {#if !externalTable} + Edit + {/if} + Delete +
diff --git a/packages/client/src/components/app/blocks/TableBlock.svelte b/packages/client/src/components/app/blocks/TableBlock.svelte index c371bed147..5fd197bc02 100644 --- a/packages/client/src/components/app/blocks/TableBlock.svelte +++ b/packages/client/src/components/app/blocks/TableBlock.svelte @@ -1,5 +1,6 @@