linear-react-components-ui 1.1.20-beta.10 → 1.1.20-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +1 -1
- package/lib/assets/styles/button.scss +1 -0
- package/lib/assets/styles/select.scss +1 -2
- package/lib/assets/styles/table.scss +6 -10
- package/lib/assets/styles/toolbar.scss +0 -3
- package/lib/avatar/index.js +9 -8
- package/lib/badge/index.js +4 -4
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +17 -5
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +1 -1
- package/lib/buttons/types.d.ts +1 -0
- package/lib/calendar/base/Day.js +1 -1
- package/lib/calendar/base/Month.js +1 -1
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/base/Content.d.ts +1 -1
- package/lib/dialog/base/Content.js +2 -3
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +4 -6
- package/lib/dialog/form/index.js +3 -8
- package/lib/dialog/types.d.ts +4 -34
- package/lib/drawer/Drawer.js +3 -3
- package/lib/drawer/Header.js +1 -1
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +43 -22
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/types.d.ts +6 -2
- package/lib/dropdown/withDropdown.js +7 -6
- package/lib/fieldset/index.js +7 -7
- package/lib/form/Field.js +24 -11
- package/lib/form/FieldArray.js +25 -10
- package/lib/form/FieldNumber.js +21 -9
- package/lib/form/FieldPeriod.js +5 -5
- package/lib/form/index.js +6 -9
- package/lib/form/types.d.ts +6 -10
- package/lib/form/withFieldHOC.js +2 -2
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +4 -1
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/index.js +7 -1
- package/lib/icons/helper.d.ts +0 -20
- package/lib/icons/helper.js +0 -20
- package/lib/icons/index.js +24 -27
- package/lib/inputs/base/InputTextBase.js +6 -9
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +7 -3
- package/lib/inputs/date/helpers.js +4 -1
- package/lib/inputs/date/index.js +9 -15
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +5 -6
- package/lib/inputs/file/DragDropFile.js +15 -17
- package/lib/inputs/file/File.js +3 -4
- package/lib/inputs/mask/BaseMask.js +1 -1
- package/lib/inputs/multiSelect/Dropdown.js +9 -10
- package/lib/inputs/multiSelect/helper.js +1 -2
- package/lib/inputs/multiSelect/index.js +7 -9
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/BaseNumber.js +9 -2
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Currency.js +11 -4
- package/lib/inputs/number/index.js +1 -1
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +3 -1
- package/lib/inputs/period/index.js +9 -14
- package/lib/inputs/search/index.js +1 -1
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.js +10 -13
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.js +12 -19
- package/lib/inputs/select/simple/index.js +13 -22
- package/lib/inputs/select/types.d.ts +0 -1
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/internals/withTooltip.js +9 -9
- package/lib/labelMessages/index.js +4 -3
- package/lib/labels/DefaultLabel.js +4 -1
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +9 -7
- package/lib/list/index.js +1 -1
- package/lib/menus/float/MenuItem.js +2 -2
- package/lib/menus/float/SubMenuContainer.js +1 -1
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +7 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +5 -5
- package/lib/panel/Content.js +5 -7
- package/lib/panel/Default.js +2 -2
- package/lib/panel/Header.js +3 -3
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/PopoverText.d.ts +3 -2
- package/lib/popover/PopoverText.js +5 -8
- package/lib/popover/PopoverTitle.d.ts +1 -0
- package/lib/popover/index.d.ts +3 -5
- package/lib/popover/index.js +20 -14
- package/lib/popover/types.d.ts +12 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +2 -2
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +2 -1
- package/lib/skeleton/index.js +4 -1
- package/lib/spinner/index.js +2 -2
- package/lib/split/Split.js +1 -1
- package/lib/split/SplitSide.js +3 -3
- package/lib/table/Body.js +3 -3
- package/lib/table/Header.js +8 -11
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +6 -7
- package/lib/table/Row.js +3 -3
- package/lib/table/RowColumn.js +2 -3
- package/lib/table/index.js +6 -1
- package/lib/table/types.d.ts +2 -4
- package/lib/tabs/DropdownTabs.js +1 -1
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +2 -2
- package/lib/tabs/Panel.js +5 -7
- package/lib/tabs/context.js +3 -6
- package/lib/textContent/index.js +1 -1
- package/lib/toolbar/ButtonBar.js +1 -1
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/index.js +7 -7
- package/lib/treetable/Body.js +1 -1
- package/lib/treetable/Header.js +2 -2
- package/lib/treetable/Row.js +8 -8
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +11 -15
- package/lib/treeview/index.js +7 -11
- package/lib/treeview/types.d.ts +0 -4
- package/lib/uitour/index.js +6 -8
- package/package.json +2 -2
- package/lib/assets/styles/wizard.scss +0 -125
- package/lib/dialog/wizard/index.d.ts +0 -13
- package/lib/dialog/wizard/index.js +0 -74
- package/lib/dialog/wizard/progressbar.d.ts +0 -13
- package/lib/dialog/wizard/progressbar.js +0 -36
- package/lib/dialog/wizard/step.d.ts +0 -9
- package/lib/dialog/wizard/step.js +0 -22
- package/lib/dialog/wizard/useWizard.d.ts +0 -9
- package/lib/dialog/wizard/useWizard.js +0 -48
- package/lib/inputs/mask/imaskHOC.js +0 -203
- package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
- package/lib/tabs/DropdownItems.js +0 -62
- package/lib/tabs/MenuItems.js +0 -70
- package/lib/treeview_old/Header.js +0 -29
- package/lib/treeview_old/Node.js +0 -68
- package/lib/treeview_old/index.js +0 -43
package/lib/dropdown/Popup.js
CHANGED
|
@@ -7,28 +7,46 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
|
-
const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
|
|
10
|
+
const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth", "targetRef"];
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
|
-
const
|
|
14
|
+
const getDropdownStyles = _ref => {
|
|
15
15
|
let {
|
|
16
|
-
topPosition,
|
|
17
|
-
leftPosition,
|
|
18
|
-
rightPosition,
|
|
19
16
|
align,
|
|
20
17
|
isFloatMenu,
|
|
21
|
-
minWidth
|
|
18
|
+
minWidth,
|
|
19
|
+
container,
|
|
20
|
+
target
|
|
22
21
|
} = _ref;
|
|
23
|
-
|
|
22
|
+
if (!container || !target) return '';
|
|
23
|
+
const targetDimensions = target.getBoundingClientRect();
|
|
24
|
+
const rightPosition = !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined;
|
|
25
|
+
const leftPosition = targetDimensions.left;
|
|
26
|
+
let topPosition = targetDimensions.top + window.scrollY + targetDimensions.height;
|
|
27
|
+
let top = topPosition + (isFloatMenu ? 6 : 2);
|
|
28
|
+
let maxHeight = undefined;
|
|
29
|
+
let showScroll = false;
|
|
30
|
+
const isOverflowing = top + container.scrollHeight > window.innerHeight;
|
|
31
|
+
if (isOverflowing) {
|
|
32
|
+
const targetPosition = targetDimensions.top;
|
|
33
|
+
const containerHeight = container.scrollHeight;
|
|
34
|
+
showScroll = containerHeight > targetPosition;
|
|
35
|
+
maxHeight = showScroll ? targetPosition - 10 : containerHeight;
|
|
36
|
+
top = top - maxHeight - targetDimensions.height - (isFloatMenu ? 6 : 2) - 5;
|
|
37
|
+
}
|
|
38
|
+
let style = `top: ${top}px; min-width: ${minWidth}px;`;
|
|
39
|
+
if (showScroll) style += `max-height: ${maxHeight}px; overflow-y: scroll;`;
|
|
24
40
|
if (align === 'left') {
|
|
25
|
-
style +=
|
|
41
|
+
style += `left: ${leftPosition}px;`;
|
|
26
42
|
} else if (align === 'right') {
|
|
27
|
-
style +=
|
|
43
|
+
style += `right: ${rightPosition}px;`;
|
|
28
44
|
}
|
|
29
45
|
return style;
|
|
30
46
|
};
|
|
31
|
-
const
|
|
47
|
+
const {
|
|
48
|
+
body
|
|
49
|
+
} = document;
|
|
32
50
|
const DropdownPopup = _ref2 => {
|
|
33
51
|
let {
|
|
34
52
|
id,
|
|
@@ -38,28 +56,31 @@ const DropdownPopup = _ref2 => {
|
|
|
38
56
|
topPosition = 0,
|
|
39
57
|
leftPosition = 0,
|
|
40
58
|
rightPosition = 0,
|
|
41
|
-
minWidth = 0
|
|
59
|
+
minWidth = 0,
|
|
60
|
+
targetRef
|
|
42
61
|
} = _ref2,
|
|
43
62
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
44
63
|
const popup = (0, _react.useRef)(document.createElement('div'));
|
|
45
|
-
popup.current.className =
|
|
64
|
+
popup.current.className = `dropdown-component ${customClassForDropdown}`;
|
|
46
65
|
popup.current.dataset.testid = 'dropdown-component';
|
|
47
|
-
popup.current.style.cssText = getCalendarDropdownStyle({
|
|
48
|
-
topPosition,
|
|
49
|
-
leftPosition,
|
|
50
|
-
rightPosition,
|
|
51
|
-
align,
|
|
52
|
-
isFloatMenu,
|
|
53
|
-
minWidth
|
|
54
|
-
});
|
|
55
66
|
if (popup && popup.current) {
|
|
56
67
|
const modalContainers = document.body.getElementsByClassName('modalcontainer');
|
|
57
68
|
const lastModalContainer = modalContainers[modalContainers.length - 1];
|
|
58
|
-
popup.current.style.zIndex =
|
|
69
|
+
popup.current.style.zIndex = `${modalContainers.length ? Number(lastModalContainer.style.zIndex) + 1 : 99999}`;
|
|
59
70
|
}
|
|
60
71
|
(0, _react.useEffect)(() => {
|
|
61
72
|
body.appendChild(popup.current);
|
|
62
|
-
popup.current.id = id ||
|
|
73
|
+
popup.current.id = id || `dropdown-component-${(0, _uuid.v1)()}`;
|
|
74
|
+
popup.current.style.cssText = getDropdownStyles({
|
|
75
|
+
topPosition,
|
|
76
|
+
leftPosition,
|
|
77
|
+
rightPosition,
|
|
78
|
+
align,
|
|
79
|
+
isFloatMenu,
|
|
80
|
+
minWidth,
|
|
81
|
+
container: popup.current,
|
|
82
|
+
target: targetRef
|
|
83
|
+
});
|
|
63
84
|
return () => {
|
|
64
85
|
body.removeChild(popup.current);
|
|
65
86
|
};
|
package/lib/dropdown/helper.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
-
const contentClass = showClearButton =>
|
|
7
|
+
const contentClass = showClearButton => `content ${showClearButton ? '' : 'noclear'}`;
|
|
8
8
|
exports.contentClass = contentClass;
|
|
9
9
|
const getDropdownItemCssClass = (selected, disabled, striped) => {
|
|
10
10
|
let className = 'item';
|
package/lib/dropdown/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface WithDropdownProps {
|
|
|
10
10
|
closeDropdownOnClickOutside?: boolean;
|
|
11
11
|
showDropdown?: () => void;
|
|
12
12
|
isFloatMenu?: boolean;
|
|
13
|
+
handlerClose?: (cb: () => void) => void;
|
|
13
14
|
}
|
|
14
15
|
interface WrappedComponentProps extends WithDropdownProps {
|
|
15
16
|
getDropdownPopup?: (ref: Ref<HTMLElement | null>) => ReactElement;
|
|
@@ -31,14 +32,17 @@ interface IPopUpProps {
|
|
|
31
32
|
leftPosition?: number;
|
|
32
33
|
rightPosition?: number;
|
|
33
34
|
minWidth?: number;
|
|
35
|
+
targetRef?: HTMLElement;
|
|
34
36
|
}
|
|
35
|
-
interface
|
|
37
|
+
interface GetDropdownStyleParams {
|
|
36
38
|
align: 'left' | 'right';
|
|
37
39
|
minWidth: number;
|
|
38
40
|
isFloatMenu: boolean;
|
|
39
41
|
topPosition: number;
|
|
40
42
|
leftPosition: number;
|
|
41
43
|
rightPosition: number;
|
|
44
|
+
container?: HTMLDivElement;
|
|
45
|
+
target?: HTMLElement;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
export {
|
|
48
|
+
export { GetDisplayNameParams, GetDropdownStyleParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
|
|
@@ -20,6 +20,7 @@ const withDropdown = WrappedComponent => {
|
|
|
20
20
|
showDropdown,
|
|
21
21
|
dropdown,
|
|
22
22
|
closeDropdownOnClickOutside = true,
|
|
23
|
+
handlerClose,
|
|
23
24
|
customClassForDropdown,
|
|
24
25
|
children,
|
|
25
26
|
dropdownAlign = 'left',
|
|
@@ -38,7 +39,7 @@ const withDropdown = WrappedComponent => {
|
|
|
38
39
|
const {
|
|
39
40
|
target
|
|
40
41
|
} = event;
|
|
41
|
-
if (popupRef
|
|
42
|
+
if (popupRef?.current && target !== popupRef?.current && !event.composedPath().includes(popupRef.current) && wrappedComponentRef.current !== target) {
|
|
42
43
|
setOpened(false);
|
|
43
44
|
}
|
|
44
45
|
};
|
|
@@ -48,11 +49,8 @@ const withDropdown = WrappedComponent => {
|
|
|
48
49
|
const getDropdown = targetRef => {
|
|
49
50
|
if (!targetRef || !opened) return null;
|
|
50
51
|
wrappedComponentRef.current = targetRef;
|
|
51
|
-
const targetDimensions = targetRef.getBoundingClientRect();
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
53
|
-
|
|
54
|
-
rightPosition: !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined,
|
|
55
|
-
leftPosition: targetDimensions.left,
|
|
53
|
+
targetRef: targetRef,
|
|
56
54
|
align: dropdownAlign,
|
|
57
55
|
customClassForDropdown: customClassForDropdown,
|
|
58
56
|
isFloatMenu: isFloatMenu
|
|
@@ -73,6 +71,9 @@ const withDropdown = WrappedComponent => {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
}, []);
|
|
74
|
+
(0, _react.useEffect)(() => {
|
|
75
|
+
if (handlerClose) handlerClose(() => setOpened(false));
|
|
76
|
+
}, [handlerClose]);
|
|
76
77
|
const contextValues = {
|
|
77
78
|
handleDropdownClose: onDropdownClick
|
|
78
79
|
};
|
|
@@ -86,7 +87,7 @@ const withDropdown = WrappedComponent => {
|
|
|
86
87
|
value: contextValues
|
|
87
88
|
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, newProps)));
|
|
88
89
|
};
|
|
89
|
-
EnhancedComponent.displayName =
|
|
90
|
+
EnhancedComponent.displayName = `withDropdown(${getDisplayName(WrappedComponent)})`;
|
|
90
91
|
return EnhancedComponent;
|
|
91
92
|
};
|
|
92
93
|
var _default = exports.default = withDropdown;
|
package/lib/fieldset/index.js
CHANGED
|
@@ -43,9 +43,9 @@ const Fieldset = props => {
|
|
|
43
43
|
customClass,
|
|
44
44
|
hasError
|
|
45
45
|
} = _ref;
|
|
46
|
-
let cssClass =
|
|
47
|
-
if (type) cssClass =
|
|
48
|
-
if (hasError) cssClass =
|
|
46
|
+
let cssClass = `fieldset-component ${customClass}`;
|
|
47
|
+
if (type) cssClass = `${cssClass} -${type}`;
|
|
48
|
+
if (hasError) cssClass = `${cssClass} -witherror`;
|
|
49
49
|
return cssClass;
|
|
50
50
|
};
|
|
51
51
|
const getContentStyle = _ref2 => {
|
|
@@ -55,11 +55,11 @@ const Fieldset = props => {
|
|
|
55
55
|
} = _ref2;
|
|
56
56
|
if (template === 'rows') {
|
|
57
57
|
return {
|
|
58
|
-
gridTemplateRows:
|
|
58
|
+
gridTemplateRows: `repeat(${rowsCount}, 1fr)`
|
|
59
59
|
};
|
|
60
60
|
} else if (template === 'columns') {
|
|
61
61
|
return {
|
|
62
|
-
gridTemplateColumns:
|
|
62
|
+
gridTemplateColumns: `repeat(${colsCount}, 1fr)`
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
return {};
|
|
@@ -70,9 +70,9 @@ const Fieldset = props => {
|
|
|
70
70
|
}, onDenied.hideContent ? /*#__PURE__*/_react.default.createElement(_noPermission.default, null) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, title && /*#__PURE__*/_react.default.createElement("legend", {
|
|
71
71
|
style: styleTitle,
|
|
72
72
|
align: titleAlign,
|
|
73
|
-
className:
|
|
73
|
+
className: `legend ${titleCustomClass}`
|
|
74
74
|
}, leftElements, title, rightElements), /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
className:
|
|
75
|
+
className: `contentfieldset -template${template} `,
|
|
76
76
|
style: Object.assign(getContentStyle(props), styleContent)
|
|
77
77
|
}, children)));
|
|
78
78
|
if (onDenied.unvisible) return null;
|
package/lib/form/Field.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
9
|
var _withFieldHOC = _interopRequireDefault(require("./withFieldHOC"));
|
|
10
10
|
var _helpers = require("./helpers");
|
|
11
|
-
const _excluded = ["handlerFieldChange", "
|
|
11
|
+
const _excluded = ["handlerFieldChange", "handlerFieldValidade", "onChange", "onBlur", "name", "validators", "data", "fieldErrors", "handlerStoreValidators", "handlerRemoveValidators", "component", "externalFieldErrors", "originalData"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
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
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; }
|
|
@@ -25,23 +25,25 @@ const getEvents = _ref => {
|
|
|
25
25
|
validators = [],
|
|
26
26
|
name,
|
|
27
27
|
onBlur,
|
|
28
|
-
|
|
28
|
+
handlerFieldValidade,
|
|
29
29
|
validatorFromComponent,
|
|
30
30
|
handlerFieldChange,
|
|
31
|
-
onChange
|
|
31
|
+
onChange,
|
|
32
|
+
handleShowValidateMessages
|
|
32
33
|
} = _ref;
|
|
33
34
|
if (!(validators || validatorFromComponent || onBlur || onChange)) return {};
|
|
34
35
|
const validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
|
|
35
36
|
return {
|
|
36
37
|
onBlur: e => {
|
|
37
|
-
if (validatorsArray && e.target &&
|
|
38
|
-
|
|
38
|
+
if (validatorsArray && e.target && handlerFieldValidade) {
|
|
39
|
+
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
40
|
+
handleShowValidateMessages(true);
|
|
39
41
|
}
|
|
40
42
|
if (onBlur) onBlur(e);
|
|
41
43
|
},
|
|
42
44
|
onChange: e => {
|
|
43
|
-
if (validatorsArray && e.target &&
|
|
44
|
-
|
|
45
|
+
if (validatorsArray && e.target && handlerFieldValidade) {
|
|
46
|
+
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
45
47
|
}
|
|
46
48
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
47
49
|
if (onChange) onChange(e);
|
|
@@ -80,7 +82,7 @@ const getCustomProps = (props, handlerSetComponentValidator) => {
|
|
|
80
82
|
const Field = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
81
83
|
const {
|
|
82
84
|
handlerFieldChange,
|
|
83
|
-
|
|
85
|
+
handlerFieldValidade,
|
|
84
86
|
onChange,
|
|
85
87
|
onBlur,
|
|
86
88
|
name,
|
|
@@ -94,23 +96,34 @@ const Field = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
94
96
|
originalData
|
|
95
97
|
} = props,
|
|
96
98
|
rest = _objectWithoutProperties(props, _excluded);
|
|
99
|
+
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
97
100
|
const {
|
|
98
101
|
handlerSetValidatorFromComponent,
|
|
99
102
|
validatorFromComponent
|
|
100
103
|
} = (0, _react.useContext)(_helpers.withFieldContext);
|
|
104
|
+
const currentValue = _lodash.default.get(data, name);
|
|
105
|
+
const originalValue = _lodash.default.get(originalData, name);
|
|
106
|
+
(0, _react.useEffect)(() => {
|
|
107
|
+
if (currentValue && currentValue !== originalValue && (!!currentValue || currentValue === 0 || Array.isArray(currentValue) && currentValue.length > 0)) {
|
|
108
|
+
setShowValidateMessages(true);
|
|
109
|
+
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || currentValue === originalValue) {
|
|
110
|
+
setShowValidateMessages(false);
|
|
111
|
+
}
|
|
112
|
+
}, [currentValue, originalValue]);
|
|
101
113
|
return /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getEvents({
|
|
102
114
|
name,
|
|
103
115
|
validators,
|
|
104
116
|
onBlur,
|
|
105
117
|
validatorFromComponent,
|
|
106
|
-
|
|
118
|
+
handlerFieldValidade,
|
|
107
119
|
handlerFieldChange,
|
|
108
|
-
onChange
|
|
120
|
+
onChange,
|
|
121
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
109
122
|
}), getCustomProps(props, handlerSetValidatorFromComponent), {
|
|
110
123
|
ref: ref,
|
|
111
124
|
name: name,
|
|
112
125
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
113
|
-
fieldErrors: props.fieldErrors
|
|
126
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
114
127
|
}))
|
|
115
128
|
}));
|
|
116
129
|
});
|
package/lib/form/FieldArray.js
CHANGED
|
@@ -10,7 +10,7 @@ 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
|
-
const _excluded = ["cols", "label", "bordered", "labelContainerStyle", "skipLabel", "data", "name", "handlerStoreValidators", "component", "handlerFieldChange", "
|
|
13
|
+
const _excluded = ["cols", "label", "bordered", "labelContainerStyle", "skipLabel", "data", "name", "handlerStoreValidators", "component", "handlerFieldChange", "handlerFieldValidade", "changePropName", "fieldErrors", "externalMessagesErrors", "handlerRemoveValidators", "validators", "valuePropName", "originalData", "handlerSelecionados"];
|
|
14
14
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
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); }
|
|
@@ -23,7 +23,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
23
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
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
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 => {
|
|
26
|
+
const getDefaultProps = (props, handleShowValidateMessages) => {
|
|
27
27
|
const {
|
|
28
28
|
valuePropName = 'value',
|
|
29
29
|
changePropName = 'onSelect',
|
|
@@ -35,8 +35,9 @@ const getDefaultProps = props => {
|
|
|
35
35
|
} = props;
|
|
36
36
|
return {
|
|
37
37
|
onBlur: (0, _react.useCallback)(e => {
|
|
38
|
+
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
38
39
|
if (onBlur) onBlur(e);
|
|
39
|
-
}, [onBlur]),
|
|
40
|
+
}, [handleShowValidateMessages, onBlur]),
|
|
40
41
|
[valuePropName]: _lodash.default.get(data, name),
|
|
41
42
|
[changePropName]: (0, _react.useCallback)(ids => {
|
|
42
43
|
if (handlerFieldChange) handlerFieldChange({
|
|
@@ -46,7 +47,8 @@ const getDefaultProps = props => {
|
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
if (handlerSelecionados) handlerSelecionados(ids);
|
|
49
|
-
|
|
50
|
+
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
51
|
+
}, [handlerFieldChange, handlerSelecionados, handleShowValidateMessages, changePropName])
|
|
50
52
|
};
|
|
51
53
|
};
|
|
52
54
|
const FieldArray = props => {
|
|
@@ -61,7 +63,7 @@ const FieldArray = props => {
|
|
|
61
63
|
handlerStoreValidators,
|
|
62
64
|
component: Component,
|
|
63
65
|
handlerFieldChange,
|
|
64
|
-
|
|
66
|
+
handlerFieldValidade,
|
|
65
67
|
changePropName,
|
|
66
68
|
fieldErrors,
|
|
67
69
|
externalMessagesErrors,
|
|
@@ -72,27 +74,40 @@ const FieldArray = props => {
|
|
|
72
74
|
handlerSelecionados
|
|
73
75
|
} = props,
|
|
74
76
|
rest = _objectWithoutProperties(props, _excluded);
|
|
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 => {
|
|
81
|
+
setShowValidateMessages(value);
|
|
82
|
+
}, []);
|
|
83
|
+
(0, _react.useEffect)(() => {
|
|
84
|
+
if (!_lodash.default.isEqual(currentValue, originalValue) && Array.isArray(currentValue) && currentValue.length > 0) {
|
|
85
|
+
setShowValidateMessages(true);
|
|
86
|
+
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || _lodash.default.isEqual(currentValue, originalValue)) {
|
|
87
|
+
setShowValidateMessages(false);
|
|
88
|
+
}
|
|
89
|
+
}, [currentValue]);
|
|
75
90
|
let content = null;
|
|
76
91
|
if (Component) {
|
|
77
92
|
if (!skipLabel && label) {
|
|
78
93
|
content = /*#__PURE__*/_react.default.createElement(_fieldset.default, {
|
|
79
94
|
title: label,
|
|
80
|
-
customClass:
|
|
95
|
+
customClass: `arraycontainer ${bordered && '-bordered'}`,
|
|
81
96
|
style: labelContainerStyle,
|
|
82
97
|
titleCustomClass: "label"
|
|
83
|
-
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props), {
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
84
99
|
label: label,
|
|
85
100
|
name: name,
|
|
86
101
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
87
|
-
fieldErrors: props.fieldErrors
|
|
102
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
88
103
|
}))
|
|
89
104
|
})));
|
|
90
105
|
} else {
|
|
91
|
-
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props), {
|
|
106
|
+
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
92
107
|
label: label,
|
|
93
108
|
name: name,
|
|
94
109
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
95
|
-
fieldErrors: props.fieldErrors
|
|
110
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
96
111
|
}))
|
|
97
112
|
})));
|
|
98
113
|
}
|
package/lib/form/FieldNumber.js
CHANGED
|
@@ -25,26 +25,29 @@ const getEventProps = _ref => {
|
|
|
25
25
|
onBlur,
|
|
26
26
|
onKeyDown,
|
|
27
27
|
onChange,
|
|
28
|
-
|
|
28
|
+
handlerFieldValidade,
|
|
29
29
|
handlerFieldChange,
|
|
30
|
+
handleShowValidateMessages,
|
|
30
31
|
component
|
|
31
32
|
} = _ref;
|
|
32
33
|
return {
|
|
33
34
|
onBlur: e => {
|
|
34
|
-
if (
|
|
35
|
-
if (validators &&
|
|
35
|
+
if (handlerFieldChange) handlerFieldChange(e);
|
|
36
|
+
if (validators && handlerFieldValidade) handlerFieldValidade(name, e.target.value, validators);
|
|
36
37
|
if (onBlur) onBlur(e);
|
|
38
|
+
handleShowValidateMessages(true);
|
|
37
39
|
},
|
|
38
40
|
onKeyDown: e => {
|
|
39
41
|
if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
|
|
40
|
-
if (validators)
|
|
42
|
+
if (validators) handlerFieldValidade?.(name, e.target.value, validators);
|
|
41
43
|
if (onKeyDown) onKeyDown(e);
|
|
44
|
+
handleShowValidateMessages(true);
|
|
42
45
|
}
|
|
43
46
|
},
|
|
44
47
|
onChange: e => {
|
|
45
|
-
if (
|
|
46
|
-
if (validators && e.target &&
|
|
47
|
-
|
|
48
|
+
if (component?.name === 'NumberField') {
|
|
49
|
+
if (validators && e.target && handlerFieldValidade) {
|
|
50
|
+
handlerFieldValidade(name, e.target.value, validators);
|
|
48
51
|
}
|
|
49
52
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
50
53
|
if (onChange) onChange(e);
|
|
@@ -61,9 +64,18 @@ const FieldMask = props => {
|
|
|
61
64
|
const currentValue = _lodash.default.get(data, name);
|
|
62
65
|
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
63
66
|
const originalValue = _lodash.default.get(originalData, name);
|
|
64
|
-
|
|
67
|
+
(0, _react.useEffect)(() => {
|
|
68
|
+
if (currentValue && currentValue !== originalValue && !!currentValue) {
|
|
69
|
+
setShowValidateMessages(true);
|
|
70
|
+
} else if (_lodash.default.isEmpty(data) || _lodash.default.every(data, _lodash.default.isEmpty) || currentValue === originalValue) {
|
|
71
|
+
setShowValidateMessages(false);
|
|
72
|
+
}
|
|
73
|
+
}, [currentValue, originalValue]);
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(props.component, _extends({}, props, getEventProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
75
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
76
|
+
})), {
|
|
65
77
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
66
|
-
fieldErrors: props.fieldErrors
|
|
78
|
+
fieldErrors: showValidateMessages ? props.fieldErrors : {}
|
|
67
79
|
})),
|
|
68
80
|
value: currentValue
|
|
69
81
|
}));
|
package/lib/form/FieldPeriod.js
CHANGED
|
@@ -19,7 +19,7 @@ const FieldPeriod = props => {
|
|
|
19
19
|
nameDateInitial,
|
|
20
20
|
nameDateFinal,
|
|
21
21
|
handlerFieldChange,
|
|
22
|
-
|
|
22
|
+
handlerFieldValidade,
|
|
23
23
|
fieldErrors,
|
|
24
24
|
externalMessagesErrors,
|
|
25
25
|
onChange,
|
|
@@ -55,8 +55,8 @@ const FieldPeriod = props => {
|
|
|
55
55
|
initial,
|
|
56
56
|
final
|
|
57
57
|
} = _ref;
|
|
58
|
-
if (validators &&
|
|
59
|
-
|
|
58
|
+
if (validators && handlerFieldValidade) {
|
|
59
|
+
handlerFieldValidade(nameDateInitial, {
|
|
60
60
|
[nameDateInitial]: initial,
|
|
61
61
|
[nameDateFinal]: final
|
|
62
62
|
}, validators);
|
|
@@ -79,8 +79,8 @@ const FieldPeriod = props => {
|
|
|
79
79
|
});
|
|
80
80
|
},
|
|
81
81
|
value: {
|
|
82
|
-
initial: _lodash.default.get(data,
|
|
83
|
-
final: _lodash.default.get(data,
|
|
82
|
+
initial: _lodash.default.get(data, `${name}.${nameDateInitial}`),
|
|
83
|
+
final: _lodash.default.get(data, `${name}.${nameDateFinal}`)
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
86
|
}
|
package/lib/form/index.js
CHANGED
|
@@ -75,7 +75,6 @@ const Form = _ref => {
|
|
|
75
75
|
const [fieldErrors, setFieldErrors] = (0, _react.useState)({});
|
|
76
76
|
const fieldsValidators = (0, _react.useRef)({});
|
|
77
77
|
const [oldFieldsValidatorsQuantity, setOldFieldsValidatorsQuantity] = (0, _react.useState)(0);
|
|
78
|
-
const [isValid, setIsValid] = (0, _react.useState)(false);
|
|
79
78
|
const context = (0, _react.useContext)(_withFormSecurity.FormSecurityContext);
|
|
80
79
|
const usedData = useInternalState ? data : dataSource;
|
|
81
80
|
const getValidatesErrorMessages = (validators, fieldValue) => {
|
|
@@ -108,9 +107,8 @@ const Form = _ref => {
|
|
|
108
107
|
let updateState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
109
108
|
let currentValidators = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
110
109
|
const currentFieldErrors = getErrorMessages(currentData, currentValidators || fieldsValidators.current);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return isValidNow;
|
|
110
|
+
if (updateState) setFieldErrors(currentFieldErrors);
|
|
111
|
+
return Object.values(currentFieldErrors).every(value => value.length === 0);
|
|
114
112
|
};
|
|
115
113
|
const onFieldChange = (0, _react.useCallback)(event => {
|
|
116
114
|
const {
|
|
@@ -237,7 +235,7 @@ const Form = _ref => {
|
|
|
237
235
|
}
|
|
238
236
|
}, [submitOnPressEnterKey]);
|
|
239
237
|
(0, _react.useEffect)(() => {
|
|
240
|
-
const validatorsQuantity = Object.values(fieldsValidators.current).reduce((acc, currentValue) => acc + (
|
|
238
|
+
const validatorsQuantity = Object.values(fieldsValidators.current).reduce((acc, currentValue) => acc + (currentValue?.length || 0), 0);
|
|
241
239
|
if (fieldsValidators.current && onValidateForm && oldFieldsValidatorsQuantity !== validatorsQuantity) {
|
|
242
240
|
setOldFieldsValidatorsQuantity(validatorsQuantity);
|
|
243
241
|
onValidateForm(checkIsValid(usedData, true, fieldsValidators.current));
|
|
@@ -246,7 +244,7 @@ const Form = _ref => {
|
|
|
246
244
|
const contextValues = {
|
|
247
245
|
skeletonize,
|
|
248
246
|
handlerFieldChange: onFieldChange,
|
|
249
|
-
|
|
247
|
+
handlerFieldValidade: onValidate,
|
|
250
248
|
handlerStoreValidators: (fieldName, fieldValidates) => {
|
|
251
249
|
fieldsValidators.current = _objectSpread(_objectSpread({}, fieldsValidators.current), {}, {
|
|
252
250
|
[fieldName]: fieldValidates
|
|
@@ -256,8 +254,7 @@ const Form = _ref => {
|
|
|
256
254
|
data: useInternalState ? data : dataSource,
|
|
257
255
|
originalData,
|
|
258
256
|
fieldErrors,
|
|
259
|
-
externalFieldErrors
|
|
260
|
-
isFormValid: isValid
|
|
257
|
+
externalFieldErrors
|
|
261
258
|
};
|
|
262
259
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Provider, {
|
|
263
260
|
value: contextValues
|
|
@@ -265,7 +262,7 @@ const Form = _ref => {
|
|
|
265
262
|
style: style
|
|
266
263
|
}, formProps(), {
|
|
267
264
|
role: "presentation",
|
|
268
|
-
className:
|
|
265
|
+
className: `form-component ${customClass}`
|
|
269
266
|
}), children)), /*#__PURE__*/_react.default.createElement(_dialog.DialogQuestion, {
|
|
270
267
|
zIndex: "99999999",
|
|
271
268
|
title: securityTitle || 'Dados Alterados',
|
package/lib/form/types.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ interface IFieldProps extends WithFieldProps {
|
|
|
57
57
|
value?: string;
|
|
58
58
|
label?: string;
|
|
59
59
|
handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => ChangeEvent;
|
|
60
|
-
|
|
60
|
+
handlerFieldValidade?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
61
61
|
component: ComponentType<any>;
|
|
62
62
|
componentType?: 'Radio' | 'Checkbox';
|
|
63
63
|
onChange?: (event: ChangeEvent) => ChangeEvent;
|
|
@@ -86,10 +86,6 @@ interface IFieldProps extends WithFieldProps {
|
|
|
86
86
|
autoCompleteMask?: 'left' | 'right';
|
|
87
87
|
mask?: string;
|
|
88
88
|
removeZeroLeft?: boolean;
|
|
89
|
-
textAlign?: 'left' | 'right';
|
|
90
|
-
disabled?: boolean;
|
|
91
|
-
displayCurrencySymbol?: boolean;
|
|
92
|
-
currencySymbol?: string;
|
|
93
89
|
}
|
|
94
90
|
interface CustomEvent {
|
|
95
91
|
target: {
|
|
@@ -124,7 +120,7 @@ interface IFieldArrayProps extends WithFieldProps {
|
|
|
124
120
|
multiple?: boolean;
|
|
125
121
|
disabled?: boolean;
|
|
126
122
|
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
127
|
-
|
|
123
|
+
handlerFieldValidade?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
128
124
|
required?: boolean;
|
|
129
125
|
}
|
|
130
126
|
type PeriodChangeEvent = {
|
|
@@ -156,21 +152,20 @@ interface IFieldPeriodProps extends WithFieldProps {
|
|
|
156
152
|
externalFieldErrors?: {
|
|
157
153
|
[name: string]: string[];
|
|
158
154
|
};
|
|
159
|
-
|
|
155
|
+
handlerFieldValidade?: (name: string, value: object, validatorsArray: PeriodValidator[] | PeriodValidator) => void;
|
|
160
156
|
onChange?: (event: PeriodChangeEvent) => PeriodChangeEvent;
|
|
161
157
|
gridLayout?: string;
|
|
162
158
|
}
|
|
163
159
|
interface FormContextProps {
|
|
164
160
|
skeletonize?: boolean;
|
|
165
161
|
handlerFieldChange: (event: OnFielChangeEvent) => void;
|
|
166
|
-
|
|
162
|
+
handlerFieldValidade: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
167
163
|
handlerStoreValidators: (fieldName: string, fieldValidates: Validator) => void;
|
|
168
164
|
handlerRemoveValidators: (fieldName: string) => void;
|
|
169
165
|
data: object;
|
|
170
166
|
originalData: object;
|
|
171
167
|
fieldErrors: object;
|
|
172
168
|
externalFieldErrors?: object;
|
|
173
|
-
isFormValid?: boolean;
|
|
174
169
|
}
|
|
175
170
|
interface WithFieldProps {
|
|
176
171
|
name: string;
|
|
@@ -205,9 +200,10 @@ interface IEventParams {
|
|
|
205
200
|
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
206
201
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
207
202
|
onKeyDown?: (event: CustomKeyboardEvent) => void;
|
|
208
|
-
|
|
203
|
+
handlerFieldValidade?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
209
204
|
handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => void;
|
|
210
205
|
validatorFromComponent?: Validator | Validator[];
|
|
206
|
+
handleShowValidateMessages: (value: boolean) => void;
|
|
211
207
|
component?: ComponentType<any>;
|
|
212
208
|
}
|
|
213
209
|
interface IGetErrorMessagesParams {
|
package/lib/form/withFieldHOC.js
CHANGED
|
@@ -45,7 +45,7 @@ const withFieldHOC = WrappedComponent => {
|
|
|
45
45
|
return /*#__PURE__*/_react.default.createElement(_helpers.FormContext.Consumer, null, _ref => {
|
|
46
46
|
let {
|
|
47
47
|
handlerFieldChange,
|
|
48
|
-
|
|
48
|
+
handlerFieldValidade,
|
|
49
49
|
data,
|
|
50
50
|
fieldErrors,
|
|
51
51
|
externalFieldErrors,
|
|
@@ -56,7 +56,7 @@ const withFieldHOC = WrappedComponent => {
|
|
|
56
56
|
return /*#__PURE__*/_react.default.createElement(EnhancedComponent, _extends({}, props, {
|
|
57
57
|
skeletonize: skeletonize,
|
|
58
58
|
handlerFieldChange: handlerFieldChange,
|
|
59
|
-
|
|
59
|
+
handlerFieldValidade: handlerFieldValidade,
|
|
60
60
|
handlerStoreValidators: handlerStoreValidators,
|
|
61
61
|
handlerRemoveValidators: handlerRemoveValidators,
|
|
62
62
|
data: data,
|