linear-react-components-ui 1.1.10 → 1.1.12

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.
@@ -172,6 +172,7 @@ interface WithFieldProps {
172
172
  handlerStoreValidators?: (name: string, validators: Validator | Validator[]) => void;
173
173
  handlerRemoveValidators?: (name: string) => void;
174
174
  validators?: Validator | Validator[] | PeriodValidator | PeriodValidator[];
175
+ customClass?: string;
175
176
  }
176
177
  interface IWithFieldContext {
177
178
  validatorFromComponent: Validator | Validator[] | undefined;
@@ -20,8 +20,8 @@ const getCalendarDropdownStyle = _ref => {
20
20
  exports.getCalendarDropdownStyle = getCalendarDropdownStyle;
21
21
  const getMomentValue = value => {
22
22
  let newValue = value;
23
- if ((0, _moment.default)(newValue, PT_BR_FORMAT).isValid()) {
24
- newValue = (0, _moment.default)(newValue, PT_BR_FORMAT).format(EN_US_FORMAT);
23
+ if ((0, _moment.default)(newValue, PT_BR_FORMAT, true).isValid()) {
24
+ newValue = (0, _moment.default)(newValue, PT_BR_FORMAT).format(PT_BR_FORMAT);
25
25
  }
26
26
  return typeof newValue === 'string' ? (0, _moment.default)(newValue, EN_US_FORMAT) : newValue;
27
27
  };
@@ -7,6 +7,6 @@ import '../../@types/Period.js';
7
7
  import '../../internals/types.js';
8
8
  import '../../@types/Position.js';
9
9
 
10
- declare const BaseMask: ({ value: valueProp, defaultValue, inputRef, onChange, onComplete, permissionAttr, ...rest }: IBaseMaskProps) => JSX.Element;
10
+ declare const BaseMask: ({ value: valueProp, defaultValue, inputRef, onChange, onComplete, permissionAttr, isNumeric, ...rest }: IBaseMaskProps) => JSX.Element;
11
11
 
12
12
  export { BaseMask as default };
@@ -10,7 +10,7 @@ var _format_number = require("../number/format_number");
10
10
  var _reactImask = require("react-imask");
11
11
  var _permissionValidations = require("../../permissionValidations");
12
12
  var _helpers = require("./helpers");
13
- const _excluded = ["value", "defaultValue", "inputRef", "onChange", "onComplete", "permissionAttr"];
13
+ const _excluded = ["value", "defaultValue", "inputRef", "onChange", "onComplete", "permissionAttr", "isNumeric"];
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -101,7 +101,8 @@ const BaseMask = _ref => {
101
101
  inputRef,
102
102
  onChange,
103
103
  onComplete,
104
- permissionAttr
104
+ permissionAttr,
105
+ isNumeric
105
106
  } = _ref,
106
107
  rest = _objectWithoutProperties(_ref, _excluded);
107
108
  const onDenied = (0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr);
@@ -146,7 +147,12 @@ const BaseMask = _ref => {
146
147
  });
147
148
  (0, _react.useEffect)(() => {
148
149
  if (valueProp) {
149
- setValue(String(valueProp));
150
+ if (isNumeric && (Number(valueProp) || valueProp === '0')) {
151
+ const value = (0, _format_number.numberToPtBR)(valueProp) || '';
152
+ setValue(value);
153
+ } else {
154
+ setValue(String(valueProp));
155
+ }
150
156
  }
151
157
  }, [valueProp]);
152
158
  return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",