@fto-consult/expo-ui 5.7.8 → 5.7.9
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
|
@@ -152,6 +152,9 @@ Object.map(displayTypes,(c,k)=>{
|
|
|
152
152
|
const dataSourceArgs = {};
|
|
153
153
|
export const footerFieldName = "dgrid-fters-fields";
|
|
154
154
|
|
|
155
|
+
const checkPerm = (perm,args)=>{
|
|
156
|
+
return typeof perm ==='function'? perm(args) : isNonNullString(perm) ? Auth.isAllowedFromStr(perm) : typeof perm =='boolean'? perm : true;
|
|
157
|
+
}
|
|
155
158
|
|
|
156
159
|
/*****
|
|
157
160
|
* Pour spécifier qu'un champ du datagrid n'existe pas en bd il s'ufit de suffixer le nom du champ par le suffix : "FoundInDB" et de renseigner false comme valeur
|
|
@@ -165,9 +168,10 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
165
168
|
let {
|
|
166
169
|
data,
|
|
167
170
|
selectedRows,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
+
renderChartIsAllowed,
|
|
172
|
+
exportToPDFIsAllowed,
|
|
173
|
+
exportToExcelIsAllowed,
|
|
174
|
+
renderSectionListIsAllowed,
|
|
171
175
|
...rest
|
|
172
176
|
} = props;
|
|
173
177
|
if(this.bindResizeEvents()){
|
|
@@ -198,9 +202,11 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
198
202
|
});
|
|
199
203
|
const disTypes = {};
|
|
200
204
|
let hasFoundDisplayTypes = false;
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
const
|
|
205
|
+
const pArgs = {context:this,data,props:this.props}
|
|
206
|
+
const perm = checkPerm(renderChartIsAllowed,pArgs)
|
|
207
|
+
const ePDFIsAllowed = checkPerm(exportToPDFIsAllowed,pArgs);
|
|
208
|
+
const eExcelISAllowed = checkPerm(exportToExcelIsAllowed,pArgs);
|
|
209
|
+
const renderSectionListIsAllowedP = checkPerm(renderSectionListIsAllowed,pArgs);
|
|
204
210
|
Object.map(this.props.displayTypes,(dType,v)=>{
|
|
205
211
|
if(isNonNullString(dType)){
|
|
206
212
|
dType = dType.toLowerCase().trim();
|
|
@@ -247,6 +253,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
247
253
|
isChartAllowed : {value : perm},
|
|
248
254
|
isExcellExportAllowed : {value:eExcelISAllowed},
|
|
249
255
|
isPDFExportAllowed : {value: ePDFIsAllowed},
|
|
256
|
+
renderSectionListIsAllowed : {value:renderSectionListIsAllowedP},
|
|
250
257
|
currentFilteringColumns : {value:{}},
|
|
251
258
|
emptySectionListHeaderValue : {value : uniqid("empty-section-list-header-val").toUpperCase()},
|
|
252
259
|
getSectionListHeaderProp : {value : typeof this.props.getSectionListHeader =='function'? this.props.getSectionListHeader : undefined},
|
|
@@ -2367,6 +2374,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2367
2374
|
}
|
|
2368
2375
|
/*** permet d'effectuer le rendu des colonnes groupable dans le menu item */
|
|
2369
2376
|
renderSectionListMenu(){
|
|
2377
|
+
if(!this.renderSectionListIsAllowed) return null;
|
|
2370
2378
|
const m = Array.isArray(this.preparedColumns?.sectionListColumnsMenuItems)? this.preparedColumns?.sectionListColumnsMenuItems : [];
|
|
2371
2379
|
const mm = [];
|
|
2372
2380
|
Object.map(m,(_)=>{
|
|
@@ -2744,7 +2752,7 @@ export default class CommonDatagridComponent extends AppComponent {
|
|
|
2744
2752
|
if(!isObj(d) || (hasLocalFilter && this.doLocalFilter({rowData:d,rowIndex:i}) === false)){
|
|
2745
2753
|
return;
|
|
2746
2754
|
}
|
|
2747
|
-
if(hasSectionColumns){
|
|
2755
|
+
if(hasSectionColumns && this.renderSectionListIsAllowed){
|
|
2748
2756
|
let sHeader = this.getSectionListHeader({config,data:d,columnsLength : sectionListColumnsSize,fieldsSize:sectionListColumnsSize,sectionListColumnsLength:sectionListColumnsSize,sectionListColumnsSize,allData:data,rowData:d,index:i,rowIndex,context:this,columns,fields:columns});
|
|
2749
2757
|
if(sHeader === false) return;//on omet la donnée si la fonction de récupération de son header retourne false
|
|
2750
2758
|
if(!isNonNullString(sHeader) || sHeader.toLowerCase().trim() =="undefined"){
|
|
@@ -3995,11 +4003,28 @@ CommonDatagridComponent.propTypes = {
|
|
|
3995
4003
|
sectionListHeadersSeries : PropTypes.arrayOf(PropTypes.string),
|
|
3996
4004
|
}),
|
|
3997
4005
|
/*** la permission autorisée pour l'export en pdf */
|
|
3998
|
-
|
|
4006
|
+
exportToPDFIsAllowed : PropTypes.oneOfType([
|
|
4007
|
+
PropTypes.string,
|
|
4008
|
+
PropTypes.func,
|
|
4009
|
+
PropTypes.bool,
|
|
4010
|
+
]),
|
|
3999
4011
|
/*** la permission autorisée pour l'export en excel*/
|
|
4000
|
-
|
|
4012
|
+
exportToExcelIsAllowed : PropTypes.oneOfType([
|
|
4013
|
+
PropTypes.string,
|
|
4014
|
+
PropTypes.func,
|
|
4015
|
+
PropTypes.bool,
|
|
4016
|
+
]),
|
|
4017
|
+
renderSectionListIsAllowed : PropTypes.oneOfType([
|
|
4018
|
+
PropTypes.string,
|
|
4019
|
+
PropTypes.func,
|
|
4020
|
+
PropTypes.bool,
|
|
4021
|
+
]),
|
|
4001
4022
|
/*** la permission que doit avoir l'utilisateur pour pouvoir visualiser les graphes à partir du diagrame */
|
|
4002
|
-
|
|
4023
|
+
renderChartIsAllowed : PropTypes.oneOfType([
|
|
4024
|
+
PropTypes.string,
|
|
4025
|
+
PropTypes.func,
|
|
4026
|
+
PropTypes.bool,
|
|
4027
|
+
]),
|
|
4003
4028
|
displayType : chartDisplayType,
|
|
4004
4029
|
/*** les types d'afichates supportés par l'application */
|
|
4005
4030
|
displayTypes : PropTypes.arrayOf(chartDisplayType),
|