@fto-consult/expo-ui 6.24.2 → 6.25.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.
- package/app.config.json +1 -1
- package/babel.config.alias.js +2 -1
- package/babel.config.js +1 -1
- package/electron/utils/env.js +80 -0
- package/expo-ui-path.js +2 -2
- package/index.js +14 -13
- package/is-local-dev.js +5 -0
- package/metro.config.js +3 -2
- package/package.json +6 -3
- package/src/App.js +3 -3
- package/src/components/Datagrid/Accordion/Row.js +74 -100
- package/src/components/Datagrid/Accordion/ToogleRow.js +9 -0
- package/src/components/Datagrid/Accordion/index.js +30 -35
- package/src/components/Datagrid/Actions/index.js +12 -44
- package/src/components/Datagrid/Checkbox.js +4 -7
- package/src/components/Datagrid/Common/Common.js +112 -148
- package/src/components/Datagrid/Dashboard/index.js +2 -2
- package/src/components/Datagrid/IndexComponent.js +8 -13
- package/src/components/Datagrid/Table/index.js +53 -51
- package/src/components/Datagrid/Test/index.js +10 -3
- package/src/components/Datagrid/events/evx.js +7 -0
- package/src/components/Datagrid/events/index.js +11 -0
- package/src/components/Datagrid/hooks/Provider.js +6 -0
- package/src/components/Datagrid/hooks/context.js +5 -0
- package/src/components/Datagrid/hooks/index.js +104 -0
- package/src/components/Datagrid/utils.js +6 -4
- package/src/components/Dialog/Dialog.js +13 -12
- package/src/components/Dialog/DialogContent.js +11 -0
- package/src/components/KeyboardAvoidingView/index.js +7 -3
- package/src/components/List/Common.js +5 -3
- package/src/components/List/FlashList.js +13 -13
- package/src/components/List/Virtuoso/index.js +29 -8
- package/src/components/List/Virtuoso/index.native.js +6 -1
- package/src/components/Table/FiltersOrFooters.js +11 -3
- package/src/components/Table/Header/Cell/index.js +10 -0
- package/src/components/Table/Header/Cell/index.native.js +7 -0
- package/src/components/Table/{Header.js → Header/Component.js} +0 -4
- package/src/components/Table/{Row.js → Header/Component.native.js} +3 -3
- package/src/components/Table/Header/index.js +12 -0
- package/src/components/Table/List/index.js +3 -1
- package/src/components/Table/List/index.native.js +2 -1
- package/src/components/Table/Row/Cell/Content.js +17 -0
- package/src/components/Table/Row/Cell/Content.native.js +15 -0
- package/src/components/Table/Row/Cell/index.js +29 -0
- package/src/components/Table/Row/RowWrapper.js +7 -0
- package/src/components/Table/Row/RowWrapper.native.js +10 -0
- package/src/components/Table/Row/index.js +38 -0
- package/src/components/Table/RowTemplate/index.js +10 -0
- package/src/components/Table/RowTemplate/index.web.js +9 -0
- package/src/components/Table/ScrollNative/index.js +7 -0
- package/src/components/Table/ScrollNative/index.native.js +8 -0
- package/src/components/Table/VirtuosoTable/index.js +5 -0
- package/src/components/Table/VirtuosoTable/index.native.js +3 -0
- package/src/components/Table/hooks.js +84 -0
- package/src/components/Table/index.js +88 -247
- package/src/components/Table/styles.js +88 -0
- package/src/components/Table/utils.js +1 -0
- package/src/layouts/AppBar/index.js +11 -10
- package/src/layouts/Screen/ScreenWithoutAuthContainer.js +14 -6
- package/src/navigation/Drawer/items/index.js +2 -1
- package/src/navigation/index.js +11 -3
- package/src/screens/Help/About.js +1 -1
- package/src/screens/Help/openLibraries.js +1 -1
- package/src/test-screens/Home.js +4 -1
- package/webpack.config.js +4 -2
- package/src/components/Table/Cell.js +0 -24
package/app.config.json
CHANGED
package/babel.config.alias.js
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
appConfig
|
|
61
|
-
|
|
62
|
-
|
|
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
|
+
}
|
package/is-local-dev.js
ADDED
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
|
-
|
|
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.
|
|
3
|
+
"version": "6.25.0",
|
|
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.
|
|
70
|
+
"@fto-consult/common": "^3.27.0",
|
|
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",
|
|
@@ -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/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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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(!
|
|
45
|
+
if(!expanded){
|
|
55
46
|
getContentHeight(innerRef,({height})=>{
|
|
56
|
-
|
|
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
|
-
|
|
55
|
+
setExpanded(false);
|
|
65
56
|
}})
|
|
66
57
|
}
|
|
67
58
|
},10);
|
|
68
59
|
return;
|
|
69
60
|
}
|
|
70
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
{
|
|
200
|
-
|
|
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
|
-
|
|
208
|
-
|
|
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 :
|
|
249
|
+
paddingHorizontal : isMobileNative()? 10 : 0,
|
|
276
250
|
marginHorizontal : 5,
|
|
277
251
|
flexWrap : 'nowrap',
|
|
278
252
|
justifyContent : 'center',
|