@steroidsjs/core 3.0.0-beta.69 → 3.0.0-beta.70
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/package.json +1 -1
- package/ui/form/AutoCompleteField/AutoCompleteField.js +4 -1
- package/ui/form/InputField/InputField.d.ts +3 -3
- package/ui/form/NumberField/NumberField.d.ts +2 -1
- package/ui/form/NumberField/NumberField.js +1 -1
- package/ui/form/PasswordField/PasswordField.js +4 -1
- package/ui/form/TextField/TextField.d.ts +1 -1
- package/ui/form/TextField/TextField.js +4 -1
package/package.json
CHANGED
|
@@ -92,7 +92,10 @@ function AutoCompleteField(props) {
|
|
|
92
92
|
props.inputProps.onBlur(e);
|
|
93
93
|
}
|
|
94
94
|
}, [onClose, props.inputProps, props.isOpened]);
|
|
95
|
-
var inputProps = (0, react_1.useMemo)(function () {
|
|
95
|
+
var inputProps = (0, react_1.useMemo)(function () {
|
|
96
|
+
var _a;
|
|
97
|
+
return (__assign(__assign({}, props.inputProps), { type: 'text', name: props.input.name, defaultValue: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', placeholder: props.placeholder, disabled: props.disabled, onChange: onChange, onBlur: onBlur }));
|
|
98
|
+
}, [onBlur, onChange, props.disabled, props.input.name, props.input.value, props.inputProps, props.placeholder]);
|
|
96
99
|
//Sync with form
|
|
97
100
|
(0, react_1.useEffect)(function () {
|
|
98
101
|
props.input.onChange.call(null, selectedIds[0] || null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { MaskitoOptions } from '@maskito/core';
|
|
4
4
|
import { IFieldWrapperInputProps, IFieldWrapperOutputProps } from '../Field/fieldWrapper';
|
|
5
5
|
export declare const MASK_PRESETS: {
|
|
@@ -17,7 +17,7 @@ export interface IBaseFieldProps extends IFieldWrapperInputProps, IUiComponent {
|
|
|
17
17
|
* Свойства для элемента input
|
|
18
18
|
* @example {onKeyDown: ...}
|
|
19
19
|
*/
|
|
20
|
-
inputProps?:
|
|
20
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
21
21
|
/**
|
|
22
22
|
* Показывать иконку очищения поля
|
|
23
23
|
* @example true
|
|
@@ -88,7 +88,7 @@ export interface IInputFieldViewProps extends IInputFieldProps, IFieldWrapperOut
|
|
|
88
88
|
onChange: (value: any) => void;
|
|
89
89
|
value: string | number;
|
|
90
90
|
placeholder: string;
|
|
91
|
-
disabled:
|
|
91
|
+
disabled: boolean;
|
|
92
92
|
};
|
|
93
93
|
onClear?: () => void;
|
|
94
94
|
onFocus?: (e: Event | React.FocusEvent) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
1
2
|
import { IBaseFieldProps } from '../InputField/InputField';
|
|
2
3
|
import { IFieldWrapperOutputProps } from '../Field/fieldWrapper';
|
|
3
4
|
/**
|
|
@@ -26,7 +27,7 @@ export interface INumberFieldViewProps extends INumberFieldProps, IFieldWrapperO
|
|
|
26
27
|
inputProps: {
|
|
27
28
|
type: string;
|
|
28
29
|
name: string;
|
|
29
|
-
onChange: (value: string) => void;
|
|
30
|
+
onChange: (value: ChangeEvent<HTMLInputElement> | string) => void;
|
|
30
31
|
value: number;
|
|
31
32
|
placeholder: string;
|
|
32
33
|
disabled: boolean;
|
|
@@ -21,7 +21,7 @@ function NumberField(props) {
|
|
|
21
21
|
var components = (0, hooks_1.useComponents)();
|
|
22
22
|
props.inputProps = (0, react_1.useMemo)(function () {
|
|
23
23
|
var _a;
|
|
24
|
-
return (__assign({ name: props.input.name,
|
|
24
|
+
return (__assign({ name: props.input.name, defaultValue: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onChange: function (value) { return props.input.onChange(value); }, type: 'number', min: props.min, max: props.max, step: props.step, placeholder: props.placeholder, disabled: props.disabled }, props.inputProps));
|
|
25
25
|
}, [props.disabled, props.input, props.inputProps, props.placeholder, props.min, props.max, props.step]);
|
|
26
26
|
return components.ui.renderView(props.view || 'form.NumberFieldView', props);
|
|
27
27
|
}
|
|
@@ -50,7 +50,10 @@ function PasswordField(props) {
|
|
|
50
50
|
var _a = (0, react_1.useState)('password'), type = _a[0], setType = _a[1];
|
|
51
51
|
var components = (0, hooks_1.useComponents)();
|
|
52
52
|
var onClear = (0, react_1.useCallback)(function () { return props.input.onChange(''); }, [props.input]);
|
|
53
|
-
props.inputProps = (0, react_1.useMemo)(function () {
|
|
53
|
+
props.inputProps = (0, react_1.useMemo)(function () {
|
|
54
|
+
var _a;
|
|
55
|
+
return (__assign({ name: props.input.name, defaultValue: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onChange: function (value) { return props.input.onChange(value); }, type: type, placeholder: props.placeholder, disabled: props.disabled }, props.inputProps));
|
|
56
|
+
}, [props.disabled, props.input, props.inputProps, props.placeholder, type]);
|
|
54
57
|
props.securityLevel = props.showSecurityBar ? (0, exports.checkPassword)(props.input.value) : null;
|
|
55
58
|
props.onShowPassword = function () { return setType('text'); };
|
|
56
59
|
props.onHidePassword = function () { return setType('password'); };
|
|
@@ -16,7 +16,7 @@ export interface ITextFieldViewProps extends ITextFieldProps, IFieldWrapperOutpu
|
|
|
16
16
|
inputProps: {
|
|
17
17
|
name: string;
|
|
18
18
|
onChange: (value: string | ChangeEvent) => void;
|
|
19
|
-
onKeyUp: KeyboardEventHandler
|
|
19
|
+
onKeyUp: KeyboardEventHandler;
|
|
20
20
|
value: string | number;
|
|
21
21
|
placeholder: string;
|
|
22
22
|
disabled: boolean;
|
|
@@ -32,7 +32,10 @@ function TextField(props) {
|
|
|
32
32
|
}, [props.formId, props.submitOnEnter]);
|
|
33
33
|
var onChange = (0, react_1.useCallback)(function (e) { return props.input.onChange.call(null, e.target ? e.target.value : e.nativeEvent.text); }, [props.input.onChange]);
|
|
34
34
|
var onClear = (0, react_1.useCallback)(function () { return props.input.onChange(''); }, [props.input]);
|
|
35
|
-
var inputProps = (0, react_1.useMemo)(function () {
|
|
35
|
+
var inputProps = (0, react_1.useMemo)(function () {
|
|
36
|
+
var _a;
|
|
37
|
+
return (__assign({ name: props.input.name, defaultValue: (_a = props.input.value) !== null && _a !== void 0 ? _a : '', onChange: onChange, onKeyUp: onKeyUp, placeholder: props.placeholder, disabled: props.disabled }, props.inputProps));
|
|
38
|
+
}, [onKeyUp, onChange, props.disabled, props.input.name, props.input.value, props.inputProps, props.placeholder]);
|
|
36
39
|
return components.ui.renderView(props.view || 'form.TextFieldView', __assign(__assign({}, props), { inputProps: inputProps, onClear: onClear }));
|
|
37
40
|
}
|
|
38
41
|
TextField.defaultProps = {
|