@fto-consult/expo-ui 8.63.0 → 8.64.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.63.0",
3
+ "version": "8.64.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -81,6 +81,7 @@ export const selectDateFormatFieldProps = ({onAdd:customOnAdd,onAddCustomFormat,
81
81
  getItemValue : ({item})=>item.code,
82
82
  renderItem : dateFormatSelectorRenderItem,
83
83
  showAdd : true,
84
+ label : "Format de date",
84
85
  ...props,
85
86
  inputProps : {
86
87
  enableCopy:false,...inputProps,
@@ -93,7 +93,7 @@ const DialogComponent = React.forwardRef((props,ref)=>{
93
93
  if(isNonNullString(no)){
94
94
  no = {label:no};
95
95
  }
96
- if(isObj(no) && (no.label||no.text)){
96
+ if(isObj(no)){
97
97
  cancelButton = cancelButton ? {...no,...cancelButton} : no;
98
98
  backActionProps = {...no,...backActionProps};
99
99
  }
@@ -60,7 +60,7 @@ const Provider = React.forwardRef((props,innerRef)=>{
60
60
  },
61
61
  };
62
62
  React.setRef(ref,context);
63
- return <Dialog {...props} {...state} visible={visible} controlled onDismiss = {(e)=>{
63
+ return <Dialog {...props} {...state} isProvider visible={visible} controlled onDismiss = {(e)=>{
64
64
  if(visible){
65
65
  setVisible(false);
66
66
  }
@@ -964,7 +964,7 @@ export default class Field extends AppComponent {
964
964
  rest.contentContainerProps.pointerEvents = defaultStr(rest.contentContainerProps.pointerEvents,"auto");
965
965
  }
966
966
  if(!isFilter && this.canRenderInlineIndicator()){
967
- const canRenderHashtag = format === 'hashtag' && (!isNonNullString(_type) || _type ==='text');
967
+ const canRenderHashtag = format === 'hashtag' && isEditable && (!isNonNullString(_type) || _type ==='text');
968
968
  const renderRigth = (props)=>{
969
969
  let right = null;
970
970
  let cRight = typeof customRight ==='function'? customRight(props) : customRight;
@@ -1,7 +1,7 @@
1
1
  import selectors from "./sprintfSelectors";
2
2
  import {isNonNullString,defaultFunc,isObj,isPromise} from "$cutils";
3
3
 
4
- export default ({value,val,formatter,cb,success})=>{
4
+ export default ({value,val,formatter,cb,success,...rest})=>{
5
5
  val = defaultStr(value,val)
6
6
  if(!isNonNullString(val)){
7
7
  return null;
@@ -46,13 +46,13 @@ export default ({value,val,formatter,cb,success})=>{
46
46
  } else {
47
47
  key = keys[index];
48
48
  if(!isNonNullString(key)) {return next();}
49
- let indexName = i.toLowerCase();
49
+ let indexName = key.toLowerCase();
50
50
  let selector = selectors[indexName];
51
51
  if(!selector){
52
- indexName = i.toUpperCase();
52
+ indexName = key.toUpperCase();
53
53
  selector = selectors[indexName];
54
54
  }
55
- sKeys[i] = indexName;
55
+ sKeys[key] = indexName;
56
56
  const select = isObj(selector)? selector.select : selector;
57
57
  if(typeof cb =='function'){
58
58
  const v = select({...rest,selector,selectors,indexName,selectorIndex:indexName,selectorName:indexName,results,index:key,keys,key,value:val});
@@ -1,7 +1,13 @@
1
- import Date from "$lib/date";
1
+ import {DateTime,FormatSelector} from "$ecomponents/Date";
2
2
  import {defaultObj} from "$cutils";
3
3
  import appConfig from "$capp/config";
4
+ import DialogProvider from "$ecomponents/Dialog/Provider";
5
+ import View from "$ecomponents/View";
6
+ import DateLib from "$clib/date";
7
+ import theme from "$theme";
8
+
4
9
  const sprintfSelectors = defaultObj(appConfig.get("sprintfSelectors"));
10
+
5
11
  export default {
6
12
  ...sprintfSelectors,
7
13
  "&sdate&" : {
@@ -10,9 +16,47 @@ export default {
10
16
  field : {
11
17
  type : 'date',
12
18
  text : 'Sélectionner une date',
13
- format : Date.defaultDateFormat
19
+ format : DateLib.defaultDateFormat
14
20
  },
15
21
  desc : "remplace le motif par la date qui sera sélectionnée par l'utilisateur au format jj/mm/aaaa",
22
+ select : ()=>{
23
+ return new Promise((resolve,reject)=>{
24
+ const valueRef = {current:new Date(),format:DateLib.defaultDateTimeFormat};
25
+ DialogProvider.open({
26
+ title : 'Sélectionner une date',
27
+ cancelButton : true,
28
+ onCancel : reject,
29
+ content : <View testID = {"RN_SprintfSelectorSelectDate"} style={[theme.styles.p1]}>
30
+ <DateTime
31
+ label = {"Select date"}
32
+ defaultValue = {valueRef.current}
33
+ onChange = {({value,date})=>{
34
+ if(DateLib. isDateObj (date)){
35
+ valueRef.current = date;
36
+ } else valueRef.current = new Date(value);
37
+ }}
38
+ />
39
+ <FormatSelector
40
+ defaultValue = {valueRef.format}
41
+ onChange = {({value})=>{
42
+ valueRef.format = value;
43
+ }}
44
+ />
45
+ </View>,
46
+ actions : [
47
+ {
48
+ text : "Sélectionner",
49
+ icon : "check",
50
+ success : true,
51
+ onPress : ()=>{
52
+ DialogProvider.close();
53
+ resolve(DateLib.format(valueRef.current,valueRef.format));
54
+ }
55
+ },
56
+ ]
57
+ })
58
+ })
59
+ }
16
60
  },
17
61
  "&date&" : "remplace le motif par la date actuelle au format : jj/mm/aaaa",
18
62
  "&heure&" : "remplace le motif par l'heure actuelle au format hh:mm:ss",