Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@saltcorn/markup

Package Overview
Dependencies
Maintainers
1
Versions
401
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saltcorn/markup - npm Package Compare versions

Comparing version 0.2.3-beta.1 to 0.2.3

54

helpers.js

@@ -1,2 +0,2 @@

const { a, text, div, input, text_attr } = require("./tags");
const { a, text, div, input, text_attr, ul, li, span } = require("./tags");

@@ -24,4 +24,44 @@ const isdef = (x) => typeof x !== "undefined";

const search_bar = (name, v, onClick) => `<div class="input-group">
<input type="text" class="form-control bg-light search-bar" placeholder="Search for..."
const pagination = ({ current_page, pages, get_page_link }) => {
const from = Math.max(1, current_page - 3);
const to = Math.min(pages, current_page + 3);
var lis = [];
if (from > 1) {
lis.push(
li(
{ class: `page-item` },
a({ class: "page-link", href: get_page_link(1) }, 1)
)
);
lis.push(li({ class: `page-item` }, span({ class: "page-link" }, "...")));
}
for (let index = from; index <= to; index++) {
lis.push(
li(
{ class: ["page-item", index === current_page && "active"] },
a({ class: "page-link", href: get_page_link(index) }, index)
)
);
}
if (to < pages) {
lis.push(li({ class: `page-item` }, span({ class: "page-link" }, "...")));
lis.push(
li(
{ class: `page-item` },
a({ class: "page-link", href: get_page_link(pages) }, pages)
)
);
}
return ul({ class: "pagination" }, lis);
};
const search_bar = (
name,
v,
{ onClick, placeHolder } = {}
) => `<div class="input-group">
<input type="text" class="form-control bg-light search-bar" placeholder="${
placeHolder || "Search for..."
}"
id="input${text_attr(name)}" name="${name}"

@@ -45,2 +85,8 @@ ${onClick ? `onChange="${onClick}"` : ""}

module.exports = { isdef, select_options, search_bar, search_bar_form };
module.exports = {
isdef,
select_options,
search_bar,
search_bar_form,
pagination,
};

@@ -87,3 +87,15 @@ const { contract, is } = require("contractis");

if (segment.type === "link") {
return wrap(segment, isTop, ix, a({ href: segment.url }, segment.text));
return wrap(
segment,
isTop,
ix,
a(
{
href: segment.url,
target: segment.target_blank ? "_blank" : false,
rel: segment.nofollow ? "nofollow" : false,
},
segment.text
)
);
}

@@ -96,3 +108,6 @@ if (segment.type === "card")

div(
{ class: "card shadow mt-4" },
{
class: `card shadow mt-4 ${segment.url ? "with-link" : ""}`,
onclick: segment.url ? `location.href='${segment.url}'` : false,
},
segment.title &&

@@ -99,0 +114,0 @@ div(

4

package.json
{
"name": "@saltcorn/markup",
"version": "0.2.3-beta.1",
"version": "0.2.3",
"description": "Markup for Saltcorn, open-source no-code platform",

@@ -27,3 +27,3 @@ "homepage": "https://saltcorn.com",

},
"gitHead": "868921925df3768f5454083692901425c3783435"
"gitHead": "87f837eeacdae376453ccbafa2a96141112b5cbb"
}

@@ -17,3 +17,3 @@ const { contract, is } = require("contractis");

} = require("./tags");
const { pagination } = require("./helpers");
const headerCell = (hdr) =>

@@ -24,36 +24,2 @@ hdr.sortlink

const pagination = ({ current_page, pages, get_page_link }) => {
const from = Math.max(1, current_page - 3);
const to = Math.min(pages, current_page + 3);
var lis = [];
if (from > 1) {
lis.push(
li(
{ class: `page-item` },
a({ class: "page-link", href: get_page_link(1) }, 1)
)
);
lis.push(li({ class: `page-item` }, span({ class: "page-link" }, "...")));
}
for (let index = from; index <= to; index++) {
lis.push(
li(
{ class: ["page-item", index === current_page && "active"] },
a({ class: "page-link", href: get_page_link(index) }, index)
)
);
}
if (to < pages) {
lis.push(li({ class: `page-item` }, span({ class: "page-link" }, "...")));
lis.push(
li(
{ class: `page-item` },
a({ class: "page-link", href: get_page_link(pages) }, pages)
)
);
}
return ul({ class: "pagination" }, lis);
};
const mkTable = contract(

@@ -60,0 +26,0 @@ is.fun(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc