backend-plus 2.0.8 → 2.0.9

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.
@@ -163,7 +163,7 @@ a.disabled
163
163
  color #777
164
164
  > .json-container
165
165
  position sticky
166
- top 5%
167
- bottom 5%
166
+ top 2px
167
+ bottom 2px
168
168
 
169
169
 
@@ -156,7 +156,9 @@ animation-time = 2s
156
156
  .result-progress
157
157
  height 200px
158
158
  overflow auto
159
-
159
+ @media print
160
+ display none
161
+
160
162
  .dialog-promise
161
163
  .result-progress
162
164
  width 300px
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.0.8",
4
+ "version": "2.0.9",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -522,6 +522,23 @@ function agregar_class_textInDiv(td, className, text){
522
522
  td.appendChild(div);
523
523
  }
524
524
 
525
+ function containsObjectsWithTheSameColumns(o){
526
+ var keys = Object.keys(o);
527
+ if (!keys.length) return false;
528
+ var separator = Math.random();
529
+ var colNamesFirstObject = Object.keys(o[keys[0]]).join(separator);
530
+ return !keys.find(k => o[k] == null || !(o[k] instanceof Object) || Object.keys(o[k]).join(separator) != colNamesFirstObject);
531
+ }
532
+ /* test
533
+ var cases = [
534
+ [false, {}],
535
+ [false, {a:"hola"}],
536
+ [false, {a:{a:1, b:2, c:2}, b:{a:1, x:2, c:2}}],
537
+ [true , {a:{a:1, b:2, c:2}, b:{a:1, b:2, c:2}}]
538
+ ];
539
+ cases.forEach(([expected, param]) => console.log(param, containsObjectsWithTheSameColumns(param), containsObjectsWithTheSameColumns(param) == expected ? 'ok' : 'fail'))
540
+ */
541
+
525
542
  /**
526
543
  *
527
544
  * @param {HTMLElement} div
@@ -533,7 +550,7 @@ function agregar_json(div, o, ubicaciones=agregar_json_default_ubicaciones){
533
550
  return ;
534
551
  }
535
552
  if(typeof o == "object" && !(o instanceof Date) && !o.isRealDateTime){
536
- if(o instanceof Array && o[0] && o[0] instanceof Object && !(o[0] instanceof Array) && !(o[0].isRealDateTime)){
553
+ if((o instanceof Array && o[0] || containsObjectsWithTheSameColumns(o)) && o[0] instanceof Object && !(o[0] instanceof Array) && !(o[0].isRealDateTime)){
537
554
  var table = document.createElement('table');
538
555
  div.appendChild(table);
539
556
  var titleRow = table.insertRow(-1);