@fto-consult/expo-ui 6.25.2 → 6.26.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.
Files changed (35) hide show
  1. package/babel.config.alias.js +1 -1
  2. package/package.json +2 -1
  3. package/src/components/Datagrid/Accordion/Row.js +24 -20
  4. package/src/components/Datagrid/Accordion/index.js +5 -8
  5. package/src/components/Datagrid/Common/Common.js +155 -129
  6. package/src/components/Datagrid/utils.js +5 -1
  7. package/src/components/Dialog/DialogContent.js +2 -2
  8. package/src/components/Dropdown/index.js +1 -2
  9. package/src/components/Label/index.js +12 -4
  10. package/src/components/List/Common.js +3 -10
  11. package/src/components/List/Virtuoso/index.js +4 -2
  12. package/src/components/List/hooks.js +23 -13
  13. package/src/components/Table/Header/CellHeader.js +0 -1
  14. package/src/components/Table/Row/Cell/Content.js +2 -2
  15. package/src/components/Table/Row/RowWrapper.native.js +1 -1
  16. package/src/components/Table/index.js +3 -3
  17. package/src/print/createPDF/index.js +20 -0
  18. package/src/print/formatText.js +84 -0
  19. package/src/print/index.js +13 -0
  20. package/src/print/pdf/formats/defaultFormats.js +28 -0
  21. package/src/print/pdf/formats/defaultPageFormat.js +1 -0
  22. package/src/print/pdf/formats/defaultPageOrientation.js +1 -0
  23. package/src/print/pdf/formats/fields.js +139 -0
  24. package/src/print/pdf/formats/formats.js +8 -0
  25. package/src/print/pdf/formats/index.js +10 -0
  26. package/src/print/pdf/formats/renderItem.js +8 -0
  27. package/src/print/pdf/index.js +2 -0
  28. package/src/print/pdf/paperSizes/all.js +1948 -0
  29. package/src/print/pdf/paperSizes/index.js +4 -0
  30. package/src/print/pdf/paperSizes/iso.js +493 -0
  31. package/src/print/qrCode.js +44 -0
  32. package/src/print/svg/index.js +25 -0
  33. package/src/print/toPdfMakeObj.js +51 -0
  34. package/src/print/utils.js +1840 -0
  35. package/src/screens/Help/openLibraries.js +1 -1
@@ -83,7 +83,7 @@ module.exports = (opts)=>{
83
83
  const outputPath = path.resolve(HelpScreen,"openLibraries.js");
84
84
  r.$nodeModulesPath = r.$enodeModulesPath= nodeModulesPath;
85
85
  require("./find-licenses")({
86
- paths : [root,r["$expo-ui-root-path",path.resolve(process.cwd())]],
86
+ paths : [root,r["$expo-ui-root-path"],path.resolve(process.cwd())],
87
87
  nodeModulesPath : nodeModulesPath,
88
88
  outputPath
89
89
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.25.2",
3
+ "version": "6.26.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -92,6 +92,7 @@
92
92
  "fs-extra": "^11.1.1",
93
93
  "google-libphonenumber": "^3.2.33",
94
94
  "htmlparser2-without-node-native": "^3.9.2",
95
+ "pdfmake": "^0.2.7",
95
96
  "process": "^0.11.10",
96
97
  "prop-types": "^15.8.1",
97
98
  "react": "^18.2.0",
@@ -64,7 +64,6 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
64
64
  let rowIndex = defaultDecimal(index);
65
65
  let rowIndexCount = index+1;
66
66
  const testID = defaultStr(props.testID,"RN_DatagridAccordionRow"+(rowKey||rowIndex))
67
- let _rP = {}
68
67
  const hasAvatar = React.isValidElement(avatarContent);
69
68
  const handleRowToggle = (event)=>{
70
69
  if(selectable === false) return;
@@ -75,8 +74,8 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
75
74
  }
76
75
  const wrapStyle = React.useMemo(()=>{
77
76
  return getRowStyle({row:item,index,selected,numColumns,isAccordion:true,rowIndex:index});
78
- },[selected])
79
- let viewWrapperStyle = {};
77
+ },[selected,numColumns]);
78
+ const viewWrapperStyle = [];
80
79
  if(selected) {
81
80
  const handleAvatarRowToggle = (event)=>{
82
81
  React.stopEventPropagation(event);
@@ -93,7 +92,8 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
93
92
  title = {sTtitle}
94
93
  ></Avatar> : null;
95
94
  if(!hasAvatar){
96
- viewWrapperStyle = [styles.hasNotAvatar,{borderLeftColor:theme.colors.primaryOnSurface}]
95
+ viewWrapperStyle.push(styles.hasNotAvatar);
96
+ viewWrapperStyle.push({borderLeftColor:theme.colors.primaryOnSurface})
97
97
  }
98
98
  }
99
99
 
@@ -105,26 +105,24 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
105
105
  icon = {"information-outline"}
106
106
  ></Avatar>
107
107
  }
108
- } else if(selectable === false){
109
- _rP.disabled = true;
110
108
  }
