capibara 1.3.71 → 1.3.72
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/.claude/skills/capibara-publish/SKILL.md +38 -0
- package/dist/index.js +291 -279
- package/package.json +1 -1
- package/src/lib/capibara.js +9 -1
- package/src/scss/components/_input_nav.scss +99 -0
- package/src/scss/layout/_nav.scss +30 -0
- package/src/scss/layout/_plotContainer.scss +4 -0
- package/src/util/tableElements.js +122 -11
package/package.json
CHANGED
package/src/lib/capibara.js
CHANGED
|
@@ -652,6 +652,11 @@ export class Capibara{
|
|
|
652
652
|
}
|
|
653
653
|
break;
|
|
654
654
|
|
|
655
|
+
case 'checkboxList':
|
|
656
|
+
value = Array.prototype.slice.call(elem.querySelectorAll("input.input-checkbox-list:checked"))
|
|
657
|
+
.map(input => input.value);
|
|
658
|
+
break;
|
|
659
|
+
|
|
655
660
|
case 'file':
|
|
656
661
|
inputElement = elem.querySelector("input[type='file']");
|
|
657
662
|
value = inputElement.files;
|
|
@@ -730,7 +735,10 @@ export class Capibara{
|
|
|
730
735
|
$detail.classList.remove("hide");
|
|
731
736
|
};
|
|
732
737
|
|
|
733
|
-
$detail.innerHTML = tableElements.getDetailNavItemContent(item
|
|
738
|
+
$detail.innerHTML = tableElements.getDetailNavItemContent(item, {
|
|
739
|
+
selected: this.selected,
|
|
740
|
+
tabSelected: this.tabSelected,
|
|
741
|
+
});
|
|
734
742
|
|
|
735
743
|
if(pos.yPercent > 50){ //mayor a 50%
|
|
736
744
|
if(!$detail.classList.contains("to-bottom")){
|
|
@@ -346,6 +346,54 @@
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
.cap-checkbox-list-section {
|
|
350
|
+
align-items: stretch;
|
|
351
|
+
border: 1px solid rgba(127, 127, 127, 0.5);
|
|
352
|
+
border-radius: 8px;
|
|
353
|
+
margin: 8px 16px;
|
|
354
|
+
padding: 10px 12px;
|
|
355
|
+
|
|
356
|
+
.text-subtitle {
|
|
357
|
+
line-height: 1.2;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.cap-checkbox-list-help {
|
|
362
|
+
color: inherit;
|
|
363
|
+
font-size: 0.8em;
|
|
364
|
+
line-height: 1.25;
|
|
365
|
+
margin-top: 0.25em;
|
|
366
|
+
opacity: 0.68;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.cap-checkbox-list {
|
|
370
|
+
display: grid;
|
|
371
|
+
gap: 0.35em;
|
|
372
|
+
margin-top: 0.35em;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.cap-checkbox-list-option {
|
|
376
|
+
align-items: center;
|
|
377
|
+
border: 1px solid rgba(255, 255, 255, 0.25);
|
|
378
|
+
border-radius: 6px;
|
|
379
|
+
cursor: pointer;
|
|
380
|
+
display: flex;
|
|
381
|
+
gap: 0.6em;
|
|
382
|
+
min-height: 2.5em;
|
|
383
|
+
padding: 0.45em 0.65em;
|
|
384
|
+
|
|
385
|
+
&:hover {
|
|
386
|
+
border-color: var(--accent-color, #4caf50);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
input {
|
|
390
|
+
accent-color: var(--accent-color, #4caf50);
|
|
391
|
+
flex: 0 0 auto;
|
|
392
|
+
margin: 0;
|
|
393
|
+
width: auto;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
349
397
|
.input-section-list {
|
|
350
398
|
margin: 16px 0;
|
|
351
399
|
.input-section-title {
|
|
@@ -465,6 +513,57 @@
|
|
|
465
513
|
}
|
|
466
514
|
}
|
|
467
515
|
|
|
516
|
+
.nav-input-clearable {
|
|
517
|
+
position: relative;
|
|
518
|
+
width: 100%;
|
|
519
|
+
min-width: 130px;
|
|
520
|
+
max-width: 170px;
|
|
521
|
+
margin-bottom: 8px;
|
|
522
|
+
|
|
523
|
+
input.nav-input {
|
|
524
|
+
min-width: 0;
|
|
525
|
+
max-width: none;
|
|
526
|
+
margin-bottom: 0;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.nav-input-clear {
|
|
530
|
+
position: absolute;
|
|
531
|
+
top: 50%;
|
|
532
|
+
right: 0.25em;
|
|
533
|
+
display: flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
justify-content: center;
|
|
536
|
+
width: 1.7em;
|
|
537
|
+
height: 1.7em;
|
|
538
|
+
padding: 0;
|
|
539
|
+
color: inherit;
|
|
540
|
+
opacity: 0.55;
|
|
541
|
+
background: transparent;
|
|
542
|
+
border: 0;
|
|
543
|
+
border-radius: 50%;
|
|
544
|
+
cursor: pointer;
|
|
545
|
+
transform: translateY(-50%);
|
|
546
|
+
|
|
547
|
+
&:hover,
|
|
548
|
+
&:focus-visible {
|
|
549
|
+
opacity: 1;
|
|
550
|
+
background: rgba(128, 128, 128, 0.16);
|
|
551
|
+
outline: none;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
&.is-hidden {
|
|
555
|
+
display: none;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.close-icon,
|
|
559
|
+
svg {
|
|
560
|
+
display: flex;
|
|
561
|
+
width: 1.15em !important;
|
|
562
|
+
height: 1.15em !important;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
468
567
|
.nav-input-file {
|
|
469
568
|
border: 2px solid color.adjust(grey, $alpha: -0.3);
|
|
470
569
|
border-radius: 6px;
|
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
flex: 0 0 var(--nav-item-col-width);
|
|
154
154
|
text-align: center;
|
|
155
155
|
padding: 4px 8px;
|
|
156
|
+
|
|
156
157
|
&.has-input {
|
|
157
158
|
padding: 0px;
|
|
158
159
|
|
|
@@ -209,6 +210,14 @@
|
|
|
209
210
|
display: flex;
|
|
210
211
|
line-height: 1.75rem;
|
|
211
212
|
|
|
213
|
+
&.valvula-row {
|
|
214
|
+
background: rgba(76, 175, 80, 0.08);
|
|
215
|
+
|
|
216
|
+
&:hover {
|
|
217
|
+
background: rgba(76, 175, 80, 0.14);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
212
221
|
.item-title {
|
|
213
222
|
flex: 1 0 auto;
|
|
214
223
|
padding: 4px 8px;
|
|
@@ -272,6 +281,19 @@
|
|
|
272
281
|
}
|
|
273
282
|
|
|
274
283
|
nav {
|
|
284
|
+
// Mantiene el indicador de válvula al abrir cualquiera de las columnas
|
|
285
|
+
// laterales, no solo en el listado de nombres.
|
|
286
|
+
.initial-nav-list .valvula-row,
|
|
287
|
+
.extend-nav-list .valvula-row,
|
|
288
|
+
.cap-btn-nav-list .valvula-row {
|
|
289
|
+
background: rgba(76, 175, 80, 0.08);
|
|
290
|
+
|
|
291
|
+
&:hover {
|
|
292
|
+
background: rgba(76, 175, 80, 0.14);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
|
|
275
297
|
.nav-item-container,
|
|
276
298
|
.initial-nav-item,
|
|
277
299
|
.ex-nav-item,
|
|
@@ -299,6 +321,14 @@
|
|
|
299
321
|
.child-nav-item {
|
|
300
322
|
//border-top: 1px solid #b0bec5 !important; // blue grey 200
|
|
301
323
|
}
|
|
324
|
+
|
|
325
|
+
.valvula-row {
|
|
326
|
+
background: rgba(76, 175, 80, 0.08);
|
|
327
|
+
|
|
328
|
+
&:hover {
|
|
329
|
+
background: rgba(76, 175, 80, 0.14);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
302
332
|
.nav-item {
|
|
303
333
|
//border-bottom: 1px solid #b0bec5 !important; // blue grey 200
|
|
304
334
|
}
|
|
@@ -135,7 +135,16 @@ export default {
|
|
|
135
135
|
let { width, itemHeight } = utils.getTableDimensions(config);
|
|
136
136
|
config.timeline.plots.horizontal.forEach((p) => {
|
|
137
137
|
let item = utils.getItemById(config, p.idNode, p.typeNode);
|
|
138
|
-
|
|
138
|
+
// Los plots de nivel superior conservan el comportamiento histórico;
|
|
139
|
+
// los de nodos anidados (por ejemplo válvulas) deben usar su posición
|
|
140
|
+
// real dentro del árbol visible.
|
|
141
|
+
if (!item) return;
|
|
142
|
+
let topPosition = utils.getPositionByItem(
|
|
143
|
+
config,
|
|
144
|
+
item,
|
|
145
|
+
p.typeNode === "parent" ? "parent" : "child"
|
|
146
|
+
);
|
|
147
|
+
if (topPosition < 0) return;
|
|
139
148
|
let plot = dom.createElement("div", {
|
|
140
149
|
classNames: ["plot-horizontal", p.className || ""],
|
|
141
150
|
style: {
|
|
@@ -1222,7 +1231,7 @@ export default {
|
|
|
1222
1231
|
navList += `<div class="children-items nested-children-items ${c.isClosed ? "hide" : ""}" child-list="${c.id || -1}" child-type="${c.type || ""}">`;
|
|
1223
1232
|
c.children.forEach((gc) => {
|
|
1224
1233
|
if (gc.isHidden) return;
|
|
1225
|
-
navList += `<div class="child-nav-item grandchild-nav-item"><div class="nav-item-container"><div class="item-title ${gc.clickeable ? "clickeable" : ""} ${gc.navOver ? "hoverable" : ""}" item-id="${gc.id || -1}" type-node="${gc.type || ""}"><div class="truncate">${gc.label}</div></div></div></div>`;
|
|
1234
|
+
navList += `<div class="child-nav-item grandchild-nav-item ${gc.rowClass || ""}"><div class="nav-item-container"><div class="item-title ${gc.clickeable ? "clickeable" : ""} ${gc.navOver ? "hoverable" : ""}" item-id="${gc.id || -1}" type-node="${gc.type || ""}"><div class="truncate">${gc.label}</div></div></div></div>`;
|
|
1226
1235
|
});
|
|
1227
1236
|
navList += `</div>`;
|
|
1228
1237
|
}
|
|
@@ -1308,7 +1317,7 @@ export default {
|
|
|
1308
1317
|
if (c.isHidden) return;
|
|
1309
1318
|
initialNavList += `<div class="child-initial-nav-item ${
|
|
1310
1319
|
d.isClosed ? "hide" : ""
|
|
1311
|
-
}" child="${d.id || -1}">`;
|
|
1320
|
+
} ${c.rowClass || ""}" child="${d.id || -1}">`;
|
|
1312
1321
|
|
|
1313
1322
|
if (c.withNav !== false) {
|
|
1314
1323
|
config.timeline.nav.left.initial.vars.forEach((v) => {
|
|
@@ -1376,6 +1385,28 @@ export default {
|
|
|
1376
1385
|
}
|
|
1377
1386
|
initialNavList += `
|
|
1378
1387
|
</div>`;
|
|
1388
|
+
|
|
1389
|
+
// Reserva una fila para cada nieto en las columnas iniciales. Esto
|
|
1390
|
+
// mantiene alineados los valores del sector con sus válvulas y deja
|
|
1391
|
+
// que el color de contexto cubra todo el sidebar.
|
|
1392
|
+
if (c.children) {
|
|
1393
|
+
c.children.forEach((gc) => {
|
|
1394
|
+
if (gc.isHidden) return;
|
|
1395
|
+
initialNavList += `<div class="child-initial-nav-item grandchild-initial-nav-item ${
|
|
1396
|
+
d.isClosed || c.isClosed ? "hide" : ""
|
|
1397
|
+
} ${gc.rowClass || ""}" child="${c.id || -1}" child-type="${c.type || ""}">`;
|
|
1398
|
+
|
|
1399
|
+
if (gc.withNav !== false) {
|
|
1400
|
+
config.timeline.nav.left.initial.vars.forEach((v) => {
|
|
1401
|
+
if (v.onlyTab && tab && v.onlyTab !== tab.key) return;
|
|
1402
|
+
let value = utils.getVarByPath(gc.values, v.varName);
|
|
1403
|
+
if (v.round && !isNaN(value)) value = utils.round(value, v.round);
|
|
1404
|
+
initialNavList += `<div class="item-col">${value == null ? "" : value}</div>`;
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
initialNavList += `</div>`;
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1379
1410
|
});
|
|
1380
1411
|
}
|
|
1381
1412
|
|
|
@@ -1452,7 +1483,7 @@ export default {
|
|
|
1452
1483
|
if (c.isHidden) return;
|
|
1453
1484
|
exNavList += `<div class="child-ex-nav-item ${
|
|
1454
1485
|
d.isClosed ? "hide" : ""
|
|
1455
|
-
}" child="${d.id || -1}">`;
|
|
1486
|
+
} ${c.rowClass || ""}" child="${d.id || -1}">`;
|
|
1456
1487
|
|
|
1457
1488
|
if (c.withNav !== false) {
|
|
1458
1489
|
config.timeline.nav.left.extend.vars.forEach((v) => {
|
|
@@ -1521,6 +1552,28 @@ export default {
|
|
|
1521
1552
|
}
|
|
1522
1553
|
exNavList += `
|
|
1523
1554
|
</div>`;
|
|
1555
|
+
|
|
1556
|
+
// Los nodos anidados (por ejemplo, válvulas bajo un sector) también
|
|
1557
|
+
// necesitan una fila en el sidebar extendido. Sin ella, las columnas
|
|
1558
|
+
// laterales quedan desalineadas respecto de la planilla.
|
|
1559
|
+
if (c.children) {
|
|
1560
|
+
c.children.forEach((gc) => {
|
|
1561
|
+
if (gc.isHidden) return;
|
|
1562
|
+
exNavList += `<div class="child-ex-nav-item grandchild-ex-nav-item ${
|
|
1563
|
+
d.isClosed || c.isClosed ? "hide" : ""
|
|
1564
|
+
} ${gc.rowClass || ""}" child="${c.id || -1}" child-type="${c.type || ""}">`;
|
|
1565
|
+
|
|
1566
|
+
if (gc.withNav !== false) {
|
|
1567
|
+
config.timeline.nav.left.extend.vars.forEach((v) => {
|
|
1568
|
+
if (v.onlyTab && tab && v.onlyTab !== tab.key) return;
|
|
1569
|
+
let value = utils.getVarByPath(gc.values, v.varName);
|
|
1570
|
+
if (v.round && !isNaN(value)) value = utils.round(value, v.round);
|
|
1571
|
+
exNavList += `<div class="item-col">${value == null ? "" : value}</div>`;
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
exNavList += `</div>`;
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1524
1577
|
});
|
|
1525
1578
|
}
|
|
1526
1579
|
|
|
@@ -1579,7 +1632,7 @@ export default {
|
|
|
1579
1632
|
//buttons
|
|
1580
1633
|
btnNavList += `<div class="cap-btn-child-nav-item parent ${
|
|
1581
1634
|
d.isClosed ? "hide" : ""
|
|
1582
|
-
}" child="${d.id || -1}">
|
|
1635
|
+
} ${c.rowClass || ""}" child="${d.id || -1}">
|
|
1583
1636
|
<div class="cap-btn-nav-item-content">`;
|
|
1584
1637
|
|
|
1585
1638
|
if (
|
|
@@ -1909,8 +1962,11 @@ export default {
|
|
|
1909
1962
|
* @param {Object} [item={}] - Configuracion de item
|
|
1910
1963
|
* @return {String} Html de ventana de detalle
|
|
1911
1964
|
*/
|
|
1912
|
-
getDetailNavItemContent(item = {}) {
|
|
1965
|
+
getDetailNavItemContent(item = {}, context = {}) {
|
|
1913
1966
|
if (item.navOver == undefined) item.navOver = {};
|
|
1967
|
+
const content = typeof item.navOver.content === "function"
|
|
1968
|
+
? item.navOver.content(context)
|
|
1969
|
+
: item.navOver.content || "";
|
|
1914
1970
|
|
|
1915
1971
|
return `
|
|
1916
1972
|
<div class="header-detail">
|
|
@@ -1928,7 +1984,7 @@ export default {
|
|
|
1928
1984
|
</div>
|
|
1929
1985
|
|
|
1930
1986
|
<div class="detail-container">
|
|
1931
|
-
${
|
|
1987
|
+
${content}
|
|
1932
1988
|
</div>`;
|
|
1933
1989
|
},
|
|
1934
1990
|
|
|
@@ -2436,7 +2492,7 @@ export default {
|
|
|
2436
2492
|
//children Data
|
|
2437
2493
|
let position = this.getPositionFloatBox(config, data, item, typeNode);
|
|
2438
2494
|
|
|
2439
|
-
let className = "";
|
|
2495
|
+
let className = item.rowClass ? item.rowClass + " " : "";
|
|
2440
2496
|
|
|
2441
2497
|
if (data.errors && data.errors.length > 0) {
|
|
2442
2498
|
className += "has-errors ";
|
|
@@ -3264,6 +3320,9 @@ export default {
|
|
|
3264
3320
|
case "select":
|
|
3265
3321
|
r = this.createInputSelect(props, dataDay, daySelected, selected);
|
|
3266
3322
|
break;
|
|
3323
|
+
case "checkboxList":
|
|
3324
|
+
r = this.createInputCheckboxList(props, dataDay, daySelected, selected);
|
|
3325
|
+
break;
|
|
3267
3326
|
case "file":
|
|
3268
3327
|
r = this.createInputFile(props, dataDay);
|
|
3269
3328
|
break;
|
|
@@ -3485,6 +3544,11 @@ export default {
|
|
|
3485
3544
|
let hintStyle = hintLines
|
|
3486
3545
|
? ` style="min-height:${(hintLines * 1.3).toFixed(2)}em;line-height:1.3;"`
|
|
3487
3546
|
: "";
|
|
3547
|
+
const clearButton = props.clearable
|
|
3548
|
+
? `<button type="button" class="nav-input-clear" aria-label="Limpiar ${props.label}" title="Limpiar">
|
|
3549
|
+
${icons.closeIcon}
|
|
3550
|
+
</button>`
|
|
3551
|
+
: "";
|
|
3488
3552
|
|
|
3489
3553
|
let elem = dom.createElementFromHTML(`
|
|
3490
3554
|
<div class="input-section ${props.classNames || ""} ${
|
|
@@ -3499,9 +3563,12 @@ export default {
|
|
|
3499
3563
|
</span>
|
|
3500
3564
|
</div>
|
|
3501
3565
|
<div class="d-flex">
|
|
3502
|
-
<
|
|
3503
|
-
|
|
3504
|
-
|
|
3566
|
+
<div class="nav-input-clearable">
|
|
3567
|
+
<input type="number"
|
|
3568
|
+
class="nav-input"
|
|
3569
|
+
value="${value}">
|
|
3570
|
+
${clearButton}
|
|
3571
|
+
</div>
|
|
3505
3572
|
|
|
3506
3573
|
<span class="text-hint"${hintStyle}>
|
|
3507
3574
|
${props.textHint || ""}
|
|
@@ -3510,6 +3577,22 @@ export default {
|
|
|
3510
3577
|
</div>`);
|
|
3511
3578
|
|
|
3512
3579
|
let inputElem = elem.querySelector("input");
|
|
3580
|
+
let clearButtonElem = elem.querySelector(".nav-input-clear");
|
|
3581
|
+
|
|
3582
|
+
if (clearButtonElem) {
|
|
3583
|
+
const syncClearButton = () => {
|
|
3584
|
+
clearButtonElem.classList.toggle("is-hidden", inputElem.value === "");
|
|
3585
|
+
};
|
|
3586
|
+
clearButtonElem.addEventListener("click", (event) => {
|
|
3587
|
+
event.preventDefault();
|
|
3588
|
+
event.stopPropagation();
|
|
3589
|
+
inputElem.value = "";
|
|
3590
|
+
inputElem.dispatchEvent(new Event("input", { bubbles: true }));
|
|
3591
|
+
inputElem.focus();
|
|
3592
|
+
});
|
|
3593
|
+
inputElem.addEventListener("input", syncClearButton);
|
|
3594
|
+
syncClearButton();
|
|
3595
|
+
}
|
|
3513
3596
|
|
|
3514
3597
|
this.addKeyDownInputEvents(inputElem, elem, props);
|
|
3515
3598
|
|
|
@@ -3751,6 +3834,34 @@ export default {
|
|
|
3751
3834
|
return elem;
|
|
3752
3835
|
},
|
|
3753
3836
|
|
|
3837
|
+
createInputCheckboxList(props, dataDay, daySelected = null, selected = []) {
|
|
3838
|
+
let value = [];
|
|
3839
|
+
let options = typeof props.options === "function" ? props.options({ dataDay, daySelected, selected }) : props.options;
|
|
3840
|
+
options = options || [];
|
|
3841
|
+
|
|
3842
|
+
if (dataDay && dataDay.values) {
|
|
3843
|
+
const val = utils.getVarByPath(dataDay, props.varName);
|
|
3844
|
+
value = val && Array.isArray(val.value) ? val.value.map((item) => String(item)) : [];
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
let str = `<div input-key="${props.key || ""}" class="${props.isHidden ? "hide" : ""}">
|
|
3848
|
+
<div class="input-section cap-checkbox-list-section">
|
|
3849
|
+
<span class="text-subtitle">${props.label}</span>
|
|
3850
|
+
${props.helpText ? `<span class="cap-checkbox-list-help">${props.helpText}</span>` : ""}
|
|
3851
|
+
<div class="cap-checkbox-list" role="group" aria-label="${props.label}">`;
|
|
3852
|
+
|
|
3853
|
+
options.forEach((option) => {
|
|
3854
|
+
const checked = value.indexOf(String(option.id)) !== -1 ? "checked" : "";
|
|
3855
|
+
str += `<label class="cap-checkbox-list-option">
|
|
3856
|
+
<input class="input-checkbox-list" type="checkbox" value="${option.id}" ${checked}>
|
|
3857
|
+
<span>${option.label}</span>
|
|
3858
|
+
</label>`;
|
|
3859
|
+
});
|
|
3860
|
+
|
|
3861
|
+
str += `</div></div></div>`;
|
|
3862
|
+
return dom.createElementFromHTML(str);
|
|
3863
|
+
},
|
|
3864
|
+
|
|
3754
3865
|
/**
|
|
3755
3866
|
* Crea Input de texto TextArea como elemento Dom
|
|
3756
3867
|
*
|