diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 9b0bf7605c..08744c1952 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2576,7 +2576,6 @@ ] }, "tablewithsearch": { - "block": true, "name": "Table with search", "icon": "Table", "styles": ["size"], diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index faf0226604..c13a50d52e 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -40,6 +40,7 @@ // Get contexts const context = getContext("context") const insideScreenslot = !!getContext("screenslot") + const insideBlock = !!getContext("block") // Create component context const componentStore = writable({}) @@ -53,7 +54,8 @@ $: name = instance._instanceName $: interactive = $builderStore.inBuilder && - ($builderStore.previewType === "layout" || insideScreenslot) + ($builderStore.previewType === "layout" || insideScreenslot) && + !insideBlock $: empty = interactive && !children.length && definition?.hasChildren $: emptyState = empty && definition?.showEmptyState !== false $: rawProps = getRawProps(instance) @@ -197,6 +199,8 @@ {/each} {:else if emptyState} + {:else if insideBlock} + {/if} diff --git a/packages/client/src/components/app/DataProvider.svelte b/packages/client/src/components/app/DataProvider.svelte index 991c41b77d..df59820506 100644 --- a/packages/client/src/components/app/DataProvider.svelte +++ b/packages/client/src/components/app/DataProvider.svelte @@ -234,7 +234,7 @@ {:else} - {#if !$component.children} + {#if $component.emptyState} {:else} diff --git a/packages/client/src/components/app/blocks/Block.svelte b/packages/client/src/components/app/blocks/Block.svelte new file mode 100644 index 0000000000..112b2387a7 --- /dev/null +++ b/packages/client/src/components/app/blocks/Block.svelte @@ -0,0 +1,14 @@ + + +
+ +
diff --git a/packages/client/src/components/app/blocks/BlockComponent.svelte b/packages/client/src/components/app/blocks/BlockComponent.svelte new file mode 100644 index 0000000000..5ef0509391 --- /dev/null +++ b/packages/client/src/components/app/blocks/BlockComponent.svelte @@ -0,0 +1,33 @@ + + + + + diff --git a/packages/client/src/components/app/blocks/TableWithSearch.svelte b/packages/client/src/components/app/blocks/TableWithSearch.svelte index dba50eb4b8..95960e49af 100644 --- a/packages/client/src/components/app/blocks/TableWithSearch.svelte +++ b/packages/client/src/components/app/blocks/TableWithSearch.svelte @@ -1,99 +1,89 @@ -
- -
+ + + {#if searchColumns?.length} + + {/if} + + + + + + + diff --git a/packages/client/src/utils/styleable.js b/packages/client/src/utils/styleable.js index 6a2562fb48..f35e45d3fe 100644 --- a/packages/client/src/utils/styleable.js +++ b/packages/client/src/utils/styleable.js @@ -64,9 +64,7 @@ export const styleable = (node, styles = {}) => { // Handler to select a component in the builder when clicking it in the // builder preview selectComponent = event => { - if (newStyles.interactive) { - builderStore.actions.selectComponent(componentId) - } + builderStore.actions.selectComponent(componentId) event.preventDefault() event.stopPropagation() return false @@ -77,7 +75,7 @@ export const styleable = (node, styles = {}) => { node.addEventListener("mouseout", applyNormalStyles) // Add builder preview click listener - if (get(builderStore).inBuilder) { + if (newStyles.interactive) { node.addEventListener("click", selectComponent, false) } @@ -89,11 +87,7 @@ export const styleable = (node, styles = {}) => { const removeListeners = () => { node.removeEventListener("mouseover", applyHoverStyles) node.removeEventListener("mouseout", applyNormalStyles) - - // Remove builder preview click listener - if (get(builderStore).inBuilder) { - node.removeEventListener("click", selectComponent) - } + node.removeEventListener("click", selectComponent) } // Apply initial styles