capibara 1.3.84 → 1.3.86
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 +274 -274
- package/package.json +1 -1
- package/src/lib/capibara.js +175 -24
- package/src/scss/abstracts/_variables.scss +1 -0
- package/src/scss/layout/_corner.scss +19 -0
- package/src/scss/layout/_detail_day.scss +171 -26
- package/src/util/tableElements.js +10 -1
package/package.json
CHANGED
package/src/lib/capibara.js
CHANGED
|
@@ -214,6 +214,7 @@ export class Capibara{
|
|
|
214
214
|
this.containerElement.innerHTML = "";
|
|
215
215
|
this.containerElement.appendChild($capibara);
|
|
216
216
|
this.selectTab(initialTab);
|
|
217
|
+
this.updateHeaderTitlesWidth();
|
|
217
218
|
|
|
218
219
|
return $capibara;
|
|
219
220
|
}
|
|
@@ -325,6 +326,10 @@ export class Capibara{
|
|
|
325
326
|
this.setShowNavInitial(!this.isShowNavInitial);
|
|
326
327
|
if(!this.isMobile){
|
|
327
328
|
this.setShowNavExtended(!this.isShowNavExtended);
|
|
329
|
+
}else if(this.config.timeline.nav.left.mobileHeaderTitles){
|
|
330
|
+
// Con el sidebar abierto se muestra la columna de botones, como en escritorio: los títulos
|
|
331
|
+
// del header extendido quedan sobre ella y no encima de los títulos de las columnas.
|
|
332
|
+
this.setShowNavButtons(this.isShowNavInitial);
|
|
328
333
|
}else{
|
|
329
334
|
let cornerInputTitles = this.$elements.$corner.querySelector(".input-titles");
|
|
330
335
|
if(cornerInputTitles){
|
|
@@ -366,6 +371,48 @@ export class Capibara{
|
|
|
366
371
|
setShowNavButtons(isShowNavButtons){
|
|
367
372
|
this.isShowNavButtons = isShowNavButtons;
|
|
368
373
|
styleUtils.setNavLeftButtonsStyle(this.config, this.isShowNavButtons, this.tabSelected);
|
|
374
|
+
this.fitHeaderTitlesMobile();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Con nav.left.mobileHeaderTitles, en mobile y con la columna de botones visible, la ensancha hasta
|
|
379
|
+
* el ancho de los títulos del header extendido para que quepan sin montarse sobre los títulos de
|
|
380
|
+
* las columnas del sidebar. Mide todos los títulos (también los no persistentes) para no tener
|
|
381
|
+
* que recalcular al mostrar u ocultar el header extendido.
|
|
382
|
+
*/
|
|
383
|
+
fitHeaderTitlesMobile(){
|
|
384
|
+
if(!this.isMobile || !this.isShowNavButtons || !this.config.timeline.nav.left.mobileHeaderTitles) return;
|
|
385
|
+
let needed = this.measureHeaderTitles();
|
|
386
|
+
let current = parseFloat(utils.getCSSVariable(this.config, "--btn-nav-width")) || 0;
|
|
387
|
+
if(needed > current){
|
|
388
|
+
utils.setCSSVariable(this.config, "--btn-nav-width", needed + "px");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Ancho en px del título más largo del header extendido (en el corner), contando también los no
|
|
394
|
+
* persistentes. 0 si no hay títulos o el corner aún no está en el DOM.
|
|
395
|
+
*/
|
|
396
|
+
measureHeaderTitles(){
|
|
397
|
+
let titles = this.$elements && this.$elements.$corner && this.$elements.$corner.querySelector(".input-titles");
|
|
398
|
+
if(!titles) return 0;
|
|
399
|
+
titles.classList.add("input-titles--measure");
|
|
400
|
+
let needed = 0;
|
|
401
|
+
titles.querySelectorAll(".input-title").forEach((span) => {
|
|
402
|
+
needed = Math.max(needed, Math.ceil(span.getBoundingClientRect().width));
|
|
403
|
+
});
|
|
404
|
+
titles.classList.remove("input-titles--measure");
|
|
405
|
+
return needed;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Publica en --header-titles-width el ancho de los títulos del header extendido. El select de
|
|
410
|
+
* agrupación del corner lo usa para no quedar debajo de esos títulos cuando se dibujan sobre la
|
|
411
|
+
* columna del nav (sidebar cerrado).
|
|
412
|
+
*/
|
|
413
|
+
updateHeaderTitlesWidth(){
|
|
414
|
+
if(!this.$elements || !this.$elements.$corner) return;
|
|
415
|
+
utils.setCSSVariable(this.config, "--header-titles-width", this.measureHeaderTitles() + "px");
|
|
369
416
|
}
|
|
370
417
|
|
|
371
418
|
|
|
@@ -777,7 +824,15 @@ export class Capibara{
|
|
|
777
824
|
*/
|
|
778
825
|
mouseMoveOnFlexBoxContainer(evt){
|
|
779
826
|
let position = utils.eventToPosition(this.config, evt, this.$elements.$table);
|
|
780
|
-
this.
|
|
827
|
+
let last = this.lastDetailDayPosition;
|
|
828
|
+
let isSameCell = last &&
|
|
829
|
+
!this.$elements.$detailDay.classList.contains("dd-hide") &&
|
|
830
|
+
last.position.top === position.top &&
|
|
831
|
+
last.position.left === position.left &&
|
|
832
|
+
last.scrollTop === utils.tablePositions.scrollTop;
|
|
833
|
+
if(!isSameCell){
|
|
834
|
+
this.refreshDetailDayPosition(position);
|
|
835
|
+
}
|
|
781
836
|
evt.preventDefault();
|
|
782
837
|
}
|
|
783
838
|
|
|
@@ -788,8 +843,22 @@ export class Capibara{
|
|
|
788
843
|
* @param {Object} evt - Evento de mouseleave
|
|
789
844
|
*/
|
|
790
845
|
mouseLeaveOnFloatBoxContainer(evt){
|
|
791
|
-
this.hideDetailDay();
|
|
792
846
|
evt.preventDefault();
|
|
847
|
+
let $detailDay = this.$elements.$detailDay;
|
|
848
|
+
if(evt.relatedTarget && $detailDay.contains(evt.relatedTarget)) return;
|
|
849
|
+
// margen para cruzar hasta el panel y poder hacer scroll en él
|
|
850
|
+
clearTimeout(this.hideDetailDayTimer);
|
|
851
|
+
this.hideDetailDayTimer = setTimeout(() => this.hideDetailDay(), 200);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
mouseEnterDetailDay(){
|
|
855
|
+
clearTimeout(this.hideDetailDayTimer);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
mouseLeaveDetailDay(evt){
|
|
859
|
+
let related = evt.relatedTarget;
|
|
860
|
+
if(related && this.$elements.$floatBoxContainer.contains(related)) return;
|
|
861
|
+
this.hideDetailDay();
|
|
793
862
|
}
|
|
794
863
|
|
|
795
864
|
/**
|
|
@@ -1268,6 +1337,7 @@ export class Capibara{
|
|
|
1268
1337
|
* oculta detailDay en el dom, usando la clase dd-hide
|
|
1269
1338
|
*/
|
|
1270
1339
|
hideDetailDay(){
|
|
1340
|
+
clearTimeout(this.hideDetailDayTimer);
|
|
1271
1341
|
this.$elements.$detailDay.classList.add("dd-hide");
|
|
1272
1342
|
};
|
|
1273
1343
|
|
|
@@ -1354,32 +1424,94 @@ export class Capibara{
|
|
|
1354
1424
|
*
|
|
1355
1425
|
* @param {Object} evt - evento de mousemove, para posiciones en pantalla
|
|
1356
1426
|
*/
|
|
1357
|
-
refreshDetailDayPosition(position){
|
|
1427
|
+
refreshDetailDayPosition(position, scrollTarget = {}){
|
|
1428
|
+
let $detailDay = this.$elements.$detailDay;
|
|
1429
|
+
let $container = this.$elements.$container;
|
|
1358
1430
|
let dayWidth = parseFloat(utils.getCSSVariable(this.config, "--day-width"));
|
|
1359
1431
|
let itemHeight = parseFloat(utils.getCSSVariable(this.config, "--item-height"));
|
|
1432
|
+
let headerHeight = parseFloat(utils.getCSSVariable(this.config, "--header-height"));
|
|
1433
|
+
let margin = 8;
|
|
1434
|
+
let arrowSpace = 20;
|
|
1360
1435
|
|
|
1361
|
-
|
|
1362
|
-
this.$elements.$detailDay.style.left = position.left + dayWidth + "px";
|
|
1363
|
-
|
|
1364
|
-
let yPositionClass = "has-top-arrow";
|
|
1365
|
-
let xPositionClass = "";
|
|
1436
|
+
let xPositionClass = position.xPercent > 30 ? "has-right-arrow" : "";
|
|
1366
1437
|
|
|
1367
|
-
//
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1438
|
+
//quita dd-hide, sobreescribiendo todas las clases
|
|
1439
|
+
$detailDay.className = "detail-day has-fitted-position " + xPositionClass;
|
|
1440
|
+
$detailDay.style.left = position.left + dayWidth + "px";
|
|
1441
|
+
|
|
1442
|
+
// En mobile el contenedor hace scroll suave hasta la celda: se calcula con
|
|
1443
|
+
// el scroll de destino, no con el actual.
|
|
1444
|
+
let scrollTop = scrollTarget.top != null ? scrollTarget.top : utils.tablePositions.scrollTop;
|
|
1445
|
+
let scrollLeft = scrollTarget.left != null ? scrollTarget.left : utils.tablePositions.scrollLeft;
|
|
1446
|
+
let visTop = scrollTop + margin;
|
|
1447
|
+
// La tabla parte bajo la cabecera, que puede ser extendida (fila de
|
|
1448
|
+
// gráficos): se usa su posición real y no solo --header-height.
|
|
1449
|
+
let tableTop = this.$elements.$table ? this.$elements.$table.offsetTop : headerHeight;
|
|
1450
|
+
let visBottom = scrollTop + $container.clientHeight - tableTop - margin;
|
|
1451
|
+
|
|
1452
|
+
// Ancho libre entre la celda y el borde del contenedor, del lado donde se
|
|
1453
|
+
// abre el panel (puede cubrir la columna de nombres).
|
|
1454
|
+
let navWidth = this.$elements.$navLeft ? this.$elements.$navLeft.clientWidth : 0;
|
|
1455
|
+
let cellLeftClient = position.left - scrollLeft + navWidth;
|
|
1456
|
+
let availableLeft = Math.max(cellLeftClient - arrowSpace - margin, 200);
|
|
1457
|
+
let availableRight = Math.max($container.clientWidth - (cellLeftClient + dayWidth) - arrowSpace - margin, 200);
|
|
1458
|
+
let available = xPositionClass ? availableLeft : availableRight;
|
|
1459
|
+
|
|
1460
|
+
$detailDay.style.width = "";
|
|
1461
|
+
$detailDay.style.maxWidth = this.isMobile ? available + "px" : "";
|
|
1462
|
+
// min-width del CSS ganaría a este max-width en pantallas angostas
|
|
1463
|
+
$detailDay.style.minWidth = this.isMobile ? "0" : "";
|
|
1464
|
+
$detailDay.style.maxHeight = Math.max(visBottom - visTop, itemHeight * 3) + "px";
|
|
1465
|
+
|
|
1466
|
+
// Si el contenido no cabe en alto, primero se ensancha el panel de a una
|
|
1467
|
+
// columna (el grid agrega columnas solo) mientras haya espacio al costado;
|
|
1468
|
+
// si aun así no cabe, se prueba con una densidad más compacta. Con poco
|
|
1469
|
+
// contenido queda el tamaño y el espaciado normal.
|
|
1470
|
+
let $body = $detailDay.querySelector(".detail-day__body");
|
|
1471
|
+
if($body){
|
|
1472
|
+
let baseClass = "detail-day has-fitted-position " + xPositionClass;
|
|
1473
|
+
let overflows = () => $body.scrollHeight > $body.clientHeight + 1;
|
|
1474
|
+
let maxDensity = this.isMobile ? 2 : 3;
|
|
1475
|
+
let applyDensity = (density) => {
|
|
1476
|
+
$detailDay.className = density ? baseClass + " dd-density-" + density : baseClass;
|
|
1477
|
+
$detailDay.style.width = "";
|
|
1478
|
+
$detailDay.style.maxWidth = this.isMobile ? available + "px" : "";
|
|
1479
|
+
let width = $detailDay.offsetWidth;
|
|
1480
|
+
while(overflows() && width < available){
|
|
1481
|
+
width = Math.min(width + 160, available);
|
|
1482
|
+
$detailDay.style.maxWidth = available + "px";
|
|
1483
|
+
$detailDay.style.width = width + "px";
|
|
1484
|
+
}
|
|
1485
|
+
return !overflows();
|
|
1486
|
+
};
|
|
1487
|
+
let fits = applyDensity(0);
|
|
1488
|
+
// Si no cabe del lado por defecto y el otro lado tiene bastante más
|
|
1489
|
+
// espacio, se abre hacia ese lado antes de compactar.
|
|
1490
|
+
let otherAvailable = xPositionClass ? availableRight : availableLeft;
|
|
1491
|
+
if(!fits && !this.isMobile && otherAvailable > available + 160){
|
|
1492
|
+
xPositionClass = xPositionClass ? "" : "has-right-arrow";
|
|
1493
|
+
baseClass = "detail-day has-fitted-position " + xPositionClass;
|
|
1494
|
+
available = otherAvailable;
|
|
1495
|
+
fits = applyDensity(0);
|
|
1496
|
+
}
|
|
1497
|
+
for(let density = 1; density <= maxDensity && !fits; density++){
|
|
1498
|
+
fits = applyDensity(density);
|
|
1499
|
+
}
|
|
1500
|
+
// En el teléfono, si ni compactando cabe, igual habrá scroll: se
|
|
1501
|
+
// prefiere letra legible a ahorrar unas líneas.
|
|
1502
|
+
if(!fits && this.isMobile) applyDensity(1);
|
|
1375
1503
|
}
|
|
1376
1504
|
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1505
|
+
// Centra el panel en la celda y lo desplaza lo justo para no salir del
|
|
1506
|
+
// área visible; la flecha sigue apuntando a la celda.
|
|
1507
|
+
let height = $detailDay.offsetHeight;
|
|
1508
|
+
let cellCenter = position.top + itemHeight / 2;
|
|
1509
|
+
let top = Math.max(Math.min(cellCenter - height / 2, visBottom - height), visTop);
|
|
1510
|
+
let arrowTop = Math.max(6, Math.min(cellCenter - top - 10, height - 26));
|
|
1380
1511
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1512
|
+
$detailDay.style.top = top + "px";
|
|
1513
|
+
$detailDay.style.setProperty("--dd-arrow-top", arrowTop + "px");
|
|
1514
|
+
this.lastDetailDayPosition = { position, scrollTarget, scrollTop };
|
|
1383
1515
|
}
|
|
1384
1516
|
|
|
1385
1517
|
|
|
@@ -1410,6 +1542,7 @@ export class Capibara{
|
|
|
1410
1542
|
* usada para mostrar detalle de dia/item del floatbox
|
|
1411
1543
|
*/
|
|
1412
1544
|
mouseOverFloatBox(evt, force){
|
|
1545
|
+
clearTimeout(this.hideDetailDayTimer);
|
|
1413
1546
|
let item = evt.detail.item;
|
|
1414
1547
|
let dataDay = evt.detail.data;
|
|
1415
1548
|
|
|
@@ -1421,6 +1554,11 @@ export class Capibara{
|
|
|
1421
1554
|
this.$elements.$detailDay.innerHTML = newDDContentString;
|
|
1422
1555
|
}
|
|
1423
1556
|
this.lastDataDay = dataDay;
|
|
1557
|
+
// el alto cambió con el contenido: recalcular sobre la misma celda
|
|
1558
|
+
let last = this.lastDetailDayPosition;
|
|
1559
|
+
if(last && !this.$elements.$detailDay.classList.contains("dd-hide")){
|
|
1560
|
+
this.refreshDetailDayPosition(last.position, last.scrollTarget);
|
|
1561
|
+
}
|
|
1424
1562
|
}
|
|
1425
1563
|
}
|
|
1426
1564
|
|
|
@@ -1622,12 +1760,16 @@ export class Capibara{
|
|
|
1622
1760
|
let top = pos.top - 0.5 * itemHeight;
|
|
1623
1761
|
|
|
1624
1762
|
let position = utils.eventToPosition(this.config, evt, this.$elements.$table);
|
|
1763
|
+
let $container = this.$elements.$container;
|
|
1764
|
+
let maxTop = Math.max($container.scrollHeight - $container.clientHeight, 0);
|
|
1765
|
+
let maxLeft = Math.max($container.scrollWidth - $container.clientWidth, 0);
|
|
1766
|
+
top = Math.min(Math.max(top, 0), maxTop);
|
|
1767
|
+
left = Math.min(Math.max(left, 0), maxLeft);
|
|
1625
1768
|
this.refreshDetailDayPosition({
|
|
1626
1769
|
...position,
|
|
1627
|
-
topClient : position.yInnerPercent >= 70 ? position.topClient : 0, // fuerza posicion de arrow en detailday
|
|
1628
1770
|
xPercent : position.x < 4 ? 0: 100 // fuerza arrow right
|
|
1629
|
-
});
|
|
1630
|
-
|
|
1771
|
+
}, { top, left });
|
|
1772
|
+
$container.scroll({
|
|
1631
1773
|
top, left,
|
|
1632
1774
|
behavior: 'smooth'
|
|
1633
1775
|
});
|
|
@@ -1680,6 +1822,13 @@ export class Capibara{
|
|
|
1680
1822
|
this.$elements.$floatBoxContainer.addEventListener("mouseleave", this.mouseLeaveOnFloatBoxContainer.bind(this));
|
|
1681
1823
|
this.$elements.$floatBoxContainer.addEventListener("contextmenu", this.rightClickOnFloatBox.bind(this));
|
|
1682
1824
|
|
|
1825
|
+
this.$elements.$detailDay.addEventListener("mouseenter", this.mouseEnterDetailDay.bind(this));
|
|
1826
|
+
this.$elements.$detailDay.addEventListener("mouseleave", this.mouseLeaveDetailDay.bind(this));
|
|
1827
|
+
// el panel vive dentro de $table: sin esto un click en él selecciona el día de abajo
|
|
1828
|
+
["click", "mousemove", "contextmenu"].forEach((name) => {
|
|
1829
|
+
this.$elements.$detailDay.addEventListener(name, (e) => e.stopPropagation());
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1683
1832
|
this.$elements.$table.addEventListener("mousemove", this.mouseMoveOnTable.bind(this) );
|
|
1684
1833
|
this.$elements.$table.addEventListener("click", this.clickOnTable.bind(this));
|
|
1685
1834
|
this.$elements.$table.addEventListener("contextmenu", this.rightClickOnTable.bind(this));
|
|
@@ -1758,6 +1907,7 @@ export class Capibara{
|
|
|
1758
1907
|
|
|
1759
1908
|
if(options.cornerLeft){
|
|
1760
1909
|
tableElements.redrawCorner(this.$elements.$corner, this.config, this.tabSelected);
|
|
1910
|
+
this.updateHeaderTitlesWidth();
|
|
1761
1911
|
}
|
|
1762
1912
|
|
|
1763
1913
|
if(options.cornerRight){
|
|
@@ -1825,6 +1975,7 @@ export class Capibara{
|
|
|
1825
1975
|
styleUtils.setNavLeftInitialStyle(config, this.isShowNavInitial, this.tabSelected);
|
|
1826
1976
|
styleUtils.setNavLeftExtendedStyle(config, this.isShowNavExtended, this.tabSelected);
|
|
1827
1977
|
styleUtils.setNavLeftButtonsStyle(config, this.isShowNavButtons, this.tabSelected);
|
|
1978
|
+
this.fitHeaderTitlesMobile();
|
|
1828
1979
|
styleUtils.setTableStyle(config);
|
|
1829
1980
|
}
|
|
1830
1981
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
--initial-nav-width : 0px; //calc(var(--nav-item-col-width) * 3);
|
|
12
12
|
--ex-nav-width : 0px; //calc(var(--nav-item-col-width) * 6);
|
|
13
13
|
--btn-nav-width : 117px;
|
|
14
|
+
--header-titles-width : 0px; // ancho de los títulos del header extendido (updateHeaderTitlesWidth)
|
|
14
15
|
--nav-right-width : 300px;
|
|
15
16
|
--item-min-width : 100px;
|
|
16
17
|
--item-height : 45px;
|
|
@@ -65,6 +65,17 @@
|
|
|
65
65
|
// corrido por ese padding y si no se compensa, se solapa con la
|
|
66
66
|
// columna siguiente (Riego Nominal, etc).
|
|
67
67
|
width: calc(var(--nav-width) - 16px);
|
|
68
|
+
// Con el sidebar cerrado, los títulos del header extendido (Eto con su
|
|
69
|
+
// promedio, oidio, …) se dibujan a la derecha del corner, encima de esta
|
|
70
|
+
// columna: el select se acorta para terminar antes de ellos.
|
|
71
|
+
// --header-titles-width lo publica Capibara.updateHeaderTitlesWidth().
|
|
72
|
+
width: min(
|
|
73
|
+
calc(var(--nav-width) - 16px),
|
|
74
|
+
calc(
|
|
75
|
+
var(--nav-width) + var(--initial-nav-width) + var(--ex-nav-width) +
|
|
76
|
+
var(--btn-nav-width) - var(--header-titles-width) - 16px
|
|
77
|
+
)
|
|
78
|
+
);
|
|
68
79
|
box-sizing: border-box;
|
|
69
80
|
display: flex;
|
|
70
81
|
flex-direction: column;
|
|
@@ -232,6 +243,14 @@
|
|
|
232
243
|
right: 0px;
|
|
233
244
|
top: var(--header-labels-height);
|
|
234
245
|
|
|
246
|
+
// Solo mientras fitHeaderTitlesMobile mide: todos los títulos visibles y en una línea.
|
|
247
|
+
&.input-titles--measure {
|
|
248
|
+
white-space: nowrap;
|
|
249
|
+
.input-title-container {
|
|
250
|
+
display: unset !important;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
235
254
|
.input-title-container {
|
|
236
255
|
position: relative;
|
|
237
256
|
border-radius: 3px;
|
|
@@ -4,48 +4,87 @@
|
|
|
4
4
|
|
|
5
5
|
.capibara {
|
|
6
6
|
.detail-day {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// Fertilización: una fila por producto para que varios productos no
|
|
8
|
+
// multipliquen el alto del panel.
|
|
9
|
+
.item-detail--wide {
|
|
10
|
+
grid-column: 1 / -1;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
margin-top: 0.375rem;
|
|
12
|
+
.item-description {
|
|
13
|
+
display: block;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// Variante ancha que reparte los valores (ej. productos) en columnas.
|
|
18
|
+
.list-detail.detail-grid .item-detail.item-detail--wide.item-detail--columns .item-description {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
|
|
21
|
+
gap: 0.25rem 1rem;
|
|
22
|
+
align-items: start;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
.fert-
|
|
25
|
+
.fert-table {
|
|
24
26
|
width: 100%;
|
|
25
27
|
border-collapse: collapse;
|
|
26
|
-
table-layout: fixed;
|
|
27
28
|
font-size: inherit;
|
|
29
|
+
font-variant-numeric: tabular-nums;
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
th,
|
|
32
|
+
td {
|
|
33
|
+
padding: 0.25rem 0 0.25rem 0.75rem;
|
|
34
|
+
vertical-align: baseline;
|
|
35
|
+
text-align: right;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
overflow-wrap: normal;
|
|
38
|
+
word-break: normal;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
th,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
th:first-child,
|
|
42
|
+
td:first-child {
|
|
43
|
+
padding-left: 0;
|
|
44
|
+
text-align: left;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
th {
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
thead th {
|
|
48
|
+
font-size: 0.8em;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
opacity: 0.7;
|
|
51
|
+
padding-top: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
tbody tr {
|
|
55
|
+
border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
tbody th {
|
|
42
59
|
text-align: left;
|
|
60
|
+
font-weight: 600;
|
|
61
|
+
white-space: normal;
|
|
62
|
+
overflow-wrap: anywhere;
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.fert-table__unit {
|
|
67
|
+
margin-left: 0.2em;
|
|
68
|
+
font-size: 0.85em;
|
|
69
|
+
opacity: 0.75;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fert-table__note {
|
|
73
|
+
display: block;
|
|
74
|
+
font-size: 0.8em;
|
|
43
75
|
font-weight: 400;
|
|
76
|
+
opacity: 0.7;
|
|
44
77
|
}
|
|
45
78
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
@media screen and (max-width: 600px) {
|
|
80
|
+
td {
|
|
81
|
+
line-height: 1.15;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fert-table__unit {
|
|
85
|
+
display: block;
|
|
86
|
+
margin-left: 0;
|
|
87
|
+
}
|
|
49
88
|
}
|
|
50
89
|
}
|
|
51
90
|
|
|
@@ -59,7 +98,7 @@
|
|
|
59
98
|
min-width: min(18rem, calc(100vw - 2rem));
|
|
60
99
|
max-width: min(42rem, calc(100vw - 2rem));
|
|
61
100
|
border: 1px solid grey;
|
|
62
|
-
padding: 0
|
|
101
|
+
padding: 0;
|
|
63
102
|
display: flex;
|
|
64
103
|
flex-flow: column nowrap;
|
|
65
104
|
margin: 0 0 0 1em;
|
|
@@ -99,6 +138,99 @@
|
|
|
99
138
|
display: none;
|
|
100
139
|
}
|
|
101
140
|
|
|
141
|
+
.detail-day__body {
|
|
142
|
+
flex: 1 1 auto;
|
|
143
|
+
min-height: 0;
|
|
144
|
+
padding: 0.75em;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-flow: column nowrap;
|
|
147
|
+
overflow-y: auto;
|
|
148
|
+
overscroll-behavior: contain;
|
|
149
|
+
border-radius: inherit;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Posición calculada en JS (top y --dd-arrow-top) para que el panel no
|
|
153
|
+
// salga del área visible. max-height no se anima: JS mide el alto final.
|
|
154
|
+
&.has-fitted-position {
|
|
155
|
+
transform: none;
|
|
156
|
+
transition: top 0.2s ease, left 0.2s ease, opacity 0.2s ease;
|
|
157
|
+
|
|
158
|
+
&:after {
|
|
159
|
+
top: var(--dd-arrow-top, 6px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&.has-right-arrow {
|
|
163
|
+
transform: translateX(calc(-100% - 20px - var(--day-width)));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Densidad: JS agrega dd-density-N solo cuando el contenido no cabe en el
|
|
168
|
+
// área visible ni ensanchando el panel. Con poco contenido no se aplica.
|
|
169
|
+
&.dd-density-1,
|
|
170
|
+
&.dd-density-2,
|
|
171
|
+
&.dd-density-3 {
|
|
172
|
+
.detail-day__body {
|
|
173
|
+
padding: 0.5em 0.625em;
|
|
174
|
+
}
|
|
175
|
+
// compensa el padding del body para quedar a ras del borde
|
|
176
|
+
.msj-container {
|
|
177
|
+
margin: 0 -0.625em -0.5em -0.625em;
|
|
178
|
+
}
|
|
179
|
+
.header-detail {
|
|
180
|
+
.title {
|
|
181
|
+
font-size: 1.125em;
|
|
182
|
+
margin-bottom: 0;
|
|
183
|
+
}
|
|
184
|
+
.subtitle {
|
|
185
|
+
margin-bottom: 4px;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
.list-detail.detail-grid {
|
|
189
|
+
gap: 0.25rem 0.75rem;
|
|
190
|
+
.item-detail {
|
|
191
|
+
padding: 0.375rem 0.5rem 0.375rem 0.75rem;
|
|
192
|
+
.name {
|
|
193
|
+
margin-bottom: 0.2rem;
|
|
194
|
+
}
|
|
195
|
+
.item-description {
|
|
196
|
+
gap: 0.125rem 0.75rem;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
.fert-table {
|
|
201
|
+
th,
|
|
202
|
+
td {
|
|
203
|
+
padding-top: 0.125rem;
|
|
204
|
+
padding-bottom: 0.125rem;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&.dd-density-2,
|
|
210
|
+
&.dd-density-3 {
|
|
211
|
+
font-size: 0.875em;
|
|
212
|
+
line-height: 1.25;
|
|
213
|
+
.list-detail.detail-grid {
|
|
214
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
|
|
215
|
+
}
|
|
216
|
+
// la nota del producto va en la misma línea que el nombre
|
|
217
|
+
.fert-table .fert-table__note {
|
|
218
|
+
display: inline;
|
|
219
|
+
margin-left: 0.5em;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&.dd-density-3 {
|
|
224
|
+
font-size: 0.8em;
|
|
225
|
+
line-height: 1.15;
|
|
226
|
+
.list-detail.detail-grid {
|
|
227
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
|
|
228
|
+
.item-detail {
|
|
229
|
+
padding: 0.25rem 0.375rem 0.25rem 0.5rem;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
102
234
|
&.has-right-arrow {
|
|
103
235
|
margin: 0px 16px 0px 0px;
|
|
104
236
|
transform: translateX(calc(-100% - 20px - var(--day-width)))
|
|
@@ -289,6 +421,9 @@
|
|
|
289
421
|
&.detail-grid {
|
|
290
422
|
display: grid;
|
|
291
423
|
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
|
|
424
|
+
// Las cápsulas chicas rellenan los huecos que deja una ancha
|
|
425
|
+
// (ej. Fertilización) en vez de dejar celdas vacías.
|
|
426
|
+
grid-auto-flow: row dense;
|
|
292
427
|
gap: 0.5rem 1rem;
|
|
293
428
|
|
|
294
429
|
// Una sola cápsula debe ocupar todo el ancho disponible.
|
|
@@ -327,7 +462,8 @@
|
|
|
327
462
|
margin: 0;
|
|
328
463
|
padding-inline: 0.125rem;
|
|
329
464
|
|
|
330
|
-
|
|
465
|
+
// el número no se corta; un sufijo largo puede pasar a otra línea
|
|
466
|
+
&.is-measurement .value {
|
|
331
467
|
white-space: nowrap;
|
|
332
468
|
}
|
|
333
469
|
|
|
@@ -448,6 +584,9 @@
|
|
|
448
584
|
// texto que contiene la explicación de la alerta.
|
|
449
585
|
width: 100%;
|
|
450
586
|
box-sizing: border-box;
|
|
587
|
+
// el ícono es absoluto: sin esto un aviso de una línea lo deja asomar
|
|
588
|
+
// bajo su caja y el mensaje siguiente lo tapa
|
|
589
|
+
min-height: 3em;
|
|
451
590
|
min-width: 0;
|
|
452
591
|
max-width: 100%;
|
|
453
592
|
overflow-wrap: anywhere;
|
|
@@ -500,6 +639,12 @@
|
|
|
500
639
|
}
|
|
501
640
|
}
|
|
502
641
|
|
|
642
|
+
// Los títulos con color hex de la configuración suelen ser oscuros
|
|
643
|
+
// (ej. #1a237e) y no se leen sobre el fondo del tema oscuro.
|
|
644
|
+
&.dark-theme .detail-day .item-detail.has-hex-color .name {
|
|
645
|
+
color: color-mix(in oklab, var(--local-color-font) 45%, white);
|
|
646
|
+
}
|
|
647
|
+
|
|
503
648
|
@each $nameTheme, $theme in $themes {
|
|
504
649
|
&#{$nameTheme} {
|
|
505
650
|
.detail-day {
|
|
@@ -2964,14 +2964,20 @@ export default {
|
|
|
2964
2964
|
if (utils.isHexColor(cap.color)) {
|
|
2965
2965
|
colorStyle = `--local-color: ${cap.color};`;
|
|
2966
2966
|
colorStyle += `--local-color-font: ${cap.color};`;
|
|
2967
|
+
colorClass = "has-hex-color";
|
|
2967
2968
|
} else {
|
|
2968
2969
|
colorClass = cap.color;
|
|
2969
2970
|
}
|
|
2970
2971
|
}
|
|
2972
|
+
// className puede depender del día (ej. ancho completo solo con muchos datos)
|
|
2973
|
+
let capClassName =
|
|
2974
|
+
typeof cap.className === "function"
|
|
2975
|
+
? cap.className(dataDay) || ""
|
|
2976
|
+
: cap.className || "";
|
|
2971
2977
|
if (hasValues && !hideIf) {
|
|
2972
2978
|
visibleItemsCount++; // Incrementar contador de elementos visibles
|
|
2973
2979
|
str += `
|
|
2974
|
-
<div class="item-detail ${colorClass}" style="${colorStyle}">
|
|
2980
|
+
<div class="item-detail ${colorClass} ${capClassName}" style="${colorStyle}">
|
|
2975
2981
|
|
|
2976
2982
|
<div class="left-icon ${cap.shape || ""} "></div>
|
|
2977
2983
|
|
|
@@ -3147,6 +3153,9 @@ export default {
|
|
|
3147
3153
|
</div>`;
|
|
3148
3154
|
}
|
|
3149
3155
|
|
|
3156
|
+
// El cuerpo hace scroll y el contenedor no: así la flecha (:after) no se recorta.
|
|
3157
|
+
str = `<div class="detail-day__body">${str}</div>`;
|
|
3158
|
+
|
|
3150
3159
|
let strContainer = `<div class="detail-day dd-hide"> ${str} </div>`;
|
|
3151
3160
|
|
|
3152
3161
|
if (onlyStringContent) return str;
|