@senior-gestao-pessoas/hcm-entity-lookups 5.3.2 → 5.4.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.
@@ -2743,8 +2743,7 @@
2743
2743
  var displayFields = mergeUnique(this.employeeLookupDisplayFields, this.employeeFieldsForValidation);
2744
2744
  return this.employeeService
2745
2745
  .list({ page: page, sort: sort, filterQuery: employeeFilterQuery, displayFields: displayFields })
2746
- .pipe(operators.takeUntil(this.ngUnsubscribe))
2747
- .pipe(operators.map(function (list) { return _this.mapToComponent(list, isDynamicForm); }));
2746
+ .pipe(operators.takeUntil(this.ngUnsubscribe), operators.map(function (list) { return _this.mapToComponent(list, isDynamicForm); }));
2748
2747
  };
2749
2748
  EmployeeLookupService.prototype.mapToComponent = function (list, isDynamicForm) {
2750
2749
  var _this = this;
@@ -2853,7 +2852,7 @@
2853
2852
  EmployeeLookupComponent.prototype.onEmployeeLookupRequest = function (value) {
2854
2853
  var _this = this;
2855
2854
  this.employeeLookupService
2856
- .onEmployeeLookupRequestObservable(value, this.companyIds)
2855
+ .onEmployeeLookupRequestObservable(value, this.companyIds, this.additionalFilter)
2857
2856
  .subscribe(function (list) {
2858
2857
  _this.employeeLookupSuggestions = list.contents;
2859
2858
  });
@@ -2861,7 +2860,7 @@
2861
2860
  EmployeeLookupComponent.prototype.onEmployeeSearchRequest = function (event) {
2862
2861
  var _this = this;
2863
2862
  this.employeeLookupService
2864
- .onEmployeeSearchRequestObservable(event, this.companyIds)
2863
+ .onEmployeeSearchRequestObservable(event, this.companyIds, false, this.additionalFilter)
2865
2864
  .subscribe(function (list) {
2866
2865
  _this.employeeSearchGridData = list.contents;
2867
2866
  _this.employeeSearchTotalRecords = list.totalElements;
@@ -4821,16 +4820,48 @@
4821
4820
  this.translate = translate;
4822
4821
  this.configService = configService;
4823
4822
  this.employmentRelationshipService = employmentRelationshipService;
4824
- this.employmentRelationshipLookupDisplayFields = ["code", "name"];
4825
- this.employmentRelationshipLookupSeparator = " - ";
4826
- this.employmentRelationshipSearchSubject = new rxjs.Subject();
4827
- this.employmentRelationshipLookupSubject = new rxjs.Subject();
4828
4823
  this.ngUnsubscribe = new rxjs.Subject();
4824
+ this.lookupServiceConfig = {
4825
+ lookupDisplayFields: ["code", "name"],
4826
+ lookupSeparator: " - ",
4827
+ searchSubject: new rxjs.Subject(),
4828
+ lookupSubject: new rxjs.Subject(),
4829
+ entityName: "employmentRelationship",
4830
+ dynamicFormOptions: {
4831
+ cancelLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".cancel"),
4832
+ clearLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".clear"),
4833
+ dataKey: "id",
4834
+ emptyFieldLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".list_grid_empty_field"),
4835
+ emptyMessage: this.translate.instant(this.configService.getTranslationPrefix() + ".empty_message_field"),
4836
+ filterLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".filter"),
4837
+ filterTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".filters"),
4838
+ label: this.translate.instant(this.configService.getTranslationPrefix() + ".employment_relationship_label"),
4839
+ lookupDisplayField: "label",
4840
+ multiple: false,
4841
+ name: "employmentRelationship",
4842
+ recordLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
4843
+ recordsLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
4844
+ required: true,
4845
+ searchEmptyTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".nothing_found"),
4846
+ searchFields: this.getEmploymentRelationshipSearchFields(),
4847
+ searchGridFields: this.getEmploymentRelationshipSearchFields(),
4848
+ searchTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".employment_relationship_history_employment_relationship_search_title"),
4849
+ selectLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".select"),
4850
+ visible: true,
4851
+ isCollective: false,
4852
+ },
4853
+ filters: {
4854
+ additionalFilter: undefined,
4855
+ initialFilter: undefined,
4856
+ companyIds: [],
4857
+ },
4858
+ };
4829
4859
  }
