@saltcorn/markup
Advanced tools
Comparing version 0.9.5-beta.18 to 0.9.5-beta.19
@@ -35,2 +35,16 @@ "use strict"; | ||
}; | ||
const navSubItemsIterator = (si) => si?.type === "Separator" | ||
? hr({ class: "mx-3 my-1" }) | ||
: si?.subitems | ||
? div({ class: "dropdown-item btn-group dropend" }, a({ | ||
type: "button", | ||
class: "dropdown-item dropdown-toggle p-0", | ||
"data-bs-toggle": "dropdown", | ||
"aria-expanded": "false", | ||
}, si.label), ul({ class: "dropdown-menu" }, si?.subitems.map((si1) => li(navSubItemsIterator(si1))))) | ||
: a({ | ||
class: ["dropdown-item", si.style || "", si.class], | ||
href: si.link, | ||
target: si.target_blank ? "_blank" : undefined, | ||
}, si.icon ? i({ class: `fa-fw mr-05 ${si.icon}` }) : "", si.label); | ||
/** | ||
@@ -44,20 +58,17 @@ * @param {object} opts | ||
*/ | ||
const navSubitems = ({ label, subitems, icon, isUser, }) => li({ class: "nav-item dropdown" }, a({ | ||
class: ["nav-link dropdown-toggle", isUser && "user-nav-section"], | ||
href: "#", | ||
id: `dropdown${labelToId(label)}`, | ||
role: "button", | ||
"data-bs-toggle": "dropdown", | ||
"aria-haspopup": "true", | ||
"aria-expanded": "false", | ||
}, icon ? i({ class: `fa-fw mr-05 ${icon}` }) : "", label), div({ | ||
class: ["dropdown-menu", isUser && "dropdown-menu-end"], | ||
"aria-labelledby": `dropdown${labelToId(label)}`, | ||
}, subitems.map((si) => si?.type === "Separator" | ||
? hr({ class: "mx-3 my-1" }) | ||
: a({ | ||
class: ["dropdown-item", si.style || "", si.class], | ||
href: si.link, | ||
target: si.target_blank ? "_blank" : undefined, | ||
}, si.icon ? i({ class: `fa-fw mr-05 ${si.icon}` }) : "", si.label)))); | ||
const navSubitems = ({ label, subitems, icon, isUser, }) => { | ||
return li({ class: "nav-item dropdown" }, a({ | ||
class: ["nav-link dropdown-toggle", isUser && "user-nav-section"], | ||
href: "#", | ||
id: `dropdown${labelToId(label)}`, | ||
role: "button", | ||
"data-bs-toggle": "dropdown", | ||
"aria-haspopup": "true", | ||
"aria-expanded": "false", | ||
"data-bs-auto-close": "outside", | ||
}, icon ? i({ class: `fa-fw mr-05 ${icon}` }) : "", label), div({ | ||
class: ["dropdown-menu", isUser && "dropdown-menu-end"], | ||
"aria-labelledby": `dropdown${labelToId(label)}`, | ||
}, subitems.map(navSubItemsIterator))); | ||
}; | ||
/** | ||
@@ -297,2 +308,8 @@ * @param {string} currentUrl | ||
: standardBreadcrumbItem(crumbs.length)(c, ix)), after ? li({ class: "ms-3" }, after) : "", right ? li({ class: "ms-auto" }, right) : "")); | ||
const removeLeadingSlash = (s) => { | ||
if (s.startsWith("/")) | ||
return s.slice(1); | ||
else | ||
return s; | ||
}; | ||
/** | ||
@@ -304,3 +321,3 @@ * @param {object[]} headers | ||
.filter((h) => h.css) | ||
.map((h) => `<link href="${h.css}" rel="stylesheet">`) | ||
.map((h) => `<link href="${isNode ? h.css : removeLeadingSlash(h.css)}" rel="stylesheet">`) | ||
.join("") + | ||
@@ -321,3 +338,3 @@ headers | ||
.filter((h) => h.script) | ||
.map((h) => `<script ${h.defer ? "defer " : ""}src="${h.script}" ${h.integrity | ||
.map((h) => `<script ${h.defer ? "defer " : ""}src="${isNode ? h.script : removeLeadingSlash(h.script)}" ${h.integrity | ||
? `integrity="${h.integrity}" crossorigin="anonymous"` | ||
@@ -324,0 +341,0 @@ : ""}></script>`) |
@@ -45,2 +45,4 @@ "use strict"; | ||
xss_1.whiteList.kbd = []; | ||
xss_1.whiteList.span = ["style"]; | ||
xss_1.whiteList.div = ["style"]; | ||
/** | ||
@@ -47,0 +49,0 @@ * @param {string|number} t |
{ | ||
"name": "@saltcorn/markup", | ||
"version": "0.9.5-beta.18", | ||
"version": "0.9.5-beta.19", | ||
"description": "Markup for Saltcorn, open-source no-code platform", | ||
@@ -38,3 +38,3 @@ "homepage": "https://saltcorn.com", | ||
"devDependencies": { | ||
"@saltcorn/types": "0.9.5-beta.18", | ||
"@saltcorn/types": "0.9.5-beta.19", | ||
"@types/escape-html": "^1.0.1", | ||
@@ -41,0 +41,0 @@ "@types/jest": "^29.5.11", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
256805
3383