linear-react-components-ui 1.1.13 → 1.1.14-beta.0
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/.eslintrc.json +77 -45
- package/.gitlab-ci.yml +5 -13
- package/.tool-versions +1 -0
- package/.vscode/settings.json +3 -12
- package/babel.config.json +4 -4
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/alerts/AlertContainer.js +56 -47
- package/lib/alerts/AlertProvider.js +51 -33
- package/lib/alerts/BaseAlert.js +18 -11
- package/lib/alerts/Message.d.ts +1 -1
- package/lib/alerts/Message.js +44 -77
- package/lib/alerts/helpers.js +3 -2
- package/lib/alerts/index.js +3 -2
- package/lib/alerts/types.d.ts +0 -1
- package/lib/alerts/withAlert.js +9 -8
- package/lib/assets/styles/alerts.scss +7 -4
- package/lib/assets/styles/button.scss +9 -11
- package/lib/assets/styles/checkbox.scss +38 -45
- package/lib/assets/styles/colors.scss +1 -3
- package/lib/assets/styles/commons.scss +0 -1
- package/lib/assets/styles/dialog.scss +20 -37
- package/lib/assets/styles/drawers.scss +6 -9
- package/lib/assets/styles/fieldset.scss +0 -3
- package/lib/assets/styles/gridlayout.scss +2 -0
- package/lib/assets/styles/hint.scss +0 -21
- package/lib/assets/styles/icon.scss +4 -31
- package/lib/assets/styles/input.scss +7 -7
- package/lib/assets/styles/multiSelect.scss +1 -6
- package/lib/assets/styles/radio.scss +35 -37
- package/lib/assets/styles/select.scss +7 -13
- package/lib/assets/styles/table.scss +1 -9
- package/lib/assets/styles/tabs.scss +18 -28
- package/lib/avatar/index.js +39 -39
- package/lib/badge/index.js +13 -11
- package/lib/buttons/ActivateButton.js +7 -4
- package/lib/buttons/AddButton.js +10 -7
- package/lib/buttons/Button.js +9 -8
- package/lib/buttons/ButtonGroups.js +4 -5
- package/lib/buttons/CancelButton.js +5 -6
- package/lib/buttons/DangerButton.js +5 -6
- package/lib/buttons/DefaultButton.js +85 -85
- package/lib/buttons/DestroyButton.js +5 -6
- package/lib/buttons/EditButton.js +7 -4
- package/lib/buttons/InactivateButton.js +7 -4
- package/lib/buttons/InfoButton.js +5 -6
- package/lib/buttons/PrimaryButton.js +5 -6
- package/lib/buttons/RestoreButton.js +7 -4
- package/lib/buttons/SaveButton.js +5 -6
- package/lib/buttons/SuccessButton.js +5 -6
- package/lib/buttons/WarningButton.js +5 -6
- package/lib/buttons/button_container/index.js +19 -15
- package/lib/buttons/index.js +16 -15
- package/lib/buttons/split_button/index.js +23 -20
- package/lib/buttons/types.d.ts +0 -1
- package/lib/calendar/DangerCalendar.js +5 -6
- package/lib/calendar/InfoCalendar.js +5 -6
- package/lib/calendar/PrimaryCalendar.js +5 -6
- package/lib/calendar/SuccessCalendar.js +5 -6
- package/lib/calendar/WarningCalendar.js +5 -6
- package/lib/calendar/base/Day.js +11 -12
- package/lib/calendar/base/Month.js +17 -12
- package/lib/calendar/base/Week.js +17 -12
- package/lib/calendar/base/helpers.js +11 -11
- package/lib/calendar/base/index.js +43 -29
- package/lib/calendar/index.js +7 -6
- package/lib/checkbox/Label.js +9 -19
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +95 -81
- package/lib/checkbox/types.d.ts +1 -2
- package/lib/dialog/Alert.js +4 -3
- package/lib/dialog/Custom.js +16 -14
- package/lib/dialog/Error.js +4 -3
- package/lib/dialog/Information.js +4 -3
- package/lib/dialog/Question.js +12 -11
- package/lib/dialog/Warning.js +5 -5
- package/lib/dialog/base/Content.js +5 -7
- package/lib/dialog/base/Footer.js +7 -4
- package/lib/dialog/base/Header.js +28 -28
- package/lib/dialog/base/index.d.ts +2 -8
- package/lib/dialog/base/index.js +104 -108
- package/lib/dialog/base/style.js +10 -7
- package/lib/dialog/form/index.js +35 -36
- package/lib/dialog/index.js +8 -7
- package/lib/dialog/types.d.ts +13 -8
- package/lib/drawer/Content.js +10 -11
- package/lib/drawer/Drawer.js +83 -69
- package/lib/drawer/Header.js +36 -33
- package/lib/drawer/helpers.js +3 -2
- package/lib/drawer/index.js +4 -3
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +39 -38
- package/lib/dropdown/helper.js +5 -3
- package/lib/dropdown/types.d.ts +0 -1
- package/lib/dropdown/withDropdown.js +58 -37
- package/lib/fieldset/index.js +56 -50
- package/lib/fieldset/types.d.ts +0 -2
- package/lib/form/Field.d.ts +0 -2
- package/lib/form/Field.js +74 -68
- package/lib/form/FieldArray.d.ts +0 -2
- package/lib/form/FieldArray.js +90 -66
- package/lib/form/FieldNumber.d.ts +0 -2
- package/lib/form/FieldNumber.js +53 -33
- package/lib/form/FieldPeriod.d.ts +0 -2
- package/lib/form/FieldPeriod.js +52 -46
- package/lib/form/helpers.d.ts +0 -2
- package/lib/form/helpers.js +26 -21
- package/lib/form/index.d.ts +0 -2
- package/lib/form/index.js +143 -111
- package/lib/form/types.d.ts +4 -7
- package/lib/form/withFieldHOC.d.ts +0 -2
- package/lib/form/withFieldHOC.js +38 -31
- package/lib/form/withFormSecurity.d.ts +0 -2
- package/lib/form/withFormSecurity.js +34 -26
- package/lib/gridlayout/GridCol.js +13 -13
- package/lib/gridlayout/GridRow.js +11 -17
- package/lib/gridlayout/index.js +3 -2
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/index.d.ts +1 -2
- package/lib/hint/index.js +28 -17
- package/lib/hint/types.d.ts +0 -3
- package/lib/icons/helper.d.ts +0 -4
- package/lib/icons/helper.js +4 -7
- package/lib/icons/index.d.ts +2 -3
- package/lib/icons/index.js +47 -42
- package/lib/icons/types.d.ts +9 -22
- package/lib/index.d.ts +1 -2
- package/lib/index.js +9 -9
- package/lib/inputs/base/InputTextBase.d.ts +0 -2
- package/lib/inputs/base/InputTextBase.js +111 -143
- package/lib/inputs/base/helpers.d.ts +2 -3
- package/lib/inputs/base/helpers.js +25 -20
- package/lib/inputs/base/types.d.ts +3 -17
- package/lib/inputs/color/index.js +38 -27
- package/lib/inputs/date/Dialog.d.ts +0 -2
- package/lib/inputs/date/Dialog.js +9 -8
- package/lib/inputs/date/Dropdown.d.ts +0 -2
- package/lib/inputs/date/Dropdown.js +10 -11
- package/lib/inputs/date/helpers.d.ts +0 -2
- package/lib/inputs/date/helpers.js +13 -13
- package/lib/inputs/date/index.d.ts +0 -2
- package/lib/inputs/date/index.js +150 -125
- package/lib/inputs/date/types.d.ts +1 -4
- package/lib/inputs/file/DefaultFile.d.ts +0 -2
- package/lib/inputs/file/DefaultFile.js +72 -45
- package/lib/inputs/file/DragDropFile.d.ts +0 -2
- package/lib/inputs/file/DragDropFile.js +147 -95
- package/lib/inputs/file/File.d.ts +1 -3
- package/lib/inputs/file/File.js +28 -22
- package/lib/inputs/file/FileButtonSettings.d.ts +0 -2
- package/lib/inputs/file/FileButtonSettings.js +12 -12
- package/lib/inputs/file/helpers.d.ts +0 -2
- package/lib/inputs/file/helpers.js +6 -4
- package/lib/inputs/file/index.d.ts +0 -2
- package/lib/inputs/file/index.js +4 -3
- package/lib/inputs/file/types.d.ts +0 -2
- package/lib/inputs/inputHOC.d.ts +1 -2
- package/lib/inputs/inputHOC.js +32 -19
- package/lib/inputs/mask/BaseMask.d.ts +5 -4
- package/lib/inputs/mask/BaseMask.js +34 -121
- package/lib/inputs/mask/Cnpj.d.ts +0 -2
- package/lib/inputs/mask/Cnpj.js +29 -16
- package/lib/inputs/mask/Cpf.d.ts +0 -2
- package/lib/inputs/mask/Cpf.js +35 -18
- package/lib/inputs/mask/Phone.d.ts +0 -2
- package/lib/inputs/mask/Phone.js +4 -5
- package/lib/inputs/mask/ZipCode.d.ts +0 -2
- package/lib/inputs/mask/ZipCode.js +7 -4
- package/lib/inputs/mask/helpers.d.ts +12 -53
- package/lib/inputs/mask/helpers.js +36 -90
- package/lib/inputs/{errorMessage/index.d.ts → mask/imaskHOC.d.ts} +7 -5
- package/lib/inputs/mask/imaskHOC.js +224 -0
- package/lib/inputs/mask/index.d.ts +2 -4
- package/lib/inputs/mask/index.js +6 -5
- package/lib/inputs/mask/types.d.ts +18 -22
- package/lib/inputs/multiSelect/ActionButtons.d.ts +0 -2
- package/lib/inputs/multiSelect/ActionButtons.js +21 -22
- package/lib/inputs/multiSelect/Dropdown.d.ts +0 -2
- package/lib/inputs/multiSelect/Dropdown.js +65 -48
- package/lib/inputs/multiSelect/helper.d.ts +0 -2
- package/lib/inputs/multiSelect/helper.js +7 -8
- package/lib/inputs/multiSelect/index.d.ts +0 -2
- package/lib/inputs/multiSelect/index.js +132 -80
- package/lib/inputs/multiSelect/types.d.ts +0 -2
- package/lib/inputs/number/BaseNumber.d.ts +2 -3
- package/lib/inputs/number/BaseNumber.js +21 -22
- package/lib/inputs/number/Currency.d.ts +2 -3
- package/lib/inputs/number/Currency.js +6 -6
- package/lib/inputs/number/Decimal.d.ts +2 -3
- package/lib/inputs/number/Decimal.js +5 -2
- package/lib/inputs/number/format_number.js +5 -5
- package/lib/inputs/number/index.d.ts +2 -3
- package/lib/inputs/number/index.js +49 -18
- package/lib/inputs/number/types.d.ts +14 -15
- package/lib/inputs/period/Dialog.d.ts +1 -3
- package/lib/inputs/period/Dialog.js +9 -8
- package/lib/inputs/period/Dropdown.d.ts +0 -2
- package/lib/inputs/period/Dropdown.js +8 -7
- package/lib/inputs/period/PeriodList.d.ts +0 -2
- package/lib/inputs/period/PeriodList.js +12 -13
- package/lib/inputs/period/helper.d.ts +0 -2
- package/lib/inputs/period/helper.js +36 -33
- package/lib/inputs/period/index.d.ts +0 -2
- package/lib/inputs/period/index.js +194 -160
- package/lib/inputs/period/types.d.ts +1 -3
- package/lib/inputs/search/index.d.ts +1 -2
- package/lib/inputs/search/index.js +63 -40
- package/lib/inputs/select/ActionButtons.d.ts +1 -2
- package/lib/inputs/select/ActionButtons.js +34 -24
- package/lib/inputs/select/Dropdown.d.ts +1 -2
- package/lib/inputs/select/Dropdown.js +58 -39
- package/lib/inputs/select/helper.d.ts +1 -2
- package/lib/inputs/select/helper.js +43 -49
- package/lib/inputs/select/index.d.ts +0 -2
- package/lib/inputs/select/index.js +8 -9
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -3
- package/lib/inputs/select/multiple/Selecteds.js +21 -16
- package/lib/inputs/select/multiple/index.d.ts +0 -2
- package/lib/inputs/select/multiple/index.js +176 -128
- package/lib/inputs/select/simple/index.d.ts +0 -2
- package/lib/inputs/select/simple/index.js +179 -151
- package/lib/inputs/select/types.d.ts +2 -5
- package/lib/inputs/text/index.js +5 -2
- package/lib/inputs/textarea/index.d.ts +0 -2
- package/lib/inputs/textarea/index.js +9 -9
- package/lib/inputs/textarea/types.d.ts +0 -2
- package/lib/inputs/types.d.ts +7 -12
- package/lib/internals/colorStyles.js +3 -2
- package/lib/internals/constants.js +4 -2
- package/lib/internals/types.d.ts +2 -5
- package/lib/internals/withTooltip.d.ts +2 -3
- package/lib/internals/withTooltip.js +74 -74
- package/lib/labelMessages/index.js +41 -21
- package/lib/labels/DangerLabel.js +5 -6
- package/lib/labels/DefaultLabel.js +39 -25
- package/lib/labels/InfoLabel.js +5 -6
- package/lib/labels/PrimaryLabel.js +5 -6
- package/lib/labels/SuccessLabel.js +5 -6
- package/lib/labels/WarningLabel.js +5 -6
- package/lib/labels/index.js +8 -7
- package/lib/labels/label_container/index.js +7 -7
- package/lib/list/Header.js +7 -8
- package/lib/list/Item.js +68 -72
- package/lib/list/Separator.js +7 -4
- package/lib/list/helpers.js +5 -3
- package/lib/list/index.js +100 -73
- package/lib/menus/float/MenuItem.js +19 -18
- package/lib/menus/float/SubMenuContainer.js +32 -26
- package/lib/menus/float/helpers.js +3 -2
- package/lib/menus/float/index.js +17 -16
- package/lib/menus/float/types.d.ts +1 -1
- package/lib/menus/index.js +2 -1
- package/lib/menus/sidenav/ExpandMenu.js +7 -8
- package/lib/menus/sidenav/MenuLink.js +8 -9
- package/lib/menus/sidenav/NavMenuGroup.js +11 -12
- package/lib/menus/sidenav/NavMenuItem.js +60 -46
- package/lib/menus/sidenav/NavSubMenuItem.js +24 -19
- package/lib/menus/sidenav/helpers.js +8 -5
- package/lib/menus/sidenav/index.js +111 -83
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +6 -6
- package/lib/menus/sidenav/popup_menu_search/index.js +83 -63
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/noPermission/index.js +16 -13
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/Content.js +56 -43
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/DangerPanel.js +7 -4
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +56 -41
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/Header.js +26 -28
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/InfoPanel.js +7 -4
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.js +7 -4
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.js +7 -4
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/ToolBar.js +4 -5
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/WarningPanel.js +7 -4
- package/lib/panel/helpers.d.ts +2 -7
- package/lib/panel/helpers.js +23 -11
- package/lib/panel/index.d.ts +1 -1
- package/lib/panel/index.js +9 -8
- package/lib/panel/types.d.ts +5 -46
- package/lib/permissionValidations.js +29 -24
- package/lib/popover/PopoverText.js +4 -5
- package/lib/popover/PopoverTitle.js +4 -5
- package/lib/popover/index.js +18 -14
- package/lib/progress/Bar.js +36 -30
- package/lib/progress/index.js +18 -16
- package/lib/radio/index.js +55 -34
- package/lib/shortcuts/index.js +8 -9
- package/lib/skeleton/SkeletonContainer.js +10 -9
- package/lib/skeleton/index.js +32 -25
- package/lib/spinner/SpinnerLoading.js +7 -6
- package/lib/spinner/index.js +36 -22
- package/lib/split/Split.js +110 -93
- package/lib/split/SplitSide.js +18 -19
- package/lib/split/helpers.js +3 -2
- package/lib/split/index.js +3 -2
- package/lib/table/Body.js +44 -41
- package/lib/table/Header.js +31 -28
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +21 -34
- package/lib/table/Row.js +47 -44
- package/lib/table/RowColumn.js +37 -36
- package/lib/table/helpers.js +12 -6
- package/lib/table/index.js +98 -78
- package/lib/table/types.d.ts +0 -3
- package/lib/tabs/{MenuTabs.d.ts → DropdownItems.d.ts} +3 -3
- package/lib/tabs/DropdownItems.js +65 -0
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +20 -32
- package/lib/tabs/MenuItems.d.ts +11 -0
- package/lib/tabs/MenuItems.js +76 -0
- package/lib/tabs/Panel.d.ts +1 -1
- package/lib/tabs/Panel.js +65 -69
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +221 -42
- package/lib/tabs/tabHelpers.d.ts +15 -4
- package/lib/tabs/tabHelpers.js +41 -36
- package/lib/tabs/types.d.ts +15 -48
- package/lib/toolbar/ButtonBar.js +39 -35
- package/lib/toolbar/LabelBar.js +36 -32
- package/lib/toolbar/Separator.js +7 -4
- package/lib/toolbar/ToolBarGroup.js +6 -6
- package/lib/toolbar/helpers.js +3 -2
- package/lib/toolbar/index.js +21 -19
- package/lib/toolbar/types.d.ts +0 -1
- package/lib/tooltip/index.js +32 -27
- package/lib/treetable/Body.js +32 -20
- package/lib/treetable/Header.js +14 -11
- package/lib/treetable/Row.js +137 -85
- package/lib/treetable/helpers.js +24 -15
- package/lib/treetable/index.js +10 -8
- package/lib/treeview/Header.js +6 -7
- package/lib/treeview/Node.js +132 -92
- package/lib/treeview/constants.js +2 -1
- package/lib/treeview/index.js +214 -148
- package/lib/treeview_old/Header.js +28 -0
- package/lib/treeview_old/Node.js +88 -0
- package/lib/treeview_old/index.js +42 -0
- package/lib/types-c2a0f035.d.ts +50 -0
- package/lib/uitour/helpers.js +7 -4
- package/lib/uitour/index.d.ts +1 -2
- package/lib/uitour/index.js +99 -112
- package/lib/uitour/types.d.ts +1 -9
- package/package.json +82 -77
- package/tsconfig.json +0 -1
- package/.eslintcache +0 -1
- package/.nvmrc +0 -1
- package/lib/assets/styles/error.scss +0 -9
- package/lib/assets/styles/textContent.scss +0 -9
- package/lib/hint/helpers.d.ts +0 -3
- package/lib/hint/helpers.js +0 -21
- package/lib/inputs/base/Label.d.ts +0 -14
- package/lib/inputs/base/Label.js +0 -35
- package/lib/inputs/errorMessage/index.js +0 -26
- package/lib/tabs/DropdownTabs.d.ts +0 -11
- package/lib/tabs/DropdownTabs.js +0 -71
- package/lib/tabs/MenuTabs.js +0 -82
- package/lib/tabs/context.d.ts +0 -12
- package/lib/tabs/context.js +0 -130
- package/lib/tabs/useTabs.d.ts +0 -11
- package/lib/tabs/useTabs.js +0 -11
- package/lib/textContent/index.d.ts +0 -8
- package/lib/textContent/index.js +0 -30
|
@@ -4,8 +4,6 @@ import '../../@types/Align.js';
|
|
|
4
4
|
import '../../@types/PermissionAttr.js';
|
|
5
5
|
import '../base/types.js';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
|
-
import '../../internals/types.js';
|
|
8
|
-
import '../../@types/Position.js';
|
|
9
7
|
|
|
10
8
|
declare const PhoneField: (props: IPhoneFieldProps) => JSX.Element;
|
|
11
9
|
|
package/lib/inputs/mask/Phone.js
CHANGED
|
@@ -8,12 +8,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _BaseMask = _interopRequireDefault(require("./BaseMask"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
cellNumber
|
|
14
|
-
} = props;
|
|
11
|
+
var PhoneField = function PhoneField(props) {
|
|
12
|
+
var cellNumber = props.cellNumber;
|
|
15
13
|
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
|
|
16
14
|
mask: cellNumber ? '(00) 00000-0000' : '(00) 0000-0000'
|
|
17
15
|
}));
|
|
18
16
|
};
|
|
19
|
-
var _default =
|
|
17
|
+
var _default = PhoneField;
|
|
18
|
+
exports.default = _default;
|
|
@@ -4,8 +4,6 @@ import '../../@types/Align.js';
|
|
|
4
4
|
import '../../@types/PermissionAttr.js';
|
|
5
5
|
import '../base/types.js';
|
|
6
6
|
import '../../@types/Period.js';
|
|
7
|
-
import '../../internals/types.js';
|
|
8
|
-
import '../../@types/Position.js';
|
|
9
7
|
|
|
10
8
|
declare const ZipCodeField: (props: IZipCode) => JSX.Element;
|
|
11
9
|
|
|
@@ -8,7 +8,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _BaseMask = _interopRequireDefault(require("./BaseMask"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
var ZipCodeField = function ZipCodeField(props) {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
|
|
13
|
+
mask: "00000-000"
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
var _default = ZipCodeField;
|
|
17
|
+
exports.default = _default;
|
|
@@ -1,59 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { AnyMaskedOptions } from 'imask';
|
|
2
|
+
import { IMaskHOCProps } from '../types.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '../../@types/PermissionAttr.js';
|
|
5
|
+
import '../../@types/DataCombo.js';
|
|
6
|
+
import '../base/types.js';
|
|
7
|
+
import '../../@types/Align.js';
|
|
6
8
|
import '../../@types/Period.js';
|
|
7
|
-
import '../../
|
|
9
|
+
import '../../drawer/types.js';
|
|
8
10
|
import '../../@types/Position.js';
|
|
11
|
+
import '../../@types/Icon.js';
|
|
12
|
+
import '../../icons/helper.js';
|
|
9
13
|
|
|
10
|
-
declare
|
|
11
|
-
value?: string | number | undefined;
|
|
12
|
-
onBlur?: ((e: CustomInputEvent) => void) | undefined;
|
|
13
|
-
onKeyDown?: ((e: CustomInputEvent | React.KeyboardEvent<Element>) => void) | undefined;
|
|
14
|
-
defaultValue?: string | undefined;
|
|
15
|
-
isNumeric?: boolean | undefined;
|
|
16
|
-
blocks?: any;
|
|
17
|
-
leftElements?: JSX.Element | JSX.Element[] | undefined;
|
|
18
|
-
handlerSetOnDenied?: ((onDeniedValue: OnDenied) => void) | undefined;
|
|
19
|
-
onChange?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
|
|
20
|
-
onComplete?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
|
|
21
|
-
inputRef?: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void) | undefined;
|
|
22
|
-
permissionAttr?: PermissionAttr | undefined;
|
|
23
|
-
errorMessages?: string[] | undefined;
|
|
24
|
-
rounded?: boolean | undefined;
|
|
25
|
-
textAlign?: TextAlign | undefined;
|
|
26
|
-
customClassForInputContent?: string | undefined;
|
|
27
|
-
label?: string | undefined;
|
|
28
|
-
name?: string | undefined;
|
|
29
|
-
customClassForLabel?: string | undefined;
|
|
30
|
-
customClass?: string | undefined;
|
|
31
|
-
gridLayout?: string | undefined;
|
|
32
|
-
placeHolder?: string | undefined;
|
|
33
|
-
readOnly?: boolean | undefined;
|
|
34
|
-
labelUppercase?: boolean | undefined;
|
|
35
|
-
disabled?: boolean | undefined;
|
|
36
|
-
unmask?: boolean | undefined;
|
|
37
|
-
onFocus?: ((e: CustomInputEvent) => void) | undefined;
|
|
38
|
-
required?: boolean | undefined;
|
|
39
|
-
returnFormattedValueOnBlur?: boolean | undefined;
|
|
40
|
-
returnFormattedValueOnKeyDown?: boolean | undefined;
|
|
41
|
-
autoCompleteMask?: "left" | "right" | undefined;
|
|
42
|
-
definitions?: any;
|
|
43
|
-
mask?: any;
|
|
44
|
-
placeholderChar: string;
|
|
45
|
-
min: any;
|
|
46
|
-
max: any;
|
|
47
|
-
lazy: boolean;
|
|
48
|
-
pattern: string;
|
|
49
|
-
radix: string;
|
|
50
|
-
thousandsSeparator: string;
|
|
51
|
-
mapToRadix: string[];
|
|
52
|
-
scale: number;
|
|
53
|
-
normalizeZeros: boolean;
|
|
54
|
-
padFractionalZeros: boolean;
|
|
55
|
-
};
|
|
14
|
+
declare function extractNonMaskProps(props: IMaskHOCProps, maskProps: AnyMaskedOptions): any;
|
|
56
15
|
declare function CPFValidation(cpf?: string, returnMessage?: (msg: string) => void): void | "CPF inválido";
|
|
57
16
|
declare function CNPJValidation(cnpj?: string, returnMessage?: (msg: string) => void): void | "CNPJ inválido";
|
|
58
17
|
|
|
59
|
-
export { CNPJValidation, CPFValidation,
|
|
18
|
+
export { CNPJValidation, CPFValidation, extractNonMaskProps };
|
|
@@ -5,91 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CNPJValidation = CNPJValidation;
|
|
7
7
|
exports.CPFValidation = CPFValidation;
|
|
8
|
-
exports.
|
|
8
|
+
exports.extractNonMaskProps = extractNonMaskProps;
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
13
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _toPropertyKey(
|
|
16
|
-
function _toPrimitive(
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
scale = 2,
|
|
32
|
-
normalizeZeros = true,
|
|
33
|
-
padFractionalZeros = true,
|
|
34
|
-
rightElements
|
|
35
|
-
} = _ref,
|
|
36
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
// TODO: essa etapa deverá ser feita junto com o refactory dos componentes Date e Period.
|
|
38
|
-
// if (isDateField) {
|
|
39
|
-
// return {
|
|
40
|
-
// mask: Date,
|
|
41
|
-
// min: min || new Date(1900, 0, 1),
|
|
42
|
-
// max: max || new Date(9999, 0, 1),
|
|
43
|
-
// pattern: momentFormat,
|
|
44
|
-
// lazy,
|
|
45
|
-
// format: (date: moment.MomentInput) => moment(date).format(momentFormat),
|
|
46
|
-
// parse: (str) => moment(str, momentFormat).toDate(),
|
|
47
|
-
// blocks: {
|
|
48
|
-
// DD: {
|
|
49
|
-
// mask: IMask.MaskedRange,
|
|
50
|
-
// from: 1,
|
|
51
|
-
// to: 31,
|
|
52
|
-
// maxLength: 2,
|
|
53
|
-
// },
|
|
54
|
-
// MM: {
|
|
55
|
-
// mask: IMask.MaskedRange,
|
|
56
|
-
// from: 1,
|
|
57
|
-
// to: 12,
|
|
58
|
-
// maxLength: 2,
|
|
59
|
-
// },
|
|
60
|
-
// YYYY: {
|
|
61
|
-
// mask: IMask.MaskedRange,
|
|
62
|
-
// from: 1900,
|
|
63
|
-
// to: 9999,
|
|
64
|
-
// },
|
|
65
|
-
// },
|
|
66
|
-
// } satisfies ReactMaskOpts;
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
|
-
return _objectSpread({
|
|
70
|
-
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
71
|
-
min,
|
|
72
|
-
max,
|
|
73
|
-
lazy,
|
|
74
|
-
pattern,
|
|
75
|
-
radix,
|
|
76
|
-
thousandsSeparator,
|
|
77
|
-
mapToRadix,
|
|
78
|
-
scale,
|
|
79
|
-
normalizeZeros,
|
|
80
|
-
padFractionalZeros
|
|
81
|
-
}, rest);
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
/* eslint-disable no-plusplus */
|
|
17
|
+
function extractNonMaskProps(props, maskProps) {
|
|
18
|
+
var nonMask = _objectSpread({}, props);
|
|
19
|
+
Object.keys(maskProps).forEach(function (maskProp) {
|
|
20
|
+
delete nonMask[maskProp];
|
|
21
|
+
});
|
|
22
|
+
delete nonMask.value;
|
|
23
|
+
delete nonMask.onChange;
|
|
24
|
+
return nonMask;
|
|
25
|
+
}
|
|
26
|
+
var allEqualDigits = function allEqualDigits(input) {
|
|
27
|
+
return input.split('').every(function (char) {
|
|
28
|
+
return char === input[0];
|
|
29
|
+
});
|
|
82
30
|
};
|
|
83
|
-
exports.getMaskOptions = getMaskOptions;
|
|
84
|
-
const allEqualDigits = input => input.split('').every(char => char === input[0]);
|
|
85
31
|
function CPFValidation(cpf, returnMessage) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
32
|
+
var stringCpf = cpf ? cpf.replace(/[^\d]+/g, '') : '';
|
|
33
|
+
var sum = 0;
|
|
34
|
+
var splitRest;
|
|
89
35
|
if (stringCpf === '' || stringCpf.length < 11) return returnMessage ? returnMessage('CPF inválido') : 'CPF inválido';
|
|
90
36
|
if (allEqualDigits(stringCpf)) return returnMessage ? returnMessage('CPF inválido') : 'CPF inválido';
|
|
91
37
|
// 1st digit validation
|
|
92
|
-
for (
|
|
38
|
+
for (var i = 0; i < 9; i++) {
|
|
93
39
|
sum += (0, _lodash.parseInt)(stringCpf.charAt(i), 10) * (10 - i);
|
|
94
40
|
}
|
|
95
41
|
splitRest = sum * 10 % 11;
|
|
@@ -98,8 +44,8 @@ function CPFValidation(cpf, returnMessage) {
|
|
|
98
44
|
// 2nd digit validation
|
|
99
45
|
sum = 0;
|
|
100
46
|
splitRest = 0;
|
|
101
|
-
for (
|
|
102
|
-
sum += (0, _lodash.parseInt)(stringCpf.charAt(
|
|
47
|
+
for (var _i = 0; _i < 10; _i++) {
|
|
48
|
+
sum += (0, _lodash.parseInt)(stringCpf.charAt(_i), 10) * (11 - _i);
|
|
103
49
|
}
|
|
104
50
|
splitRest = sum * 10 % 11;
|
|
105
51
|
if (splitRest === 10 || splitRest === 11) splitRest = 0;
|
|
@@ -107,28 +53,28 @@ function CPFValidation(cpf, returnMessage) {
|
|
|
107
53
|
return returnMessage ? returnMessage('') : undefined;
|
|
108
54
|
}
|
|
109
55
|
function CNPJValidation(cnpj, returnMessage) {
|
|
110
|
-
|
|
56
|
+
var stringCnpj = cnpj ? cnpj.replace(/[^\d]+/g, '') : '';
|
|
111
57
|
if (stringCnpj === '' || stringCnpj.length !== 14) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
|
|
112
58
|
if (allEqualDigits(stringCnpj)) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
59
|
+
var length = stringCnpj.length - 2;
|
|
60
|
+
var numbers = stringCnpj.substring(0, length);
|
|
61
|
+
var digits = stringCnpj.substring(length);
|
|
62
|
+
var sum = 0;
|
|
63
|
+
var pos = length - 7;
|
|
118
64
|
// 1° digit validation
|
|
119
|
-
for (
|
|
65
|
+
for (var i = length; i >= 1; i--) {
|
|
120
66
|
sum += (0, _lodash.parseInt)(numbers.charAt(length - i)) * pos--;
|
|
121
67
|
if (pos < 2) pos = 9;
|
|
122
68
|
}
|
|
123
|
-
|
|
69
|
+
var result = sum % 11 < 2 ? 0 : 11 - sum % 11;
|
|
124
70
|
if (result.toString() !== digits.charAt(0)) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
|
|
125
71
|
length += 1;
|
|
126
72
|
numbers = stringCnpj.substring(0, length);
|
|
127
73
|
sum = 0;
|
|
128
74
|
pos = length - 7;
|
|
129
75
|
// 2° digit validation
|
|
130
|
-
for (
|
|
131
|
-
sum += (0, _lodash.parseInt)(numbers.charAt(length -
|
|
76
|
+
for (var _i2 = length; _i2 >= 1; _i2--) {
|
|
77
|
+
sum += (0, _lodash.parseInt)(numbers.charAt(length - _i2)) * pos--;
|
|
132
78
|
if (pos < 2) pos = 9;
|
|
133
79
|
}
|
|
134
80
|
result = sum % 11 < 2 ? 0 : 11 - sum % 11;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IMaskHOCProps } from '../types.js';
|
|
3
3
|
import '../../@types/PermissionAttr.js';
|
|
4
4
|
import '../../@types/DataCombo.js';
|
|
5
5
|
import '../base/types.js';
|
|
6
6
|
import '../../@types/Align.js';
|
|
7
7
|
import '../../@types/Period.js';
|
|
8
|
-
import '../../internals/types.js';
|
|
9
|
-
import '../../@types/Position.js';
|
|
10
8
|
import '../../drawer/types.js';
|
|
9
|
+
import '../../@types/Position.js';
|
|
11
10
|
import '../../@types/Icon.js';
|
|
12
11
|
import '../../icons/helper.js';
|
|
13
12
|
|
|
14
|
-
declare const
|
|
13
|
+
declare const IMaskHOC: <ComponentProps extends IMaskHOCProps>(ComposedComponent: React__default.ComponentType<ComponentProps>) => {
|
|
14
|
+
(props: ComponentProps): JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
15
17
|
|
|
16
|
-
export {
|
|
18
|
+
export { IMaskHOC as default };
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _imask = _interopRequireDefault(require("imask"));
|
|
9
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
10
|
+
var _permissionValidations = require("../../permissionValidations");
|
|
11
|
+
var _format_number = require("../number/format_number");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
24
|
+
var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
25
|
+
var MaskedComponent = function MaskedComponent(props) {
|
|
26
|
+
var permissionAttr = props.permissionAttr,
|
|
27
|
+
skeletonize = props.skeletonize,
|
|
28
|
+
_inputRef = props.inputRef,
|
|
29
|
+
_props$placeholderCha = props.placeholderChar,
|
|
30
|
+
placeholderChar = _props$placeholderCha === void 0 ? '_' : _props$placeholderCha,
|
|
31
|
+
_props$lazy = props.lazy,
|
|
32
|
+
lazy = _props$lazy === void 0 ? false : _props$lazy,
|
|
33
|
+
_props$pattern = props.pattern,
|
|
34
|
+
pattern = _props$pattern === void 0 ? '' : _props$pattern,
|
|
35
|
+
_props$radix = props.radix,
|
|
36
|
+
radix = _props$radix === void 0 ? ' ' : _props$radix,
|
|
37
|
+
_props$thousandsSepar = props.thousandsSeparator,
|
|
38
|
+
thousandsSeparator = _props$thousandsSepar === void 0 ? '' : _props$thousandsSepar,
|
|
39
|
+
_props$mapToRadix = props.mapToRadix,
|
|
40
|
+
mapToRadix = _props$mapToRadix === void 0 ? [] : _props$mapToRadix,
|
|
41
|
+
_props$scale = props.scale,
|
|
42
|
+
scale = _props$scale === void 0 ? 2 : _props$scale,
|
|
43
|
+
_props$signed = props.signed,
|
|
44
|
+
signed = _props$signed === void 0 ? false : _props$signed,
|
|
45
|
+
_props$normalizeZeros = props.normalizeZeros,
|
|
46
|
+
normalizeZeros = _props$normalizeZeros === void 0 ? true : _props$normalizeZeros,
|
|
47
|
+
_props$padFractionalZ = props.padFractionalZeros,
|
|
48
|
+
padFractionalZeros = _props$padFractionalZ === void 0 ? true : _props$padFractionalZ,
|
|
49
|
+
mask = props.mask,
|
|
50
|
+
_props$commit = props.commit,
|
|
51
|
+
commit = _props$commit === void 0 ? function () {} : _props$commit,
|
|
52
|
+
parse = props.parse,
|
|
53
|
+
format = props.format,
|
|
54
|
+
definitions = props.definitions,
|
|
55
|
+
groups = props.groups,
|
|
56
|
+
min = props.min,
|
|
57
|
+
max = props.max,
|
|
58
|
+
dispatch = props.dispatch,
|
|
59
|
+
_props$value = props.value,
|
|
60
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
61
|
+
onChange = props.onChange,
|
|
62
|
+
_props$isDateField = props.isDateField,
|
|
63
|
+
isDateField = _props$isDateField === void 0 ? false : _props$isDateField,
|
|
64
|
+
autoCompleteMask = props.autoCompleteMask;
|
|
65
|
+
var maskOptions = {
|
|
66
|
+
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
67
|
+
lazy: lazy,
|
|
68
|
+
pattern: pattern,
|
|
69
|
+
radix: radix,
|
|
70
|
+
thousandsSeparator: thousandsSeparator,
|
|
71
|
+
mapToRadix: mapToRadix,
|
|
72
|
+
scale: scale,
|
|
73
|
+
signed: signed,
|
|
74
|
+
normalizeZeros: normalizeZeros,
|
|
75
|
+
padFractionalZeros: padFractionalZeros,
|
|
76
|
+
mask: mask,
|
|
77
|
+
commit: commit,
|
|
78
|
+
parse: parse,
|
|
79
|
+
format: format,
|
|
80
|
+
definitions: definitions,
|
|
81
|
+
groups: groups,
|
|
82
|
+
min: min,
|
|
83
|
+
max: max,
|
|
84
|
+
dispatch: dispatch
|
|
85
|
+
};
|
|
86
|
+
var _useState = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr)),
|
|
87
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
88
|
+
onDenied = _useState2[0];
|
|
89
|
+
var elementRef = (0, _react.useRef)(null);
|
|
90
|
+
var maskRef = (0, _react.useRef)(null);
|
|
91
|
+
var hideContent = onDenied.hideContent,
|
|
92
|
+
unvisible = onDenied.unvisible,
|
|
93
|
+
disabled = onDenied.disabled,
|
|
94
|
+
readOnly = onDenied.readOnly;
|
|
95
|
+
var dontInitMask = hideContent || unvisible || skeletonize;
|
|
96
|
+
var disableCallbacks = disabled || readOnly;
|
|
97
|
+
var setValue = function setValue(newValue) {
|
|
98
|
+
if (maskRef.current) {
|
|
99
|
+
if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
|
|
100
|
+
maskRef.current.value = String(newValue);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var onAccept = (0, _react.useCallback)(function () {
|
|
104
|
+
if (onChange && !disableCallbacks && maskRef.current) {
|
|
105
|
+
var _maskRef$current = maskRef.current,
|
|
106
|
+
unmaskedValue = _maskRef$current.unmaskedValue,
|
|
107
|
+
el = _maskRef$current.el;
|
|
108
|
+
var name = el.name || el.input && el.input.name;
|
|
109
|
+
onChange({
|
|
110
|
+
target: {
|
|
111
|
+
value: unmaskedValue,
|
|
112
|
+
name: name
|
|
113
|
+
}
|
|
114
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
115
|
+
}
|
|
116
|
+
}, [onChange]);
|
|
117
|
+
var onComplete = (0, _react.useCallback)(function () {
|
|
118
|
+
if (props.onComplete && !disableCallbacks && maskRef.current) {
|
|
119
|
+
var _maskRef$current2 = maskRef.current,
|
|
120
|
+
unmaskedValue = _maskRef$current2.unmaskedValue,
|
|
121
|
+
el = _maskRef$current2.el;
|
|
122
|
+
var name = el.name || el.input && el.input.name;
|
|
123
|
+
props.onComplete({
|
|
124
|
+
target: {
|
|
125
|
+
value: unmaskedValue,
|
|
126
|
+
name: name
|
|
127
|
+
}
|
|
128
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
129
|
+
}
|
|
130
|
+
}, [props.onComplete]);
|
|
131
|
+
var autoCompleteMaskValue = (0, _react.useCallback)(function (eventTargetValue) {
|
|
132
|
+
if (autoCompleteMask && eventTargetValue.length && maskRef.current && elementRef.current) {
|
|
133
|
+
var sizeMask = maskRef.current.mask.toString().replace(/\D+/g, '').length;
|
|
134
|
+
if (sizeMask > eventTargetValue.length) {
|
|
135
|
+
switch (autoCompleteMask) {
|
|
136
|
+
case 'left':
|
|
137
|
+
setValue(eventTargetValue.padStart(sizeMask, '0'));
|
|
138
|
+
break;
|
|
139
|
+
case 'right':
|
|
140
|
+
setValue(eventTargetValue.padEnd(sizeMask, '0'));
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
setValue(eventTargetValue);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, [autoCompleteMask, maskRef.current, elementRef.current]);
|
|
149
|
+
var getMask = function getMask() {
|
|
150
|
+
var element = elementRef.current;
|
|
151
|
+
if (element) {
|
|
152
|
+
var maskCurrent = maskRef.current;
|
|
153
|
+
if (!maskCurrent) {
|
|
154
|
+
maskRef.current = (0, _imask.default)(element, maskOptions);
|
|
155
|
+
if (value && typeof value !== 'number' && value.trim() !== '' || value && typeof value === 'number') onAccept();
|
|
156
|
+
setValue(value);
|
|
157
|
+
} else {
|
|
158
|
+
maskCurrent.updateOptions(maskOptions);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var destroyMask = function destroyMask() {
|
|
163
|
+
if (maskRef.current) {
|
|
164
|
+
maskRef.current.destroy();
|
|
165
|
+
maskRef.current = null;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
(0, _react.useEffect)(function () {
|
|
169
|
+
if (props.handlerSetOnDenied) props.handlerSetOnDenied(onDenied);
|
|
170
|
+
if (!props.mask || dontInitMask) return;
|
|
171
|
+
getMask();
|
|
172
|
+
}, [maskOptions]);
|
|
173
|
+
(0, _react.useEffect)(function () {
|
|
174
|
+
if (!maskRef.current) return;
|
|
175
|
+
var maskCurrent = maskRef.current;
|
|
176
|
+
maskCurrent.on('accept', onAccept);
|
|
177
|
+
maskCurrent.on('complete', onComplete);
|
|
178
|
+
|
|
179
|
+
// eslint-disable-next-line consistent-return
|
|
180
|
+
return function () {
|
|
181
|
+
maskCurrent.off('accept', onAccept);
|
|
182
|
+
maskCurrent.off('complete', onComplete);
|
|
183
|
+
};
|
|
184
|
+
}, [onAccept, onComplete]);
|
|
185
|
+
(0, _react.useEffect)(function () {
|
|
186
|
+
if (maskOptions.mask && !dontInitMask) {
|
|
187
|
+
if (maskRef.current) {
|
|
188
|
+
var formattedValue = isDateField ? value : (0, _format_number.numberToPtBR)(value) || '';
|
|
189
|
+
setValue(formattedValue);
|
|
190
|
+
} else {
|
|
191
|
+
getMask();
|
|
192
|
+
}
|
|
193
|
+
} else if (!dontInitMask) {
|
|
194
|
+
destroyMask();
|
|
195
|
+
if (value && elementRef.current) elementRef.current.value = value;
|
|
196
|
+
}
|
|
197
|
+
}, [value, isDateField]);
|
|
198
|
+
(0, _react.useEffect)(function () {
|
|
199
|
+
return destroyMask;
|
|
200
|
+
}, []);
|
|
201
|
+
return /*#__PURE__*/_react.default.createElement(ComposedComponent, _extends({}, helpers.extractNonMaskProps(props, maskOptions), {
|
|
202
|
+
onDeniedActions: onDenied,
|
|
203
|
+
defaultValue: value,
|
|
204
|
+
onBlur: function onBlur(e) {
|
|
205
|
+
autoCompleteMaskValue(e.target.value);
|
|
206
|
+
if (props.onBlur) props.onBlur(e);
|
|
207
|
+
},
|
|
208
|
+
onChange: function onChange(e) {
|
|
209
|
+
return setValue(e.target.value);
|
|
210
|
+
},
|
|
211
|
+
inputRef: function inputRef(el) {
|
|
212
|
+
elementRef.current = el;
|
|
213
|
+
if (_inputRef) {
|
|
214
|
+
if (_typeof(_inputRef) === 'object') _inputRef.current = el;else _inputRef(el);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
};
|
|
219
|
+
var nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
|
|
220
|
+
MaskedComponent.displayName = "IMask(".concat(nestedComponentName, ")");
|
|
221
|
+
return MaskedComponent;
|
|
222
|
+
};
|
|
223
|
+
var _default = IMaskHOC;
|
|
224
|
+
exports.default = _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _default from './BaseMask.js';
|
|
2
2
|
export { default as CpfField } from './Cpf.js';
|
|
3
3
|
export { default as CnpjField } from './Cnpj.js';
|
|
4
4
|
export { default as PhoneField } from './Phone.js';
|
|
@@ -9,9 +9,7 @@ import '../../@types/Align.js';
|
|
|
9
9
|
import '../../@types/PermissionAttr.js';
|
|
10
10
|
import '../base/types.js';
|
|
11
11
|
import '../../@types/Period.js';
|
|
12
|
-
import '../../internals/types.js';
|
|
13
|
-
import '../../@types/Position.js';
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
|
|
17
|
-
export {
|
|
15
|
+
export { _default as default };
|
package/lib/inputs/mask/index.js
CHANGED
|
@@ -5,25 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "CnpjField", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function () {
|
|
8
|
+
get: function get() {
|
|
9
9
|
return _Cnpj.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "CpfField", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () {
|
|
14
|
+
get: function get() {
|
|
15
15
|
return _Cpf.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "PhoneField", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () {
|
|
20
|
+
get: function get() {
|
|
21
21
|
return _Phone.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "ZipCodeField", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () {
|
|
26
|
+
get: function get() {
|
|
27
27
|
return _ZipCode.default;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -34,4 +34,5 @@ var _Cnpj = _interopRequireDefault(require("./Cnpj"));
|
|
|
34
34
|
var _Phone = _interopRequireDefault(require("./Phone"));
|
|
35
35
|
var _ZipCode = _interopRequireDefault(require("./ZipCode"));
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
var _default =
|
|
37
|
+
var _default = _BaseMask.default;
|
|
38
|
+
exports.default = _default;
|