@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.js
CHANGED
|
@@ -8984,8 +8984,11 @@ var calculateMask = function calculateMask(_ref) {
|
|
|
8984
8984
|
var slotsSet = new Set(slots);
|
|
8985
8985
|
var accept = new RegExp('\\d', 'g');
|
|
8986
8986
|
var inputMatches = value.match(accept) || [];
|
|
8987
|
-
|
|
8988
|
-
|
|
8987
|
+
var _calculateDigitReplac = calculateDigitReplacement(slots, format, inputMatches.length, cursorPosition),
|
|
8988
|
+
isReplacingDigit = _calculateDigitReplac.isReplacingDigit,
|
|
8989
|
+
isReplacingAt = _calculateDigitReplac.isReplacingAt;
|
|
8990
|
+
if (isReplacingDigit) {
|
|
8991
|
+
inputMatches.splice(isReplacingAt, 1);
|
|
8989
8992
|
}
|
|
8990
8993
|
if (isDeletingAnchor) {
|
|
8991
8994
|
inputMatches.pop();
|
|
@@ -9024,10 +9027,19 @@ var calculateCursorPosition = function calculateCursorPosition(params) {
|
|
|
9024
9027
|
});
|
|
9025
9028
|
return calculatedCursorRange;
|
|
9026
9029
|
};
|
|
9027
|
-
var
|
|
9030
|
+
var calculateDigitReplacement = function calculateDigitReplacement(slots, format, amountOfDigitsTyped, cursorPosition) {
|
|
9028
9031
|
var slotsRegExp = new RegExp("[" + slots.split('').join('|') + "]", 'g');
|
|
9029
9032
|
var slotsMatches = format.match(slotsRegExp) || [];
|
|
9030
|
-
|
|
9033
|
+
var isReplacingDigit = amountOfDigitsTyped > slotsMatches.length;
|
|
9034
|
+
var getCharacterPosition = function getCharacterPosition() {
|
|
9035
|
+
var formatUntilTheCursorPoint = format.slice(0, cursorPosition.selectionStart);
|
|
9036
|
+
var slotsFormatSlicedMatches = formatUntilTheCursorPoint.match(slotsRegExp) || [];
|
|
9037
|
+
return slotsFormatSlicedMatches.length;
|
|
9038
|
+
};
|
|
9039
|
+
return {
|
|
9040
|
+
isReplacingDigit: isReplacingDigit,
|
|
9041
|
+
isReplacingAt: isReplacingDigit ? getCharacterPosition() : 0
|
|
9042
|
+
};
|
|
9031
9043
|
};
|
|
9032
9044
|
|
|
9033
9045
|
var useFieldMask = function useFieldMask(format) {
|
|
@@ -9134,9 +9146,6 @@ var DateField = function DateField(_ref) {
|
|
|
9134
9146
|
onFocus: function onFocus(e) {
|
|
9135
9147
|
setShowCalendar(true);
|
|
9136
9148
|
maskfy(e.target);
|
|
9137
|
-
setTimeout(function () {
|
|
9138
|
-
e.target.setSelectionRange(0, 0);
|
|
9139
|
-
}, 10);
|
|
9140
9149
|
},
|
|
9141
9150
|
onClick: function onClick() {
|
|
9142
9151
|
return setShowCalendar(true);
|
|
@@ -9149,7 +9158,13 @@ var DateField = function DateField(_ref) {
|
|
|
9149
9158
|
controllers.onChange(parsedDate);
|
|
9150
9159
|
}
|
|
9151
9160
|
},
|
|
9152
|
-
onBlur:
|
|
9161
|
+
onBlur: function onBlur(event) {
|
|
9162
|
+
var parsedDate = parseDate(event.target.value, format);
|
|
9163
|
+
if (!parsedDate) {
|
|
9164
|
+
controllers.onChange(undefined);
|
|
9165
|
+
}
|
|
9166
|
+
controllers.onBlur();
|
|
9167
|
+
},
|
|
9153
9168
|
defaultValue: getDefaultValue()
|
|
9154
9169
|
})), showCalendar && React__default.createElement(Calendar, {
|
|
9155
9170
|
onSelect: function onSelect(date) {
|