isobit-ui 0.0.285 → 0.0.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +265 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* isobit-ui v0.0.
|
|
2
|
+
* isobit-ui v0.0.288
|
|
3
3
|
* (c) Erik Alarcon Pinedo
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -4779,9 +4779,8 @@ var resize = function resize() {
|
|
|
4779
4779
|
ww[0].childNodes[kk].style.overflowY = 'auto';
|
|
4780
4780
|
break;
|
|
4781
4781
|
}
|
|
4782
|
-
}
|
|
4782
|
+
} //console.log(ww[0].childNodes);
|
|
4783
4783
|
|
|
4784
|
-
console.log(ww[0].childNodes);
|
|
4785
4784
|
}
|
|
4786
4785
|
}
|
|
4787
4786
|
};
|
|
@@ -4832,6 +4831,19 @@ function HTML2Canvas(props) {
|
|
|
4832
4831
|
};
|
|
4833
4832
|
}
|
|
4834
4833
|
|
|
4834
|
+
var f = {
|
|
4835
|
+
value: function value(v) {
|
|
4836
|
+
var a = this;
|
|
4837
|
+
|
|
4838
|
+
for (var i = 0; i < a.length; i++) {
|
|
4839
|
+
if (a[i] == v) return true;
|
|
4840
|
+
}
|
|
4841
|
+
|
|
4842
|
+
return false;
|
|
4843
|
+
}
|
|
4844
|
+
};
|
|
4845
|
+
if (![].contains) Object.defineProperty(Array.prototype, 'contains', f);
|
|
4846
|
+
if (!"".contains) Object.defineProperty(String.prototype, 'contains', f);
|
|
4835
4847
|
_ = Object.assign(_, {
|
|
4836
4848
|
remoteServer: '',
|
|
4837
4849
|
_id: 0,
|
|
@@ -4842,16 +4854,256 @@ _ = Object.assign(_, {
|
|
|
4842
4854
|
varMap: {},
|
|
4843
4855
|
id: function id() {
|
|
4844
4856
|
return ++_._id;
|
|
4845
|
-
}
|
|
4846
|
-
|
|
4857
|
+
},
|
|
4858
|
+
findForm: function findForm(e) {
|
|
4859
|
+
var parent = e.parentNode;
|
|
4847
4860
|
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
}
|
|
4861
|
+
if (parent && parent.tagName != 'FORM') {
|
|
4862
|
+
parent = _.findForm(parent);
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
return parent;
|
|
4866
|
+
},
|
|
4867
|
+
contains: function contains(a, b) {
|
|
4868
|
+
return a && a.includes(b);
|
|
4869
|
+
},
|
|
4870
|
+
uiParent: function uiParent(e) {
|
|
4871
|
+
return e.ui || !e ? e : _.uiParent(e.$parent);
|
|
4872
|
+
},
|
|
4873
|
+
closest: function closest(el, sel) {
|
|
4874
|
+
while ((el = el.parentElement) && !(el.matches || el.matchesSelector).call(el, sel)) {
|
|
4875
|
+
}
|
|
4854
4876
|
|
|
4877
|
+
return el;
|
|
4878
|
+
},
|
|
4879
|
+
fadeOut: function fadeOut(id, val) {
|
|
4880
|
+
if (isNaN(val)) {
|
|
4881
|
+
val = 9;
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4884
|
+
document.getElementById(id).style.opacity = '0.' + val; //For IE
|
|
4885
|
+
|
|
4886
|
+
document.getElementById(id).style.filter = 'alpha(opacity=' + val + '0)';
|
|
4887
|
+
|
|
4888
|
+
if (val > 0) {
|
|
4889
|
+
val--;
|
|
4890
|
+
setTimeout('fadeOut("' + id + '",' + val + ')', 90);
|
|
4891
|
+
} else {
|
|
4892
|
+
return;
|
|
4893
|
+
}
|
|
4894
|
+
},
|
|
4895
|
+
fadeIn: function fadeIn(id, val) {
|
|
4896
|
+
// ID of the element to fade, Fade value[min value is 0]
|
|
4897
|
+
if (isNaN(val)) {
|
|
4898
|
+
val = 0;
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
document.getElementById(id).style.opacity = '0.' + val; //For IE
|
|
4902
|
+
|
|
4903
|
+
document.getElementById(id).style.filter = 'alpha(opacity=' + val + '0)';
|
|
4904
|
+
|
|
4905
|
+
if (val < 9) {
|
|
4906
|
+
val++;
|
|
4907
|
+
setTimeout('fadeIn("' + id + '",' + val + ')', 90);
|
|
4908
|
+
} else {
|
|
4909
|
+
return;
|
|
4910
|
+
}
|
|
4911
|
+
},
|
|
4912
|
+
whichChild: function whichChild(e) {
|
|
4913
|
+
var i = 0;
|
|
4914
|
+
|
|
4915
|
+
while ((e = e.previousSibling) != null) {
|
|
4916
|
+
++i;
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
return i;
|
|
4920
|
+
},
|
|
4921
|
+
mask: function mask(ms, cfg) {
|
|
4922
|
+
if (!document.body) return;
|
|
4923
|
+
var center = document.createElement("div");
|
|
4924
|
+
center.style = 'top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2';
|
|
4925
|
+
var s = center.style;
|
|
4926
|
+
s.left = '50%';
|
|
4927
|
+
s.textAlign = 'center';
|
|
4928
|
+
|
|
4929
|
+
if (ms !== false) {
|
|
4930
|
+
if (ms instanceof Element) {
|
|
4931
|
+
center = ms; //.append(ms);
|
|
4932
|
+
} else {
|
|
4933
|
+
if (ms) {
|
|
4934
|
+
var d = document.createElement('div');
|
|
4935
|
+
d.innerHTML = ms;
|
|
4936
|
+
center.append(d);
|
|
4937
|
+
center.style = "padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center";
|
|
4938
|
+
}
|
|
4939
|
+
|
|
4940
|
+
var img = document.createElement('div');
|
|
4941
|
+
s = img.style;
|
|
4942
|
+
s.width = '100%';
|
|
4943
|
+
s.height = '180px';
|
|
4944
|
+
img.className = 'loading';
|
|
4945
|
+
}
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
var p = document.createElement('div');
|
|
4949
|
+
s = p.style;
|
|
4950
|
+
s.height = '100%';
|
|
4951
|
+
s.top = '0px';
|
|
4952
|
+
s.position = 'absolute';
|
|
4953
|
+
s.left = '0';
|
|
4954
|
+
s.zIndex = 10000;
|
|
4955
|
+
s.width = '100%';
|
|
4956
|
+
var bg = document.createElement('div');
|
|
4957
|
+
s = bg.style;
|
|
4958
|
+
s.height = '100%';
|
|
4959
|
+
s.width = '100%';
|
|
4960
|
+
s.top = '0';
|
|
4961
|
+
s.position = 'absolute';
|
|
4962
|
+
s.left = '0';
|
|
4963
|
+
s.backgroundColor = 'rgba(0,0,0,0.5)';
|
|
4964
|
+
if (cfg && cfg.opacity) s.opacity = cfg.opacity;
|
|
4965
|
+
if (cfg && cfg.backgroundColor) s.backgroundColor = cfg.backgroundColor;
|
|
4966
|
+
p.appendChild(bg);
|
|
4967
|
+
p.appendChild(center);
|
|
4968
|
+
if (img) center.appendChild(img);
|
|
4969
|
+
document.body.appendChild(p);
|
|
4970
|
+
return p;
|
|
4971
|
+
},
|
|
4972
|
+
unmask: function unmask(m) {
|
|
4973
|
+
if (m) {
|
|
4974
|
+
m.style.display = "none";
|
|
4975
|
+
if (m.parentNode) m.parentNode.removeChild(m);
|
|
4976
|
+
}
|
|
4977
|
+
},
|
|
4978
|
+
clean: function clean(obj) {
|
|
4979
|
+
for (var propName in obj) {
|
|
4980
|
+
if (obj[propName] === '' || obj[propName] === null || obj[propName] === undefined) {
|
|
4981
|
+
delete obj[propName];
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
return obj;
|
|
4986
|
+
},
|
|
4987
|
+
processURL: function processURL(s) {
|
|
4988
|
+
//console.log(s);
|
|
4989
|
+
return s;
|
|
4990
|
+
},
|
|
4991
|
+
loadCSS: function loadCSS(url) {
|
|
4992
|
+
var head = document.getElementsByTagName('head')[0];
|
|
4993
|
+
var link = document.createElement('link'); //link.id = cssId;
|
|
4994
|
+
|
|
4995
|
+
link.rel = 'stylesheet';
|
|
4996
|
+
link.type = 'text/css';
|
|
4997
|
+
link.href = url;
|
|
4998
|
+
link.media = 'all';
|
|
4999
|
+
head.appendChild(link);
|
|
5000
|
+
},
|
|
5001
|
+
go: function go(u) {
|
|
5002
|
+
window.location = u;
|
|
5003
|
+
},
|
|
5004
|
+
getCurrentPosition: function getCurrentPosition() {
|
|
5005
|
+
return new Promise(function (res, rej) {
|
|
5006
|
+
if (_.location) {
|
|
5007
|
+
var id = 'result' + _.id();
|
|
5008
|
+
|
|
5009
|
+
_[id] = function (r) {
|
|
5010
|
+
delete _[id];
|
|
5011
|
+
|
|
5012
|
+
if (r.coords) {
|
|
5013
|
+
res(r);
|
|
5014
|
+
} else rej(r);
|
|
5015
|
+
};
|
|
5016
|
+
|
|
5017
|
+
_.location(id);
|
|
5018
|
+
} else if (navigator.geolocation) {
|
|
5019
|
+
navigator.geolocation.getCurrentPosition(res, rej);
|
|
5020
|
+
}
|
|
5021
|
+
});
|
|
5022
|
+
},
|
|
5023
|
+
URL: function URL(path) {
|
|
5024
|
+
var me = this;
|
|
5025
|
+
me.location = window.location;
|
|
5026
|
+
me.path = path ? path : window.location.pathname;
|
|
5027
|
+
var h = me.path.split('?');
|
|
5028
|
+
|
|
5029
|
+
if (h.length > 1) {
|
|
5030
|
+
me.path = h[0];
|
|
5031
|
+
h = h[1].split('#');
|
|
5032
|
+
me.query = h[0];
|
|
5033
|
+
} else {
|
|
5034
|
+
h = h[0].split('#');
|
|
5035
|
+
me.path = h[0];
|
|
5036
|
+
}
|
|
5037
|
+
|
|
5038
|
+
me.get = function (key, def) {
|
|
5039
|
+
if (me.query) {
|
|
5040
|
+
var kvp = me.query.split('&');
|
|
5041
|
+
var i = kvp.length;
|
|
5042
|
+
var x;
|
|
5043
|
+
|
|
5044
|
+
while (i--) {
|
|
5045
|
+
x = kvp[i].split('=');
|
|
5046
|
+
|
|
5047
|
+
if (x[0] == key) {
|
|
5048
|
+
return x[1];
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
return def;
|
|
5054
|
+
};
|
|
5055
|
+
|
|
5056
|
+
me.put = function (key, value) {
|
|
5057
|
+
key = encodeURI(key);
|
|
5058
|
+
value = encodeURI(value);
|
|
5059
|
+
var kvp = me.path.split('?');
|
|
5060
|
+
if (kvp.length > 1) kvp = kvp[1].split('&');
|
|
5061
|
+
var i = kvp.length;
|
|
5062
|
+
var x;
|
|
5063
|
+
|
|
5064
|
+
while (i--) {
|
|
5065
|
+
x = kvp[i].split('=');
|
|
5066
|
+
|
|
5067
|
+
if (x[0] == key) {
|
|
5068
|
+
x[1] = value;
|
|
5069
|
+
kvp[i] = x.join('=');
|
|
5070
|
+
break;
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
if (i < 0) {
|
|
5075
|
+
kvp[kvp.length] = [key, value].join('=');
|
|
5076
|
+
} //this will reload the page, it's likely better to store this until finished
|
|
5077
|
+
//document.location.search = kvp.join('&');
|
|
5078
|
+
//console.log('pathname='+me.location.pathname);
|
|
5079
|
+
//console.log('query='+kvp.join('&'));
|
|
5080
|
+
//console.log('hash='+me.location.hash);
|
|
5081
|
+
|
|
5082
|
+
|
|
5083
|
+
return me.location.pathname + '?' + kvp.join('&') + me.location.hash;
|
|
5084
|
+
};
|
|
5085
|
+
},
|
|
5086
|
+
loadScript: function loadScript(url, callback) {
|
|
5087
|
+
// adding the script tag to the head as suggested before
|
|
5088
|
+
var head = document.getElementsByTagName('head')[0];
|
|
5089
|
+
var script = document.createElement('script');
|
|
5090
|
+
script.type = 'text/javascript';
|
|
5091
|
+
script.src = url; // then bind the event to the callback function
|
|
5092
|
+
// there are several events for cross browser compatibility
|
|
5093
|
+
|
|
5094
|
+
script.onreadystatechange = callback;
|
|
5095
|
+
script.onload = callback; // fire the loading
|
|
5096
|
+
|
|
5097
|
+
head.appendChild(script);
|
|
5098
|
+
},
|
|
5099
|
+
sum: function sum(c) {
|
|
5100
|
+
return this.reduce(function (a, b) {
|
|
5101
|
+
b = c ? b[c] : b;
|
|
5102
|
+
return a + (b ? Number(b) : 0);
|
|
5103
|
+
}, 0);
|
|
5104
|
+
}
|
|
5105
|
+
});
|
|
5106
|
+
_.getLocation = _.getCurrentPosition;
|
|
4855
5107
|
Vue.id = _.id;
|
|
4856
5108
|
|
|
4857
5109
|
Vue.pad = function (num, size) {
|
|
@@ -5484,8 +5736,8 @@ window.ui = _.ui = function (cfg) {
|
|
|
5484
5736
|
|
|
5485
5737
|
dialog.setAttribute("path", path.path);
|
|
5486
5738
|
} else {
|
|
5487
|
-
var overlay = document.createElement("div");
|
|
5488
|
-
|
|
5739
|
+
var overlay = document.createElement("div"); //console.log('create overlay');
|
|
5740
|
+
|
|
5489
5741
|
overlay.classList.add("v-overlay");
|
|
5490
5742
|
overlay.style.padding = "40px";
|
|
5491
5743
|
document.body.appendChild(overlay);
|