New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-ui-builder

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-ui-builder - npm Package Compare versions

Comparing version 1.0.31 to 1.0.32

2

package.json
{
"name": "simple-ui-builder",
"version": "1.0.31",
"version": "1.0.32",
"description": "Build user interface like Lego bricks. UI.input(), UI.button(cb), UI.select(arr) etc. For lazy guys as I am.",

@@ -5,0 +5,0 @@ "main": "ui.js",

@@ -32,4 +32,6 @@ /**

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -62,3 +64,4 @@ var exNode = document.getElementById(params.id);

if (params.value === undefined) {
input.value = localStorage["input#" + params.id] || params.default || "";
input.value = localStorage["input#" + params.id] ||
params.default || "";
} else input.value = params.value;

@@ -106,7 +109,14 @@

params.id = params.id || "button";
params.className = (params.class !== undefined) ? params.class : ((params.className !== undefined) ? params.className : "btn btn-default");
params.className = (params.class !== undefined) ?
params.class :
((params.className !== undefined) ?
params.className :
"btn btn-default");
params.innerHTML = params.innerHTML || params.title || "Action";
if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -136,3 +146,4 @@ var exNode = document.getElementById(params.id);

if (!arr || !arr.length) return console.warn("no array to build buttons!");
if (!arr || !arr.length)
return console.warn("no array to build buttons!");

@@ -202,4 +213,6 @@ if (typeof cb == "object") {

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string")
params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") ||
document.body;

@@ -219,3 +232,4 @@ params.id = params.id || "br";

if (!arr || !arr.length) return console.warn("no array to build radios!");
if (!arr || !arr.length)
return console.warn("no array to build radios!");

@@ -238,4 +252,6 @@ params = params || {};

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -289,4 +305,6 @@ params.id = params.id || "radio";

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -304,3 +322,4 @@ params.id = params.id || "checkbox";

if (params.text) params.parent.appendChild(document.createTextNode(params.text));
if (params.text)
params.parent.appendChild(document.createTextNode(params.text));
};

@@ -322,4 +341,6 @@

params.id = params.id || "file-reader";
if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -333,17 +354,26 @@ var exNode = document.getElementById(params.id);

fileInput.id = params.id;
fileInput.onchange = function(evt) {
var fileToRead = evt.target.files[0];
var fileType = fileToRead.name.split(/\./).pop();
if (parent.bypassFileReader) return cb(fileToRead);
var fileReader = new FileReader();
fileReader.onload = function(e) {
var contents = e.target.result;
if (params.json && (["{", "["].indexOf(contents.slice(0, 1)) != -1)) contents = JSON.parse(contents);
if (params.json && (["{", "["].indexOf(contents.slice(0, 1)) != -1))
contents = JSON.parse(contents);
cb(contents, fileToRead);
};
if ((["zip", "kmz"].indexOf(fileType) != -1) || (params.readAsArrayBuffer)) {
if ((["zip", "kmz"].indexOf(fileType) != -1) ||
(params.readAsArrayBuffer)) {
fileReader.readAsArrayBuffer(fileToRead);
} else if ((["xls", "xlsx"].indexOf(fileType) != -1) || (params.readAsBinaryString)) {
} else if ((["xls", "xlsx"].indexOf(fileType) != -1) ||
(params.readAsBinaryString)) {
fileReader.readAsBinaryString(fileToRead);
} else {

@@ -368,4 +398,6 @@ fileReader.readAsText(fileToRead, params.encoding);

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -411,4 +443,6 @@ var exNode = document.getElementById(params.id);

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -442,4 +476,6 @@ var exNode = document.getElementById(params.id);

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -476,4 +512,6 @@ var exNode = document.getElementById(params.id);

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -500,3 +538,4 @@ var exNode = document.getElementById(params.id);

if (!arr || !arr.length) return console.warn("no array to build select!");
if (!arr || !arr.length)
return console.warn("no array to build select!");

@@ -518,4 +557,6 @@ if ((typeof params == "function") && (typeof cb == "object")) {

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -559,3 +600,4 @@ var exNode = document.getElementById(params.id + "Select");

select.onchange = function() {
var selectedOptionNode = document.querySelector("option#" + params.id + "Option" + ":checked");
var selectedOptionNode =
document.querySelector("option#" + params.id + "Option" + ":checked");
if (selectedOptionNode) cb(selectedOptionNode.value);

@@ -574,4 +616,6 @@ };

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -598,3 +642,4 @@ var exNode = document.getElementById(params.id);

textarea.value = localStorage["textarea#" + params.id] || params.value || "";
textarea.value = localStorage["textarea#" + params.id] ||
params.value || "";

@@ -622,4 +667,6 @@ textarea.onkeyup = saveContents;

if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -646,5 +693,7 @@ params.className = "";

UI.button(actionParams, function() {
var textareaArr = textareaNode.value.trim().split(/\n\r?/).filter(function(a) {
return a;
});
var textareaArr = textareaNode.value
.trim()
.split(/\n\r?/).filter(function(a) {
return a;
});
cb(textareaArr);

@@ -693,7 +742,11 @@ });

params.tableId = params.tableId || params.id || "printedTable";
params.showColumns = params.showColumns || params.columns || params.cols || [];
params.showColumns = params.showColumns ||
params.columns || params.cols || [];
params.hideColumns = params.hideColumns || [];
if (typeof params.parent == "string") params.parent = document.querySelector(params.parent);
else params.parent = params.parent || document.querySelector("#ui") || document.body;
if (typeof params.parent == "string") {
params.parent = document.querySelector(params.parent);
} else params.parent = params.parent ||
document.querySelector("#ui") || document.body;

@@ -713,5 +766,6 @@ if (typeof params.hideHead != "boolean") params.hideHead = false;

for (var i = 0; i < arr.length; i++) { //собираем все ключи со всех объектов, а не только с первого
for (var i = 0; i < arr.length; i++) { //собираем ключи со всех объектов
for (var key in arr[i]) {
if ((columns.indexOf(key) == -1) && (params.hideColumns.indexOf(key) == -1)) {
if ((columns.indexOf(key) == -1) &&
(params.hideColumns.indexOf(key) == -1)) {
columns.push(key);

@@ -801,3 +855,4 @@

cell = cell.replace(params.quotes, "'");
if (reDateTimeJS.test(cell)) cell = new Date(cell).toLocaleDateString();
if (reDateTimeJS.test(cell)) cell =
new Date(cell).toLocaleDateString();
}

@@ -808,5 +863,11 @@

if (/<a.+<\/a>/.test(cell)) {
td.appendChild(new DOMParser().parseFromString(cell, "text/html").querySelector("a"));
td.appendChild(new DOMParser()
.parseFromString(cell, "text/html")
.querySelector("a"));
} else if (/<img.+?>/.test(cell)) {
td.appendChild(new DOMParser().parseFromString(cell, "text/html").querySelector("img"));
td.appendChild(new DOMParser()
.parseFromString(cell, "text/html")
.querySelector("img"));
} else {

@@ -826,3 +887,5 @@ td.appendChild(document.createTextNode(cell));

chBoxCol.onchange = function() {
var checkboxes = document.querySelectorAll("." + params.tableId + "RowCheckbox");
var checkboxes =
document.querySelectorAll("." + params.tableId + "RowCheckbox");
for (var i = 0; i < checkboxes.length; i++) {

@@ -835,2 +898,12 @@ checkboxes[i].checked = !checkboxes[i].checked;

UI.getTableSel = function(tableId) {
var checkboxes = document.querySelectorAll("." + tableId + "RowCheckbox");
var checkedArr = [];
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) checkedArr.push(i);
}
return checkedArr;
};
})();
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