Fix indicators around modals and side panels when used inside grids
This commit is contained in:
parent
6baf784f4a
commit
d36fef5c86
|
@ -18,14 +18,37 @@
|
||||||
"numberLike": {
|
"numberLike": {
|
||||||
"supported": ["number", "boolean"],
|
"supported": ["number", "boolean"],
|
||||||
"partialSupport": [
|
"partialSupport": [
|
||||||
{ "type": "longform", "message": "stringAsNumber" },
|
{
|
||||||
{ "type": "string", "message": "stringAsNumber" },
|
"type": "longform",
|
||||||
{ "type": "bigint", "message": "stringAsNumber" },
|
"message": "stringAsNumber"
|
||||||
{ "type": "options", "message": "stringAsNumber" },
|
},
|
||||||
{ "type": "formula", "message": "stringAsNumber" },
|
{
|
||||||
{ "type": "datetime", "message": "dateAsNumber" }
|
"type": "string",
|
||||||
|
"message": "stringAsNumber"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bigint",
|
||||||
|
"message": "stringAsNumber"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "options",
|
||||||
|
"message": "stringAsNumber"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "formula",
|
||||||
|
"message": "stringAsNumber"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "datetime",
|
||||||
|
"message": "dateAsNumber"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"unsupported": [{ "type": "json", "message": "jsonPrimitivesOnly" }]
|
"unsupported": [
|
||||||
|
{
|
||||||
|
"type": "json",
|
||||||
|
"message": "jsonPrimitivesOnly"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"stringLike": {
|
"stringLike": {
|
||||||
"supported": [
|
"supported": [
|
||||||
|
@ -37,19 +60,47 @@
|
||||||
"boolean",
|
"boolean",
|
||||||
"datetime"
|
"datetime"
|
||||||
],
|
],
|
||||||
"unsupported": [{ "type": "json", "message": "jsonPrimitivesOnly" }]
|
"unsupported": [
|
||||||
|
{
|
||||||
|
"type": "json",
|
||||||
|
"message": "jsonPrimitivesOnly"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"datetimeLike": {
|
"datetimeLike": {
|
||||||
"supported": ["datetime"],
|
"supported": ["datetime"],
|
||||||
"partialSupport": [
|
"partialSupport": [
|
||||||
{ "type": "longform", "message": "stringAsDate" },
|
{
|
||||||
{ "type": "string", "message": "stringAsDate" },
|
"type": "longform",
|
||||||
{ "type": "options", "message": "stringAsDate" },
|
"message": "stringAsDate"
|
||||||
{ "type": "formula", "message": "stringAsDate" },
|
},
|
||||||
{ "type": "bigint", "message": "stringAsDate" },
|
{
|
||||||
{ "type": "number", "message": "numberAsDate" }
|
"type": "string",
|
||||||
|
"message": "stringAsDate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "options",
|
||||||
|
"message": "stringAsDate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "formula",
|
||||||
|
"message": "stringAsDate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bigint",
|
||||||
|
"message": "stringAsDate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"message": "numberAsDate"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"unsupported": [{ "type": "json", "message": "jsonPrimitivesOnly" }]
|
"unsupported": [
|
||||||
|
{
|
||||||
|
"type": "json",
|
||||||
|
"message": "jsonPrimitivesOnly"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"layout": {
|
"layout": {
|
||||||
|
@ -4292,7 +4343,10 @@
|
||||||
"label": "High",
|
"label": "High",
|
||||||
"value": 3136
|
"value": 3136
|
||||||
},
|
},
|
||||||
{ "label": "Custom", "value": "custom" }
|
{
|
||||||
|
"label": "Custom",
|
||||||
|
"value": "custom"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -7148,6 +7202,7 @@
|
||||||
"name": "Side Panel",
|
"name": "Side Panel",
|
||||||
"icon": "RailRight",
|
"icon": "RailRight",
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
|
"ignoresLayout": true,
|
||||||
"illegalChildren": ["section", "sidepanel", "modal"],
|
"illegalChildren": ["section", "sidepanel", "modal"],
|
||||||
"showEmptyState": false,
|
"showEmptyState": false,
|
||||||
"draggable": false,
|
"draggable": false,
|
||||||
|
@ -7171,6 +7226,7 @@
|
||||||
"icon": "MBox",
|
"icon": "MBox",
|
||||||
"hasChildren": true,
|
"hasChildren": true,
|
||||||
"illegalChildren": ["section", "modal", "sidepanel"],
|
"illegalChildren": ["section", "modal", "sidepanel"],
|
||||||
|
"ignoresLayout": true,
|
||||||
"showEmptyState": false,
|
"showEmptyState": false,
|
||||||
"draggable": false,
|
"draggable": false,
|
||||||
"info": "Modals are hidden by default. They will only be revealed when triggered by the 'Open Modal' action.",
|
"info": "Modals are hidden by default. They will only be revealed when triggered by the 'Open Modal' action.",
|
||||||
|
|
|
@ -209,8 +209,9 @@
|
||||||
// Metadata to pass into grid action to apply CSS
|
// Metadata to pass into grid action to apply CSS
|
||||||
let gridMetadata = memo()
|
let gridMetadata = memo()
|
||||||
$: gridMetadata.set({
|
$: gridMetadata.set({
|
||||||
active:
|
insideGrid:
|
||||||
parent?._component.endsWith("/container") && parent?.layout === "grid",
|
parent?._component.endsWith("/container") && parent?.layout === "grid",
|
||||||
|
ignoresLayout: definition.ignoresLayout === true,
|
||||||
id,
|
id,
|
||||||
interactive,
|
interactive,
|
||||||
styles: normalStyles,
|
styles: normalStyles,
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure all top level children have grid styles applied */
|
/* Ensure all top level children have grid styles applied */
|
||||||
.grid :global(> .component) {
|
.grid :global(> .component:not(.ignores-layout)) {
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
|
|
|
@ -59,9 +59,24 @@ export const gridLayout = (node, metadata) => {
|
||||||
|
|
||||||
// Applies the required listeners, CSS and classes to a component DOM node
|
// Applies the required listeners, CSS and classes to a component DOM node
|
||||||
const applyMetadata = metadata => {
|
const applyMetadata = metadata => {
|
||||||
const { id, styles, interactive, errored, definition, draggable, active } =
|
const {
|
||||||
metadata
|
id,
|
||||||
if (!active) {
|
styles,
|
||||||
|
interactive,
|
||||||
|
errored,
|
||||||
|
definition,
|
||||||
|
draggable,
|
||||||
|
insideGrid,
|
||||||
|
ignoresLayout,
|
||||||
|
} = metadata
|
||||||
|
if (!insideGrid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this component ignores layout, flag it as such so that we can avoid
|
||||||
|
// selecting it later
|
||||||
|
if (ignoresLayout) {
|
||||||
|
node.classList.add("ignores-layout")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +158,12 @@ export const gridLayout = (node, metadata) => {
|
||||||
|
|
||||||
// Removes the previously set up listeners
|
// Removes the previously set up listeners
|
||||||
const removeListeners = () => {
|
const removeListeners = () => {
|
||||||
node.removeEventListener("click", selectComponent, false)
|
// By checking if this is defined we can avoid trying to remove event
|
||||||
|
// listeners on every component
|
||||||
|
if (selectComponent) {
|
||||||
|
node.removeEventListener("click", selectComponent, false)
|
||||||
|
selectComponent = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applyMetadata(metadata)
|
applyMetadata(metadata)
|
||||||
|
|
Loading…
Reference in New Issue