@fto-consult/expo-ui 6.17.0 → 6.17.2
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
CHANGED
|
@@ -26,6 +26,8 @@ export * from "./utils";
|
|
|
26
26
|
//const isNative = isNativeMobile();
|
|
27
27
|
const isAndroid = _isAndroid() //|| isAndroidMobileBrowser();
|
|
28
28
|
const isWeb = _isWeb();
|
|
29
|
+
const MAX_HEIGHT = 250;
|
|
30
|
+
const N_LINE_HEIGHT = 16;
|
|
29
31
|
|
|
30
32
|
const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
31
33
|
let {defaultValue,toCase:toCustomCase,color,validType,validRule,placeholder,outlined,placeholderColor,
|
|
@@ -295,7 +297,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
295
297
|
const currentDefaultValue = alwaysUseLabel && displayText == emptyValue ? "" : displayText;
|
|
296
298
|
const withAutoHeight = typeof autoHeight === 'boolean'? autoHeight : false;
|
|
297
299
|
const height = withAutoHeight || multiline ? undefined : tHeight;
|
|
298
|
-
const inputStyle2 = withAutoHeight || multiline ? {height : heightRef.current} : null;
|
|
300
|
+
const inputStyle2 = withAutoHeight || multiline ? {height : Math.min(heightRef.current,250)} : null;
|
|
299
301
|
const containerStyle = StyleSheet.flatten(containerProps.style) || {};
|
|
300
302
|
const inputProps= {
|
|
301
303
|
caretHidden : false,
|
|
@@ -358,6 +360,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
358
360
|
inputStyle2,
|
|
359
361
|
isNormalMode && styles.inputNormalMode,
|
|
360
362
|
isShadowMode && styles.inputShadowMode,
|
|
363
|
+
isShadowMode && multiline && styles.inputMultipleShadowMode,
|
|
361
364
|
//isShadowMode && multiline && {minHeight:heightRef.current},
|
|
362
365
|
multiline && {paddingTop : isFlatMode? 12 : 7},
|
|
363
366
|
],
|
|
@@ -373,7 +376,17 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
373
376
|
onContentSizeChange : (e,...rest) => {
|
|
374
377
|
if(typeof onContentSizeChange ==='function' && onContentSizeChange(e,...rest) === false) return;
|
|
375
378
|
if(multiline){
|
|
376
|
-
|
|
379
|
+
const mH = e.nativeEvent.contentSize.height;
|
|
380
|
+
const width = e.nativeEvent.contentSize.width;
|
|
381
|
+
if(width>10){
|
|
382
|
+
const txt = defaultStr(displayText);
|
|
383
|
+
const nC = txt.split("\n").length;
|
|
384
|
+
const nbCharsByLine = width/4;//le nombre de caractère par line à supposer qu'un caractère vaut 4pixel, length caractère vallent combien ?
|
|
385
|
+
const maxHeight = N_LINE_HEIGHT*(nC+ (txt.length/nbCharsByLine))+MULTIPLE_HEIGHT;//la hauteur maximale sur la base de la maxHeight
|
|
386
|
+
heightRef.current = Math.min(maxHeight,mH);
|
|
387
|
+
} else {
|
|
388
|
+
heightRef.current = Math.min(mH,MAX_HEIGHT)
|
|
389
|
+
}
|
|
377
390
|
setToggle(!toggle);
|
|
378
391
|
}
|
|
379
392
|
},
|
|
@@ -387,7 +400,7 @@ const TextFieldComponent = React.forwardRef((componentProps,inputRef)=>{
|
|
|
387
400
|
const tVal = toCase(text2);
|
|
388
401
|
if(tVal !== text){
|
|
389
402
|
if(multiline && tVal.toLowerCase()+"\n" === text.toLowerCase()){
|
|
390
|
-
heightRef.current = Math.max(heightRef.current -
|
|
403
|
+
heightRef.current = Math.max(heightRef.current - N_LINE_HEIGHT,MULTIPLE_HEIGHT);
|
|
391
404
|
}
|
|
392
405
|
setText(text2,true);
|
|
393
406
|
callOnChange(tVal);
|
|
@@ -694,6 +707,10 @@ const styles = StyleSheet.create({
|
|
|
694
707
|
marginVertical:0,
|
|
695
708
|
paddingVertical:0,
|
|
696
709
|
},
|
|
710
|
+
inputMultipleShadowMode : {
|
|
711
|
+
paddingHorizontal : 7,
|
|
712
|
+
paddingVertical : 7,
|
|
713
|
+
}
|
|
697
714
|
})
|
|
698
715
|
|
|
699
716
|
TextFieldComponent.propTypes = {
|
|
@@ -187,10 +187,9 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
187
187
|
const isMobOrTab = isMobileOrTabletMedia();
|
|
188
188
|
let archived = this.isArchived();
|
|
189
189
|
const fields = {};
|
|
190
|
-
const fieldsToPrepare = extendObj({},true,this.fields,customFields);
|
|
191
190
|
const {
|
|
192
191
|
actions,
|
|
193
|
-
fields:
|
|
192
|
+
fields:preparedFields,
|
|
194
193
|
onKeyEvent,
|
|
195
194
|
canMakePhoneCall : customCanMakePhoneCall,
|
|
196
195
|
makePhoneCallProps : customMakePhoneCallProps,
|
|
@@ -218,11 +217,11 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
218
217
|
prepareField,
|
|
219
218
|
prepareComponentProps,
|
|
220
219
|
...rest
|
|
221
|
-
} = this.prepareComponentProps({...props,tableName,fields:
|
|
220
|
+
} = this.prepareComponentProps({...props,tableName,fields:extendObj({},true,this.fields,props.fields),isUpdated,isUpdate:isUpdated,data,datas,currentIndex});
|
|
222
221
|
const sessionName = this.getSessionName();
|
|
223
222
|
const prepareCb = typeof prepareField =='function'? prepareField : x=> x;
|
|
224
223
|
///on effectue une mutator sur le champ en cours de modification
|
|
225
|
-
Object.map(
|
|
224
|
+
Object.map(preparedFields,(field,i,counterIndex)=>{
|
|
226
225
|
const currentField = isObj(field)?Object.clone(field):field;
|
|
227
226
|
if(isObj(field)){
|
|
228
227
|
const columnField = defaultStr(currentField.field,i);
|
|
@@ -237,7 +236,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
|
|
|
237
236
|
currentField.readOnly = true;
|
|
238
237
|
}
|
|
239
238
|
});
|
|
240
|
-
const cArgs = {field:currentField,columnField,columnDef:currentField,isUpdate:isUpdated,name:columnField,index:i,counterIndex,isPrimary,fields:
|
|
239
|
+
const cArgs = {field:currentField,columnField,columnDef:currentField,isUpdate:isUpdated,name:columnField,index:i,counterIndex,isPrimary,fields:preparedFields,contex:this,data:this.getCurrentData(),datas,currentIndex,isUpdated,tableName,table};
|
|
241
240
|
if(isUpdated){
|
|
242
241
|
//la props readOnlyOnEditing permet de rendre le champ readOnly en cas de mise à jour de la tableData
|
|
243
242
|
const readOnlyOnEditing = typeof currentField.readOnlyOnEditing =='function'? currentField.readOnlyOnEditing(cArgs) : currentField.readOnlyOnEditing;
|