hrm_ui_lib 2.0.2 → 2.0.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.
|
@@ -120,7 +120,10 @@ var FormContainer = function FormContainer(props) {
|
|
|
120
120
|
setError: setError,
|
|
121
121
|
dirtyFields: dirtyFields,
|
|
122
122
|
getFieldState: getFieldState,
|
|
123
|
-
unregister: unregister
|
|
123
|
+
unregister: unregister,
|
|
124
|
+
onSubmit: function onSubmit() {
|
|
125
|
+
return handleSubmit(customSubmit)();
|
|
126
|
+
}
|
|
124
127
|
}
|
|
125
128
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, children, buttonConfigs && /*#__PURE__*/React.createElement("div", {
|
|
126
129
|
className: "form-container__buttons"
|
|
@@ -56,7 +56,7 @@ import '../SVGIcons/IconArrowDownloadFilled.js';
|
|
|
56
56
|
import '../../helpers/download-file.js';
|
|
57
57
|
import '../Button/consts.js';
|
|
58
58
|
|
|
59
|
-
var _excluded = ["datePlaceHolderText", "className", "size", "error", "hasError", "label", "mask", "maskChar", "maskPlaceholder", "currentValue", "name", "leftIconProps", "rightIconProps", "disabled", "required", "readonly", "placeholder", "type", "helperText", "successMessage", "maxCount", "setFieldValue", "handleChange", "dataId", "isValid", "allowLeadingZeros", "thousandSeparator", "allowNegative", "hideCounter", "labelAddons", "witUpperCase", "isAllowed", "onChange"];
|
|
59
|
+
var _excluded = ["datePlaceHolderText", "className", "size", "error", "hasError", "label", "mask", "maskChar", "maskPlaceholder", "currentValue", "name", "leftIconProps", "rightIconProps", "disabled", "required", "readonly", "placeholder", "type", "helperText", "successMessage", "maxCount", "setFieldValue", "handleChange", "dataId", "isValid", "allowLeadingZeros", "thousandSeparator", "allowNegative", "hideCounter", "labelAddons", "witUpperCase", "isAllowed", "onChange", "handleBlurEvent"];
|
|
60
60
|
var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
61
61
|
var datePlaceHolderText = _ref.datePlaceHolderText,
|
|
62
62
|
className = _ref.className,
|
|
@@ -98,6 +98,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
98
98
|
witUpperCase = _ref$witUpperCase === void 0 ? false : _ref$witUpperCase,
|
|
99
99
|
isAllowed = _ref.isAllowed,
|
|
100
100
|
onChange = _ref.onChange,
|
|
101
|
+
handleBlurEvent = _ref.handleBlurEvent,
|
|
101
102
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
102
103
|
var isErrorVisible = hasError !== undefined ? hasError : !!error;
|
|
103
104
|
var placeHolder = label === placeholder ? '' : placeholder || datePlaceHolderText;
|
|
@@ -126,6 +127,11 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
126
127
|
}
|
|
127
128
|
return 0;
|
|
128
129
|
}, [rest, currentValue]);
|
|
130
|
+
var onBlurCallback = function onBlurCallback(e) {
|
|
131
|
+
var _rest$onBlur;
|
|
132
|
+
rest === null || rest === void 0 || (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 || _rest$onBlur.call(rest, e);
|
|
133
|
+
handleBlurEvent === null || handleBlurEvent === void 0 || handleBlurEvent(e);
|
|
134
|
+
};
|
|
129
135
|
var input = mask ?
|
|
130
136
|
/*#__PURE__*/
|
|
131
137
|
// @ts-ignore
|
|
@@ -139,6 +145,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
139
145
|
}
|
|
140
146
|
}, rest, {
|
|
141
147
|
placeholder: placeHolder,
|
|
148
|
+
onBlur: onBlurCallback,
|
|
142
149
|
onChange: changeHandler,
|
|
143
150
|
disabled: disabled,
|
|
144
151
|
"data-id": dataId,
|
|
@@ -162,7 +169,8 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
162
169
|
maxLength: maxCount,
|
|
163
170
|
inputMode: 'numeric',
|
|
164
171
|
disabled: disabled,
|
|
165
|
-
isAllowed: isAllowed
|
|
172
|
+
isAllowed: isAllowed,
|
|
173
|
+
onBlur: onBlurCallback
|
|
166
174
|
}, currentValue !== undefined ? {
|
|
167
175
|
value: currentValue
|
|
168
176
|
} : {})) :
|
|
@@ -177,6 +185,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
177
185
|
placeholder: placeHolder,
|
|
178
186
|
"data-id": dataId
|
|
179
187
|
}, rest, {
|
|
188
|
+
onBlur: onBlurCallback,
|
|
180
189
|
onChange: changeHandler
|
|
181
190
|
}, currentValue !== undefined ? {
|
|
182
191
|
value: currentValue
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputHTMLAttributes, ReactElement, RefObject } from 'react';
|
|
1
|
+
import { InputHTMLAttributes, ReactElement, RefObject, FocusEvent } from 'react';
|
|
2
2
|
import { ISVGIconProps } from '../SVGIcons/types';
|
|
3
3
|
export interface InputCustomProps extends IFormCompProps, Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'onFocus' | 'value' | 'onChange' | 'autoComplete'> {
|
|
4
4
|
mask?: string;
|
|
@@ -24,6 +24,7 @@ export interface InputCustomProps extends IFormCompProps, Omit<InputHTMLAttribut
|
|
|
24
24
|
successMessage?: string;
|
|
25
25
|
maxCount?: number;
|
|
26
26
|
onFocus?: (event: TClickEventType) => void;
|
|
27
|
+
handleBlurEvent?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
27
28
|
hideCounter?: boolean;
|
|
28
29
|
allowNegative?: boolean;
|
|
29
30
|
currencySymbol?: string;
|
package/context/types.d.ts
CHANGED
|
@@ -16,5 +16,6 @@ export type TFormContextProps = {
|
|
|
16
16
|
trigger?: UseFormTrigger<TFormData>;
|
|
17
17
|
getFieldState?: UseFormGetFieldState<TFormData>;
|
|
18
18
|
unregister?: UseFormUnregister<TFormData>;
|
|
19
|
+
onSubmit?: () => void;
|
|
19
20
|
};
|
|
20
21
|
export declare const FormContext: import("react").Context<TFormContextProps>;
|