update v0.0.2 twa sys
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
user-select: none
|
||||
}
|
||||
|
||||
a {,
|
||||
a {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
|
||||
@ -43,9 +43,9 @@
|
||||
.abs-table th {
|
||||
color: #fff;
|
||||
background-color: #36304a;
|
||||
padding: 20px 10px 20px;
|
||||
font-size: .9rem;
|
||||
font-weight: 500;
|
||||
padding: 18px 10px 18px;
|
||||
font-size: .82rem;
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
letter-spacing: .5px
|
||||
}
|
||||
@ -64,7 +64,7 @@
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
color: #808080;
|
||||
padding: 8px 15px
|
||||
padding: 15px
|
||||
}
|
||||
|
||||
.abs-container {
|
||||
|
||||
@ -53,7 +53,6 @@
|
||||
max-width: 100% !important
|
||||
}
|
||||
}
|
||||
|
||||
.ws-login {
|
||||
box-shadow: 0 2px 3px rgba(96, 96, 96, 0.1);
|
||||
background-color: #fff;
|
||||
@ -79,11 +78,12 @@
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.ws-login .title, .ws-login .desc {
|
||||
.ws-login .desc{
|
||||
font-size: .92rem;
|
||||
}
|
||||
|
||||
.ws-login .hint {
|
||||
font-size: .82rem;
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
|
||||
@ -109,8 +109,8 @@
|
||||
margin-right: -15px;
|
||||
}
|
||||
|
||||
.frm-input, .frm-header {
|
||||
padding: 0 15px;
|
||||
.frm-input, .frm-header, .c_validation {
|
||||
padding: 0 5px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
@ -162,4 +162,10 @@
|
||||
|
||||
.frm-input .c-input:not(.line) input:hover, .frm-input .c-input:not(.line) input:focus, .frm-input .con-aselect.active .aselect {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.main-login a {
|
||||
color: #454545;
|
||||
font-size: .85rem;
|
||||
font-weight: 600
|
||||
}
|
||||
@ -28,6 +28,7 @@ html {
|
||||
font-weight: 500;
|
||||
}
|
||||
a{
|
||||
position: relative;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
@ -73,8 +74,10 @@ body[page="10001"] #header {
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: 600;
|
||||
color: #5e5873;
|
||||
margin-bottom: 5px
|
||||
color: #5e5873
|
||||
}
|
||||
h2{
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
h5 {
|
||||
@ -332,7 +335,7 @@ nav {
|
||||
cursor:pointer
|
||||
}
|
||||
|
||||
.active .more span{
|
||||
.active .more span {
|
||||
-webkit-transform: rotate(90deg);
|
||||
-moz-transform: rotate(90deg);
|
||||
-ms-transform: rotate(90deg);
|
||||
@ -340,7 +343,8 @@ nav {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.more span {
|
||||
transition: all .3s ease-in;
|
||||
display: inline-block;
|
||||
transition: all .3s ease-in-out;
|
||||
transform: rotate(0)
|
||||
}
|
||||
.more {
|
||||
@ -464,6 +468,16 @@ nav {
|
||||
right: 0
|
||||
}
|
||||
|
||||
.card-body .dropdown{
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.card-body .sub-item{
|
||||
box-shadow: none !important;
|
||||
position: relative !important
|
||||
}
|
||||
|
||||
|
||||
.card-body {
|
||||
border-radius: var(--border-radius);
|
||||
padding: 20px 20px;
|
||||
@ -793,6 +807,40 @@ nav {
|
||||
box-shadow: 0 3px 10px 0 rgb(34 41 47 / 10%);
|
||||
}
|
||||
|
||||
.amultitag .item{
|
||||
transition: all .3s ease-in-out;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius);
|
||||
margin: 5px;
|
||||
background: var(--color-primary);
|
||||
padding: 5px 10px;
|
||||
font-size: .8rem;
|
||||
color: #fff
|
||||
}
|
||||
.amultitag .item .con-ico {
|
||||
margin-left: 0;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
color: #5e5873;
|
||||
visibility: hidden;
|
||||
width: 0;
|
||||
transition-delay: 0;
|
||||
transition: width .3s ease-in-out, visibility .3s ease-in-out;
|
||||
transition-delay: .3s;
|
||||
transition: background .3s ease-in-out, margin-left .3s ease-in-out
|
||||
}
|
||||
.amultitag .item:hover .con-ico {
|
||||
margin-left: 10px;
|
||||
background: #fff;
|
||||
visibility: visible;
|
||||
width: 20px
|
||||
}
|
||||
|
||||
.amultitag .item:hover .con-ico:hover{
|
||||
color:#fff;
|
||||
background: var(--secondary);
|
||||
}
|
||||
|
||||
.form-group input, .form-group .aselect, .form-group textarea {
|
||||
font-size: .85rem;
|
||||
width: 100%;
|
||||
@ -1210,17 +1258,17 @@ input[type=checkbox] {
|
||||
top: 50%;
|
||||
transform: translateY(-50%)
|
||||
}
|
||||
.mess-info{
|
||||
[class^=mess_] {
|
||||
font-size: .82rem;
|
||||
font-weight: 400;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.mess-success {
|
||||
.mess_success {
|
||||
color: #28c76f;
|
||||
}
|
||||
|
||||
.mess-error {
|
||||
.mess_error {
|
||||
color: #ea5455;
|
||||
}
|
||||
|
||||
@ -1261,10 +1309,10 @@ input[type=checkbox] {
|
||||
background-color: #7367f0;
|
||||
box-shadow: 0 .125rem .25rem rgba(165, 163, 174, .3);
|
||||
}
|
||||
|
||||
|
||||
.animationSlide {
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.animationSlide .slideContent {
|
||||
@ -1273,11 +1321,16 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.animationSlide .tabcontent.show {
|
||||
visibility: visible;
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.animationSlide .tabcontent {
|
||||
opacity: 0;
|
||||
transition: .3s all ease-in-out
|
||||
visibility:hidden;
|
||||
height: 0;
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
.animationFade .tabcontent {
|
||||
@ -1302,4 +1355,10 @@ input[type=checkbox] {
|
||||
.awStorageConnector .tabcontent .form-group{
|
||||
padding: 0;
|
||||
}
|
||||
/*******************End Page**********************/
|
||||
/*******************End Page**********************/
|
||||
|
||||
|
||||
/*********Login Form**********/
|
||||
.c_validation{
|
||||
margin-bottom: 15px !important
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import AWizard from "/js/libs/js-AWizard.js";
|
||||
import AButton from "/js/libs/js-AButton.js";
|
||||
|
||||
window.L10001 = function () {
|
||||
Waves.attach('.btn-effect', ['waves-float']);
|
||||
@ -18,6 +19,49 @@ window.L10001 = function () {
|
||||
navSignUp.addEventListener("click", (e) => {
|
||||
wrd1.nextPage(2);
|
||||
});
|
||||
|
||||
window.requestTimeout(() => {
|
||||
const v = document.querySelector(".c-login");
|
||||
let top = (v.parentElement.clientHeight / 2) - (v.clientHeight / 2);
|
||||
if (v.clientHeight <= window.innerHeight) {
|
||||
top = top - (window.innerHeight - v.clientHeight) / 2
|
||||
} else {
|
||||
top = top - 40;
|
||||
}
|
||||
|
||||
if (window.getOS() == "iOS") {
|
||||
} else {
|
||||
window.smScroll.scrollTop = top;
|
||||
}
|
||||
}, 500);
|
||||
|
||||
let btn = new AButton(document.getElementById("SignIn"));
|
||||
btn.on("click_SignIn", (el) => {
|
||||
btn.AddLoading(el);
|
||||
document.querySelector("#frm_login_summary .mess_error").innerHTML = "";
|
||||
let promise = new Promise(async function (resolve, reject) {
|
||||
const fd = new FormData();
|
||||
fd.append("username", document.getElementById("txtUser").value);
|
||||
fd.append("password", document.getElementById("txtPass").value)
|
||||
const response = await fetch(`/Login/SignIn`, {
|
||||
method: 'POST',
|
||||
body: fd
|
||||
});
|
||||
const data = await response.json();
|
||||
if (data) {
|
||||
switch (data.Status) {
|
||||
case 0:
|
||||
document.querySelector("#frm_login_summary .mess_error").innerHTML = data.Message;
|
||||
break;
|
||||
case 1:
|
||||
window.app.initNavApp("/");
|
||||
break;
|
||||
}
|
||||
btn.RemoveLoading(el);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function ComeBack(e, wrd) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,6 @@ class AsyncLayout extends ALayout {
|
||||
super.dispose();
|
||||
}
|
||||
renderMenu() {
|
||||
console.log("ÁDASD");
|
||||
this.isLoaded = true;
|
||||
var asyncStyleSheets = [
|
||||
'https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap',
|
||||
@ -46,9 +45,6 @@ class AsyncLayout extends ALayout {
|
||||
window.app.initScrollBar();
|
||||
window.Scrollbar.init(document.querySelector('.mini-scrollbar'), sOption);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,16 +22,9 @@ class LoginLayout extends ALayout {
|
||||
window.app.loadCSS(asyncStyleSheets);
|
||||
window.app.initNavs("Login");
|
||||
|
||||
var sOption = {
|
||||
damping: (window.getOS() == "Android") ? .06 : .04,
|
||||
thumbMinSize: 25,
|
||||
renderByPixel: true,
|
||||
alwaysShowTracks: true,
|
||||
continuousScrolling: true
|
||||
};
|
||||
|
||||
window.Scrollbar.use(window.OverscrollPlugin);
|
||||
window.app.initScrollBar();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,12 +44,16 @@
|
||||
}).bind(this);
|
||||
break;
|
||||
case "Slide":
|
||||
var slideC = document.createElement("div");
|
||||
slideC.classList.add("slideContent");
|
||||
while (this.params.parent.childNodes.length > 0) {
|
||||
slideC.appendChild(this.params.parent.childNodes[0]);
|
||||
var slideC = this.params.parent.querySelector(".slideContent");
|
||||
if (slideC == null) {
|
||||
slideC = document.createElement("div");
|
||||
slideC.classList.add("slideContent");
|
||||
while (this.params.parent.childNodes.length > 0) {
|
||||
slideC.appendChild(this.params.parent.childNodes[0]);
|
||||
}
|
||||
this.params.parent.appendChild(slideC);
|
||||
}
|
||||
this.params.parent.appendChild(slideC);
|
||||
|
||||
|
||||
slideC.querySelectorAll(".tabcontent").forEach((el) => {
|
||||
let style = this.params.parent.currentStyle || window.getComputedStyle(this.params.parent);
|
||||
|
||||
@ -51,7 +51,6 @@ export default class Dropdown extends window.AObject {
|
||||
if (this.isLock) {
|
||||
return;
|
||||
}
|
||||
console.log("Asdasd");
|
||||
var t1 = e.currentTarget;
|
||||
var p = t1.closest('[data-dropdown]');
|
||||
var p1 = e.target.closest(".noopen");
|
||||
|
||||
@ -10,10 +10,10 @@ export default class AMenu extends window.AObject {
|
||||
this.navD = document.querySelector(nav);
|
||||
this.transition = new ATransitionEffect();
|
||||
this.overlay = new AOverlay(document.body);
|
||||
|
||||
|
||||
this.isMDiffD = isMDiffD;
|
||||
this.changeActive();
|
||||
|
||||
|
||||
if (btnMs != null) {
|
||||
if (!(Array.isArray(btnMs) || btnMs instanceof NodeList || btnMs instanceof HTMLCollection)) {
|
||||
const tmp = [];
|
||||
@ -21,14 +21,14 @@ export default class AMenu extends window.AObject {
|
||||
btnMs = tmp;
|
||||
}
|
||||
btnMs.forEach((el => {
|
||||
|
||||
|
||||
var f = function (e) {
|
||||
this.mobileMenu.call(this, e, el);
|
||||
}.bind(this);
|
||||
el.addEventListener(this.eventName, f, false);
|
||||
this.addSystemEvent(this.eventName, el, f, "icomenu");
|
||||
this.listIco.push(el);
|
||||
|
||||
|
||||
}).bind(this));
|
||||
this.overlay.createOverlay();
|
||||
this.overlay.setIndex(2000);
|
||||
@ -54,7 +54,7 @@ export default class AMenu extends window.AObject {
|
||||
this.initNav(this.navM, "M");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
initNav(ele, type = "D") {
|
||||
let arr = ele.querySelectorAll(".nav-i.has-sub .nav-link, .navmain > .nav-i:not(.has-sub) a");
|
||||
Array.from(arr).forEach(el => {
|
||||
@ -81,10 +81,10 @@ export default class AMenu extends window.AObject {
|
||||
}
|
||||
updateIdPage() {
|
||||
this.idPage = document.head.querySelector("meta[name=idPage]").content;
|
||||
|
||||
|
||||
this.navActiveD = this.navD.querySelector("a[nav-id='" + this.idPage + "']");
|
||||
if (this.isMDiffD) {
|
||||
this.navActiveM = this.navM.querySelector("a[nav-id='" + this.idPage + "']");
|
||||
this.navActiveM = this.navM.querySelector("a[nav-id='" + this.idPage + "']");
|
||||
}
|
||||
window.removeStopCollapsed();
|
||||
}
|
||||
@ -140,7 +140,7 @@ export default class AMenu extends window.AObject {
|
||||
}
|
||||
}).bind(this));
|
||||
}).bind(this), 100);
|
||||
|
||||
|
||||
}
|
||||
closeExpandMenu() {
|
||||
Array.from(this.navM.querySelectorAll(".nav-i.has-sub")).forEach(el => {
|
||||
|
||||
@ -52,7 +52,9 @@ export default class AModal extends window.AObject {
|
||||
showModal() {
|
||||
this.overlay.showOverlay();
|
||||
}
|
||||
|
||||
removeModal() {
|
||||
this.overlay.removeOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
class AModalOK {
|
||||
|
||||
@ -3,8 +3,8 @@ export default class AMultiTag extends window.AObject {
|
||||
super();
|
||||
this.parent = ele;
|
||||
this.cItems = ele.querySelector(".input-content");
|
||||
this.itemEles = [];
|
||||
this.itemDatas = [];
|
||||
this.itemEles = new Map();
|
||||
this.itemDatas = new Map();
|
||||
this.btnAdd = ele.querySelector(".btn-Add");
|
||||
this.btnAdd.addEventListener("click", ((e) => {
|
||||
this.parent.classList.add("active");
|
||||
@ -16,6 +16,11 @@ export default class AMultiTag extends window.AObject {
|
||||
}
|
||||
initGlobalVar() {
|
||||
var f = function (ev) {
|
||||
const close = ev.target.closest(".con-ico");
|
||||
if (close) {
|
||||
const t = close.closest(".item[data-id]");
|
||||
if (t) this.removeItem(1 * t.getAttribute("data-id"));
|
||||
}
|
||||
if (ev.target.closest(".amultitag") || ev.target.closest(".c-aoverlay")) {
|
||||
return;
|
||||
} else {
|
||||
@ -26,22 +31,32 @@ export default class AMultiTag extends window.AObject {
|
||||
window.AMultiTag = true;
|
||||
}
|
||||
addItem(id, name, obj, action = null) {
|
||||
var ele = this.addItem(id, name, action);
|
||||
this.itemEles.push(ele);
|
||||
this.itemDatas.push(obj);
|
||||
var ele = this.createItem(id, name, action);
|
||||
this.itemEles.set(id, ele);
|
||||
this.itemDatas.set(id, obj);
|
||||
this.cItems.appendChild(ele);
|
||||
}
|
||||
removeItem(id) {
|
||||
const t = this.itemEles.get(id);
|
||||
this.itemDatas.delete(id);
|
||||
this.itemEles.delete(id);
|
||||
t.remove();
|
||||
}
|
||||
createItem(id, name, action) {
|
||||
var p = document.createElement("div");
|
||||
p.setAttribute("data-id", id);
|
||||
p.classList.add("item");
|
||||
p.classList.add("item", "d-f", "a-i-center");
|
||||
var label = document.createElement("span");
|
||||
label.innerHTML = name;
|
||||
label.classList.add("name");
|
||||
if (action != null) {
|
||||
p.appendChild(action);
|
||||
}
|
||||
let close = document.createElement("div");
|
||||
close.classList.add("con-ico", "d-f", "a-i-center", "j-c-center");
|
||||
p.appendChild(label);
|
||||
close.innerHTML = `<span class="atg a-1x atg-x"></span>`;
|
||||
p.appendChild(close);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@ -182,6 +182,7 @@ class ASelectEle extends window.AObject {
|
||||
if (this.selectedEleItem != null) this.selectedEleItem.classList.remove("active");
|
||||
this.selectedEleItem = this.listItems[idx].element;
|
||||
this.selectedItem = this.listItems[idx];
|
||||
|
||||
this.removeAllChildNodes(this.cSelectedItem);
|
||||
this.cloneNodes(this.selectedEleItem, this.cSelectedItem);
|
||||
this.setElement(this.selectedEleItem);
|
||||
@ -398,7 +399,6 @@ class ASelectEle extends window.AObject {
|
||||
}
|
||||
if (tmp != null && tmp.classList.contains("a-option")) {
|
||||
this.updateIndex(tmp.getAttribute("index"));
|
||||
console.log(tmp.offsetTop);
|
||||
this.scroll.scrollIntoView(tmp, {
|
||||
alignToTop: false,
|
||||
offsetBottom: 0,
|
||||
|
||||
69
TWASys-App/wwwroot/js/libs/js-ASlideDown.js
Normal file
69
TWASys-App/wwwroot/js/libs/js-ASlideDown.js
Normal file
@ -0,0 +1,69 @@
|
||||
import ATransitionEffect from '/js/libs/js-ATransitionEffect.js'
|
||||
|
||||
export default class ASlideDown extends window.AObject {
|
||||
constructor(el) {
|
||||
super();
|
||||
this._eleM = [];
|
||||
if (el instanceof NodeList) {
|
||||
Array.from(el).forEach((e) => {
|
||||
this._eleM.push(new ASlideDownEle(e))
|
||||
});
|
||||
} else {
|
||||
this._eleM.push(new ASlideDownEle(el));
|
||||
}
|
||||
}
|
||||
get(i) {
|
||||
return this._eleM[i];
|
||||
}
|
||||
}
|
||||
|
||||
class ASlideDownEle extends window.AObject {
|
||||
constructor(ele) {
|
||||
super();
|
||||
this.transition = new ATransitionEffect();
|
||||
this._ele = ele;
|
||||
this._pCon = ele.closest('[data-dropdown]');
|
||||
this._subI = this._pCon.querySelector(".sub-item");
|
||||
var f = function (ev) {
|
||||
if (window.isValidPointerClick(ev)) return;
|
||||
this.onClick.call(this, ev);
|
||||
}.bind(this);
|
||||
this.addSystemEvent(this.eventName, this._ele, f);
|
||||
}
|
||||
enable() {
|
||||
this._ele.classList.remove("disabled");
|
||||
}
|
||||
disable() {
|
||||
this._ele.classList.add("disabled");
|
||||
}
|
||||
enable_Open() {
|
||||
this.enable();
|
||||
this.open();
|
||||
}
|
||||
disable_Close() {
|
||||
this.disable();
|
||||
this.close();
|
||||
}
|
||||
open() {
|
||||
if (this._ele.classList.contains("disabled")) {
|
||||
return;
|
||||
}
|
||||
this._pCon.classList.add("active");
|
||||
this.transition.expandEffect(this._subI, function () {
|
||||
this.trigger("opened");
|
||||
}.bind(this));
|
||||
}
|
||||
close() {
|
||||
this._pCon.classList.remove("active");
|
||||
this.transition.collapsedEffect(this._subI, function () {
|
||||
this.trigger("closed");
|
||||
}.bind(this));
|
||||
}
|
||||
onClick(e) {
|
||||
if (this._pCon.classList.contains("active")) {
|
||||
this.close();
|
||||
} else {
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,14 @@ export default class AWizard extends ATab {
|
||||
Cancel
|
||||
</button>
|
||||
</div>`;
|
||||
|
||||
|
||||
const ro = new ResizeObserver((entries => {
|
||||
for (const e of entries) {
|
||||
const { width, height } = e.contentRect;
|
||||
this.aAnimation.setType(this.typeAnimation, { "parent": this.tabContents });
|
||||
}
|
||||
}).bind(this));
|
||||
ro.observe(this.tabContents);
|
||||
}
|
||||
showPage(i) {
|
||||
this.cPage = i;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
this.pElement = e;
|
||||
this.Headers = [];
|
||||
this.lSysRows = [];
|
||||
this.labelID = "";
|
||||
this.InitStructure();
|
||||
this.InitCss();
|
||||
this.SetIdCheckBox();
|
||||
@ -18,7 +19,8 @@
|
||||
}
|
||||
}
|
||||
SetScrollBarY(height) {
|
||||
this.absContainerRows.style.height = height + "px";
|
||||
this.absContainerRows.style.height = "auto";
|
||||
this.absContainerRows.style.maxHeight = height + "px";
|
||||
}
|
||||
AddHeader(name, width, minWidth, id = "", rowTemp = null) {
|
||||
var d = document.createElement("th");
|
||||
@ -184,10 +186,15 @@
|
||||
this.data.forEach((e, i) => {
|
||||
var r = document.createElement("tr");
|
||||
r.setAttribute("data-id", i);
|
||||
this.Headers.forEach((o) => {
|
||||
this.Headers.forEach((o, j) => {
|
||||
|
||||
var td = document.createElement("td");
|
||||
if (o.rowTemp != null) {
|
||||
td.appendChild(o.rowTemp(i, e));
|
||||
const rT = o.rowTemp(i, e);
|
||||
if (this.isCheckBox && j < 1) {
|
||||
rT.setAttribute("id", (this.labelID.length >0)?e[this.labelID]:"");
|
||||
}
|
||||
td.appendChild(rT);
|
||||
} else {
|
||||
td.innerHTML = e[o.id];
|
||||
}
|
||||
|
||||
@ -104,14 +104,14 @@ window.getOS = function () {
|
||||
return os;
|
||||
}
|
||||
|
||||
window.GetAbsoluteURL = function(relativeURL) {
|
||||
window.GetAbsoluteURL = function (relativeURL) {
|
||||
if (relativeURL.startsWith(window.location.origin)) {
|
||||
return relativeURL;
|
||||
}
|
||||
return window.location.origin + relativeURL;
|
||||
}
|
||||
|
||||
window.getPathFromUrl = function(url) {
|
||||
window.getPathFromUrl = function (url) {
|
||||
const parsed = new URL(url);
|
||||
return parsed.pathname + parsed.search + parsed.hash;
|
||||
}
|
||||
@ -377,9 +377,9 @@ window.AObject = class {
|
||||
const eventMap = this.systemEvents.get(element);
|
||||
if (eventMap) {
|
||||
const data = eventMap.get(eventName);
|
||||
|
||||
|
||||
if (data && typeof data.callback === 'function') {
|
||||
element.removeEventListener(eventName , data.callback, false);
|
||||
element.removeEventListener(eventName, data.callback, false);
|
||||
eventMap.delete(eventName);
|
||||
// Nếu element không còn event nào, xóa khỏi systemEvents
|
||||
if (eventMap.size === 0) {
|
||||
@ -387,7 +387,7 @@ window.AObject = class {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.parentEventMap.delete(parent);
|
||||
}
|
||||
@ -406,7 +406,7 @@ window.AObject = class {
|
||||
}
|
||||
addCustomEvent(id, element, groups = null) {
|
||||
if (!this.customEvents.has(id)) {
|
||||
this.customEvents.set(id, { "ele":element, "groups":groups });
|
||||
this.customEvents.set(id, { "ele": element, "groups": groups });
|
||||
}
|
||||
if (groups) {
|
||||
if (!this.parentEventMap.has("Custom" + parent)) {
|
||||
@ -429,6 +429,7 @@ window.AObject = class {
|
||||
}
|
||||
this.parentEventMap.get(parent).add({ element, eventName });
|
||||
}
|
||||
|
||||
}
|
||||
removeAllChildNodes(parent) {
|
||||
while (parent.firstChild) {
|
||||
@ -541,12 +542,11 @@ class AApp extends window.AObject {
|
||||
this.metaPage = document.head.querySelector("meta[name=idPage]");
|
||||
this.pageName = this.metaPage.getAttribute("pageName");
|
||||
this.lName = this.metaPage.getAttribute("layName");
|
||||
console.log(this.lName);
|
||||
var tmp = document.querySelector(container);
|
||||
this.mainApp = tmp.querySelector("[main-content]") ? tmp.querySelector("[main-content]") : tmp;
|
||||
var f = function (ev) {
|
||||
if (ev.state) {
|
||||
this.cachePage.get(ev.state.url, ((result) => {
|
||||
this.cachePage.get(ev.state.url, ((result) => {
|
||||
if (result == null) {
|
||||
|
||||
} else {
|
||||
@ -655,7 +655,7 @@ class AApp extends window.AObject {
|
||||
this.addSystemEvent("click", el, f1, groups)
|
||||
const f2 = (function (ev) {
|
||||
if (window.isValidPointerClick(ev)) return;
|
||||
|
||||
|
||||
this.initNavApp(ev.currentTarget.getAttribute("href"), ev.currentTarget.hasAttribute("isflexpage"));
|
||||
}).bind(this);
|
||||
this.addSystemEvent(this.eventName, el, f2, groups);
|
||||
@ -689,8 +689,7 @@ class AApp extends window.AObject {
|
||||
doc: doc,
|
||||
dynamicF: a.dynamicF
|
||||
};
|
||||
|
||||
this.setContentPage(obj, url);
|
||||
this.setContentPage(obj, url);
|
||||
} else {
|
||||
this.getPage(url, result)
|
||||
}
|
||||
@ -699,17 +698,6 @@ class AApp extends window.AObject {
|
||||
this.getPage(url);
|
||||
}
|
||||
}).bind(this));
|
||||
//if (flex) {
|
||||
|
||||
//} else {
|
||||
// this.cachePage.get(url, ((result) => {
|
||||
// if (result) {
|
||||
// // Set content page từ cache
|
||||
// } else {
|
||||
// this.getPage(url); // Load mới nếu chưa có trong cache
|
||||
// }
|
||||
// }).bind(this));
|
||||
//}
|
||||
}
|
||||
loadContentPage(content) {
|
||||
const tpl = document.createElement('template');
|
||||
@ -723,12 +711,10 @@ class AApp extends window.AObject {
|
||||
document.title = page.title + " - " + this.pageName;
|
||||
var meta = document.head.querySelector("meta[name=idPage]");
|
||||
document.body.setAttribute("page", page.idPage);
|
||||
|
||||
meta.content = page.idPage;
|
||||
this.lName = page.lName;
|
||||
meta.setAttribute("layName", page.lName);
|
||||
meta.setAttribute("layName", page.lName);
|
||||
this.loadContentPage(page.html);
|
||||
window.history.pushState({"url":url}, page.title, url);
|
||||
window.history.pushState({ "url": url }, page.title, url);
|
||||
}
|
||||
setContentPage(page, url) {
|
||||
this.contentPage(page, url);
|
||||
@ -778,7 +764,6 @@ class AApp extends window.AObject {
|
||||
loadedPage() {
|
||||
this.metaPage = document.head.querySelector("meta[name=idPage]");
|
||||
if (this.metaPage != null && this.isLoadedLayout) {
|
||||
console.log(window.location.href);
|
||||
this.cachePage.searchFlexPage(window.getPathFromUrl(window.location.href), ((tmp) => {
|
||||
tmp = tmp.layout.info;
|
||||
if (tmp != null && tmp.dynamicF != null) {
|
||||
@ -790,7 +775,7 @@ class AApp extends window.AObject {
|
||||
this.initNavs(this.metaPage.content);
|
||||
this.trigger("pageLoaded", null);
|
||||
}).bind(this));
|
||||
|
||||
|
||||
} else {
|
||||
window.requestTimeout(this.loadedPage.bind(this), 10, window.registerCancel);
|
||||
}
|
||||
@ -803,9 +788,9 @@ class AApp extends window.AObject {
|
||||
console.log("connect new Layout");
|
||||
this.loadLayout(); // Load mới nếu chưa có trong cache
|
||||
}
|
||||
|
||||
|
||||
}).bind(this), "layout");
|
||||
|
||||
|
||||
}
|
||||
loadLayout() {
|
||||
(function () {
|
||||
@ -825,10 +810,9 @@ class AApp extends window.AObject {
|
||||
}).bind(this)();
|
||||
}
|
||||
loadedLayout() {
|
||||
console.log(this.lName);
|
||||
if (this.lName !== "None") {
|
||||
const l = window.ALayout.get(this.lName);
|
||||
if (!l.isLoaded) {
|
||||
if (!l.isLoaded) {
|
||||
l.renderMenu();
|
||||
this.isLoadedLayout = true;
|
||||
this.trigger("layoutLoaded", null);
|
||||
@ -928,7 +912,7 @@ class CacheManager {
|
||||
|
||||
// Lấy thông tin trang hoặc layout
|
||||
|
||||
|
||||
|
||||
// Lấy dữ liệu từ cache (localStorage hoặc IndexedDB nếu cần)
|
||||
get(id, callback, type = "cahce") {
|
||||
this._onReady(() => {
|
||||
@ -986,7 +970,7 @@ class CacheManager {
|
||||
this.countFP++;
|
||||
}
|
||||
this.storage.set("treePage", this.flexPages.toJSON(), function () { });
|
||||
} else {
|
||||
} else {
|
||||
const layout = {
|
||||
Content: obj.Content,
|
||||
Scripts: obj.Scripts
|
||||
@ -1054,7 +1038,7 @@ class CacheStorage {
|
||||
del.onblocked = () => {
|
||||
console.warn("deleteDatabase blocked (tab khác đang giữ kết nối)");
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
_flushQueue() {
|
||||
while (this.queue.length) {
|
||||
@ -1104,7 +1088,7 @@ class CacheStorage {
|
||||
}
|
||||
});
|
||||
}
|
||||
set(key, data, callback = () => { }, type="cache") {
|
||||
set(key, data, callback = () => { }, type = "cache") {
|
||||
this._onReady(() => {
|
||||
if (this.db) {
|
||||
let tx, store, req;
|
||||
@ -1117,7 +1101,7 @@ class CacheStorage {
|
||||
store = tx.objectStore("cache");
|
||||
store.put({ key: this._key(key), value: data, ts: Date.now() });
|
||||
}
|
||||
|
||||
|
||||
tx.oncomplete = () => callback(null);
|
||||
tx.onerror = (e) => callback(e);
|
||||
} else {
|
||||
@ -1126,7 +1110,7 @@ class CacheStorage {
|
||||
localStorage.setItem(this._key(key), JSON.stringify({ data, ts: Date.now() }));
|
||||
callback(null);
|
||||
} catch (e) {
|
||||
|
||||
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user