@senior-gestao-empresarial/angular-components 7.14.1-ec5f2ab3-5b80-485c-8495-13eb6c5073d7 → 7.15.0-a253e448-5c12-41fb-896f-7e01bd46fc46

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.
@@ -429,6 +429,15 @@
429
429
  /** Contains string value (Ex: /Products?$filter=containing(lower(name), lower('my name'))) */
430
430
  EnumLogicalOperator["Contains"] = "containing";
431
431
  })(exports.EnumLogicalOperator || (exports.EnumLogicalOperator = {}));
432
+ var ErpLookupsSearchField = /** @class */ (function (_super) {
433
+ __extends(ErpLookupsSearchField, _super);
434
+ function ErpLookupsSearchField(searchFieldOptions, args) {
435
+ var _this = _super.call(this, args) || this;
436
+ _this.searchFieldOptions = searchFieldOptions;
437
+ return _this;
438
+ }
439
+ return ErpLookupsSearchField;
440
+ }(angularComponents.FormField));
432
441
  var ErpLookups = /** @class */ (function () {
433
442
  /**
434
443
  * Criação de um lookup.
@@ -471,6 +480,9 @@
471
480
  translationKey = prefix + ".lookup_" + _this.toSnakeCase(_this.entity) + "_" + _this.toSnakeCase(fieldName);
472
481
  label = _this.translate.instant(translationKey);
473
482
  }
483
+ if ("searchFieldOptions" in field) {
484
+ return new ErpLookupsSearchField(field.searchFieldOptions, __assign(__assign({}, field), { label: label }));
485
+ }
474
486
  return new angularComponents.FormField(__assign(__assign({}, field), { label: label }));
475
487
  });
476
488
  };
@@ -654,13 +666,24 @@
654
666
  var name = _a.name;
655
667
  return filterData[name] != undefined && filterData[name] != "";
656
668
  })
657
- .map(function (_a) {
658
- var name = _a.name, type = _a.type, multiple = _a.multiple;
669
+ .map(function (formField) {
670
+ var _a;
671
+ var name = formField.name, type = formField.type, multiple = formField.multiple;
659
672
  var value = filterData[name];
660
673
  if (typeof value == "number")
661
674
  return name + " eq " + value;
662
- else if (type == angularComponents.FieldType.Date)
675
+ else if (type == angularComponents.FieldType.Date) {
676
+ if ('searchFieldOptions' in formField &&
677
+ ((_a = formField.searchFieldOptions) === null || _a === void 0 ? void 0 : _a.useAs) ===
678
+ angularComponents.FieldType.DateTime) {
679
+ return "(" + name + " " + exports.EnumLogicalOperator.Gt + " '" + moment(value)
680
+ .startOf('day')
681
+ .toISOString() + "' " + exports.EnumLogicalOperator.And + " " + name + " " + exports.EnumLogicalOperator.Lt + " '" + moment(value)
682
+ .endOf('day')
683
+ .toISOString() + "')";
684
+ }
663
685
  return name + " eq '" + moment(value).format("YYYY-MM-DD") + "'";
686
+ }
664
687
  else if (type == angularComponents.FieldType.Time)
665
688
  return name + " eq '" + moment(value).format("HH:mm:ss") + "'";
666
689
  else if (type == angularComponents.FieldType.DateTime)
@@ -9013,6 +9036,7 @@
9013
9036
  exports.EquipmentLookup = EquipmentLookup;
9014
9037
  exports.ErpLookups = ErpLookups;
9015
9038
  exports.ErpLookupsModule = ErpLookupsModule;
9039
+ exports.ErpLookupsSearchField = ErpLookupsSearchField;
9016
9040
  exports.ErpLookupsService = ErpLookupsService;
9017
9041
  exports.ErpPolling = ErpPolling;
9018
9042
  exports.ExportUtils = ExportUtils;