111
109
  right = typeof right === 'function'? right ({color:theme.colors.primaryOnSurface,selectable:true,style:[rStyles.lineHeight,styles.right]}) : right;
112
110
  const swipeableRef = React.useRef(null);
113
111
  return <Pressable
114
- {..._rP}
112
+ disabled = {selectable===false?true : false}
115
113
  {...rowProps}
116
114
  testID={testID}
117
115
  children = {null}
118
116
  onPress = {toggleExpander}
119
117
  onLongPress={handleRowToggle}
120
118
  style = {[
121
- _rP.style,rowProps.style,
122
119
  styles.container,
123
- numColumns > 1 && {width:'99%'},
124
120
  styles.bordered,
125
- wrapperStyle,
126
121
  wrapStyle,
127
- style,
122
+ rowProps.style,
123
+ numColumns > 1 && styles.multiColumns,
124
+ selected && styles.selected,
125
+ //style,
128
126
  ]}
129
127
  ref = {React.useMergeRefs(ref,innerRef)}
130
128
  >
@@ -221,11 +219,17 @@ const styles = StyleSheet.create({
221
219
  bordered : {
222
220
  //borderColor: "#ced4da",
223
221
  //borderWidth : 1,
222
+ //paddingHorizontal:10,
223
+ },
224
+ multiColumns : {
225
+ paddingHorizontal : 5,
226
+ width : "98%"
224
227
  },
225
228
  renderedContent : {
226
229
  flexDirection : 'row',
227
230
  alignItems : 'center',
228
- justifyContent : 'center'
231
+ justifyContent : 'center',
232
+ paddingVertical : 10,
229
233
  },
230
234
  right : {
231
235
  marginHorizontal : 0,
@@ -244,25 +248,25 @@ const styles = StyleSheet.create({
244
248
  alignSelf : 'flex-start',
245
249
  },
246
250
  container : {
247
- marginVertical : 10,
248
- paddingVertical : 5,
249
- paddingHorizontal : isMobileNative()? 10 : 0,
251
+ paddingVertical : 0,
252
+ paddingHorizontal : 0,
250
253
  marginHorizontal : 5,
251
254
  flexWrap : 'nowrap',
252
255
  justifyContent : 'center',
253
256
  width : '100%',
254
257
  },
255
- containerSelected : {
256
- paddingLeft : 2,
257
- },
258
258
  avatarContent : {
259
259
  marginRight : 5,
260
260
  },
261
261
  hasNotAvatar : {
262
262
  borderLeftWidth : 5,
263
- paddingLeft : 2,
263
+ paddingLeft : 0,
264
264
  height : "100%"
265
- }
265
+ },
266
+ selected : {
267
+ paddingHorizontal : 0,
268
+ paddingVertical : 0,
269
+ },
266
270
  });
267
271
 
268
272
  DatagridAccordionRow.displayName = 'DatagridAccordionRow';
@@ -23,7 +23,7 @@ import RenderType from "../RenderType";
23
23
  import { flatMode} from "$ecomponents/TextField";
24
24
  import List from "$ecomponents/Table/List";
25
25
  import theme,{Colors} from "$theme";
26
- import {getRowStyle,styles as rStyles} from "../utils";
26
+ import {styles as rStyles} from "../utils";
27
27
  import Avatar from "$ecomponents/Avatar";
28
28
  import {defaultObj,isOb,isNonNullString} from "$cutils";
29
29
  import PropTypes from "prop-types";
@@ -94,13 +94,10 @@ const DatagridFactory = (Factory)=>{
94
94
  const formatValue = this.formatValue.bind(this);
95
95
  return {...this.getActionsArgs(),valueFormatter:formatValue,formatValue,abreviateValues:this.state.abreviateValues,row:item,items:this.state.data,item,rowData:item,index,rowIndex:index,rowCounterIndex:rowIndexCount,rowIndexCount};
96
96
  }
97
- getRenderingItemProps ({item,rowKey,numColumns,index}){
97
+ getRenderingItemProps ({item,rowKey,index}){
98
98
  this.renderingItemsProps = isObj(this.renderingItemsProps)? this.renderingItemsProps : {};
99
- const wrapperStyle = getRowStyle({row:item,index,numColumns,isAccordion:true,rowIndex:index});
100
99
  if(this.renderingItemsProps[rowKey]){
101
- const it = this.renderingItemsProps[rowKey];
102
- it.wrapperStyle = wrapperStyle;
103
- return it;
100
+ return this.renderingItemsProps[rowKey];
104
101
  }
105
102
  const callArgs = this.getItemCallArgs({item,index});
106
103
  const accordion = this.props.accordion;
@@ -169,7 +166,7 @@ const DatagridFactory = (Factory)=>{
169
166
  }
170
167
  this.renderingItemsProps[rowKey] = {
171
168
  testID,
172
- wrapperStyle,title,right,rightProps,description,avatarContent,rowProps,avatarProps,
169
+ title,right,rightProps,description,avatarContent,rowProps,avatarProps,
173
170
  bottomSheetTitlePrefix : defaultStr(renderedContent?.bottomSheetTitlePrefix,accordionProps.bottomSheetTitlePrefix,accordion?.bottomSheetTitlePrefix)
174
171
  }
175
172
  return this.renderingItemsProps[rowKey];
@@ -200,8 +197,8 @@ const DatagridFactory = (Factory)=>{
200
197
  selectable = {this.props.selectable}
201
198
  {...defaultObj(this.props.accordionProps)}
202
199
  accordion = {this.props.accordion}
200
+ {...this.getRenderingItemProps({item,index,rowKey})}
203
201
  numColumns = {numColumns}
204
- {...this.getRenderingItemProps({item,numColumns,index,rowKey})}
205
202
  key = {index}
206
203
  ref = {(el)=>{
207
204
  if(isObj(this.renderingItemsProps) && isObj(this.renderingItemsProps[rowKey]) ){
@@ -1706,6 +1706,15 @@ export default class CommonDatagridComponent extends AppComponent {
1706
1706
  label : "Exporter les entêtes des groupes",
1707
1707
  defaultValue :1,
1708
1708
  },
1709
+ fields : {
1710
+ text : "Champs à exporter",
1711
+ items : this.state.columns,
1712
+ type : "select",
1713
+ itemValue : ({item,index})=>index,
1714
+ filter : ({item,index})=> isObj(item) && item.exportable !== false,
1715
+ renderItem : ({item,index})=> item?.label || item?.text || index,
1716
+ multiple : true,
1717
+ },
1709
1718
  /*abreviateValues : {
1710
1719
  text : "Abréger les valeurs numériques",
1711
1720
  type : "switch",
@@ -1718,147 +1727,164 @@ export default class CommonDatagridComponent extends AppComponent {
1718
1727
  },
1719
1728
  }
1720
1729
  }
1721
- /***@see : https://docs.sheetjs.com/docs/api/utilities */
1722
- exportToExcel(){
1723
- const skey = "export-to-excel";
1730
+ SetExportOptions({excel}){
1731
+ const skey = excel ? "export-to-excel":"export-to-other";
1724
1732
  const isOnlytotal = this.state.displayOnlySectionListHeaders;
1725
- let displayOnlyHeader = this.canDisplayOnlySectionListHeaders() && isOnlytotal;
1733
+ const displayOnlyHeader = this.canDisplayOnlySectionListHeaders() && isOnlytotal;
1726
1734
  const sData = defaultObj(this.getSessionData(skey));
1727
- return DialogProvider.open({
1728
- title : "Paramètre d'export excel",
1729
- data : sData,
1730
- fields : {
1731
- ...this.getExportableFields(),
1732
- sheetName : {
1733
- label : 'Nom de la feuille excel',
1734
- format : "hashtag",
1735
- required : true,
1735
+ return new Promise((resolve,reject)=>{
1736
+ return DialogProvider.open({
1737
+ title : `Paramètre d'export ${excel?"excel":"pdf"}`,
1738
+ data : sData,
1739
+ fields : {
1740
+ ...this.getExportableFields(),
1741
+ sheetName : excel && {
1742
+ label : 'Nom de la feuille excel',
1743
+ format : "hashtag",
1744
+ required : true,
1745
+ },
1746
+ exportOnlyTotal : displayOnlyHeader && {
1747
+ label : "Exporter uniquemnt les totaux",
1748
+ defaultValue : 0,
1749
+ type : "switch",
1750
+ },
1751
+ aggregatedValues : displayOnlyHeader ? {
1752
+ label : "Exporter uniquement les totaux aggrégées",
1753
+ defaultValue : 0,
1754
+ type : "switch",
1755
+ } : null,
1736
1756
  },
1737
- exportOnlyTotal : displayOnlyHeader && {
1738
- label : "Exporter uniquemnt les totaux",
1739
- defaultValue : 0,
1740
- type : "switch",
1757
+ actions : [{text:'Exporter',icon : "check"}],
1758
+ onSuccess: (args)=>{
1759
+ args.sessionKeyName = skey;
1760
+ args.displayOnlyHeader = displayOnlyHeader;
1761
+ args.isOnlytotal = isOnlytotal;
1762
+ args.sessionData = sData;
1763
+ DialogProvider.close();
1764
+ resolve(args);
1765
+ return args;
1741
1766
  },
1742
- aggregatedValues : displayOnlyHeader ? {
1743
- label : "Exporter uniquement les totaux aggrégées",
1744
- defaultValue : 0,
1745
- type : "switch",
1746
- } : null,
1747
- },
1748
- actions : [{text:'Exporter',icon : "check"}],
1749
- onSuccess:({data:config})=>{
1750
- this.setSessionData(skey,config);
1751
- config.fileName = sprintf(config.fileName);
1752
- config.sheetName = sanitizeSheetName(config.sheetName);
1753
- const data = [];
1754
- let totalColumns = 0;
1755
- const cols = {};
1756
- DialogProvider.close();
1757
- Preloader.open("préparation des données...");
1758
- const footers = this.getFooters();
1759
- if(displayOnlyHeader && config.aggregatedValues){
1760
- const fValues = this.getFooterValues();
1761
- const headers = ["Fonction d'agrégation"];
1762
- const aggregatorFunctions = this.aggregatorFunctions;
1763
- Object.map(footers,(f,i)=>{
1764
- const col = this.state.columns[i];
1765
- if(!col || col.visible === false) return;
1766
- headers.push(defaultStr(col.label,col.text));
1767
- cols[i] = col;
1767
+ onCancel : reject,
1768
+ })
1769
+ })
1770
+ }
1771
+ /***@see : https://docs.sheetjs.com/docs/api/utilities */
1772
+ exportToExcel(){
1773
+ return this.SetExportOptions({excel:true}).then(({sessionKeyName,isOnlytotal,displayOnlyHeader,data:config})=>{
1774
+ this.setSessionData(sessionKeyName,config);
1775
+ config.fileName = sprintf(config.fileName);
1776
+ config.sheetName = sanitizeSheetName(config.sheetName);
1777
+ const data = [];
1778
+ let totalColumns = 0;
1779
+ const cols = {};
1780
+ Preloader.open("préparation des données...");
1781
+ const footers = this.getFooters();
1782
+ const hasFields = !!config.fields.length;
1783
+ const fields = config.fields;
1784
+ if(displayOnlyHeader && config.aggregatedValues){
1785
+ const fValues = this.getFooterValues();
1786
+ const headers = ["Fonction d'agrégation"];
1787
+ const aggregatorFunctions = this.aggregatorFunctions;
1788
+ Object.map(footers,(f,i)=>{
1789
+ if(hasFields && !fields.includes(i)) return;
1790
+ const col = this.state.columns[i];
1791
+ if(!col || col.visible === false) return;
1792
+ headers.push(defaultStr(col.label,col.text));
1793
+ cols[i] = col;
1794
+ });
1795
+ data.push(headers);
1796
+ Object.map(aggregatorFunctions,(ag,i)=>{
1797
+ const d = [defaultStr(ag.label,ag.text,i)];
1798
+ Object.map(fValues,(footer,field)=>{
1799
+ if(!cols[field]) return;
1800
+ d.push(defaultNumber(footer[i]))
1768
1801
  });
1769
- data.push(headers);
1770
- Object.map(aggregatorFunctions,(ag,i)=>{
1771
- const d = [defaultStr(ag.label,ag.text,i)];
1772
- Object.map(fValues,(footer,field)=>{
1773
- if(!cols[field]) return;
1774
- d.push(defaultNumber(footer[i]))
1775
- });
1776
- data.push(d);
1777
- })
1778
- } else {
1779
- const headers = [];
1780
- const hFooters = defaultObj(this.sectionListHeaderFooters);
1781
- const agFunc = this.state.aggregatorFunction;
1782
- const canExportOnlyTotal = isOnlytotal || (config.exportOnlyTotal && displayOnlyHeader);
1783
- if(canExportOnlyTotal){
1784
- headers.push("");
1785
- }
1786
- Object.map(this.state.columns,(col,i)=>{
1787
- if(!isObj(col) || col.visible === false || this.isSelectableColumn(col,i) || i === this.getIndexColumnName()) return;
1788
- if(canExportOnlyTotal && !(i in footers)) return;
1789
- cols[i] = col;
1790
- headers.push(defaultStr(col.label,col.text));
1791
- totalColumns++;
1792
- })
1793
- data.push(headers);
1794
- Object.map(this.state.data,(dat,index)=>{
1795
- ///si l'on a a faire à une colonne de type entete
1796
- const d = [];
1797
- if(dat.isSectionListHeader){
1798
- if(!config.displayTotals && !canExportOnlyTotal) return;
1799
- const {sectionListHeaderKey:key} = dat;
1800
- const val = key === this.emptySectionListHeaderValue ? this.getEmptySectionListHeaderValue() : key;
1801
- d.push(val);
1802
- if(!canExportOnlyTotal){
1803
- for(let i = 1;i<totalColumns;i++){
1804
- d.push(null);
1805
- }
1806
- data.push(d);
1807
- } else {
1808
- const hF = hFooters[key];
1809
- if(isObj(hF) && isNonNullString(agFunc)){
1810
- const dd = [];
1811
- Object.map(cols,(col,i)=>{
1812
- if(i in hF){
1813
- const ff = hF[i];
1814
- dd.push(defaultNumber(ff[agFunc]));
1815
- } else {
1816
- dd.push(null);
1817
- }
1818
- });
1819
- if(canExportOnlyTotal){
1820
- dd.unshift(val);
1821
- data.push(dd);
1822
- } else {
1823
- data.push(d);
1824
- data.push(dd);
1825
- }
1802
+ data.push(d);
1803
+ })
1804
+ } else {
1805
+ const headers = [];
1806
+ const hFooters = defaultObj(this.sectionListHeaderFooters);
1807
+ const agFunc = this.state.aggregatorFunction;
1808
+ const canExportOnlyTotal = isOnlytotal || (config.exportOnlyTotal && displayOnlyHeader);
1809
+ if(canExportOnlyTotal){
1810
+ headers.push("");
1811
+ }
1812
+ Object.map(this.state.columns,(col,i)=>{
1813
+ if(hasFields && !fields.includes(i)) return;
1814
+ if(!isObj(col) || col.visible === false || this.isSelectableColumn(col,i) || i === this.getIndexColumnName()) return;
1815
+ if(canExportOnlyTotal && !(i in footers)) return;
1816
+ cols[i] = col;
1817
+ headers.push(defaultStr(col.label,col.text));
1818
+ totalColumns++;
1819
+ })
1820
+ data.push(headers);
1821
+ Object.map(this.state.data,(dat,index)=>{
1822
+ ///si l'on a a faire à une colonne de type entete
1823
+ const d = [];
1824
+ if(dat.isSectionListHeader){
1825
+ if(!config.displayTotals && !canExportOnlyTotal) return;
1826
+ const {sectionListHeaderKey:key} = dat;
1827
+ const val = key === this.emptySectionListHeaderValue ? this.getEmptySectionListHeaderValue() : key;
1828
+ d.push(val);
1829
+ if(!canExportOnlyTotal){
1830
+ for(let i = 1;i<totalColumns;i++){
1831
+ d.push(null);
1832
+ }
1833
+ data.push(d);
1834
+ } else {
1835
+ const hF = hFooters[key];
1836
+ if(isObj(hF) && isNonNullString(agFunc)){
1837
+ const dd = [];
1838
+ Object.map(cols,(col,i)=>{
1839
+ if(i in hF){
1840
+ const ff = hF[i];
1841
+ dd.push(defaultNumber(ff[agFunc]));
1842
+ } else {
1843
+ dd.push(null);
1844
+ }
1845
+ });
1846
+ if(canExportOnlyTotal){
1847
+ dd.unshift(val);
1848
+ data.push(dd);
1826
1849
  } else {
1827
1850
  data.push(d);
1851
+ data.push(dd);
1828
1852
  }
1853
+ } else {
1854
+ data.push(d);
1829
1855
  }
1830
- } else if(!canExportOnlyTotal) {
1831
- Object.map(cols,(col,i)=>{
1832
- const isDateField = defaultStr(col.type).toLowerCase().contains("date");
1833
- d.push(this.renderRowCell({
1834
- data : dat,
1835
- rowData : dat,
1836
- rowCounterIndex : index,
1837
- rowIndex : index,
1838
- formatValue : false,
1839
- renderRowCell : false,
1840
- columnField : defaultStr(col.field,i),
1841
- columnDef :{
1842
- ...col,
1843
- ...(isDateField?{format:config.dateFormat}:{})
1844
- }
1845
- }));
1846
- })
1847
- data.push(d);
1848
1856
  }
1849
- });
1850
- }
1851
- const wb = XLSX.utils.book_new();
1852
- const ws = XLSX.utils.aoa_to_sheet(data);
1853
- XLSX.utils.book_append_sheet(wb, ws, config.sheetName);
1854
- FileSystem.writeExcel({...config,workbook:wb}).then(({path})=>{
1855
- if(isNonNullString(path)){
1856
- notify.success("Fichier enregistré dans le répertoire {0}".sprintf(path))
1857
+ } else if(!canExportOnlyTotal) {
1858
+ Object.map(cols,(col,i)=>{
1859
+ const isDateField = defaultStr(col.type).toLowerCase().contains("date");
1860
+ d.push(this.renderRowCell({
1861
+ data : dat,
1862
+ rowData : dat,
1863
+ rowCounterIndex : index,
1864
+ rowIndex : index,
1865
+ formatValue : false,
1866
+ renderRowCell : false,
1867
+ columnField : defaultStr(col.field,i),
1868
+ columnDef :{
1869
+ ...col,
1870
+ ...(isDateField?{format:config.dateFormat}:{})
1871
+ }
1872
+ }));
1873
+ })
1874
+ data.push(d);
1857
1875
  }
1858
- }).finally(()=>{
1859
- Preloader.close();
1860
- })
1876
+ });
1861
1877
  }
1878
+ const wb = XLSX.utils.book_new();
1879
+ const ws = XLSX.utils.aoa_to_sheet(data);
1880
+ XLSX.utils.book_append_sheet(wb, ws, config.sheetName);
1881
+ FileSystem.writeExcel({...config,workbook:wb}).then(({path})=>{
1882
+ if(isNonNullString(path)){
1883
+ notify.success("Fichier enregistré dans le répertoire {0}".sprintf(path))
1884
+ }
1885
+ }).finally(()=>{
1886
+ Preloader.close();
1887
+ })
1862
1888
  })
1863
1889
  }
1864
1890
  exportToPdf(){
@@ -103,6 +103,8 @@ export const ROW_SELECTED_STYLE = {
103
103
  }
104
104
  }
105
105
 
106
+ export const SELECTED_BORDER_COLOR = "rgb(251, 207, 232)";
107
+
106
108
  export const ROW_BORDER_STYLE = {
107
109
  marginHorizontal : 0,
108
110
  marginVertical : 0,
@@ -171,7 +173,9 @@ export const getRowStyle = ({row,bordered,numColumns,rowData,isAccordion,isTable
171
173
  style.push(rowIndex%2===0?styles.even : theme.isDark()?styles.oddDark : styles.odd)
172
174
  }
173
175
  if(selected){
174
- style.push(styles.selected,{borderBottomWidth:1,borderBottomColor:theme.colors.primary})
176
+ const selectedBcolor = theme.isDark()? SELECTED_BORDER_COLOR : theme.colors.primary;
177
+ const bordered = isAccordion ? null : {borderBottomWidth:1,borderBottomColor:selectedBcolor,borderTopWidth:1,borderTopColor:selectedBcolor};
178
+ style.push(styles.selected,bordered);
175
179
  }
176
180
  if(paid || row.paid){
177
181
  style.push(styles.paid);
@@ -2,10 +2,10 @@ import KeyboardAvoidingView from "../KeyboardAvoidingView";
2
2
  import React from "$react";
3
3
  import { useWindowDimensions } from "react-native";
4
4
 
5
- const DialogContentComponent = ({isPreloader,isFullScreen,...props})=>{
5
+ const DialogContentComponent = ({isPreloader,title,children,isFullScreen,...props})=>{
6
6
  const isFull = isFullScreen();
7
7
  //useWindowDimensions();
8
- const content = React.useMemo(()=>props.children,[isPreloader]);
8
+ const content = React.useMemo(()=>children,[isPreloader,title,children]);
9
9
  return isPreloader || !isFull ? content : <KeyboardAvoidingView>{content}</KeyboardAvoidingView>
10
10
  }
11
11
  export default DialogContentComponent;
@@ -967,7 +967,6 @@ class DropdownComponent extends AppComponent {
967
967
  const renderingItems = this.getItems();
968
968
  const isDisabled = readOnly || disabled?true:false;
969
969
  const isBigList = this.isBigList;
970
- const ListComponent = isBigList ? BigList : List;
971
970
  const autoFocus = canAutoFocusSearchField({visible,items:renderingItems});
972
971
  dialogProps = defaultObj(dialogProps);
973
972
  if(this.props.name =="RG_Compta"){
@@ -1063,7 +1062,7 @@ class DropdownComponent extends AppComponent {
1063
1062
  {isMob && helperText ? <View testID = {testID+"_HelperText"} style={[styles.helperText]}>
1064
1063
  {helperText}
1065
1064
  </View>: null}
1066
- <ListComponent
1065
+ <BigList
1067
1066
  testID = {testID+"_List"}
1068
1067
  {...listProps}
1069
1068
  ref = {this.listRef}
@@ -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,role,color,upperCase,fontSize,testID,wrap,id,wrapText,error,underlined,splitText,secondary,primary,bold,textBold,disabled,text,style,...rest},ref)=> {
13
+ const LabelComponent = React.forwardRef(({ children,selectable,role,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){
@@ -58,6 +58,8 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
58
58
  if(disabled){
59
59
  r1.pointerEvents = "none";
60
60
  }
61
+ selectable = !!(selectable || defaultSelectable);
62
+ r2.userSelect = selectable?"none":"all";
61
63
  if(isNonNullString(children) || isText || typeof children ==='number'){
62
64
  if(!isText){
63
65
  children +="";
@@ -68,7 +70,10 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
68
70
  if(fontSize){
69
71
  r1.fontSize = fontSize;
70
72
  }
71
- return (<Text allowFontScaling = {true} ref = {ref} selectable={defaultSelectable}
73
+ if(selectable){
74
+ r2.userSelect = "text";
75
+ }
76
+ return (<Text allowFontScaling = {true} ref = {ref}
72
77
  {...rest} {...restProps} testID={testID} disabled={disabled}
73
78
  role={typeof role =='string' && role && supportedRoles.includes(role.trim()) && role.trim() || undefined}
74
79
  style={[styles.label,splitText?styles.wrap:null,splitText?styles.w100:null,bold?styles.bold:null,r2,style,r1,styles.webFontFamilly]}>{children}</Text>)
@@ -92,7 +97,7 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
92
97
  }
93
98
  return children;
94
99
  }
95
- return <View ref = {ref} selectable={defaultSelectable} {...rest} {...restProps} testID = {testID} style={viewStyle} disabled={disabled}>{children}</View>
100
+ return <View ref = {ref} {...rest} {...restProps} testID = {testID} style={viewStyle} disabled={disabled}>{children}</View>
96
101
  }
97
102
  return null;
98
103
  })
@@ -114,7 +119,10 @@ LabelComponentExported.propTypes = {
114
119
  color : PropTypes.string,
115
120
  selectable : PropTypes.bool, //si le texte est sélectionnable
116
121
  underlined : PropTypes.bool,//si le style underlined sera appliqué au label
117
- splitText : PropTypes.bool,///si le texte lorsqu'il est long sera splité
122
+ splitText : PropTypes.bool,///si le texte lorsqu'il est long sera splité,
123
+ /*useSelect : PropTypes.oneOfType([
124
+ 'auto', 'text', 'none', 'contain', 'all'
125
+ ])*/
118
126
  }
119
127
 
120
128
  export default LabelComponentExported;
@@ -9,22 +9,15 @@ import BackToTop from "$ecomponents/BackToTop";
9
9
  import {FlatList,StyleSheet,View} from "react-native";
10
10
  import Label from "$ecomponents/Label";
11
11
  import { useWindowDimensions,Dimensions } from "react-native";
12
- import { useList } from "./hooks";
12
+ import { useList,useGetNumColumns } from "./hooks";
13
13
 
14
14
  const CommonListComponent = React.forwardRef((props,ref)=>{
15
15
  const context = useList(props);
16
- let {responsive,testID,defaultItemHeight,itemHeight,windowWidth,onRender,componentProps,columnWrapperStyle,onViewableItemsChanged,withFlatListItem,Component,withBackToTop,backToTopRef:customBackToTopRef,withBackToTopButton,onScroll,onScrollEnd,onMount,onUnmount,renderScrollViewWrapper,prepareItems,getItemKey,getKey,keyExtractor,items,filter,renderItem,numColumns,containerProps,bindResizeEvents,...rest} = props;
16
+ let {testID,defaultItemHeight,itemHeight,onRender,componentProps,columnWrapperStyle,onViewableItemsChanged,withFlatListItem,Component,withBackToTop,backToTopRef:customBackToTopRef,withBackToTopButton,onScroll,onScrollEnd,onMount,onUnmount,renderScrollViewWrapper,prepareItems,getItemKey,getKey,keyExtractor,items,filter,renderItem,numColumns,containerProps,bindResizeEvents,...rest} = props;
17
17
  withBackToTopButton = withBackToTop === true || withBackToTopButton == true || isMobileMedia()? true : false;
18
18
  rest = defaultObj(rest);
19
19
  containerProps = defaultObj(containerProps);
20
- responsive = defaultBool(responsive,false);
21
- const dimensions = responsive ? useWindowDimensions() : Dimensions.get("window");
22
- if(responsive){
23
- numColumns = grid.numColumns(windowWidth);
24
- } else {
25
- numColumns = defaultDecimal(numColumns,1);
26
- }
27
- const itemWindowWidth = dimensions.width/numColumns;
20
+ const {itemWindowWidth} = useGetNumColumns(props);
28
21
  let scrollEndTimeout = React.useRef(null);
29
22
  const listRef = React.useRef(null);
30
23
  const hasCustomBackToTop = typeof customBackToTopRef == 'function'? true : false;