Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/pmb/node_modules/@testing-library/user-event/dist/utils/edit/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.calculateNewValue = calculateNewValue;
var _selectionRange = require("./selectionRange");
var _getValue2 = require("./getValue");
var _isValidDateValue = require("./isValidDateValue");
var _isValidInputTimeValue = require("./isValidInputTimeValue");
function calculateNewValue(newEntry, element, value = (() => {
var _getValue;
return (_getValue = (0, _getValue2.getValue)(element)) != null ? _getValue :
/* istanbul ignore next */
'';
})(), selectionRange = (0, _selectionRange.getSelectionRange)(element), deleteContent) {
const selectionStart = selectionRange.selectionStart === null ? value.length : selectionRange.selectionStart;
const selectionEnd = selectionRange.selectionEnd === null ? value.length : selectionRange.selectionEnd;
const prologEnd = Math.max(0, selectionStart === selectionEnd && deleteContent === 'backward' ? selectionStart - 1 : selectionStart);
const prolog = value.substring(0, prologEnd);
const epilogStart = Math.min(value.length, selectionStart === selectionEnd && deleteContent === 'forward' ? selectionEnd + 1 : selectionEnd);
const epilog = value.substring(epilogStart, value.length);
let newValue = `${prolog}${newEntry}${epilog}`;
const newSelectionStart = prologEnd + newEntry.length;
if (element.type === 'date' && !(0, _isValidDateValue.isValidDateValue)(element, newValue)) {
newValue = value;
}
if (element.type === 'time' && !(0, _isValidInputTimeValue.isValidInputTimeValue)(element, newValue)) {
if ((0, _isValidInputTimeValue.isValidInputTimeValue)(element, newEntry)) {
newValue = newEntry;
} else {
newValue = value;
}
}
return {
newValue,
newSelectionStart
};
} |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0056 ]-- |