window.NetCallJs = {
|
delTableCol: function (parentID, columnId) {
|
try {
|
const owner = document.querySelector("#" + parentID);
|
if (owner == null) { return; }
|
const tab = owner.querySelector("table");
|
var rows = tab.rows;
|
if (rows == null) { return; }
|
var columnLength = rows.item(0).cells.length;
|
if (columnLength > columnId) {
|
for (var i = 0; i < tab.rows.length; i++) {
|
tab.rows[i].deleteCell(columnId);
|
}
|
}
|
}
|
catch (error) {
|
console.log(error);
|
}
|
},
|
|
setTableWidth: function (parentID, w) {
|
const owner = document.querySelector("#" + parentID);
|
const table = owner.querySelector("table");
|
table.setAttribute('style', 'table-layout: fixed;');
|
table.style.width = w;
|
},
|
|
setTableStyle: function (parentID, s) {
|
const owner = document.querySelector("#" + parentID);
|
const table = owner.querySelector("table");
|
table.setAttribute('style', s);
|
},
|
|
removeTableClass: function (parentID, s) {
|
const owner = document.querySelector("#" + parentID);
|
const table = owner.querySelector("table");
|
table.classList.remove(s);
|
},
|
|
setTRTop: function (parentID, i) {
|
const owner = document.querySelector("#" + parentID);
|
const scrollParent = owner.querySelector(".mud-table-container");
|
const tr = scrollParent.querySelectorAll("tr")[i];
|
scrollParent.scrollTop = tr.offsetTop;
|
},
|
|
clearA: function () {
|
document.querySelector("a.active")?.classList.remove("active");
|
},
|
|
hideGlobalLoadingSpinner: function () {
|
document.body.classList.remove('loading');
|
},
|
|
hideGlobalLoadingSpinnerLogo: function () {
|
document.body.classList.remove('loading-logo');
|
},
|
|
showGlobalLoadingSpinner: function () {
|
document.body.classList.add('loading');
|
},
|
|
removeCss: function (el, cssName) {
|
el.classList.remove(cssName);
|
},
|
|
getClientRectByID: function (elementId) {
|
return document.getElementById(elementId).getBoundingClientRect();
|
},
|
|
getClientRect: function (el) {
|
return el.getBoundingClientRect();
|
},
|
|
getScroll: function (el) {
|
return {
|
scrollTop: el.scrollTop,
|
scrollLeft: el.scrollLeft,
|
windowWidth: window.innerWidth,
|
windowHeight: window.innerHeight
|
};
|
},
|
|
getWindowSize: function () {
|
return {
|
width: window.innerWidth,
|
height: window.innerHeight
|
};
|
},
|
|
getInputValue: function (el) {
|
return el.value;
|
},
|
|
setInputValue: function (el, text) {
|
el.value = text;
|
},
|
|
getActiveElement: function () {
|
const el = document.activeElement;
|
return {
|
id: el.id,
|
tagName: el.tagName
|
};
|
},
|
|
setFocusByKey: function (key) {
|
const el = document.querySelector(key);
|
el.focus();
|
},
|
|
saveAsFile: function (fileName, type, bytesBase64, useBom) {
|
var browser = 0; // for Safari
|
if (window.navigator.msSaveBlob) {
|
browser = 1; // for IE、Edge
|
} else if (window.webkitURL && window.webkitURL.createObjectURL) {
|
browser = 3; // Chrome
|
} else if (window.URL && window.URL.createObjectURL) {
|
browser = 2; //Firefox、Chromeでも行く
|
}
|
|
if (browser > 0) {
|
var data = window.atob(bytesBase64);
|
var content = new Uint8Array(data.length);
|
for (var i = 0; i < data.length; i++) {
|
content[i] = data.charCodeAt(i);
|
}
|
var bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
|
//var blob = new Blob([bom, content], { type: type });
|
var blob = useBom ? new Blob([bom, content], { type: type }) : new Blob([content.buffer], { type: type });
|
|
if (browser === 1) {
|
window.navigator.msSaveBlob(blob, fileName)
|
} else {
|
var a = document.createElement('a');
|
a.download = fileName;
|
a.target = '_blank';
|
|
if (browser === 2) {
|
a.href = window.URL.createObjectURL(blob);
|
document.body.appendChild(a);
|
a.click();
|
document.body.removeChild(a);
|
} else {
|
a.href = window.webkitURL.createObjectURL(blob);
|
a.click();
|
}
|
}
|
} else {
|
window.open('data:' + type + ';base64,' + bytesBase64, '_blank');
|
}
|
}
|
};
|