@fto-consult/expo-ui 6.83.0 → 6.83.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.83.0",
3
+ "version": "6.83.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
@@ -128,5 +128,6 @@ DateTimePickerComponent.propTypes = {
128
128
  defaultValue : PropTypes.oneOfType([
129
129
  PropTypes.string,
130
130
  PropTypes.object,
131
+ PropTypes.array,
131
132
  ])
132
133
  }
@@ -10,6 +10,9 @@ export const locale = "fr";
10
10
 
11
11
  export const toDateObj = (value,format,force)=>{
12
12
  if(!value) return undefined;
13
+ if(Array.isArray(value)){
14
+ value = value[0] || value[1];
15
+ }
13
16
  if(DateLib.isDateObj(value)) return value;
14
17
  try {
15
18
  const d = new Date(value);
@@ -1,3 +1,7 @@
1
+ /*****
2
+ si la props items est une fonction, alors elle ne doit en aucun cas retourner une promesse,
3
+ mais surtout un tableau un un objet
4
+ */
1
5
  import PropTypes from "prop-types";
2
6
  import View from "$ecomponents/View";
3
7
  import {Dimensions,Pressable,StyleSheet,Animated,} from "react-native";
@@ -602,9 +606,15 @@ class DropdownComponent extends AppComponent {
602
606
  }
603
607
  UNSAFE_componentWillReceiveProps(nextProps){
604
608
  const {items,defaultValue,selected} = nextProps;
605
- if(!React.areEquals(items,this.props.items)){
609
+ const isFunc = typeof nextProps.items == "function";
610
+ if(isFunc || !React.areEquals(items,this.props.items)){
606
611
  const nState = this.prepareItems({items,defaultValue,selected});
607
- return this.updateSelected(nState,true);
612
+ return this.updateSelected(nState,!isFunc);
613
+ const val = this.prepareSelected({defaultValue});
614
+ if(!this.compare(val,this.state.selected)){
615
+ return this.selectValue(defaultValue,true);
616
+ }
617
+ return;
608
618
  }
609
619
  let value = this.prepareSelected({defaultValue});
610
620
  let areEquals = !this.canHandleMultiple ? this.compare(value,this.state.selected) : false;
@@ -788,7 +798,8 @@ class DropdownComponent extends AppComponent {
788
798
  }
789
799
  let menuActions = [];
790
800
  Object.map(dropdownActions,(action,index)=>{
791
- if(!isObj(action) || (!action.text)) return;
801
+ if(!isObj(action) || (!action.text && !!action.label)) return;
802
+ action.text = defaultVal(action.text,action.label);
792
803
  menuActions.push(action);
793
804
  });
794
805
  if(this.isSortable()){
@@ -1289,7 +1300,11 @@ DropdownComponent.propTypes = {
1289
1300
  renderItem : PropTypes.oneOfType([PropTypes.func]),
1290
1301
  /*** la fonction permettant d'afficher le texte du dropdown */
1291
1302
  renderText : PropTypes.func,
1292
- items : PropTypes.oneOfType([PropTypes.object,PropTypes.array,PropTypes.func]),
1303
+ items : PropTypes.oneOfType([
1304
+ PropTypes.object,
1305
+ PropTypes.array,
1306
+ PropTypes.func, //la fonction doit retourner, soit un tableau, soit un objet des données. elle ne doit en aucun cas retourner une promesse
1307
+ ]),
1293
1308
  /**** l'info bulle a associer à l'iconne addIcon */
1294
1309
  addIcon : PropTypes.oneOfType([PropTypes.string,PropTypes.bool]), //l'icon plus
1295
1310
  addIconTooltip : PropTypes.string,