linear-react-components-ui 1.0.10-beta.2 → 1.0.10-beta.21
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 +1 -0
- package/.vscode/settings.json +1 -1
- package/README.md +19 -12
- package/lib/@types/Align.d.ts +2 -1
- package/lib/alerts/AlertContainer.d.ts +2 -0
- package/lib/alerts/AlertProvider.d.ts +2 -0
- package/lib/alerts/BaseAlert.d.ts +2 -0
- package/lib/alerts/Message.d.ts +2 -0
- package/lib/alerts/Message.js +1 -1
- package/lib/alerts/alert.spec.js +133 -0
- package/lib/alerts/helpers.d.ts +2 -0
- package/lib/alerts/index.d.ts +2 -0
- package/lib/alerts/types.d.ts +3 -1
- package/lib/alerts/withAlert.d.ts +2 -0
- package/lib/assets/styles/dialog.scss +9 -6
- package/lib/assets/styles/drawers.scss +9 -0
- package/lib/assets/styles/effects.scss +2 -2
- package/lib/assets/styles/radio.scss +52 -8
- package/lib/assets/styles/table.scss +30 -0
- package/lib/assets/styles/tooltip.scss +42 -2
- package/lib/avatar/avatar.spec.js +190 -0
- package/lib/badge/badge.spec.js +127 -0
- package/lib/buttons/ActivateButton.d.ts +2 -0
- package/lib/buttons/AddButton.d.ts +2 -0
- package/lib/buttons/Button.d.ts +2 -0
- package/lib/buttons/CancelButton.d.ts +2 -0
- package/lib/buttons/DangerButton.d.ts +2 -0
- package/lib/buttons/DefaultButton.d.ts +2 -0
- package/lib/buttons/DefaultButton.js +14 -4
- package/lib/buttons/DestroyButton.d.ts +2 -0
- package/lib/buttons/EditButton.d.ts +2 -0
- package/lib/buttons/InactivateButton.d.ts +2 -0
- package/lib/buttons/InfoButton.d.ts +2 -0
- package/lib/buttons/PrimaryButton.d.ts +2 -0
- package/lib/buttons/RestoreButton.d.ts +2 -0
- package/lib/buttons/SaveButton.d.ts +2 -0
- package/lib/buttons/SpinnerLoading.js +230 -0
- package/lib/buttons/SuccessButton.d.ts +2 -0
- package/lib/buttons/WarningButton.d.ts +2 -0
- package/lib/buttons/buttons.spec.js +504 -0
- package/lib/buttons/index.d.ts +2 -0
- package/lib/buttons/split_button/index.d.ts +2 -0
- package/lib/buttons/types.d.ts +6 -2
- package/lib/calendar/calendar.spec.js +171 -0
- package/lib/checkbox/checkbox.spec.js +215 -0
- package/lib/dialog/Alert.d.ts +3 -0
- package/lib/dialog/Custom.d.ts +3 -0
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/Error.d.ts +3 -0
- package/lib/dialog/Information.d.ts +3 -0
- package/lib/dialog/Question.d.ts +3 -0
- package/lib/dialog/Warning.d.ts +3 -0
- package/lib/dialog/base/Content.d.ts +3 -0
- package/lib/dialog/base/Footer.d.ts +3 -0
- package/lib/dialog/base/Header.d.ts +3 -0
- package/lib/dialog/base/Header.js +12 -1
- package/lib/dialog/base/index.d.ts +3 -0
- package/lib/dialog/base/index.js +78 -16
- package/lib/dialog/dialog.spec.js +488 -0
- package/lib/dialog/form/index.d.ts +7 -3
- package/lib/dialog/form/index.js +11 -4
- package/lib/dialog/index.d.ts +3 -0
- package/lib/dialog/types.d.ts +10 -4
- package/lib/drawer/Content.d.ts +2 -0
- package/lib/drawer/Drawer.d.ts +3 -1
- package/lib/drawer/Drawer.js +22 -2
- package/lib/drawer/Drawer.spec.js +258 -0
- package/lib/drawer/Header.d.ts +2 -0
- package/lib/drawer/helpers.d.ts +2 -0
- package/lib/drawer/index.d.ts +2 -0
- package/lib/drawer/types.d.ts +4 -1
- package/lib/dropdown/Popup.js +5 -0
- package/lib/dropdown/dropdown.spec.js +169 -0
- package/lib/fieldset/fieldset.spec.js +329 -0
- package/lib/form/Field.d.ts +2 -1
- package/lib/form/Field.js +33 -24
- package/lib/form/FieldArray.d.ts +1 -0
- package/lib/form/FieldArray.js +41 -4
- package/lib/form/FieldNumber.d.ts +1 -0
- package/lib/form/FieldNumber.js +24 -5
- package/lib/form/FieldPeriod.d.ts +1 -0
- package/lib/form/FieldPeriod.js +16 -2
- package/lib/form/form.spec.js +293 -0
- package/lib/form/helpers.d.ts +2 -1
- package/lib/form/helpers.js +2 -2
- package/lib/form/index.d.ts +4 -2
- package/lib/form/index.js +72 -35
- package/lib/form/types.d.ts +25 -6
- package/lib/form/withFieldHOC.d.ts +1 -0
- package/lib/form/withFieldHOC.js +1 -0
- package/lib/form/withFormSecurity.d.ts +1 -0
- package/lib/form/withFormSecurity.js +2 -1
- package/lib/gridlayout/gridLayout.spec.js +169 -0
- package/lib/icons/helper.d.ts +4 -0
- package/lib/icons/helper.js +4 -0
- package/lib/icons/icons.spec.js +86 -0
- package/lib/icons/index.d.ts +2 -0
- package/lib/icons/types.d.ts +3 -1
- package/lib/index.d.ts +4 -1
- package/lib/inputs/base/InputTextBase.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.js +10 -2
- package/lib/inputs/base/base.spec.js +690 -0
- package/lib/inputs/base/helpers.d.ts +2 -1
- package/lib/inputs/base/index.js +1 -0
- package/lib/inputs/base/types.d.ts +2 -1
- package/lib/inputs/color/color_input.spec.js +174 -0
- package/lib/inputs/date/Dialog.d.ts +1 -0
- package/lib/inputs/date/Dropdown.d.ts +1 -0
- package/lib/inputs/date/date.spec.js +354 -0
- package/lib/inputs/date/helpers.d.ts +2 -1
- package/lib/inputs/date/helpers.js +3 -2
- package/lib/inputs/date/index.d.ts +1 -0
- package/lib/inputs/date/index.js +24 -9
- package/lib/inputs/date/types.d.ts +3 -1
- package/lib/inputs/file/DefaultFile.d.ts +1 -0
- package/lib/inputs/file/DragDropFile.d.ts +1 -0
- package/lib/inputs/file/File.d.ts +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -0
- package/lib/inputs/file/helpers.d.ts +1 -0
- package/lib/inputs/file/index.d.ts +1 -0
- package/lib/inputs/file/types.d.ts +1 -0
- package/lib/inputs/inputHOC.d.ts +3 -0
- package/lib/inputs/mask/BaseMask.d.ts +1 -0
- package/lib/inputs/mask/BaseMask.js +20 -5
- package/lib/inputs/mask/Cnpj.d.ts +1 -0
- package/lib/inputs/mask/Cpf.d.ts +1 -0
- package/lib/inputs/mask/Cpf.js +4 -4
- package/lib/inputs/mask/Phone.d.ts +1 -0
- package/lib/inputs/mask/ZipCode.d.ts +1 -0
- package/lib/inputs/mask/helpers.d.ts +3 -0
- package/lib/inputs/mask/helpers.js +1 -1
- package/lib/inputs/mask/imaskHOC.d.ts +3 -0
- package/lib/inputs/mask/imaskHOC.js +16 -12
- package/lib/inputs/mask/index.d.ts +1 -0
- package/lib/inputs/mask/input_mask.spec.js +607 -0
- package/lib/inputs/mask/types.d.ts +2 -1
- package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -1
- package/lib/inputs/multiSelect/ActionButtons.js +4 -1
- package/lib/inputs/multiSelect/Dropdown.d.ts +1 -0
- package/lib/inputs/multiSelect/Dropdown.js +4 -4
- package/lib/inputs/multiSelect/helper.d.ts +8 -6
- package/lib/inputs/multiSelect/helper.js +5 -1
- package/lib/inputs/multiSelect/index.d.ts +1 -0
- package/lib/inputs/multiSelect/index.js +15 -11
- package/lib/inputs/multiSelect/types.d.ts +16 -6
- package/lib/inputs/number/BaseNumber.d.ts +3 -0
- package/lib/inputs/number/BaseNumber.js +1 -2
- package/lib/inputs/number/Currency.d.ts +3 -0
- package/lib/inputs/number/Decimal.d.ts +3 -0
- package/lib/inputs/number/format_number.d.ts +2 -1
- package/lib/inputs/number/format_number.js +8 -3
- package/lib/inputs/number/index.d.ts +3 -0
- package/lib/inputs/number/numberfield.spec.js +215 -0
- package/lib/inputs/number/types.d.ts +3 -1
- package/lib/inputs/period/Dialog.d.ts +1 -0
- package/lib/inputs/period/Dropdown.d.ts +1 -0
- package/lib/inputs/period/PeriodList.d.ts +1 -0
- package/lib/inputs/period/helper.d.ts +1 -0
- package/lib/inputs/period/index.d.ts +1 -0
- package/lib/inputs/period/index.js +8 -9
- package/lib/inputs/period/types.d.ts +3 -2
- package/lib/inputs/search/index.d.ts +3 -0
- package/lib/inputs/search/search_input.spec.js +209 -0
- package/lib/inputs/select/ActionButtons.d.ts +3 -0
- package/lib/inputs/select/Dropdown.d.ts +3 -0
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.d.ts +7 -9
- package/lib/inputs/select/helper.js +11 -2
- package/lib/inputs/select/index.d.ts +1 -0
- package/lib/inputs/select/index.js +6 -5
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -0
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -0
- package/lib/inputs/select/multiple/index.js +13 -10
- package/lib/inputs/select/select.spec.js +395 -0
- package/lib/inputs/select/simple/index.d.ts +1 -0
- package/lib/inputs/select/simple/index.js +35 -18
- package/lib/inputs/select/types.d.ts +22 -7
- package/lib/inputs/text/index.d.ts +1 -0
- package/lib/inputs/text/textfield.spec.js +215 -0
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/index.d.ts +1 -0
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/inputs/textarea/textarea.spec.js +59 -0
- package/lib/inputs/textarea/types.d.ts +1 -0
- package/lib/inputs/types.d.ts +7 -3
- package/lib/internals/types.d.ts +1 -0
- package/lib/internals/withTooltip.js +13 -6
- package/lib/labelMessages/index.d.ts +2 -0
- package/lib/labelMessages/index.js +3 -4
- package/lib/labelMessages/labelMessages.spec.js +176 -0
- package/lib/labelMessages/types.d.ts +3 -1
- package/lib/labels/DangerLabel.d.ts +2 -0
- package/lib/labels/DefaultLabel.d.ts +2 -0
- package/lib/labels/InfoLabel.d.ts +2 -0
- package/lib/labels/PrimaryLabel.d.ts +2 -0
- package/lib/labels/SuccessLabel.d.ts +2 -0
- package/lib/labels/WarningLabel.d.ts +2 -0
- package/lib/labels/index.d.ts +2 -0
- package/lib/labels/label.spec.js +162 -0
- package/lib/labels/types.d.ts +3 -1
- package/lib/list/Header.d.ts +2 -0
- package/lib/list/Item.d.ts +2 -0
- package/lib/list/helpers.d.ts +2 -0
- package/lib/list/index.d.ts +2 -0
- package/lib/list/list.spec.js +769 -0
- package/lib/list/types.d.ts +4 -2
- package/lib/menus/float/MenuItem.d.ts +2 -0
- package/lib/menus/float/float-menu.spec.js +221 -0
- package/lib/menus/float/helpers.d.ts +2 -0
- package/lib/menus/float/index.d.ts +2 -0
- package/lib/menus/float/types.d.ts +3 -1
- package/lib/menus/index.d.ts +2 -0
- package/lib/menus/sidenav/ExpandMenu.d.ts +2 -0
- package/lib/menus/sidenav/MenuLink.d.ts +2 -0
- package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -0
- package/lib/menus/sidenav/NavMenuItem.d.ts +2 -0
- package/lib/menus/sidenav/NavSubMenuItem.d.ts +2 -0
- package/lib/menus/sidenav/helpers.d.ts +2 -0
- package/lib/menus/sidenav/index.d.ts +2 -0
- package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +2 -0
- package/lib/menus/sidenav/popup_menu_search/index.d.ts +2 -0
- package/lib/menus/sidenav/sidenav.spec.js +379 -0
- package/lib/menus/sidenav/types.d.ts +4 -2
- package/lib/panel/Content.d.ts +3 -1
- package/lib/panel/DangerPanel.d.ts +3 -1
- package/lib/panel/Default.d.ts +3 -1
- package/lib/panel/Header.d.ts +3 -1
- package/lib/panel/Header.js +3 -4
- package/lib/panel/InfoPanel.d.ts +3 -1
- package/lib/panel/PrimaryPanel.d.ts +3 -1
- package/lib/panel/SuccessPanel.d.ts +3 -1
- package/lib/panel/ToolBar.d.ts +3 -1
- package/lib/panel/WarningPanel.d.ts +3 -1
- package/lib/panel/helpers.d.ts +3 -1
- package/lib/panel/index.d.ts +3 -1
- package/lib/panel/panel.spec.js +216 -0
- package/lib/panel/types.d.ts +3 -1
- package/lib/popover/PopoverText.d.ts +2 -0
- package/lib/popover/PopoverTitle.d.ts +2 -0
- package/lib/popover/index.d.ts +2 -0
- package/lib/popover/index.js +1 -2
- package/lib/popover/popover.spec.js +146 -0
- package/lib/popover/types.d.ts +3 -1
- package/lib/progress/progress.spec.js +94 -0
- package/lib/radio/index.d.ts +2 -1
- package/lib/radio/index.js +5 -1
- package/lib/radio/radio.spec.js +189 -0
- package/lib/radio/types.d.ts +4 -1
- package/lib/spinner/spinner.spec.js +152 -0
- package/lib/split/split.spec.js +163 -0
- package/lib/table/Body.js +9 -12
- package/lib/table/Header.js +19 -16
- package/lib/table/Row.js +20 -3
- package/lib/table/index.js +1 -0
- package/lib/table/table.spec.js +352 -0
- package/lib/table/types.d.ts +7 -0
- package/lib/tabs/DropdownItems.d.ts +2 -0
- package/lib/tabs/Menu.d.ts +2 -0
- package/lib/tabs/MenuItems.d.ts +2 -0
- package/lib/tabs/Panel.d.ts +2 -0
- package/lib/tabs/index.d.ts +2 -0
- package/lib/tabs/tabHelpers.d.ts +2 -0
- package/lib/tabs/tabs.spec.js +321 -0
- package/lib/tabs/types.d.ts +3 -1
- package/lib/toolbar/ButtonBar.d.ts +2 -0
- package/lib/toolbar/LabelBar.d.ts +2 -0
- package/lib/toolbar/ToolBarGroup.d.ts +2 -0
- package/lib/toolbar/helpers.d.ts +2 -0
- package/lib/toolbar/index.d.ts +2 -0
- package/lib/toolbar/toolbar.spec.js +394 -0
- package/lib/toolbar/types.d.ts +4 -2
- package/lib/tooltip/index.d.ts +1 -1
- package/lib/tooltip/index.js +5 -1
- package/lib/tooltip/tooltip.spec.js +215 -0
- package/lib/tooltip/types.d.ts +1 -0
- package/lib/treeview/index.js +1 -0
- package/lib/treeview/treeview.spec.js +279 -0
- package/lib/{types-90c43ae1.d.ts → types-c1e2d0c9.d.ts} +2 -1
- package/lib/uitour/uitour.spec.js +176 -0
- package/package.json +67 -64
package/lib/inputs/inputHOC.d.ts
CHANGED
|
@@ -3,9 +3,12 @@ import { IInputHOCProps } from './types.js';
|
|
|
3
3
|
import '../@types/PermissionAttr.js';
|
|
4
4
|
import '../@types/DataCombo.js';
|
|
5
5
|
import './base/types.js';
|
|
6
|
+
import '../@types/Align.js';
|
|
6
7
|
import '../@types/Period.js';
|
|
7
8
|
import '../drawer/types.js';
|
|
8
9
|
import '../@types/Position.js';
|
|
10
|
+
import '../@types/Icon.js';
|
|
11
|
+
import '../icons/helper.js';
|
|
9
12
|
|
|
10
13
|
declare const InputHOC: <ComponentProps extends IInputHOCProps>(WrappedComponent: React__default.ComponentType<ComponentProps>) => (props: ComponentProps) => JSX.Element;
|
|
11
14
|
|
|
@@ -35,21 +35,36 @@ var getEventProps = function getEventProps(props) {
|
|
|
35
35
|
return {
|
|
36
36
|
onBlur: function onBlur(e) {
|
|
37
37
|
if (props.onBlur) {
|
|
38
|
-
var
|
|
38
|
+
var value = e.target.value;
|
|
39
|
+
var formatedValue = (0, _format_number.formatOnlyNumbers)(value);
|
|
40
|
+
var eventWithFormatedValue = _extends({}, e, {
|
|
41
|
+
target: {
|
|
42
|
+
value: formatedValue
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var formattedEvent = returnEventFormattedValue(props, eventWithFormatedValue);
|
|
39
46
|
props.onBlur(formattedEvent);
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
onKeyDown: function onKeyDown(e) {
|
|
43
50
|
if (props.onKeyDown) {
|
|
44
|
-
var
|
|
51
|
+
var _ref = e.target,
|
|
52
|
+
value = _ref.value;
|
|
53
|
+
var formatedValue = (0, _format_number.formatOnlyNumbers)(value);
|
|
54
|
+
var eventWithFormatedValue = _extends({}, e, {
|
|
55
|
+
target: {
|
|
56
|
+
value: formatedValue
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var formattedEvent = returnEventFormattedValue(props, eventWithFormatedValue);
|
|
45
60
|
props.onKeyDown(formattedEvent);
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
};
|
|
49
64
|
};
|
|
50
|
-
var BaseMask = function BaseMask(
|
|
51
|
-
var inputRef =
|
|
52
|
-
props = _objectWithoutProperties(
|
|
65
|
+
var BaseMask = function BaseMask(_ref2) {
|
|
66
|
+
var inputRef = _ref2.inputRef,
|
|
67
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
53
68
|
return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
54
69
|
inputRef: inputRef
|
|
55
70
|
}, getEventProps(props)));
|
package/lib/inputs/mask/Cpf.d.ts
CHANGED
package/lib/inputs/mask/Cpf.js
CHANGED
|
@@ -45,11 +45,11 @@ var CpfField = function CpfField(props) {
|
|
|
45
45
|
return debouncedOnChange.cancel;
|
|
46
46
|
}, []);
|
|
47
47
|
var onChange = function onChange(e) {
|
|
48
|
+
// console.log('onChange >>>', props.onChange);
|
|
48
49
|
if (enableValidation && e) {
|
|
49
50
|
debouncedOnChange(e.target.value);
|
|
50
51
|
if (props.onChange) props.onChange(e);
|
|
51
|
-
}
|
|
52
|
-
if (props.onChange) {
|
|
52
|
+
} else if (props.onChange) {
|
|
53
53
|
props.onChange(e);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
@@ -61,10 +61,10 @@ var CpfField = function CpfField(props) {
|
|
|
61
61
|
}
|
|
62
62
|
return {};
|
|
63
63
|
};
|
|
64
|
-
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
|
|
65
65
|
onChange: onChange,
|
|
66
66
|
mask: "000.000.000-00"
|
|
67
|
-
},
|
|
67
|
+
}, getErrorMessagesProp()));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Em caso de alteração na propriedade displayName deverá ser atualizada a lógica na função
|
|
@@ -4,9 +4,12 @@ import 'react';
|
|
|
4
4
|
import '../../@types/PermissionAttr.js';
|
|
5
5
|
import '../../@types/DataCombo.js';
|
|
6
6
|
import '../base/types.js';
|
|
7
|
+
import '../../@types/Align.js';
|
|
7
8
|
import '../../@types/Period.js';
|
|
8
9
|
import '../../drawer/types.js';
|
|
9
10
|
import '../../@types/Position.js';
|
|
11
|
+
import '../../@types/Icon.js';
|
|
12
|
+
import '../../icons/helper.js';
|
|
10
13
|
|
|
11
14
|
declare function extractNonMaskProps(props: IMaskHOCProps, maskProps: AnyMaskedOptions): any;
|
|
12
15
|
declare function CPFValidation(cpf?: string, returnMessage?: (msg: string) => void): void | "CPF inválido";
|
|
@@ -7,7 +7,7 @@ exports.CNPJValidation = CNPJValidation;
|
|
|
7
7
|
exports.CPFValidation = CPFValidation;
|
|
8
8
|
exports.extractNonMaskProps = extractNonMaskProps;
|
|
9
9
|
var _lodash = require("lodash");
|
|
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); }
|
|
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); } /* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
11
|
/* eslint-disable no-plusplus */
|
|
12
12
|
function extractNonMaskProps(props, maskProps) {
|
|
13
13
|
var nonMask = _extends({}, props);
|
|
@@ -3,9 +3,12 @@ import { IMaskHOCProps } from '../types.js';
|
|
|
3
3
|
import '../../@types/PermissionAttr.js';
|
|
4
4
|
import '../../@types/DataCombo.js';
|
|
5
5
|
import '../base/types.js';
|
|
6
|
+
import '../../@types/Align.js';
|
|
6
7
|
import '../../@types/Period.js';
|
|
7
8
|
import '../../drawer/types.js';
|
|
8
9
|
import '../../@types/Position.js';
|
|
10
|
+
import '../../@types/Icon.js';
|
|
11
|
+
import '../../icons/helper.js';
|
|
9
12
|
|
|
10
13
|
declare const IMaskHOC: <ComponentProps extends IMaskHOCProps>(ComposedComponent: React__default.ComponentType<ComponentProps>) => {
|
|
11
14
|
(props: ComponentProps): JSX.Element;
|
|
@@ -9,7 +9,6 @@ var _imask = _interopRequireDefault(require("imask"));
|
|
|
9
9
|
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
10
10
|
var _permissionValidations = require("../../permissionValidations");
|
|
11
11
|
var _format_number = require("../number/format_number");
|
|
12
|
-
var _this = void 0;
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
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); }
|
|
15
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; }
|
|
@@ -63,7 +62,7 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
63
62
|
_props$isDateField = props.isDateField,
|
|
64
63
|
isDateField = _props$isDateField === void 0 ? false : _props$isDateField;
|
|
65
64
|
var maskOptions = {
|
|
66
|
-
placeholderChar: placeholderChar,
|
|
65
|
+
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
67
66
|
lazy: lazy,
|
|
68
67
|
pattern: pattern,
|
|
69
68
|
radix: radix,
|
|
@@ -100,7 +99,7 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
100
99
|
maskRef.current.value = String(newValue);
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
|
-
var onAccept = function
|
|
102
|
+
var onAccept = (0, _react.useCallback)(function () {
|
|
104
103
|
if (onChange && !disableCallbacks && maskRef.current) {
|
|
105
104
|
var _maskRef$current = maskRef.current,
|
|
106
105
|
unmaskedValue = _maskRef$current.unmaskedValue,
|
|
@@ -113,8 +112,8 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
113
112
|
}
|
|
114
113
|
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
115
114
|
}
|
|
116
|
-
};
|
|
117
|
-
var onComplete = function
|
|
115
|
+
}, [onChange]);
|
|
116
|
+
var onComplete = (0, _react.useCallback)(function () {
|
|
118
117
|
if (props.onComplete && !disableCallbacks && maskRef.current) {
|
|
119
118
|
var _maskRef$current2 = maskRef.current,
|
|
120
119
|
unmaskedValue = _maskRef$current2.unmaskedValue,
|
|
@@ -127,13 +126,14 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
127
126
|
}
|
|
128
127
|
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
129
128
|
}
|
|
130
|
-
};
|
|
129
|
+
}, [props.onComplete]);
|
|
131
130
|
var getMask = function getMask() {
|
|
132
131
|
var element = elementRef.current;
|
|
133
132
|
if (element) {
|
|
134
133
|
var maskCurrent = maskRef.current;
|
|
135
134
|
if (!maskCurrent) {
|
|
136
|
-
maskRef.current = (0, _imask.default)(element, maskOptions)
|
|
135
|
+
maskRef.current = (0, _imask.default)(element, maskOptions);
|
|
136
|
+
if (value && typeof value !== 'number' && value.trim() !== '' || value && typeof value === 'number') onAccept();
|
|
137
137
|
setValue(value);
|
|
138
138
|
} else {
|
|
139
139
|
maskCurrent.updateOptions(maskOptions);
|
|
@@ -150,14 +150,19 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
150
150
|
if (props.handlerSetOnDenied) props.handlerSetOnDenied(onDenied);
|
|
151
151
|
if (!props.mask || dontInitMask) return;
|
|
152
152
|
getMask();
|
|
153
|
+
}, [maskOptions]);
|
|
154
|
+
(0, _react.useEffect)(function () {
|
|
155
|
+
if (!maskRef.current) return;
|
|
156
|
+
var maskCurrent = maskRef.current;
|
|
157
|
+
maskCurrent.on('accept', onAccept);
|
|
158
|
+
maskCurrent.on('complete', onComplete);
|
|
153
159
|
|
|
154
160
|
// eslint-disable-next-line consistent-return
|
|
155
161
|
return function () {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
(_maskRef$current4 = maskRef.current) === null || _maskRef$current4 === void 0 ? void 0 : _maskRef$current4.off('complete', onComplete);
|
|
162
|
+
maskCurrent.off('accept', onAccept);
|
|
163
|
+
maskCurrent.off('complete', onComplete);
|
|
159
164
|
};
|
|
160
|
-
}, [
|
|
165
|
+
}, [onAccept, onComplete]);
|
|
161
166
|
(0, _react.useEffect)(function () {
|
|
162
167
|
if (maskOptions.mask && !dontInitMask) {
|
|
163
168
|
if (maskRef.current) {
|
|
@@ -182,7 +187,6 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
182
187
|
},
|
|
183
188
|
inputRef: function inputRef(el) {
|
|
184
189
|
elementRef.current = el;
|
|
185
|
-
// Propagate the input ref for who call it
|
|
186
190
|
if (_inputRef) {
|
|
187
191
|
if (_typeof(_inputRef) === 'object') _inputRef.current = el;else _inputRef(el);
|
|
188
192
|
}
|
|
@@ -5,6 +5,7 @@ export { default as PhoneField } from './Phone.js';
|
|
|
5
5
|
export { default as ZipCodeField } from './ZipCode.js';
|
|
6
6
|
import './types.js';
|
|
7
7
|
import 'react';
|
|
8
|
+
import '../../@types/Align.js';
|
|
8
9
|
import '../../@types/PermissionAttr.js';
|
|
9
10
|
import '../base/types.js';
|
|
10
11
|
import '../../@types/Period.js';
|