linear-react-components-ui 1.1.22-beta.13 → 1.1.22-beta.15

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.
@@ -119,10 +119,10 @@ const BaseMask = _ref => {
119
119
  const {
120
120
  ref,
121
121
  setValue,
122
- setTypedValue,
122
+ setUnmaskedValue,
123
123
  maskRef
124
124
  } = (0, _reactImask.useIMask)(_objectSpread({}, maskOptions), {
125
- defaultValue: defaultValue,
125
+ defaultValue,
126
126
  onAccept: (_, r) => {
127
127
  if (!disableCallbacks && onChange) {
128
128
  const event = {
@@ -151,9 +151,9 @@ const BaseMask = _ref => {
151
151
  }
152
152
  });
153
153
  (0, _react.useEffect)(() => {
154
- if (mask === Number) {
155
- const typedValue = (0, _format_number.numberToEnUS)(String(valueProp));
156
- if (!Number.isNaN(typedValue)) setTypedValue(typedValue);
154
+ if (mask === Number || typeof valueProp === 'number') {
155
+ const updatedUnmaskedValue = (0, _format_number.numberToEnUS)(String(valueProp));
156
+ if (!Number.isNaN(updatedUnmaskedValue)) setUnmaskedValue(String(updatedUnmaskedValue));
157
157
  return;
158
158
  }
159
159
  const updatedValue = valueProp ? String(valueProp) : '';
@@ -29,7 +29,7 @@ const returnEventFormattedValue = (props, event) => {
29
29
  } = event.target;
30
30
  return _objectSpread(_objectSpread({}, event), {}, {
31
31
  target: {
32
- value: String((0, _format_number.numberToEnUS)(value)),
32
+ value: (0, _format_number.numberToEnUS)(value),
33
33
  name
34
34
  }
35
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.22-beta.13",
3
+ "version": "1.1.22-beta.15",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -1,13 +0,0 @@
1
- type UseSecurityParams = {
2
- showSecurity: boolean;
3
- title?: string;
4
- message?: string;
5
- onClose: () => void;
6
- };
7
- type UseSecurityReturn = {
8
- handleClose: () => void;
9
- SecurityComponent: () => JSX.Element | null;
10
- };
11
- declare function useSecurity({ showSecurity, title, message, onClose, }: UseSecurityParams): UseSecurityReturn;
12
-
13
- export { useSecurity };
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useSecurity = useSecurity;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _dialog = require("../../dialog");
9
- 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); }
10
- 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; }
11
- function useSecurity(_ref) {
12
- let {
13
- showSecurity = false,
14
- title = 'Dados Alterados',
15
- message = 'Você possui dados alterados, confirma o fechamento?',
16
- onClose
17
- } = _ref;
18
- const [showDialogAlert, setShowDialogAlert] = (0, _react.useState)(false);
19
- const handleClose = () => {
20
- if (showSecurity) {
21
- setShowDialogAlert(true);
22
- return;
23
- }
24
- onClose();
25
- };
26
- const onConfirmClick = () => {
27
- setShowDialogAlert(false);
28
- onClose();
29
- };
30
- const onUnconfirmClick = () => {
31
- setShowDialogAlert(false);
32
- };
33
- const onBeforeUnload = ev => {
34
- ev.preventDefault();
35
- };
36
- const DialogComponent = () => /*#__PURE__*/_react.default.createElement(_dialog.DialogQuestion, {
37
- zIndex: "99999999",
38
- title: title,
39
- text: message,
40
- visible: showDialogAlert,
41
- onConfirmClick: onConfirmClick,
42
- onUnconfirmClick: onUnconfirmClick
43
- });
44
- (0, _react.useEffect)(() => {
45
- if (showSecurity) {
46
- window.addEventListener('beforeunload', onBeforeUnload);
47
- }
48
- return () => {
49
- window.removeEventListener('beforeunload', onBeforeUnload);
50
- };
51
- }, [showSecurity]);
52
- return {
53
- handleClose,
54
- SecurityComponent: DialogComponent
55
- };
56
- }