@fto-consult/expo-ui 6.16.5 → 6.16.7
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/src/components/Date/Time.js +9 -7
- package/src/components/Date/TimePickerModal/index.js +8 -2
- package/src/components/Drawer/index.js +24 -1
- package/src/components/Dropdown/index.js +1 -1
- package/src/components/SimpleSelect/index.js +1 -1
- package/src/components/TextField/index.js +3 -2
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import PropTypes from "prop-types";
|
|
|
7
7
|
import theme,{styles} from "$theme";
|
|
8
8
|
import { locale } from "./utils";
|
|
9
9
|
import { TouchableRipple } from "react-native-paper";
|
|
10
|
+
import View from "$ecomponents/View";
|
|
10
11
|
export const getDate = (hours,minutes,seconds)=>{
|
|
11
12
|
return new Date(2000, 1, 1, defaultDecimal(hours), defaultDecimal(minutes),defaultDecimal(seconds))
|
|
12
13
|
}
|
|
@@ -72,7 +73,7 @@ export default function TimePickerComponent (props){
|
|
|
72
73
|
let right = null;
|
|
73
74
|
if(withModal){
|
|
74
75
|
right = (props)=>{
|
|
75
|
-
return
|
|
76
|
+
return <View testID="RN_DatePickerRightContainer" style={[{pointerEvents:isEditable && !disabled ?"auto":"none"},styles.row,styles.justifyContentStart,styles.alignItemsCenter]}>
|
|
76
77
|
<Icon title={label} {...anchorProps}
|
|
77
78
|
icon="clock-outline" onPress={(e)=>{
|
|
78
79
|
React.stopEventPropagation(e);
|
|
@@ -82,7 +83,7 @@ export default function TimePickerComponent (props){
|
|
|
82
83
|
style = {[props.style,anchorProps.style]}
|
|
83
84
|
/>
|
|
84
85
|
{typeof customRight =='function'? customRight(props): customRight}
|
|
85
|
-
|
|
86
|
+
</View>
|
|
86
87
|
}
|
|
87
88
|
} else right = customRight;
|
|
88
89
|
React.useEffect(()=>{
|
|
@@ -111,15 +112,16 @@ export default function TimePickerComponent (props){
|
|
|
111
112
|
if(!disabled){
|
|
112
113
|
containerProps.style = [containerProps.style,{opacity:1}]
|
|
113
114
|
}
|
|
115
|
+
const tCursor = disabled || readOnly ? styles.cursorNotAllowed:styles.cursorPointer;
|
|
114
116
|
const iContainerProps = defaultObj(inputProps.containerProps);
|
|
115
117
|
return <>
|
|
116
118
|
<TouchableRipple {...containerProps}
|
|
117
119
|
disabled = {!isEditable}
|
|
118
|
-
style = {[containerProps.style,
|
|
120
|
+
style = {[containerProps.style,tCursor]}
|
|
119
121
|
onPress = {isEditable?openModal:undefined}
|
|
120
122
|
rippleColor={containerProps.rippleColor}
|
|
121
123
|
>
|
|
122
|
-
|
|
124
|
+
<TextField
|
|
123
125
|
mode = {mode||theme.textFieldMode}
|
|
124
126
|
{...rest}
|
|
125
127
|
{...inputProps}
|
|
@@ -128,12 +130,12 @@ export default function TimePickerComponent (props){
|
|
|
128
130
|
right = {right}
|
|
129
131
|
disabled = {disabled}
|
|
130
132
|
readOnly = {true}
|
|
131
|
-
|
|
132
|
-
style = {[rest.style,!disabled && {
|
|
133
|
+
useReadOnlyOpacity = {!disabled && !readOnly ? false : true}
|
|
134
|
+
style = {[rest.style,tCursor,!disabled && {color:theme.colors.text}]}
|
|
133
135
|
contentContainerProps = {{...defaultObj(rest.contentContainerProps),pointerEvents:'auto'}}
|
|
134
136
|
defaultValue = {state.value}
|
|
135
137
|
placeholder = {formatLabel}
|
|
136
|
-
|
|
138
|
+
/>
|
|
137
139
|
</TouchableRipple>
|
|
138
140
|
{withModal && <TimePickerModal
|
|
139
141
|
{...dialogProps}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {TimePickerModal} from 'react-native-paper-dates'
|
|
1
|
+
import {TimePickerModal} from 'react-native-paper-dates';
|
|
2
|
+
import {PaperProvider} from 'react-native-paper';
|
|
3
|
+
import theme from "$theme";
|
|
2
4
|
|
|
3
|
-
export default
|
|
5
|
+
export default function TimePickerModalComponent(props){
|
|
6
|
+
return <PaperProvider theme={theme}>
|
|
7
|
+
<TimePickerModal {...props}/>
|
|
8
|
+
</PaperProvider>
|
|
9
|
+
}
|
|
@@ -103,8 +103,19 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
103
103
|
callbackRef.current = callback;
|
|
104
104
|
setState({minimized:false,permanent:true});
|
|
105
105
|
}
|
|
106
|
+
const checkToggleBtn = (cb)=>{
|
|
107
|
+
if(!Dimensions.isDesktopMedia() && drawerRef?.current?.isPermanent()){
|
|
108
|
+
setState({permanent:false});
|
|
109
|
+
if(typeof cb ==='function'){
|
|
110
|
+
cb(getDrawerState());
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
106
116
|
|
|
107
117
|
context.toggleMinimized = (minimized,s2)=>{
|
|
118
|
+
if(!checkToggleBtn()) return;
|
|
108
119
|
if(!Dimensions.isDesktopMedia() || typeof minimized !== 'boolean' || !drawerRef.current || !drawerRef.current.isOpen()) return;
|
|
109
120
|
if(!minimizable === false) return;
|
|
110
121
|
let nS = {minimized};
|
|
@@ -119,6 +130,17 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
119
130
|
context.isLeftPosition = ()=> isLeftPosition;
|
|
120
131
|
context.canToggle = x=> canHandleExtra() ? true : permanent? false : true;
|
|
121
132
|
context.canMinimize = x => minimizable !== false && canBeMinimizedOrPermanent() ? true : false;
|
|
133
|
+
context.togglePermanent = (x,cb)=>{
|
|
134
|
+
if(typeof x !== "boolean") return;
|
|
135
|
+
if(!checkToggleBtn(cb)) return;
|
|
136
|
+
const isPerm = drawerRef?.current?.isPermanent();
|
|
137
|
+
if(x && ! isPerm || !x && isPerm){
|
|
138
|
+
setState({permanent:x});
|
|
139
|
+
}
|
|
140
|
+
if(typeof cb =="function"){
|
|
141
|
+
cb(getDrawerState());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
122
144
|
|
|
123
145
|
let {permanent:isPermanent,minimized:isMinimized} = session.get();
|
|
124
146
|
if(_canBeMinimizedOrPermanent && isPermanent){
|
|
@@ -288,9 +310,10 @@ const DrawerComponent = React.forwardRef((props,ref)=>{
|
|
|
288
310
|
drawerRef.current.isOpen = context.isOpen = typeof drawerRef.current.isOpen =='function'? drawerRef.current.isOpen.bind(drawerRef.current) : x=> drawerRef && drawerRef.current ? drawerRef.current.drawerShown : false;
|
|
289
311
|
drawerRef.current.isClosed = context.isClosed = x => !drawerRef.current.isOpen();
|
|
290
312
|
context.toggle = drawerRef.current.toggleDrawer = drawerRef.current.toggle = cb =>{
|
|
313
|
+
if(!checkToggleBtn(cb)) return;
|
|
291
314
|
if(isPermanent || isMinimized) {
|
|
292
315
|
if(typeof cb ==='function'){
|
|
293
|
-
cb(getDrawerState(
|
|
316
|
+
cb(getDrawerState());
|
|
294
317
|
}
|
|
295
318
|
return;
|
|
296
319
|
}
|
|
@@ -894,7 +894,7 @@ class DropdownComponent extends AppComponent {
|
|
|
894
894
|
{<TextField
|
|
895
895
|
defaultValue={selectedText}
|
|
896
896
|
autoHeight = {renderTag}
|
|
897
|
-
useReadOnlyOpacity = {false}
|
|
897
|
+
useReadOnlyOpacity = {!disabled && !readOnly ? false : true}
|
|
898
898
|
{...inputProps}
|
|
899
899
|
{...textInputProps}
|
|
900
900
|
mode = {mode}
|
|
@@ -221,7 +221,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
221
221
|
const pointerEvents = isEditable?"auto":'none';
|
|
222
222
|
const upperStyle = text && (upper || lower) && !isAndroid ? {textTransform:upper?'uppercase':'lowercase'} : null;
|
|
223
223
|
const opacity = disabled ? DISABLED_OPACITY : (useReadOnlyOpacity !== false && !error && (readOnly)) ? READONLY_OPACITY : undefined;
|
|
224
|
-
const disabledStyle =
|
|
224
|
+
const disabledStyle = typeof opacity =="number" ? {opacity} : undefined;
|
|
225
225
|
if((readOnly === true || disabled === true) ){
|
|
226
226
|
selection = defaultObj(selection);
|
|
227
227
|
if(!isNumber(selection.start)){
|
|
@@ -354,6 +354,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
354
354
|
isWeb && { outline: 'none'},
|
|
355
355
|
disabledStyle,
|
|
356
356
|
{height},
|
|
357
|
+
readOnly || disabled && theme.styles.cursorNotAllowed,
|
|
357
358
|
inputStyle2,
|
|
358
359
|
isNormalMode && styles.inputNormalMode,
|
|
359
360
|
isShadowMode && styles.inputShadowMode,
|
|
@@ -751,7 +752,7 @@ TextFieldComponent.propTypes = {
|
|
|
751
752
|
]),
|
|
752
753
|
///le style à afficher sur l'affix
|
|
753
754
|
affixStyle : PropTypes.object,
|
|
754
|
-
handleOpacity : PropTypes.bool,///si l'opacité sera géré automatiquement en fonction du status disabled de la textField
|
|
755
|
+
//handleOpacity : PropTypes.bool,///si l'opacité sera géré automatiquement en fonction du status disabled de la textField
|
|
755
756
|
toCase : PropTypes.func,
|
|
756
757
|
};
|
|
757
758
|
|