@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.
- 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 +7 -4
- package/readChart.txt +4 -1
- 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 +121 -152
- 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 +8 -5
- 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/Label/index.js +8 -4
- package/src/components/List/Common.js +5 -3
- package/src/components/List/FlashList.js +13 -13
- package/src/components/List/Virtuoso/index.js +68 -10
- package/src/components/List/Virtuoso/index.native.js +6 -1
- 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/index.js +34 -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 +16 -0
- package/src/components/Table/Row/Cell/Content.native.js +15 -0
- package/src/components/Table/Row/Cell/index.js +30 -0
- package/src/components/Table/Row/RowWrapper.js +7 -0
- package/src/components/Table/Row/RowWrapper.native.js +11 -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 +92 -250
- package/src/components/Table/styles.js +104 -0
- package/src/components/Table/utils.js +1 -0
- package/src/context/Provider.js +16 -2
- 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/src/components/Table/FiltersOrFooters.js +0 -18
- package/src/components/Table/Header.js +0 -25
- package/src/components/Table/Row.js +0 -21
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import Accordion,{ TableData as TableDataAccordion} from "./Accordion";
|
|
6
|
-
import Dashboard from "./Dashboard";
|
|
7
6
|
import Table,{TableData as DatagridTableData} from "./Table";
|
|
8
7
|
import {isDesktopMedia,isMobileMedia} from "$cplatform/dimensions";
|
|
9
8
|
import {isFunction,defaultVal} from "$cutils";
|
|
@@ -14,19 +13,15 @@ import {getRenderType} from "./utils";
|
|
|
14
13
|
const DatagridMainComponent = React.forwardRef((props,ref)=>{
|
|
15
14
|
const isDesk = isDesktopMedia();
|
|
16
15
|
const isMob = isMobileMedia();
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const AccordionComponent = isTableDataRef.current ? TableDataAccordion : Accordion;
|
|
20
|
-
let Component = TableComponent;
|
|
16
|
+
const isTableData = typeof props.isTableData =='boolean'? props.isTableData : defaultStr(props.tableName,props.table).trim() || typeof props.fetchData ==='function'?true : false;
|
|
17
|
+
const renderType = defaultStr(getRenderType(),isDesk? "table":'accordion').trim().toLowerCase();
|
|
21
18
|
const canRenderAccordion = (isFunction(props.accordion) || (isObj(props.accordionProps) && isFunction(props.accordionProps.accordion)) || props.accordion === true);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
Component = AccordionComponent;
|
|
29
|
-
}
|
|
19
|
+
const Component = React.useMemo(()=>{
|
|
20
|
+
if((renderType == 'accordion' || (renderType !=='table' && isMob)) && canRenderAccordion){
|
|
21
|
+
return isTableData ? TableDataAccordion : Accordion;
|
|
22
|
+
}
|
|
23
|
+
return isTableData ? DatagridTableData : Table;
|
|
24
|
+
},[isTableData,renderType,canRenderAccordion,isMob])
|
|
30
25
|
return <Component
|
|
31
26
|
{...props}
|
|
32
27
|
ref = {ref}
|
|
@@ -14,6 +14,7 @@ import RenderType from "../RenderType";
|
|
|
14
14
|
import Footer from "../Footer/Footer";
|
|
15
15
|
import theme from "$theme";
|
|
16
16
|
import Table from "$ecomponents/Table";
|
|
17
|
+
import DatagridProvider from "../hooks/Provider";
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
const DatagridFactory = (Factory)=>{
|
|
@@ -276,57 +277,58 @@ const DatagridFactory = (Factory)=>{
|
|
|
276
277
|
</View>
|
|
277
278
|
</ScrollView>
|
|
278
279
|
</View> : null;
|
|
279
|
-
return <
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
280
|
+
return <DatagridProvider context={this}>
|
|
281
|
+
<View style={[styles.container,{flex:1}]} testID={testID+"_TableContainer"} pointerEvents={pointerEvents}>
|
|
282
|
+
<View ref={this.layoutRef} testID={testID+"_LayoutContainer"}>
|
|
283
|
+
{this.props.showActions !== false ? <DatagridActions
|
|
284
|
+
pointerEvents = {pointerEvents}
|
|
285
|
+
title = {this.renderDataSourceSelector()}
|
|
286
|
+
actions = {actions}
|
|
287
|
+
/> : null}
|
|
288
|
+
{rPagination}
|
|
289
|
+
{progressBar}
|
|
290
|
+
</View>
|
|
291
|
+
{canRenderChart ?
|
|
292
|
+
<View testID={testID+"_ChartContainer"} {...chartContainerProps} style={[theme.styles.w100,chartContainerProps.style]}>
|
|
293
|
+
{this.renderChart()}
|
|
294
|
+
</View> :
|
|
295
|
+
<Table
|
|
296
|
+
ref = {this.listRef}
|
|
297
|
+
{...rest}
|
|
298
|
+
withDatagridContext
|
|
299
|
+
sortedColumn = {sortedColumn}
|
|
300
|
+
onRender = {this.onRender.bind(this)}
|
|
301
|
+
getItemType = {this.getFlashListItemType.bind(this)}
|
|
302
|
+
renderItem = {this.renderFlashListItem.bind(this)}
|
|
303
|
+
renderSectionHeader = {this.renderFlashListItem.bind(this)}
|
|
304
|
+
hasFooters = {hasFootersFields && !canRenderChart ? true : false}
|
|
305
|
+
showFilters = {showFilters}
|
|
306
|
+
showFooters = {showFooters && !canRenderChart ? true : false}
|
|
307
|
+
showHeaders = { canRenderChart ? !!showFilters : true}
|
|
308
|
+
headerCellContainerProps = {{
|
|
309
|
+
style : showFilters?{justifyContent:'flex-start'}:null
|
|
310
|
+
}}
|
|
311
|
+
isRowSelected = {this.isRowSelected.bind(this)}
|
|
312
|
+
columns = {this.state.columns}
|
|
313
|
+
//renderRow={this.renderRow.bind(this)}
|
|
314
|
+
getRowKey = {this.getRowKey.bind(this)}
|
|
315
|
+
columnsWidths = {widths}
|
|
316
|
+
renderCell={this.renderRowCell.bind(this)}
|
|
317
|
+
rowContainerProps = {(props)=>{
|
|
318
|
+
return {
|
|
319
|
+
style : getRowStyle(props,{selected:this.isRowSelected.bind(this)}),
|
|
320
|
+
}
|
|
321
|
+
}}
|
|
322
|
+
data = {this.state.data}
|
|
323
|
+
footers = {this.getFooterValues()}
|
|
324
|
+
renderHeaderCell={this.renderHeaderCell.bind(this)}
|
|
325
|
+
renderFilterCell={this.renderFilterCell.bind(this)}
|
|
326
|
+
renderFooterCell={this.renderFooterCell.bind(this)}
|
|
327
|
+
renderEmpty = {this.renderEmpty.bind(this)}
|
|
328
|
+
/>}
|
|
329
|
+
</View>
|
|
330
|
+
|
|
331
|
+
</DatagridProvider>
|
|
330
332
|
}
|
|
331
333
|
}
|
|
332
334
|
clx.propTypes = {
|
|
@@ -2,19 +2,26 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style
|
|
3
3
|
// license that can be found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import Table from "../Table";
|
|
5
|
+
import Table from "../IndexComponent";
|
|
7
6
|
import React from "$react";
|
|
8
7
|
import { faker } from '@faker-js/faker';
|
|
9
8
|
export default function TestDatagridComponent({count,...props}){
|
|
10
9
|
const data = React.useMemo(()=>{
|
|
11
|
-
count = typeof count =='number' && count > 10 ? count :
|
|
10
|
+
count = typeof count =='number' && count > 10 ? count : 100;
|
|
12
11
|
return faker.helpers.multiple(createRandomUser, {
|
|
13
12
|
count,
|
|
14
13
|
});
|
|
15
14
|
},[count])
|
|
16
15
|
return <Table
|
|
17
16
|
title = "Utilisateurs"
|
|
17
|
+
accordion = {({rowData})=>{
|
|
18
|
+
return {
|
|
19
|
+
content : `${rowData.email}`,
|
|
20
|
+
title : rowData?.username,
|
|
21
|
+
//avatar : rowData.avatar,
|
|
22
|
+
right : rowData.birthdate,
|
|
23
|
+
}
|
|
24
|
+
}}
|
|
18
25
|
columns={{
|
|
19
26
|
userId : {
|
|
20
27
|
primaryKey : true,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useContext,useEffect,useMemo,useReducer } from "react";
|
|
2
|
+
import { DatagridContext } from "./context";
|
|
3
|
+
import {isObj,isNonNullString} from "$cutils";
|
|
4
|
+
import events from "../events";
|
|
5
|
+
export const useDatagrid = x=> {
|
|
6
|
+
const t = useContext(DatagridContext)
|
|
7
|
+
if(!t || !t?.context || !t?.context?.state || !t?.context?.state?.data){
|
|
8
|
+
throw "Le composant Datagrid actions doit être enfant d'un contexe de datagrid valide";
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
export const useDatagridContext = ()=>{
|
|
13
|
+
return useDatagrid()?.context;
|
|
14
|
+
}
|
|
15
|
+
export const useData = ()=>{
|
|
16
|
+
const {context} = useDatagrid();
|
|
17
|
+
return Array.isArray(context.state.data) && context.state.data || [];
|
|
18
|
+
}
|
|
19
|
+
export const useSelectedRows = ()=>{
|
|
20
|
+
const {context} = useDatagrid();
|
|
21
|
+
}
|
|
22
|
+
export const useGetRowKey = ({rowData,rowIndex})=>{
|
|
23
|
+
const {context} = useDatagrid();
|
|
24
|
+
return context.getRowKey(rowData,rowIndex);
|
|
25
|
+
};
|
|
26
|
+
/****
|
|
27
|
+
@param {string|Array} event, l'évènement ou les évènements en question, qui est trigger par le contexte de datagrid
|
|
28
|
+
@param {function|string} getter, la fonction getter, est la fonction qui prenant en paramètre le contexte, retourne la valeur liée à l'évènement event
|
|
29
|
+
@param {function} onEvent, la fonction appelée lorsque l'évènement est exécutée
|
|
30
|
+
*/
|
|
31
|
+
export const useOnEvent = (event,getter,onEvent)=>{
|
|
32
|
+
const {context} = useDatagrid();
|
|
33
|
+
if((!isNonNullString(event) && !Array.isArray(event)) || !event.length){
|
|
34
|
+
throw `méthode invalide ${method} supportée par le contexte`;
|
|
35
|
+
}
|
|
36
|
+
if(typeof getter !=='function') {
|
|
37
|
+
throw "méthode getter invalide pour la récupéreration de l'état lié au contexte du datagrid";
|
|
38
|
+
}
|
|
39
|
+
const evBack = event;
|
|
40
|
+
event = Array.isArray(event) ? event : isNonNullString(event)? event.trim().split(",") : [];
|
|
41
|
+
const [state, dispatch] = useReducer(function(state2,action){
|
|
42
|
+
if(event.filter(ev=>action.type.toLowerCase() === ev?.toLowerCase().trim()).length){
|
|
43
|
+
return getter(context,action.type);
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}, getter(context,evBack));
|
|
47
|
+
const callbacks = useMemo((...args)=>{
|
|
48
|
+
const callbacks = {};
|
|
49
|
+
event.map((ev)=>{
|
|
50
|
+
callbacks[ev] = (...args)=>{
|
|
51
|
+
if(typeof onEvent ==='function' && onEvent(ev,...args) === false) return false;
|
|
52
|
+
return dispatch({type:ev});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return callbacks;
|
|
56
|
+
},[event.join(",")]);
|
|
57
|
+
useEffect(()=>{
|
|
58
|
+
Object.map(callbacks,(cb,event)=>{
|
|
59
|
+
context.on(event,cb);
|
|
60
|
+
});
|
|
61
|
+
return ()=>{
|
|
62
|
+
Object.map(callbacks,(cb,ev)=>{
|
|
63
|
+
context.off(ev,cb);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
},[]);
|
|
67
|
+
return state;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
/****
|
|
72
|
+
ecoute l'évènement event sur le contexte de datagrid
|
|
73
|
+
@param {string} event, l'évènement à écouter
|
|
74
|
+
@param {function} onEvent, la fonction appelée lorsque l'évènement est écoutée
|
|
75
|
+
*/
|
|
76
|
+
export const useBindEvent = (event,onEvent)=>{
|
|
77
|
+
const {context} = useDatagrid();
|
|
78
|
+
if(!isNonNullString(event)){
|
|
79
|
+
throw `impossible d'écouter un évènemet invalide pour le contexte de datagrid`;
|
|
80
|
+
}
|
|
81
|
+
useEffect(()=>{
|
|
82
|
+
context.on(event,onEvent);
|
|
83
|
+
return ()=>{
|
|
84
|
+
context.off(event,onEvent);
|
|
85
|
+
}
|
|
86
|
+
},[]);
|
|
87
|
+
return onEvent;
|
|
88
|
+
}
|
|
89
|
+
export const useIsRowSelected = (...args)=>{
|
|
90
|
+
return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
|
|
91
|
+
return context.isRowSelected(...args);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const useGetSelectedRowsCount = ()=>{
|
|
96
|
+
return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
|
|
97
|
+
return context.getSelectedRowsCount();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export const useIsAllRowsSelected = ()=>{
|
|
101
|
+
return useOnEvent([events.ON_ROW_TOGGLE,events.ON_ALL_ROWS_TOGGLE],(context)=>{
|
|
102
|
+
return context.isAllRowsSelected();
|
|
103
|
+
});
|
|
104
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import theme,{LINE_HEIGHT} from "$theme";
|
|
1
|
+
import theme,{Colors,LINE_HEIGHT} from "$theme";
|
|
2
2
|
import { StyleSheet } from "react-native";
|
|
3
3
|
import {get as getSession} from "./Common/session";
|
|
4
4
|
import appConfig from "$capp/config";
|
|
@@ -98,7 +98,9 @@ export const ROW_EVEN_STYLE = {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export const ROW_SELECTED_STYLE = {
|
|
101
|
-
backgroundColor
|
|
101
|
+
get backgroundColor(){
|
|
102
|
+
return theme.isDark()? Colors.lighten(theme.colors.surface) : Colors.darken(theme.colors.surface);
|
|
103
|
+
}
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
export const ROW_BORDER_STYLE = {
|
|
@@ -111,7 +113,8 @@ export const ROW_BORDER_STYLE = {
|
|
|
111
113
|
borderRightColor : ROW_BORDER_COLOR,
|
|
112
114
|
borderRightWidth : 0,
|
|
113
115
|
borderTopColor : ROW_BORDER_COLOR,
|
|
114
|
-
borderTopWidth : 0
|
|
116
|
+
borderTopWidth : 0,
|
|
117
|
+
borderStyle : "solid",
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
|
|
@@ -119,7 +122,7 @@ export const DATE_COLUMN_WIDTH = 200;
|
|
|
119
122
|
|
|
120
123
|
export {LINE_HEIGHT}
|
|
121
124
|
|
|
122
|
-
export const styles =
|
|
125
|
+
export const styles = ({
|
|
123
126
|
approved : ROW_APPROVED_STYLE,
|
|
124
127
|
archived : ROW_ARCHIVED_STYLE,
|
|
125
128
|
selected : ROW_SELECTED_STYLE,
|
|
@@ -167,7 +170,7 @@ export const getRowStyle = ({row,bordered,numColumns,rowData,isAccordion,isTable
|
|
|
167
170
|
if(rowIndex !== undefined){
|
|
168
171
|
style.push(rowIndex%2===0?styles.even : theme.isDark()?styles.oddDark : styles.odd)
|
|
169
172
|
}
|
|
170
|
-
if(
|
|
173
|
+
if(selected){
|
|
171
174
|
style.push(styles.selected,{borderBottomWidth:1,borderBottomColor:theme.colors.primary})
|
|
172
175
|
}
|
|
173
176
|
if(paid || row.paid){
|
|
@@ -20,7 +20,7 @@ import {ACTION_ICON_SIZE} from "$ecomponents/AppBar";
|
|
|
20
20
|
import DialogFooter from "./DialogFooter";
|
|
21
21
|
import { Dimensions } from "react-native";
|
|
22
22
|
import Surface from "$ecomponents/Surface";
|
|
23
|
-
import
|
|
23
|
+
import DialogContent from "./DialogContent";
|
|
24
24
|
|
|
25
25
|
export const FOOTER_HEIGHT = 50;
|
|
26
26
|
export const HEADER_HEIGHT = 50;
|
|
@@ -198,14 +198,14 @@ const DialogComponent = React.forwardRef((props,ref)=>{
|
|
|
198
198
|
testID = {testID}
|
|
199
199
|
contentContainerProps = {contentContainerProps}
|
|
200
200
|
>
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
201
|
+
<DialogContent isFullScreen={isFullScreenDialog} isPreloader={isPreloader}>
|
|
202
|
+
<Surface
|
|
203
|
+
testID = {testID+"_Overlay"}
|
|
204
|
+
ref={overlayRef}
|
|
205
|
+
{...overlayProps}
|
|
206
|
+
style={[styles.overlay,isAlert && styles.overlayAlert,{backgroundColor},overlayProps.style,fullScreenStyle]}
|
|
207
|
+
>
|
|
208
|
+
{(!isAlert && (actions || title || subtitle)) ? <AppBarDialog
|
|
209
209
|
actionsProps = {actionsProps}
|
|
210
210
|
testID = {testID+"_AppBar"}
|
|
211
211
|
{...appBarProps}
|
|
@@ -269,14 +269,15 @@ const DialogComponent = React.forwardRef((props,ref)=>{
|
|
|
269
269
|
isFullScreen = {isFullScreenDialog}
|
|
270
270
|
fullScreen = {customFullScreen}
|
|
271
271
|
children = {footer}
|
|
272
|
-
/> : null}
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
/> : null}
|
|
273
|
+
</Surface>
|
|
274
|
+
</DialogContent>
|
|
275
275
|
</ModalComponent>
|
|
276
276
|
</Portal>
|
|
277
277
|
});
|
|
278
278
|
export default DialogComponent;
|
|
279
279
|
|
|
280
|
+
|
|
280
281
|
DialogComponent.propTypes= {
|
|
281
282
|
...Modal.propTypes,
|
|
282
283
|
isAlert : PropTypes.bool,//si c'est le rendu alert, pour le rendu de l'alerte
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import KeyboardAvoidingView from "../KeyboardAvoidingView";
|
|
2
|
+
import React from "$react";
|
|
3
|
+
import { useWindowDimensions } from "react-native";
|
|
4
|
+
|
|
5
|
+
const DialogContentComponent = ({isPreloader,isFullScreen,...props})=>{
|
|
6
|
+
const isFull = isFullScreen();
|
|
7
|
+
//useWindowDimensions();
|
|
8
|
+
const content = React.useMemo(()=>props.children,[isPreloader]);
|
|
9
|
+
return isPreloader || !isFull ? content : <KeyboardAvoidingView>{content}</KeyboardAvoidingView>
|
|
10
|
+
}
|
|
11
|
+
export default DialogContentComponent;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import View from "$ecomponents/View";
|
|
2
2
|
import React from "$react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import {isNonNullString} from "$cutils";
|
|
4
|
+
import theme from "$theme";
|
|
5
|
+
const KeyboardAvoidingViewComponent = React.forwardRef(({children,style,testID,...props},ref)=>{
|
|
6
|
+
return <View {...props} style={[theme.styles.flex1,style]} children={children} testID={isNonNullString(testID) ? `${testID.trim()}_KeyboardAvoidingView` : "RN_KeyboardAvoidingView"}/>
|
|
5
7
|
});
|
|
6
8
|
|
|
7
9
|
KeyboardAvoidingViewComponent.displayName = "KeyboardAvoidingViewComponent";
|
|
8
|
-
KeyboardAvoidingViewComponent.propTypes = Object.assign({},View.propTypes);
|
|
10
|
+
KeyboardAvoidingViewComponent.propTypes = Object.assign({},View.propTypes);
|
|
11
|
+
|
|
12
|
+
export default KeyboardAvoidingViewComponent;
|
|
@@ -42,6 +42,7 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
style = Object.assign({},StyleSheet.flatten(style));
|
|
45
|
+
let hasP = Object.size(style,true);
|
|
45
46
|
testID = defaultStr(testID,"RN_LabelComponent");
|
|
46
47
|
const restProps = {id};
|
|
47
48
|
if(splitText){
|
|
@@ -54,6 +55,9 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
54
55
|
if(wrap){
|
|
55
56
|
r1.flexWrap = "wrap";
|
|
56
57
|
}
|
|
58
|
+
if(disabled){
|
|
59
|
+
r1.pointerEvents = "none";
|
|
60
|
+
}
|
|
57
61
|
if(isNonNullString(children) || isText || typeof children ==='number'){
|
|
58
62
|
if(!isText){
|
|
59
63
|
children +="";
|
|
@@ -69,7 +73,6 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
69
73
|
role={typeof role =='string' && role && supportedRoles.includes(role.trim()) && role.trim() || undefined}
|
|
70
74
|
style={[styles.label,splitText?styles.wrap:null,splitText?styles.w100:null,bold?styles.bold:null,r2,style,r1,styles.webFontFamilly]}>{children}</Text>)
|
|
71
75
|
}
|
|
72
|
-
let hasP = false;
|
|
73
76
|
if(isObj(rest)){
|
|
74
77
|
for(let i in rest){
|
|
75
78
|
if(rest[i]!== undefined) {
|
|
@@ -81,14 +84,15 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
81
84
|
if(children == undefined){
|
|
82
85
|
return null;
|
|
83
86
|
}
|
|
87
|
+
const viewStyle = [bold?styles.bold:null,r2,style,r1];
|
|
84
88
|
if(React.isValidElement(children)){
|
|
85
89
|
if(!hasP) {
|
|
86
90
|
if(id || ref){
|
|
87
|
-
return <View ref = {ref} testID = {testID} id={id}>{children}</View>
|
|
91
|
+
return <View ref = {ref} testID = {testID} id={id} style={viewStyle}>{children}</View>
|
|
88
92
|
}
|
|
89
|
-
return
|
|
93
|
+
return children;
|
|
90
94
|
}
|
|
91
|
-
return <View ref = {ref} selectable={defaultSelectable} {...rest} {...restProps} testID = {testID} style={
|
|
95
|
+
return <View ref = {ref} selectable={defaultSelectable} {...rest} {...restProps} testID = {testID} style={viewStyle} disabled={disabled}>{children}</View>
|
|
92
96
|
}
|
|
93
97
|
return null;
|
|
94
98
|
})
|
|
@@ -3,7 +3,7 @@ import React from "$react";
|
|
|
3
3
|
import { prepareItems as customPrepareItems,getBToTopRef } from "./utils";
|
|
4
4
|
import {grid,StylePropTypes} from "$theme";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
|
-
import {defaultObj,extendObj,isObj,defaultDecimal,defaultArray,defaultFunc} from "$cutils";
|
|
6
|
+
import {defaultObj,defaultStr,extendObj,isObj,defaultDecimal,defaultArray,defaultFunc} from "$cutils";
|
|
7
7
|
import {isMobileMedia} from "$cplatform/dimensions";
|
|
8
8
|
import BackToTop from "$ecomponents/BackToTop";
|
|
9
9
|
import {FlatList,StyleSheet,View} from "react-native";
|
|
@@ -13,7 +13,7 @@ import { useList } from "./hooks";
|
|
|
13
13
|
|
|
14
14
|
const CommonListComponent = React.forwardRef((props,ref)=>{
|
|
15
15
|
const context = useList(props);
|
|
16
|
-
let {responsive,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 {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;
|
|
17
17
|
withBackToTopButton = withBackToTop === true || withBackToTopButton == true || isMobileMedia()? true : false;
|
|
18
18
|
rest = defaultObj(rest);
|
|
19
19
|
containerProps = defaultObj(containerProps);
|
|
@@ -30,6 +30,7 @@ const CommonListComponent = React.forwardRef((props,ref)=>{
|
|
|
30
30
|
const hasCustomBackToTop = typeof customBackToTopRef == 'function'? true : false;
|
|
31
31
|
const backToTopRef = React.useRef(null);
|
|
32
32
|
const isFlatList = Component === FlatList;
|
|
33
|
+
defaultStr(props.testID,"RN_CommonListComponent");
|
|
33
34
|
extendObj(context,{
|
|
34
35
|
getKey : typeof keyExtractor =='function'? keyExtractor : typeof getItemKey =='function'? getItemKey : typeof getKey =='function'? getKey : undefined,
|
|
35
36
|
addItemsRefs : function(ref, itemRef){
|
|
@@ -150,12 +151,13 @@ const CommonListComponent = React.forwardRef((props,ref)=>{
|
|
|
150
151
|
const restP = numColumns > 1 && isFlatList ? {
|
|
151
152
|
columnWrapperStyle : [styles.columnWrapperStyle,props.columnWrapperStyle]
|
|
152
153
|
} : {};
|
|
153
|
-
return <View {...containerProps} style={[styles.container,containerProps.style]}>
|
|
154
|
+
return <View testID={testID+"_CommonListContainer"} {...containerProps} style={[styles.container,containerProps.style]}>
|
|
154
155
|
<Component
|
|
155
156
|
onEndReachedThreshold={0}
|
|
156
157
|
scrollEventThrottle={16}
|
|
157
158
|
{...rest}
|
|
158
159
|
{...restP}
|
|
160
|
+
testID = {testID}
|
|
159
161
|
ref = {listRef}
|
|
160
162
|
onScroll={context.onScroll}
|
|
161
163
|
data = {context.items}
|
|
@@ -7,19 +7,19 @@ import View from "$ecomponents/View";
|
|
|
7
7
|
const FlashListComponent = React.forwardRef((props,ref)=>{
|
|
8
8
|
const {testID} = props
|
|
9
9
|
return (<CommonListComponent
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
testID = {'RN_FlashListComponent'}
|
|
11
|
+
estimatedItemSize = {50}
|
|
12
|
+
ListHeaderComponent={() => (
|
|
13
|
+
<View testID={(testID||'RN_FlashListComponent')+"_Header"}>{props.children}</View>
|
|
14
|
+
)}
|
|
15
|
+
//disableAutoLayout
|
|
16
|
+
//disableHorizontalListHeightMeasurement = {props.horizontal?undefined : true}
|
|
17
|
+
{...props}
|
|
18
|
+
contentContainerStyle = {undefined}
|
|
19
|
+
style = {undefined}
|
|
20
|
+
Component = {FlashList}
|
|
21
|
+
ref={ref}
|
|
22
|
+
/>)
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
FlashListComponent.propTypes = {
|