capibara 1.3.73 → 1.3.75

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": "capibara",
3
- "version": "1.3.73",
3
+ "version": "1.3.75",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1682,6 +1682,21 @@ export default {
1682
1682
  btnNavList += `
1683
1683
  </div>
1684
1684
  </div>`;
1685
+
1686
+ // Los nietos (por ejemplo, válvulas bajo un sector) también
1687
+ // necesitan una fila en esta columna para que no desplacen los
1688
+ // controles del siguiente sector. No se copian los botones del
1689
+ // padre: pueden pertenecer exclusivamente al sector.
1690
+ if (c.children) {
1691
+ c.children.forEach((gc) => {
1692
+ if (gc.isHidden) return;
1693
+ btnNavList += `<div class="cap-btn-child-nav-item grandchild-btn-nav-item ${
1694
+ d.isClosed || c.isClosed ? "hide" : ""
1695
+ } ${gc.rowClass || ""}" child="${c.id || -1}" child-type="${c.type || ""}">
1696
+ <div class="cap-btn-nav-item-content"></div>
1697
+ </div>`;
1698
+ });
1699
+ }
1685
1700
  });
1686
1701
  }
1687
1702
  });
package/src/util/utils.js CHANGED
@@ -36,6 +36,13 @@ export default {
36
36
  for (let i = 0; i < paths.length; ++i) {
37
37
  const pathSegment = paths[i];
38
38
 
39
+ // Una ruta opcional puede atravesar un valor nulo (por ejemplo,
40
+ // `riego.mm` después de eliminar un riego). Trátalo igual que una
41
+ // propiedad inexistente en vez de intentar leer una propiedad de null.
42
+ if (current === null || current === undefined) {
43
+ return defaultReturn;
44
+ }
45
+
39
46
  // Verificar si el segmento de ruta contiene una referencia a un array
40
47
  if (pathSegment.includes('[') && pathSegment.includes(']')) {
41
48
  const arrName = pathSegment.split('[')[0];
@@ -27,3 +27,10 @@ describe("árbol de Capibara", () => {
27
27
  expect(utils.getItemById(config, 7, "sector")).toBe(sector);
28
28
  });
29
29
  });
30
+
31
+ describe("getVarByPath", () => {
32
+ it("devuelve el valor por defecto al atravesar una rama nula", () => {
33
+ expect(utils.getVarByPath({ riego: null }, "riego.mm")).toBeNull();
34
+ expect(utils.getVarByPath({ riego: null }, "riego.mm", 0)).toBe(0);
35
+ });
36
+ });