@alexochihua/exos-library-components 2.25.28 → 2.25.29
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.
|
@@ -52744,6 +52744,7 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52744
52744
|
let cursorPosition = event.target.selectionStart;
|
|
52745
52745
|
let previousLength = valueInput.length;
|
|
52746
52746
|
const charLengt = props.charAmount ? props.charAmount.length : 0;
|
|
52747
|
+
let timeCursorPosition = null;
|
|
52747
52748
|
let emails = valueInput.replace(/ /g, '').split(props.charSplitEmail);
|
|
52748
52749
|
let allEmailCorrect = true;
|
|
52749
52750
|
let incorrectEmail = null;
|
|
@@ -52841,18 +52842,30 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52841
52842
|
}
|
|
52842
52843
|
case props.modelModifiers?.time:
|
|
52843
52844
|
{
|
|
52845
|
+
const rawValue = valueInput;
|
|
52846
|
+
const cursorPos = cursorPosition;
|
|
52847
|
+
const digitsBeforeCursor = countDigitsBefore(rawValue, cursorPos);
|
|
52848
|
+
|
|
52844
52849
|
// 1. Obtener solo los dígitos
|
|
52845
|
-
|
|
52850
|
+
let digitsOnly = valueInput.replace(/\D/g, '');
|
|
52851
|
+
const prevDigitsTime = (props.modelValue || '').replace(/\D/g, '');
|
|
52852
|
+
let digitsBeforeCursorForPosition = digitsBeforeCursor;
|
|
52853
|
+
if (props.modelValue && valueInput === prevDigitsTime && props.modelValue.length > valueInput.length && digitsBeforeCursor >= 1) {
|
|
52854
|
+
digitsOnly = digitsOnly.slice(0, digitsBeforeCursor - 1) + digitsOnly.slice(digitsBeforeCursor);
|
|
52855
|
+
digitsBeforeCursorForPosition = digitsBeforeCursor - 1;
|
|
52856
|
+
}
|
|
52846
52857
|
|
|
52847
52858
|
// 2. Formatear como HH:mm:ss
|
|
52848
52859
|
valueInput = formatToHHMMSS(digitsOnly);
|
|
52860
|
+
timeCursorPosition = getPositionAfterNDigits(valueInput, digitsBeforeCursorForPosition);
|
|
52849
52861
|
|
|
52850
52862
|
// 3. Validar que sea una hora válida (máximo 23:59:59)
|
|
52851
52863
|
const [hourStr, minStr, secStr] = valueInput.split(':');
|
|
52852
52864
|
const hour = parseInt(hourStr, 10);
|
|
52853
52865
|
const minute = parseInt(minStr ?? '0', 10);
|
|
52854
52866
|
const second = parseInt(secStr ?? '0', 10);
|
|
52855
|
-
const
|
|
52867
|
+
const invalidHour11SingleMinuteDigit = hour === 11 && minStr != null && minStr !== '' && minStr.length === 1;
|
|
52868
|
+
const isValid = hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60 && !invalidHour11SingleMinuteDigit;
|
|
52856
52869
|
if (isValid) {
|
|
52857
52870
|
resetRestrictions();
|
|
52858
52871
|
enteredTime = valueInput;
|
|
@@ -52867,12 +52880,23 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52867
52880
|
}
|
|
52868
52881
|
case props.modelModifiers?.timens:
|
|
52869
52882
|
{
|
|
52883
|
+
const rawValueTimens = valueInput;
|
|
52884
|
+
const cursorPosTimens = cursorPosition;
|
|
52885
|
+
const digitsBeforeCursorTimens = countDigitsBefore(rawValueTimens, cursorPosTimens);
|
|
52870
52886
|
let digitsOnly = valueInput.replace(/\D/g, '');
|
|
52887
|
+
const prevDigitsTimens = (props.modelValue || '').replace(/\D/g, '');
|
|
52888
|
+
let digitsBeforeCursorTimensForPosition = digitsBeforeCursorTimens;
|
|
52889
|
+
if (props.modelValue && valueInput === prevDigitsTimens && props.modelValue.length > valueInput.length && digitsBeforeCursorTimens >= 1) {
|
|
52890
|
+
digitsOnly = digitsOnly.slice(0, digitsBeforeCursorTimens - 1) + digitsOnly.slice(digitsBeforeCursorTimens);
|
|
52891
|
+
digitsBeforeCursorTimensForPosition = digitsBeforeCursorTimens - 1;
|
|
52892
|
+
}
|
|
52871
52893
|
valueInput = formatToHHMM(digitsOnly);
|
|
52894
|
+
timeCursorPosition = getPositionAfterNDigits(valueInput, digitsBeforeCursorTimensForPosition);
|
|
52872
52895
|
const [hourStr, minStr] = valueInput.split(':');
|
|
52873
52896
|
const hour = parseInt(hourStr, 10);
|
|
52874
52897
|
const minute = parseInt(minStr, 10);
|
|
52875
|
-
const
|
|
52898
|
+
const invalidHour11SingleMinuteDigit = hour === 11 && minStr != null && minStr !== '' && minStr.length === 1;
|
|
52899
|
+
const isValid = hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && !invalidHour11SingleMinuteDigit;
|
|
52876
52900
|
if (isValid) {
|
|
52877
52901
|
resetRestrictions();
|
|
52878
52902
|
} else {
|
|
@@ -52932,9 +52956,10 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52932
52956
|
}
|
|
52933
52957
|
event.target.setSelectionRange(position, position);
|
|
52934
52958
|
} else if (needsCursorAtEnd) {
|
|
52935
|
-
// Solo para modificadores que reformatean (time, timens)
|
|
52959
|
+
// Solo para modificadores que reformatean (time, timens): preservar posición según dígitos
|
|
52936
52960
|
const len = event.target.value.length;
|
|
52937
|
-
|
|
52961
|
+
const pos = timeCursorPosition != null ? timeCursorPosition : len;
|
|
52962
|
+
event.target.setSelectionRange(pos, pos);
|
|
52938
52963
|
} else {
|
|
52939
52964
|
// Para modificadores que solo filtran caracteres, preservar posición del cursor
|
|
52940
52965
|
const lengthDiff = valueInput.length - previousLength;
|
|
@@ -52966,10 +52991,28 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52966
52991
|
}
|
|
52967
52992
|
return '';
|
|
52968
52993
|
};
|
|
52994
|
+
const countDigitsBefore = (str, position) => {
|
|
52995
|
+
let count = 0;
|
|
52996
|
+
for (let i = 0; i < position && i < str.length; i++) {
|
|
52997
|
+
if (/\d/.test(str[i])) count++;
|
|
52998
|
+
}
|
|
52999
|
+
return count;
|
|
53000
|
+
};
|
|
53001
|
+
const getPositionAfterNDigits = (str, n) => {
|
|
53002
|
+
if (n <= 0) return 0;
|
|
53003
|
+
let digitCount = 0;
|
|
53004
|
+
let i = 0;
|
|
53005
|
+
for (; i < str.length && digitCount < n; i++) {
|
|
53006
|
+
if (/\d/.test(str[i])) digitCount++;
|
|
53007
|
+
}
|
|
53008
|
+
if (digitCount < n) return str.length;
|
|
53009
|
+
while (i < str.length && str[i] === ':') i++;
|
|
53010
|
+
return i;
|
|
53011
|
+
};
|
|
52969
53012
|
const formatToHHMM = raw => {
|
|
52970
53013
|
let digits = raw.replace(/\D/g, '');
|
|
52971
53014
|
if (digits.length === 0) return '';
|
|
52972
|
-
if (digits.length === 1) return
|
|
53015
|
+
if (digits.length === 1) return digits;
|
|
52973
53016
|
if (digits.length === 2) return `${digits}:`;
|
|
52974
53017
|
if (digits.length === 3) return `${digits.slice(0, 2)}:${digits[2]}`;
|
|
52975
53018
|
if (digits.length >= 4) return `${digits.slice(0, 2)}:${digits.slice(2, 4)}`;
|
|
@@ -52977,7 +53020,7 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52977
53020
|
const formatToHHMMSS = raw => {
|
|
52978
53021
|
let digits = raw.replace(/\D/g, '');
|
|
52979
53022
|
if (digits.length === 0) return '';
|
|
52980
|
-
if (digits.length === 1) return
|
|
53023
|
+
if (digits.length === 1) return digits;
|
|
52981
53024
|
if (digits.length === 2) return `${digits}:`;
|
|
52982
53025
|
if (digits.length === 3) return `${digits.slice(0, 2)}:${digits[2]}`;
|
|
52983
53026
|
if (digits.length === 4) return `${digits.slice(0, 2)}:${digits.slice(2, 4)}:`;
|
|
@@ -52762,6 +52762,7 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52762
52762
|
let cursorPosition = event.target.selectionStart;
|
|
52763
52763
|
let previousLength = valueInput.length;
|
|
52764
52764
|
const charLengt = props.charAmount ? props.charAmount.length : 0;
|
|
52765
|
+
let timeCursorPosition = null;
|
|
52765
52766
|
let emails = valueInput.replace(/ /g, '').split(props.charSplitEmail);
|
|
52766
52767
|
let allEmailCorrect = true;
|
|
52767
52768
|
let incorrectEmail = null;
|
|
@@ -52859,18 +52860,30 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52859
52860
|
}
|
|
52860
52861
|
case props.modelModifiers?.time:
|
|
52861
52862
|
{
|
|
52863
|
+
const rawValue = valueInput;
|
|
52864
|
+
const cursorPos = cursorPosition;
|
|
52865
|
+
const digitsBeforeCursor = countDigitsBefore(rawValue, cursorPos);
|
|
52866
|
+
|
|
52862
52867
|
// 1. Obtener solo los dígitos
|
|
52863
|
-
|
|
52868
|
+
let digitsOnly = valueInput.replace(/\D/g, '');
|
|
52869
|
+
const prevDigitsTime = (props.modelValue || '').replace(/\D/g, '');
|
|
52870
|
+
let digitsBeforeCursorForPosition = digitsBeforeCursor;
|
|
52871
|
+
if (props.modelValue && valueInput === prevDigitsTime && props.modelValue.length > valueInput.length && digitsBeforeCursor >= 1) {
|
|
52872
|
+
digitsOnly = digitsOnly.slice(0, digitsBeforeCursor - 1) + digitsOnly.slice(digitsBeforeCursor);
|
|
52873
|
+
digitsBeforeCursorForPosition = digitsBeforeCursor - 1;
|
|
52874
|
+
}
|
|
52864
52875
|
|
|
52865
52876
|
// 2. Formatear como HH:mm:ss
|
|
52866
52877
|
valueInput = formatToHHMMSS(digitsOnly);
|
|
52878
|
+
timeCursorPosition = getPositionAfterNDigits(valueInput, digitsBeforeCursorForPosition);
|
|
52867
52879
|
|
|
52868
52880
|
// 3. Validar que sea una hora válida (máximo 23:59:59)
|
|
52869
52881
|
const [hourStr, minStr, secStr] = valueInput.split(':');
|
|
52870
52882
|
const hour = parseInt(hourStr, 10);
|
|
52871
52883
|
const minute = parseInt(minStr ?? '0', 10);
|
|
52872
52884
|
const second = parseInt(secStr ?? '0', 10);
|
|
52873
|
-
const
|
|
52885
|
+
const invalidHour11SingleMinuteDigit = hour === 11 && minStr != null && minStr !== '' && minStr.length === 1;
|
|
52886
|
+
const isValid = hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60 && !invalidHour11SingleMinuteDigit;
|
|
52874
52887
|
if (isValid) {
|
|
52875
52888
|
resetRestrictions();
|
|
52876
52889
|
enteredTime = valueInput;
|
|
@@ -52885,12 +52898,23 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52885
52898
|
}
|
|
52886
52899
|
case props.modelModifiers?.timens:
|
|
52887
52900
|
{
|
|
52901
|
+
const rawValueTimens = valueInput;
|
|
52902
|
+
const cursorPosTimens = cursorPosition;
|
|
52903
|
+
const digitsBeforeCursorTimens = countDigitsBefore(rawValueTimens, cursorPosTimens);
|
|
52888
52904
|
let digitsOnly = valueInput.replace(/\D/g, '');
|
|
52905
|
+
const prevDigitsTimens = (props.modelValue || '').replace(/\D/g, '');
|
|
52906
|
+
let digitsBeforeCursorTimensForPosition = digitsBeforeCursorTimens;
|
|
52907
|
+
if (props.modelValue && valueInput === prevDigitsTimens && props.modelValue.length > valueInput.length && digitsBeforeCursorTimens >= 1) {
|
|
52908
|
+
digitsOnly = digitsOnly.slice(0, digitsBeforeCursorTimens - 1) + digitsOnly.slice(digitsBeforeCursorTimens);
|
|
52909
|
+
digitsBeforeCursorTimensForPosition = digitsBeforeCursorTimens - 1;
|
|
52910
|
+
}
|
|
52889
52911
|
valueInput = formatToHHMM(digitsOnly);
|
|
52912
|
+
timeCursorPosition = getPositionAfterNDigits(valueInput, digitsBeforeCursorTimensForPosition);
|
|
52890
52913
|
const [hourStr, minStr] = valueInput.split(':');
|
|
52891
52914
|
const hour = parseInt(hourStr, 10);
|
|
52892
52915
|
const minute = parseInt(minStr, 10);
|
|
52893
|
-
const
|
|
52916
|
+
const invalidHour11SingleMinuteDigit = hour === 11 && minStr != null && minStr !== '' && minStr.length === 1;
|
|
52917
|
+
const isValid = hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && !invalidHour11SingleMinuteDigit;
|
|
52894
52918
|
if (isValid) {
|
|
52895
52919
|
resetRestrictions();
|
|
52896
52920
|
} else {
|
|
@@ -52950,9 +52974,10 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52950
52974
|
}
|
|
52951
52975
|
event.target.setSelectionRange(position, position);
|
|
52952
52976
|
} else if (needsCursorAtEnd) {
|
|
52953
|
-
// Solo para modificadores que reformatean (time, timens)
|
|
52977
|
+
// Solo para modificadores que reformatean (time, timens): preservar posición según dígitos
|
|
52954
52978
|
const len = event.target.value.length;
|
|
52955
|
-
|
|
52979
|
+
const pos = timeCursorPosition != null ? timeCursorPosition : len;
|
|
52980
|
+
event.target.setSelectionRange(pos, pos);
|
|
52956
52981
|
} else {
|
|
52957
52982
|
// Para modificadores que solo filtran caracteres, preservar posición del cursor
|
|
52958
52983
|
const lengthDiff = valueInput.length - previousLength;
|
|
@@ -52984,10 +53009,28 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52984
53009
|
}
|
|
52985
53010
|
return '';
|
|
52986
53011
|
};
|
|
53012
|
+
const countDigitsBefore = (str, position) => {
|
|
53013
|
+
let count = 0;
|
|
53014
|
+
for (let i = 0; i < position && i < str.length; i++) {
|
|
53015
|
+
if (/\d/.test(str[i])) count++;
|
|
53016
|
+
}
|
|
53017
|
+
return count;
|
|
53018
|
+
};
|
|
53019
|
+
const getPositionAfterNDigits = (str, n) => {
|
|
53020
|
+
if (n <= 0) return 0;
|
|
53021
|
+
let digitCount = 0;
|
|
53022
|
+
let i = 0;
|
|
53023
|
+
for (; i < str.length && digitCount < n; i++) {
|
|
53024
|
+
if (/\d/.test(str[i])) digitCount++;
|
|
53025
|
+
}
|
|
53026
|
+
if (digitCount < n) return str.length;
|
|
53027
|
+
while (i < str.length && str[i] === ':') i++;
|
|
53028
|
+
return i;
|
|
53029
|
+
};
|
|
52987
53030
|
const formatToHHMM = raw => {
|
|
52988
53031
|
let digits = raw.replace(/\D/g, '');
|
|
52989
53032
|
if (digits.length === 0) return '';
|
|
52990
|
-
if (digits.length === 1) return
|
|
53033
|
+
if (digits.length === 1) return digits;
|
|
52991
53034
|
if (digits.length === 2) return `${digits}:`;
|
|
52992
53035
|
if (digits.length === 3) return `${digits.slice(0, 2)}:${digits[2]}`;
|
|
52993
53036
|
if (digits.length >= 4) return `${digits.slice(0, 2)}:${digits.slice(2, 4)}`;
|
|
@@ -52995,7 +53038,7 @@ const EInputvue_type_script_setup_true_lang_js_hoisted_4 = {
|
|
|
52995
53038
|
const formatToHHMMSS = raw => {
|
|
52996
53039
|
let digits = raw.replace(/\D/g, '');
|
|
52997
53040
|
if (digits.length === 0) return '';
|
|
52998
|
-
if (digits.length === 1) return
|
|
53041
|
+
if (digits.length === 1) return digits;
|
|
52999
53042
|
if (digits.length === 2) return `${digits}:`;
|
|
53000
53043
|
if (digits.length === 3) return `${digits.slice(0, 2)}:${digits[2]}`;
|
|
53001
53044
|
if (digits.length === 4) return `${digits.slice(0, 2)}:${digits.slice(2, 4)}:`;
|