1
1
import React , { useEffect , useRef , useState , useImperativeHandle , useCallback , DOMAttributes } from 'react' ;
2
- import PropTypes from 'prop-types' ;
2
+ // import PropTypes from 'prop-types';
3
3
// import {type} from 'jb-date-input';
4
4
import 'jb-date-input' ;
5
5
// eslint-disable-next-line no-duplicate-imports
@@ -33,6 +33,7 @@ export type JBDateInputEventType<T> = T & {
33
33
}
34
34
export type JBDateInputProps = {
35
35
label ?: string ,
36
+ style ?:string ,
36
37
name ?:string ,
37
38
min ?: string ,
38
39
max ?: string ,
@@ -44,7 +45,7 @@ export type JBDateInputProps = {
44
45
valueType ?: 'GREGORIAN' | 'JALALI' | 'TIME_STAMP' ,
45
46
inputType ?: 'GREGORIAN' | 'JALALI' ,
46
47
direction ?: 'ltr' | 'rtl' ,
47
- value : string | null | undefined ,
48
+ value : string | Date | null | undefined ,
48
49
validationList ?: JBDateInputValidationItem [ ] ,
49
50
required ?: boolean ,
50
51
calendarDefaultDateView ?:{ year :number , month : number , dateType :JBDateInputInputTypes } ,
@@ -124,6 +125,13 @@ export const JBDateInput = React.forwardRef((props: JBDateInputProps, ref) => {
124
125
element . current . value = props . value ;
125
126
}
126
127
} , [ props . value ] ) ;
128
+ useEffect ( ( ) => {
129
+ if ( element . current ) {
130
+ if ( typeof props . style == "string" ) {
131
+ element . current . setAttribute ( "style" , props . style ) ;
132
+ }
133
+ }
134
+ } , [ props . style ] ) ;
127
135
useEffect ( ( ) => {
128
136
if ( element . current && Array . isArray ( props . validationList ) ) {
129
137
element . current . validationList = props . validationList ;
@@ -160,24 +168,24 @@ export const JBDateInput = React.forwardRef((props: JBDateInputProps, ref) => {
160
168
) ;
161
169
} ) ;
162
170
JBDateInput . displayName = "JBDateInput" ;
163
- JBDateInput . propTypes = {
164
- label : PropTypes . string ,
165
- name :PropTypes . string ,
166
- className :PropTypes . string ,
167
- min : PropTypes . string ,
168
- max : PropTypes . string ,
169
- format : PropTypes . string ,
170
- onKeyup : PropTypes . func ,
171
- onChange : PropTypes . func ,
172
- onSelect : PropTypes . func ,
173
- valueType : PropTypes . oneOf ( [ 'GREGORIAN' , 'JALALI' , 'TIME_STAMP' ] ) ,
174
- inputType : PropTypes . oneOf ( [ 'GREGORIAN' , 'JALALI' ] ) ,
175
- direction : PropTypes . oneOf ( [ 'ltr' , 'rtl' ] ) ,
176
- value : PropTypes . string ,
177
- validationList : PropTypes . array ,
178
- required : PropTypes . bool ,
179
- calendarDefaultDateView : PropTypes . shape ( { year : PropTypes . number . isRequired , month : PropTypes . number . isRequired , dateType : PropTypes . oneOf < JBDateInputInputTypes > ( [ JBDateInputInputTypes . gregorian , JBDateInputInputTypes . jalali ] ) . isRequired } ) ,
180
- // calendarDefaultDateView: PropTypes.object,
181
- usePersianNumber : PropTypes . bool ,
182
- // children:PropTypes.element
183
- } ;
171
+ // JBDateInput.propTypes = {
172
+ // label: PropTypes.string,
173
+ // name:PropTypes.string,
174
+ // className:PropTypes.string,
175
+ // min: PropTypes.string,
176
+ // max: PropTypes.string,
177
+ // format: PropTypes.string,
178
+ // onKeyup: PropTypes.func,
179
+ // onChange: PropTypes.func,
180
+ // onSelect: PropTypes.func,
181
+ // valueType: PropTypes.oneOf(['GREGORIAN', 'JALALI', 'TIME_STAMP']),
182
+ // inputType: PropTypes.oneOf(['GREGORIAN', 'JALALI']),
183
+ // direction: PropTypes.oneOf(['ltr', 'rtl']),
184
+ // value: PropTypes.string,
185
+ // validationList: PropTypes.array,
186
+ // required: PropTypes.bool,
187
+ // calendarDefaultDateView: PropTypes.shape({ year: PropTypes.number.isRequired, month: PropTypes.number.isRequired, dateType: PropTypes.oneOf<JBDateInputInputTypes>([JBDateInputInputTypes.gregorian, JBDateInputInputTypes.jalali]).isRequired }),
188
+ // // calendarDefaultDateView: PropTypes.object,
189
+ // usePersianNumber: PropTypes.bool,
190
+ // // children:PropTypes.element
191
+ // };
0 commit comments