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