@fto-consult/expo-ui 7.20.6 → 7.22.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/utils.js CHANGED
@@ -1 +1 @@
1
- module.exports = require("@fto-consult/electron-gen/src/utils");
1
+ module.exports = require("@fto-consult/node-utils");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.20.6",
3
+ "version": "7.22.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -46,7 +46,7 @@
46
46
  "delete-node-modules": "rimraf ./**/node_modules",
47
47
  "dev": "npx expo start --no-dev --minify -c",
48
48
  "modifier-url-remote-git": "git remote set-url origin 'https://borispipo@github.com/borispipo/smart-eneo.git'",
49
- "update": "npm i @fto-consult/electron-gen@latest pdfmake@latest expo @emotion/native@latest react-native-big-list@latest apexcharts@latest file-saver@latest fs-extra@latest google-libphonenumber@latest @pchmn/expo-material3-theme@latest @emotion/native@latest @fto-consult/common@latest @react-navigation/stack react-native-blob-util react-native-iphone-x-helper@latest react-native-mime-types@latest react-native-paper@5 react-native-paper-dates@latest @react-navigation/native@latest @react-navigation/native-stack@latest react-virtuoso@latest tippy.js@latest websql@latest xlsx@latest react-native-web@latest react-dom@latest && npx expo install --fix && npm run update-apexchart && npm run update-pdfmake && npm run find-licenses"
49
+ "update": "npm i @fto-consult/node-utils@latest pdfmake@latest expo @emotion/native@latest react-native-big-list@latest apexcharts@latest file-saver@latest fs-extra@latest google-libphonenumber@latest @pchmn/expo-material3-theme@latest @emotion/native@latest @fto-consult/common@latest @react-navigation/stack react-native-blob-util react-native-iphone-x-helper@latest react-native-mime-types@latest react-native-paper@5 react-native-paper-dates@latest @react-navigation/native@latest @react-navigation/native-stack@latest react-virtuoso@latest tippy.js@latest websql@latest xlsx@latest react-native-web@latest react-dom@latest && npx expo install --fix && npm run update-apexchart && npm run update-pdfmake && npm run find-licenses"
50
50
  },
