@fto-consult/expo-ui 8.75.0 → 8.76.1

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.
@@ -9,6 +9,9 @@ import theme from "$theme"
9
9
  import {styles as rStyles,getRowStyle} from "../utils";
10
10
  import { useIsRowSelected,useDatagrid} from "../hooks";
11
11
  import {HStack} from "$ecomponents/Stack";
12
+ import { isMobileNative, isReactNativeWebview} from "$cplatform";
13
+
14
+ const isNative = isMobileNative() || isReactNativeWebview();
12
15
 
13
16
  const DatagridAccordionRow = React.forwardRef(({selectable,
14
17
  rowKey,
@@ -81,10 +84,7 @@ const DatagridAccordionRow = React.forwardRef(({selectable,
81
84
  const wrapStyle = React.useMemo(()=>{
82
85
  return getRowStyle({row:item,index,selected,numColumns,isAccordion:true,rowIndex:index});
83
86
  },[selected,numColumns]);
84
- const viewWrapperStyle = [selectable !== false && theme.styles.cursorPointer];
85
- if(!hasAvatar){
86
- viewWrapperStyle.push(styles.hasNotAvatar);
87
- }
87
+ const viewWrapperStyle = [selectable !== false && theme.styles.cursorPointer,hasAvatar ? styles.hasAvatar : styles.hasNotAvatar];
88
88
  if(selected) {
89
89
  const handleAvatarRowToggle = (event)=>{
90
90
  React.stopEventPropagation(event);
@@ -238,7 +238,9 @@ const styles = StyleSheet.create({
238
238
  },
239
239
  container : {
240
240
  paddingVertical : 0,
241
- paddingHorizontal : 7,
241
+ paddingLeft : isNative ? 7 : 2,
242
+ //paddingHorizontal : 7,
243
+ paddingRight : 7,
242
244
  marginHorizontal : 0,
243
245
  flexWrap : 'nowrap',
244
246
  justifyContent : 'center',
@@ -249,14 +251,17 @@ const styles = StyleSheet.create({
249
251
  marginRight : 10,
250
252
  },
251
253
  hasNotAvatar : {
252
- borderLeftWidth : 5,
254
+ borderLeftWidth : 7,
253
255
  paddingLeft : 0,
254
256
  height : "100%",
255
257
  borderLeftColor : "transparent",
256
258
  },
259
+ hasAvatar : {
260
+ paddingLeft : isNative ? 10 : 7,
261
+ },
257
262
  selected : {
258
- paddingHorizontal : 0,
259
- paddingVertical : 0,
263
+ //paddingHorizontal : 0,
264
+ //paddingVertical : 0,
260
265
  },
261
266
  contentContainerNotAvatar : {
262
267
  paddingLeft : 2,
@@ -194,7 +194,7 @@ export default class DatagridAccordionComponent extends Datagrid {
194
194
  if(!(item) || typeof item !== 'object') return null;
195
195
  const canHandleRow = typeof this.props.filter =='function' ? this.props.filter(this.getItemCallArgs({item,index})) : true;
196
196
  if(canHandleRow === false || canHandleRow === null) return null;
197
- const rowKey = this.getRowKeyByIndex(index);
197
+ const rowKey = this.getRowKey(item);
198
198
  return <DatagridAccordionRow
199
199
  item = {item}
200
200
  index = {index}
@@ -47,6 +47,7 @@ import {createTableHeader,fields as pdfFields,pageHeaderMargin,sprintf as pdfSpr
47
47
  import {isWeb,isMobileNative} from "$cplatform";
48
48
  import { createPDF,getFields as getPdfFields } from '$expo-ui/pdf';
49
49
  import actions from '$cactions';
50
+ import {printTableData} from "$epdf";
50
51
 
51
52
  export const TIMEOUT = 100;
52
53
 
@@ -831,15 +832,21 @@ export default class CommonDatagridComponent extends AppComponent {
831
832
  }
832
833
  return copyToClipboard({...rest,isDatagrid:true,data:row,fields : this.props.columns,sessionName:defaultStr(this.props.sessionName,"datagrid")});
833
834
  }
834
-
835
+ isPrintable(){
836
+ if(!this.isTableData() || this.props.printAction === false) return false;
837
+ if(typeof this.props.printable ==='function'){
838
+ return !!this.props.printable({context:this,tableName:this.tableName,table:this.tableName,context:this,isDatagrid:true,isTableData:false});
839
+ }
840
+ return this.props.printable === true;
841
+ }
835
842
  /*** les actions représentes les différents menus apparaissant lorsqu'une ligne est sélectionnée
836
843
  * ou pas.
837
844
  */
838
845
  renderSelectedRowsActions(sActions){
839
846
  let {makePhoneCallProps,canMakePhoneCall,archivable} = this.props;
840
847
  const size = this.getSelectedRowsCount();
841
- let r = [];
842
- let endActs = [];
848
+ const r = [];
849
+ const endActs = [];
843
850
  if(size <=0) {
844
851
  return r
845
852
  };
@@ -851,6 +858,28 @@ export default class CommonDatagridComponent extends AppComponent {
851
858
  if(isFunction(selectedR)) {
852
859
  selectedR = selectedR.call(this,sArgs)
853
860
  }
861
+ if(this.isPrintable()){
862
+ const {filter:printFilter,onPress,...printAction} = defaultObj(this.props.printAction);
863
+ r.push({
864
+ icon : "printer",
865
+ ...printAction,
866
+ text : printAction.text || printAction.label || "Imprimer",
867
+ label : printAction.label || printAction.label || 'Imprimer',
868
+ onPress : (r)=>{
869
+ const opts2 = {isTableData:false,context:this,isDatagrid:true,tableName:this.tableName,table:this.tableName};
870
+ const args = {...React.getOnPressArgs(r),...sArgs,...opts2};
871
+ if(typeof onPress =='function' && onPress(args) === false) return;
872
+ const printDat = [];
873
+ const filter = typeof printFilter =="function" ? printFilter : x=>true;
874
+ Object.map(args.selectedRows,(row,rowKey,index)=>{
875
+ if(!!!filter({...args,data:row,key:rowKey,rowData:row,index,rowIndex:index})) return;
876
+ printDat.push(row);
877
+ });
878
+ if(!printDat.length) return notify.error(printAction.noDataError,"Aucune données sélectionnée pour l'impression");
879
+ return this.print(printDat,opts2);
880
+ },
881
+ });
882
+ }
854
883
  Object.map(sActions,(o,i)=>{
855
884
  if(isObj(o)){
856
885
  let {onPress, ...rest} = o;
@@ -878,7 +907,7 @@ export default class CommonDatagridComponent extends AppComponent {
878
907
  }
879
908
  r.push(rest)
880
909
  }
881
- })
910
+ });
882
911
  endActs.map((a)=>{
883
912
  r.push(a);
884
913
  })
@@ -914,7 +943,18 @@ export default class CommonDatagridComponent extends AppComponent {
914
943
  }
915
944
  return r;
916
945
  }
917
-
946
+ getTableName(){
947
+ return defaultStr(this.tableName,this.props.table,this.props.tableName).toUpperCase().trim();
948
+ }
949
+ print(data,options){
950
+ if(!this.isPrintable()) return;
951
+ if(!isObj(data) && !Array.isArray(data)) return;
952
+ const opts = {...defaultObj(options),tableName:this.getTableName(),table:this.getTableName(),isTableData:false,isDatagrid:true,context:this};
953
+ if(typeof this.props.print ==='function'){
954
+ return this.props.print.call(this,data,opts);
955
+ }
956
+ return printTableData(data,opts);
957
+ }
918
958
  /*** le trie du tableau prend en paramètre
919
959
  : le nom de la colonne de trie, la direction de la conne de trie
920
960
  par défaut, le trie se fait en ignorant la casse
@@ -3926,6 +3966,10 @@ export default class CommonDatagridComponent extends AppComponent {
3926
3966
  getRowsKeysIndexes(){
3927
3967
  return Array.isArray(this.rowsKeysIndexes) ? this.rowsKeysIndexes : [];
3928
3968
  }
3969
+ /****
3970
+ attention cette fonction est uniquement valide lorsque les données ne sont pas groupées
3971
+ Lorsque les données sont groupées, cette fonction est inutile
3972
+ */
3929
3973
  getRowKeyByIndex(rowIndex){
3930
3974
  if(typeof rowIndex !='number') return undefined;
3931
3975
  const idx = this.getRowsKeysIndexes();
@@ -4279,6 +4323,21 @@ CommonDatagridComponent.propTypes = {
4279
4323
  abreviateValues : PropTypes.bool, //si les valeurs numériques seront abregées
4280
4324
  handleTitle : PropTypes.bool,//si le titre du datagrid, props title, sera pris en compte dans les actions du datagrid, pour le rendu du DataSourceSelector, fonction renderDataSourceSelector
4281
4325
  checkPerms : PropTypes.func,//la fonction utilisée pour vérifier les permissions de l'utilisateur
4326
+ printAction : PropTypes.oneOfType([
4327
+ PropTypes.bool,
4328
+ PropTypes.shape({
4329
+ label : PropTypes.any,
4330
+ text : PropTypes.any,
4331
+ icon : PropTypes.any,
4332
+ onPress : PropTypes.func, //({selectedRows,context,.....})=><boolean | any>,
4333
+ filter : PropTypes.func,//la fonction permettant de filtrer les données à imprimer,
4334
+ noDataError : PropTypes.oneOfType([ //le message d'erreur lorsque aucune données n'a été selectionnée pour l'impression
4335
+ PropTypes.string,
4336
+ PropTypes.object,
4337
+ ]),
4338
+ ///....rest, les options similaires à celles du composant Menu où de l'AppBar en fonction des cas
4339
+ }), //les props à passer à l'action d'impression du datagrid
4340
+ ]), //si l'action d'impression sera affiché dans le datagrid
4282
4341
  }
4283
4342
 
4284
4343
  const styles = StyleSheet.create({
@@ -25,6 +25,7 @@ import i18n from "$i18n";
25
25
  import fetch from "$capi/fetch";
26
26
  import appConfig from "$capp/config";
27
27
  import {Vertical} from "$ecomponents/AutoSizer";
28
+ import {printTableData} from "$epdf";
28
29
 
29
30
 
30
31
  const HIDE_PRELOADER_TIMEOUT = 300;
@@ -566,6 +567,9 @@ export default class TableDataScreenComponent extends FormDataScreen{
566
567
  return true;
567
568
  }
568
569
  isPrintable(){
570
+ if(typeof this.props.printable ==='function'){
571
+ return !!this.props.printable({context:this,tableName:this.getTableName(),isTableData:true,table:this.getTableName()})
572
+ }
569
573
  return !!(this.props.printable);
570
574
  }
571
575
  /*** retourne la liste des valeurs de clé primarire associés à la table data pour la données en cours de modification
@@ -596,10 +600,11 @@ export default class TableDataScreenComponent extends FormDataScreen{
596
600
  print(data){
597
601
  if(!this.isPrintable()) return;
598
602
  data = this.isDocEditing(data)? data : isObj(data) && this.isDocEditing(data.data)? data.data : {};
603
+ const opts = {tableName:this.getTableName(),table:this.getTableName(),isTableData:true,fromTableData:true,context:this};
599
604
  if(typeof this.props.print ==='function'){
600
- return this.props.print.call(this,data);
601
- }
602
- return data;
605
+ return this.props.print.call(this,data,opts);
606
+ }
607
+ return printTableData(data,opts);
603
608
  }
604
609
  isClonable(){
605
610
  return !!(this.props.clonable !==false);
@@ -961,6 +966,7 @@ export default class TableDataScreenComponent extends FormDataScreen{
961
966
 
962
967
  TableDataScreenComponent.propTypes = {
963
968
  ...defaultObj(FormData.propTypes),
969
+ printable : PropTypes.oneOfType([PropTypes.func,PropTypes.bool]),//si la table data est imprimable
964
970
  renderTabsType : PropTypes.oneOf([...defaultRendersTypes,undefined,"responsive"]),//spécifie le type de rendue : mobile, alors le tab sera rendu en mobile, desktop, ce sera rendu en desktop, responsible ou undefined, alors les deux rendu seront possible
965
971
  prepareComponentProps : PropTypes.func, //permet d'appreter les components props à utiliser pour le rendu des données
966
972
  prepareField : PropTypes.func,//La fonction permettant de faire des mutations sur le champ field à passer au formulaire form. si elle retourne false alors la field ne sera pas pris een compte
package/src/pdf/index.js CHANGED
@@ -277,9 +277,9 @@ export function printTableData(data,options){
277
277
  } else if(!Auth.isTableDataAllowed({table,action:'print'})){
278
278
  return Promise.reject({message:'Vous n\'etes pas autorisé à imprimer ce type de document'});
279
279
  }
280
- const printOptions = typeof tableObj.printOptions =="function"? tableObj.printOptions({...options,table,data}) : tableObj.printOptions;
281
280
  return print(data,{
282
281
  getSettings : (options)=>{
282
+ const printOptions = typeof tableObj.printOptions =="function"? tableObj.printOptions({...options,table}) : tableObj.printOptions;
283
283
  return getPrintSettings(extendObj(true,{},{sessionName:`print-${table}`,isTableData:true,tableDataFields:defaultObj(options.tableDataFields,tableObj.printableFields,tableObj.fields)},options,printOptions)).then(({data})=>{
284
284
  return data;
285
285
  });
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
- "version": "8.74.2",
3
+ "version": "8.73.1",
4
4
  "url": "https://github.com/borispipo/expo-ui#readme",
5
5
  "license": "ISC"
6
6
  },
@@ -9,64 +9,34 @@ module.exports = {
9
9
  "url": "https://babel.dev/docs/en/next/babel-plugin-proposal-export-namespace-from",
10
10
  "license": "MIT"
11
11
  },
12
- "@emotion/native": {
13
- "version": "11.11.0",
14
- "url": "https://emotion.sh",
15
- "license": "MIT"
16
- },
17
- "@expo/html-elements": {
18
- "version": "0.5.1",
19
- "url": "https://github.com/expo/expo/tree/main/packages/html-elements",
12
+ "@emotion/react": {
13
+ "version": "11.11.4",
14
+ "url": "https://github.com/emotion-js/emotion/tree/main/packages/react",
20
15
  "license": "MIT"
21
16
  },
22
17
  "@expo/metro-config": {
23
- "version": "0.17.7",
18
+ "version": "0.17.6",
24
19
  "url": "https://github.com/expo/expo.git",
25
20
  "license": "MIT"
26
21
  },
27
- "@expo/vector-icons": {
28
- "version": "14.0.0",
29
- "url": "https://expo.github.io/vector-icons",
30
- "license": "MIT"
31
- },
32
22
  "@expo/webpack-config": {
33
23
  "version": "19.0.1",
34
24
  "url": "https://github.com/expo/expo-webpack-integrations/tree/main/packages/webpack-config#readme",
35
25
  "license": "MIT"
36
26
  },
37
- "@pchmn/expo-material3-theme": {
38
- "version": "1.3.2",
39
- "url": "https://github.com/pchmn/expo-material3-theme#readme",
40
- "license": "MIT"
41
- },
42
- "@react-native-community/netinfo": {
43
- "version": "11.1.0",
44
- "url": "https://github.com/react-native-netinfo/react-native-netinfo#readme",
45
- "license": "MIT"
46
- },
47
- "@react-native/assets-registry": {
48
- "version": "0.72.0",
49
- "url": "git@github.com:facebook/react-native.git",
27
+ "@faker-js/faker": {
28
+ "version": "8.4.1",
29
+ "url": "https://github.com/faker-js/faker.git",
50
30
  "license": "MIT"
51
31
  },
52
- "@react-navigation/native": {
53
- "version": "6.1.17",
54
- "url": "https://reactnavigation.org",
55
- "license": "MIT"
56
- },
57
- "@react-navigation/native-stack": {
58
- "version": "6.9.26",
59
- "url": "https://github.com/software-mansion/react-native-screens#readme",
60
- "license": "MIT"
61
- },
62
- "@react-navigation/stack": {
63
- "version": "6.3.29",
64
- "url": "https://reactnavigation.org/docs/stack-navigator/",
65
- "license": "MIT"
32
+ "@fto-consult/common": {
33
+ "version": "4.47.0",
34
+ "url": "https://github.com/borispipo/common#readme",
35
+ "license": "ISC"
66
36
  },
67
- "@shopify/flash-list": {
68
- "version": "1.6.3",
69
- "url": "https://shopify.github.io/flash-list/",
37
+ "apexcharts": {
38
+ "version": "3.49.0",
39
+ "url": "https://apexcharts.com",
70
40
  "license": "MIT"
71
41
  },
72
42
  "babel-plugin-inline-dotenv": {
@@ -84,74 +54,48 @@ module.exports = {
84
54
  "url": "https://github.com/crypto-browserify/crypto-browserify",
85
55
  "license": "MIT"
86
56
  },
87
- "expo": {
88
- "version": "50.0.17",
89
- "url": "https://github.com/expo/expo/tree/main/packages/expo",
57
+ "file-saver": {
58
+ "version": "2.0.5",
59
+ "url": "https://github.com/eligrey/FileSaver.js#readme",
90
60
  "license": "MIT"
91
61
  },
92
- "expo-camera": {
93
- "version": "14.1.3",
94
- "url": "https://docs.expo.dev/versions/latest/sdk/camera/",
95
- "license": "MIT"
62
+ "google-libphonenumber": {
63
+ "version": "3.2.34",
64
+ "url": "https://ruimarinho.github.io/google-libphonenumber/",
65
+ "license": "(MIT AND Apache-2.0)"
96
66
  },
97
- "expo-clipboard": {
98
- "version": "5.0.1",
99
- "url": "https://docs.expo.dev/versions/latest/sdk/clipboard",
67
+ "html2canvas": {
68
+ "version": "1.4.1",
69
+ "url": "https://html2canvas.hertzen.com",
100
70
  "license": "MIT"
101
71
  },
102
- "expo-document-picker": {
103
- "version": "11.10.1",
104
- "url": "https://docs.expo.dev/versions/latest/sdk/document-picker/",
72
+ "htmlparser2-without-node-native": {
73
+ "version": "3.9.2",
74
+ "url": "git://github.com/fb55/htmlparser2.git",
105
75
  "license": "MIT"
106
76
  },
107
- "expo-font": {
108
- "version": "11.10.3",
109
- "url": "https://docs.expo.dev/versions/latest/sdk/font/",
77
+ "is-plain-obj": {
78
+ "version": "4.1.0",
110
79
  "license": "MIT"
111
80
  },
112
- "expo-image-picker": {
113
- "version": "14.7.1",
114
- "url": "https://docs.expo.dev/versions/latest/sdk/imagepicker/",
81
+ "jsbarcode": {
82
+ "version": "3.11.6",
83
+ "url": "https://github.com/lindell/JsBarcode#readme",
115
84
  "license": "MIT"
116
85
  },
117
- "expo-intent-launcher": {
118
- "version": "10.11.0",
119
- "url": "https://docs.expo.dev/versions/latest/sdk/intent-launcher/",
86
+ "prop-types": {
87
+ "version": "15.8.1",
88
+ "url": "https://facebook.github.io/react/",
120
89
  "license": "MIT"
121
90
  },
122
- "expo-linking": {
123
- "version": "6.2.2",
124
- "url": "https://docs.expo.dev/versions/latest/sdk/linking",
91
+ "react-content-loader": {
92
+ "version": "6.2.1",
93
+ "url": "https://github.com/danilowoz/react-content-loader",
125
94
  "license": "MIT"
126
95
  },
127
- "expo-sharing": {
128
- "version": "11.10.0",
129
- "url": "https://docs.expo.dev/versions/latest/sdk/sharing/",
130
- "license": "MIT"
131
- },
132
- "expo-sqlite": {
133
- "version": "13.4.0",
134
- "url": "https://docs.expo.dev/versions/latest/sdk/sqlite/",
135
- "license": "MIT"
136
- },
137
- "expo-status-bar": {
138
- "version": "1.11.1",
139
- "url": "https://docs.expo.dev/versions/latest/sdk/status-bar/",
140
- "license": "MIT"
141
- },
142
- "expo-system-ui": {
143
- "version": "2.9.4",
144
- "url": "https://docs.expo.dev/versions/latest/sdk/system-ui",
145
- "license": "MIT"
146
- },
147
- "expo-web-browser": {
148
- "version": "12.8.2",
149
- "url": "https://docs.expo.dev/versions/latest/sdk/webbrowser/",
150
- "license": "MIT"
151
- },
152
- "react-native": {
153
- "version": "0.73.6",
154
- "url": "https://reactnative.dev/",
96
+ "react-dom": {
97
+ "version": "18.2.0",
98
+ "url": "https://reactjs.org/",
155
99
  "license": "MIT"
156
100
  },
157
101
  "react-native-big-list": {
@@ -159,45 +103,44 @@ module.exports = {
159
103
  "url": "https://marcocesarato.github.io/react-native-big-list-docs/",
160
104
  "license": "GPL-3.0-or-later"
161
105
  },
162
- "react-native-blob-util": {
163
- "version": "0.18.6",
164
- "url": "https://github.com/RonRadtke/react-native-blob-util",
106
+ "react-native-iphone-x-helper": {
107
+ "version": "1.3.1",
108
+ "url": "https://github.com/ptelad/react-native-iphone-x-helper#readme",
165
109
  "license": "MIT"
166
110
  },
167
- "react-native-gesture-handler": {
168
- "version": "2.14.1",
169
- "url": "https://github.com/software-mansion/react-native-gesture-handler#readme",
111
+ "react-native-mime-types": {
112
+ "version": "2.5.0",
170
113
  "license": "MIT"
171
114
  },
172
- "react-native-reanimated": {
173
- "version": "3.6.2",
174
- "url": "https://github.com/software-mansion/react-native-reanimated#readme",
115
+ "react-native-paper": {
116
+ "version": "5.12.3",
117
+ "url": "https://callstack.github.io/react-native-paper",
175
118
  "license": "MIT"
176
119
  },
177
- "react-native-safe-area-context": {
178
- "version": "4.8.2",
179
- "url": "https://github.com/th3rdwave/react-native-safe-area-context#readme",
120
+ "react-native-paper-dates": {
121
+ "version": "0.22.7",
122
+ "url": "https://github.com/web-ridge/react-native-paper-dates#readme",
180
123
  "license": "MIT"
181
124
  },
182
- "react-native-screens": {
183
- "version": "3.29.0",
184
- "url": "https://github.com/software-mansion/react-native-screens#readme",
125
+ "react-native-web": {
126
+ "version": "0.19.11",
127
+ "url": "git://github.com/necolas/react-native-web.git",
185
128
  "license": "MIT"
186
129
  },
187
- "react-native-svg": {
188
- "version": "14.1.0",
189
- "url": "https://github.com/react-native-community/react-native-svg",
130
+ "react-virtuoso": {
131
+ "version": "4.7.10",
132
+ "url": "https://virtuoso.dev/",
190
133
  "license": "MIT"
191
134
  },
192
- "react-native-view-shot": {
193
- "version": "3.8.0",
194
- "url": "https://github.com/gre/react-native-view-shot",
135
+ "readable-stream": {
136
+ "version": "4.5.2",
137
+ "url": "https://github.com/nodejs/readable-stream",
195
138
  "license": "MIT"
196
139
  },
197
- "react-native-webview": {
198
- "version": "13.6.4",
199
- "url": "https://github.com/react-native-webview/react-native-webview#readme",
200
- "license": "MIT"
140
+ "sanitize-filename": {
141
+ "version": "1.6.3",
142
+ "url": "git@github.com:parshap/node-sanitize-filename.git",
143
+ "license": "WTFPL OR ISC"
201
144
  },
202
145
  "sharp-cli": {
203
146
  "version": "2.1.1",
@@ -209,9 +152,19 @@ module.exports = {
209
152
  "url": "https://github.com/browserify/stream-browserify",
210
153
  "license": "MIT"
211
154
  },
155
+ "tippy.js": {
156
+ "version": "6.3.7",
157
+ "url": "https://atomiks.github.io/tippyjs/",
158
+ "license": "MIT"
159
+ },
212
160
  "vm": {
213
161
  "version": "0.1.0",
214
162
  "url": "https://github.com/DiegoRBaquero/node-vm#readme",
215
163
  "license": "MIT"
164
+ },
165
+ "xlsx": {
166
+ "version": "0.18.5",
167
+ "url": "https://sheetjs.com/",
168
+ "license": "Apache-2.0"
216
169
  }
217
170
  };