4830
4860
  EmploymentRelationshipLookupService.prototype.updateSuggestions = function (value) {
4861
+ var _a, _b;
4831
4862
  if (value.employmentRelationship) {
4832
- value.employmentRelationship.label = this.getSuggestionValue(["code", "name"], "employmentRelationship", value, this.employmentRelationshipLookupSeparator);
4833
- if (value.employmentRelationship.label.trim() === this.employmentRelationshipLookupSeparator.trim()) {
4863
+ value.employmentRelationship.label = this.getSuggestionValue(["code", "name"], (_a = this.lookupServiceConfig) === null || _a === void 0 ? void 0 : _a.entityName, value, (_b = this.lookupServiceConfig) === null || _b === void 0 ? void 0 : _b.lookupSeparator);
4864
+ if (value.employmentRelationship.label.trim() === this.lookupServiceConfig.lookupSeparator.trim()) {
4834
4865
  delete value.employmentRelationship.label;
4835
4866
  }
4836
4867
  }
@@ -4846,37 +4877,37 @@
4846
4877
  EmploymentRelationshipLookupService.prototype.getFormField = function (isCollective, additionalFilter, initialFilter) {
4847
4878
  var _this = this;
4848
4879
  return new angularComponents.FormField({
4849
- cancelLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".cancel"),
4850
- clearLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".clear"),
4880
+ cancelLabel: this.lookupServiceConfig.dynamicFormOptions.cancelLabel,
4881
+ clearLabel: this.lookupServiceConfig.dynamicFormOptions.clearLabel,
4851
4882
  dataKey: "id",
4852
- emptyFieldLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".list_grid_empty_field"),
4853
- emptyMessage: this.translate.instant(this.configService.getTranslationPrefix() + ".empty_message_field"),
4854
- filterLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".filter"),
4855
- filterTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".filters"),
4856
- label: this.translate.instant(this.configService.getTranslationPrefix() + ".employment_relationship"),
4857
- lookupDisplayField: "label",
4858
- multiple: false,
4859
- name: "employmentRelationship",
4883
+ emptyFieldLabel: this.lookupServiceConfig.dynamicFormOptions.emptyFieldLabel,
4884
+ emptyMessage: this.lookupServiceConfig.dynamicFormOptions.emptyMessage,
4885
+ filterLabel: this.lookupServiceConfig.dynamicFormOptions.filterLabel,
4886
+ filterTitle: this.lookupServiceConfig.dynamicFormOptions.filterTitle,
4887
+ label: this.lookupServiceConfig.dynamicFormOptions.label,
4888
+ lookupDisplayField: this.lookupServiceConfig.dynamicFormOptions.lookupDisplayField,
4889
+ multiple: this.lookupServiceConfig.dynamicFormOptions.multiple,
4890
+ name: this.lookupServiceConfig.dynamicFormOptions.name,
4860
4891
  onLookupRequest: function (value) { return _this.onEmploymentRelationshipLookupRequest(value, additionalFilter, initialFilter); },
4861
4892
  onSearchRequest: function (event) { return _this.onEmploymentRelationshipSearchRequest(event, additionalFilter, initialFilter); },
4862
- recordLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
4863
- recordsLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".records_found"),
4893
+ recordLabel: this.lookupServiceConfig.dynamicFormOptions.recordLabel,
4894
+ recordsLabel: this.lookupServiceConfig.dynamicFormOptions.recordsLabel,
4864
4895
  required: function () { return true; },
