-
-
-
-
@@ -111,20 +96,10 @@ export default {
type: Array,
required: true
},
- openedBlocks: {
- type: Object,
- required: true
- },
- position: {
- type: [String, Number],
- required: true
- },
},
data() {
return {
showPicker: false,
- activeCategory: 'all',
- search: '',
}
},
methods: {
@@ -135,25 +110,14 @@ export default {
settings[i] = widget.settings[i].default
}
- const block = {
+ this.container.push({
id: this.makeId(),
widget: name,
settings,
children: [],
- }
-
-
- if (this.position === 'bottom') {
- this.container.push(block)
- this.$emit('updateContainer', this.container)
- } else if (this.position === 'top') {
- this.container.unshift(block)
- } else {
- this.container.splice(this.position+1, 0, block)
- }
+ })
this.$emit('updateContainer', this.container)
- this.openedBlocks[block.id] = true
this.togglePicker()
},
makeId() {
@@ -167,26 +131,17 @@ export default {
return `block-${result}`
},
- matchSearch(name) {
- if (!this.search.trim().length) {
- return true
- }
-
- return name.toLowerCase().includes(this.search.toLowerCase())
- },
togglePicker() {
this.showPicker = !this.showPicker
},
categories() {
- let items = {
- all: {label: 'All', widgets: {}},
- }
+ let items = {}
for (let widgetName in this.widgets) {
let value = this.widgets[widgetName]
if (!value.category) {
- value.category = 'all'
+ value.category = 'none'
}
if (typeof items[value.category] === 'undefined') {
@@ -198,7 +153,6 @@ export default {
if (!this.allowedWidgets.length || this.allowedWidgets.includes(widgetName)) {
items[value.category].widgets[widgetName] = value
- items['all'].widgets[widgetName] = value
}
}
diff --git a/src/core/Resources/assets/js/components/builder-block/BuilderBlockItem.vue b/src/core/Resources/assets/js/components/builder-block/BuilderBlockItem.vue
index 854eaee..bab4f7d 100644
--- a/src/core/Resources/assets/js/components/builder-block/BuilderBlockItem.vue
+++ b/src/core/Resources/assets/js/components/builder-block/BuilderBlockItem.vue
@@ -1,157 +1,88 @@
-