@solidpepper/solidpepper-solidgeneration 0.2.2 → 0.2.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.
@@ -5096,6 +5096,42 @@ class DataSheetSVG {
5096
5096
  let cleanActual = cleanValueForHide(actualValue).toLowerCase();
5097
5097
  let cleanCompare = cleanValueForHide(compareVal).toLowerCase();
5098
5098
  let shouldHide = false;
5099
+ // Vérifier si l'attribut est de type multiSelect
5100
+ const normAttr = attrName.toLowerCase().trim();
5101
+ const allAttrs = (this.DataSheet && this.DataSheet.attributes) || DataSheetSingleton.getInstance().attributes || [];
5102
+ const getAttrString = (val) => {
5103
+ if (!val)
5104
+ return '';
5105
+ if (typeof val === 'string')
5106
+ return val.toLowerCase().trim();
5107
+ if (typeof val === 'object' && val.fr)
5108
+ return String(val.fr).toLowerCase().trim();
5109
+ return String(val).toLowerCase().trim();
5110
+ };
5111
+ const matchedAttr = allAttrs.find((a) => (a && a.id && getAttrString(a.id) === normAttr) ||
5112
+ (a && a.attributeId && getAttrString(a.attributeId) === normAttr) ||
5113
+ (a && a.guid && getAttrString(a.guid) === normAttr) ||
5114
+ (a && a.attributeGuid && getAttrString(a.attributeGuid) === normAttr) ||
5115
+ (a && a.attributeName && getAttrString(a.attributeName) === normAttr) ||
5116
+ (a && a.code && getAttrString(a.code) === normAttr) ||
5117
+ (a && a.attributeCode && getAttrString(a.attributeCode) === normAttr));
5118
+ const isMultiSelectAttr = !!(matchedAttr &&
5119
+ (matchedAttr.attributeType === 'multiSelect' || matchedAttr.type === 'multiSelect'));
5120
+ let actualValues = [];
5121
+ if (isMultiSelectAttr) {
5122
+ if (Array.isArray(actualValue)) {
5123
+ actualValues = actualValue.map((v) => cleanValueForHide(v).toLowerCase().trim());
5124
+ }
5125
+ else if (cleanActual) {
5126
+ actualValues = cleanActual
5127
+ .split(/[#;,\n|]+/)
5128
+ .map((item) => item.trim())
5129
+ .filter((item) => item.length > 0);
5130
+ }
5131
+ }
5132
+ else {
5133
+ actualValues = [cleanActual];
5134
+ }
5099
5135
  switch (op) {
5100
5136
  case 'is_null':
5101
5137
  shouldHide = cleanActual === '';
@@ -5104,10 +5140,14 @@ class DataSheetSVG {
5104
5140
  shouldHide = cleanActual !== '';
5105
5141
  break;
5106
5142
  case 'equals':
5107
- shouldHide = cleanActual === cleanCompare;
5143
+ shouldHide = isMultiSelectAttr
5144
+ ? actualValues.includes(cleanCompare)
5145
+ : cleanActual === cleanCompare;
5108
5146
  break;
5109
5147
  case 'not_equals':
5110
- shouldHide = cleanActual !== cleanCompare;
5148
+ shouldHide = isMultiSelectAttr
5149
+ ? !actualValues.includes(cleanCompare)
5150
+ : cleanActual !== cleanCompare;
5111
5151
  break;
5112
5152
  }
5113
5153
  if (shouldHide) {