capibara 1.3.74 → 1.3.76
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/dist/index.js +168 -165
- package/package.json +1 -1
- package/src/scss/components/_input_nav.scss +18 -0
- package/src/util/tableElements.js +9 -2
- package/src/util/utils.js +7 -0
- package/test/utils.test.js +7 -0
package/package.json
CHANGED
|
@@ -394,6 +394,24 @@
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
.cap-checkbox-list-option-content {
|
|
398
|
+
display: flex;
|
|
399
|
+
flex: 1 1 auto;
|
|
400
|
+
flex-direction: column;
|
|
401
|
+
min-width: 0;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.cap-checkbox-list-option-detail {
|
|
405
|
+
color: inherit;
|
|
406
|
+
// Conserva el segundo renglón aunque todavía no exista una previsualización.
|
|
407
|
+
// Así seleccionar una opción no desplaza las demás filas de la lista.
|
|
408
|
+
min-height: 1.25em;
|
|
409
|
+
font-size: 0.78em;
|
|
410
|
+
line-height: 1.25;
|
|
411
|
+
margin-top: 0.12em;
|
|
412
|
+
opacity: 0.7;
|
|
413
|
+
}
|
|
414
|
+
|
|
397
415
|
.input-section-list {
|
|
398
416
|
margin: 16px 0;
|
|
399
417
|
.input-section-title {
|
|
@@ -3869,12 +3869,19 @@ export default {
|
|
|
3869
3869
|
const checked = value.indexOf(String(option.id)) !== -1 ? "checked" : "";
|
|
3870
3870
|
str += `<label class="cap-checkbox-list-option">
|
|
3871
3871
|
<input class="input-checkbox-list" type="checkbox" value="${option.id}" ${checked}>
|
|
3872
|
-
<span
|
|
3872
|
+
<span class="cap-checkbox-list-option-content">
|
|
3873
|
+
<span class="cap-checkbox-list-option-label">${option.label}</span>
|
|
3874
|
+
<span class="cap-checkbox-list-option-detail">${option.detail || ""}</span>
|
|
3875
|
+
</span>
|
|
3873
3876
|
</label>`;
|
|
3874
3877
|
});
|
|
3875
3878
|
|
|
3876
3879
|
str += `</div></div></div>`;
|
|
3877
|
-
|
|
3880
|
+
const elem = dom.createElementFromHTML(str);
|
|
3881
|
+
elem.querySelectorAll("input.input-checkbox-list").forEach((input) => {
|
|
3882
|
+
this.addKeyDownInputEvents(input, elem, props);
|
|
3883
|
+
});
|
|
3884
|
+
return elem;
|
|
3878
3885
|
},
|
|
3879
3886
|
|
|
3880
3887
|
/**
|
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];
|
package/test/utils.test.js
CHANGED
|
@@ -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
|
+
});
|