4865
- searchEmptyTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".nothing_found"),
4866
- searchFields: this.getEmploymentRelationshipSearchFields(),
4867
- searchGridFields: this.getEmploymentRelationshipSearchFields(),
4868
- searchObservable: this.employmentRelationshipSearchSubject,
4869
- searchTitle: this.translate.instant(this.configService.getTranslationPrefix() + ".employment_relationship_search_title"),
4870
- selectLabel: this.translate.instant(this.configService.getTranslationPrefix() + ".select"),
4871
- suggestionsObservable: this.employmentRelationshipLookupSubject,
4896
+ searchEmptyTitle: this.lookupServiceConfig.dynamicFormOptions.searchEmptyTitle,
4897
+ searchFields: this.lookupServiceConfig.dynamicFormOptions.searchFields,
4898
+ searchGridFields: this.lookupServiceConfig.dynamicFormOptions.searchGridFields,
4899
+ searchObservable: this.lookupServiceConfig.searchSubject,
4900
+ suggestionsObservable: this.lookupServiceConfig.lookupSubject,
4901
+ searchTitle: this.lookupServiceConfig.dynamicFormOptions.searchTitle,
4902
+ selectLabel: this.lookupServiceConfig.dynamicFormOptions.selectLabel,
4872
4903
  type: angularComponents.FieldType.Lookup,
4873
- visible: function () { return !isCollective; },
4904
+ visible: this.lookupServiceConfig.dynamicFormOptions.visible,
4874
4905
  });
4875
4906
  };
4876
4907
  EmploymentRelationshipLookupService.prototype.onEmploymentRelationshipSearchRequest = function (event, additionalFilter, initialFilter) {
4877
4908
  var _this = this;
4878
4909
  this.onEmploymentRelationshipSearchRequestObservable(event, additionalFilter, initialFilter, true)
4879
- .subscribe(function (data) { return _this.employmentRelationshipSearchSubject.next(data); });
4910
+ .subscribe(function (data) { return _this.lookupServiceConfig.searchSubject.next(data); });
4880
4911
  };
4881
4912
  EmploymentRelationshipLookupService.prototype.onEmploymentRelationshipSearchRequestObservable = function (event, additionalFilter, initialFilter, isDynamicForm) {
4882
4913
  var _this = this;
@@ -4886,7 +4917,7 @@
4886
4917
  var sort = multiSortMeta;
4887
4918
  var employmentRelationshipFilterQuery = createSearchRequestFilter(filterData, this.getEmploymentRelationshipSearchFields());
4888
4919
  employmentRelationshipFilterQuery = getFilterForLookup(employmentRelationshipFilterQuery, additionalFilter, initialFilter);
4889
- var displayFields = mergeUnique(this.employmentRelationshipLookupDisplayFields, __spread(this.employmentRelationshipLookupDisplayFields));
4920
+ var displayFields = mergeUnique(this.lookupServiceConfig.lookupDisplayFields, __spread(this.lookupServiceConfig.lookupDisplayFields));
4890
4921
  return this.employmentRelationshipService
4891
4922
  .list({ page: page, sort: sort, filterQuery: employmentRelationshipFilterQuery, displayFields: displayFields })
4892
4923
  .pipe(operators.takeUntil(this.ngUnsubscribe))
@@ -4908,7 +4939,7 @@
4908
4939
  };
4909
4940
  EmploymentRelationshipLookupService.prototype.getLabelForMaping = function (item) {
4910
4941
  var _this = this;
4911
- return this.employmentRelationshipLookupDisplayFields
4942
+ return this.lookupServiceConfig.lookupDisplayFields
4912
4943
  .map(function (field) {
4913
4944
  if (field === "name" && !item.name) {
4914
4945
  item.name = _this.translate
@@ -4919,24 +4950,24 @@
4919
4950
  }
4920
4951
  return item[field];
4921
4952
  })
4922
- .join(this.employmentRelationshipLookupSeparator);
4953
+ .join(this.lookupServiceConfig.lookupSeparator);
4923
4954
  };
