@zuzjs/ui 0.2.6 → 0.2.8
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/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/comps/input.tsx +4 -0
package/dist/index.js
CHANGED
|
@@ -556,7 +556,7 @@ const UPDATE_FORM_FIELD = (formName, field, value, forms) => {
|
|
|
556
556
|
};
|
|
557
557
|
|
|
558
558
|
const Input = forwardRef((props, ref) => {
|
|
559
|
-
const { as, accept, multiple, onChange, onKeyUp, type, tag, placeholder, name, form, touched, onSubmit, defaultValue, fref } = props;
|
|
559
|
+
const { as, accept, multiple, onChange, onKeyUp, onClick, readOnly, type, tag, placeholder, name, form, touched, onSubmit, defaultValue, fref } = props;
|
|
560
560
|
const dispatch = useDispatch(STORE_FORM_KEY);
|
|
561
561
|
const { forms } = useStore(state => state[STORE_FORM_KEY], false);
|
|
562
562
|
let Tag = tag || 'input';
|
|
@@ -574,7 +574,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
574
574
|
: e.currentTarget.value;
|
|
575
575
|
dispatch(dispatch(UPDATE_FORM_FIELD(form || 'orphan', name, val == "" ? null : val, forms)));
|
|
576
576
|
onChange && onChange(val == "" ? null : val);
|
|
577
|
-
}, onBlur: e => {
|
|
577
|
+
}, onClick: onClick ? onClick : () => { }, readOnly: readOnly || false, onBlur: e => {
|
|
578
578
|
}, onFocus: e => touched == false && dispatch(UPDATE_FORM_FIELD(form || 'orphan', `touched`, true, forms)) }) }));
|
|
579
579
|
});
|
|
580
580
|
|
package/package.json
CHANGED
package/src/comps/input.tsx
CHANGED
|
@@ -23,6 +23,8 @@ const Input = forwardRef((props : { [ key: string ] : any }, ref : LegacyRef<HTM
|
|
|
23
23
|
multiple,
|
|
24
24
|
onChange,
|
|
25
25
|
onKeyUp,
|
|
26
|
+
onClick,
|
|
27
|
+
readOnly,
|
|
26
28
|
type,
|
|
27
29
|
tag,
|
|
28
30
|
placeholder,
|
|
@@ -67,6 +69,8 @@ const Input = forwardRef((props : { [ key: string ] : any }, ref : LegacyRef<HTM
|
|
|
67
69
|
dispatch( dispatch( UPDATE_FORM_FIELD( form || 'orphan', name, val == "" ? null : val, forms ) ) );
|
|
68
70
|
onChange && onChange(val == "" ? null : val)
|
|
69
71
|
}}
|
|
72
|
+
onClick={onClick ? onClick : () => {}}
|
|
73
|
+
readOnly={readOnly || false}
|
|
70
74
|
onBlur={e => {
|
|
71
75
|
if(touched){}
|
|
72
76
|
}}
|