@senior-gestao-empresarial/angular-components 7.17.0 → 7.18.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.
@@ -546,10 +546,30 @@ var ErpLookups = /** @class */ (function () {
546
546
  this.lookupService
547
547
  .list({ page: page, sort: sort, filterQuery: filterQuery, displayFields: displayFields }, this.entity, options.domain || this.domain, options.service || this.service)
548
548
  .pipe(takeUntil(this.ngUnsubscribe))
549
- .pipe(map(function (list) { return ({
550
- gridData: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.getItemLabel(item, prefix, lookupDisplayFields) })); }),
551
- totalRecords: list.totalElements
552
- }); }))
549
+ .pipe(map(function (list) {
550
+ // Criar um mapa de campos com maxLength definido
551
+ var fieldsWithMaxLength = new Map();
552
+ __spread((options.searchFields || _this.searchFields), (options.searchGridFields || _this.searchGridFields)).forEach(function (field) {
553
+ if (field.maxLength &&
554
+ (field.type === FieldType.String || field.type === FieldType.Text)) {
555
+ fieldsWithMaxLength.set(field.name, field.maxLength);
556
+ }
557
+ });
558
+ return {
559
+ gridData: list.contents.map(function (item) {
560
+ var processedItem = __assign({}, item);
561
+ // Aplicar maxLength nos campos que possuem a configuração
562
+ fieldsWithMaxLength.forEach(function (maxLength, fieldName) {
563
+ if (processedItem[fieldName] && typeof processedItem[fieldName] === 'string'
564
+ && processedItem[fieldName].length > maxLength) {
565
+ processedItem[fieldName] = processedItem[fieldName].substring(0, maxLength) + '...';
566
+ }
567
+ });
568
+ return __assign(__assign({}, processedItem), { label: _this.getItemLabel(processedItem, prefix, lookupDisplayFields) });
569
+ }),
570
+ totalRecords: list.totalElements
571
+ };
572
+ }))
553
573
  .subscribe(function (data) {
554
574
  _this.lookupSearchObservable.next(data);
555
575
  });