isobit-ui 0.0.286 → 0.0.289
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 +310 -9
- 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.289
|
|
3
3
|
* (c) Erik Alarcon Pinedo
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -4582,6 +4582,37 @@ Vue.n = function (v) {
|
|
|
4582
4582
|
return v;
|
|
4583
4583
|
};
|
|
4584
4584
|
|
|
4585
|
+
if (typeof JSON.clone !== "function") {
|
|
4586
|
+
JSON.clone = function (obj) {
|
|
4587
|
+
return JSON.parse(JSON.stringify(obj));
|
|
4588
|
+
};
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
if (typeof Object.assign != 'function') {
|
|
4592
|
+
Object.assign = function (target) {
|
|
4593
|
+
|
|
4594
|
+
if (target == null) {
|
|
4595
|
+
throw new TypeError('Cannot convert undefined or null to object');
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4598
|
+
var to = Object(target);
|
|
4599
|
+
|
|
4600
|
+
for (var index = 1; index < arguments.length; index++) {
|
|
4601
|
+
var nextSource = arguments[index];
|
|
4602
|
+
|
|
4603
|
+
if (nextSource != null) {
|
|
4604
|
+
for (var nextKey in nextSource) {
|
|
4605
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
4606
|
+
to[nextKey] = nextSource[nextKey];
|
|
4607
|
+
}
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
return to;
|
|
4613
|
+
};
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4585
4616
|
var resize = function resize() {
|
|
4586
4617
|
//dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
|
|
4587
4618
|
var h = window.innerHeight;
|
|
@@ -4831,6 +4862,19 @@ function HTML2Canvas(props) {
|
|
|
4831
4862
|
};
|
|
4832
4863
|
}
|
|
4833
4864
|
|
|
4865
|
+
var f = {
|
|
4866
|
+
value: function value(v) {
|
|
4867
|
+
var a = this;
|
|
4868
|
+
|
|
4869
|
+
for (var i = 0; i < a.length; i++) {
|
|
4870
|
+
if (a[i] == v) return true;
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
return false;
|
|
4874
|
+
}
|
|
4875
|
+
};
|
|
4876
|
+
if (![].contains) Object.defineProperty(Array.prototype, 'contains', f);
|
|
4877
|
+
if (!"".contains) Object.defineProperty(String.prototype, 'contains', f);
|
|
4834
4878
|
_ = Object.assign(_, {
|
|
4835
4879
|
remoteServer: '',
|
|
4836
4880
|
_id: 0,
|
|
@@ -4841,16 +4885,273 @@ _ = Object.assign(_, {
|
|
|
4841
4885
|
varMap: {},
|
|
4842
4886
|
id: function id() {
|
|
4843
4887
|
return ++_._id;
|
|
4844
|
-
}
|
|
4845
|
-
|
|
4888
|
+
},
|
|
4889
|
+
findForm: function findForm(e) {
|
|
4890
|
+
var parent = e.parentNode;
|
|
4846
4891
|
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
}
|
|
4892
|
+
if (parent && parent.tagName != 'FORM') {
|
|
4893
|
+
parent = _.findForm(parent);
|
|
4894
|
+
}
|
|
4895
|
+
|
|
4896
|
+
return parent;
|
|
4897
|
+
},
|
|
4898
|
+
contains: function contains(a, b) {
|
|
4899
|
+
return a && a.includes(b);
|
|
4900
|
+
},
|
|
4901
|
+
uiParent: function uiParent(e) {
|
|
4902
|
+
return e.ui || !e ? e : _.uiParent(e.$parent);
|
|
4903
|
+
},
|
|
4904
|
+
closest: function closest(el, sel) {
|
|
4905
|
+
while ((el = el.parentElement) && !(el.matches || el.matchesSelector).call(el, sel)) {
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4908
|
+
return el;
|
|
4909
|
+
},
|
|
4910
|
+
fadeOut: function fadeOut(id, val) {
|
|
4911
|
+
if (isNaN(val)) {
|
|
4912
|
+
val = 9;
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
document.getElementById(id).style.opacity = '0.' + val; //For IE
|
|
4916
|
+
|
|
4917
|
+
document.getElementById(id).style.filter = 'alpha(opacity=' + val + '0)';
|
|
4918
|
+
|
|
4919
|
+
if (val > 0) {
|
|
4920
|
+
val--;
|
|
4921
|
+
setTimeout('fadeOut("' + id + '",' + val + ')', 90);
|
|
4922
|
+
} else {
|
|
4923
|
+
return;
|
|
4924
|
+
}
|
|
4925
|
+
},
|
|
4926
|
+
fadeIn: function fadeIn(id, val) {
|
|
4927
|
+
// ID of the element to fade, Fade value[min value is 0]
|
|
4928
|
+
if (isNaN(val)) {
|
|
4929
|
+
val = 0;
|
|
4930
|
+
}
|
|
4931
|
+
|
|
4932
|
+
document.getElementById(id).style.opacity = '0.' + val; //For IE
|
|
4933
|
+
|
|
4934
|
+
document.getElementById(id).style.filter = 'alpha(opacity=' + val + '0)';
|
|
4935
|
+
|
|
4936
|
+
if (val < 9) {
|
|
4937
|
+
val++;
|
|
4938
|
+
setTimeout('fadeIn("' + id + '",' + val + ')', 90);
|
|
4939
|
+
} else {
|
|
4940
|
+
return;
|
|
4941
|
+
}
|
|
4942
|
+
},
|
|
4943
|
+
whichChild: function whichChild(e) {
|
|
4944
|
+
var i = 0;
|
|
4945
|
+
|
|
4946
|
+
while ((e = e.previousSibling) != null) {
|
|
4947
|
+
++i;
|
|
4948
|
+
}
|
|
4949
|
+
|
|
4950
|
+
return i;
|
|
4951
|
+
},
|
|
4952
|
+
print: function print(o) {
|
|
4953
|
+
var e = document.createElement('iframe');
|
|
4954
|
+
document.body.appendChild(e);
|
|
4955
|
+
var d = e.contentWindow.document;
|
|
4956
|
+
e.style.display = 'none';
|
|
4957
|
+
d.open();
|
|
4958
|
+
d.write('<html><head><title>TT' + o.title + '</title>');
|
|
4959
|
+
d.write('<link rel="stylesheet" type="text/css" href="/cdn/isobit.css?v=0004">' + '<style>table{background-color:red}</style>');
|
|
4960
|
+
d.write('</head><body style="padding:20px;background-color:white !important">');
|
|
4961
|
+
d.write('<style>body, body > * {padding:20px;background-color:white !important }</style>');
|
|
4962
|
+
d.write('<h1>' + o.title + '</h1>');
|
|
4963
|
+
d.write(o.body);
|
|
4964
|
+
d.write('</body></html>');
|
|
4965
|
+
d.close();
|
|
4966
|
+
e.focus();
|
|
4967
|
+
e.contentWindow.print();
|
|
4968
|
+
},
|
|
4969
|
+
mask: function mask(ms, cfg) {
|
|
4970
|
+
if (!document.body) return;
|
|
4971
|
+
var center = document.createElement("div");
|
|
4972
|
+
center.style = 'top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2';
|
|
4973
|
+
var s = center.style;
|
|
4974
|
+
s.left = '50%';
|
|
4975
|
+
s.textAlign = 'center';
|
|
4976
|
+
|
|
4977
|
+
if (ms !== false) {
|
|
4978
|
+
if (ms instanceof Element) {
|
|
4979
|
+
center = ms; //.append(ms);
|
|
4980
|
+
} else {
|
|
4981
|
+
if (ms) {
|
|
4982
|
+
var d = document.createElement('div');
|
|
4983
|
+
d.innerHTML = ms;
|
|
4984
|
+
center.append(d);
|
|
4985
|
+
center.style = "padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center";
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
var img = document.createElement('div');
|
|
4989
|
+
s = img.style;
|
|
4990
|
+
s.width = '100%';
|
|
4991
|
+
s.height = '180px';
|
|
4992
|
+
img.className = 'loading';
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
var p = document.createElement('div');
|
|
4997
|
+
s = p.style;
|
|
4998
|
+
s.height = '100%';
|
|
4999
|
+
s.top = '0px';
|
|
5000
|
+
s.position = 'absolute';
|
|
5001
|
+
s.left = '0';
|
|
5002
|
+
s.zIndex = 10000;
|
|
5003
|
+
s.width = '100%';
|
|
5004
|
+
var bg = document.createElement('div');
|
|
5005
|
+
s = bg.style;
|
|
5006
|
+
s.height = '100%';
|
|
5007
|
+
s.width = '100%';
|
|
5008
|
+
s.top = '0';
|
|
5009
|
+
s.position = 'absolute';
|
|
5010
|
+
s.left = '0';
|
|
5011
|
+
s.backgroundColor = 'rgba(0,0,0,0.5)';
|
|
5012
|
+
if (cfg && cfg.opacity) s.opacity = cfg.opacity;
|
|
5013
|
+
if (cfg && cfg.backgroundColor) s.backgroundColor = cfg.backgroundColor;
|
|
5014
|
+
p.appendChild(bg);
|
|
5015
|
+
p.appendChild(center);
|
|
5016
|
+
if (img) center.appendChild(img);
|
|
5017
|
+
document.body.appendChild(p);
|
|
5018
|
+
return p;
|
|
5019
|
+
},
|
|
5020
|
+
unmask: function unmask(m) {
|
|
5021
|
+
if (m) {
|
|
5022
|
+
m.style.display = "none";
|
|
5023
|
+
if (m.parentNode) m.parentNode.removeChild(m);
|
|
5024
|
+
}
|
|
5025
|
+
},
|
|
5026
|
+
clean: function clean(obj) {
|
|
5027
|
+
for (var propName in obj) {
|
|
5028
|
+
if (obj[propName] === '' || obj[propName] === null || obj[propName] === undefined) {
|
|
5029
|
+
delete obj[propName];
|
|
5030
|
+
}
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5033
|
+
return obj;
|
|
5034
|
+
},
|
|
5035
|
+
processURL: function processURL(s) {
|
|
5036
|
+
//console.log(s);
|
|
5037
|
+
return s;
|
|
5038
|
+
},
|
|
5039
|
+
loadCSS: function loadCSS(url) {
|
|
5040
|
+
var head = document.getElementsByTagName('head')[0];
|
|
5041
|
+
var link = document.createElement('link'); //link.id = cssId;
|
|
5042
|
+
|
|
5043
|
+
link.rel = 'stylesheet';
|
|
5044
|
+
link.type = 'text/css';
|
|
5045
|
+
link.href = url;
|
|
5046
|
+
link.media = 'all';
|
|
5047
|
+
head.appendChild(link);
|
|
5048
|
+
},
|
|
5049
|
+
go: function go(u) {
|
|
5050
|
+
window.location = u;
|
|
5051
|
+
},
|
|
5052
|
+
getCurrentPosition: function getCurrentPosition() {
|
|
5053
|
+
return new Promise(function (res, rej) {
|
|
5054
|
+
if (_.location) {
|
|
5055
|
+
var id = 'result' + _.id();
|
|
5056
|
+
|
|
5057
|
+
_[id] = function (r) {
|
|
5058
|
+
delete _[id];
|
|
4853
5059
|
|
|
5060
|
+
if (r.coords) {
|
|
5061
|
+
res(r);
|
|
5062
|
+
} else rej(r);
|
|
5063
|
+
};
|
|
5064
|
+
|
|
5065
|
+
_.location(id);
|
|
5066
|
+
} else if (navigator.geolocation) {
|
|
5067
|
+
navigator.geolocation.getCurrentPosition(res, rej);
|
|
5068
|
+
}
|
|
5069
|
+
});
|
|
5070
|
+
},
|
|
5071
|
+
URL: function URL(path) {
|
|
5072
|
+
var me = this;
|
|
5073
|
+
me.location = window.location;
|
|
5074
|
+
me.path = path ? path : window.location.pathname;
|
|
5075
|
+
var h = me.path.split('?');
|
|
5076
|
+
|
|
5077
|
+
if (h.length > 1) {
|
|
5078
|
+
me.path = h[0];
|
|
5079
|
+
h = h[1].split('#');
|
|
5080
|
+
me.query = h[0];
|
|
5081
|
+
} else {
|
|
5082
|
+
h = h[0].split('#');
|
|
5083
|
+
me.path = h[0];
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
me.get = function (key, def) {
|
|
5087
|
+
if (me.query) {
|
|
5088
|
+
var kvp = me.query.split('&');
|
|
5089
|
+
var i = kvp.length;
|
|
5090
|
+
var x;
|
|
5091
|
+
|
|
5092
|
+
while (i--) {
|
|
5093
|
+
x = kvp[i].split('=');
|
|
5094
|
+
|
|
5095
|
+
if (x[0] == key) {
|
|
5096
|
+
return x[1];
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
}
|
|
5100
|
+
|
|
5101
|
+
return def;
|
|
5102
|
+
};
|
|
5103
|
+
|
|
5104
|
+
me.put = function (key, value) {
|
|
5105
|
+
key = encodeURI(key);
|
|
5106
|
+
value = encodeURI(value);
|
|
5107
|
+
var kvp = me.path.split('?');
|
|
5108
|
+
if (kvp.length > 1) kvp = kvp[1].split('&');
|
|
5109
|
+
var i = kvp.length;
|
|
5110
|
+
var x;
|
|
5111
|
+
|
|
5112
|
+
while (i--) {
|
|
5113
|
+
x = kvp[i].split('=');
|
|
5114
|
+
|
|
5115
|
+
if (x[0] == key) {
|
|
5116
|
+
x[1] = value;
|
|
5117
|
+
kvp[i] = x.join('=');
|
|
5118
|
+
break;
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
|
|
5122
|
+
if (i < 0) {
|
|
5123
|
+
kvp[kvp.length] = [key, value].join('=');
|
|
5124
|
+
} //this will reload the page, it's likely better to store this until finished
|
|
5125
|
+
//document.location.search = kvp.join('&');
|
|
5126
|
+
//console.log('pathname='+me.location.pathname);
|
|
5127
|
+
//console.log('query='+kvp.join('&'));
|
|
5128
|
+
//console.log('hash='+me.location.hash);
|
|
5129
|
+
|
|
5130
|
+
|
|
5131
|
+
return me.location.pathname + '?' + kvp.join('&') + me.location.hash;
|
|
5132
|
+
};
|
|
5133
|
+
},
|
|
5134
|
+
loadScript: function loadScript(url, callback) {
|
|
5135
|
+
// adding the script tag to the head as suggested before
|
|
5136
|
+
var head = document.getElementsByTagName('head')[0];
|
|
5137
|
+
var script = document.createElement('script');
|
|
5138
|
+
script.type = 'text/javascript';
|
|
5139
|
+
script.src = url; // then bind the event to the callback function
|
|
5140
|
+
// there are several events for cross browser compatibility
|
|
5141
|
+
|
|
5142
|
+
script.onreadystatechange = callback;
|
|
5143
|
+
script.onload = callback; // fire the loading
|
|
5144
|
+
|
|
5145
|
+
head.appendChild(script);
|
|
5146
|
+
},
|
|
5147
|
+
sum: function sum(c) {
|
|
5148
|
+
return this.reduce(function (a, b) {
|
|
5149
|
+
b = c ? b[c] : b;
|
|
5150
|
+
return a + (b ? Number(b) : 0);
|
|
5151
|
+
}, 0);
|
|
5152
|
+
}
|
|
5153
|
+
});
|
|
5154
|
+
_.getLocation = _.getCurrentPosition;
|
|
4854
5155
|
Vue.id = _.id;
|
|
4855
5156
|
|
|
4856
5157
|
Vue.pad = function (num, size) {
|