@nixweb/nixloc-ui 1.5.0 → 1.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -3,7 +3,6 @@
3
3
  <div ref='preview'>
4
4
  <v-runtime-template :template="`<div>${template}</div>`" />
5
5
  </div>
6
- <div>{{ template }}</div>
7
6
  </div>
8
7
  </template>
9
8
 
@@ -113,7 +113,7 @@ export default {
113
113
 
114
114
  const tabelaGrupoSubGrupo = "t.produtoGrupoSubgrupo";
115
115
  const idxMarker = documentHtml.indexOf(tabelaGrupoSubGrupo);
116
- const marcadorDiv = '<tabela-grupo-subgrupo></tabela-grupo-subgrupo>';
116
+ const marcadorDiv = `<tabela-grupo-subgrupo></tabela-grupo-subgrupo>`;
117
117
 
118
118
  if (idxMarker !== -1) {
119
119
  tableStart = documentHtml.lastIndexOf("<table", idxMarker);
@@ -156,6 +156,7 @@ export default {
156
156
  let isProduct = th.innerText.includes("t.produtoLocacao");
157
157
  let isInvoice = th.innerText.includes("t.produtoFatura");
158
158
  let isGrouped = th.innerText.includes("t.produtoAgrupado");
159
+ let isGroupedSubgroup = th.innerText.includes("t.produtoGrupoSubgrupo");
159
160
  let isMoviment = th.innerText.includes("t.produtoMovimentacao");
160
161
  let isCustumerAddress = th.innerText.includes("t.enderecoCliente");
161
162
  let isAddressRent = th.innerText.includes("t.saidaRetornoLocacao");
@@ -208,7 +209,10 @@ export default {
208
209
 
209
210
  config.push(obj);
210
211
 
211
- } else if (isMoviment) {
212
+ } else if (isGroupedSubgroup) {
213
+ // não faz nda, quem altera essa tabela é a após retParse
214
+ }
215
+ else if (isMoviment) {
212
216
  obj.vForSimple = "v-for='produto in d.itensMovimentacao'";
213
217
  config.push(obj);
214
218
  } else if (isCustumerAddress) {
@@ -231,16 +235,53 @@ export default {
231
235
 
232
236
  let replace = "";
233
237
  config.forEach(x => {
234
- if (x.nameGroup || x.vForGrouped || x.nameGroupReplace || x.vForSimple) {
235
- replace += `.replace("<tbody>${x.nameGroup}<tr>", "<tbody ${x.vForGrouped}>${x.nameGroupReplace}<tr ${x.vForSimple}>")`;
236
- }
238
+ replace += `.replace("<tbody>${x.nameGroup}<tr>", "<tbody ${x.vForGrouped}>${x.nameGroupReplace}<tr ${x.vForSimple}>")`;
237
239
  });
238
240
 
239
241
  var retParse = ret.replaceAll("\"", "'");
240
242
  retParse = eval(`retParse${replace}`);
241
243
 
242
- if (removedTableHtml)
244
+ if (removedTableHtml) {
245
+
246
+ removedTableHtml = removedTableHtml.replace("<tbody>", `<tbody v-for="(grupos, grupoMaster) in produtoGrupoSubgrupo">`);
247
+
248
+ const inicio = removedTableHtml.indexOf("<tbody");
249
+ const fim = removedTableHtml.indexOf("</tbody>", inicio) + "</tbody>".length;
250
+ let tbodyHtml = removedTableHtml.substring(inicio, fim);
251
+ const trs = [...tbodyHtml.matchAll(/<tr[^>]*>/g)];
252
+ if (trs.length >= 3) {
253
+ const grupoStart = trs[1].index;
254
+ const produtoStart = trs[2].index;
255
+ const produtoEnd = tbodyHtml.indexOf("</tr>", produtoStart) + "</tr>".length;
256
+
257
+ const wrapStart = grupoStart;
258
+ const wrapEnd = produtoEnd;
259
+
260
+ let templateContent = tbodyHtml.substring(wrapStart, wrapEnd);
261
+
262
+ const innerTrs = [...templateContent.matchAll(/<tr[^>]*>/g)];
263
+ if (innerTrs.length >= 2) {
264
+ const prodTag = innerTrs[1];
265
+ const pStart = prodTag.index;
266
+ const pEnd = pStart + prodTag[0].length;
267
+
268
+ templateContent =
269
+ templateContent.substring(0, pStart) +
270
+ `<tr v-for="produto in itensLocacao">` +
271
+ templateContent.substring(pEnd);
272
+ }
273
+
274
+ tbodyHtml = tbodyHtml.substring(0, wrapStart) +
275
+ `<template v-for="(itensLocacao, grupo) in grupos">` +
276
+ templateContent +
277
+ `</template>` +
278
+ tbodyHtml.substring(wrapEnd);
279
+
280
+ removedTableHtml = removedTableHtml.substring(0, inicio) + tbodyHtml + removedTableHtml.substring(fim);
281
+ }
282
+
243
283
  retParse = retParse.replace(marcadorDiv, `<div>${removedTableHtml}</div>`);
284
+ }
244
285
 
245
286
  var classImportant = retParse
246
287
  .replaceAll("t.pagamentoLocacao", "")