@saltcorn/markup
Advanced tools
Comparing version 0.3.2-beta.0 to 0.3.2-beta.1
@@ -23,7 +23,17 @@ const { contract, is } = require("contractis"); | ||
const couldHaveAlerts = (alerts) => alerts || Array.isArray(alerts); | ||
const makeSegments = (body, alerts) => { | ||
const alertsSegments = | ||
alerts && alerts.length > 0 | ||
? [{ type: "blank", contents: alerts.map((a) => alert(a.type, a.msg)) }] | ||
: []; | ||
const alertsSegments = couldHaveAlerts(alerts) | ||
? [ | ||
{ | ||
type: "blank", | ||
contents: div( | ||
{ id: "alerts-area" }, | ||
(alerts || []).map((a) => alert(a.type, a.msg)) | ||
), | ||
}, | ||
] | ||
: []; | ||
if (typeof body === "string") | ||
@@ -34,9 +44,5 @@ return { | ||
else if (body.above) { | ||
if (alerts && alerts.length > 0) body.above.unshift(alertsSegments[0]); | ||
if (couldHaveAlerts(alerts)) body.above.unshift(alertsSegments[0]); | ||
return body; | ||
} else { | ||
if (alerts && alerts.length > 0) | ||
return { above: [...alertsSegments, body] }; | ||
else return body; | ||
} | ||
} else return { above: [...alertsSegments, body] }; | ||
}; | ||
@@ -258,2 +264,4 @@ const applyTextStyle = (textStyle, inner, isBlock) => { | ||
hide, | ||
customClass, | ||
customCSS, | ||
} = segment; | ||
@@ -271,2 +279,3 @@ if (hide) return ""; | ||
: `${cssNm}: ${segment[segKey]}${unit};`; | ||
const ppCustomCSS = (s) => (s ? s.split("\n").join("") + ";" : ""); | ||
return wrap( | ||
@@ -279,2 +288,3 @@ segment, | ||
class: [ | ||
customClass || false, | ||
hAlign && `text-${hAlign}`, | ||
@@ -286,3 +296,3 @@ vAlign === "middle" && "d-flex align-items-center", | ||
], | ||
style: `${ | ||
style: `${ppCustomCSS(customCSS || "")}${ | ||
block === false ? "display: inline-block;" : "" | ||
@@ -289,0 +299,0 @@ }${sizeProp("minHeight", "min-height")}${sizeProp( |
{ | ||
"name": "@saltcorn/markup", | ||
"version": "0.3.2-beta.0", | ||
"version": "0.3.2-beta.1", | ||
"description": "Markup for Saltcorn, open-source no-code platform", | ||
@@ -27,3 +27,3 @@ "homepage": "https://saltcorn.com", | ||
}, | ||
"gitHead": "91dc90a9afde606b0dcca164a63bba03839729d9" | ||
"gitHead": "25ac380a46a3c2a90daa30f83bc69836cdee257f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47491
1620