@saltcorn/markup
Advanced tools
Comparing version 0.1.3 to 0.1.4
18
index.js
@@ -9,9 +9,21 @@ const renderForm = require("./form"); | ||
const post_btn = (href, s, csrfToken, btnClass = "primary") => | ||
const post_btn = ( | ||
href, | ||
s, | ||
csrfToken, | ||
{ btnClass = "primary", onClick, small, klass = "" } = {} | ||
) => | ||
`<form action="${text(href)}" method="post"> | ||
<input type="hidden" name="_csrf" value="${csrfToken}"> | ||
<button type="submit" class="btn btn-${btnClass}">${s}</button></form>`; | ||
<button type="submit" ${ | ||
onClick ? `onclick="${onClick}"` : "" | ||
} class="${klass} btn ${ | ||
small ? "btn-sm" : "" | ||
} btn-${btnClass}">${s}</button></form>`; | ||
const post_delete_btn = (href, csrfToken) => | ||
post_btn(href, '<i class="fas fa-trash"></i>', csrfToken, "danger"); | ||
post_btn(href, '<i class="fas fa-trash"></i>', csrfToken, { | ||
btnClass: "danger", | ||
small: true | ||
}); | ||
@@ -18,0 +30,0 @@ module.exports = { |
@@ -102,8 +102,18 @@ const { contract, is } = require("contractis"); | ||
bgFileId, | ||
bgType, | ||
bgColor, | ||
vAlign, | ||
hAlign, | ||
imageSize, | ||
minHeight, | ||
borderWidth, | ||
borderStyle | ||
borderStyle, | ||
setTextColor, | ||
textColor | ||
} = segment; | ||
const renderBg = !( | ||
isTop && | ||
blockDispatch.noBackgroundAtTop && | ||
blockDispatch.noBackgroundAtTop() | ||
); | ||
return wrap( | ||
@@ -117,13 +127,22 @@ segment, | ||
`text-${hAlign}`, | ||
vAlign === "middle" && "d-flex align-items-center" | ||
vAlign === "middle" && "d-flex align-items-center", | ||
vAlign === "middle" && | ||
hAlign === "center" && | ||
"justify-content-center" | ||
], | ||
style: `min-height: ${minHeight}px; | ||
border: ${borderWidth}px ${borderStyle} black; | ||
style: `min-height: ${minHeight || 0}px; | ||
border: ${borderWidth || 0}px ${borderStyle} black; | ||
${ | ||
bgFileId && +bgFileId | ||
renderBg && bgType === "Image" && bgFileId && +bgFileId | ||
? `background-image: url('/files/serve/${bgFileId}'); | ||
background-size: contain; | ||
background-repeat: no-repeat` | ||
background-size: ${imageSize || "contain"}; | ||
background-repeat: no-repeat;` | ||
: "" | ||
}` | ||
} | ||
${ | ||
renderBg && bgType === "Color" | ||
? `background-color: ${bgColor};` | ||
: "" | ||
} | ||
${setTextColor ? `color: ${textColor};` : ""}` | ||
}, | ||
@@ -130,0 +149,0 @@ go(segment.contents) |
{ | ||
"name": "@saltcorn/markup", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Markup for Saltcorn, open-source no-code platform", | ||
@@ -13,3 +13,3 @@ "homepage": "https://saltcorn.com", | ||
"dependencies": { | ||
"contractis": "^0.0.11", | ||
"contractis": "^0.0.12", | ||
"escape-html": "^1.0.3", | ||
@@ -28,3 +28,3 @@ "xss": "^1.0.6" | ||
}, | ||
"gitHead": "f957b5e343a571d00eed364e31067f20cd6f36c0" | ||
"gitHead": "88ae255c919879e321b718d9cd433781e588efd8" | ||
} |
21
table.js
@@ -97,12 +97,13 @@ const { contract, is } = require("contractis"); | ||
const mkClickHandler = (opts, v) => | ||
!opts.onRowSelect | ||
? {} | ||
: { | ||
onclick: | ||
typeof opts.onRowSelect === "function" | ||
? opts.onRowSelect(v) | ||
: opts.onRowSelect | ||
}; | ||
const mkClickHandler = (opts, v) => { | ||
var attrs = {}; | ||
if (opts.onRowSelect) | ||
attrs.onclick = | ||
typeof opts.onRowSelect === "function" | ||
? opts.onRowSelect(v) | ||
: opts.onRowSelect; | ||
if (opts.selectedId && v.id && +v.id === +opts.selectedId) | ||
attrs.class = "table-active"; | ||
return attrs; | ||
}; | ||
module.exports = mkTable; |
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
344037
1985
+ Addedcontractis@0.0.12(transitive)
- Removedcontractis@0.0.11(transitive)
Updatedcontractis@^0.0.12