@things-factory/import-ui-excel 4.3.767 → 4.3.776

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.
@@ -64,10 +64,13 @@ async function excelToObj(params) {
64
64
  //Fetch all data and place it in records array, 'extraData' object is used to map the id for list type.
65
65
  let records = []
66
66
  for (let rowcount = 1; rowcount < ws._rows.length; rowcount++) {
67
+ const row = ws._rows[rowcount]
68
+ if (!row || !row._cells) continue
69
+
67
70
  let objRow = {}
68
71
 
69
- for (let columncount = 0; columncount < ws._rows[rowcount]._cells.length; columncount++) {
70
- let currentCell = ws._rows[rowcount]._cells[columncount]
72
+ for (let columncount = 0; columncount < row._cells.length; columncount++) {
73
+ let currentCell = row._cells[columncount]
71
74
  let columnType = ''
72
75
  if (currentCell) {
73
76
  let currentColumnCode = currentCell._address.match(/[a-z]+|[^a-z]+/gi)[0]
@@ -114,6 +117,13 @@ async function excelToObj(params) {
114
117
  }
115
118
  }
116
119
  }
120
+
121
+ // Skip empty rows: do not add to records if row has no meaningful data
122
+ const isEmpty = Object.values(objRow).every(
123
+ v => v == null || v === '' || v === 0 || v === '0'
124
+ )
125
+ if (isEmpty) continue
126
+
117
127
  records.push(objRow)
118
128
  }
119
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/import-ui-excel",
3
- "version": "4.3.767",
3
+ "version": "4.3.776",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,9 +23,9 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/import-ui": "^4.3.767",
26
+ "@things-factory/import-ui": "^4.3.770",
27
27
  "@things-factory/layout-base": "^4.3.767",
28
28
  "xlsx": "^0.16.8"
29
29
  },
30
- "gitHead": "065b02059d800f6a759a98c240fed8608b48a52c"
30
+ "gitHead": "a2ad3248858837746d6c4f477bce580c604d1991"
31
31
  }