isobit-ui 0.0.275 → 0.0.278

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.
Files changed (2) hide show
  1. package/dist/index.js +293 -49
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * isobit-ui v0.0.275
2
+ * isobit-ui v0.0.278
3
3
  * (c) Erik Alarcon Pinedo
4
4
  * Released under the MIT License.
5
5
  */
@@ -4568,7 +4568,7 @@ Vue.n = function (v) {
4568
4568
  return v;
4569
4569
  };
4570
4570
 
4571
- Vue.resize = function () {
4571
+ var resize = function resize() {
4572
4572
  //dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
4573
4573
  var h = window.innerHeight;
4574
4574
  document.body.children[0].style.height = h + '.px';
@@ -4772,6 +4772,11 @@ Vue.resize = function () {
4772
4772
  }
4773
4773
  };
4774
4774
 
4775
+ setTimeout(Vue.resize = resize, 400);
4776
+ window.addEventListener('resize', function () {
4777
+ setTimeout(resize, 400);
4778
+ });
4779
+
4775
4780
  function HTML2Canvas(props) {
4776
4781
  this.props = props;
4777
4782
  this.ctx = props.ctx;
@@ -4813,6 +4818,19 @@ function HTML2Canvas(props) {
4813
4818
  };
4814
4819
  }
4815
4820
 
4821
+ _ = Object.assign(_, {
4822
+ remoteServer: '',
4823
+ _id: 0,
4824
+ networkStatus: {
4825
+ connected: true
4826
+ },
4827
+ storeFunction: {},
4828
+ varMap: {},
4829
+ id: function id() {
4830
+ return ++_._id;
4831
+ }
4832
+ });
4833
+
4816
4834
  _.sum = function (c) {
4817
4835
  return this.reduce(function (a, b) {
4818
4836
  b = c ? b[c] : b;
@@ -5288,71 +5306,295 @@ window.ui = _.ui = function (cfg) {
5288
5306
  return str.replace(_.contextPath, _.contextPath + '/api');
5289
5307
  },
5290
5308
  open: function open(response, path, o) {
5291
- var me = this;
5309
+ var me = this,
5310
+ el;
5311
+
5312
+ if (response.$el) {
5313
+ response = response.$el;
5314
+ path = {};
5315
+ } else if (response instanceof HTMLElement) {
5316
+ path = {};
5317
+ } else if (response.target) {
5318
+ el = response.target;
5319
+ return me.open(el.pathname ? el.pathname : el.href);
5320
+ } else if (response === 'GET') {
5321
+ if (typeof path == 'string') {
5322
+ var cfg = {
5323
+ path: _.currentPath = path + (typeof o == 'string' ? '/' + o : '')
5324
+ };
5292
5325
 
5293
- if (response === 'GET') {
5294
- _.currentPath = path + '/' + o; // window.history.pushState(_.currentPath, t, '{}');
5326
+ if (typeof o == 'function') {
5327
+ cfg.result = o;
5328
+ } else if (_typeof(o) == 'object') {
5329
+ cfg = Vue.mergeDeep(cfg, o);
5330
+ }
5295
5331
 
5296
- axios.get((_.currentPath + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(me.open)["catch"](me.error);
5297
- return;
5298
- } else if (typeof response == 'string') {
5299
- if (path === true) window.app.$router.replace(_.currentPath = response);else window.app.$router.push(_.currentPath = response);
5300
- return;
5332
+ return me.open(response, cfg);
5333
+ } else if (!path.data) {
5334
+ //Tiene q buscarse el elemt si existe
5335
+ //console.log('path='+path.path);
5336
+ el = document.querySelector('[path=\'' + path.path + '\']'); //console.log(el);
5337
+
5338
+ if (el) {
5339
+ var dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content'); //console.log(dd);
5340
+
5341
+ for (var i = 0; i < dd.children.length; i++) {
5342
+ //Se ocultan todas las demas paginas
5343
+ if (dd.children[i].style) {
5344
+ if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
5345
+ backPanel = dd.children[i];
5346
+ }
5347
+
5348
+ dd.children[i].style.display = 'none';
5349
+ }
5350
+ }
5351
+
5352
+ el.style.removeProperty('display');
5353
+ return el;
5354
+ } else {
5355
+ return axios.get((path.path + '/?modal').replace(/([^:]\/)\/+/g, "$1")).then(function (r) {
5356
+ r["class"] = path["class"] ? path["class"] : '';
5357
+ r.path = path.path;
5358
+ r.result = path.callback;
5359
+ r = Object.assign(r, path);
5360
+ me.open(response, r);
5361
+ })["catch"](me.error);
5362
+ }
5363
+ }
5364
+ } else if (!response.data) {
5365
+ return me.open('GET', response, path);
5366
+ } else if (response.data) {
5367
+ path = response;
5301
5368
  }
5302
5369
 
5303
- var overlay = document.createElement("div");
5304
- overlay.classList.add("v-overlay");
5305
- overlay.style.padding = "40px";
5306
- document.body.appendChild(overlay);
5307
- var dialog = document.createElement("div");
5308
- dialog.classList.add("v-dialog");
5309
- dialog.innerHTML = response.data;
5310
- var s = dialog.getElementsByTagName('script'); //console.log('patttt=' + _.currentPath);
5370
+ var dialog,
5371
+ nid = Vue.id(),
5372
+ scriptDom = [],
5373
+ for_,
5374
+ ifor = 0;
5311
5375
 
5312
- dialog.setAttribute("path", _.currentPath);
5376
+ if (response instanceof HTMLElement) {
5377
+ dialog = response;
5378
+ dialog.classList.add("v-dialog");
5379
+ } else {
5380
+ dialog = document.createElement("div");
5381
+ dialog.classList.add("v-dialog");
5382
+ dialog.innerHTML = path.data;
5383
+ var s = dialog.getElementsByTagName('script'); //console.log('patttt=' + _.currentPath);
5313
5384
 
5314
- var nid = _.id();
5385
+ dialog.setAttribute("path", _.currentPath);
5386
+ var ld = dialog.children; //console.log(s);
5315
5387
 
5316
- dialog.setAttribute("callback", nid);
5317
- overlay.appendChild(dialog);
5388
+ for (var k = 0; k < s.length; k++) {
5389
+ scriptDom.push(s[k]);
5390
+ }
5318
5391
 
5319
- for (var i = 0; s.length > i; i++) {
5320
- eval(s[i].innerHTML);
5392
+ for (k = 0; k < ld.length; k++) {
5393
+ //console.log(ld[k].tagName);
5394
+ if (ld[k].tagName == 'V-FORM' || ld[k].tagName == 'V-PANEL') {
5395
+ for_ = ld[k];
5396
+ ifor = k;
5397
+ }
5398
+ }
5321
5399
  }
5322
5400
 
5323
- overlay.style.visibility = "unset";
5324
- overlay.style.opacity = "unset";
5325
- overlay.style.overflow = "auto";
5326
- dialog.style.margin = "0 auto";
5327
- dialog.style.position = "unset";
5401
+ var backPanel;
5328
5402
 
5329
- _.storeFunction[nid] = function (o) {
5330
- if (o === true) me.refresh();
5403
+ var close = function close() {
5404
+ dialog.style.display = "none";
5405
+ overlay = dialog.parentNode;
5406
+
5407
+ if (overlay.classList.contains('v-overlay')) {
5408
+ //para los dialog
5409
+ overlay.style.display = "none";
5410
+ dialog.parentNode.removeChild(dialog);
5411
+ overlay.parentNode.removeChild(overlay);
5412
+ }
5413
+
5414
+ if (backPanel) {
5415
+ dialog.parentNode.removeChild(dialog);
5416
+ backPanel.style.display = 'block';
5417
+ }
5418
+
5419
+ _.resize();
5331
5420
  };
5332
5421
 
5333
- var resize = function resize() {
5334
- dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
5422
+ if (for_ && for_.classList.contains('panel')) {
5423
+ //Si elemto tiene declarado el id se debe considerar que es
5424
+ if (for_.id) {
5425
+ window.currentEl = '#' + for_.id;
5426
+ } else {
5427
+ var clsId = 'cls-id-' + Vue.id();
5428
+ for_.classList.add(clsId);
5429
+ window.currentEl = '.' + clsId;
5430
+ }
5431
+
5432
+ dd = document.querySelector('#layoutUnit-center > .ui-layout-unit-content,#page-content');
5335
5433
 
5336
- if (window.innerWidth < 600) {
5337
- var dc = dialog.querySelector('.ui-dialog-content'); //console.log(dc);
5434
+ for (i = 0; i < dd.children.length; i++) {
5435
+ //Se ocultan todas las demas paginas
5436
+ if (dd.children[i].style) {
5437
+ if (dd.children[i].className == 'ui-panel' && dd.children[i].style.display != 'none') {
5438
+ backPanel = dd.children[i];
5439
+ }
5338
5440
 
5339
- var h = dialog.querySelector('.ui-panel-titlebar'); //console.log(h.clientHeight);
5441
+ dd.children[i].style.display = 'none';
5442
+ }
5443
+ } //se agrega el dialog recuperado y se genera
5340
5444
 
5341
- var ih = window.innerHeight - 94 - h.clientHeight;
5342
- dc.style.height = ih + "px";
5445
+
5446
+ dd.appendChild(dialog); //console.log(scriptDom);
5447
+
5448
+ for (var l2 = 0; scriptDom.length > l2; l2++) {
5449
+ //console.log(s[l2]);
5450
+ try {
5451
+ eval(scriptDom[l2].innerHTML);
5452
+ } catch (e) {
5453
+ console.error(e);
5454
+ }
5343
5455
  }
5456
+
5457
+ dialog.style.display = 'none';
5458
+ var td;
5459
+ var aux = dialog.children[ifor]; //todo los elementos del dialog son agregados al panel
5460
+
5461
+ while (dialog.children.length > 0) {
5462
+ if (!td) td = dialog.children[0];
5463
+ dd.appendChild(dialog.children[0]);
5464
+ }
5465
+
5466
+ dialog.parentNode.removeChild(dialog);
5467
+ dialog = aux; //console.log(path);
5468
+
5469
+ dialog.setAttribute("path", path.path);
5470
+ } else {
5471
+ var overlay = document.createElement("div");
5472
+ console.log('create overlay');
5473
+ overlay.classList.add("v-overlay");
5474
+ overlay.style.padding = "40px";
5475
+ document.body.appendChild(overlay);
5476
+ overlay.appendChild(dialog);
5477
+
5478
+ if (!(response instanceof HTMLElement)) {
5479
+ for (l2 = 0; s.length > l2; l2++) {
5480
+ //console.log(s[l2]);
5481
+ try {
5482
+ eval(s[l2].innerHTML);
5483
+ } catch (e) {
5484
+ console.error(e);
5485
+ }
5486
+ }
5487
+ }
5488
+
5489
+ overlay.style.visibility = "unset";
5490
+ overlay.style.opacity = "unset";
5491
+ overlay.style.overflow = "auto";
5492
+ dialog.style.margin = "0 auto";
5493
+ dialog.style.position = "unset"; //console.log(dialog);
5494
+
5495
+ var resize = function resize(e) {
5496
+ dialog.style.left = (window.innerWidth - dialog.offsetWidth) / 2 + 'px';
5497
+
5498
+ if (window.innerWidth < 600) {
5499
+ //console.log(333333);
5500
+ var dc = dialog.querySelector('.v-dialog-content'); //console.log(dc);
5501
+
5502
+ var h = dialog.querySelector('.v-panel-titlebar'); //console.log(h.clientHeight);
5503
+
5504
+ var ih = window.innerHeight - 94 - h.clientHeight;
5505
+ dc.style.height = ih + "px";
5506
+ }
5507
+ };
5508
+
5509
+ window.addEventListener('resize', resize);
5510
+
5511
+ if (path["class"] === 'v-search') {
5512
+ var d = dialog;
5513
+ d.className = d.className + ' ' + path["class"];
5514
+ d.style.width = "100%";
5515
+ d.style.height = "calc(100% - 2px)";
5516
+ var children = d.querySelector('div');
5517
+ var f = d.querySelector('form');
5518
+ var t = d.querySelector('.v-datatable');
5519
+ var tb = d.querySelector('.v-datatable-scrollable-body');
5520
+ children.style.height = 'calc(100% - 2px)';
5521
+ children.style.overflowY = 'auto';
5522
+ children.children[1].style.padding = '0px';
5523
+ children.children[1].style.height = 'calc(100% - 33px)';
5524
+ f.style.height = '100%';
5525
+ f.style.overflowY = 'auto';
5526
+ t.style.height = 'calc(100% - 52px)';
5527
+ tb.style.height = 'calc(100% - 72px)';
5528
+ tb.style.overflowY = 'auto';
5529
+ var pag = d.querySelector('.v-paginator');
5530
+ pag.style.display = 'inline-block';
5531
+ f.appendChild(pag);
5532
+ tb = document.createElement("button");
5533
+ tb.innerHTML = 'Recuperar';
5534
+ tb.style.padding = '4px 16px';
5535
+ tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
5536
+
5537
+ var vue = _.varMap[children.getAttribute("vueid")];
5538
+
5539
+ tb.onclick = function (e) {
5540
+ e.preventDefault();
5541
+ vue.refresh();
5542
+ };
5543
+
5544
+ f.appendChild(tb);
5545
+ tb = document.createElement("button");
5546
+ tb.innerHTML = 'Seleccionar';
5547
+ tb.style.padding = '4px 16px';
5548
+ tb.className = "_ ui-widget v-state-default ui-corner-all v-button ui-button-text-only";
5549
+ vue = _.varMap[children.getAttribute("vueid")];
5550
+
5551
+ tb.onclick = function (e) {
5552
+ e.preventDefault();
5553
+ var d = [];
5554
+ var t = vue.$children[0].$children[0];
5555
+
5556
+ for (i = 0; i < t.selected.length; i++) {
5557
+ d.push(t.filteredData[t.selected[i]]);
5558
+ }
5559
+
5560
+ path.result(d);
5561
+ delete path.result;
5562
+ vue.close(e);
5563
+ };
5564
+
5565
+ f.appendChild(tb);
5566
+ }
5567
+
5568
+ resize();
5569
+ }
5570
+
5571
+ _.storeFunction['PROPS=' + nid] = path;
5572
+
5573
+ _.storeFunction[nid] = function (o) {
5574
+ if (path.result) {
5575
+ path.result(o);
5576
+ }
5577
+
5578
+ if (o === true) me.refresh();
5344
5579
  };
5345
5580
 
5346
- window.addEventListener('resize', resize);
5347
- var h = dialog.querySelector('.ui-panel-titlebar');
5581
+ var _vue_ = dialog.querySelector('[vueid]');
5582
+
5583
+ if (_vue_) {
5584
+ path.__vue__ = _vue_.__vue__;
5585
+
5586
+ _vue_.__vue__.$emit('opened', path);
5587
+ }
5588
+
5589
+ dialog.setAttribute("callback", nid);
5590
+ var h = dialog.querySelector('.v-panel-titlebar');
5348
5591
 
5349
5592
  if (h) {
5350
5593
  var acl = h.querySelector('.ui-js-close');
5351
5594
 
5352
5595
  window.onkeyup = function (event) {
5353
5596
  if (event.keyCode == 27) {
5354
- dialog.style.display = "none";
5355
- overlay.style.display = "none";
5597
+ close();
5356
5598
  }
5357
5599
  };
5358
5600
 
@@ -5365,18 +5607,20 @@ window.ui = _.ui = function (cfg) {
5365
5607
  span.style.color = "white";
5366
5608
  span.className = "fa fa-window-close v-dialog-close";
5367
5609
  acl = document.createElement("a");
5368
- acl.className = "ui-js-close ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all";
5610
+ acl.className = "ui-js-close v-dialog-titlebar-icon v-dialog-titlebar-close ui-corner-all";
5369
5611
  acl.appendChild(span);
5370
5612
  h.appendChild(acl);
5371
- acl.addEventListener("click", function () {
5372
- dialog.style.display = "none";
5373
- overlay.style.display = "none";
5374
- Vue.resize();
5375
- });
5613
+ acl.addEventListener("click", close);
5376
5614
  }
5377
5615
  }
5378
5616
 
5379
- Vue.resize();
5617
+ dialog.style.display = 'block';
5618
+
5619
+ _.resize();
5620
+
5621
+ document.documentElement.style.overflow = 'hidden'; // firefox, chrome
5622
+
5623
+ document.body.scroll = "no"; // ie only
5380
5624
  },
5381
5625
  close: function close(ok) {
5382
5626
  var dlg = this.$el.parentElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isobit-ui",
3
- "version": "0.0.275",
3
+ "version": "0.0.278",
4
4
  "description": "Vue component to play videos",
5
5
  "keywords": [
6
6
  "ui",