Comparing version 4.60.3 to 4.60.4
@@ -23,3 +23,3 @@ 'use strict'; | ||
var _excluded = ["id", "type", "name", "onBlur", "onChange", "onFocus", "onNativeChange", "onValueChange", "validate", "asyncValidate", "validateModified", "gatherData", "yupSchema", "multiple", "field", "keep", "keepState", "keepStateIfRelevant", "remember", "inputRef", "inputRefs", "relevant", "defaultValue", "initialValue", "autocomplete", "showErrorIfError", "showErrorIfTouched", "showErrorIfDirty", "formatter", "parser", "clean", "mask", "maintainCursor", "required", "noFalsy", "minimum", "maximum", "minLength", "maxLength", "pattern", "allowEmptyString", "emptyValue", "disabled", "gatherOnMount", "gatherOnBlur", "validateOnMount", "modifyOnMount", "validateOn", "maskOnBlur", "validateWhen", "formatterDependencies", "formController", "initialize", "errorMessage", "initializeValueIfPristine", "relevanceWhen", "relevanceDeps", "validateDeps", "evaluate", "evaluateWhen"]; | ||
var _excluded = ["id", "dir", "type", "name", "onBlur", "onChange", "onFocus", "onNativeChange", "onValueChange", "validate", "asyncValidate", "validateModified", "gatherData", "yupSchema", "multiple", "field", "keep", "keepState", "keepStateIfRelevant", "remember", "inputRef", "inputRefs", "relevant", "defaultValue", "initialValue", "autocomplete", "showErrorIfError", "showErrorIfTouched", "showErrorIfDirty", "formatter", "parser", "clean", "mask", "maintainCursor", "required", "noFalsy", "minimum", "maximum", "minLength", "maxLength", "pattern", "allowEmptyString", "emptyValue", "disabled", "gatherOnMount", "gatherOnBlur", "validateOnMount", "modifyOnMount", "validateOn", "maskOnBlur", "validateWhen", "formatterDependencies", "formController", "initialize", "errorMessage", "initializeValueIfPristine", "relevanceWhen", "relevanceDeps", "validateDeps", "evaluate", "evaluateWhen"]; | ||
var logger = debug.Debug('informed:useField' + '\t'); | ||
@@ -31,2 +31,3 @@ | ||
var id = _ref.id, | ||
dir = _ref.dir, | ||
type = _ref.type, | ||
@@ -201,2 +202,3 @@ userName = _ref.name, | ||
type: type, | ||
dir: dir, | ||
onBlur: onBlur, | ||
@@ -391,2 +393,3 @@ onChange: onChange, | ||
type: type, | ||
dir: dir, | ||
multiple: multiple, | ||
@@ -393,0 +396,0 @@ autoComplete: autocomplete, |
@@ -20,2 +20,3 @@ 'use strict'; | ||
var useForm = function useForm(_ref) { | ||
var _window; | ||
var onSubmit = _ref.onSubmit, | ||
@@ -71,2 +72,13 @@ onReset = _ref.onReset, | ||
}, [userInitialValues]); | ||
// If we have a schema allow user to add magic validation to the schema before passing it in!! | ||
if ((_window = window) !== null && _window !== void 0 && (_window = _window.informed) !== null && _window !== void 0 && _window.properties) { | ||
var _window2; | ||
var properties = (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.informed) === null || _window2 === void 0 ? void 0 : _window2.properties; | ||
Object.keys(properties).forEach(function (key) { | ||
if (schema.properties[key]) { | ||
schema.properties[key]['ui:props'] = properties[key]; | ||
} | ||
}); | ||
} | ||
var formControllerOptions = { | ||
@@ -73,0 +85,0 @@ initialValues: initialValues, |
@@ -457,2 +457,3 @@ 'use strict'; | ||
var informedFormat = function informedFormat(val, frmtr, old) { | ||
var dir = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'ltr'; | ||
// Our formatter is an object! so we must format for each key | ||
@@ -472,3 +473,3 @@ // Example: | ||
// console.log('Old', old); | ||
var _informedFormatter = informedFormatter(val[key], frmtr[key], old ? old[val] : undefined, val), | ||
var _informedFormatter = informedFormatter(val[key], frmtr[key], old ? old[val] : undefined, val, dir), | ||
value = _informedFormatter.value, | ||
@@ -489,5 +490,5 @@ offset = _informedFormatter.offset; | ||
// Simply pass along if its a flat formatter | ||
return informedFormatter(val, frmtr, old, val); | ||
return informedFormatter(val, frmtr, old, val, dir); | ||
}; | ||
var informedFormatter = function informedFormatter(val, frmtr, old, full) { | ||
var informedFormatter = function informedFormatter(val, frmtr, old, full, dir) { | ||
// console.log('Formatting', val); | ||
@@ -662,3 +663,3 @@ debug('Formatting', val); | ||
// And length of new is greater than or equal two suffix start | ||
var case1 = suffixStart && value && old && value.length < old.length && value.length >= suffixStart; | ||
var case1 = suffixStart && value && old && value.length < old.length && value.length >= suffixStart && dir != 'rtl'; | ||
// Special case2: | ||
@@ -675,2 +676,3 @@ // Suffix is '%' | ||
var case2 = suffixStart && formatted.length > suffixStart && (!old || typeof old === 'string' && !old.includes(suffix)); | ||
// && dir != 'rtl'; | ||
if (case1 || case2) { | ||
@@ -680,2 +682,5 @@ offset = 0; | ||
// Special case if right to left then we actually want to offset by one | ||
if (dir == 'rtl') offset = 1; | ||
// Special case, we want to diable keeping suffix on backspace in react native | ||
@@ -682,0 +687,0 @@ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative' && value && old && value.length < old.length) { |
@@ -15,3 +15,3 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
var _excluded = ["id", "type", "name", "onBlur", "onChange", "onFocus", "onNativeChange", "onValueChange", "validate", "asyncValidate", "validateModified", "gatherData", "yupSchema", "multiple", "field", "keep", "keepState", "keepStateIfRelevant", "remember", "inputRef", "inputRefs", "relevant", "defaultValue", "initialValue", "autocomplete", "showErrorIfError", "showErrorIfTouched", "showErrorIfDirty", "formatter", "parser", "clean", "mask", "maintainCursor", "required", "noFalsy", "minimum", "maximum", "minLength", "maxLength", "pattern", "allowEmptyString", "emptyValue", "disabled", "gatherOnMount", "gatherOnBlur", "validateOnMount", "modifyOnMount", "validateOn", "maskOnBlur", "validateWhen", "formatterDependencies", "formController", "initialize", "errorMessage", "initializeValueIfPristine", "relevanceWhen", "relevanceDeps", "validateDeps", "evaluate", "evaluateWhen"]; | ||
var _excluded = ["id", "dir", "type", "name", "onBlur", "onChange", "onFocus", "onNativeChange", "onValueChange", "validate", "asyncValidate", "validateModified", "gatherData", "yupSchema", "multiple", "field", "keep", "keepState", "keepStateIfRelevant", "remember", "inputRef", "inputRefs", "relevant", "defaultValue", "initialValue", "autocomplete", "showErrorIfError", "showErrorIfTouched", "showErrorIfDirty", "formatter", "parser", "clean", "mask", "maintainCursor", "required", "noFalsy", "minimum", "maximum", "minLength", "maxLength", "pattern", "allowEmptyString", "emptyValue", "disabled", "gatherOnMount", "gatherOnBlur", "validateOnMount", "modifyOnMount", "validateOn", "maskOnBlur", "validateWhen", "formatterDependencies", "formController", "initialize", "errorMessage", "initializeValueIfPristine", "relevanceWhen", "relevanceDeps", "validateDeps", "evaluate", "evaluateWhen"]; | ||
var logger = Debug('informed:useField' + '\t'); | ||
@@ -23,2 +23,3 @@ | ||
var id = _ref.id, | ||
dir = _ref.dir, | ||
type = _ref.type, | ||
@@ -193,2 +194,3 @@ userName = _ref.name, | ||
type: type, | ||
dir: dir, | ||
onBlur: onBlur, | ||
@@ -383,2 +385,3 @@ onChange: onChange, | ||
type: type, | ||
dir: dir, | ||
multiple: multiple, | ||
@@ -385,0 +388,0 @@ autoComplete: autocomplete, |
@@ -12,2 +12,3 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
var useForm = function useForm(_ref) { | ||
var _window; | ||
var onSubmit = _ref.onSubmit, | ||
@@ -63,2 +64,13 @@ onReset = _ref.onReset, | ||
}, [userInitialValues]); | ||
// If we have a schema allow user to add magic validation to the schema before passing it in!! | ||
if ((_window = window) !== null && _window !== void 0 && (_window = _window.informed) !== null && _window !== void 0 && _window.properties) { | ||
var _window2; | ||
var properties = (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.informed) === null || _window2 === void 0 ? void 0 : _window2.properties; | ||
Object.keys(properties).forEach(function (key) { | ||
if (schema.properties[key]) { | ||
schema.properties[key]['ui:props'] = properties[key]; | ||
} | ||
}); | ||
} | ||
var formControllerOptions = { | ||
@@ -65,0 +77,0 @@ initialValues: initialValues, |
@@ -453,2 +453,3 @@ import { createClass as _createClass, typeof as _typeof, createForOfIteratorHelper as _createForOfIteratorHelper, toConsumableArray as _toConsumableArray, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
var informedFormat = function informedFormat(val, frmtr, old) { | ||
var dir = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'ltr'; | ||
// Our formatter is an object! so we must format for each key | ||
@@ -468,3 +469,3 @@ // Example: | ||
// console.log('Old', old); | ||
var _informedFormatter = informedFormatter(val[key], frmtr[key], old ? old[val] : undefined, val), | ||
var _informedFormatter = informedFormatter(val[key], frmtr[key], old ? old[val] : undefined, val, dir), | ||
value = _informedFormatter.value, | ||
@@ -485,5 +486,5 @@ offset = _informedFormatter.offset; | ||
// Simply pass along if its a flat formatter | ||
return informedFormatter(val, frmtr, old, val); | ||
return informedFormatter(val, frmtr, old, val, dir); | ||
}; | ||
var informedFormatter = function informedFormatter(val, frmtr, old, full) { | ||
var informedFormatter = function informedFormatter(val, frmtr, old, full, dir) { | ||
// console.log('Formatting', val); | ||
@@ -658,3 +659,3 @@ debug('Formatting', val); | ||
// And length of new is greater than or equal two suffix start | ||
var case1 = suffixStart && value && old && value.length < old.length && value.length >= suffixStart; | ||
var case1 = suffixStart && value && old && value.length < old.length && value.length >= suffixStart && dir != 'rtl'; | ||
// Special case2: | ||
@@ -671,2 +672,3 @@ // Suffix is '%' | ||
var case2 = suffixStart && formatted.length > suffixStart && (!old || typeof old === 'string' && !old.includes(suffix)); | ||
// && dir != 'rtl'; | ||
if (case1 || case2) { | ||
@@ -676,2 +678,5 @@ offset = 0; | ||
// Special case if right to left then we actually want to offset by one | ||
if (dir == 'rtl') offset = 1; | ||
// Special case, we want to diable keeping suffix on backspace in react native | ||
@@ -678,0 +683,0 @@ if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative' && value && old && value.length < old.length) { |
{ | ||
"name": "informed", | ||
"version": "4.60.3", | ||
"version": "4.60.4", | ||
"description": "A lightweight framework and utility for building powerful forms in React applications", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
618598
15523