@fto-consult/expo-ui 6.24.2 → 6.25.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.
Files changed (69) hide show
  1. package/app.config.json +1 -1
  2. package/babel.config.alias.js +2 -1
  3. package/babel.config.js +1 -1
  4. package/electron/utils/env.js +80 -0
  5. package/expo-ui-path.js +2 -2
  6. package/index.js +14 -13
  7. package/is-local-dev.js +5 -0
  8. package/metro.config.js +3 -2
  9. package/package.json +7 -4
  10. package/readChart.txt +4 -1
  11. package/src/App.js +3 -3
  12. package/src/components/Datagrid/Accordion/Row.js +74 -100
  13. package/src/components/Datagrid/Accordion/ToogleRow.js +9 -0
  14. package/src/components/Datagrid/Accordion/index.js +30 -35
  15. package/src/components/Datagrid/Actions/index.js +12 -44
  16. package/src/components/Datagrid/Checkbox.js +4 -7
  17. package/src/components/Datagrid/Common/Common.js +121 -152
  18. package/src/components/Datagrid/Dashboard/index.js +2 -2
  19. package/src/components/Datagrid/IndexComponent.js +8 -13
  20. package/src/components/Datagrid/Table/index.js +53 -51
  21. package/src/components/Datagrid/Test/index.js +10 -3
  22. package/src/components/Datagrid/events/evx.js +7 -0
  23. package/src/components/Datagrid/events/index.js +11 -0
  24. package/src/components/Datagrid/hooks/Provider.js +6 -0
  25. package/src/components/Datagrid/hooks/context.js +5 -0
  26. package/src/components/Datagrid/hooks/index.js +104 -0
  27. package/src/components/Datagrid/utils.js +8 -5
  28. package/src/components/Dialog/Dialog.js +13 -12
  29. package/src/components/Dialog/DialogContent.js +11 -0
  30. package/src/components/KeyboardAvoidingView/index.js +7 -3
  31. package/src/components/Label/index.js +8 -4
  32. package/src/components/List/Common.js +5 -3
  33. package/src/components/List/FlashList.js +13 -13
  34. package/src/components/List/Virtuoso/index.js +68 -10
  35. package/src/components/List/Virtuoso/index.native.js +6 -1
  36. package/src/components/Table/Header/Cell/index.js +10 -0
  37. package/src/components/Table/Header/Cell/index.native.js +7 -0
  38. package/src/components/Table/Header/index.js +34 -0
  39. package/src/components/Table/List/index.js +3 -1
  40. package/src/components/Table/List/index.native.js +2 -1
  41. package/src/components/Table/Row/Cell/Content.js +16 -0
  42. package/src/components/Table/Row/Cell/Content.native.js +15 -0
  43. package/src/components/Table/Row/Cell/index.js +30 -0
  44. package/src/components/Table/Row/RowWrapper.js +7 -0
  45. package/src/components/Table/Row/RowWrapper.native.js +11 -0
  46. package/src/components/Table/Row/index.js +38 -0
  47. package/src/components/Table/RowTemplate/index.js +10 -0
  48. package/src/components/Table/RowTemplate/index.web.js +9 -0
  49. package/src/components/Table/ScrollNative/index.js +7 -0
  50. package/src/components/Table/ScrollNative/index.native.js +8 -0
  51. package/src/components/Table/VirtuosoTable/index.js +5 -0
  52. package/src/components/Table/VirtuosoTable/index.native.js +3 -0
  53. package/src/components/Table/hooks.js +84 -0
  54. package/src/components/Table/index.js +92 -250
  55. package/src/components/Table/styles.js +104 -0
  56. package/src/components/Table/utils.js +1 -0
  57. package/src/context/Provider.js +16 -2
  58. package/src/layouts/AppBar/index.js +11 -10
  59. package/src/layouts/Screen/ScreenWithoutAuthContainer.js +14 -6
  60. package/src/navigation/Drawer/items/index.js +2 -1
  61. package/src/navigation/index.js +11 -3
  62. package/src/screens/Help/About.js +1 -1
  63. package/src/screens/Help/openLibraries.js +1 -1
  64. package/src/test-screens/Home.js +4 -1
  65. package/webpack.config.js +4 -2
  66. package/src/components/Table/Cell.js +0 -24
  67. package/src/components/Table/FiltersOrFooters.js +0 -18
  68. package/src/components/Table/Header.js +0 -25
  69. package/src/components/Table/Row.js +0 -21
