@7shifts/sous-chef 3.31.1-beta → 3.31.1-beta3
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 +23 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +23 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8980,8 +8980,11 @@ var calculateMask = function calculateMask(_ref) {
|
|
|
8980
8980
|
var slotsSet = new Set(slots);
|
|
8981
8981
|
var accept = new RegExp('\\d', 'g');
|
|
8982
8982
|
var inputMatches = value.match(accept) || [];
|
|
8983
|
-
|
|
8984
|
-
|
|
8983
|
+
var _calculateDigitReplac = calculateDigitReplacement(slots, format, inputMatches.length, cursorPosition),
|
|
8984
|
+
isReplacingDigit = _calculateDigitReplac.isReplacingDigit,
|
|
8985
|
+
isReplacingAt = _calculateDigitReplac.isReplacingAt;
|
|
8986
|
+
if (isReplacingDigit) {
|
|
8987
|
+
inputMatches.splice(isReplacingAt, 1);
|
|
8985
8988
|
}
|
|
8986
8989
|
if (isDeletingAnchor) {
|
|
8987
8990
|
inputMatches.pop();
|
|
@@ -9020,10 +9023,19 @@ var calculateCursorPosition = function calculateCursorPosition(params) {
|
|
|
9020
9023
|
});
|
|
9021
9024
|
return calculatedCursorRange;
|
|
9022
9025
|
};
|
|
9023
|
-
var
|
|
9026
|
+
var calculateDigitReplacement = function calculateDigitReplacement(slots, format, amountOfDigitsTyped, cursorPosition) {
|
|
9024
9027
|
var slotsRegExp = new RegExp("[" + slots.split('').join('|') + "]", 'g');
|
|
9025
9028
|
var slotsMatches = format.match(slotsRegExp) || [];
|
|
9026
|
-
|
|
9029
|
+
var isReplacingDigit = amountOfDigitsTyped > slotsMatches.length;
|
|
9030
|
+
var getCharacterPosition = function getCharacterPosition() {
|
|
9031
|
+
var formatUntilTheCursorPoint = format.slice(0, cursorPosition.selectionStart);
|
|
9032
|
+
var slotsFormatSlicedMatches = formatUntilTheCursorPoint.match(slotsRegExp) || [];
|
|
9033
|
+
return slotsFormatSlicedMatches.length;
|
|
9034
|
+
};
|
|
9035
|
+
return {
|
|
9036
|
+
isReplacingDigit: isReplacingDigit,
|
|
9037
|
+
isReplacingAt: isReplacingDigit ? getCharacterPosition() : 0
|
|
9038
|
+
};
|
|
9027
9039
|
};
|
|
9028
9040
|
|
|
9029
9041
|
var useFieldMask = function useFieldMask(format) {
|
|
@@ -9130,9 +9142,6 @@ var DateField = function DateField(_ref) {
|
|
|
9130
9142
|
onFocus: function onFocus(e) {
|
|
9131
9143
|
setShowCalendar(true);
|
|
9132
9144
|
maskfy(e.target);
|
|
9133
|
-
setTimeout(function () {
|
|
9134
|
-
e.target.setSelectionRange(0, 0);
|
|
9135
|
-
}, 10);
|
|
9136
9145
|
},
|
|
9137
9146
|
onClick: function onClick() {
|
|
9138
9147
|
return setShowCalendar(true);
|
|
@@ -9145,7 +9154,13 @@ var DateField = function DateField(_ref) {
|
|
|
9145
9154
|
controllers.onChange(parsedDate);
|
|
9146
9155
|
}
|
|
9147
9156
|
},
|
|
9148
|
-
onBlur:
|
|
9157
|
+
onBlur: function onBlur(event) {
|
|
9158
|
+
var parsedDate = parseDate(event.target.value, format);
|
|
9159
|
+
if (!parsedDate) {
|
|
9160
|
+
controllers.onChange(undefined);
|
|
9161
|
+
}
|
|
9162
|
+
controllers.onBlur();
|
|
9163
|
+
},
|
|
9149
9164
|
defaultValue: getDefaultValue()
|
|
9150
9165
|
})), showCalendar && React__default.createElement(Calendar, {
|
|
9151
9166
|
onSelect: function onSelect(date) {
|