linear-react-components-ui 1.1.3-beta.3 → 1.1.3
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/.eslintcache +1 -1
- package/lib/@types/Align.d.ts +1 -1
- package/lib/@types/ButtonTypes.d.ts +1 -1
- package/lib/@types/ColorStyles.d.ts +1 -1
- package/lib/@types/DataCombo.d.ts +1 -1
- package/lib/@types/Icon.d.ts +1 -1
- package/lib/@types/LabelStyles.d.ts +1 -1
- package/lib/@types/Period.d.ts +1 -1
- package/lib/@types/PermissionAttr.d.ts +1 -1
- package/lib/@types/PointerEvents.d.ts +1 -1
- package/lib/@types/Position.d.ts +1 -1
- package/lib/@types/PositionAlert.d.ts +1 -1
- package/lib/@types/Size.d.ts +1 -1
- package/lib/@types/SizePixels.d.ts +1 -1
- package/lib/@types/StorageMock.d.ts +1 -1
- package/lib/alerts/types.d.ts +1 -1
- package/lib/assets/styles/button.scss +9 -11
- package/lib/assets/styles/table.scss +1 -2
- package/lib/avatar/types.d.ts +1 -1
- package/lib/badge/types.d.ts +1 -1
- package/lib/buttons/DefaultButton.js +11 -29
- package/lib/buttons/types.d.ts +1 -2
- package/lib/calendar/types.d.ts +1 -1
- package/lib/checkbox/index.js +1 -1
- package/lib/checkbox/types.d.ts +1 -1
- package/lib/dialog/types.d.ts +1 -1
- package/lib/drawer/types.d.ts +1 -1
- package/lib/dropdown/types.d.ts +1 -1
- package/lib/fieldset/types.d.ts +1 -1
- package/lib/form/Field.d.ts +1 -1
- package/lib/form/FieldArray.js +26 -12
- package/lib/form/index.js +7 -6
- package/lib/form/types.d.ts +3 -4
- package/lib/gridlayout/types.d.ts +1 -1
- package/lib/hint/types.d.ts +1 -1
- package/lib/icons/types.d.ts +1 -1
- package/lib/inputs/base/InputTextBase.js +2 -1
- package/lib/inputs/base/types.d.ts +1 -1
- package/lib/inputs/color/types.d.ts +1 -1
- package/lib/inputs/date/index.js +38 -26
- package/lib/inputs/date/types.d.ts +1 -1
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/mask/Cpf.js +1 -0
- package/lib/inputs/mask/imaskHOC.js +4 -2
- package/lib/inputs/mask/types.d.ts +1 -1
- package/lib/inputs/multiSelect/types.d.ts +1 -1
- package/lib/inputs/number/types.d.ts +1 -1
- package/lib/inputs/period/types.d.ts +1 -1
- package/lib/inputs/select/types.d.ts +1 -1
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +1 -1
- package/lib/internals/types.d.ts +2 -5
- package/lib/internals/withTooltip.d.ts +2 -3
- package/lib/internals/withTooltip.js +8 -19
- package/lib/labelMessages/types.d.ts +1 -1
- package/lib/labels/types.d.ts +1 -1
- package/lib/list/Item.js +5 -24
- package/lib/list/types.d.ts +1 -1
- package/lib/menus/float/index.d.ts +10 -10
- package/lib/menus/float/types.d.ts +1 -1
- package/lib/menus/sidenav/types.d.ts +1 -1
- package/lib/panel/types.d.ts +1 -1
- package/lib/popover/types.d.ts +1 -1
- package/lib/progress/types.d.ts +1 -1
- package/lib/radio/types.d.ts +1 -1
- package/lib/shortcuts/types.d.ts +1 -1
- package/lib/skeleton/types.d.ts +1 -1
- package/lib/spinner/types.d.ts +1 -1
- package/lib/split/helpers.d.ts +1 -1
- package/lib/split/types.d.ts +1 -1
- package/lib/table/RowColumn.js +8 -6
- package/lib/table/types.d.ts +1 -1
- package/lib/tabs/types.d.ts +1 -1
- package/lib/toolbar/types.d.ts +1 -2
- package/lib/tooltip/types.d.ts +1 -1
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview/types.d.ts +1 -1
- package/lib/{types.d-DvJcBS8L.d.ts → types.d-73cece43.d.ts} +1 -1
- package/lib/uitour/index.d.ts +1 -2
- package/lib/uitour/index.js +4 -57
- package/lib/uitour/types.d.ts +1 -9
- package/package.json +1 -1
package/lib/@types/Align.d.ts
CHANGED
package/lib/@types/Icon.d.ts
CHANGED
package/lib/@types/Period.d.ts
CHANGED
package/lib/@types/Position.d.ts
CHANGED
package/lib/@types/Size.d.ts
CHANGED
package/lib/alerts/types.d.ts
CHANGED
|
@@ -47,4 +47,4 @@ type MessagesState = {
|
|
|
47
47
|
[key: string]: Array<IMessageProps>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
export
|
|
50
|
+
export { AlertContainerMethods, DefaultMessageConfigType, GetClassParams, IAlertProviderProps, IBaseAlertProps, IMessageProps, MessagesState, WithAlertContextProps };
|
|
@@ -38,14 +38,13 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
38
38
|
@extend %component-splash-click;
|
|
39
39
|
content: "";
|
|
40
40
|
position: absolute;
|
|
41
|
-
top: 50
|
|
42
|
-
left: 50
|
|
41
|
+
top: 50%;
|
|
42
|
+
left: 50%;
|
|
43
43
|
display: block;
|
|
44
|
+
width: 0;
|
|
44
45
|
padding-top: 0;
|
|
45
46
|
border-radius: 100%;
|
|
46
47
|
background-color: rgba(236, 240, 241, 0.3);
|
|
47
|
-
width: 0;
|
|
48
|
-
height: 0 !important;
|
|
49
48
|
}
|
|
50
49
|
> .icon-component {
|
|
51
50
|
width: 15px;
|
|
@@ -70,7 +69,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
70
69
|
&:active:before {
|
|
71
70
|
@extend %component-effect-click;
|
|
72
71
|
}
|
|
73
|
-
&:hover
|
|
72
|
+
&:hover {
|
|
74
73
|
background-color: $default-hover-color;
|
|
75
74
|
}
|
|
76
75
|
&:focus {
|
|
@@ -103,7 +102,6 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
103
102
|
@extend %component-disabled;
|
|
104
103
|
opacity: 0.7;
|
|
105
104
|
border: solid 1px $font-color-disabled;
|
|
106
|
-
pointer-events: auto;
|
|
107
105
|
}
|
|
108
106
|
&.-shadowsdisabled {
|
|
109
107
|
box-shadow: none!important;
|
|
@@ -164,7 +162,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
164
162
|
border: 1px solid $primary-border-color;
|
|
165
163
|
text-shadow: $shadow-text-button;
|
|
166
164
|
@extend %color-effects;
|
|
167
|
-
&:hover
|
|
165
|
+
&:hover {
|
|
168
166
|
background-color: $primary-hover-color;
|
|
169
167
|
}
|
|
170
168
|
&:focus {
|
|
@@ -203,7 +201,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
203
201
|
border: 1px solid $warning-color;
|
|
204
202
|
text-shadow: $shadow-text-button;
|
|
205
203
|
@extend %color-effects;
|
|
206
|
-
&:hover
|
|
204
|
+
&:hover {
|
|
207
205
|
background-color: $warning-hover-color;
|
|
208
206
|
}
|
|
209
207
|
&:focus {
|
|
@@ -222,7 +220,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
222
220
|
text-shadow: $shadow-text-button;
|
|
223
221
|
@extend %color-effects;
|
|
224
222
|
color: $font-color-second;
|
|
225
|
-
&:hover
|
|
223
|
+
&:hover {
|
|
226
224
|
background-color: $danger-hover-color;
|
|
227
225
|
}
|
|
228
226
|
&:focus {
|
|
@@ -241,7 +239,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
241
239
|
text-shadow: $shadow-text-button;
|
|
242
240
|
@extend %color-effects;
|
|
243
241
|
color: $font-color-second;
|
|
244
|
-
&:hover
|
|
242
|
+
&:hover {
|
|
245
243
|
background-color: $success-hover-color;
|
|
246
244
|
color: $font-color-second;
|
|
247
245
|
}
|
|
@@ -261,7 +259,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
261
259
|
text-shadow: $shadow-text-button;
|
|
262
260
|
@extend %color-effects;
|
|
263
261
|
color: $font-color-second;
|
|
264
|
-
&:hover
|
|
262
|
+
&:hover {
|
|
265
263
|
background-color: $info-hover-color;
|
|
266
264
|
color: $font-color-second;
|
|
267
265
|
}
|
package/lib/avatar/types.d.ts
CHANGED
package/lib/badge/types.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
9
|
var _icons = _interopRequireDefault(require("../../lib/icons"));
|
|
10
|
-
var _withTooltip =
|
|
10
|
+
var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
|
|
11
11
|
var _spinner = _interopRequireDefault(require("../spinner"));
|
|
12
12
|
var _withDropdown = _interopRequireDefault(require("../dropdown/withDropdown"));
|
|
13
13
|
var _permissionValidations = require("../permissionValidations");
|
|
14
|
-
const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "errorMessage", "tooltipWidth", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef"
|
|
14
|
+
const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "tooltipPosition", "errorMessage", "tooltipWidth", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
17
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; }
|
|
@@ -53,13 +53,13 @@ const DefaultButton = _ref => {
|
|
|
53
53
|
round,
|
|
54
54
|
permissionAttr,
|
|
55
55
|
skeletonize,
|
|
56
|
+
tooltipPosition,
|
|
56
57
|
errorMessage,
|
|
57
58
|
tooltipWidth,
|
|
58
59
|
isFloatMenu,
|
|
59
60
|
dropdownAlign,
|
|
60
61
|
customClassForDropdown,
|
|
61
|
-
buttonRef
|
|
62
|
-
onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.'
|
|
62
|
+
buttonRef
|
|
63
63
|
} = _ref,
|
|
64
64
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
65
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
@@ -67,30 +67,18 @@ const DefaultButton = _ref => {
|
|
|
67
67
|
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
68
68
|
const refButton = (0, _react.useRef)(null);
|
|
69
69
|
const disabledIconColor = 'rgb(193, 193, 193)';
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const {
|
|
73
|
-
handlerSetOnDeniedText
|
|
74
|
-
} = (0, _react.useContext)(_withTooltip.TooltipContext);
|
|
75
|
-
const getClass = () => "button-component ".concat(className, "\n ").concat(customClass, "\n ").concat(transparent && '-transparent', "\n ").concat(isDisabled && '-disabled', "\n ").concat(size && "-".concat(size), "\n ").concat(dropdown && !round && 'icon-right', "\n ").concat(dropdown && round && 'icon-center', "\n ").concat(iconAlign && !dropdown && "icon-".concat(iconAlign), "\n ").concat(boxShadow ? '' : '-shadowsdisabled', "\n ").concat(round && '-round');
|
|
76
|
-
const returnPadlockIcon = resultantStyle => /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
77
|
-
name: "padlock",
|
|
78
|
-
size: 16,
|
|
79
|
-
pointerEvents: "none",
|
|
80
|
-
color: disabledIconColor,
|
|
81
|
-
style: resultantStyle
|
|
82
|
-
});
|
|
70
|
+
const shouldDisable = () => !!onDenied.disabled || disabled;
|
|
71
|
+
const getClass = () => "button-component ".concat(className, " \n ").concat(customClass, " \n ").concat(transparent && '-transparent', "\n ").concat(shouldDisable() && '-disabled', "\n ").concat(size && "-".concat(size), "\n ").concat(dropdown && !round && 'icon-right', " \n ").concat(dropdown && round && 'icon-center', " \n ").concat(iconAlign && !dropdown && "icon-".concat(iconAlign), "\n ").concat(boxShadow ? '' : '-shadowsdisabled', "\n ").concat(round && '-round');
|
|
83
72
|
const getIcon = () => {
|
|
84
73
|
let resultantStyle = iconStyle;
|
|
85
|
-
if (
|
|
74
|
+
if (shouldDisable()) {
|
|
86
75
|
resultantStyle = _objectSpread(_objectSpread({}, resultantStyle), {}, {
|
|
87
76
|
fill: disabledIconColor
|
|
88
77
|
});
|
|
89
78
|
}
|
|
90
79
|
if (dropdown && showIconDropdown) {
|
|
91
|
-
const openDropDownRule = isDropdownOpened ? 'mini_up' : 'mini_down';
|
|
92
80
|
return /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
93
|
-
name:
|
|
81
|
+
name: isDropdownOpened ? 'mini_up' : 'mini_down',
|
|
94
82
|
size: 16,
|
|
95
83
|
customClass: "dropdown-icon",
|
|
96
84
|
pointerEvents: "none",
|
|
@@ -98,16 +86,12 @@ const DefaultButton = _ref => {
|
|
|
98
86
|
});
|
|
99
87
|
}
|
|
100
88
|
if (icon) {
|
|
101
|
-
if (
|
|
102
|
-
return returnPadlockIcon(resultantStyle);
|
|
103
|
-
} else if (disabled) {
|
|
89
|
+
if (shouldDisable()) {
|
|
104
90
|
return /*#__PURE__*/_react.default.createElement(_icons.default, _extends({}, icon.props, {
|
|
105
91
|
color: disabledIconColor
|
|
106
92
|
}));
|
|
107
93
|
}
|
|
108
94
|
return icon;
|
|
109
|
-
} else if (!icon && disabledByPermission) {
|
|
110
|
-
return returnPadlockIcon(resultantStyle);
|
|
111
95
|
} else if (iconName) {
|
|
112
96
|
return /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
113
97
|
name: iconName,
|
|
@@ -119,18 +103,16 @@ const DefaultButton = _ref => {
|
|
|
119
103
|
}
|
|
120
104
|
return null;
|
|
121
105
|
};
|
|
122
|
-
(0, _react.useEffect)(() => {
|
|
123
|
-
if (disabledByPermission) handlerSetOnDeniedText(onDeniedText);
|
|
124
|
-
}, [disabledByPermission]);
|
|
125
106
|
if (!visible || onDenied.unvisible) return null;
|
|
126
107
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("button", _extends({}, rest, {
|
|
127
108
|
style: style,
|
|
128
109
|
onClick: e => {
|
|
129
|
-
if (
|
|
110
|
+
if (shouldDisable()) return;
|
|
130
111
|
if (onClick) onClick(e);
|
|
131
112
|
if (dropdown && showDropdown) showDropdown();
|
|
132
113
|
if (onClick && toggleable) setActiveButton(!activeButton);
|
|
133
114
|
},
|
|
115
|
+
disabled: shouldDisable(),
|
|
134
116
|
className: "".concat(getClass(), " ").concat(activeButton ? '-toggleable' : '', " ").concat(skeletonize ? '-skeletonized' : ''),
|
|
135
117
|
ref: r => {
|
|
136
118
|
if (buttonRef) {
|
package/lib/buttons/types.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
43
43
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
44
44
|
closeDropdownOnClickOutside?: boolean;
|
|
45
45
|
errorMessage?: string;
|
|
46
|
-
onDeniedText?: string;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
export
|
|
48
|
+
export { IButtonProps };
|
package/lib/calendar/types.d.ts
CHANGED
package/lib/checkbox/index.js
CHANGED
|
@@ -81,7 +81,6 @@ const CheckBox = _ref => {
|
|
|
81
81
|
"aria-checked": "false",
|
|
82
82
|
onKeyPress: undefined
|
|
83
83
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
84
|
-
id: id || undefined,
|
|
85
84
|
ref: r => {
|
|
86
85
|
if (targetRef) targetRef(r);
|
|
87
86
|
inputRef.current = r;
|
|
@@ -94,6 +93,7 @@ const CheckBox = _ref => {
|
|
|
94
93
|
name: name,
|
|
95
94
|
required: required,
|
|
96
95
|
value: value,
|
|
96
|
+
id: id,
|
|
97
97
|
onChange: () => {}
|
|
98
98
|
}), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_.Icon, {
|
|
99
99
|
size: 12,
|
package/lib/checkbox/types.d.ts
CHANGED
package/lib/dialog/types.d.ts
CHANGED
|
@@ -67,4 +67,4 @@ interface IFormDialogContext {
|
|
|
67
67
|
headerRef?: React.RefObject<HTMLDivElement>;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export
|
|
70
|
+
export { IBaseProps, ICommonDialogProps, IContentProps, ICustomProps, IFooterProps, IFormDialogContext, IFormProps, IHeaderProps, IQuestionProps };
|
package/lib/drawer/types.d.ts
CHANGED
package/lib/dropdown/types.d.ts
CHANGED
|
@@ -41,4 +41,4 @@ interface GetCalendarDropdownStyleParams {
|
|
|
41
41
|
rightPosition: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export
|
|
44
|
+
export { GetCalendarDropdownStyleParams, GetDisplayNameParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
|
package/lib/fieldset/types.d.ts
CHANGED
package/lib/form/Field.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ import '../@types/Period.js';
|
|
|
9
9
|
import '../internals/types.js';
|
|
10
10
|
import '../@types/Position.js';
|
|
11
11
|
|
|
12
|
-
declare const _default: React__default.ForwardRefExoticComponent<Pick<IFieldProps & React__default.RefAttributes<unknown>, keyof IFieldProps
|
|
12
|
+
declare const _default: React__default.ForwardRefExoticComponent<Pick<IFieldProps & React__default.RefAttributes<unknown>, "key" | keyof IFieldProps> & React__default.RefAttributes<HTMLElement>>;
|
|
13
13
|
|
|
14
14
|
export { _default as default };
|
package/lib/form/FieldArray.js
CHANGED
|
@@ -10,8 +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", "handlerFieldValidade", "changePropName", "fieldErrors", "externalMessagesErrors", "handlerRemoveValidators", "validators", "valuePropName", "originalData"
|
|
14
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
13
|
+
const _excluded = ["cols", "label", "bordered", "labelContainerStyle", "skipLabel", "data", "name", "handlerStoreValidators", "component", "handlerFieldChange", "handlerFieldValidade", "changePropName", "fieldErrors", "externalMessagesErrors", "handlerRemoveValidators", "validators", "valuePropName", "originalData"];
|
|
15
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
15
|
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
16
|
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; }
|
|
@@ -34,12 +33,12 @@ const getDefaultProps = (props, handleShowValidateMessages) => {
|
|
|
34
33
|
onBlur
|
|
35
34
|
} = props;
|
|
36
35
|
return {
|
|
37
|
-
onBlur:
|
|
36
|
+
onBlur: e => {
|
|
38
37
|
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
39
38
|
if (onBlur) onBlur(e);
|
|
40
|
-
},
|
|
39
|
+
},
|
|
41
40
|
[valuePropName]: _lodash.default.get(data, name),
|
|
42
|
-
[changePropName]:
|
|
41
|
+
[changePropName]: ids => {
|
|
43
42
|
if (handlerFieldChange) handlerFieldChange({
|
|
44
43
|
target: {
|
|
45
44
|
value: ids,
|
|
@@ -48,7 +47,19 @@ const getDefaultProps = (props, handleShowValidateMessages) => {
|
|
|
48
47
|
});
|
|
49
48
|
if (handlerSelecionados) handlerSelecionados(ids);
|
|
50
49
|
if (handleShowValidateMessages) handleShowValidateMessages(true);
|
|
51
|
-
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const getEvents = _ref => {
|
|
54
|
+
let {
|
|
55
|
+
onBlur,
|
|
56
|
+
handleShowValidateMessages
|
|
57
|
+
} = _ref;
|
|
58
|
+
return {
|
|
59
|
+
onBlur: e => {
|
|
60
|
+
handleShowValidateMessages(true);
|
|
61
|
+
if (onBlur) onBlur(e);
|
|
62
|
+
}
|
|
52
63
|
};
|
|
53
64
|
};
|
|
54
65
|
const FieldArray = props => {
|
|
@@ -70,16 +81,15 @@ const FieldArray = props => {
|
|
|
70
81
|
handlerRemoveValidators,
|
|
71
82
|
validators,
|
|
72
83
|
valuePropName,
|
|
73
|
-
originalData
|
|
74
|
-
handlerSelecionados
|
|
84
|
+
originalData
|
|
75
85
|
} = props,
|
|
76
86
|
rest = _objectWithoutProperties(props, _excluded);
|
|
77
87
|
const [showValidateMessages, setShowValidateMessages] = (0, _react.useState)(false);
|
|
78
88
|
const currentValue = _lodash.default.get(data, name);
|
|
79
89
|
const originalValue = _lodash.default.get(originalData, name);
|
|
80
|
-
const handleShowValidateMessages =
|
|
90
|
+
const handleShowValidateMessages = value => {
|
|
81
91
|
setShowValidateMessages(value);
|
|
82
|
-
}
|
|
92
|
+
};
|
|
83
93
|
(0, _react.useEffect)(() => {
|
|
84
94
|
if (!_lodash.default.isEqual(currentValue, originalValue) && Array.isArray(currentValue) && currentValue.length > 0) {
|
|
85
95
|
setShowValidateMessages(true);
|
|
@@ -95,7 +105,9 @@ const FieldArray = props => {
|
|
|
95
105
|
customClass: "arraycontainer ".concat(bordered && '-bordered'),
|
|
96
106
|
style: labelContainerStyle,
|
|
97
107
|
titleCustomClass: "label"
|
|
98
|
-
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), getEvents(_objectSpread(_objectSpread({}, props), {}, {
|
|
109
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
110
|
+
})), {
|
|
99
111
|
label: label,
|
|
100
112
|
name: name,
|
|
101
113
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -103,7 +115,9 @@ const FieldArray = props => {
|
|
|
103
115
|
}))
|
|
104
116
|
})));
|
|
105
117
|
} else {
|
|
106
|
-
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), {
|
|
118
|
+
content = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props, handleShowValidateMessages), getEvents(_objectSpread(_objectSpread({}, props), {}, {
|
|
119
|
+
handleShowValidateMessages: value => setShowValidateMessages(value)
|
|
120
|
+
})), {
|
|
107
121
|
label: label,
|
|
108
122
|
name: name,
|
|
109
123
|
errorMessages: (0, _helpers.getErrorMessages)(_objectSpread(_objectSpread({}, props), {}, {
|
package/lib/form/index.js
CHANGED
|
@@ -110,16 +110,17 @@ const Form = _ref => {
|
|
|
110
110
|
if (updateState) setFieldErrors(currentFieldErrors);
|
|
111
111
|
return Object.values(currentFieldErrors).every(value => value.length === 0);
|
|
112
112
|
};
|
|
113
|
-
const onFieldChange =
|
|
113
|
+
const onFieldChange = event => {
|
|
114
114
|
const {
|
|
115
115
|
target
|
|
116
116
|
} = event;
|
|
117
117
|
if (!useInternalState && onDataChange) {
|
|
118
|
-
|
|
118
|
+
const newData = (0, _helpers.changeValue)(dataSource, target);
|
|
119
|
+
onDataChange(newData);
|
|
119
120
|
} else {
|
|
120
121
|
setData(prevState => (0, _helpers.changeValue)(prevState, target));
|
|
121
122
|
}
|
|
122
|
-
}
|
|
123
|
+
};
|
|
123
124
|
const onValidate = (fieldName, fieldValue, validators) => {
|
|
124
125
|
if (validators) {
|
|
125
126
|
let currentFieldErrors = fieldErrors;
|
|
@@ -134,10 +135,10 @@ const Form = _ref => {
|
|
|
134
135
|
setFieldErrors(currentFieldErrors);
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
const onFormSubmit =
|
|
138
|
+
const onFormSubmit = event => {
|
|
138
139
|
if (event) event.preventDefault();
|
|
139
140
|
if (checkIsValid(usedData)) onSubmit(usedData);
|
|
140
|
-
}
|
|
141
|
+
};
|
|
141
142
|
const onReset = () => {
|
|
142
143
|
if (!useInternalState && onDataChange) {
|
|
143
144
|
onDataChange(JSON.parse(JSON.stringify(originalData)));
|
|
@@ -185,7 +186,7 @@ const Form = _ref => {
|
|
|
185
186
|
onChangedData(false);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
if (onDataChange
|
|
189
|
+
if (onDataChange) onDataChange(usedData);
|
|
189
190
|
|
|
190
191
|
// TODO - Usar debounce para evitar chamada a cada letra digitada
|
|
191
192
|
if (onValidateForm) onValidateForm(checkIsValid(usedData, true));
|
package/lib/form/types.d.ts
CHANGED
|
@@ -38,13 +38,12 @@ type BaseFormProps = {
|
|
|
38
38
|
skeletonize?: boolean;
|
|
39
39
|
disabled?: boolean;
|
|
40
40
|
};
|
|
41
|
-
type OnDataChange = React.Dispatch<React.SetStateAction<any>>;
|
|
42
41
|
type FormProps = BaseFormProps & ({
|
|
43
42
|
useInternalState?: false;
|
|
44
|
-
onDataChange:
|
|
43
|
+
onDataChange: (data: object) => void;
|
|
45
44
|
} | {
|
|
46
45
|
useInternalState: true;
|
|
47
|
-
onDataChange?:
|
|
46
|
+
onDataChange?: (data: object) => void;
|
|
48
47
|
});
|
|
49
48
|
type Data = {
|
|
50
49
|
[key: string]: any;
|
|
@@ -220,4 +219,4 @@ type FieldValidator = {
|
|
|
220
219
|
[name: string]: Validator | Validator[];
|
|
221
220
|
};
|
|
222
221
|
|
|
223
|
-
export
|
|
222
|
+
export { CustomEvent, CustomKeyboardEvent, FieldErrors, FieldValidator, FormContextProps, FormProps, IEventParams, IFieldArrayProps, IFieldPeriodProps, IFieldProps, IFormSecurityContext, IGetErrorMessagesParams, IWithFieldContext, IWithFormSecurity, OnFielChangeEvent, PeriodChangeEvent, PeriodValidator, Validator, WithFieldProps };
|
package/lib/hint/types.d.ts
CHANGED
package/lib/icons/types.d.ts
CHANGED
|
@@ -218,7 +218,8 @@ const InputTextBase = props => {
|
|
|
218
218
|
cols: props.cols
|
|
219
219
|
}, inputProps())) : /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
220
220
|
autoComplete: autoComplete,
|
|
221
|
-
tabIndex: applyTabIndex()
|
|
221
|
+
tabIndex: applyTabIndex(),
|
|
222
|
+
"data-testid": "teste-123"
|
|
222
223
|
}, inputProps())), children), helpers.getRightElements(errorMessages || [], skeletonize, rightElements)), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
223
224
|
disabled: disabled,
|
|
224
225
|
visible: !!hint,
|