@fto-consult/expo-ui 7.17.3 → 7.17.5

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": "7.17.3",
3
+ "version": "7.17.5",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -291,7 +291,7 @@ export default class CommonDatagridComponent extends AppComponent {
291
291
  this.renderProgressBar = this.renderProgressBar.bind(this);
292
292
  this.sortRef.current.dir = defaultStr(this.sortRef.current.dir,this.sortRef.current.column == "date"?"desc":'asc')
293
293
  this.hasColumnsHalreadyInitialized = false;
294
- this.initColumns(props.columns);
294
+ this.state.columns = this.initColumns(props.columns);
295
295
  if(!isNonNullString(this.sortRef.current.column) && "date" in this.state.columns){
296
296
  this.sortRef.current.column = "date";
297
297
  }
@@ -323,7 +323,7 @@ export default class CommonDatagridComponent extends AppComponent {
323
323
  if(!("sparkline" in this.state.config) && this.isDashboard()){
324
324
  this.state.config.sparkline = true;
325
325
  }
326
- const dType = defaultStr(this.props.displayType,this.getSessionData("displayType"),"table");
326
+ const dType = defaultStr(this.getSessionData("displayType"),this.props.displayType,"table");
327
327
  this.state.displayType = this.displayTypes[dType] ? this.displayTypes[dType].code : "table" in this.displayTypes ? "table" : Object.keys(this.displayTypes)[0]?.code;
328
328
  this.state.displayOnlySectionListHeaders = defaultBool(this.getSessionData("displayOnlySectionListHeaders"),this.props.displayOnlySectionListHeaders,false)
329
329
  if(this.state.displayOnlySectionListHeaders){
@@ -696,10 +696,10 @@ export default class CommonDatagridComponent extends AppComponent {
696
696
  }
697
697
  initColumnsCallback(){}
698
698
  initColumns (columns){
699
- this.state.columns = {};
699
+ const newColumns = {};
700
700
  let colIndex = 0;
701
701
  if(this.canHandleSelectableColumn()){
702
- this.state.columns[this.getSelectableColumName()] = {
702
+ newColumns[this.getSelectableColumName()] = {
703
703
  field : this.getSelectableColumName(),
704
704
  style : this.getSelectableColumNameStyle(),
705
705
  width : 40,
@@ -712,7 +712,7 @@ export default class CommonDatagridComponent extends AppComponent {
712
712
  }
713
713
  if(this.canHandleIndexColumn()){
714
714
  colIndex++;
715
- this.state.columns [this.getIndexColumnName()] = {
715
+ newColumns [this.getIndexColumnName()] = {
716
716
  filter : false,
717
717
  visible : true,
718
718
  width : 50,
@@ -748,7 +748,7 @@ export default class CommonDatagridComponent extends AppComponent {
748
748
  colIndex++;
749
749
  header.visible = defaultVal(header.visible,true);
750
750
  header.colIndex = colIndex;
751
- this.state.columns[header.field] = header;
751
+ newColumns[header.field] = header;
752
752
  /*** les pieds de pages sont les données de type decimal, où qu'on peut compter */
753
753
  if(header.footer !== false && ((arrayValueExists(['decimal','number','money'],header.type) && header.format) || header.format == 'money' || header.format =='number')){
754
754
  footers[header.field] = Object.clone(header);
@@ -758,7 +758,7 @@ export default class CommonDatagridComponent extends AppComponent {
758
758
  }
759
759
  });
760
760
  this.rowKeysColumns = Object.keys(rowKeysColumns);
761
- return footers;
761
+ return newColumns;
762
762
  }
763
763
  getFootersFields(init){
764
764
  this[this.footerFieldName] = init === true ? {} : defaultObj(this[this.footerFieldName]);
@@ -3676,6 +3676,21 @@ export default class CommonDatagridComponent extends AppComponent {
3676
3676
  return false;
3677
3677
  }
3678
3678
  UNSAFE_componentWillReceiveProps(nextProps){
3679
+ if(false && !React.areEquals(this.props.columns,nextProps.columns)){
3680
+ const newColumns = this.initColumns(nextProps.columns);
3681
+ console.log("will prepare column ",newColumns,this.state.columns);
3682
+ this.setIsLoading(true,()=>{
3683
+ this.setState({columns:newColumns},()=>{
3684
+ this.prepareColumns();
3685
+ console.log("preparing data ",nextProps);
3686
+ this.prepareData({...nextProps,force:true},(state)=>{
3687
+ console.log("setting state data",state,this.state);
3688
+ this.setState(state)
3689
+ })
3690
+ })
3691
+ },0);
3692
+ return;
3693
+ }
3679
3694
  const cb = ()=>{
3680
3695
  if(typeof nextProps.isLoading =='boolean' && nextProps.isLoading !== this.isLoading()){
3681
3696
  this.setIsLoading(nextProps.isLoading);