isobit-ui 0.0.275 → 0.0.276

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