linear-react-components-ui 1.1.14-beta.0 → 1.1.14-beta.1
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 +45 -77
- package/.gitlab-ci.yml +13 -5
- package/.nvmrc +1 -0
- package/.vscode/settings.json +12 -3
- package/babel.config.json +4 -4
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/alerts/AlertContainer.js +48 -57
- package/lib/alerts/AlertProvider.js +36 -54
- package/lib/alerts/BaseAlert.js +12 -19
- package/lib/alerts/Message.d.ts +1 -1
- package/lib/alerts/Message.js +78 -45
- package/lib/alerts/helpers.js +2 -3
- package/lib/alerts/index.js +3 -4
- package/lib/alerts/types.d.ts +1 -0
- package/lib/alerts/withAlert.js +10 -11
- package/lib/assets/styles/alerts.scss +4 -7
- package/lib/assets/styles/button.scss +11 -9
- package/lib/assets/styles/checkbox.scss +45 -38
- package/lib/assets/styles/colors.scss +3 -1
- package/lib/assets/styles/commons.scss +1 -0
- package/lib/assets/styles/dialog.scss +37 -20
- package/lib/assets/styles/drawers.scss +9 -6
- package/lib/assets/styles/error.scss +9 -0
- package/lib/assets/styles/fieldset.scss +3 -0
- package/lib/assets/styles/gridlayout.scss +0 -2
- package/lib/assets/styles/hint.scss +21 -0
- package/lib/assets/styles/icon.scss +31 -4
- package/lib/assets/styles/input.scss +7 -7
- package/lib/assets/styles/multiSelect.scss +6 -1
- package/lib/assets/styles/radio.scss +37 -35
- package/lib/assets/styles/select.scss +13 -7
- package/lib/assets/styles/table.scss +9 -1
- package/lib/assets/styles/tabs.scss +28 -18
- package/lib/assets/styles/textContent.scss +9 -0
- package/lib/avatar/index.js +41 -41
- package/lib/badge/index.js +12 -14
- package/lib/buttons/ActivateButton.js +6 -9
- package/lib/buttons/AddButton.js +9 -12
- package/lib/buttons/Button.js +11 -12
- package/lib/buttons/ButtonGroups.js +6 -5
- package/lib/buttons/CancelButton.js +10 -9
- package/lib/buttons/DangerButton.js +10 -9
- package/lib/buttons/DefaultButton.js +90 -90
- package/lib/buttons/DestroyButton.js +10 -9
- package/lib/buttons/EditButton.js +6 -9
- package/lib/buttons/InactivateButton.js +6 -9
- package/lib/buttons/InfoButton.js +10 -9
- package/lib/buttons/PrimaryButton.js +10 -9
- package/lib/buttons/RestoreButton.js +6 -9
- package/lib/buttons/SaveButton.js +10 -9
- package/lib/buttons/SuccessButton.js +10 -9
- package/lib/buttons/WarningButton.js +10 -9
- package/lib/buttons/button_container/index.js +17 -21
- package/lib/buttons/index.js +16 -17
- package/lib/buttons/split_button/index.js +22 -25
- package/lib/buttons/types.d.ts +1 -0
- package/lib/calendar/DangerCalendar.js +10 -9
- package/lib/calendar/InfoCalendar.js +10 -9
- package/lib/calendar/PrimaryCalendar.js +10 -9
- package/lib/calendar/SuccessCalendar.js +10 -9
- package/lib/calendar/WarningCalendar.js +10 -9
- package/lib/calendar/base/Day.js +13 -12
- package/lib/calendar/base/Month.js +13 -18
- package/lib/calendar/base/Week.js +13 -18
- package/lib/calendar/base/helpers.js +12 -12
- package/lib/calendar/base/index.js +30 -44
- package/lib/calendar/index.js +7 -8
- package/lib/checkbox/Label.js +20 -10
- package/lib/checkbox/index.d.ts +2 -2
- package/lib/checkbox/index.js +83 -97
- package/lib/checkbox/types.d.ts +2 -1
- package/lib/dialog/Alert.js +5 -6
- package/lib/dialog/Custom.js +16 -18
- package/lib/dialog/Error.js +5 -6
- package/lib/dialog/Information.js +5 -6
- package/lib/dialog/Question.js +13 -14
- package/lib/dialog/Warning.js +7 -7
- package/lib/dialog/base/Content.js +8 -6
- package/lib/dialog/base/Footer.js +5 -8
- package/lib/dialog/base/Header.js +29 -29
- package/lib/dialog/base/index.d.ts +8 -2
- package/lib/dialog/base/index.js +109 -105
- package/lib/dialog/base/style.js +7 -10
- package/lib/dialog/form/index.js +31 -34
- package/lib/dialog/index.js +8 -9
- package/lib/dialog/types.d.ts +8 -13
- package/lib/drawer/Content.js +12 -11
- package/lib/drawer/Drawer.js +74 -88
- package/lib/drawer/Header.js +34 -37
- package/lib/drawer/helpers.js +3 -4
- package/lib/drawer/index.js +4 -5
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +41 -42
- package/lib/dropdown/helper.js +3 -5
- package/lib/dropdown/types.d.ts +1 -0
- package/lib/dropdown/withDropdown.js +39 -60
- package/lib/fieldset/index.js +52 -58
- package/lib/fieldset/types.d.ts +2 -0
- package/lib/form/Field.d.ts +2 -0
- package/lib/form/Field.js +73 -79
- package/lib/form/FieldArray.d.ts +2 -0
- package/lib/form/FieldArray.js +70 -94
- package/lib/form/FieldNumber.d.ts +2 -0
- package/lib/form/FieldNumber.js +39 -48
- package/lib/form/FieldPeriod.d.ts +2 -0
- package/lib/form/FieldPeriod.js +48 -54
- package/lib/form/helpers.d.ts +2 -0
- package/lib/form/helpers.js +22 -27
- package/lib/form/index.d.ts +2 -0
- package/lib/form/index.js +114 -146
- package/lib/form/types.d.ts +6 -2
- package/lib/form/withFieldHOC.d.ts +2 -0
- package/lib/form/withFieldHOC.js +32 -39
- package/lib/form/withFormSecurity.d.ts +2 -0
- package/lib/form/withFormSecurity.js +27 -35
- package/lib/gridlayout/GridCol.js +14 -14
- package/lib/gridlayout/GridRow.js +18 -12
- package/lib/gridlayout/index.js +3 -4
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/helpers.d.ts +3 -0
- package/lib/hint/helpers.js +21 -0
- package/lib/hint/index.d.ts +2 -1
- package/lib/hint/index.js +18 -29
- package/lib/hint/types.d.ts +3 -0
- package/lib/icons/helper.d.ts +4 -0
- package/lib/icons/helper.js +7 -4
- package/lib/icons/index.d.ts +3 -2
- package/lib/icons/index.js +43 -48
- package/lib/icons/types.d.ts +22 -9
- package/lib/index.d.ts +2 -1
- package/lib/index.js +10 -10
- package/lib/inputs/base/InputTextBase.d.ts +2 -0
- package/lib/inputs/base/InputTextBase.js +149 -113
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +3 -2
- package/lib/inputs/base/helpers.js +21 -26
- package/lib/inputs/base/types.d.ts +17 -2
- package/lib/inputs/color/index.js +29 -40
- package/lib/inputs/date/Dialog.d.ts +2 -0
- package/lib/inputs/date/Dialog.js +9 -10
- package/lib/inputs/date/Dropdown.d.ts +2 -0
- package/lib/inputs/date/Dropdown.js +12 -11
- package/lib/inputs/date/helpers.d.ts +2 -0
- package/lib/inputs/date/helpers.js +14 -14
- package/lib/inputs/date/index.d.ts +2 -0
- package/lib/inputs/date/index.js +127 -152
- package/lib/inputs/date/types.d.ts +4 -1
- package/lib/inputs/{mask/imaskHOC.d.ts → errorMessage/index.d.ts} +5 -7
- package/lib/inputs/errorMessage/index.js +26 -0
- package/lib/inputs/file/DefaultFile.d.ts +2 -0
- package/lib/inputs/file/DefaultFile.js +47 -74
- package/lib/inputs/file/DragDropFile.d.ts +2 -0
- package/lib/inputs/file/DragDropFile.js +97 -149
- package/lib/inputs/file/File.d.ts +3 -1
- package/lib/inputs/file/File.js +26 -32
- package/lib/inputs/file/FileButtonSettings.d.ts +2 -0
- package/lib/inputs/file/FileButtonSettings.js +13 -13
- package/lib/inputs/file/helpers.d.ts +2 -0
- package/lib/inputs/file/helpers.js +4 -6
- package/lib/inputs/file/index.d.ts +2 -0
- package/lib/inputs/file/index.js +4 -5
- package/lib/inputs/file/types.d.ts +2 -0
- package/lib/inputs/inputHOC.d.ts +2 -1
- package/lib/inputs/inputHOC.js +21 -34
- package/lib/inputs/mask/BaseMask.d.ts +4 -5
- package/lib/inputs/mask/BaseMask.js +125 -37
- package/lib/inputs/mask/Cnpj.d.ts +2 -0
- package/lib/inputs/mask/Cnpj.js +18 -31
- package/lib/inputs/mask/Cpf.d.ts +2 -0
- package/lib/inputs/mask/Cpf.js +20 -37
- package/lib/inputs/mask/Phone.d.ts +2 -0
- package/lib/inputs/mask/Phone.js +7 -6
- package/lib/inputs/mask/ZipCode.d.ts +2 -0
- package/lib/inputs/mask/ZipCode.js +6 -9
- package/lib/inputs/mask/helpers.d.ts +50 -12
- package/lib/inputs/mask/helpers.js +77 -37
- package/lib/inputs/mask/index.d.ts +4 -2
- package/lib/inputs/mask/index.js +6 -7
- package/lib/inputs/mask/types.d.ts +18 -17
- package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -0
- package/lib/inputs/multiSelect/ActionButtons.js +23 -22
- package/lib/inputs/multiSelect/Dropdown.d.ts +2 -0
- package/lib/inputs/multiSelect/Dropdown.js +50 -67
- package/lib/inputs/multiSelect/helper.d.ts +2 -0
- package/lib/inputs/multiSelect/helper.js +8 -7
- package/lib/inputs/multiSelect/index.d.ts +2 -0
- package/lib/inputs/multiSelect/index.js +83 -135
- package/lib/inputs/multiSelect/types.d.ts +2 -0
- package/lib/inputs/number/BaseNumber.d.ts +2 -1
- package/lib/inputs/number/BaseNumber.js +25 -24
- package/lib/inputs/number/Currency.d.ts +2 -1
- package/lib/inputs/number/Currency.js +8 -8
- package/lib/inputs/number/Decimal.d.ts +2 -1
- package/lib/inputs/number/Decimal.js +3 -6
- package/lib/inputs/number/format_number.js +5 -5
- package/lib/inputs/number/index.d.ts +2 -1
- package/lib/inputs/number/index.js +20 -32
- package/lib/inputs/number/types.d.ts +2 -9
- package/lib/inputs/period/Dialog.d.ts +3 -1
- package/lib/inputs/period/Dialog.js +9 -10
- package/lib/inputs/period/Dropdown.d.ts +2 -0
- package/lib/inputs/period/Dropdown.js +8 -9
- package/lib/inputs/period/PeriodList.d.ts +2 -0
- package/lib/inputs/period/PeriodList.js +14 -13
- package/lib/inputs/period/helper.d.ts +2 -0
- package/lib/inputs/period/helper.js +34 -37
- package/lib/inputs/period/index.d.ts +2 -0
- package/lib/inputs/period/index.js +162 -196
- package/lib/inputs/period/types.d.ts +3 -1
- package/lib/inputs/search/index.d.ts +2 -1
- package/lib/inputs/search/index.js +45 -68
- package/lib/inputs/select/ActionButtons.d.ts +2 -1
- package/lib/inputs/select/ActionButtons.js +25 -35
- package/lib/inputs/select/Dropdown.d.ts +2 -1
- package/lib/inputs/select/Dropdown.js +41 -60
- package/lib/inputs/select/helper.d.ts +2 -1
- package/lib/inputs/select/helper.js +49 -43
- package/lib/inputs/select/index.d.ts +2 -0
- package/lib/inputs/select/index.js +13 -12
- package/lib/inputs/select/multiple/Selecteds.d.ts +3 -1
- package/lib/inputs/select/multiple/Selecteds.js +17 -22
- package/lib/inputs/select/multiple/index.d.ts +2 -0
- package/lib/inputs/select/multiple/index.js +125 -162
- package/lib/inputs/select/simple/index.d.ts +2 -0
- package/lib/inputs/select/simple/index.js +154 -179
- package/lib/inputs/select/types.d.ts +5 -2
- package/lib/inputs/text/index.js +3 -6
- package/lib/inputs/textarea/index.d.ts +2 -0
- package/lib/inputs/textarea/index.js +10 -10
- package/lib/inputs/textarea/types.d.ts +2 -0
- package/lib/inputs/types.d.ts +12 -9
- package/lib/internals/colorStyles.js +2 -3
- package/lib/internals/constants.js +2 -4
- package/lib/internals/types.d.ts +5 -2
- package/lib/internals/withTooltip.d.ts +3 -2
- package/lib/internals/withTooltip.js +76 -76
- package/lib/labelMessages/index.js +22 -42
- package/lib/labels/DangerLabel.js +10 -9
- package/lib/labels/DefaultLabel.js +26 -40
- package/lib/labels/InfoLabel.js +10 -9
- package/lib/labels/PrimaryLabel.js +10 -9
- package/lib/labels/SuccessLabel.js +10 -9
- package/lib/labels/WarningLabel.js +10 -9
- package/lib/labels/index.js +8 -9
- package/lib/labels/label_container/index.js +8 -8
- package/lib/list/Header.js +9 -8
- package/lib/list/Item.js +74 -70
- package/lib/list/Separator.js +5 -8
- package/lib/list/helpers.js +4 -6
- package/lib/list/index.js +74 -101
- package/lib/menus/float/MenuItem.js +19 -20
- package/lib/menus/float/SubMenuContainer.js +27 -33
- package/lib/menus/float/helpers.js +3 -4
- package/lib/menus/float/index.js +17 -18
- package/lib/menus/float/types.d.ts +1 -1
- package/lib/menus/index.js +2 -3
- package/lib/menus/sidenav/ExpandMenu.js +9 -8
- package/lib/menus/sidenav/MenuLink.js +10 -9
- package/lib/menus/sidenav/NavMenuGroup.js +12 -11
- package/lib/menus/sidenav/NavMenuItem.js +48 -62
- package/lib/menus/sidenav/NavSubMenuItem.js +20 -25
- package/lib/menus/sidenav/helpers.js +6 -9
- package/lib/menus/sidenav/index.js +85 -113
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +7 -7
- package/lib/menus/sidenav/popup_menu_search/index.js +64 -84
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/noPermission/index.js +14 -17
- package/lib/panel/Content.d.ts +1 -1
- package/lib/panel/Content.js +47 -60
- package/lib/panel/DangerPanel.d.ts +1 -1
- package/lib/panel/DangerPanel.js +6 -9
- package/lib/panel/Default.d.ts +1 -1
- package/lib/panel/Default.js +45 -60
- package/lib/panel/Header.d.ts +1 -1
- package/lib/panel/Header.js +32 -30
- package/lib/panel/InfoPanel.d.ts +1 -1
- package/lib/panel/InfoPanel.js +6 -9
- package/lib/panel/PrimaryPanel.d.ts +1 -1
- package/lib/panel/PrimaryPanel.js +6 -9
- package/lib/panel/SuccessPanel.d.ts +1 -1
- package/lib/panel/SuccessPanel.js +6 -9
- package/lib/panel/ToolBar.d.ts +1 -1
- package/lib/panel/ToolBar.js +6 -5
- package/lib/panel/WarningPanel.d.ts +1 -1
- package/lib/panel/WarningPanel.js +6 -9
- package/lib/panel/helpers.d.ts +7 -2
- package/lib/panel/helpers.js +12 -24
- package/lib/panel/index.d.ts +1 -1
- package/lib/panel/index.js +9 -10
- package/lib/panel/types.d.ts +46 -5
- package/lib/permissionValidations.js +24 -29
- package/lib/popover/PopoverText.js +6 -5
- package/lib/popover/PopoverTitle.js +6 -5
- package/lib/popover/index.js +15 -19
- package/lib/progress/Bar.js +31 -37
- package/lib/progress/index.js +18 -20
- package/lib/radio/index.js +36 -57
- package/lib/shortcuts/index.js +10 -9
- package/lib/skeleton/SkeletonContainer.js +10 -11
- package/lib/skeleton/index.js +27 -34
- package/lib/spinner/SpinnerLoading.js +7 -8
- package/lib/spinner/index.js +23 -37
- package/lib/split/Split.js +95 -112
- package/lib/split/SplitSide.js +20 -19
- package/lib/split/helpers.js +3 -4
- package/lib/split/index.js +3 -4
- package/lib/table/Body.js +42 -45
- package/lib/table/Header.js +29 -32
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +35 -22
- package/lib/table/Row.js +45 -48
- package/lib/table/RowColumn.js +38 -39
- package/lib/table/helpers.js +7 -13
- package/lib/table/index.js +82 -102
- package/lib/table/types.d.ts +3 -0
- package/lib/tabs/DropdownTabs.d.ts +11 -0
- package/lib/tabs/DropdownTabs.js +71 -0
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +35 -23
- package/lib/tabs/{DropdownItems.d.ts → MenuTabs.d.ts} +3 -3
- package/lib/tabs/MenuTabs.js +82 -0
- package/lib/tabs/Panel.d.ts +1 -1
- package/lib/tabs/Panel.js +70 -66
- package/lib/tabs/context.d.ts +12 -0
- package/lib/tabs/context.js +130 -0
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +46 -225
- package/lib/tabs/tabHelpers.d.ts +4 -15
- package/lib/tabs/tabHelpers.js +37 -42
- package/lib/tabs/types.d.ts +48 -15
- package/lib/tabs/useTabs.d.ts +11 -0
- package/lib/tabs/useTabs.js +11 -0
- package/lib/textContent/index.d.ts +8 -0
- package/lib/textContent/index.js +30 -0
- package/lib/toolbar/ButtonBar.js +39 -43
- package/lib/toolbar/LabelBar.js +36 -40
- package/lib/toolbar/Separator.js +5 -8
- package/lib/toolbar/ToolBarGroup.js +7 -7
- package/lib/toolbar/helpers.js +2 -3
- package/lib/toolbar/index.js +23 -25
- package/lib/toolbar/types.d.ts +1 -0
- package/lib/tooltip/index.js +28 -33
- package/lib/treetable/Body.js +21 -33
- package/lib/treetable/Header.js +11 -14
- package/lib/treetable/Row.js +90 -142
- package/lib/treetable/helpers.js +15 -24
- package/lib/treetable/index.js +11 -13
- package/lib/treeview/Header.js +8 -7
- package/lib/treeview/Node.js +96 -136
- package/lib/treeview/constants.js +2 -3
- package/lib/treeview/index.js +150 -216
- package/lib/uitour/helpers.js +4 -7
- package/lib/uitour/index.d.ts +2 -1
- package/lib/uitour/index.js +113 -100
- package/lib/uitour/types.d.ts +9 -1
- package/package.json +77 -82
- package/tsconfig.json +1 -0
- package/.tool-versions +0 -1
- package/lib/inputs/mask/imaskHOC.js +0 -224
- package/lib/tabs/DropdownItems.js +0 -65
- package/lib/tabs/MenuItems.d.ts +0 -11
- package/lib/tabs/MenuItems.js +0 -76
- package/lib/treeview_old/Header.js +0 -28
- package/lib/treeview_old/Node.js +0 -88
- package/lib/treeview_old/index.js +0 -42
- package/lib/types-c2a0f035.d.ts +0 -50
package/lib/form/Field.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -9,61 +8,58 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
9
|
var _withFieldHOC = _interopRequireDefault(require("./withFieldHOC"));
|
|
11
10
|
var _helpers = require("./helpers");
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
16
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
17
|
-
function ownKeys(
|
|
18
|
-
function _objectSpread(
|
|
19
|
-
function _defineProperty(
|
|
20
|
-
function _toPropertyKey(
|
|
21
|
-
function _toPrimitive(
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
handlerFieldChange = _ref.handlerFieldChange,
|
|
38
|
-
_onChange = _ref.onChange,
|
|
39
|
-
handleShowValidateMessages = _ref.handleShowValidateMessages;
|
|
40
|
-
if (!(validators || validatorFromComponent || _onBlur || _onChange)) return {};
|
|
41
|
-
var validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
|
|
11
|
+
const _excluded = ["handlerFieldChange", "handlerFieldValidade", "onChange", "onBlur", "name", "validators", "data", "fieldErrors", "handlerStoreValidators", "handlerRemoveValidators", "component", "externalFieldErrors", "originalData"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
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; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
22
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
23
|
+
const getEvents = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
validators = [],
|
|
26
|
+
name,
|
|
27
|
+
onBlur,
|
|
28
|
+
handlerFieldValidade,
|
|
29
|
+
validatorFromComponent,
|
|
30
|
+
handlerFieldChange,
|
|
31
|
+
onChange,
|
|
32
|
+
handleShowValidateMessages
|
|
33
|
+
} = _ref;
|
|
34
|
+
if (!(validators || validatorFromComponent || onBlur || onChange)) return {};
|
|
35
|
+
const validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
|
|
42
36
|
return {
|
|
43
|
-
onBlur:
|
|
37
|
+
onBlur: e => {
|
|
44
38
|
if (validatorsArray && e.target && handlerFieldValidade) {
|
|
45
39
|
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
46
40
|
handleShowValidateMessages(true);
|
|
47
41
|
}
|
|
48
|
-
if (
|
|
42
|
+
if (onBlur) onBlur(e);
|
|
49
43
|
},
|
|
50
|
-
onChange:
|
|
44
|
+
onChange: e => {
|
|
51
45
|
if (validatorsArray && e.target && handlerFieldValidade) {
|
|
52
46
|
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
53
47
|
handleShowValidateMessages(true);
|
|
54
48
|
}
|
|
55
49
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
56
|
-
if (
|
|
50
|
+
if (onChange) onChange(e);
|
|
57
51
|
}
|
|
58
52
|
};
|
|
59
53
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
const getCustomProps = (props, handlerSetComponentValidator) => {
|
|
55
|
+
const {
|
|
56
|
+
value,
|
|
57
|
+
data,
|
|
58
|
+
name,
|
|
59
|
+
fieldId,
|
|
60
|
+
componentType,
|
|
61
|
+
component
|
|
62
|
+
} = props;
|
|
67
63
|
if (componentType && componentType.toLowerCase() === 'radio') {
|
|
68
64
|
return {
|
|
69
65
|
checked: _lodash.default.get(data, name) === value,
|
|
@@ -77,38 +73,38 @@ var getCustomProps = function getCustomProps(props, handlerSetComponentValidator
|
|
|
77
73
|
} else if (component.displayName === 'CpfField' || component.displayName === 'CnpjField') {
|
|
78
74
|
return {
|
|
79
75
|
value: _lodash.default.get(data, name),
|
|
80
|
-
handlerSetComponentValidator
|
|
76
|
+
handlerSetComponentValidator
|
|
81
77
|
};
|
|
82
78
|
}
|
|
83
79
|
return {
|
|
84
80
|
value: _lodash.default.get(data, name)
|
|
85
81
|
};
|
|
86
82
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
const Field = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
84
|
+
const {
|
|
85
|
+
handlerFieldChange,
|
|
86
|
+
handlerFieldValidade,
|
|
87
|
+
onChange,
|
|
88
|
+
onBlur,
|
|
89
|
+
name,
|
|
90
|
+
validators,
|
|
91
|
+
data,
|
|
92
|
+
fieldErrors,
|
|
93
|
+
handlerStoreValidators,
|
|
94
|
+
handlerRemoveValidators,
|
|
95
|
+
component: Component,
|
|
96
|
+
externalFieldErrors,
|
|
97
|
+
originalData
|
|
98
|
+
} = props,
|
|
101
99
|
rest = _objectWithoutProperties(props, _excluded);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var originalValue = _lodash.default.get(originalData, name);
|
|
111
|
-
(0, _react.useEffect)(function () {
|
|
100
|
+
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
101
|
+
const {
|
|
102
|
+
handlerSetValidatorFromComponent,
|
|
103
|
+
validatorFromComponent
|
|
104
|
+
} = (0, _react.useContext)(_helpers.withFieldContext);
|
|
105
|
+
const currentValue = _lodash.default.get(data, name);
|
|
106
|
+
const originalValue = _lodash.default.get(originalData, name);
|
|
107
|
+
(0, _react.useEffect)(() => {
|
|
112
108
|
if (currentValue && currentValue !== originalValue && (!!currentValue || currentValue === 0 || Array.isArray(currentValue) && currentValue.length > 0)) {
|
|
113
109
|
setShowValidateMessages(true);
|
|
114
110
|
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || currentValue === originalValue) {
|
|
@@ -116,16 +112,14 @@ var Field = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
116
112
|
}
|
|
117
113
|
}, [currentValue, originalValue]);
|
|
118
114
|
return /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getEvents({
|
|
119
|
-
name
|
|
120
|
-
validators
|
|
121
|
-
onBlur
|
|
122
|
-
validatorFromComponent
|
|
123
|
-
handlerFieldValidade
|
|
124
|
-
handlerFieldChange
|
|
125
|
-
onChange
|
|
126
|
-
handleShowValidateMessages:
|
|
127
|
-
return setShowValidateMessages(value);
|
|
128
|
-
}
|
|
115
|
+
name,
|
|
116
|
+
validators,
|
|
117
|
+
onBlur,
|
|
118
|
+
validatorFromComponent,
|
|
119
|
+
handlerFieldValidade,
|
|
120
|
+
handlerFieldChange,
|
|
121
|
+
onChange,
|
|
122
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
129
123
|
}), getCustomProps(props, handlerSetValidatorFromComponent), {
|
|
130
124
|
ref: ref,
|
|
131
125
|
name: name,
|
|
@@ -134,5 +128,5 @@ var Field = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
134
128
|
}))
|
|
135
129
|
}));
|
|
136
130
|
});
|
|
137
|
-
|
|
138
|
-
exports.default =
|
|
131
|
+
Field.displayName = 'Field';
|
|
132
|
+
var _default = exports.default = (0, _withFieldHOC.default)(Field);
|
package/lib/form/FieldArray.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import '../@types/DataCombo.js';
|
|
|
6
6
|
import '../@types/PermissionAttr.js';
|
|
7
7
|
import '../inputs/base/types.js';
|
|
8
8
|
import '../@types/Period.js';
|
|
9
|
+
import '../internals/types.js';
|
|
10
|
+
import '../@types/Position.js';
|
|
9
11
|
|
|
10
12
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldArrayProps & React__default.RefAttributes<HTMLElement>>;
|
|
11
13
|
|
package/lib/form/FieldArray.js
CHANGED
|
@@ -10,99 +10,84 @@ var _withFieldHOC = _interopRequireDefault(require("./withFieldHOC"));
|
|
|
10
10
|
var _gridlayout = _interopRequireDefault(require("../gridlayout"));
|
|
11
11
|
var _fieldset = _interopRequireDefault(require("../fieldset"));
|
|
12
12
|
var _helpers = require("./helpers");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
19
|
-
function ownKeys(
|
|
20
|
-
function _objectSpread(
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_props$changePropName = props.changePropName,
|
|
37
|
-
changePropName = _props$changePropName === void 0 ? 'onSelect' : _props$changePropName,
|
|
38
|
-
data = props.data,
|
|
39
|
-
name = props.name,
|
|
40
|
-
handlerFieldChange = props.handlerFieldChange,
|
|
41
|
-
handlerSelecionados = props.handlerSelecionados,
|
|
42
|
-
_onBlur = props.onBlur;
|
|
43
|
-
return _ref = {
|
|
44
|
-
onBlur: function onBlur(e) {
|
|
45
|
-
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
46
|
-
if (_onBlur) _onBlur(e);
|
|
47
|
-
}
|
|
48
|
-
}, _defineProperty(_ref, valuePropName, _lodash.default.get(data, name)), _defineProperty(_ref, changePropName, function (ids) {
|
|
49
|
-
if (handlerFieldChange) handlerFieldChange({
|
|
50
|
-
target: {
|
|
51
|
-
value: ids,
|
|
52
|
-
name: name
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
if (handlerSelecionados) handlerSelecionados(ids);
|
|
56
|
-
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
57
|
-
}), _ref;
|
|
58
|
-
};
|
|
59
|
-
var getEvents = function getEvents(_ref2) {
|
|
60
|
-
var _onBlur2 = _ref2.onBlur,
|
|
61
|
-
handleShowValidateMessages = _ref2.handleShowValidateMessages;
|
|
13
|
+
const _excluded = ["cols", "label", "bordered", "labelContainerStyle", "skipLabel", "data", "name", "handlerStoreValidators", "component", "handlerFieldChange", "handlerFieldValidade", "changePropName", "fieldErrors", "externalMessagesErrors", "handlerRemoveValidators", "validators", "valuePropName", "originalData", "handlerSelecionados"];
|
|
14
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
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; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
26
|
+
const getDefaultProps = (props, handleShowValidateMessages) => {
|
|
27
|
+
const {
|
|
28
|
+
valuePropName = 'value',
|
|
29
|
+
changePropName = 'onSelect',
|
|
30
|
+
data,
|
|
31
|
+
name,
|
|
32
|
+
handlerFieldChange,
|
|
33
|
+
handlerSelecionados,
|
|
34
|
+
onBlur
|
|
35
|
+
} = props;
|
|
62
36
|
return {
|
|
63
|
-
onBlur:
|
|
64
|
-
handleShowValidateMessages(true);
|
|
65
|
-
if (
|
|
66
|
-
}
|
|
37
|
+
onBlur: (0, _react.useCallback)(e => {
|
|
38
|
+
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
39
|
+
if (onBlur) onBlur(e);
|
|
40
|
+
}, [handleShowValidateMessages, onBlur]),
|
|
41
|
+
[valuePropName]: _lodash.default.get(data, name),
|
|
42
|
+
[changePropName]: (0, _react.useCallback)(ids => {
|
|
43
|
+
if (handlerFieldChange) handlerFieldChange({
|
|
44
|
+
target: {
|
|
45
|
+
value: ids,
|
|
46
|
+
name
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (handlerSelecionados) handlerSelecionados(ids);
|
|
50
|
+
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
51
|
+
}, [handlerFieldChange, handlerSelecionados, handleShowValidateMessages, changePropName])
|
|
67
52
|
};
|
|
68
53
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
const FieldArray = props => {
|
|
55
|
+
const {
|
|
56
|
+
cols,
|
|
57
|
+
label,
|
|
58
|
+
bordered,
|
|
59
|
+
labelContainerStyle,
|
|
60
|
+
skipLabel,
|
|
61
|
+
data,
|
|
62
|
+
name,
|
|
63
|
+
handlerStoreValidators,
|
|
64
|
+
component: Component,
|
|
65
|
+
handlerFieldChange,
|
|
66
|
+
handlerFieldValidade,
|
|
67
|
+
changePropName,
|
|
68
|
+
fieldErrors,
|
|
69
|
+
externalMessagesErrors,
|
|
70
|
+
handlerRemoveValidators,
|
|
71
|
+
validators,
|
|
72
|
+
valuePropName,
|
|
73
|
+
originalData,
|
|
74
|
+
handlerSelecionados
|
|
75
|
+
} = props,
|
|
88
76
|
rest = _objectWithoutProperties(props, _excluded);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var currentValue = _lodash.default.get(data, name);
|
|
94
|
-
var originalValue = _lodash.default.get(originalData, name);
|
|
95
|
-
var handleShowValidateMessages = function handleShowValidateMessages(value) {
|
|
77
|
+
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
78
|
+
const currentValue = _lodash.default.get(data, name);
|
|
79
|
+
const originalValue = _lodash.default.get(originalData, name);
|
|
80
|
+
const handleShowValidateMessages = (0, _react.useCallback)(value => {
|
|
96
81
|
setShowValidateMessages(value);
|
|
97
|
-
};
|
|
98
|
-
(0, _react.useEffect)(
|
|
82
|
+
}, []);
|
|
83
|
+
(0, _react.useEffect)(() => {
|
|
99
84
|
if (!_lodash.default.isEqual(currentValue, originalValue) && Array.isArray(currentValue) && currentValue.length > 0) {
|
|
100
85
|
setShowValidateMessages(true);
|
|
101
86
|
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || _lodash.default.isEqual(currentValue, originalValue)) {
|
|
102
87
|
setShowValidateMessages(false);
|
|
103
88
|
}
|
|
104
89
|
}, [currentValue]);
|
|
105
|
-
|
|
90
|
+
let content = null;
|
|
106
91
|
if (Component) {
|
|
107
92
|
if (!skipLabel && label) {
|
|
108
93
|
content = /*#__PURE__*/_react.default.createElement(_fieldset.default, {
|
|
@@ -110,11 +95,7 @@ var FieldArray = function FieldArray(props) {
|
|
|
110
95
|
customClass: "arraycontainer ".concat(bordered && '-bordered'),
|
|
111
96
|
style: labelContainerStyle,
|
|
112
97
|
titleCustomClass: "label"
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages),
|
|
114
|
-
handleShowValidateMessages: function handleShowValidateMessages(value) {
|
|
115
|
-
return setShowValidateMessages(value);
|
|
116
|
-
}
|
|
117
|
-
})), {
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
118
99
|
label: label,
|
|
119
100
|
name: name,
|
|
120
101
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -122,11 +103,7 @@ var FieldArray = function FieldArray(props) {
|
|
|
122
103
|
}))
|
|
123
104
|
})));
|
|
124
105
|
} else {
|
|
125
|
-
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages),
|
|
126
|
-
handleShowValidateMessages: function handleShowValidateMessages(value) {
|
|
127
|
-
return setShowValidateMessages(value);
|
|
128
|
-
}
|
|
129
|
-
})), {
|
|
106
|
+
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
130
107
|
label: label,
|
|
131
108
|
name: name,
|
|
132
109
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -140,5 +117,4 @@ var FieldArray = function FieldArray(props) {
|
|
|
140
117
|
}, content);
|
|
141
118
|
return content;
|
|
142
119
|
};
|
|
143
|
-
var _default = (0, _withFieldHOC.default)(FieldArray);
|
|
144
|
-
exports.default = _default;
|
|
120
|
+
var _default = exports.default = (0, _withFieldHOC.default)(FieldArray);
|
|
@@ -6,6 +6,8 @@ import '../@types/DataCombo.js';
|
|
|
6
6
|
import '../@types/PermissionAttr.js';
|
|
7
7
|
import '../inputs/base/types.js';
|
|
8
8
|
import '../@types/Period.js';
|
|
9
|
+
import '../internals/types.js';
|
|
10
|
+
import '../@types/Position.js';
|
|
9
11
|
|
|
10
12
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldProps & React__default.RefAttributes<HTMLElement>>;
|
|
11
13
|
|
package/lib/form/FieldNumber.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -10,68 +9,63 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
10
9
|
var _withFieldHOC = _interopRequireDefault(require("./withFieldHOC"));
|
|
11
10
|
var _helpers = require("./helpers");
|
|
12
11
|
var constants = _interopRequireWildcard(require("../internals/constants"));
|
|
13
|
-
function _interopRequireDefault(
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
16
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
17
|
-
function ownKeys(
|
|
18
|
-
function _objectSpread(
|
|
19
|
-
function _defineProperty(
|
|
20
|
-
function _toPropertyKey(
|
|
21
|
-
function _toPrimitive(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
handlerFieldValidade = _ref.handlerFieldValidade,
|
|
35
|
-
handlerFieldChange = _ref.handlerFieldChange,
|
|
36
|
-
handleShowValidateMessages = _ref.handleShowValidateMessages,
|
|
37
|
-
component = _ref.component;
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
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; }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
const getEventProps = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
name,
|
|
24
|
+
validators,
|
|
25
|
+
onBlur,
|
|
26
|
+
onKeyDown,
|
|
27
|
+
onChange,
|
|
28
|
+
handlerFieldValidade,
|
|
29
|
+
handlerFieldChange,
|
|
30
|
+
handleShowValidateMessages,
|
|
31
|
+
component
|
|
32
|
+
} = _ref;
|
|
38
33
|
return {
|
|
39
|
-
onBlur:
|
|
34
|
+
onBlur: e => {
|
|
40
35
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
41
36
|
if (validators && handlerFieldValidade) handlerFieldValidade(name, e.target.value, validators);
|
|
42
|
-
if (
|
|
37
|
+
if (onBlur) onBlur(e);
|
|
43
38
|
handleShowValidateMessages(true);
|
|
44
39
|
},
|
|
45
|
-
onKeyDown:
|
|
40
|
+
onKeyDown: e => {
|
|
46
41
|
if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
|
|
47
42
|
if (validators) handlerFieldValidade === null || handlerFieldValidade === void 0 ? void 0 : handlerFieldValidade(name, e.target.value, validators);
|
|
48
|
-
if (
|
|
43
|
+
if (onKeyDown) onKeyDown(e);
|
|
49
44
|
handleShowValidateMessages(true);
|
|
50
45
|
}
|
|
51
46
|
},
|
|
52
|
-
onChange:
|
|
47
|
+
onChange: e => {
|
|
53
48
|
if ((component === null || component === void 0 ? void 0 : component.name) === 'NumberField') {
|
|
54
49
|
if (validators && e.target && handlerFieldValidade) {
|
|
55
50
|
handlerFieldValidade(name, e.target.value, validators);
|
|
56
51
|
handleShowValidateMessages(true);
|
|
57
52
|
}
|
|
58
53
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
59
|
-
if (
|
|
54
|
+
if (onChange) onChange(e);
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
};
|
|
63
58
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
(0, _react.useEffect)(function () {
|
|
59
|
+
const FieldMask = props => {
|
|
60
|
+
const {
|
|
61
|
+
data,
|
|
62
|
+
name,
|
|
63
|
+
originalData
|
|
64
|
+
} = props;
|
|
65
|
+
const currentValue = _lodash.default.get(data, name);
|
|
66
|
+
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
67
|
+
const originalValue = _lodash.default.get(originalData, name);
|
|
68
|
+
(0, _react.useEffect)(() => {
|
|
75
69
|
if (currentValue && currentValue !== originalValue && !!currentValue) {
|
|
76
70
|
setShowValidateMessages(true);
|
|
77
71
|
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || currentValue === originalValue) {
|
|
@@ -79,9 +73,7 @@ var FieldMask = function FieldMask(props) {
|
|
|
79
73
|
}
|
|
80
74
|
}, [currentValue, originalValue]);
|
|
81
75
|
return /*#__PURE__*/_react.default.createElement(props.component, _extends({}, props, getEventProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
82
|
-
handleShowValidateMessages:
|
|
83
|
-
return setShowValidateMessages(value);
|
|
84
|
-
}
|
|
76
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
85
77
|
})), {
|
|
86
78
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
87
79
|
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
@@ -89,5 +81,4 @@ var FieldMask = function FieldMask(props) {
|
|
|
89
81
|
value: currentValue
|
|
90
82
|
}));
|
|
91
83
|
};
|
|
92
|
-
var _default = (0, _withFieldHOC.default)(FieldMask);
|
|
93
|
-
exports.default = _default;
|
|
84
|
+
var _default = exports.default = (0, _withFieldHOC.default)(FieldMask);
|