@fto-consult/expo-ui 6.60.4 → 6.62.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/bin/create-app.js +2 -0
- package/electron/expo-ui.json +7 -6
- package/package.json +3 -3
- package/src/components/Datagrid/SWRDatagrid.js +3 -2
- package/src/components/Drawer/DrawerLayout/index.js +2 -3
- package/src/components/Fab/GroupComponent.js +9 -7
- package/src/components/Form/Fields/Field.js +3 -14
- package/src/components/Form/Fields/SelectField.js +4 -1
- package/src/components/Form/Fields/SelectFontIcon.js +4 -1
- package/src/components/Image/index.js +1 -2
- package/src/components/Menu/Item.js +1 -1
- package/src/components/Modal/index.js +2 -3
- package/src/components/PhoneInput/index.js +1 -3
- package/src/components/SimpleSelect/index.js +6 -5
- package/src/media/file-system/index.js +3 -1
- package/src/media/file-system/path.js +8 -0
- package/src/media/file-system/utils/FileSaver.js +15 -0
- package/src/media/file-system/utils/FileSaver.native.js +34 -0
- package/src/media/file-system/utils/index.js +2 -1
- package/src/media/file-system/utils/index.native.js +2 -1
- package/src/media/file-system/utils/native/index.js +13 -1
- package/src/media/file-system/utils/{web/write.js → utils.js} +17 -30
- package/src/media/file-system/utils/web/index.js +1 -1
- package/src/screens/Help/openLibraries.js +1 -1
package/bin/create-app.js
CHANGED
@@ -125,6 +125,8 @@ const createAPPJSONFile = (projectRoot,{name,version})=>{
|
|
125
125
|
"supportsTablet": true
|
126
126
|
},
|
127
127
|
"android": {
|
128
|
+
"blockedPermissions": [],
|
129
|
+
"softwareKeyboardLayoutMode": "pan",
|
128
130
|
"adaptiveIcon": {
|
129
131
|
"foregroundImage": "./assets/adaptive-icon.png",
|
130
132
|
"backgroundColor": "#ffffff"
|
package/electron/expo-ui.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.61.1",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"main": "main",
|
6
6
|
"scripts": {
|
@@ -70,18 +70,18 @@
|
|
70
70
|
"@expo/html-elements": "^0.5.1",
|
71
71
|
"@expo/vector-icons": "^13.0.0",
|
72
72
|
"@faker-js/faker": "^8.0.2",
|
73
|
-
"@fto-consult/common": "^3.
|
73
|
+
"@fto-consult/common": "^3.54.2",
|
74
74
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
75
75
|
"@react-native-async-storage/async-storage": "1.18.2",
|
76
76
|
"@react-native-community/datetimepicker": "7.2.0",
|
77
77
|
"@react-native-community/netinfo": "9.3.10",
|
78
78
|
"@react-native/assets-registry": "^0.72.0",
|
79
|
-
"@react-navigation/native": "^6.1.
|
80
|
-
"@react-navigation/native-stack": "^6.9.
|
81
|
-
"@react-navigation/stack": "^6.3.
|
79
|
+
"@react-navigation/native": "^6.1.9",
|
80
|
+
"@react-navigation/native-stack": "^6.9.16",
|
81
|
+
"@react-navigation/stack": "^6.3.20",
|
82
82
|
"@shopify/flash-list": "1.4.3",
|
83
83
|
"apexcharts": "^3.44.0",
|
84
|
-
"expo": "^49.0.
|
84
|
+
"expo": "^49.0.16",
|
85
85
|
"expo-camera": "~13.4.4",
|
86
86
|
"expo-clipboard": "~4.3.1",
|
87
87
|
"expo-font": "~11.4.0",
|
@@ -124,6 +124,7 @@
|
|
124
124
|
"xlsx": "^0.18.5"
|
125
125
|
},
|
126
126
|
"devDependencies": {
|
127
|
+
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
127
128
|
"@expo/metro-config": "^0.10.7",
|
128
129
|
"@expo/webpack-config": "^19.0.0",
|
129
130
|
"babel-plugin-inline-dotenv": "^1.7.0",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.62.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"main": "main",
|
6
6
|
"scripts": {
|
@@ -77,8 +77,8 @@
|
|
77
77
|
"@react-native-community/netinfo": "9.3.10",
|
78
78
|
"@react-native/assets-registry": "^0.72.0",
|
79
79
|
"@react-navigation/native": "^6.1.9",
|
80
|
-
"@react-navigation/native-stack": "^6.9.
|
81
|
-
"@react-navigation/stack": "^6.3.
|
80
|
+
"@react-navigation/native-stack": "^6.9.16",
|
81
|
+
"@react-navigation/stack": "^6.3.20",
|
82
82
|
"@shopify/flash-list": "1.4.3",
|
83
83
|
"apexcharts": "^3.44.0",
|
84
84
|
"expo": "^49.0.16",
|
@@ -14,10 +14,11 @@ import DateLib from "$lib/date";
|
|
14
14
|
import {getFetchOptions} from "$cutils/filters";
|
15
15
|
import {setQueryParams} from "$cutils/uri";
|
16
16
|
import {uniqid} from "$cutils";
|
17
|
-
import apiFetch
|
17
|
+
import apiFetch from "$capi/fetch";
|
18
18
|
import Icon from "$ecomponents/Icon";
|
19
19
|
import Label from "$ecomponents/Label";
|
20
|
-
import { StyleSheet
|
20
|
+
import { StyleSheet} from "react-native";
|
21
|
+
import View from "$ecomponents/View";
|
21
22
|
import theme from "$theme";
|
22
23
|
import useSWR from "$swr";
|
23
24
|
import {getRowsPerPagesLimits} from "./Common/utils";
|
@@ -177,15 +177,14 @@ export default class DrawerLayout extends React.PureComponent {
|
|
177
177
|
{...this._panResponder.panHandlers}
|
178
178
|
>
|
179
179
|
{!permanent && <TouchableWithoutFeedback
|
180
|
-
|
180
|
+
style={{pointerEvents}}
|
181
181
|
testID = {testID+"_TouchableWithoutFeedBack"}
|
182
182
|
onPress={this._onOverlayClick}
|
183
183
|
>
|
184
184
|
<Animated.View
|
185
185
|
testID={testID+"_Backdrow"}
|
186
|
-
pointerEvents={pointerEvents}
|
187
186
|
ref = {this._backdropRef}
|
188
|
-
style={[styles.overlay,{backgroundColor:theme.colors.backdrop}, animatedOverlayStyles]}
|
187
|
+
style={[styles.overlay,{backgroundColor:theme.colors.backdrop},{pointerEvents}, animatedOverlayStyles]}
|
189
188
|
/>
|
190
189
|
</TouchableWithoutFeedback>}
|
191
190
|
{posRight && this.renderContent({testID})}
|
@@ -115,22 +115,22 @@ const FABGroup = ({
|
|
115
115
|
const Item = isFormAction ? Action : FabItem;
|
116
116
|
const itemComponentProps = isFormAction ? {Component : FabItem} : {};
|
117
117
|
return (
|
118
|
-
<View testID={testID+"_Container"}
|
118
|
+
<View testID={testID+"_Container"} style={[styles.container, style]}>
|
119
119
|
<TouchableWithoutFeedback testID={testID+"_TouchableOpacity"} onPress={close}>
|
120
120
|
<Animated.View
|
121
121
|
testID={testID+"_AnimatedView"}
|
122
|
-
pointerEvents={open ? 'auto' : 'none'}
|
123
122
|
style={[
|
124
123
|
styles.backdrop,
|
125
124
|
{
|
126
125
|
opacity: backdropOpacity,
|
127
126
|
backgroundColor: colors.backdrop,
|
127
|
+
pointerEvents : open ? 'auto' : 'none',
|
128
128
|
},
|
129
129
|
]}
|
130
130
|
/>
|
131
131
|
</TouchableWithoutFeedback>
|
132
|
-
<SafeAreaView testID={testID+"_SafeAreaView"}
|
133
|
-
<View testID={testID+"_ItemsContainer"} style={[styles.itemsContainer
|
132
|
+
<SafeAreaView testID={testID+"_SafeAreaView"} style={styles.safeArea}>
|
133
|
+
<View testID={testID+"_ItemsContainer"} style={[styles.itemsContainer,{pointerEvents:open ? 'box-none' : 'none'}]}>
|
134
134
|
{actions.map((it, i) => {
|
135
135
|
const itemProps = {
|
136
136
|
...it,
|
@@ -148,9 +148,9 @@ const FABGroup = ({
|
|
148
148
|
{
|
149
149
|
marginHorizontal:
|
150
150
|
typeof it.small || it.small ? 24 : 16,
|
151
|
+
pointerEvents : open ? 'box-none' : 'none',
|
151
152
|
},
|
152
153
|
]}
|
153
|
-
pointerEvents={open ? 'box-none' : 'none'}
|
154
154
|
>
|
155
155
|
<Item
|
156
156
|
{...itemProps}
|
@@ -288,7 +288,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
288
288
|
const dStyle = disabled ? disabledStyle : null;
|
289
289
|
return <>
|
290
290
|
{label ? (
|
291
|
-
<View testID = {testID+"_LabelContainer"} style={dStyle
|
291
|
+
<View testID = {testID+"_LabelContainer"} style={[dStyle,{pointerEvents}]}>
|
292
292
|
<Card
|
293
293
|
testID={testID+"_Card"}
|
294
294
|
style={
|
@@ -323,7 +323,6 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
323
323
|
icon={icon}
|
324
324
|
color={color}
|
325
325
|
disabled = {disabled}
|
326
|
-
pointerEvents={pointerEvents}
|
327
326
|
style={
|
328
327
|
[
|
329
328
|
style,
|
@@ -333,6 +332,7 @@ const _FabItem = function({children,label,disabled:customDisabled,pointerEvents,
|
|
333
332
|
transform: [{ scale}],
|
334
333
|
opacity,
|
335
334
|
backgroundColor,
|
335
|
+
pointerEvents,
|
336
336
|
},
|
337
337
|
]
|
338
338
|
}
|
@@ -356,6 +356,7 @@ export const FabItem = theme.withStyles(_FabItem,{displayName:"FabItemComponent"
|
|
356
356
|
const styles = StyleSheet.create({
|
357
357
|
safeArea: {
|
358
358
|
alignItems: 'flex-end',
|
359
|
+
pointerEvents : "box-none",
|
359
360
|
},
|
360
361
|
itemsContainer : {
|
361
362
|
marginBottom : 70,
|
@@ -363,6 +364,7 @@ const styles = StyleSheet.create({
|
|
363
364
|
container: {
|
364
365
|
...StyleSheet.absoluteFillObject,
|
365
366
|
justifyContent: 'flex-end',
|
367
|
+
pointerEvents : "box-none",
|
366
368
|
},
|
367
369
|
fab: {
|
368
370
|
marginHorizontal: 16,
|
@@ -182,17 +182,6 @@ export default class Field extends AppComponent {
|
|
182
182
|
}
|
183
183
|
this.INITIAL_STATE.validType = this.INITIAL_STATE.validRule = validType;
|
184
184
|
this.INITIAL_STATE.validParams = validParams;
|
185
|
-
Object.defineProperties(this.INITIAL_STATE,{
|
186
|
-
beforeValidate : {
|
187
|
-
value : defaultFunc(beforeValidate),override : false,
|
188
|
-
},
|
189
|
-
onValidate : {
|
190
|
-
value : defaultFunc(onValidate),override : false,
|
191
|
-
},
|
192
|
-
onNoValidate : {
|
193
|
-
value : defaultFunc(onNoValidate),override : false,
|
194
|
-
},
|
195
|
-
})
|
196
185
|
if(!this.isValidRuleDynamic()){
|
197
186
|
Object.defineProperties(this.INITIAL_STATE,{
|
198
187
|
validType : {value:validType,override:false},
|
@@ -241,7 +230,7 @@ export default class Field extends AppComponent {
|
|
241
230
|
return context;
|
242
231
|
}
|
243
232
|
}
|
244
|
-
this.
|
233
|
+
typeof this.props.beforeValidate=="function" && this.props.beforeValidate.call(this,{...defaultObj(rest),value,name:this.name,field:this.name,formName:this.formName,context:this,event,validRule,validParams});
|
245
234
|
});
|
246
235
|
return _result;
|
247
236
|
}
|
@@ -284,7 +273,7 @@ export default class Field extends AppComponent {
|
|
284
273
|
actions[k][action]();
|
285
274
|
}
|
286
275
|
let form = Forms.getForm(this.formName);
|
287
|
-
this.
|
276
|
+
typeof this.props.onValidate=="function" && this.props.onValidate.call(this,{...defaultObj(rest),isFilter:this.isFilter(),props:this.props,formName:this.formName,form,name:this.name,field:this.name,value,event,context:this});
|
288
277
|
this.callOnChange({value,event,isValid:true,...rest});
|
289
278
|
if(form && form.props){
|
290
279
|
if(canEnable){
|
@@ -357,7 +346,7 @@ export default class Field extends AppComponent {
|
|
357
346
|
for(var k in actions){
|
358
347
|
actions[k].disable();
|
359
348
|
}
|
360
|
-
this.
|
349
|
+
typeof this.props.onNoValidate=="function" && this.props.onNoValidate.call(this,{...defaultObj(rest),isFilter:this.isFilter(),props:this.props,msg,value,formName:this.formName,field:this.name,name:this.name,context:this,event,validRule,validType:validRule,validParams,context:this});
|
361
350
|
let form = Forms.getForm(this.formName);
|
362
351
|
this.callOnChange({value,validRule,validParams,event,isValid:false,...rest});
|
363
352
|
if(form){
|
@@ -121,8 +121,11 @@ export default class FormSelectField extends Field{
|
|
121
121
|
ref = {(el)=>{
|
122
122
|
this._field = el;
|
123
123
|
}}
|
124
|
-
onMount = {({context})=>{
|
124
|
+
onMount = {({context,...rest})=>{
|
125
125
|
this._field = context;
|
126
|
+
if(typeof props.onMount =='function'){
|
127
|
+
props.onMount({context,...rest});
|
128
|
+
}
|
126
129
|
}}
|
127
130
|
onChange = {(args)=>{
|
128
131
|
this.validateWithCallOnChange(args);
|
@@ -8,8 +8,11 @@ export default class FormFieldSelectFontIcon extends SelectField{
|
|
8
8
|
ref = {(el)=>{
|
9
9
|
this._field = el;
|
10
10
|
}}
|
11
|
-
onMount = {({context})=>{
|
11
|
+
onMount = {({context,...rest})=>{
|
12
12
|
this._field = context;
|
13
|
+
if(typeof props.onMount =='function'){
|
14
|
+
props.onMount({context,...rest});
|
15
|
+
}
|
13
16
|
}}
|
14
17
|
onChange = {(args)=>{
|
15
18
|
this.validateWithCallOnChange(args);
|
@@ -252,13 +252,12 @@ export default function ImageComponent(props){
|
|
252
252
|
}
|
253
253
|
const _label = defaultString(label);
|
254
254
|
const isDisabled = menuItems.length > 0 ? true : false;
|
255
|
-
const pointerEvents = isDisabled ? "auto" :"none";
|
256
255
|
return <View testID={testID+"_FagmentContainer"}>
|
257
256
|
{!createSignatureOnly ? (<Menu
|
258
257
|
{...menuProps}
|
259
258
|
disabled = {isDisabled}
|
260
259
|
anchor = {(props)=>{
|
261
|
-
return <View accessibilityLabel = {_label} testID={testID+"_Container"} {...containerProps}
|
260
|
+
return <View accessibilityLabel = {_label} testID={testID+"_Container"} {...containerProps} style={[label?styles.align:null,containerProps.style,{pointerEvents:disabled|| readOnly? "none":"auto"},label?styles.container:null]}>
|
262
261
|
{<Label testID={testID+"_Label"} {...labelProps} disabled={disabled} style={[styles.label,labelProps.style]}>{label}</Label>}
|
263
262
|
{<Avatar
|
264
263
|
resizeMethod = {"auto"}
|
@@ -96,10 +96,10 @@ const MenuItemComponent = React.forwardRef(({
|
|
96
96
|
) : null}
|
97
97
|
<View
|
98
98
|
testID={testID+"_Right2LabelContainer"}
|
99
|
-
pointerEvents={!right?"none":"auto"}
|
100
99
|
{...contentContainerProps}
|
101
100
|
style={[
|
102
101
|
styles.item,
|
102
|
+
{pointerEvents:!right?"none":"auto"},
|
103
103
|
styles.content,
|
104
104
|
!maxWidthStyle && icon ? styles.widthWithIcon : null,
|
105
105
|
contentStyle,
|
@@ -111,11 +111,10 @@ const ModalComponent = React.forwardRef((props,ref)=>{
|
|
111
111
|
ref={ref}
|
112
112
|
testID={'RN__ModalComponent'}
|
113
113
|
{...rest}
|
114
|
-
pointerEvents={visible ? 'auto' : 'none'}
|
115
114
|
accessibilityViewIsModal
|
116
115
|
role="polite"
|
117
116
|
onAccessibilityEscape={hideModal}
|
118
|
-
style = {[styles.modal,rest.style]}
|
117
|
+
style = {[styles.modal,rest.style,{pointerEvents:visible ? 'auto' : 'none'}]}
|
119
118
|
animationType = {animationType}
|
120
119
|
animationDuration = {animationDuration}
|
121
120
|
animationPosition = {animationPosition}
|
@@ -144,7 +143,6 @@ const ModalComponent = React.forwardRef((props,ref)=>{
|
|
144
143
|
{...wrapperProps}
|
145
144
|
ref = {contentContainerRef}
|
146
145
|
style={[styles.contentContainer,{ marginTop: TOP_INSET, marginBottom: BOTTOM_INSET,backgroundColor:'transparent' },contentContainerProps.style]}
|
147
|
-
pointerEvents="box-none"
|
148
146
|
>
|
149
147
|
{children}
|
150
148
|
</Surface>
|
@@ -162,6 +160,7 @@ const styles = StyleSheet.create({
|
|
162
160
|
},
|
163
161
|
contentContainer: {
|
164
162
|
...StyleSheet.absoluteFillObject,
|
163
|
+
pointerEvents : "box-none",
|
165
164
|
alignItems : 'center',
|
166
165
|
justifyContent : 'center',
|
167
166
|
flex : 1,
|
@@ -162,10 +162,8 @@ export default function PhoneInputComponent(props){
|
|
162
162
|
disabled = {props.disabled}
|
163
163
|
pointerEvents = {pointerEvents}
|
164
164
|
left = {
|
165
|
-
<Pressable testID={testID+"_Left"} style={[styles.flag,disabledStyle,!isFlatMode && styles.notFlatModeFlag]}
|
166
|
-
//role="button"
|
165
|
+
<Pressable testID={testID+"_Left"} style={[styles.flag,{pointerEvents},disabledStyle,!isFlatMode && styles.notFlatModeFlag]}
|
167
166
|
disabled = {props.disabled}
|
168
|
-
pointerEvents = {pointerEvents}
|
169
167
|
onPress={onPressFlag}
|
170
168
|
>
|
171
169
|
<>
|
@@ -167,7 +167,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
167
167
|
React.setRef(ref,context);
|
168
168
|
React.useEffect(()=>{
|
169
169
|
if(onMount ==='function'){
|
170
|
-
onMount({context})
|
170
|
+
onMount({context,props})
|
171
171
|
}
|
172
172
|
return ()=>{
|
173
173
|
React.setRef(ref,null);
|
@@ -277,17 +277,18 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
277
277
|
const renderingItems = getItems();
|
278
278
|
const autoFocus = canAutoFocusSearchField({visible,items:renderingItems});
|
279
279
|
testID = defaultStr(testID, "RN_SimpleSelectComponent");
|
280
|
+
anchorContainerProps = defaultObj(anchorContainerProps);
|
280
281
|
anchor = <Pressable
|
281
282
|
//role="button"
|
282
283
|
activeOpacity={0.3}
|
283
284
|
testID = {testID}
|
284
|
-
{...
|
285
|
+
{...anchorContainerProps}
|
285
286
|
onPress={show}
|
286
287
|
disabled = {!isEditable}
|
287
|
-
pointerEvents = {pointerEvents}
|
288
288
|
accessibilityLabel={defaultStr(label,text)}
|
289
289
|
rippleColor={undefined}
|
290
290
|
onLayout={onLayout}
|
291
|
+
style = {[{pointerEvents},anchorContainerProps.style]}
|
291
292
|
>
|
292
293
|
{anchor}
|
293
294
|
</Pressable>
|
@@ -323,10 +324,10 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
323
324
|
},
|
324
325
|
isMob && {flex:1},
|
325
326
|
!isMob && {paddingRight : 0},
|
326
|
-
contentContainerProps.style
|
327
|
+
contentContainerProps.style,
|
328
|
+
{pointerEvents:contentContainerProps.pointerEvents||pointerEvents||undefined},
|
327
329
|
]
|
328
330
|
}
|
329
|
-
pointerEvents = {pointerEvents}
|
330
331
|
>
|
331
332
|
{showSearch !== false && <>
|
332
333
|
<TextField
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const FileSaver = require('file-saver');
|
2
|
+
import {defaultNumber} from "$cutils";
|
3
|
+
|
4
|
+
export const saveBlob = ({content,fileName,timeout,delay})=>{
|
5
|
+
return new Promise((resolve,reject)=>{
|
6
|
+
try {
|
7
|
+
FileSaver.saveAs(content, fileName);
|
8
|
+
setTimeout(() => {
|
9
|
+
resolve({path:fileName,isWeb : true});
|
10
|
+
}, defaultNumber(timeout,delay,3000));
|
11
|
+
} catch(e){
|
12
|
+
reject(e);
|
13
|
+
}
|
14
|
+
})
|
15
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { Directories,FileSystem } from "./native";
|
2
|
+
import {defaultStr} from "$cutils";
|
3
|
+
import p from "../path";
|
4
|
+
import * as Sharing from 'expo-sharing';
|
5
|
+
|
6
|
+
export const saveBlob = ({content,share,directory,fileName,path})=>{
|
7
|
+
path = defaultStr(path,directory,Directories.DOCUMENTS).trim().rtrim("/");
|
8
|
+
let hasFound = false;
|
9
|
+
for(let i in Directories){
|
10
|
+
if(path.includes(Directories[i].rtrim("/"))){
|
11
|
+
hasFound = true;
|
12
|
+
break;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
if(!hasFound){
|
16
|
+
path = Directories.DOCUMENTS;
|
17
|
+
}
|
18
|
+
path = p.join(path,fileName);
|
19
|
+
return new Promise((resolve,reject)=>{
|
20
|
+
const fr = new FileReader();
|
21
|
+
fr.onload = () => {
|
22
|
+
return FileSystem.writeAsStringAsync(path, fr.result.split(',')[1], { encoding: FileSystem.EncodingType.Base64 }).then((r)=>{
|
23
|
+
setTimeout(()=>{
|
24
|
+
if(share){
|
25
|
+
Sharing.shareAsync(path);
|
26
|
+
}
|
27
|
+
},0);
|
28
|
+
resolve({fileName,path});
|
29
|
+
}).catch(reject);
|
30
|
+
};
|
31
|
+
fr.onerror(reject);
|
32
|
+
fr.readAsDataURL(content);
|
33
|
+
});
|
34
|
+
}
|
@@ -1 +1,2 @@
|
|
1
|
-
export * from "./web";
|
1
|
+
export * from "./web";
|
2
|
+
export * from "./utils";
|
@@ -1 +1,2 @@
|
|
1
|
-
export * from "./native";
|
1
|
+
export * from "./native";
|
2
|
+
export * from "./utils";
|
@@ -1 +1,13 @@
|
|
1
|
-
|
1
|
+
import * as FileSystem from 'expo-file-system';
|
2
|
+
export * from "expo-file-system";
|
3
|
+
|
4
|
+
export const Directories = {
|
5
|
+
get DOCUMENTS(){
|
6
|
+
return FileSystem.documentDirectory;
|
7
|
+
},
|
8
|
+
get CACHE(){
|
9
|
+
return FileSystem.cacheDirectory;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
export {FileSystem};
|
@@ -2,10 +2,10 @@
|
|
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
|
import {defaultStr,base64toBlob,dataURLToBlob,getTypeFromDataURL,isNonNullString,getFileName,getFileExtension,defaultNumber,defaultBool,dataURLToBase64,isBlob,isBase64,isDataURL} from "$cutils";
|
5
|
-
const FileSaver = require('file-saver');
|
6
5
|
const mime = require('react-native-mime-types')
|
7
6
|
const XLSX = require("xlsx");
|
8
7
|
import Preloader from "$preloader";
|
8
|
+
import * as FileSaver from "./FileSaver";
|
9
9
|
|
10
10
|
|
11
11
|
/**** sauvegarde un fichier sur le disque
|
@@ -14,49 +14,35 @@ import Preloader from "$preloader";
|
|
14
14
|
* charset {string}: L'encodage à utiliser pour l'enregistrement du fichier, par défaut utf-8
|
15
15
|
* directory || dir {string} : le répertoire dans lequel enregistrer le fichier
|
16
16
|
* systemDirectory || SystemDirectory : le répertoire racine au device, où enregistrer la données
|
17
|
+
path {string}, le chemin de sauvegarde des données
|
17
18
|
* fileName {string} : le nom du fichier à enregistrer
|
18
19
|
* success {function} : la fonction de rappel à appeler en cas de success
|
19
20
|
* error {function} la fonction de rappel à appeler en cas d'erreur
|
20
21
|
* isBinary : si c'est un fichier binaire
|
21
22
|
* }
|
22
23
|
*/
|
23
|
-
export const write = ({content,type,
|
24
|
-
share = defaultBool(share,true);
|
24
|
+
export const write = ({content,type,share,contentType,fileName,...rest})=>{
|
25
25
|
fileName = sanitizeFileName(fileName);
|
26
26
|
contentType = defaultStr(contentType) || mime.contentType(fileName) || mime.contentType(".txt");
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}
|
38
|
-
}
|
39
|
-
content = isBlob(content)? content : new Blob([content], { type: content?.type||contentType})
|
40
|
-
try {
|
41
|
-
FileSaver.saveAs(content, fileName);
|
42
|
-
setTimeout(() => {
|
43
|
-
resolve({path:fileName,isWeb : true});
|
44
|
-
}, defaultNumber(timeout,delay,3000));
|
45
|
-
} catch(e){
|
46
|
-
reject(e);
|
27
|
+
if(!isNonNullString(fileName)){
|
28
|
+
return Promise.reject({status:false,msg:'Nom de fichier invalide'});
|
29
|
+
}
|
30
|
+
if(isBase64(content)){
|
31
|
+
content = new Blob([base64toBlob(content,contentType)], {});
|
32
|
+
} else if(isDataURL(content)){
|
33
|
+
const type = getTypeFromDataURL(content);
|
34
|
+
content = dataURLToBlob(content);
|
35
|
+
if(isNonNullString(type)){
|
36
|
+
contentType = type;
|
47
37
|
}
|
48
|
-
}
|
38
|
+
}
|
39
|
+
return FileSaver.saveBlob({content:isBlob(content)? content : new Blob([content], { type: content?.type||contentType}),share:defaultBool(share,true),fileName,contentType,...rest})
|
49
40
|
}
|
50
41
|
|
51
42
|
export const writeText = (args)=>{
|
52
43
|
return write({...args,contentType:mime.contentType(".txt")});
|
53
44
|
}
|
54
|
-
|
55
|
-
var buf = new ArrayBuffer(s.length);
|
56
|
-
var view = new Uint8Array(buf);
|
57
|
-
for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
58
|
-
return buf;
|
59
|
-
}
|
45
|
+
|
60
46
|
/***
|
61
47
|
* @see https://ourtechroom.com/tech/mime-type-for-excel/ for excel mimesTypes
|
62
48
|
* .xls : application/vnd.ms-excel
|
@@ -101,3 +87,4 @@ export const writeImage = ({content,fileName,...rest})=>{
|
|
101
87
|
}
|
102
88
|
|
103
89
|
|
90
|
+
export {FileSaver};
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.
|
1
|
+
module.exports = {"@fto-consult/expo-ui":{"name":"@fto-consult/expo-ui","version":"6.61.1","repository":{"type":"git","url":"git+https://github.com/borispipo/expo-ui.git"},"homepage":"https://github.com/borispipo/expo-ui#readme"},"@babel/plugin-proposal-export-namespace-from":{"version":"7.18.9","url":"https://babel.dev/docs/en/next/babel-plugin-proposal-export-namespace-from","license":"MIT"},"@emotion/native":{"version":"11.11.0","url":"https://emotion.sh","license":"MIT"},"@emotion/react":{"version":"11.11.1","url":"https://github.com/emotion-js/emotion/tree/main/packages/react","license":"MIT"},"@expo/html-elements":{"version":"0.5.1","url":"https://github.com/expo/expo/tree/main/packages/html-elements","license":"MIT"},"@expo/metro-config":{"version":"0.10.7","url":"https://github.com/expo/expo.git","license":"MIT"},"@expo/vector-icons":{"version":"13.0.0","url":"https://expo.github.io/vector-icons","license":"MIT"},"@expo/webpack-config":{"version":"19.0.0","url":"https://github.com/expo/expo-cli.git","license":"MIT"},"@faker-js/faker":{"version":"8.0.2","url":"https://github.com/faker-js/faker.git","license":"MIT"},"@fto-consult/common":{"version":"3.54.2","url":"https://github.com/borispipo/common#readme","license":"ISC"},"@pchmn/expo-material3-theme":{"version":"1.3.1","url":"https://github.com/pchmn/expo-material3-theme#readme","license":"MIT"},"@react-native-async-storage/async-storage":{"version":"1.18.2","url":"https://github.com/react-native-async-storage/async-storage#readme","license":"MIT"},"@react-native-community/datetimepicker":{"version":"7.2.0","url":"https://github.com/react-native-community/datetimepicker#readme","license":"MIT"},"@react-native-community/netinfo":{"version":"9.3.10","url":"https://github.com/react-native-netinfo/react-native-netinfo#readme","license":"MIT"},"@react-native/assets-registry":{"version":"0.72.0","url":"git@github.com:facebook/react-native.git","license":"MIT"},"@react-navigation/native":{"version":"6.1.9","url":"https://reactnavigation.org","license":"MIT"},"@react-navigation/native-stack":{"version":"6.9.16","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"@react-navigation/stack":{"version":"6.3.20","url":"https://reactnavigation.org/docs/stack-navigator/","license":"MIT"},"@shopify/flash-list":{"version":"1.4.3","url":"https://shopify.github.io/flash-list/","license":"MIT"},"apexcharts":{"version":"3.44.0","url":"https://apexcharts.com","license":"MIT"},"babel-plugin-inline-dotenv":{"version":"1.7.0","url":"https://github.com/brysgo/babel-plugin-inline-dotenv#readme","license":"ISC"},"babel-plugin-module-resolver":{"version":"5.0.0","url":"https://github.com/tleunen/babel-plugin-module-resolver.git","license":"MIT"},"expo":{"version":"49.0.16","url":"https://github.com/expo/expo/tree/main/packages/expo","license":"MIT"},"expo-camera":{"version":"13.4.4","url":"https://docs.expo.dev/versions/latest/sdk/camera/","license":"MIT"},"expo-clipboard":{"version":"4.3.1","url":"https://docs.expo.dev/versions/latest/sdk/clipboard","license":"MIT"},"expo-font":{"version":"11.4.0","url":"https://docs.expo.dev/versions/latest/sdk/font/","license":"MIT"},"expo-image-picker":{"version":"14.3.2","url":"https://docs.expo.dev/versions/latest/sdk/imagepicker/","license":"MIT"},"expo-linking":{"version":"5.0.2","url":"https://docs.expo.dev/versions/latest/sdk/linking","license":"MIT"},"expo-sqlite":{"version":"11.3.3","url":"https://docs.expo.dev/versions/latest/sdk/sqlite/","license":"MIT"},"expo-status-bar":{"version":"1.6.0","url":"https://docs.expo.dev/versions/latest/sdk/status-bar/","license":"MIT"},"expo-system-ui":{"version":"2.4.0","url":"https://docs.expo.dev/versions/latest/sdk/system-ui","license":"MIT"},"expo-web-browser":{"version":"12.3.2","url":"https://docs.expo.dev/versions/latest/sdk/webbrowser/","license":"MIT"},"file-saver":{"version":"2.0.5","url":"https://github.com/eligrey/FileSaver.js#readme","license":"MIT"},"fs-extra":{"version":"11.1.1","url":"https://github.com/jprichardson/node-fs-extra","license":"MIT"},"google-libphonenumber":{"version":"3.2.33","url":"https://ruimarinho.github.io/google-libphonenumber/","license":"(MIT AND Apache-2.0)"},"htmlparser2-without-node-native":{"version":"3.9.2","url":"git://github.com/fb55/htmlparser2.git","license":"MIT"},"is-plain-obj":{"version":"4.1.0","license":"MIT"},"js-base64":{"version":"3.7.5","license":"BSD-3-Clause"},"pdfmake":{"version":"0.2.7","url":"http://pdfmake.org","license":"MIT"},"process":{"version":"0.11.10","url":"git://github.com/shtylman/node-process.git","license":"MIT"},"prop-types":{"version":"15.8.1","url":"https://facebook.github.io/react/","license":"MIT"},"react":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-content-loader":{"version":"6.2.1","url":"https://github.com/danilowoz/react-content-loader","license":"MIT"},"react-dom":{"version":"18.2.0","url":"https://reactjs.org/","license":"MIT"},"react-native":{"version":"0.72.6","license":"MIT"},"react-native-big-list":{"version":"1.6.1","url":"https://marcocesarato.github.io/react-native-big-list-docs/","license":"GPL-3.0-or-later"},"react-native-blob-util":{"version":"0.18.6","url":"https://github.com/RonRadtke/react-native-blob-util","license":"MIT"},"react-native-gesture-handler":{"version":"2.12.1","url":"https://github.com/software-mansion/react-native-gesture-handler#readme","license":"MIT"},"react-native-iphone-x-helper":{"version":"1.3.1","url":"https://github.com/ptelad/react-native-iphone-x-helper#readme","license":"MIT"},"react-native-mime-types":{"version":"2.4.0","license":"MIT"},"react-native-paper":{"version":"5.11.0","url":"https://callstack.github.io/react-native-paper","license":"MIT"},"react-native-paper-dates":{"version":"0.20.1","url":"https://github.com/web-ridge/react-native-paper-dates#readme","license":"MIT"},"react-native-reanimated":{"version":"3.3.0","url":"https://github.com/software-mansion/react-native-reanimated#readme","license":"MIT"},"react-native-safe-area-context":{"version":"4.6.3","url":"https://github.com/th3rdwave/react-native-safe-area-context#readme","license":"MIT"},"react-native-screens":{"version":"3.22.1","url":"https://github.com/software-mansion/react-native-screens#readme","license":"MIT"},"react-native-svg":{"version":"13.9.0","url":"https://github.com/react-native-community/react-native-svg","license":"MIT"},"react-native-web":{"version":"0.19.9","url":"git://github.com/necolas/react-native-web.git","license":"MIT"},"react-native-webview":{"version":"13.2.2","url":"https://github.com/react-native-webview/react-native-webview#readme","license":"MIT"},"react-virtuoso":{"version":"4.6.2","url":"https://virtuoso.dev/","license":"MIT"},"sharp-cli":{"version":"2.1.0","url":"https://github.com/vseventer/sharp-cli","license":"MIT"},"tippy.js":{"version":"6.3.7","url":"https://atomiks.github.io/tippyjs/","license":"MIT"},"uninstall":{"version":"0.0.0","license":"MIT"},"websql":{"version":"2.0.3","url":"git://github.com/nolanlawson/node-websql.git","license":"Apache-2.0"},"xlsx":{"version":"0.18.5","url":"https://sheetjs.com/","license":"Apache-2.0"}};
|