change name to section, add illegalChildren prop to manifest
This commit is contained in:
parent
1d2d02b48b
commit
03b5cff753
|
@ -1,16 +1,18 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { ActionMenu, ActionButton, MenuItem, Icon } from "@budibase/bbui"
|
||||||
ActionMenu,
|
import { store, currentAssetName, selectedComponent } from "builderStore"
|
||||||
ActionGroup,
|
|
||||||
ActionButton,
|
|
||||||
MenuItem,
|
|
||||||
Icon,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import { store, currentAssetName } from "builderStore"
|
|
||||||
import structure from "./componentStructure.json"
|
import structure from "./componentStructure.json"
|
||||||
|
|
||||||
$: enrichedStructure = enrichStructure(structure, $store.components)
|
$: enrichedStructure = enrichStructure(structure, $store.components)
|
||||||
|
|
||||||
|
const isChildAllowed = ({ name }, selectedComponent) => {
|
||||||
|
const currentComponent = store.actions.components.getDefinition(
|
||||||
|
selectedComponent._component
|
||||||
|
)
|
||||||
|
|
||||||
|
return currentComponent?.illegalChildren?.includes(name)
|
||||||
|
}
|
||||||
|
|
||||||
const enrichStructure = (structure, definitions) => {
|
const enrichStructure = (structure, definitions) => {
|
||||||
let enrichedStructure = []
|
let enrichedStructure = []
|
||||||
structure.forEach(item => {
|
structure.forEach(item => {
|
||||||
|
@ -45,6 +47,7 @@
|
||||||
<ActionMenu disabled={!item.isCategory}>
|
<ActionMenu disabled={!item.isCategory}>
|
||||||
<ActionButton
|
<ActionButton
|
||||||
icon={item.icon}
|
icon={item.icon}
|
||||||
|
disabled={isChildAllowed(item, $selectedComponent)}
|
||||||
quiet
|
quiet
|
||||||
size="S"
|
size="S"
|
||||||
slot="control"
|
slot="control"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[
|
[
|
||||||
|
"section",
|
||||||
"container",
|
"container",
|
||||||
"layout",
|
|
||||||
"dataprovider",
|
"dataprovider",
|
||||||
"table",
|
"table",
|
||||||
"repeater",
|
"repeater",
|
||||||
|
|
|
@ -6,15 +6,17 @@
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
"transitionable": true,
|
"transitionable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": []
|
"settings": []
|
||||||
},
|
},
|
||||||
"layout": {
|
"section": {
|
||||||
"name": "Layout",
|
"name": "Section",
|
||||||
"description": "Use this component to create different column layouts",
|
"description": "Add a section to your application",
|
||||||
"icon": "ColumnTwoB",
|
"icon": "ColumnTwoB",
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
"transitionable": true,
|
"transitionable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "modal",
|
"type": "modal",
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
"name": "Button",
|
"name": "Button",
|
||||||
"description": "A basic html button that is ready for styling",
|
"description": "A basic html button that is ready for styling",
|
||||||
"icon": "Button",
|
"icon": "Button",
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -59,6 +62,7 @@
|
||||||
"description": "A configurable data list that attaches to your backend tables.",
|
"description": "A configurable data list that attaches to your backend tables.",
|
||||||
"icon": "ViewList",
|
"icon": "ViewList",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -87,6 +91,7 @@
|
||||||
"icon": "TaskList",
|
"icon": "TaskList",
|
||||||
"description": "A basic card component that can contain content and actions.",
|
"description": "A basic card component that can contain content and actions.",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -116,6 +121,7 @@
|
||||||
"description": "A basic card component that can contain content and actions.",
|
"description": "A basic card component that can contain content and actions.",
|
||||||
"icon": "ViewColumn",
|
"icon": "ViewColumn",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -176,6 +182,7 @@
|
||||||
"description": "A component for displaying paragraph text.",
|
"description": "A component for displaying paragraph text.",
|
||||||
"icon": "TextParagraph",
|
"icon": "TextParagraph",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -189,6 +196,7 @@
|
||||||
"icon": "TextBold",
|
"icon": "TextBold",
|
||||||
"description": "A component for displaying heading text",
|
"description": "A component for displaying heading text",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -209,6 +217,7 @@
|
||||||
"description": "A basic component for displaying images",
|
"description": "A basic component for displaying images",
|
||||||
"icon": "Image",
|
"icon": "Image",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -222,6 +231,7 @@
|
||||||
"description": "A background image",
|
"description": "A background image",
|
||||||
"icon": "Images",
|
"icon": "Images",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -279,6 +289,7 @@
|
||||||
"description": "A basic component for displaying icons",
|
"description": "A basic component for displaying icons",
|
||||||
"icon": "Bell",
|
"icon": "Bell",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
|
@ -326,6 +337,7 @@
|
||||||
"description": "A component for handling the navigation within your app.",
|
"description": "A component for handling the navigation within your app.",
|
||||||
"icon": "BreadcrumbNavigation",
|
"icon": "BreadcrumbNavigation",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -346,6 +358,7 @@
|
||||||
"description": "A basic link component for internal and external links",
|
"description": "A basic link component for internal and external links",
|
||||||
"icon": "Link",
|
"icon": "Link",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -375,6 +388,7 @@
|
||||||
"description": "A basic card component that can contain content and actions.",
|
"description": "A basic card component that can contain content and actions.",
|
||||||
"icon": "ViewRow",
|
"icon": "ViewRow",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -447,6 +461,7 @@
|
||||||
"description": "A card component for displaying numbers.",
|
"description": "A card component for displaying numbers.",
|
||||||
"icon": "Card",
|
"icon": "Card",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -473,6 +488,7 @@
|
||||||
"icon": "Code",
|
"icon": "Code",
|
||||||
"description": "Embed content from 3rd party sources",
|
"description": "Embed content from 3rd party sources",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -486,6 +502,7 @@
|
||||||
"description": "Bar chart",
|
"description": "Bar chart",
|
||||||
"icon": "GraphBarVertical",
|
"icon": "GraphBarVertical",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -586,6 +603,7 @@
|
||||||
"description": "Line chart",
|
"description": "Line chart",
|
||||||
"icon": "GraphTrend",
|
"icon": "GraphTrend",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -687,6 +705,7 @@
|
||||||
"description": "Line chart",
|
"description": "Line chart",
|
||||||
"icon": "GraphAreaStacked",
|
"icon": "GraphAreaStacked",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -800,6 +819,7 @@
|
||||||
"description": "Pie chart",
|
"description": "Pie chart",
|
||||||
"icon": "GraphPie",
|
"icon": "GraphPie",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -877,6 +897,7 @@
|
||||||
"description": "Donut chart",
|
"description": "Donut chart",
|
||||||
"icon": "GraphDonut",
|
"icon": "GraphDonut",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -954,6 +975,7 @@
|
||||||
"description": "Candlestick chart",
|
"description": "Candlestick chart",
|
||||||
"icon": "GraphBarVerticalStacked",
|
"icon": "GraphBarVerticalStacked",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -1036,6 +1058,7 @@
|
||||||
"icon": "Form",
|
"icon": "Form",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"actions": [
|
"actions": [
|
||||||
"ValidateForm"
|
"ValidateForm"
|
||||||
],
|
],
|
||||||
|
@ -1100,6 +1123,7 @@
|
||||||
"name": "Field Group",
|
"name": "Field Group",
|
||||||
"icon": "Group",
|
"icon": "Group",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -1128,6 +1152,7 @@
|
||||||
"name": "Text Field",
|
"name": "Text Field",
|
||||||
"icon": "Text",
|
"icon": "Text",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/string",
|
"type": "field/string",
|
||||||
|
@ -1156,6 +1181,7 @@
|
||||||
"name": "Number Field",
|
"name": "Number Field",
|
||||||
"icon": "123",
|
"icon": "123",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/number",
|
"type": "field/number",
|
||||||
|
@ -1184,6 +1210,7 @@
|
||||||
"name": "Password Field",
|
"name": "Password Field",
|
||||||
"icon": "LockClosed",
|
"icon": "LockClosed",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/string",
|
"type": "field/string",
|
||||||
|
@ -1212,6 +1239,7 @@
|
||||||
"name": "Options Picker",
|
"name": "Options Picker",
|
||||||
"icon": "ViewList",
|
"icon": "ViewList",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/options",
|
"type": "field/options",
|
||||||
|
@ -1241,6 +1269,7 @@
|
||||||
"name": "Checkbox",
|
"name": "Checkbox",
|
||||||
"icon": "Checkmark",
|
"icon": "Checkmark",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/boolean",
|
"type": "field/boolean",
|
||||||
|
@ -1269,6 +1298,7 @@
|
||||||
"name": "Rich Text",
|
"name": "Rich Text",
|
||||||
"icon": "TextParagraph",
|
"icon": "TextParagraph",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/longform",
|
"type": "field/longform",
|
||||||
|
@ -1298,6 +1328,7 @@
|
||||||
"name": "Date Picker",
|
"name": "Date Picker",
|
||||||
"icon": "DateInput",
|
"icon": "DateInput",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/datetime",
|
"type": "field/datetime",
|
||||||
|
@ -1332,6 +1363,7 @@
|
||||||
"name": "Attachment",
|
"name": "Attachment",
|
||||||
"icon": "Attach",
|
"icon": "Attach",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/attachment",
|
"type": "field/attachment",
|
||||||
|
@ -1355,6 +1387,7 @@
|
||||||
"name": "Relationship Picker",
|
"name": "Relationship Picker",
|
||||||
"icon": "TaskList",
|
"icon": "TaskList",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/link",
|
"type": "field/link",
|
||||||
|
@ -1384,6 +1417,7 @@
|
||||||
"info": "Pagination is only available for data stored in internal tables.",
|
"info": "Pagination is only available for data stored in internal tables.",
|
||||||
"icon": "Data",
|
"icon": "Data",
|
||||||
"styleable": false,
|
"styleable": false,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -1447,6 +1481,7 @@
|
||||||
"name": "Table",
|
"name": "Table",
|
||||||
"icon": "Table",
|
"icon": "Table",
|
||||||
"styleable": true,
|
"styleable": true,
|
||||||
|
"illegalChildren": ["Section"],
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
bind:clientWidth={containerWidth}
|
bind:clientWidth={containerWidth}
|
||||||
in:transition={{ type: $component.transition }}
|
in:transition={{ type: $component.transition }}
|
||||||
class="{type} columns-{columnsDependingOnSize}"
|
class="{type} columns-{columnsDependingOnSize}"
|
||||||
|
use:styleable={$component.styles}
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
{#if layoutMap[type] - $component.children > 0}
|
{#if layoutMap[type] - $component.children > 0}
|
||||||
|
@ -45,10 +46,10 @@
|
||||||
grid-gap: 16px;
|
grid-gap: 16px;
|
||||||
}
|
}
|
||||||
.mainSidebar {
|
.mainSidebar {
|
||||||
grid-template-columns: 2fr 1fr;
|
grid-template-columns: 3fr 1fr;
|
||||||
}
|
}
|
||||||
.sidebarMain {
|
.sidebarMain {
|
||||||
grid-template-columns: 1fr 2fr;
|
grid-template-columns: 1fr 3fr;
|
||||||
}
|
}
|
||||||
.twoColumns {
|
.twoColumns {
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
|
@ -11,7 +11,7 @@ import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-rollup.js"
|
||||||
loadSpectrumIcons()
|
loadSpectrumIcons()
|
||||||
|
|
||||||
export { default as container } from "./Container.svelte"
|
export { default as container } from "./Container.svelte"
|
||||||
export { default as layout } from "./Layout.svelte"
|
export { default as section } from "./Section.svelte"
|
||||||
export { default as dataprovider } from "./DataProvider.svelte"
|
export { default as dataprovider } from "./DataProvider.svelte"
|
||||||
export { default as screenslot } from "./ScreenSlot.svelte"
|
export { default as screenslot } from "./ScreenSlot.svelte"
|
||||||
export { default as button } from "./Button.svelte"
|
export { default as button } from "./Button.svelte"
|
||||||
|
|
Loading…
Reference in New Issue