4924
4955
  EmploymentRelationshipLookupService.prototype.onEmploymentRelationshipLookupRequest = function (value, additionalFilter, initialFilter) {
4925
4956
  var _this = this;
4926
4957
  this.onEmploymentRelationshipLookupRequestObservable(value, additionalFilter, initialFilter)
4927
- .subscribe(function (data) { return _this.employmentRelationshipLookupSubject.next(data.contents); });
4958
+ .subscribe(function (data) { return _this.lookupServiceConfig.lookupSubject.next(data.contents); });
4928
4959
  };
4929
4960
  EmploymentRelationshipLookupService.prototype.onEmploymentRelationshipLookupRequestObservable = function (value, additionalFilter, initialFilter) {
4930
4961
  var _this = this;
4931
- var sort = this.employmentRelationshipLookupDisplayFields
4962
+ var sort = this.lookupServiceConfig.lookupDisplayFields
4932
4963
  .map(function (field) { return ({ field: field, order: 1 }); });
4933
4964
  var workshiftfilterQuery = createLookupRequestFilter(value, this.getEmploymentRelationshipSearchFields());
4934
4965
  workshiftfilterQuery = getFilterForLookup(workshiftfilterQuery, additionalFilter, initialFilter);
4935
- var displayFields = mergeUnique(this.employmentRelationshipLookupDisplayFields, __spread(this.employmentRelationshipLookupDisplayFields));
4966
+ var displayFields = mergeUnique(this.lookupServiceConfig.lookupDisplayFields, __spread(this.lookupServiceConfig.lookupDisplayFields));
4936
4967
  return this.employmentRelationshipService
4937
4968
  .list({ sort: sort, filterQuery: workshiftfilterQuery, displayFields: displayFields })
4938
4969
  .pipe(operators.takeUntil(this.ngUnsubscribe))
4939
- .pipe(operators.map(function (list) { return (__assign(__assign({}, list), { contents: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.employmentRelationshipLookupDisplayFields
4970
+ .pipe(operators.map(function (list) { return (__assign(__assign({}, list), { contents: list.contents.map(function (item) { return (__assign(__assign({}, item), { label: _this.lookupServiceConfig.lookupDisplayFields
4940
4971
  .map(function (field) {
4941
4972
  if (field === "name" && !item.name) {
4942
4973
  item.name = _this.translate
@@ -4946,7 +4977,7 @@
4946
4977
  return getProp(item, field);
4947
4978
  }
4948
4979
  return item[field];
4949
- }).join(_this.employmentRelationshipLookupSeparator) })); }) })); }));
4980
+ }).join(_this.lookupServiceConfig.lookupSeparator) })); }) })); }));
4950
4981
  };
4951
4982
  EmploymentRelationshipLookupService.prototype.getEmploymentRelationshipSearchFields = function () {
4952
4983
  return [
@@ -4990,8 +5021,8 @@
4990
5021
  return _this;
4991
5022
  }
4992
5023
  EmploymentRelationshipLookupComponent.prototype.ngOnInit = function () {
4993
- this.employmentRelationshipSearchFields = this.employmentRelationshipLookupService.getEmploymentRelationshipSearchFields();
4994
- this.employmentRelationshipSearchGridFields = this.employmentRelationshipLookupService.getEmploymentRelationshipSearchFields();
5024
+ this.employmentRelationshipSearchFields = this.employmentRelationshipLookupService.lookupServiceConfig.dynamicFormOptions.searchFields;
5025
+ this.employmentRelationshipSearchGridFields = this.employmentRelationshipLookupService.lookupServiceConfig.dynamicFormOptions.searchFields;
4995
5026
  };
4996
5027
  EmploymentRelationshipLookupComponent.prototype.onEmploymentRelationshipLookupRequest = function (value) {
4997
5028
  var _this = this;