capibara 1.3.64 → 1.3.66
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
package/src/lib/capibara.js
CHANGED
|
@@ -986,6 +986,8 @@ export class Capibara{
|
|
|
986
986
|
this.selected.splice(index, 1);
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
+
this.refreshInputsShowInputIf();
|
|
990
|
+
|
|
989
991
|
this.setIndexToSelected();
|
|
990
992
|
|
|
991
993
|
if(redraw){
|
|
@@ -1021,6 +1023,8 @@ export class Capibara{
|
|
|
1021
1023
|
this.redraw({
|
|
1022
1024
|
cornerRight: true,
|
|
1023
1025
|
});
|
|
1026
|
+
this.$navRightDataDay = dataDay;
|
|
1027
|
+
this.$navRightDaySelected = this.selected[0];
|
|
1024
1028
|
let {inputs, element, inputsWithReload, saveCancelBtns} = tableElements.redrawNavRight(this.config, this.$elements.$navRight, this.selected, this.tabSelected, dataDay, this.selected[0]);
|
|
1025
1029
|
this.$elements.$navRight = element;
|
|
1026
1030
|
this.$inputsNavRight = inputs;
|
|
@@ -1030,6 +1034,8 @@ export class Capibara{
|
|
|
1030
1034
|
|
|
1031
1035
|
}
|
|
1032
1036
|
|
|
1037
|
+
this.refreshInputsShowInputIf();
|
|
1038
|
+
|
|
1033
1039
|
|
|
1034
1040
|
let focused = false;
|
|
1035
1041
|
if(!(this.isMobile && this.mobileSelectable)){
|
|
@@ -1057,6 +1063,30 @@ export class Capibara{
|
|
|
1057
1063
|
};
|
|
1058
1064
|
|
|
1059
1065
|
|
|
1066
|
+
/**
|
|
1067
|
+
* Re-evalua showInputIf/disabledIf de cada input del sidebar derecho contra la seleccion actual,
|
|
1068
|
+
* mostrando/ocultando o habilitando/deshabilitando sin perder los valores ya ingresados por el usuario.
|
|
1069
|
+
*/
|
|
1070
|
+
refreshInputsShowInputIf(){
|
|
1071
|
+
if(!this.$inputsNavRight || !this.tabSelected || !this.tabSelected.inputs) return;
|
|
1072
|
+
|
|
1073
|
+
this.$inputsNavRight.forEach($input => {
|
|
1074
|
+
let key = $input.getAttribute("input-key");
|
|
1075
|
+
let inputConfig = this.tabSelected.inputs.find(t => t.key == key);
|
|
1076
|
+
if(!inputConfig) return;
|
|
1077
|
+
|
|
1078
|
+
if(inputConfig.showInputIf){
|
|
1079
|
+
let isVisible = inputConfig.showInputIf(this.$navRightDataDay, this.$navRightDaySelected, this.selected, this.tabSelected);
|
|
1080
|
+
$input.classList[isVisible ? "remove" : "add"]("hide");
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
if(inputConfig.disabledIf){
|
|
1084
|
+
tableElements.applyDisabledIf($input, inputConfig, this.$navRightDataDay, this.$navRightDaySelected, this.selected, this.tabSelected);
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
|
|
1060
1090
|
setIndexToSelected(){
|
|
1061
1091
|
this.selected.forEach((s, index) => {
|
|
1062
1092
|
s.index = index+1;
|
|
@@ -519,6 +519,25 @@
|
|
|
519
519
|
height: 18px;
|
|
520
520
|
vertical-align: middle;
|
|
521
521
|
}
|
|
522
|
+
|
|
523
|
+
.cap-checkbox-label {
|
|
524
|
+
border-radius: 6px;
|
|
525
|
+
padding: 4px 6px;
|
|
526
|
+
margin: -4px -6px;
|
|
527
|
+
transition: background-color 0.15s ease;
|
|
528
|
+
cursor: pointer;
|
|
529
|
+
|
|
530
|
+
&:hover {
|
|
531
|
+
background-color: rgba(25, 118, 210, 0.15);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
&.is-disabled {
|
|
535
|
+
cursor: not-allowed;
|
|
536
|
+
&:hover {
|
|
537
|
+
background-color: transparent;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
522
541
|
}
|
|
523
542
|
|
|
524
543
|
@each $nameTheme, $theme in $themes {
|
|
@@ -1926,12 +1926,6 @@ export default {
|
|
|
1926
1926
|
if (tabSelected && tabSelected.inputs) {
|
|
1927
1927
|
tabSelected.inputs.forEach((i) => {
|
|
1928
1928
|
if (i.disabled) return;
|
|
1929
|
-
if (
|
|
1930
|
-
i.showInputIf &&
|
|
1931
|
-
!i.showInputIf(dataDay, daySelected, selected, tabSelected)
|
|
1932
|
-
) {
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
1929
|
|
|
1936
1930
|
let $input = this.createInput(
|
|
1937
1931
|
i,
|
|
@@ -1941,6 +1935,24 @@ export default {
|
|
|
1941
1935
|
tabSelected
|
|
1942
1936
|
);
|
|
1943
1937
|
if ($input) {
|
|
1938
|
+
if (
|
|
1939
|
+
i.showInputIf &&
|
|
1940
|
+
!i.showInputIf(dataDay, daySelected, selected, tabSelected)
|
|
1941
|
+
) {
|
|
1942
|
+
$input.classList.add("hide");
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
if (i.disabledIf) {
|
|
1946
|
+
this.applyDisabledIf(
|
|
1947
|
+
$input,
|
|
1948
|
+
i,
|
|
1949
|
+
dataDay,
|
|
1950
|
+
daySelected,
|
|
1951
|
+
selected,
|
|
1952
|
+
tabSelected
|
|
1953
|
+
);
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1944
1956
|
$divContainer.appendChild($input);
|
|
1945
1957
|
$inputs.push($input);
|
|
1946
1958
|
|
|
@@ -3295,6 +3307,11 @@ export default {
|
|
|
3295
3307
|
}
|
|
3296
3308
|
}
|
|
3297
3309
|
|
|
3310
|
+
let hintLines = props.textHintMinLines || 0;
|
|
3311
|
+
let hintStyle = hintLines
|
|
3312
|
+
? ` style="min-height:${(hintLines * 1.3).toFixed(2)}em;line-height:1.3;"`
|
|
3313
|
+
: "";
|
|
3314
|
+
|
|
3298
3315
|
let $elem = dom.createElementFromHTML(`
|
|
3299
3316
|
<div class="input-section ${
|
|
3300
3317
|
props.isHidden ? "hide" : ""
|
|
@@ -3319,7 +3336,7 @@ export default {
|
|
|
3319
3336
|
max="59"
|
|
3320
3337
|
value="${mmValue}">
|
|
3321
3338
|
</div>
|
|
3322
|
-
<span class="text-hint">
|
|
3339
|
+
<span class="text-hint"${hintStyle}>
|
|
3323
3340
|
${props.textHint || ""}
|
|
3324
3341
|
</span>
|
|
3325
3342
|
</div>
|
|
@@ -3419,6 +3436,11 @@ export default {
|
|
|
3419
3436
|
}
|
|
3420
3437
|
value = value || "";
|
|
3421
3438
|
|
|
3439
|
+
let hintLines = props.textHintMinLines || 0;
|
|
3440
|
+
let hintStyle = hintLines
|
|
3441
|
+
? ` style="min-height:${(hintLines * 1.3).toFixed(2)}em;line-height:1.3;"`
|
|
3442
|
+
: "";
|
|
3443
|
+
|
|
3422
3444
|
let elem = dom.createElementFromHTML(`
|
|
3423
3445
|
<div class="input-section ${props.classNames || ""} ${
|
|
3424
3446
|
props.isHidden ? "hide" : ""
|
|
@@ -3436,7 +3458,7 @@ export default {
|
|
|
3436
3458
|
class="nav-input"
|
|
3437
3459
|
value="${value}">
|
|
3438
3460
|
|
|
3439
|
-
<span class="text-hint">
|
|
3461
|
+
<span class="text-hint"${hintStyle}>
|
|
3440
3462
|
${props.textHint || ""}
|
|
3441
3463
|
</span>
|
|
3442
3464
|
</div>
|
|
@@ -4432,21 +4454,53 @@ export default {
|
|
|
4432
4454
|
if (dataDay && dataDay.values) {
|
|
4433
4455
|
value = utils.getVarByPath(dataDay, props.varName);
|
|
4434
4456
|
}
|
|
4457
|
+
let tooltipAttr = props.tooltip ? `cap-tooltip="${props.tooltip}"` : "";
|
|
4458
|
+
let tooltipClass = props.tooltip ? "cap-tooltip-wide" : "";
|
|
4435
4459
|
let r = dom.createElementFromHTML(`
|
|
4436
4460
|
<div class="input-section ${props.isHidden ? "hide" : ""} " input-key="${
|
|
4437
4461
|
props.key || ""
|
|
4438
4462
|
}">
|
|
4439
|
-
<label>
|
|
4463
|
+
<label class="cap-checkbox-label ${tooltipClass}" ${tooltipAttr} style="display:flex;align-items:center;gap:0.4em;">
|
|
4440
4464
|
<input type="checkbox" name="${props.key || ""}" input-key="${
|
|
4441
4465
|
props.key || ""
|
|
4442
4466
|
}" ${value ? "checked" : ""}>
|
|
4443
|
-
|
|
4467
|
+
<span style="font-weight:600;">${props.label}</span>
|
|
4444
4468
|
</label>
|
|
4445
4469
|
</div>`);
|
|
4446
4470
|
|
|
4447
4471
|
return r;
|
|
4448
4472
|
},
|
|
4449
4473
|
|
|
4474
|
+
/**
|
|
4475
|
+
* Aplica/actualiza estado disabled de un input segun disabledIf, sin ocultarlo
|
|
4476
|
+
*
|
|
4477
|
+
* @param {Object} $input - elemento Dom del input (contenedor .input-section)
|
|
4478
|
+
* @param {Object} props - config del input, debe tener disabledIf
|
|
4479
|
+
* @param {Object} dataDay - dia de referencia usado al renderizar el sidebar
|
|
4480
|
+
* @param {Object} daySelected - primer seleccionado, usado al renderizar el sidebar
|
|
4481
|
+
* @param {Array} selected - seleccion actual
|
|
4482
|
+
* @param {Object} tabSelected - tab actual
|
|
4483
|
+
*/
|
|
4484
|
+
applyDisabledIf($input, props, dataDay, daySelected, selected, tabSelected) {
|
|
4485
|
+
if (!props.disabledIf) return;
|
|
4486
|
+
|
|
4487
|
+
let isDisabled = !!props.disabledIf(dataDay, daySelected, selected, tabSelected);
|
|
4488
|
+
let $control = $input.querySelector("input, select, textarea, button");
|
|
4489
|
+
if ($control) {
|
|
4490
|
+
$control.disabled = isDisabled;
|
|
4491
|
+
$control.style.opacity = isDisabled ? "0.5" : "";
|
|
4492
|
+
}
|
|
4493
|
+
|
|
4494
|
+
let $span = $input.querySelector("label > span");
|
|
4495
|
+
if ($span) {
|
|
4496
|
+
$span.style.opacity = isDisabled ? "0.5" : "";
|
|
4497
|
+
}
|
|
4498
|
+
|
|
4499
|
+
let $label = $input.querySelector("label") || $input;
|
|
4500
|
+
$label.style.cursor = isDisabled ? "not-allowed" : "";
|
|
4501
|
+
$label.classList[isDisabled ? "add" : "remove"]("is-disabled");
|
|
4502
|
+
},
|
|
4503
|
+
|
|
4450
4504
|
createInputButtonsGroup(props) {
|
|
4451
4505
|
let $container = dom.createElementFromHTML(`
|
|
4452
4506
|
<div class="input-section ${props.isHidden ? "hide" : ""} " input-key="${
|