@fto-consult/expo-ui 7.1.7 → 7.2.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": "7.
|
3
|
+
"version": "7.2.0",
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
5
5
|
"main": "main",
|
6
6
|
"scripts": {
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"@expo/html-elements": "^0.5.1",
|
72
72
|
"@expo/vector-icons": "^13.0.0",
|
73
73
|
"@faker-js/faker": "^8.0.2",
|
74
|
-
"@fto-consult/common": "^3.
|
74
|
+
"@fto-consult/common": "^3.72.12",
|
75
75
|
"@pchmn/expo-material3-theme": "^1.3.1",
|
76
76
|
"@react-native-async-storage/async-storage": "1.18.2",
|
77
77
|
"@react-native-community/datetimepicker": "7.2.0",
|
@@ -1790,6 +1790,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1790
1790
|
defaultValue : 0,
|
1791
1791
|
type : "switch",
|
1792
1792
|
} : null,
|
1793
|
+
pdfDocumentTitle : {
|
1794
|
+
text : "Titre du document",
|
1795
|
+
multiple : true,
|
1796
|
+
},
|
1793
1797
|
...sFields,
|
1794
1798
|
},
|
1795
1799
|
actions : [{text:'Exporter',icon : "check"}],
|
@@ -1844,7 +1848,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
1844
1848
|
if(pdfDocumentTitle){
|
1845
1849
|
content.unshift(pdfDocumentTitle);
|
1846
1850
|
}
|
1847
|
-
const pdf = createPDF({content}
|
1851
|
+
const pdf = createPDF({...config,content});
|
1848
1852
|
if(isWeb()){
|
1849
1853
|
return pdf.open();
|
1850
1854
|
}
|
package/src/pdf/index.js
CHANGED
@@ -9,6 +9,7 @@ import session from "$session";
|
|
9
9
|
|
10
10
|
const {createPdf} = pdfMake;
|
11
11
|
pdfMake.createPdf = (docDefinition,...rest)=>{
|
12
|
+
console.log("creating pdf ",docDefinition);
|
12
13
|
try {
|
13
14
|
//@see : https://pdfmake.github.io/docs/0.1/getting-started/client-side/methods/
|
14
15
|
const pdf = createPdf(docDefinition,...rest);
|
@@ -43,14 +44,7 @@ export const print = (data,options,...rest)=>{
|
|
43
44
|
|
44
45
|
export const getFields = (config)=>{
|
45
46
|
config = Object.assign({},config);
|
46
|
-
const sFields =
|
47
|
-
pdfDocumentTitle : {
|
48
|
-
text : "Titre du document",
|
49
|
-
multiple : true,
|
50
|
-
}
|
51
|
-
},pdfFields);
|
52
|
-
delete sFields.code;
|
53
|
-
delete sFields.label;
|
47
|
+
const sFields = Object.clone(pdfFields);
|
54
48
|
if(!isDataURL(config.logo)){
|
55
49
|
delete sFields.displayLogo;
|
56
50
|
delete sFields.logoWidth;
|
@@ -80,6 +74,7 @@ export const getPrintSettings = ({multiple,sessionName,formDataProps,...rest})=>
|
|
80
74
|
onValidate : ({value,context}) =>{
|
81
75
|
if(context){
|
82
76
|
const pageBreakBeforeEachDoc = context.getField("pageBreakBeforeEachDoc");
|
77
|
+
const pageMarginAfterEachDoc = context.getField("pageMarginAfterEachDoc");
|
83
78
|
if(pageBreakBeforeEachDoc){
|
84
79
|
if(value || multiple){
|
85
80
|
pageBreakBeforeEachDoc.enable();
|
@@ -87,6 +82,13 @@ export const getPrintSettings = ({multiple,sessionName,formDataProps,...rest})=>
|
|
87
82
|
pageBreakBeforeEachDoc.disable();
|
88
83
|
}
|
89
84
|
}
|
85
|
+
if(pageMarginAfterEachDoc){
|
86
|
+
if(value || multiple){
|
87
|
+
pageMarginAfterEachDoc.enable();
|
88
|
+
} else {
|
89
|
+
pageMarginAfterEachDoc.disable();
|
90
|
+
}
|
91
|
+
}
|
90
92
|
}
|
91
93
|
}
|
92
94
|
},
|
@@ -104,7 +106,23 @@ export const getPrintSettings = ({multiple,sessionName,formDataProps,...rest})=>
|
|
104
106
|
}
|
105
107
|
return v;
|
106
108
|
}
|
107
|
-
}
|
109
|
+
},
|
110
|
+
pageMarginAfterEachDoc : {
|
111
|
+
text : "Marge après chaque document",
|
112
|
+
tooltip : 'Spécifiez le nombre de ligne à ajouter comme marge après chaque document',
|
113
|
+
defaultValue : 2,
|
114
|
+
type : "number",
|
115
|
+
getValidValue : ({context,data}) => {
|
116
|
+
if(!context || !context?.isDisabled) {
|
117
|
+
return 0;
|
118
|
+
}
|
119
|
+
const v = context?.isDisabled()?0 : context.getValue();
|
120
|
+
if(isObj(data)){
|
121
|
+
data.pageMarginAfterEachDoc = v;
|
122
|
+
}
|
123
|
+
return v;
|
124
|
+
}
|
125
|
+
},
|
108
126
|
},getFields(formDataProps.data))
|
109
127
|
return new Promise((resolve,reject)=>{
|
110
128
|
return DialogProvider.open({
|
@@ -122,7 +140,7 @@ export const getPrintSettings = ({multiple,sessionName,formDataProps,...rest})=>
|
|
122
140
|
session.set(sessionName,sessionD);
|
123
141
|
}
|
124
142
|
DialogProvider.close();
|
125
|
-
resolve({...opts,fields});
|
143
|
+
resolve({...opts,data,fields});
|
126
144
|
},
|
127
145
|
onCancel : reject,
|
128
146
|
})
|