@fto-consult/expo-ui 6.25.2 → 6.25.3
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 +2 -1
- package/src/components/Datagrid/Common/Common.js +155 -129
- package/src/components/Dialog/DialogContent.js +2 -2
- package/src/components/Dropdown/index.js +1 -2
- package/src/components/Label/index.js +12 -4
- package/src/components/List/hooks.js +8 -11
- package/src/components/Table/Header/CellHeader.js +0 -1
- package/src/components/Table/Row/Cell/Content.js +2 -2
- package/src/print/createPDF/index.js +20 -0
- package/src/print/formatText.js +84 -0
- package/src/print/index.js +13 -0
- package/src/print/pdf/formats/defaultFormats.js +28 -0
- package/src/print/pdf/formats/defaultPageFormat.js +1 -0
- package/src/print/pdf/formats/defaultPageOrientation.js +1 -0
- package/src/print/pdf/formats/fields.js +139 -0
- package/src/print/pdf/formats/formats.js +8 -0
- package/src/print/pdf/formats/index.js +10 -0
- package/src/print/pdf/formats/renderItem.js +8 -0
- package/src/print/pdf/index.js +2 -0
- package/src/print/pdf/paperSizes/all.js +1948 -0
- package/src/print/pdf/paperSizes/index.js +4 -0
- package/src/print/pdf/paperSizes/iso.js +493 -0
- package/src/print/qrCode.js +44 -0
- package/src/print/svg/index.js +25 -0
- package/src/print/toPdfMakeObj.js +51 -0
- package/src/print/utils.js +1840 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fto-consult/expo-ui",
|
|
3
|
-
"version": "6.25.
|
|
3
|
+
"version": "6.25.3",
|
|
4
4
|
"description": "Bibliothèque de composants UI Expo,react-native",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"fs-extra": "^11.1.1",
|
|
93
93
|
"google-libphonenumber": "^3.2.33",
|
|
94
94
|
"htmlparser2-without-node-native": "^3.9.2",
|
|
95
|
+
"pdfmake": "^0.2.7",
|
|
95
96
|
"process": "^0.11.10",
|
|
96
97
|
"prop-types": "^15.8.1",
|
|
97
98
|
"react": "^18.2.0",
|
|
@@ -1706,6 +1706,15 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1706
1706
|
label : "Exporter les entêtes des groupes",
|
|
1707
1707
|
defaultValue :1,
|
|
1708
1708
|
},
|
|
1709
|
+
fields : {
|
|
1710
|
+
text : "Champs à exporter",
|
|
1711
|
+
items : this.state.columns,
|
|
1712
|
+
type : "select",
|
|
1713
|
+
itemValue : ({item,index})=>index,
|
|
1714
|
+
filter : ({item,index})=> isObj(item) && item.exportable !== false,
|
|
1715
|
+
renderItem : ({item,index})=> item?.label || item?.text || index,
|
|
1716
|
+
multiple : true,
|
|
1717
|
+
},
|
|
1709
1718
|
/*abreviateValues : {
|
|
1710
1719
|
text : "Abréger les valeurs numériques",
|
|
1711
1720
|
type : "switch",
|
|
@@ -1718,147 +1727,164 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
1718
1727
|
},
|
|
1719
1728
|
}
|
|
1720
1729
|
}
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
const skey = "export-to-excel";
|
|
1730
|
+
SetExportOptions({excel}){
|
|
1731
|
+
const skey = excel ? "export-to-excel":"export-to-other";
|
|
1724
1732
|
const isOnlytotal = this.state.displayOnlySectionListHeaders;
|
|
1725
|
-
|
|
1733
|
+
const displayOnlyHeader = this.canDisplayOnlySectionListHeaders() && isOnlytotal;
|
|
1726
1734
|
const sData = defaultObj(this.getSessionData(skey));
|
|
1727
|
-
return
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1735
|
+
return new Promise((resolve,reject)=>{
|
|
1736
|
+
return DialogProvider.open({
|
|
1737
|
+
title : `Paramètre d'export ${excel?"excel":"pdf"}`,
|
|
1738
|
+
data : sData,
|
|
1739
|
+
fields : {
|
|
1740
|
+
...this.getExportableFields(),
|
|
1741
|
+
sheetName : excel && {
|
|
1742
|
+
label : 'Nom de la feuille excel',
|
|
1743
|
+
format : "hashtag",
|
|
1744
|
+
required : true,
|
|
1745
|
+
},
|
|
1746
|
+
exportOnlyTotal : displayOnlyHeader && {
|
|
1747
|
+
label : "Exporter uniquemnt les totaux",
|
|
1748
|
+
defaultValue : 0,
|
|
1749
|
+
type : "switch",
|
|
1750
|
+
},
|
|
1751
|
+
aggregatedValues : displayOnlyHeader ? {
|
|
1752
|
+
label : "Exporter uniquement les totaux aggrégées",
|
|
1753
|
+
defaultValue : 0,
|
|
1754
|
+
type : "switch",
|
|
1755
|
+
} : null,
|
|
1736
1756
|
},
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1757
|
+
actions : [{text:'Exporter',icon : "check"}],
|
|
1758
|
+
onSuccess: (args)=>{
|
|
1759
|
+
args.sessionKeyName = skey;
|
|
1760
|
+
args.displayOnlyHeader = displayOnlyHeader;
|
|
1761
|
+
args.isOnlytotal = isOnlytotal;
|
|
1762
|
+
args.sessionData = sData;
|
|
1763
|
+
DialogProvider.close();
|
|
1764
|
+
resolve(args);
|
|
1765
|
+
return args;
|
|
1741
1766
|
},
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1767
|
+
onCancel : reject,
|
|
1768
|
+
})
|
|
1769
|
+
})
|
|
1770
|
+
}
|
|
1771
|
+
/***@see : https://docs.sheetjs.com/docs/api/utilities */
|
|
1772
|
+
exportToExcel(){
|
|
1773
|
+
return this.SetExportOptions({excel:true}).then(({sessionKeyName,isOnlytotal,displayOnlyHeader,data:config})=>{
|
|
1774
|
+
this.setSessionData(sessionKeyName,config);
|
|
1775
|
+
config.fileName = sprintf(config.fileName);
|
|
1776
|
+
config.sheetName = sanitizeSheetName(config.sheetName);
|
|
1777
|
+
const data = [];
|
|
1778
|
+
let totalColumns = 0;
|
|
1779
|
+
const cols = {};
|
|
1780
|
+
Preloader.open("préparation des données...");
|
|
1781
|
+
const footers = this.getFooters();
|
|
1782
|
+
const hasFields = !!config.fields.length;
|
|
1783
|
+
const fields = config.fields;
|
|
1784
|
+
if(displayOnlyHeader && config.aggregatedValues){
|
|
1785
|
+
const fValues = this.getFooterValues();
|
|
1786
|
+
const headers = ["Fonction d'agrégation"];
|
|
1787
|
+
const aggregatorFunctions = this.aggregatorFunctions;
|
|
1788
|
+
Object.map(footers,(f,i)=>{
|
|
1789
|
+
if(hasFields && !fields.includes(i)) return;
|
|
1790
|
+
const col = this.state.columns[i];
|
|
1791
|
+
if(!col || col.visible === false) return;
|
|
1792
|
+
headers.push(defaultStr(col.label,col.text));
|
|
1793
|
+
cols[i] = col;
|
|
1794
|
+
});
|
|
1795
|
+
data.push(headers);
|
|
1796
|
+
Object.map(aggregatorFunctions,(ag,i)=>{
|
|
1797
|
+
const d = [defaultStr(ag.label,ag.text,i)];
|
|
1798
|
+
Object.map(fValues,(footer,field)=>{
|
|
1799
|
+
if(!cols[field]) return;
|
|
1800
|
+
d.push(defaultNumber(footer[i]))
|
|
1768
1801
|
});
|
|
1769
|
-
data.push(
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
dd.push(null);
|
|
1817
|
-
}
|
|
1818
|
-
});
|
|
1819
|
-
if(canExportOnlyTotal){
|
|
1820
|
-
dd.unshift(val);
|
|
1821
|
-
data.push(dd);
|
|
1822
|
-
} else {
|
|
1823
|
-
data.push(d);
|
|
1824
|
-
data.push(dd);
|
|
1825
|
-
}
|
|
1802
|
+
data.push(d);
|
|
1803
|
+
})
|
|
1804
|
+
} else {
|
|
1805
|
+
const headers = [];
|
|
1806
|
+
const hFooters = defaultObj(this.sectionListHeaderFooters);
|
|
1807
|
+
const agFunc = this.state.aggregatorFunction;
|
|
1808
|
+
const canExportOnlyTotal = isOnlytotal || (config.exportOnlyTotal && displayOnlyHeader);
|
|
1809
|
+
if(canExportOnlyTotal){
|
|
1810
|
+
headers.push("");
|
|
1811
|
+
}
|
|
1812
|
+
Object.map(this.state.columns,(col,i)=>{
|
|
1813
|
+
if(hasFields && !fields.includes(i)) return;
|
|
1814
|
+
if(!isObj(col) || col.visible === false || this.isSelectableColumn(col,i) || i === this.getIndexColumnName()) return;
|
|
1815
|
+
if(canExportOnlyTotal && !(i in footers)) return;
|
|
1816
|
+
cols[i] = col;
|
|
1817
|
+
headers.push(defaultStr(col.label,col.text));
|
|
1818
|
+
totalColumns++;
|
|
1819
|
+
})
|
|
1820
|
+
data.push(headers);
|
|
1821
|
+
Object.map(this.state.data,(dat,index)=>{
|
|
1822
|
+
///si l'on a a faire à une colonne de type entete
|
|
1823
|
+
const d = [];
|
|
1824
|
+
if(dat.isSectionListHeader){
|
|
1825
|
+
if(!config.displayTotals && !canExportOnlyTotal) return;
|
|
1826
|
+
const {sectionListHeaderKey:key} = dat;
|
|
1827
|
+
const val = key === this.emptySectionListHeaderValue ? this.getEmptySectionListHeaderValue() : key;
|
|
1828
|
+
d.push(val);
|
|
1829
|
+
if(!canExportOnlyTotal){
|
|
1830
|
+
for(let i = 1;i<totalColumns;i++){
|
|
1831
|
+
d.push(null);
|
|
1832
|
+
}
|
|
1833
|
+
data.push(d);
|
|
1834
|
+
} else {
|
|
1835
|
+
const hF = hFooters[key];
|
|
1836
|
+
if(isObj(hF) && isNonNullString(agFunc)){
|
|
1837
|
+
const dd = [];
|
|
1838
|
+
Object.map(cols,(col,i)=>{
|
|
1839
|
+
if(i in hF){
|
|
1840
|
+
const ff = hF[i];
|
|
1841
|
+
dd.push(defaultNumber(ff[agFunc]));
|
|
1842
|
+
} else {
|
|
1843
|
+
dd.push(null);
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
if(canExportOnlyTotal){
|
|
1847
|
+
dd.unshift(val);
|
|
1848
|
+
data.push(dd);
|
|
1826
1849
|
} else {
|
|
1827
1850
|
data.push(d);
|
|
1851
|
+
data.push(dd);
|
|
1828
1852
|
}
|
|
1853
|
+
} else {
|
|
1854
|
+
data.push(d);
|
|
1829
1855
|
}
|
|
1830
|
-
} else if(!canExportOnlyTotal) {
|
|
1831
|
-
Object.map(cols,(col,i)=>{
|
|
1832
|
-
const isDateField = defaultStr(col.type).toLowerCase().contains("date");
|
|
1833
|
-
d.push(this.renderRowCell({
|
|
1834
|
-
data : dat,
|
|
1835
|
-
rowData : dat,
|
|
1836
|
-
rowCounterIndex : index,
|
|
1837
|
-
rowIndex : index,
|
|
1838
|
-
formatValue : false,
|
|
1839
|
-
renderRowCell : false,
|
|
1840
|
-
columnField : defaultStr(col.field,i),
|
|
1841
|
-
columnDef :{
|
|
1842
|
-
...col,
|
|
1843
|
-
...(isDateField?{format:config.dateFormat}:{})
|
|
1844
|
-
}
|
|
1845
|
-
}));
|
|
1846
|
-
})
|
|
1847
|
-
data.push(d);
|
|
1848
1856
|
}
|
|
1849
|
-
})
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
+
} else if(!canExportOnlyTotal) {
|
|
1858
|
+
Object.map(cols,(col,i)=>{
|
|
1859
|
+
const isDateField = defaultStr(col.type).toLowerCase().contains("date");
|
|
1860
|
+
d.push(this.renderRowCell({
|
|
1861
|
+
data : dat,
|
|
1862
|
+
rowData : dat,
|
|
1863
|
+
rowCounterIndex : index,
|
|
1864
|
+
rowIndex : index,
|
|
1865
|
+
formatValue : false,
|
|
1866
|
+
renderRowCell : false,
|
|
1867
|
+
columnField : defaultStr(col.field,i),
|
|
1868
|
+
columnDef :{
|
|
1869
|
+
...col,
|
|
1870
|
+
...(isDateField?{format:config.dateFormat}:{})
|
|
1871
|
+
}
|
|
1872
|
+
}));
|
|
1873
|
+
})
|
|
1874
|
+
data.push(d);
|
|
1857
1875
|
}
|
|
1858
|
-
|
|
1859
|
-
Preloader.close();
|
|
1860
|
-
})
|
|
1876
|
+
});
|
|
1861
1877
|
}
|
|
1878
|
+
const wb = XLSX.utils.book_new();
|
|
1879
|
+
const ws = XLSX.utils.aoa_to_sheet(data);
|
|
1880
|
+
XLSX.utils.book_append_sheet(wb, ws, config.sheetName);
|
|
1881
|
+
FileSystem.writeExcel({...config,workbook:wb}).then(({path})=>{
|
|
1882
|
+
if(isNonNullString(path)){
|
|
1883
|
+
notify.success("Fichier enregistré dans le répertoire {0}".sprintf(path))
|
|
1884
|
+
}
|
|
1885
|
+
}).finally(()=>{
|
|
1886
|
+
Preloader.close();
|
|
1887
|
+
})
|
|
1862
1888
|
})
|
|
1863
1889
|
}
|
|
1864
1890
|
exportToPdf(){
|
|
@@ -2,10 +2,10 @@ import KeyboardAvoidingView from "../KeyboardAvoidingView";
|
|
|
2
2
|
import React from "$react";
|
|
3
3
|
import { useWindowDimensions } from "react-native";
|
|
4
4
|
|
|
5
|
-
const DialogContentComponent = ({isPreloader,isFullScreen,...props})=>{
|
|
5
|
+
const DialogContentComponent = ({isPreloader,title,children,isFullScreen,...props})=>{
|
|
6
6
|
const isFull = isFullScreen();
|
|
7
7
|
//useWindowDimensions();
|
|
8
|
-
const content = React.useMemo(()=>
|
|
8
|
+
const content = React.useMemo(()=>children,[isPreloader,title,children]);
|
|
9
9
|
return isPreloader || !isFull ? content : <KeyboardAvoidingView>{content}</KeyboardAvoidingView>
|
|
10
10
|
}
|
|
11
11
|
export default DialogContentComponent;
|
|
@@ -967,7 +967,6 @@ class DropdownComponent extends AppComponent {
|
|
|
967
967
|
const renderingItems = this.getItems();
|
|
968
968
|
const isDisabled = readOnly || disabled?true:false;
|
|
969
969
|
const isBigList = this.isBigList;
|
|
970
|
-
const ListComponent = isBigList ? BigList : List;
|
|
971
970
|
const autoFocus = canAutoFocusSearchField({visible,items:renderingItems});
|
|
972
971
|
dialogProps = defaultObj(dialogProps);
|
|
973
972
|
if(this.props.name =="RG_Compta"){
|
|
@@ -1063,7 +1062,7 @@ class DropdownComponent extends AppComponent {
|
|
|
1063
1062
|
{isMob && helperText ? <View testID = {testID+"_HelperText"} style={[styles.helperText]}>
|
|
1064
1063
|
{helperText}
|
|
1065
1064
|
</View>: null}
|
|
1066
|
-
<
|
|
1065
|
+
<BigList
|
|
1067
1066
|
testID = {testID+"_List"}
|
|
1068
1067
|
{...listProps}
|
|
1069
1068
|
ref = {this.listRef}
|
|
@@ -10,7 +10,7 @@ const defaultSelectable = canTextBeSelectable();
|
|
|
10
10
|
|
|
11
11
|
export const EllipsizeMode = {'head':'head','middle':'middle', 'tail':'tail' , 'clip':'clip'}
|
|
12
12
|
|
|
13
|
-
const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSize,testID,wrap,id,wrapText,error,underlined,splitText,secondary,primary,bold,textBold,disabled,text,style,...rest},ref)=> {
|
|
13
|
+
const LabelComponent = React.forwardRef(({ children,selectable,role,color,upperCase,fontSize,testID,wrap,id,wrapText,error,underlined,splitText,secondary,primary,bold,textBold,disabled,text,style,...rest},ref)=> {
|
|
14
14
|
children = defaultVal(children,text);
|
|
15
15
|
let isText = false;
|
|
16
16
|
if(!React.isValidElement(children) && Array.isArray(children) && children.length){
|
|
@@ -58,6 +58,8 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
58
58
|
if(disabled){
|
|
59
59
|
r1.pointerEvents = "none";
|
|
60
60
|
}
|
|
61
|
+
selectable = !!(selectable || defaultSelectable);
|
|
62
|
+
r2.userSelect = selectable?"none":"all";
|
|
61
63
|
if(isNonNullString(children) || isText || typeof children ==='number'){
|
|
62
64
|
if(!isText){
|
|
63
65
|
children +="";
|
|
@@ -68,7 +70,10 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
68
70
|
if(fontSize){
|
|
69
71
|
r1.fontSize = fontSize;
|
|
70
72
|
}
|
|
71
|
-
|
|
73
|
+
if(selectable){
|
|
74
|
+
r2.userSelect = "text";
|
|
75
|
+
}
|
|
76
|
+
return (<Text allowFontScaling = {true} ref = {ref}
|
|
72
77
|
{...rest} {...restProps} testID={testID} disabled={disabled}
|
|
73
78
|
role={typeof role =='string' && role && supportedRoles.includes(role.trim()) && role.trim() || undefined}
|
|
74
79
|
style={[styles.label,splitText?styles.wrap:null,splitText?styles.w100:null,bold?styles.bold:null,r2,style,r1,styles.webFontFamilly]}>{children}</Text>)
|
|
@@ -92,7 +97,7 @@ const LabelComponent = React.forwardRef(({ children,role,color,upperCase,fontSiz
|
|
|
92
97
|
}
|
|
93
98
|
return children;
|
|
94
99
|
}
|
|
95
|
-
return <View ref = {ref}
|
|
100
|
+
return <View ref = {ref} {...rest} {...restProps} testID = {testID} style={viewStyle} disabled={disabled}>{children}</View>
|
|
96
101
|
}
|
|
97
102
|
return null;
|
|
98
103
|
})
|
|
@@ -114,7 +119,10 @@ LabelComponentExported.propTypes = {
|
|
|
114
119
|
color : PropTypes.string,
|
|
115
120
|
selectable : PropTypes.bool, //si le texte est sélectionnable
|
|
116
121
|
underlined : PropTypes.bool,//si le style underlined sera appliqué au label
|
|
117
|
-
splitText : PropTypes.bool,///si le texte lorsqu'il est long sera
|
|
122
|
+
splitText : PropTypes.bool,///si le texte lorsqu'il est long sera splité,
|
|
123
|
+
/*useSelect : PropTypes.oneOfType([
|
|
124
|
+
'auto', 'text', 'none', 'contain', 'all'
|
|
125
|
+
])*/
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
export default LabelComponentExported;
|
|
@@ -10,17 +10,14 @@ export const useList = ({items,filter,prepareItems,...props})=>{
|
|
|
10
10
|
const context = contextRef.current;
|
|
11
11
|
context.itemsRefs = Array.isArray(context.itemsRefs) && context.itemsRefs || [];
|
|
12
12
|
context.prepareItems = defaultFunc((prepareItems === false ? (items)=> items:null),prepareItems,customPrepareItems);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const canPrepareItems = prepareItems === false ? false : true;
|
|
14
|
+
context.items = contextRef.items = React.useMemo(()=>{
|
|
15
|
+
const r = context.prepareItems(items,filter);
|
|
16
|
+
if(!Array.isArray(r)){
|
|
17
|
+
console.error(r," is not valid list data array",items,props);
|
|
18
|
+
return [];
|
|
17
19
|
}
|
|
18
|
-
return
|
|
19
|
-
},[items]);
|
|
20
|
-
context.items = contextRef.items = prepareItems === false ? items : getItems();
|
|
21
|
-
if(!Array.isArray(context.items)){
|
|
22
|
-
console.error(context.items," is not valid list data array",items,props);
|
|
23
|
-
context.items = [];
|
|
24
|
-
}
|
|
20
|
+
return r;
|
|
21
|
+
},[items,canPrepareItems]);
|
|
25
22
|
return context;
|
|
26
23
|
}
|
|
@@ -9,7 +9,6 @@ import styles from "../styles";
|
|
|
9
9
|
export default function TableCellMainHeaderComponent({columnField,columnDef,style,colArgs,...props}){
|
|
10
10
|
const {sortedColumn,renderHeaderCell,colsWidths} = useTable();
|
|
11
11
|
const width = colsWidths[columnField];
|
|
12
|
-
const isSelectableColumnName = columnDef.isSelectableColumnName;
|
|
13
12
|
const children = React.useMemo(()=>{
|
|
14
13
|
const content = typeof renderHeaderCell =='function'? renderHeaderCell(colArgs) : defaultVal(columnDef.text,columnDef.label,columnField);
|
|
15
14
|
if(!React.isValidElement(content,true)){
|
|
@@ -6,8 +6,8 @@ import {classNames} from "$cutils";
|
|
|
6
6
|
import { StyleSheet } from "react-native";
|
|
7
7
|
import Label from "$ecomponents/Label";
|
|
8
8
|
|
|
9
|
-
function TableCellContentComponent({children,style,...rest}){
|
|
10
|
-
return (<td {
|
|
9
|
+
function TableCellContentComponent({children,columnDef,testID,columnField,style,...rest}){
|
|
10
|
+
return (<td data-test-id={testID||"RN_TableCellComoponent"} className={classNames(rest.className,"table-row-cell")} style={StyleSheet.flatten([style])}>
|
|
11
11
|
{children}
|
|
12
12
|
</td>);
|
|
13
13
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const pdfMake = require('pdfmake/build/pdfmake.js');
|
|
2
|
+
const pdfFonts = require('pdfmake/build/vfs_fonts.js');
|
|
3
|
+
pdfMake.vfs = pdfFonts.pdfMake.vfs;
|
|
4
|
+
|
|
5
|
+
const fonts = {
|
|
6
|
+
Roboto: {
|
|
7
|
+
normal: 'Roboto-Regular.ttf',
|
|
8
|
+
bold: 'Roboto-Medium.ttf',
|
|
9
|
+
italics: 'Roboto-Italic.ttf',
|
|
10
|
+
bolditalics: 'Roboto-MediumItalic.ttf'
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
pdfMake.fonts = fonts;
|
|
14
|
+
function createPDF(args){
|
|
15
|
+
return pdfMake.createPdf(args);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export {fonts};
|
|
19
|
+
export default createPDF;
|
|
20
|
+
export {createPDF};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
function isAplhanumeric(char) {
|
|
2
|
+
const x = `${char || ""}`.charCodeAt(0);
|
|
3
|
+
if (!char || Number.isNaN(x)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
return !!((x >= 65 && x <= 90)
|
|
7
|
+
|| (x >= 97 && x <= 122)
|
|
8
|
+
|| (x >= 48 && x <= 57));
|
|
9
|
+
}
|
|
10
|
+
function getIndexes(text, wildcard) {
|
|
11
|
+
const indices = [];
|
|
12
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
13
|
+
if (text[i] === wildcard) {
|
|
14
|
+
if (indices.length % 2) {
|
|
15
|
+
if (text[i - 1] === " "
|
|
16
|
+
|| isAplhanumeric(text[i + 1])) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
indices.push(i);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (typeof (text[i + 1]) === "undefined"
|
|
24
|
+
|| text[i + 1] === " "
|
|
25
|
+
|| isAplhanumeric(text[i - 1])) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
indices.push(i);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (text[i].charCodeAt(0) === 10 && indices.length % 2) {
|
|
33
|
+
indices.pop();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (indices.length % 2) {
|
|
37
|
+
// we have unclosed tags
|
|
38
|
+
indices.pop();
|
|
39
|
+
}
|
|
40
|
+
return indices;
|
|
41
|
+
}
|
|
42
|
+
function injectTags(text, indices, rule) {
|
|
43
|
+
let e = 0;
|
|
44
|
+
indices.forEach((value, index) => {
|
|
45
|
+
const tag = (index % 2)
|
|
46
|
+
? rule.closeTag
|
|
47
|
+
: rule.openTag;
|
|
48
|
+
let v = value;
|
|
49
|
+
v += e;
|
|
50
|
+
text = text.substr(0, v) + tag + text.substr(v + 1);
|
|
51
|
+
e += (tag.length - 1);
|
|
52
|
+
});
|
|
53
|
+
return text;
|
|
54
|
+
}
|
|
55
|
+
function execRule(text, rule) {
|
|
56
|
+
const indices = getIndexes(text, rule.wildcard);
|
|
57
|
+
return injectTags(text, indices, rule);
|
|
58
|
+
}
|
|
59
|
+
function parseText(text, rules) {
|
|
60
|
+
const final = rules.reduce((transformed, rule) => {
|
|
61
|
+
return execRule(transformed, rule);
|
|
62
|
+
}, text);
|
|
63
|
+
return final.replace(/\n/gi, "<br>");
|
|
64
|
+
}
|
|
65
|
+
export const whatsappRules = [
|
|
66
|
+
{
|
|
67
|
+
closeTag: "</strong>",
|
|
68
|
+
openTag: "<strong>",
|
|
69
|
+
wildcard: "*",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
closeTag: "</i>",
|
|
73
|
+
openTag: "<i>",
|
|
74
|
+
wildcard: "_",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
closeTag: "</s>",
|
|
78
|
+
openTag: "<s>",
|
|
79
|
+
wildcard: "~",
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
export default function format(text, rules) {
|
|
83
|
+
return parseText(text, rules || whatsappRules);
|
|
84
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import $session from "$session";
|
|
3
|
+
import {isDOMElement} from "$cutils/dom";
|
|
4
|
+
let formatField = require("../exporter/formatField");
|
|
5
|
+
let {outlineText} = require("./svg");
|
|
6
|
+
let printingPageFormats = {};
|
|
7
|
+
|
|
8
|
+
/*** vérifie si le contenu désiré pour l'impression est valide */
|
|
9
|
+
|
|
10
|
+
import createPDF from ("./createPDF");
|
|
11
|
+
import notify from "$cnotify";
|
|
12
|
+
|
|
13
|
+
module.exports = printTB;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function populateFormats (){
|
|
2
|
+
let i = 4;
|
|
3
|
+
const formats = {};
|
|
4
|
+
while(i>=0){
|
|
5
|
+
let format = "A"+i;
|
|
6
|
+
let size = {};
|
|
7
|
+
formats[format] = {
|
|
8
|
+
code : format,
|
|
9
|
+
label : format,
|
|
10
|
+
pageFormat : format,
|
|
11
|
+
pageWidth : 0,
|
|
12
|
+
pageHeight : 0,
|
|
13
|
+
displayLogo : 1,
|
|
14
|
+
displaySocialReason : 1,
|
|
15
|
+
displayIdentifier : 1,
|
|
16
|
+
displayThirdPartiesIdentifier : 1,
|
|
17
|
+
pageOrientation : 'portrait',
|
|
18
|
+
topMargin : 15,
|
|
19
|
+
leftMargin : 15,
|
|
20
|
+
rightMargin : 15,
|
|
21
|
+
bottomMargin : 0,
|
|
22
|
+
...size
|
|
23
|
+
}
|
|
24
|
+
i-=1;
|
|
25
|
+
}
|
|
26
|
+
return formats;
|
|
27
|
+
}
|
|
28
|
+
export default populateFormats();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "A4";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'portrait';
|