@fto-consult/expo-ui 2.2.2 → 2.2.4
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": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@expo/html-elements": "^0.2.0",
|
|
63
63
|
"@expo/metro-config": "^0.4.0",
|
|
64
64
|
"@expo/webpack-config": "^0.17.2",
|
|
65
|
-
"@fto-consult/common": "^1.11.
|
|
65
|
+
"@fto-consult/common": "^1.11.5",
|
|
66
66
|
"@gorhom/portal": "^1.0.14",
|
|
67
67
|
"@react-native-async-storage/async-storage": "~1.17.3",
|
|
68
68
|
"@react-native-community/datetimepicker": "6.5.2",
|
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
5
|
+
import DateComponent from "./DatePickerInput";
|
|
6
6
|
import Time,{parseTime} from "./Time";
|
|
7
7
|
import React from "$react";
|
|
8
8
|
import PropTypes from "prop-types";
|
|
@@ -57,7 +57,7 @@ export default function DateTimePickerComponent({left,withSeconds,right,format,d
|
|
|
57
57
|
onChange(args);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
return <
|
|
60
|
+
return <DateComponent
|
|
61
61
|
defaultValue = {dateObj}
|
|
62
62
|
disabled = {disabled}
|
|
63
63
|
readOnly = {readOnly}
|
|
@@ -107,7 +107,7 @@ export default function DateTimePickerComponent({left,withSeconds,right,format,d
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
DateTimePickerComponent.propTypes = {
|
|
110
|
-
...
|
|
110
|
+
...DateComponent.propTypes,
|
|
111
111
|
dateProps : PropTypes.object,
|
|
112
112
|
timeProps : PropTypes.object,
|
|
113
113
|
dateFormat : PropTypes.string, //Le format de date
|
|
@@ -16,6 +16,7 @@ import theme from "$theme";
|
|
|
16
16
|
import {isMobileMedia} from "$cplatform/dimensions";
|
|
17
17
|
import { ActivityIndicator } from "react-native-paper";
|
|
18
18
|
import { getSessionData,setSessionData } from "./session";
|
|
19
|
+
import DialogProvider from "$components/Form/FormData/DialogProvider";
|
|
19
20
|
|
|
20
21
|
const manualRunKey = "manual-run";
|
|
21
22
|
|
|
@@ -169,7 +170,7 @@ export default class Filter extends AppComponent {
|
|
|
169
170
|
fireValueChanged (forceRun){
|
|
170
171
|
if(this.willRunManually() && !forceRun) return;
|
|
171
172
|
let {defaultValue:value,prevDefaultValue,action,ignoreCase,operator} = this.state;
|
|
172
|
-
|
|
173
|
+
let force = forceRun ===true ? true : false;
|
|
173
174
|
if(!isObjOrArray(value) && (isNullOrEmpty(value,true) || value ==='undefined') ){
|
|
174
175
|
value = undefined;
|
|
175
176
|
}
|
|
@@ -250,57 +251,68 @@ export default class Filter extends AppComponent {
|
|
|
250
251
|
if(DateLib.isValidSQLDate(split[1])){
|
|
251
252
|
end = split[1];
|
|
252
253
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
254
|
+
const type = this.type.contains("date")? this.type : "date";
|
|
255
|
+
DialogProvider.open({
|
|
256
|
+
fields : {
|
|
257
|
+
start : {type,text:'Du',defaultValue:start},
|
|
258
|
+
end : {type,text:'Au',defaultValue:end}
|
|
259
|
+
},
|
|
260
|
+
title :"Définir une période ["+defaultStr(this.props.label,this.props.text)+"]",
|
|
261
|
+
actions : {
|
|
262
|
+
no : {
|
|
263
|
+
text : 'Annuler',
|
|
264
|
+
icon : 'cancel',
|
|
265
|
+
isFormAction : false,
|
|
266
|
+
onPress : ()=>{
|
|
267
|
+
DialogProvider.close();
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
yes : {
|
|
271
|
+
text : 'Définir',
|
|
272
|
+
icon : "check"
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
onSuccess : ({data})=>{
|
|
276
|
+
console.log(data," is dataa")
|
|
271
277
|
if(isFunction(success)){
|
|
272
278
|
success(data.start+"=>"+data.end);
|
|
273
279
|
}
|
|
280
|
+
DialogProvider.close();
|
|
274
281
|
return true;
|
|
275
|
-
}}
|
|
276
|
-
/>)
|
|
282
|
+
}})
|
|
277
283
|
}
|
|
278
284
|
setAction(action,text){
|
|
279
285
|
if(!(this.searchFilter.current)) return;
|
|
280
286
|
if(action === this.state.action && action !="$period" && action !== "$today") return;
|
|
281
287
|
let value = this.state.defaultValue;
|
|
282
288
|
let act = defaultStr(action).toLowerCase();
|
|
289
|
+
const isDateTime = this.type?.contains("time");
|
|
290
|
+
const dateFormat = isDateTime?DateLib.SQLDateTimeFormat:DateLib.SQLDateFormat;
|
|
283
291
|
if(action == '$period'){
|
|
284
292
|
this.showPeriodSelector((d)=>{
|
|
285
293
|
this.runAction({value:d,action});
|
|
286
294
|
})
|
|
287
295
|
} else if(action =="$today"){
|
|
288
|
-
return this.runAction({value:new Date().
|
|
296
|
+
return this.runAction({value:new Date().toDateFormat(dateFormat),action})
|
|
289
297
|
} else if(act.startsWith("$") && (act.contains("week") || act.contains("month"))){
|
|
290
298
|
let diff = undefined;
|
|
299
|
+
const currentDate = new Date();
|
|
300
|
+
currentDate.setHours(0);
|
|
301
|
+
currentDate.setMinutes(0);
|
|
302
|
+
currentDate.setSeconds(0);
|
|
291
303
|
switch (action){
|
|
292
304
|
case "$month":
|
|
293
|
-
diff = DateLib.currentMonthDaysLimits();
|
|
305
|
+
diff = DateLib.currentMonthDaysLimits(currentDate);
|
|
294
306
|
break;
|
|
295
307
|
case "$week":
|
|
296
|
-
diff = DateLib.currentWeekDaysLimits()
|
|
308
|
+
diff = DateLib.currentWeekDaysLimits(currentDate)
|
|
297
309
|
break;
|
|
298
310
|
case "$prevWeek":
|
|
299
|
-
diff = DateLib.previousWeekDaysLimits()
|
|
311
|
+
diff = DateLib.previousWeekDaysLimits(currentDate)
|
|
300
312
|
break;
|
|
301
313
|
}
|
|
302
314
|
if(diff){
|
|
303
|
-
let value = diff.first.toFormat(
|
|
315
|
+
let value = diff.first.toFormat(dateFormat) +"=>"+diff.last.toFormat(dateFormat);
|
|
304
316
|
this.runAction({value,action})
|
|
305
317
|
}
|
|
306
318
|
} else {
|