@senior-gestao-empresarial/angular-components 7.18.0 → 7.18.1

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.
@@ -763,12 +763,12 @@
763
763
  });
764
764
  return {
765
765
  gridData: list.contents.map(function (item) {
766
- var processedItem = __assign({}, item);
766
+ var processedItem = JSON.parse(JSON.stringify(item));
767
767
  // Aplicar maxLength nos campos que possuem a configuração
768
768
  fieldsWithMaxLength.forEach(function (maxLength, fieldName) {
769
- if (processedItem[fieldName] && typeof processedItem[fieldName] === 'string'
770
- && processedItem[fieldName].length > maxLength) {
771
- processedItem[fieldName] = processedItem[fieldName].substring(0, maxLength) + '...';
769
+ var fieldValue = _this.getNestedValue(processedItem, fieldName);
770
+ if (fieldValue && typeof fieldValue === 'string' && fieldValue.length > maxLength) {
771
+ _this.setNestedValue(processedItem, fieldName, fieldValue.substring(0, maxLength) + '...');
772
772
  }
773
773
  });
774
774
  return __assign(__assign({}, processedItem), { label: _this.getItemLabel(processedItem, prefix, lookupDisplayFields) });
@@ -792,6 +792,21 @@
792
792
  })
793
793
  .join(" - ");
794
794
  };
795
+ ErpLookups.prototype.getNestedValue = function (obj, path) {
796
+ return path.split(".").reduce(function (current, key) {
797
+ return current && current[key] !== undefined ? current[key] : undefined;
798
+ }, obj);
799
+ };
800
+ ErpLookups.prototype.setNestedValue = function (obj, path, value) {
801
+ var keys = path.split(".");
802
+ var lastKey = keys.pop();
803
+ var target = keys.reduce(function (current, key) {
804
+ return current && current[key] !== undefined ? current[key] : undefined;
805
+ }, obj);
806
+ if (target && lastKey) {
807
+ target[lastKey] = value;
808
+ }
809
+ };
795
810
  ErpLookups.ctorParameters = function () { return [
796
811
  { type: ErpLookupsService },
797
812
  { type: core$1.TranslateService },