package/app.config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@FTO-CONSULT/EXPO-UI",
3
- "version": "6.23.10",
3
+ "version": "6.24.2",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "bin": {
6
6
  "expo-ui": "./bin/index.js"
@@ -2,6 +2,7 @@ const path = require("path");
2
2
  const fs = require("fs");
3
3
  const writeFile = require("./electron/utils/writeFile");
4
4
  module.exports = (opts)=>{
5
+ const isLocalDev = require("./is-local-dev")();
5
6
  const dir = path.resolve(__dirname);
6
7
  const projectRoot = typeof opts.projectRoot =='string' && fs.existsSync(opts.projectRoot.trim()) && opts.projectRoot.trim() || process.cwd();
7
8
  const assets = path.resolve(dir,"assets");
@@ -77,7 +78,7 @@ module.exports = (opts)=>{
77
78
  const HelpScreen = path.resolve(r["$escreens"],"Help");
78
79
  ///on génère les librairies open sources utilisées par l'application
79
80
  const root = path.resolve(r.$src,"..");
80
- const nModulePath = fs.existsSync(path.resolve(root,"node_modules")) && path.resolve(root,"node_modules") || fs.existsSync(path.resolve(r.$src,"node_modules")) && path.resolve(r.$src,"node_modules") || path.resolve(projectRoot,"node_modules");
81
+ const nModulePath = isLocalDev ? path.resolve(__dirname,"node_modules") : fs.existsSync(path.resolve(root,"node_modules")) && path.resolve(root,"node_modules") || fs.existsSync(path.resolve(r.$src,"node_modules")) && path.resolve(r.$src,"node_modules") || path.resolve(projectRoot,"node_modules");
81
82
  const nodeModulesPath = fs.existsSync(nModulePath) ? nModulePath : path.resolve(process.cwd(),"node_modules");
82
83
  const outputPath = path.resolve(HelpScreen,"openLibraries.js");
83
84
  r.$nodeModulesPath = r.$enodeModulesPath= nodeModulesPath;
package/babel.config.js CHANGED
@@ -2,7 +2,7 @@ module.exports = function(api,opts) {
2
2
  opts = typeof opts =='object' && opts ? opts : {};
3
3
  api = api && typeof api =='object'? api : {};
4
4
 
5
-
5
+ const isLocalDev = require("./is-local-dev")();//si l'application est en developpement local
6
6
 
7
7
  ///les chemin vers la variable d'environnement, le chemin du fichier .env,@see : https://github.com/brysgo/babel-plugin-inline-dotenv
8
8
  //console.log(environmentPath," is envvv ",opts);
@@ -0,0 +1,80 @@
1
+ import chalk from 'chalk';
2
+
3
+ /**
4
+ * Validate the environment options and apply default values.
5
+ *
6
+ * @param env
7
+ * @category env
8
+ */
9
+ export function validateEnvironment(env){
10
+ if (typeof env.projectRoot !== 'string') {
11
+ throw new Error(
12
+ `@expo/webpack-config requires a valid projectRoot string value which points to the root of your project`
13
+ );
14
+ }
15
+ warnEnvironmentDeprecation(env, true);
16
+ const validModes = ['development', 'production', 'none'];
17
+ if (!env.mode || !validModes.includes(env.mode)) {
18
+ throw new Error(
19
+ `@expo/webpack-config requires a valid \`mode\` string which should be one of: ${validModes.join(
20
+ ', '
21
+ )}`
22
+ );
23
+ }
24
+
25
+ // Default to web. Allow any arbitrary platform.
26
+ if (typeof env.platform === 'undefined') {
27
+ env.platform = 'web';
28
+ }
29
+ // No https by default since it doesn't work well across different browsers and devices.
30
+ if (typeof env.https === 'undefined') {
31
+ env.https = false;
32
+ }
33
+
34
+ return env;
35
+ }
36
+
37
+ let warned= {};
38
+
39
+ function shouldWarnDeprecated(
40
+ config,
41
+ key,
42
+ warnOnce
43
+ ) {
44
+ return (!warnOnce || !(key in warned)) && typeof config[key] !== 'undefined';
45
+ }
46
+
47
+ /**
48
+ *
49
+ * @param env
50
+ * @param warnOnce
51
+ * @category env
52
+ * @internal
53
+ */
54
+ export function warnEnvironmentDeprecation(env, warnOnce) {
55
+ const warnings = {
56
+ production: 'Please use `mode: "production"` instead.',
57
+ development: 'Please use `mode: "development"` instead.',
58
+ polyfill: 'Please include polyfills manually in your project.',
59
+ };
60
+
61
+ for (const warning of Object.keys(warnings)) {
62
+ if (shouldWarnDeprecated(env, warning, warnOnce)) {
63
+ warned[warning] = true;
64
+ console.warn(
65
+ chalk.bgYellow.black(
66
+ `The environment property \`${warning}\` is deprecated. ${warnings[warning]}`.trim()
67
+ )
68
+ );
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Used for testing
75
+ * @category env
76
+ * @internal
77
+ */
78
+ export function _resetWarnings() {
79
+ warned = {};
80
+ }
package/expo-ui-path.js CHANGED
@@ -13,11 +13,11 @@ module.exports = function (){
13
13
  suffix = path.join(suffix,p);
14
14
  }
15
15
  })
16
- const expoUIPath = path.resolve(process.cwd(),"node_modules","@fto-consult","expo-ui");
17
16
  const sep = path.sep;
18
- if(path.resolve(process.cwd()) === path.resolve(__dirname)){//le programme s'exécute en environnement fix bugs sur electron
17
+ if(require("./is-local-dev")()){//le programme s'exécute en environnement fix bugs sur electron
19
18
  return path.resolve(__dirname,suffix).replace(sep,(sep+sep));///pour la résolution du module expo-ui en mode test
20
19
  }
20
+ const expoUIPath = path.resolve(process.cwd(),"node_modules","@fto-consult","expo-ui");
21
21
  const rootPath = process.cwd();
22
22
  const src = path.resolve(rootPath,"src");
23
23
  try {
package/index.js CHANGED
@@ -50,16 +50,17 @@ export default function registerApp (opts){
50
50
 
51
51
  registerRootComponent(MainAppEntry);
52
52
 
53
-
54
- /**
55
- registerApp({
56
- navigation : {
57
- screens : require("./src/test-screens").default
58
- },
59
- init : ({appConfig})=>{
60
- appConfig.set("isAuthSingleUserAllowed",true);
61
- appConfig.set("authDefaultUser",{code:"root",password:"admin123",label:"Master admin"})
62
- return Promise.resolve("test ted")
63
- }
64
- });
65
- */
53
+ const isLocalMode = true;
54
+ //si après 5 secondes, l'application n'a pas été registrer, alors il s'agit d'un test en mode local
55
+ if(isLocalMode){
56
+ registerApp({
57
+ navigation : {
58
+ screens : require("./src/test-screens").default
59
+ },
60
+ init : ({appConfig})=>{
61
+ appConfig.set("isAuthSingleUserAllowed",true);
62
+ appConfig.set("authDefaultUser",{code:"root",password:"admin123",label:"Master admin"})
63
+ return Promise.resolve("test ted")
64
+ }
65
+ });
66
+ }
@@ -0,0 +1,5 @@
1
+ /**** vérifie si l'application est en train d'exéccuter en environnement local, mode test
2
+ du framework expo-ui
3
+ */
4
+ const path = require("path");
5
+ module.exports = x=> path.resolve(process.cwd()) == path.resolve(__dirname);
package/metro.config.js CHANGED
@@ -11,7 +11,7 @@ module.exports = function(opts){
11
11
  let {assetExts,sourceExts} = opts;
12
12
  assetExts = Array.isArray(assetExts)? assetExts: [];
13
13
  sourceExts= Array.isArray(sourceExts)?sourceExts : [];
14
- const projectRoot = process.cwd();
14
+ const projectRoot = path.resolve(process.cwd());
15
15
  const localDir = path.resolve(__dirname);
16
16
  //@see : https://docs.expo.dev/versions/latest/config/metro/
17
17
  const config = getDefaultConfig(projectRoot,{
@@ -19,7 +19,8 @@ module.exports = function(opts){
19
19
  isCSSEnabled: true,
20
20
  });
21
21
  config.watchFolders = Array.isArray(config.watchFolders) && config.watchFolders || [];
22
- if(projectRoot !== localDir){
22
+ const isLocalTest = require("./is-local-dev")();
23
+ if(!isLocalTest){
23
24
  config.watchFolders.push(localDir);
24
25
  }
25
26
  config.projectRoot = projectRoot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.24.2",
3
+ "version": "6.25.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -64,9 +64,10 @@
64
64
  "homepage": "https://github.com/borispipo/expo-ui#readme",
65
65
  "dependencies": {
66
66
  "@emotion/native": "^11.11.0",
67
+ "@emotion/react": "^11.11.1",
67
68
  "@expo/html-elements": "^0.5.1",
68
69
  "@expo/vector-icons": "^13.0.0",
69
- "@fto-consult/common": "^3.26.2",
70
+ "@fto-consult/common": "^3.28.1",
70
71
  "@gorhom/portal": "^1.0.14",
71
72
  "@pchmn/expo-material3-theme": "^1.3.1",
72
73
  "@react-native-async-storage/async-storage": "1.18.2",
@@ -103,7 +104,7 @@
103
104
  "react-native-iphone-x-helper": "^1.3.1",
104
105
  "react-native-mime-types": "^2.4.0",
105
106
  "react-native-paper": "^5.10.1",
106
- "react-native-paper-dates": "^0.18.13",
107
+ "react-native-paper-dates": "^0.18.14",
107
108
  "react-native-reanimated": "~3.3.0",
108
109
  "react-native-safe-area-context": "4.6.3",
109
110
  "react-native-screens": "~3.22.0",
@@ -118,8 +119,10 @@
118
119
  },
119
120
  "devDependencies": {
120
121
  "@expo/metro-config": "latest",
122
+ "@expo/webpack-config": "^18.1.2",
121
123
  "@faker-js/faker": "^8.0.2",
122
124
  "babel-plugin-inline-dotenv": "^1.7.0",
123
- "babel-plugin-module-resolver": "^5.0.0"
125
+ "babel-plugin-module-resolver": "^5.0.0",
126
+ "uninstall": "^0.0.0"
124
127
  }
125
128
  }
package/readChart.txt CHANGED
@@ -5,4 +5,7 @@
5
5
  Les valeurs pouvant appartenir au séries groupées des charts peuvent être uniquement les valeurs calculées du footer,
6
6
  lorsque les colonnes sont grouépes
7
7
 
8
- Configure git credentialHelper http : credential.useHttpPath true, @see : https://microsoft.github.io/Git-Credential-Manager-for-Windows/Docs/Configuration.html#:~:text=useHttpPath,changes%20the%20behavior%20of%20Git.
8
+ Configure git credentialHelper http : credential.useHttpPath true, @see : https://microsoft.github.io/Git-Credential-Manager-for-Windows/Docs/Configuration.html#:~:text=useHttpPath,changes%20the%20behavior%20of%20Git.
9
+
10
+
11
+ il est possible d'ajouter les propriétés css valide en environnemnet web, dans le theme, en utilisant la props customCSS de type fonction ou chaine de caractère
package/src/App.js CHANGED
@@ -30,7 +30,7 @@ Object.map(Utils,(v,i)=>{
30
30
  export default function getIndex({onMount,onUnmount,render,onRender,init}){
31
31
  const {swrConfig} = useContext();
32
32
  const isScreenFocusedRef = React.useRef(true);
33
- useKeepAwake();
33
+ isMobileNative() && useKeepAwake();
34
34
  ///garde pour chaque écran sa date de dernière activité
35
35
  const screensRef = React.useRef({});//la liste des écrans actifs
36
36
  const activeScreenRef = React.useRef('');
@@ -145,8 +145,8 @@ export default function getIndex({onMount,onUnmount,render,onRender,init}){
145
145
  }}
146
146
  >
147
147
  <GestureHandlerRootView style={{ flex: 1,flexGrow:1,flexShrink:1}} testID={"RN_GestureHandlerRootView"}>
148
- <KeyboardAvoidingViewComponent>
149
- <SafeAreaProvider>
148
+ <KeyboardAvoidingViewComponent testID={"RN_AppKeyboardAvoidingView"}>
149
+ <SafeAreaProvider testID={"RN_AppSafeAreaProvider"}>
150
150
  <Index onMount={onMount} render={render} onUnmount={onUnmount} onRender={onRender} init={init}/>
151
151
  </SafeAreaProvider>
152
152
  </KeyboardAvoidingViewComponent>
@@ -6,11 +6,15 @@ import Label from "$ecomponents/Label";
6
6
  import PropTypes from "prop-types";
7
7
  import React from "$react";
8
8
  import theme from "$theme"
9
- import {styles as rStyles} from "../utils";
9
+ import {isMobileNative} from "$cplatform";
10
+ import {styles as rStyles,getRowStyle} from "../utils";
10
11
  import Swipeable from 'react-native-gesture-handler/Swipeable';
12
+ import { useIsRowSelected,useDatagrid} from "../hooks";
11
13
 
12
14
  const DatagridAccordionRow = React.forwardRef((props,ref)=>{
13
- const {selectable,rowKey,
15
+ const {
16
+ selectable,
17
+ rowKey,
14
18
  bottomSheetTitle:customBottomSheetTitle,
15
19
  bottomSheetTitlePrefix,
16
20
  previewProps:_previewProps,
@@ -18,42 +22,29 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
18
22
  onRowPress,
19
23
  avatarProps,
20
24
  onRowLongPress,
21
- context:pContext,item,
25
+ item,
22
26
  index,
23
- isScrolling:_isScrolling,
24
27
  style,
25
28
  numColumns,
26
- itemHeight,
27
29
  onToggleExpand,
28
30
  callArgs,
29
- controlItemRender,
30
31
  } = props;
32
+ const {context} = useDatagrid();
31
33
  let {wrapperStyle,title,right,rightProps,description,avatarContent,rowProps} = props;
32
34
  rightProps = defaultObj(rightProps);
33
35
  if(!isObj(item)) {
34
36
  return null;
35
37
  }
36
- const context = defaultObj(pContext);
37
- const isRowSelected = x => typeof context.isRowSelected === 'function'? context.isRowSelected(rowKey,rowIndex): false;
38
- const selected = isRowSelected();
39
- let isScrolling = defaultBool(_isScrolling)
38
+ const selected = useIsRowSelected(rowKey,rowIndex);
40
39
  const innerRef = React.useRef(null);
41
- if(typeof context.isScrolling =='function'){
42
- let isS = context.isScrolling();
43
- if(typeof isS =='boolean'){
44
- isScrolling = isS;
45
- }
46
- }
47
- const [state,setState] = React.useState({
48
- expanded : false,
49
- });
40
+ const [expanded,setExpanded] = React.useState(false);
50
41
  const toggleExpander = ()=>{
51
42
  if(onRowPress){
52
43
  onRowPress(callArgs);
53
44
  }
54
- if(!state.expanded){
45
+ if(!expanded){
55
46
  getContentHeight(innerRef,({height})=>{
56
- setState({...state,expanded:true});
47
+ setExpanded(true);
57
48
  if(onToggleExpand){
58
49
  const previewProps = defaultObj(_previewProps,bottomSheetProps);
59
50
  let bottomSheetTitle = typeof customBottomSheetTitle =='function'? customBottomSheetTitle(callArgs) : customBottomSheetTitle;
@@ -61,23 +52,18 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
61
52
  bottomSheetTitle = defaultStr(bottomSheetTitle,defTitle,'Détails de la ligne N° '+rowIndexCount.formatNumber())
62
53
  const previewTitle = isFunction(previewProps.title)? previewProps.title(callArgs) : defaultVal(previewProps.title,bottomSheetTitle);
63
54
  return onToggleExpand({...previewProps,rowKey,item,index,height,title:previewTitle,onDismiss:()=>{
64
- setState({...state,expanded:false});
55
+ setExpanded(false);
65
56
  }})
66
57
  }
67
58
  },10);
68
59
  return;
69
60
  }
70
- setState({...state,expanded:!state.expanded});
61
+ setExpanded(!expanded);
71
62
  }
72
63
 
73
64
  let rowIndex = defaultDecimal(index);
74
65
  let rowIndexCount = index+1;
75
66
  const testID = defaultStr(props.testID,"RN_DatagridAccordionRow"+(rowKey||rowIndex))
76
- let _canHandleRow = isObj(context.props)? (!isFunction(context.props.filter)? true : context.props.filter(callArgs)):true;
77
- if(_canHandleRow ===false || _canHandleRow === null){
78
- //resetLayoutsRef();
79
- return null;
80
- }
81
67
  let _rP = {}
82
68
  const hasAvatar = React.isValidElement(avatarContent);
83
69
  const handleRowToggle = (event)=>{
@@ -85,12 +71,11 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
85
71
  if(onRowLongPress){
86
72
  onRowLongPress(callArgs);
87
73
  }
88
- if(typeof context.handleRowToggle =='function'){
89
- return context.handleRowToggle({selected:!isRowSelected(),rowKey,rowData:item,item,row:item,rowIndex,index:rowIndex,cb:()=>{
90
- setState({...state})
91
- }});
92
- }
74
+ return !!context.handleRowToggle({rowKey,rowData:item,item,row:item,rowIndex,index:rowIndex});
93
75
  }
76
+ const wrapStyle = React.useMemo(()=>{
77
+ return getRowStyle({row:item,index,selected,numColumns,isAccordion:true,rowIndex:index});
78
+ },[selected])
94
79
  let viewWrapperStyle = {};
95
80
  if(selected) {
96
81
  const handleAvatarRowToggle = (event)=>{
@@ -106,17 +91,13 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
106
91
  onPress = {handleAvatarRowToggle}
107
92
  icon = {"check"}
108
93
  title = {sTtitle}
109
- ></Avatar> : null;/*<Pressable
110
- onPress={handleAvatarRowToggle}
111
- style = {{width:'100%'}}
112
- testID = {testID+"_HandleToggle"}
113
- />*/
94
+ ></Avatar> : null;
114
95
  if(!hasAvatar){
115
96
  viewWrapperStyle = [styles.hasNotAvatar,{borderLeftColor:theme.colors.primaryOnSurface}]
116
97
  }
117
98
  }
118
99
 
119
- if(state.expanded){
100
+ if(expanded){
120
101
  if(React.isValidElement(avatarContent) && hasAvatar){
121
102
  avatarContent = <Avatar
122
103
  {...avatarProps}
@@ -127,32 +108,7 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
127
108
  } else if(selectable === false){
128
109
  _rP.disabled = true;
129
110
  }
130
- if(!React.isValidElement(avatarContent)){
131
- avatarContent = null;
132
- }
133
111
  right = typeof right === 'function'? right ({color:theme.colors.primaryOnSurface,selectable:true,style:[rStyles.lineHeight,styles.right]}) : right;
134
- const renderLeftActions = (_progress,dragX) => {
135
- const trans = dragX.interpolate({
136
- inputRange: [0, 80],
137
- outputRange: [0, 1],
138
- extrapolate: 'clamp',
139
- });
140
- return (
141
- <View style={{justifyContent:'center',flex:1}}>
142
- <Animated.Text
143
- style={[
144
- styles.actionText,
145
- {
146
- transform: [{ translateX: trans }],
147
- alignItems : 'center',
148
- color : theme.colors.primary,
149
- },
150
- ]}>
151
- {(selected?'Désélectionnez la ligne ':'Sélectionnez la ligne ')}
152
- </Animated.Text>
153
- </View>
154
- );
155
- };
156
112
  const swipeableRef = React.useRef(null);
157
113
  return <Pressable
158
114
  {..._rP}
@@ -165,47 +121,65 @@ const DatagridAccordionRow = React.forwardRef((props,ref)=>{
165
121
  _rP.style,rowProps.style,
166
122
  styles.container,
167
123
  numColumns > 1 && {width:'99%'},
168
- //selected && !hasAvatar && styles.containerSelected,
169
124
  styles.bordered,
170
125
  wrapperStyle,
126
+ wrapStyle,
171
127
  style,
172
128
  ]}
173
129
  ref = {React.useMergeRefs(ref,innerRef)}
174
- >
175
- <Swipeable
176
- ref = {swipeableRef}
177
- testID={testID+'_ContentContainerSwipeable'}
178
- friction={2}
179
- containerStyle = {{overflow:'hidden'}}
180
- leftThreshold={80}
181
- enableTrackpadTwoFingerGesture
182
- renderLeftActions={selectable === false? undefined : renderLeftActions}
183
- onSwipeableWillOpen = {(direction)=>{
184
- if(selectable === false) return;
185
- if(swipeableRef.current && swipeableRef.current.close){
186
- swipeableRef.current.close();
187
- }
188
- handleRowToggle();
189
- }}
190
- >
191
- <View
192
- style={[styles.renderedContent,viewWrapperStyle]}
193
- testID={testID+'_ContentContainer'}
194
- >
195
- {avatarContent ? <View testID={testID+"_AvatarContainer"} style={[styles.avatarContent]}>
196
- {avatarContent}
197
- </View> : null}
198
- <View testID={testID+"_Content"} style={[styles.content,styles.wrap]}>
199
- {title}
200
- {description}
201
- </View>
202
- {right ? <Label testID={testID+"_Right"} primary selectable {...rightProps} style={[styles.right,styles.label,rStyles.lineHeight,rightProps.style]}>
203
- {right}
204
- </Label> : null}
205
-
130
+ >
131
+ <Swipeable
132
+ ref = {swipeableRef}
133
+ testID={testID+'_ContentContainerSwipeable'}
134
+ friction={2}
135
+ containerStyle = {{overflow:'hidden'}}
136
+ leftThreshold={80}
137
+ enableTrackpadTwoFingerGesture
138
+ renderLeftActions={selectable === false? undefined : (_progress,dragX) => {
139
+ const trans = dragX.interpolate({
140
+ inputRange: [0, 80],
141
+ outputRange: [0, 1],
142
+ extrapolate: 'clamp',
143
+ });
144
+ return (
145
+ <View style={{justifyContent:'center',flex:1}}>
146
+ <Animated.Text
147
+ style={[
148
+ styles.actionText,
149
+ {
150
+ transform: [{ translateX: trans }],
151
+ alignItems : 'center',
152
+ color : theme.colors.primary,
153
+ },
154
+ ]}>
155
+ {(selected?'Désélectionnez la ligne ':'Sélectionnez la ligne ')}
156
+ </Animated.Text>
206
157
  </View>
207
- </Swipeable>
208
- </Pressable>
158
+ );
159
+ }}
160
+ onSwipeableWillOpen = {(direction)=>{
161
+ if(selectable === false) return;
162
+ if(swipeableRef.current && swipeableRef.current.close){
163
+ swipeableRef.current.close();
164
+ }
165
+ handleRowToggle();
166
+ }}
167
+ >
168
+ <View
169
+ style={[styles.renderedContent,viewWrapperStyle]}
170
+ testID={testID+'_ContentContainer'}
171
+ >
172
+ {avatarContent}
173
+ <View testID={testID+"_Content"} style={[styles.content,styles.wrap]}>
174
+ {title}
175
+ {description}
176
+ </View>
177
+ {right ? <Label testID={testID+"_Right"} primary selectable {...rightProps} style={[styles.right,styles.label,rStyles.lineHeight,rightProps.style]}>
178
+ {right}
179
+ </Label> : null}
180
+ </View>
181
+ </Swipeable>
182
+ </Pressable>
209
183
  })
210
184
 
211
185
  export default DatagridAccordionRow;
@@ -272,7 +246,7 @@ const styles = StyleSheet.create({
272
246
  container : {
273
247
  marginVertical : 10,
274
248
  paddingVertical : 5,
275
- paddingHorizontal : 10,// isMobileNative()? 15:10,
249
+ paddingHorizontal : isMobileNative()? 10 : 0,
276
250
  marginHorizontal : 5,
277
251
  flexWrap : 'nowrap',
278
252
  justifyContent : 'center',
@@ -0,0 +1,9 @@
1
+ import React from "$react";
2
+ import View from "$ecomponents/View";
3
+
4
+ export default function DatagridAccordionToggleRow({handleRowToggle,avatarContent,...props}){
5
+ if(!React.isValidElement(avatarContent)){
6
+ avatarContent = null;
7
+ }
8
+ return null;
9
+ }