51
51
  "bin": {
52
52
  "expo-ui": "./bin/index.js"
@@ -72,8 +72,8 @@
72
72
  "@expo/vector-icons": "^13.0.0",
73
73
  "@faker-js/faker": "^8.0.2",
74
74
  "@fto-consult/common": "^4.6.0",
75
- "@fto-consult/electron-gen": "^2.3.1",
76
75
  "@fto-consult/expo-ui": "^7.17.9",
76
+ "@fto-consult/node-utils": "^1.3.4",
77
77
  "@pchmn/expo-material3-theme": "^1.3.1",
78
78
  "@react-native-async-storage/async-storage": "1.18.2",
79
79
  "@react-native-community/datetimepicker": "7.2.0",
@@ -98,7 +98,7 @@
98
98
  "expo-web-browser": "~12.3.2",
99
99
  "file-saver": "^2.0.5",
100
100
  "fs-extra": "^11.2.0",
101
- "google-libphonenumber": "^3.2.33",
101
+ "google-libphonenumber": "^3.2.34",
102
102
  "htmlparser2-without-node-native": "^3.9.2",
103
103
  "is-plain-obj": "^4.1.0",
104
104
  "js-base64": "^3.7.5",
@@ -114,7 +114,7 @@
114
114
  "react-native-get-random-values": "~1.9.0",
115
115
  "react-native-iphone-x-helper": "^1.3.1",
116
116
  "react-native-mime-types": "^2.4.0",
117
- "react-native-paper": "^5.12.0",
117
+ "react-native-paper": "^5.12.1",
118
118
  "react-native-paper-dates": "^0.21.7",
119
119
  "react-native-reanimated": "~3.3.0",
120
120
  "react-native-safe-area-context": "4.6.3",
@@ -3,7 +3,7 @@ import Dialog from "./Dialog";
3
3
  import { createProviderRef } from "$ecomponents/Dialog/Provider";
4
4
  import {isMobileOrTabletMedia} from "$cplatform/dimensions";
5
5
  import {MAX_WIDTH} from "$ecomponents/Dialog/utils";
6
- import {extendObj,defaultObj,isObj,defaultBool,defaultStr} from "$cutils";
6
+ import {extendObj,defaultObj,isObj,defaultBool,defaultStr,defaultVal} from "$cutils";
7
7
  import grid from "$theme/grid";
8
8
  import theme from "$theme";
9
9
  import {isDesktopMedia} from "$cdimensions";
@@ -11,6 +11,9 @@ import {isDesktopMedia} from "$cdimensions";
11
11
  let dialogProviderRef = null;
12
12
 
13
13
 
14
+ /*** l'on peut override par défaut l'action ok par les props ok|yes
15
+ l'on peut override par défaut l'acction cancel par les props closeAction|no
16
+ */
14
17
  const FormDataDialogProvider = React.forwardRef((props,innerRef)=>{
15
18
  innerRef = innerRef || createProviderRef((eRef)=>{
16
19
  dialogProviderRef = eRef;
@@ -59,22 +62,27 @@ const FormDataDialogProvider = React.forwardRef((props,innerRef)=>{
59
62
  isProvider
60
63
  ref={formRef}
61
64
  windowWidth = {MAX_WIDTH}
62
- propsMutator = {(rest)=>{
65
+ propsMutator = {({cancelButton,...rest})=>{
63
66
  const isMob = isMobileOrTabletMedia();
64
67
  if(closeAction === true || state.closeAction === true) return rest;
65
68
  rest.windowWidth = !isMob ? MAX_WIDTH : undefined;
69
+ const no = extendObj({},props.no,state.no);
66
70
  rest.actions = Array.isArray(rest.actions)? Object.clone(rest.actions) : isObj(rest.actions)? Object.clone(rest.actions) : null;
71
+ const closeAction = defaultObj(closeAction);
67
72
  rest.cancelButton = false;
68
- if(rest.actions && (!isMob || rest.fullScreen === false)){
73
+ if(cancelButton !== false && rest.actions && (!isMob || rest.fullScreen === false) && state.no !== false){
69
74
  if(isDesktopMedia() && typeof rest.maxActions !=='number'){
70
75
  rest.maxActions = 2;
71
76
  }
77
+ const noText = defaultVal(no.text,no.label,closeAction.text,closeAction.label,'Annuler')
72
78
  const closeBtn ={
73
- text : 'Annuler',
74
- icon : 'close',
79
+ ...closeAction,
80
+ ...no,
81
+ text : noText,
82
+ label : noText,
83
+ icon : defaultVal(no.icon,closeAction.icon,'close'),
75
84
  isCancelButton : true,
76
85
  error : true,
77
- ...defaultObj(closeAction),
78
86
  onPress : context.close,
79
87
  isAction : false,
80
88
  }
@@ -1,4 +1,4 @@
1
- import {isNonNullString,isObj,defaultObj,isPromise,isFunction,defaultStr,isObjOrArray,defaultFunc} from "$cutils";
1
+ import {isNonNullString,isObj,defaultObj,extendObj,defaultVal,isPromise,isFunction,defaultStr,isObjOrArray,defaultFunc} from "$cutils";
2
2
  import notify from "$notify";
3
3
  import { getFormData } from "../utils/FormsManager";
4
4
  import {isMobileBrowser,isMobileNative} from "$cplatform";
@@ -15,21 +15,25 @@ export const canHandleShurtCut = x=> !isMobileNative(true) && !isMobileBrowser()
15
15
 
16
16
  const canHandleS = canHandleShurtCut();
17
17
  export const getAppBarActionsProps = function(_props){
18
- let {actions,formName,save,cancel,actionMutator,saveButton,saveButtonIcon,data,style,...props} = defaultObj(_props);
18
+ let {actions,formName,save,cancel,actionMutator,saveButton,saveButtonIcon,data,style,yes,ok,...props} = defaultObj(_props);
19
19
  props = Object.assign({},props);
20
20
  cancel = defaultFunc(cancel);
21
21
  save = defaultFunc(save);
22
22
  saveButton = isNonNullString(saveButton)? saveButton : Object.size(data,true) > 0 && (isNonNullString(data.code) || isNonNullString(data._id))? "Modifier":'Enregister';
23
- saveButtonIcon = defaultStr(saveButtonIcon,'check')
23
+ saveButtonIcon = defaultStr(saveButtonIcon,'check');
24
+ const yesOk = extendObj({},yes,ok);
24
25
  if(typeof actions =='function'){
25
26
  actions = actions(props);
26
27
  }
27
- if(actions === undefined){
28
+ if(actions === undefined && yes !== false && ok !== false){
29
+ const yesOKText = defaultVal(yesOk.text,yesOk.label);
28
30
  actions = [{
29
31
  formName,
30
- text : saveButton,
31
- icon : saveButtonIcon,
32
32
  isAction: true,
33
+ ...yesOk,
34
+ text : yesOKText,
35
+ label: yesOKText,
36
+ icon : defaultVal(yesOk.icon,saveButtonIcon),
33
37
  }]
34
38
  } else {
35
39
  actions = (isObjOrArray(actions))?actions : [];
@@ -45,13 +45,13 @@ module.exports = {
45
45
  "license": "MIT"
46
46
  },
47
47
  "@fto-consult/common": {
48
- "version": "4.4.0",
48
+ "version": "4.6.0",
49
49
  "url": "https://github.com/borispipo/common#readme",
50
50
  "license": "ISC"
51
51
  },
52
- "@fto-consult/electron-gen": {
53
- "version": "2.3.1",
54
- "license": "ISC"
52
+ "@fto-consult/node-utils": {
53
+ "version": "1.3.4",
54
+ "license": "MIT"
55
55
  },
56
56
  "@pchmn/expo-material3-theme": {
57
57
  "version": "1.3.1",
@@ -184,7 +184,7 @@ module.exports = {
184
184
  "license": "MIT"
185
185
  },
186
186
  "google-libphonenumber": {
187
- "version": "3.2.33",
187
+ "version": "3.2.34",
188
188
  "url": "https://ruimarinho.github.io/google-libphonenumber/",
189
189
  "license": "(MIT AND Apache-2.0)"
190
190
  },
@@ -259,7 +259,7 @@ module.exports = {
259
259
  "license": "MIT"
260
260
  },
261
261
  "react-native-paper": {
262
- "version": "5.12.0",
262
+ "version": "5.12.1",
263
263
  "url": "https://callstack.github.io/react-native-paper",
264
264
  "license": "MIT"
265
265
  },