@fto-consult/expo-ui 6.0.0 → 6.1.0
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/babel.config.js +63 -64
- package/package.json +5 -5
- package/src/auth/avatarProps/index.js +1 -1
- package/src/components/AppBar/Content.js +4 -4
- package/src/components/AppBar/index.js +39 -18
- package/src/components/BackHandler/index.android.js +3 -0
- package/src/components/BackHandler/index.js +23 -0
- package/src/components/BottomSheet/Sheet.js +1 -2
- package/src/components/Button/index.js +3 -3
- package/src/components/Checkbox/index.js +2 -3
- package/src/components/Chip/index.js +5 -5
- package/src/components/Color/ColorPicker.js +7 -7
- package/src/components/Color/index.js +5 -5
- package/src/components/Countries/Flag.js +1 -1
- package/src/components/Countries/SelectCountry.js +1 -1
- package/src/components/Datagrid/Common/Common.js +0 -1
- package/src/components/Datagrid/Common/utils.js +1 -2
- package/src/components/Date/DatePickerInput/index.js +4 -4
- package/src/components/Date/Time.js +3 -3
- package/src/components/Dialog/confirm/showConfirmOrAlertOrPrompt.js +1 -1
- package/src/components/DragResize/DragResizeBlock.js +3 -3
- package/src/components/Drawer/DrawerItems/_DrawerItem.js +1 -1
- package/src/components/Dropdown/index.js +9 -17
- package/src/components/Expandable/index.js +1 -1
- package/src/components/Fab/GroupComponent.js +4 -5
- package/src/components/Filter/BetweenComponent.js +1 -1
- package/src/components/Filter/index.js +1 -1
- package/src/components/Form/Fields/Field.js +7 -16
- package/src/components/Form/Fields/{IDField.js → IdField.js} +1 -1
- package/src/components/Form/Fields/SelectTableData/Component.js +1 -1
- package/src/components/Form/FormData/FormData.js +1 -1
- package/src/components/Form/List/List.js +15 -15
- package/src/components/Grid/Cell.js +1 -1
- package/src/components/HeavyScreen/index.js +5 -8
- package/src/components/Icon/Icon.js +13 -5
- package/src/components/Icon/IconButton.js +1 -1
- package/src/components/Image/index.js +6 -7
- package/src/components/Label/index.js +4 -4
- package/src/components/Menu/Item.js +1 -1
- package/src/components/Menu/Menu.js +2 -2
- package/src/components/Menu/index.js +2 -2
- package/src/components/Modal/index.js +3 -3
- package/src/components/PhoneInput/index.js +3 -3
- package/src/components/Radio/index.js +2 -3
- package/src/components/SelectCurrency/Format.js +3 -4
- package/src/components/SelectCurrency/index.js +3 -3
- package/src/components/SimpleSelect/index.js +6 -9
- package/src/components/Slider/index.js +2 -3
- package/src/components/Snackbar/index.js +1 -1
- package/src/components/SplashScreen/index.js +1 -1
- package/src/components/Switch/index.js +3 -4
- package/src/components/Tab/TabItem.js +1 -1
- package/src/components/TextField/index.js +17 -20
- package/src/components/Tooltip/Popover/index.web.js +1 -1
- package/src/components/Tooltip/index.js +1 -1
- package/src/index.js +2 -1
- package/src/layouts/ProfilAvatar/index.js +2 -2
- package/src/layouts/Screen/ScreenWithOrWithoutAuthContainer.js +1 -1
- package/src/layouts/Screen/TableData.js +1 -1
- package/src/screens/ScreenWrapper.js +1 -1
|
@@ -44,10 +44,10 @@ export const timeToString = (value,withSeconds)=>{
|
|
|
44
44
|
return value.substring(0,5);
|
|
45
45
|
}
|
|
46
46
|
export default function TimePickerComponent (props){
|
|
47
|
-
let {right:customRight,upper,anchorProps,dialogProps,withLabel,inputProps,containerProps,mode,onChange,withSeconds,cancelLabel,confirmLabel,label,text,upperCase,defaultValue,disabled,
|
|
47
|
+
let {right:customRight,upper,anchorProps,dialogProps,withLabel,inputProps,containerProps,mode,onChange,withSeconds,cancelLabel,confirmLabel,label,text,upperCase,defaultValue,disabled,withModal,readOnly,...rest} = props;
|
|
48
48
|
rest = defaultObj(rest);
|
|
49
49
|
inputProps = defaultObj(inputProps);
|
|
50
|
-
const isEditable = disabled !== true && readOnly !== true
|
|
50
|
+
const isEditable = disabled !== true && readOnly !== true?true : false;
|
|
51
51
|
withModal = defaultBool(withModal,true);
|
|
52
52
|
if(!isEditable){
|
|
53
53
|
withModal = false;
|
|
@@ -127,7 +127,7 @@ export default function TimePickerComponent (props){
|
|
|
127
127
|
label = {label}
|
|
128
128
|
right = {right}
|
|
129
129
|
disabled = {disabled}
|
|
130
|
-
|
|
130
|
+
readOnly = {true}
|
|
131
131
|
handleOpacity = {false}
|
|
132
132
|
style = {[rest.style,!disabled && {opacity:1,color:theme.colors.text}]}
|
|
133
133
|
contentContainerProps = {{...defaultObj(rest.contentContainerProps),pointerEvents:'auto'}}
|
|
@@ -8,7 +8,7 @@ import React, {Component} from 'react';
|
|
|
8
8
|
import {
|
|
9
9
|
Dimensions,
|
|
10
10
|
View,
|
|
11
|
-
|
|
11
|
+
Pressable,
|
|
12
12
|
} from 'react-native';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
|
|
@@ -713,7 +713,7 @@ export class DragResizeBlock extends Component {
|
|
|
713
713
|
},containerProps.style]}
|
|
714
714
|
testID = {testID}
|
|
715
715
|
>
|
|
716
|
-
<
|
|
716
|
+
<Pressable
|
|
717
717
|
onPress={this.onPress}
|
|
718
718
|
testID = {testID+"_TouchableFeedBack"}
|
|
719
719
|
>
|
|
@@ -727,7 +727,7 @@ export class DragResizeBlock extends Component {
|
|
|
727
727
|
>
|
|
728
728
|
{children}
|
|
729
729
|
</View>
|
|
730
|
-
</
|
|
730
|
+
</Pressable>
|
|
731
731
|
|
|
732
732
|
{isDisabled ? null : this.renderConnectors()}
|
|
733
733
|
|
|
@@ -81,7 +81,7 @@ const DrawerItem = ({icon,iconProps,borderRadius,color,minimized,contentContaine
|
|
|
81
81
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
|
82
82
|
accessibilityTraits={active ? ['button', 'selected'] : 'button'}
|
|
83
83
|
accessibilityComponentType="button"
|
|
84
|
-
|
|
84
|
+
role="button"
|
|
85
85
|
accessibilityState={{ selected: active }}
|
|
86
86
|
accessibilityLabel={accessibilityLabel}
|
|
87
87
|
>
|
|
@@ -506,7 +506,7 @@ class DropdownComponent extends AppComponent {
|
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
force = typeof force !== 'boolean'? false : force;
|
|
509
|
-
if(this.props.disabled === true || this.props.
|
|
509
|
+
if(this.props.disabled === true || this.props.readOnly === true || (force !== true && this.isLoading())) return;
|
|
510
510
|
if(!this.state.visible){
|
|
511
511
|
if(this.props.withBottomSheet){
|
|
512
512
|
getContentHeight(this.anchorRef).then(({height})=>{
|
|
@@ -548,7 +548,7 @@ class DropdownComponent extends AppComponent {
|
|
|
548
548
|
return this.hide(cb);
|
|
549
549
|
}
|
|
550
550
|
canHandleFilter(){
|
|
551
|
-
return this.props.disabled !== true && this.props.readOnly !==true && this.
|
|
551
|
+
return this.props.disabled !== true && this.props.readOnly !==true && this.state.visible ? true : false;
|
|
552
552
|
}
|
|
553
553
|
focus = ()=>{
|
|
554
554
|
if(this.canHandleFilter() && this.inputRef && this.inputRef.current){
|
|
@@ -659,7 +659,6 @@ class DropdownComponent extends AppComponent {
|
|
|
659
659
|
visible: _visible,
|
|
660
660
|
itemProps,
|
|
661
661
|
disabled,
|
|
662
|
-
editable,
|
|
663
662
|
readOnly,
|
|
664
663
|
defaultValue,
|
|
665
664
|
selectedColor,
|
|
@@ -722,13 +721,7 @@ class DropdownComponent extends AppComponent {
|
|
|
722
721
|
itemProps = defaultObj(itemProps);
|
|
723
722
|
disabled = defaultBool(disabled,false);
|
|
724
723
|
readOnly = defaultBool(readOnly,false);
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if(!readOnly){
|
|
728
|
-
readOnly = editable === false ? true : false;
|
|
729
|
-
editable = !readOnly;
|
|
730
|
-
}
|
|
731
|
-
|
|
724
|
+
|
|
732
725
|
listProps = defaultObj(listProps);
|
|
733
726
|
selectedColor = (Colors.isValid(selectedColor)? selectedColor : theme.colors.primaryOnSurface);
|
|
734
727
|
this.selectedColor = selectedColor;
|
|
@@ -736,19 +729,19 @@ class DropdownComponent extends AppComponent {
|
|
|
736
729
|
const {layout:inputLayout,selectedText,visible,isFiltering,filterText} = this.state;
|
|
737
730
|
const self = this,state = this.state;
|
|
738
731
|
const canHandle = !this.isLoading();
|
|
739
|
-
const canFilter = !disabled && !readOnly &&
|
|
732
|
+
const canFilter = !disabled && !readOnly && visible;
|
|
740
733
|
const isMob = isMobileOrTabletMedia();
|
|
741
734
|
inputProps = defaultObj(inputProps);
|
|
742
735
|
const contentContainerProps = Object.assign({},inputProps.contentContainerProps);
|
|
743
736
|
const containerProps = Object.assign({},inputProps.containerProps);
|
|
744
|
-
const inputRest = {disabled,
|
|
737
|
+
const inputRest = {disabled,readOnly,label,error}
|
|
745
738
|
clearTimeout(this.doSearchFilter);
|
|
746
739
|
this.doSearchFilter = null;
|
|
747
740
|
mode = defaultStr(mode,inputProps.mode);
|
|
748
741
|
const textInputProps = {
|
|
749
742
|
...inputRest,
|
|
750
743
|
mode,
|
|
751
|
-
|
|
744
|
+
disabled,
|
|
752
745
|
style : StyleSheet.flatten([styles.input,inputProps.style])
|
|
753
746
|
}
|
|
754
747
|
const dimensions = Dimensions.get("window");
|
|
@@ -757,11 +750,11 @@ class DropdownComponent extends AppComponent {
|
|
|
757
750
|
if(isMob){
|
|
758
751
|
contentContainerHeight = '95%';
|
|
759
752
|
}
|
|
760
|
-
const iconDisabled = !canHandle || disabled || readOnly
|
|
753
|
+
const iconDisabled = !canHandle || disabled || readOnly ?true : false;
|
|
761
754
|
const pointerEvents = iconDisabled?"none":"auto";
|
|
762
755
|
addIconTooltip = defaultStr(addIconTooltip,'Ajouter un élément');
|
|
763
756
|
addIconProps = defaultObj(addIconProps);
|
|
764
|
-
if(disabled || readOnly
|
|
757
|
+
if(disabled || readOnly){
|
|
765
758
|
showAdd = false;
|
|
766
759
|
}
|
|
767
760
|
if(typeof showAdd ==='function'){
|
|
@@ -912,7 +905,6 @@ class DropdownComponent extends AppComponent {
|
|
|
912
905
|
readOnly = {readOnly}
|
|
913
906
|
//divider = {canHandle}
|
|
914
907
|
alwaysUseLabel = {renderTag?true : false}
|
|
915
|
-
editable = {false}
|
|
916
908
|
contentContainerProps = {{
|
|
917
909
|
...contentContainerProps,
|
|
918
910
|
pointerEvents:iconDisabled && (!enableCopy && disabled)?'none':'auto',
|
|
@@ -975,7 +967,7 @@ class DropdownComponent extends AppComponent {
|
|
|
975
967
|
restProps.pointerEvents = "auto";
|
|
976
968
|
}
|
|
977
969
|
const renderingItems = this.getItems();
|
|
978
|
-
const isDisabled =
|
|
970
|
+
const isDisabled = readOnly || disabled?true:false;
|
|
979
971
|
const isBigList = this.isBigList;
|
|
980
972
|
const ListComponent = isBigList ? BigList : List;
|
|
981
973
|
const autoFocus = canAutoFocusSearchField({visible,items:renderingItems});
|
|
@@ -110,7 +110,7 @@ const ExpandableComponent = React.forwardRef(({
|
|
|
110
110
|
borderless = {false}
|
|
111
111
|
accessibilityTraits="button"
|
|
112
112
|
accessibilityComponentType="button"
|
|
113
|
-
|
|
113
|
+
role="button"
|
|
114
114
|
style={[styles.container,props.style]}
|
|
115
115
|
onPress={handlePressAction}
|
|
116
116
|
onLongPress={onLongPress}
|
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
StyleSheet,
|
|
4
4
|
Animated,
|
|
5
5
|
SafeAreaView,
|
|
6
|
-
|
|
7
|
-
TouchableWithoutFeedback,
|
|
6
|
+
TouchableWithoutFeedback
|
|
8
7
|
} from 'react-native';
|
|
9
8
|
import View from "$ecomponents/View";
|
|
10
9
|
import {FAB,Text,Card,withTheme} from "react-native-paper";
|
|
@@ -175,7 +174,7 @@ const FABGroup = ({
|
|
|
175
174
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
|
176
175
|
accessibilityTraits="button"
|
|
177
176
|
accessibilityComponentType="button"
|
|
178
|
-
|
|
177
|
+
role="button"
|
|
179
178
|
accessibilityState={{ expanded: open }}
|
|
180
179
|
style={StyleSheet.flatten([styles.fab, fabStyle])}
|
|
181
180
|
visible={visible}
|
|
@@ -311,7 +310,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
|
311
310
|
}
|
|
312
311
|
accessibilityTraits="button"
|
|
313
312
|
accessibilityComponentType="button"
|
|
314
|
-
|
|
313
|
+
role="button"
|
|
315
314
|
>
|
|
316
315
|
<Text testID={testID+"_Label"} style={StyleSheet.flatten([{ color},cursorStyle])}>
|
|
317
316
|
{label}
|
|
@@ -346,7 +345,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
|
346
345
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
|
347
346
|
accessibilityTraits="button"
|
|
348
347
|
accessibilityComponentType="button"
|
|
349
|
-
|
|
348
|
+
role="button"
|
|
350
349
|
testID={testID}
|
|
351
350
|
visible={open}
|
|
352
351
|
/>
|
|
@@ -12,7 +12,7 @@ const FilterBetweenComponent = React.forwardRef(({inputProps,contentContainerPro
|
|
|
12
12
|
ref = {ref}
|
|
13
13
|
{...props}
|
|
14
14
|
contentContainerProps={contentContainerProps}
|
|
15
|
-
inputProps = {{...defaultObj(inputProps),pointerEvents:"none",
|
|
15
|
+
inputProps = {{...defaultObj(inputProps),style : [inputProps?.style,{pointerEvents:"none"}],readOnly:true}}
|
|
16
16
|
type ="text"
|
|
17
17
|
format = {undefined}
|
|
18
18
|
onChange = {(e)=>false}
|
|
@@ -506,7 +506,7 @@ export default class Filter extends AppComponent {
|
|
|
506
506
|
const ignoreDefaultValue = (isPeriodAction||isBetweenAction) && isNonNullString(defaultValue) && defaultValue.contains("=>");
|
|
507
507
|
rest.defaultValue = defaultValue;
|
|
508
508
|
rest.disabled = rest.readOnly = rest.affix = false;
|
|
509
|
-
rest.
|
|
509
|
+
rest.readOnly = false;
|
|
510
510
|
rest.style = [style];
|
|
511
511
|
rest.type = type;
|
|
512
512
|
const isMob = isMobileMedia() || withBottomSheet;
|
|
@@ -860,7 +860,6 @@ export default class Field extends AppComponent {
|
|
|
860
860
|
disabled,
|
|
861
861
|
visible,
|
|
862
862
|
readOnly,
|
|
863
|
-
editable,
|
|
864
863
|
beforeValidate,
|
|
865
864
|
footer,
|
|
866
865
|
archived,
|
|
@@ -898,12 +897,12 @@ export default class Field extends AppComponent {
|
|
|
898
897
|
disabled = true;
|
|
899
898
|
readOnly = true;
|
|
900
899
|
rest.disabled = rest.readOnly = true;
|
|
901
|
-
rest.
|
|
900
|
+
rest.readOnly = true;
|
|
902
901
|
} else if(this.isEnabledBySymbol()){
|
|
903
902
|
disabled = readOnly = false;
|
|
904
|
-
|
|
903
|
+
readOnly = false;
|
|
905
904
|
rest.disabled = rest.readOnly = false;
|
|
906
|
-
rest.
|
|
905
|
+
rest.readOnly = false;
|
|
907
906
|
} else {
|
|
908
907
|
const callArgs = {context:this,field:this.name,name:this.name,value:this.validatingValue,validValue:this.state.validValue,...rest,data,props:this.props};
|
|
909
908
|
readOnly = defaultVal(readOnly);
|
|
@@ -911,11 +910,7 @@ export default class Field extends AppComponent {
|
|
|
911
910
|
readOnly = readOnly.call(this,callArgs);
|
|
912
911
|
}
|
|
913
912
|
if(!isUndefined(readOnly)) readOnly = readOnly?true:false;
|
|
914
|
-
|
|
915
|
-
editable = editable.call(this,callArgs);
|
|
916
|
-
}
|
|
917
|
-
if(isBool(editable)) editable = editable;
|
|
918
|
-
else rest.editable = readOnly ? false : true;
|
|
913
|
+
else rest.readOnly = readOnly ? true : false;
|
|
919
914
|
if(isFunction(disabled)){
|
|
920
915
|
disabled = disabled.call(this,callArgs);
|
|
921
916
|
}
|
|
@@ -925,16 +920,12 @@ export default class Field extends AppComponent {
|
|
|
925
920
|
archived = archived.call(this,callArgs);
|
|
926
921
|
}
|
|
927
922
|
if(archived === true){
|
|
928
|
-
|
|
923
|
+
readOnly = false;
|
|
929
924
|
disabled = true;
|
|
930
925
|
}
|
|
931
|
-
if(readOnly || disabled){
|
|
932
|
-
editable = false;
|
|
933
|
-
}
|
|
934
926
|
rest.disabled = disabled;
|
|
935
927
|
rest.readOnly = readOnly;
|
|
936
|
-
|
|
937
|
-
if(disabled || readOnly || !editable){
|
|
928
|
+
if(disabled || readOnly){
|
|
938
929
|
this[this.isEditableSymbol] = false;
|
|
939
930
|
}
|
|
940
931
|
}
|
|
@@ -966,7 +957,7 @@ export default class Field extends AppComponent {
|
|
|
966
957
|
format = defaultStr(format);
|
|
967
958
|
tooltip = defaultVal(tooltip,title);
|
|
968
959
|
|
|
969
|
-
const isEditable = rest.disabled !== true && rest.readOnly !== true
|
|
960
|
+
const isEditable = rest.disabled !== true && rest.readOnly !== true ? true : false;
|
|
970
961
|
const hasDefaultValue = isNonNullString(rest.defaultValue) || typeof rest.defaultValue =='number'? true : false;
|
|
971
962
|
const canChangeRight = this.isTextField() && !isEditable && hasDefaultValue;
|
|
972
963
|
if(canChangeRight){
|
|
@@ -89,7 +89,7 @@ export default class FormIDField extends TextField {
|
|
|
89
89
|
props.contentContainerProps.pointerEvents = defaultStr(props.contentContainerProps.pointerEvents,"auto");
|
|
90
90
|
props.enableCopy = typeof props.enableCopy ==='boolean'? props.enableCopy : (props.defaultValue || this.newFieldIdValue ? true : false);
|
|
91
91
|
const {right} = props;
|
|
92
|
-
props.
|
|
92
|
+
props.readOnly = typeof props.disabled ==='boolean' ? !!!props.disabled : typeof props.readOnly =="boolean"? !!!props.disabled : false;
|
|
93
93
|
props.right = (props)=>{
|
|
94
94
|
const r = typeof right =='function'? right (props) : React.isValidElement(right)? right : null;
|
|
95
95
|
if(!defValue){
|
|
@@ -82,7 +82,7 @@ const TableDataSelectField = React.forwardRef(({foreignKeyColumn,prepareFilters:
|
|
|
82
82
|
}
|
|
83
83
|
const foreignKeyColumnValue = props.defaultValue;
|
|
84
84
|
let isDisabled = defaultBool(props.disabled,props.readOnly,false);
|
|
85
|
-
if(!isDisabled && props.
|
|
85
|
+
if(!isDisabled && props.readOnly === true){
|
|
86
86
|
isDisabled = true;
|
|
87
87
|
}
|
|
88
88
|
if(isUpdate && isNonNullString(foreignKeyColumnValue) && (isDisabled)){
|
|
@@ -262,7 +262,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
262
262
|
text,
|
|
263
263
|
title,
|
|
264
264
|
indexField,
|
|
265
|
-
|
|
265
|
+
readOnly,addIcon,
|
|
266
266
|
addIconLabel,
|
|
267
267
|
onRemove,onSave,
|
|
268
268
|
onDelete,
|
|
@@ -347,12 +347,12 @@ export default class FormListComponent extends AppComponent {
|
|
|
347
347
|
selectedRowsActions = selectedRowsActions(args);
|
|
348
348
|
}
|
|
349
349
|
selectedRowsActions = isObjOrArray(selectedRowsActions)? selectedRowsActions : []
|
|
350
|
-
let
|
|
350
|
+
let readOnly = defaultVal(datagridProps.readOnly,this.props.readOnly);
|
|
351
351
|
let deletable = defaultVal(datagridProps.deletable,this.props.deletable);
|
|
352
352
|
let _sActs = isObj(selectedRowsActions)? {} : [];
|
|
353
|
-
if(
|
|
353
|
+
if(!readOnly){
|
|
354
354
|
let _edit = {
|
|
355
|
-
text : isNonNullString(
|
|
355
|
+
text : isNonNullString(readOnly)? readOnly:'Modifier l\'élément',
|
|
356
356
|
icon : 'pencil',
|
|
357
357
|
onPress : (args)=>{
|
|
358
358
|
let {selectedRows} = args;
|
|
@@ -360,7 +360,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
360
360
|
let index = keys[0];
|
|
361
361
|
let data = Object.assign({},selectedRows[index]);
|
|
362
362
|
let pArgs = {...args,data,index,allData:allData,selectedRows};
|
|
363
|
-
const canEdit = defaultVal(isFunction(
|
|
363
|
+
const canEdit = defaultVal(isFunction(readOnly)?readOnly.call(context,pArgs):readOnly,false)
|
|
364
364
|
if(canEdit){
|
|
365
365
|
return this.show(pArgs);
|
|
366
366
|
}
|
|
@@ -434,7 +434,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
434
434
|
renderAvatar,context,primaryText,show,title,indexField,
|
|
435
435
|
allData : customAllData,
|
|
436
436
|
controlled,
|
|
437
|
-
|
|
437
|
+
readOnly,addIcon,addIconLabel,onRemove,onSave,onDelete,
|
|
438
438
|
beforeSave,beforeRemove,formDataProps,formName,
|
|
439
439
|
itemProps,avatarProps,secondaryText,content,
|
|
440
440
|
itemContainerProps,
|
|
@@ -495,14 +495,14 @@ export default class FormListComponent extends AppComponent {
|
|
|
495
495
|
|
|
496
496
|
let canRenderTable = this.canRenderDatagrid(fields);
|
|
497
497
|
|
|
498
|
-
if(typeof
|
|
499
|
-
|
|
498
|
+
if(typeof readOnly =='undefined'){
|
|
499
|
+
readOnly = false;
|
|
500
500
|
}
|
|
501
501
|
if(typeof deletable =='undefined'){
|
|
502
502
|
deletable = true;
|
|
503
503
|
}
|
|
504
504
|
const deletableFunc = typeof deletable =='function'? args => defaultVal(deletable.call(context,args,true)) : x => deletable;
|
|
505
|
-
const
|
|
505
|
+
const readOnlyFunc = typeof readOnly =='function'? args => defaultVal(deletable.call(context,args),false) : x => readOnly;
|
|
506
506
|
const isCurrentDisplayTable = canRenderTable && this.state.display === 'table';
|
|
507
507
|
let listContent = null;
|
|
508
508
|
if(isCurrentDisplayTable){
|
|
@@ -513,7 +513,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
513
513
|
},datagridProps)
|
|
514
514
|
dgProps.progressbar = defaultVal(dgProps.progressbar,<Datagrid.LinesProgressBar/>)
|
|
515
515
|
delete dgProps.deletable;
|
|
516
|
-
delete dgProps.
|
|
516
|
+
delete dgProps.readOnly;
|
|
517
517
|
let _fields = extendObj(true,{},fields,datagridProps.fields)
|
|
518
518
|
this.restDatagridProps = dgProps;
|
|
519
519
|
this._onRowsClick = dgProps.onRowPress;
|
|
@@ -572,7 +572,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
572
572
|
counter++;
|
|
573
573
|
const pArgs = {avatarProps,context,itemProps,data:data,index,allData:allData};
|
|
574
574
|
const deletable = deletableFunc(pArgs),
|
|
575
|
-
|
|
575
|
+
readOnly = readOnlyFunc(pArgs);
|
|
576
576
|
let avatar = renderAvatar.call(context,pArgs);
|
|
577
577
|
const avatarProps = Object.assign({},avatarProps);
|
|
578
578
|
if(isObj(avatar)){
|
|
@@ -597,7 +597,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
597
597
|
index,
|
|
598
598
|
_index,
|
|
599
599
|
deletable,
|
|
600
|
-
|
|
600
|
+
readOnly,
|
|
601
601
|
key,
|
|
602
602
|
props : {
|
|
603
603
|
...itemProps,
|
|
@@ -612,7 +612,7 @@ export default class FormListComponent extends AppComponent {
|
|
|
612
612
|
return itx;
|
|
613
613
|
}}
|
|
614
614
|
renderItem = {({item})=>{
|
|
615
|
-
const {data,title,description,key,_index,props,index,
|
|
615
|
+
const {data,title,description,key,_index,props,index,readOnly,deletable} = item;
|
|
616
616
|
const titleText = React.getTextContent(title);
|
|
617
617
|
return <View key={key} testID={testID+".Cell"+key} style={[theme.styles.w100]}>
|
|
618
618
|
<Surface key={key} elevation={5} {...itemContainerProps} style={[styles.itemContainer,itemContainerProps.style]}>
|
|
@@ -625,9 +625,9 @@ export default class FormListComponent extends AppComponent {
|
|
|
625
625
|
description={description}
|
|
626
626
|
descriptionStyle = {[{color:theme.colors.text},props.descriptionStyle]}
|
|
627
627
|
style = {[props.style,styles.item]}
|
|
628
|
-
right = {
|
|
628
|
+
right = {readOnly && !deletable?undefined : (rProps)=>{
|
|
629
629
|
return <View {...rProps} style={[styles.itemRight]}>
|
|
630
|
-
{
|
|
630
|
+
{readOnly?null:<Icon title={"Modifier ["+titleText+"]"} name={"pencil"} color={theme.colors.secondary} onPress = {(e)=>{
|
|
631
631
|
React.stopEventPropagation(e);
|
|
632
632
|
this.show({data:{...data},index,_index,allData,context})
|
|
633
633
|
}} ></Icon>}
|
|
@@ -111,7 +111,7 @@ GridCellComponent.propTypes = {
|
|
|
111
111
|
PropTypes.number,
|
|
112
112
|
]),
|
|
113
113
|
withSurface : PropTypes.bool,
|
|
114
|
-
elevation : PropTypes.number
|
|
114
|
+
elevation : PropTypes.number,
|
|
115
115
|
contentProps : PropTypes.object,
|
|
116
116
|
}
|
|
117
117
|
const styles = StyleSheet.create({
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React from '$react';
|
|
2
2
|
import {useAfterInteractions } from "./utils";
|
|
3
|
-
import { Transition
|
|
3
|
+
import { Transition } from 'react-native-reanimated'
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import {Animated} from "react-native";
|
|
5
6
|
import { StylePropTypes } from '$theme';
|
|
6
7
|
import {isNumber,defaultStr} from "$cutils";
|
|
7
8
|
|
|
8
9
|
const OptimizedHeavyScreen = React.forwardRef(({
|
|
9
|
-
transition = (<Transition.Together>
|
|
10
|
-
<Transition.Change interpolation="easeInOut" />
|
|
11
|
-
<Transition.In type="fade" />
|
|
12
|
-
</Transition.Together>),
|
|
13
10
|
style,
|
|
14
11
|
children:cChildren,
|
|
15
12
|
isLoading,
|
|
@@ -26,14 +23,14 @@ const OptimizedHeavyScreen = React.forwardRef(({
|
|
|
26
23
|
if(enabled === false) return children;
|
|
27
24
|
placeholder = React.isComponent(Placeholder)? <Placeholder /> : React.isValidElement(Placeholder)? Placeholder : null;
|
|
28
25
|
return (
|
|
29
|
-
<
|
|
26
|
+
<Animated.View
|
|
30
27
|
testID={defaultStr(testID,'RN_OptimizedHeavyScreen')}
|
|
31
|
-
transition={transition}
|
|
28
|
+
//transition={transition}
|
|
32
29
|
style={[{flex:1},style]}
|
|
33
30
|
ref={React.useMergeRefs(transitionRef,ref)}
|
|
34
31
|
>
|
|
35
32
|
{areInteractionsComplete && isLoading !==true ? (children) : placeholder}
|
|
36
|
-
</
|
|
33
|
+
</Animated.View>
|
|
37
34
|
)
|
|
38
35
|
});
|
|
39
36
|
|
|
@@ -6,7 +6,7 @@ import React from "$react";
|
|
|
6
6
|
import {IconButton} from "react-native-paper"
|
|
7
7
|
|
|
8
8
|
const IconComponentRef = React.forwardRef((props,ref)=>{
|
|
9
|
-
let {icon,style,Component,button,color,name,...rest} = props;
|
|
9
|
+
let {icon,style,Component,button,color,name,containerColor,...rest} = props;
|
|
10
10
|
icon = defaultVal(icon,name);
|
|
11
11
|
if(isNonNullString(icon)){
|
|
12
12
|
icon = icon.trim().ltrim("")
|
|
@@ -22,14 +22,22 @@ const IconComponentRef = React.forwardRef((props,ref)=>{
|
|
|
22
22
|
if(button === false){
|
|
23
23
|
flattenedStyle.borderRadius = 0;
|
|
24
24
|
}
|
|
25
|
+
const C = React.isComponent(Component)?Component:IconButton;
|
|
25
26
|
const iconColor = Colors.isValid(color) ? color : Colors.isValid(rest.iconColor)? rest.iconColor : Colors.isValid(flattenedStyle.color)? flattenedStyle.color : theme.colors.text
|
|
27
|
+
const restP = {};
|
|
28
|
+
if(C == IconButton){
|
|
29
|
+
restP.iconColor = iconColor;
|
|
30
|
+
restP.containerColor = Colors.isValid(containerColor)? containerColor : Colors.isValid(flattenStyle.backgroundColor) ? flattenStyle.backgroundColor : "transparent";
|
|
31
|
+
} else {
|
|
32
|
+
restP.color = iconColor;
|
|
33
|
+
}
|
|
26
34
|
return <Tooltip
|
|
27
35
|
animated
|
|
28
|
-
{...
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
{...restP}
|
|
37
|
+
{...rest}
|
|
38
|
+
testID = {defaultStr(rest.testID,"RN_IconComponent")}
|
|
31
39
|
style = {flattenedStyle}
|
|
32
|
-
Component={
|
|
40
|
+
Component={C}
|
|
33
41
|
ref = {ref}
|
|
34
42
|
/>
|
|
35
43
|
});
|
|
@@ -69,7 +69,7 @@ const IconButtonComponent = ({
|
|
|
69
69
|
// @ts-expect-error We keep old a11y props for backwards compat with old RN versions
|
|
70
70
|
accessibilityTraits={disabled ? ['button', 'disabled'] : 'button'}
|
|
71
71
|
accessibilityComponentType="button"
|
|
72
|
-
|
|
72
|
+
role="button"
|
|
73
73
|
accessibilityState={{ disabled }}
|
|
74
74
|
disabled={disabled}
|
|
75
75
|
hitSlop={
|
|
@@ -55,7 +55,7 @@ export default function ImageComponent(props){
|
|
|
55
55
|
})*/
|
|
56
56
|
const [isDrawing,setIsDrawing] = React.useState(false);
|
|
57
57
|
let {disabled,onMount,defaultSource,onUnmount,label,text,labelProps,readOnly,beforeRemove,
|
|
58
|
-
onChange,draw,round,drawText,drawLabel,rounded,
|
|
58
|
+
onChange,draw,round,drawText,drawLabel,rounded,defaultSrc,
|
|
59
59
|
createSignatureOnly,pickImageProps,width,height,cropProps,size,resizeProps,containerProps,
|
|
60
60
|
menuProps,pickUri,drawProps,imageProps,length,testID,...rest} = props;
|
|
61
61
|
rest = defaultObj(rest);
|
|
@@ -72,9 +72,8 @@ export default function ImageComponent(props){
|
|
|
72
72
|
drawProps = defaultObj(drawProps);
|
|
73
73
|
const flattenStyle = StyleSheet.flatten(props.style) || {};
|
|
74
74
|
defaultSrc = defaultVal(defaultSrc);
|
|
75
|
-
editable = defaultBool(editable,false);
|
|
76
75
|
if(disabled){
|
|
77
|
-
|
|
76
|
+
readOnly = true;
|
|
78
77
|
}
|
|
79
78
|
React.useEffect(()=>{
|
|
80
79
|
if(src == props.src) return;
|
|
@@ -211,7 +210,7 @@ export default function ImageComponent(props){
|
|
|
211
210
|
imageProps = defaultObj(imageProps);
|
|
212
211
|
testID = defaultStr(testID,"RN_ImageComponent");
|
|
213
212
|
let menuItems = []
|
|
214
|
-
if(
|
|
213
|
+
if(!readOnly){
|
|
215
214
|
menuItems.push({
|
|
216
215
|
label : 'Sélect Image',
|
|
217
216
|
icon :'image-search',
|
|
@@ -232,7 +231,7 @@ export default function ImageComponent(props){
|
|
|
232
231
|
}
|
|
233
232
|
})();
|
|
234
233
|
|
|
235
|
-
if(canUpdate &&
|
|
234
|
+
if(canUpdate && !readOnly){
|
|
236
235
|
menuItems.push({
|
|
237
236
|
key : 'has-photo',
|
|
238
237
|
label : 'Retirer la photo',
|
|
@@ -240,7 +239,7 @@ export default function ImageComponent(props){
|
|
|
240
239
|
onPress : x=> context.deleteImage()
|
|
241
240
|
})
|
|
242
241
|
}
|
|
243
|
-
if(false && defaultBool(draw ,true) &&
|
|
242
|
+
if(false && defaultBool(draw ,true) && !readOnly){
|
|
244
243
|
menuItems.push({
|
|
245
244
|
key : "drawImageCustom",
|
|
246
245
|
label : defaultString(drawText,drawLabel,'Faire un dessin'),
|
|
@@ -308,7 +307,7 @@ const styles = StyleSheet.create ({
|
|
|
308
307
|
ImageComponent.propTypes = {
|
|
309
308
|
containerProps : PropTypes.object,//les props du container entre le lable et l'image rendu
|
|
310
309
|
menuProps : PropTypes.object, ///les props du menu d'édition du composant,
|
|
311
|
-
|
|
310
|
+
readOnly : PropTypes.bool,
|
|
312
311
|
disabled: PropTypes.bool,
|
|
313
312
|
pickUri : PropTypes.bool,////si l'uri sera retournée lorsqu'on pick l'image en lieu et place du dataURL
|
|
314
313
|
imageProps : PropTypes.object, ///les props supplémentaires du composant Image
|
|
@@ -10,7 +10,7 @@ const defaultSelectable = canTextBeSelectable();
|
|
|
10
10
|
|
|
11
11
|
export const EllipsizeMode = {'head':'head','middle':'middle', 'tail':'tail' , 'clip':'clip'}
|
|
12
12
|
|
|
13
|
-
const LabelComponent = React.forwardRef(({ children,color,upperCase,fontSize,testID,wrap,
|
|
13
|
+
const LabelComponent = React.forwardRef(({ children,color,upperCase,fontSize,testID,wrap,id,wrapText,error,underlined,splitText,secondary,primary,bold,textBold,disabled,text,style,...rest},ref)=> {
|
|
14
14
|
children = defaultVal(children,text);
|
|
15
15
|
let isText = false;
|
|
16
16
|
if(!React.isValidElement(children) && Array.isArray(children) && children.length){
|
|
@@ -43,7 +43,7 @@ const LabelComponent = React.forwardRef(({ children,color,upperCase,fontSize,tes
|
|
|
43
43
|
|
|
44
44
|
style = Object.assign({},StyleSheet.flatten(style));
|
|
45
45
|
testID = defaultStr(testID,"RN_LabelComponent");
|
|
46
|
-
const restProps = {
|
|
46
|
+
const restProps = {id};
|
|
47
47
|
if(splitText){
|
|
48
48
|
restProps.numberOfLines = defaultNumber(restProps.numberOfLines,1);
|
|
49
49
|
restProps.ellipsizeMode = defaultStr(restProps.ellipsizeMode,'tail');
|
|
@@ -80,8 +80,8 @@ const LabelComponent = React.forwardRef(({ children,color,upperCase,fontSize,tes
|
|
|
80
80
|
}
|
|
81
81
|
if(React.isValidElement(children)){
|
|
82
82
|
if(!hasP) {
|
|
83
|
-
if(
|
|
84
|
-
return <View ref = {ref} testID = {testID}
|
|
83
|
+
if(id || ref){
|
|
84
|
+
return <View ref = {ref} testID = {testID} id={id}>{children}</View>
|
|
85
85
|
}
|
|
86
86
|
return <>{children}</>
|
|
87
87
|
}
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
Platform,
|
|
6
6
|
StyleSheet,
|
|
7
7
|
Animated,
|
|
8
|
-
BackHandler,
|
|
9
8
|
Dimensions,
|
|
10
9
|
Easing,
|
|
11
10
|
I18nManager,
|
|
12
11
|
TouchableWithoutFeedback,
|
|
13
12
|
findNodeHandle,
|
|
14
13
|
} from 'react-native';
|
|
14
|
+
import BackHandler from "$ecomponents/BackHandler";
|
|
15
15
|
import PropTypes from "prop-types";
|
|
16
16
|
import { withTheme,Surface,Portal} from 'react-native-paper';
|
|
17
17
|
//import Surface from "$components/Surface";
|
|
@@ -475,7 +475,7 @@ class _Menu extends AppComponent {
|
|
|
475
475
|
{rendered ? <TouchableWithoutFeedback
|
|
476
476
|
testID={testID+"_TouchableWithoutFeedBack"}
|
|
477
477
|
accessibilityLabel={overlayAccessibilityLabel}
|
|
478
|
-
|
|
478
|
+
role="button"
|
|
479
479
|
onPress={onDismiss}
|
|
480
480
|
style = {[hiddenStyle]}
|
|
481
481
|
>
|