@seniorsistemas/angular-components 17.10.3 → 17.10.5

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.
@@ -7977,8 +7977,8 @@ __decorate([
7977
7977
  TokenListComponent = TokenListComponent_1 = __decorate([
7978
7978
  Component({
7979
7979
  selector: `s-token-list`,
7980
- template: "<div\n [id]=\"id\"\n class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span\n [id]=\"token.id\"\n class=\"token\"\n [ngClass]=\"{\n 'no-pointer-events': hidePointerEvents,\n 'token--disabled': token.disabled\n }\">\n <a\n [id]=\"(token.id || 'token') + '-label'\"\n class=\"token-label\"\n (click)=\"onTokenSelected(token)\">\n {{ token.label }}\n </a>\n <span\n *ngIf=\"removableTokens && !token.notRemovable\"\n [id]=\"token.id + '-remove'\"\n class=\"token-icon fa fa-fw fa-close\"\n (click)=\"onTokenRemoved(token)\">\n </span>\n </span>\n </ng-container>\n</div>",
7981
- styles: [".no-pointer-events{pointer-events:none}.token-list{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;padding:0 10px;text-transform:none}.token-list .token{-ms-flex-align:center;align-items:center;background-color:#e5eaea;border:1px solid #697882;border-radius:4px;color:#333;display:-ms-flexbox;display:flex;font:400 12px/150% \"Open Sans\",sans-serif;margin:2px 5px 0 0;max-width:100%;padding:2px 8px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.token-list .token-label{max-width:50ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-list .token:not(.token--disabled):focus,.token-list .token:not(.token--disabled):hover{background-color:#ccc}.token-list .token a{text-decoration:none;color:#333}.token-list .token--disabled{opacity:50%}.token-list .token--disabled a{cursor:default}"]
7980
+ template: "<div\n [id]=\"id\"\n class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span\n [id]=\"token.id\"\n class=\"token\"\n [ngClass]=\"{\n 'no-pointer-events': hidePointerEvents,\n 'token--disabled': token.disabled\n }\">\n <a\n [id]=\"(token.id || 'token') + '-label'\"\n class=\"token-label\"\n (click)=\"onTokenSelected(token)\">\n {{ token.label }}\n </a>\n <span\n *ngIf=\"removableTokens && !token.notRemovable\"\n [id]=\"token.id + '-remove'\"\n class=\"fas fa-times\"\n (click)=\"onTokenRemoved(token)\">\n </span>\n </span>\n </ng-container>\n</div>",
7981
+ styles: [".no-pointer-events{pointer-events:none}.token-list{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;padding:0 10px;text-transform:none}.token-list .token{-ms-flex-align:center;align-items:center;background-color:#e5eaea;border:1px solid #697882;border-radius:4px;color:#333;display:-ms-flexbox;display:flex;font:400 12px/150% \"Open Sans\",sans-serif;gap:8px;margin:2px 5px 0 0;max-width:100%;padding:2px 8px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.token-list .token-label{max-width:50ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-list .token:not(.token--disabled):focus,.token-list .token:not(.token--disabled):hover{background-color:#ccc}.token-list .token a{text-decoration:none;color:#333}.token-list .token--disabled{opacity:50%}.token-list .token--disabled a{cursor:default}"]
7982
7982
  })
7983
7983
  ], TokenListComponent);
7984
7984
 
@@ -10963,7 +10963,6 @@ CustomFieldsService = __decorate([
10963
10963
  Injectable()
10964
10964
  ], CustomFieldsService);
10965
10965
 
10966
- var CustomFieldsComponent_1;
10967
10966
  var CustomFieldType;
10968
10967
  (function (CustomFieldType) {
10969
10968
  CustomFieldType["String"] = "String";
@@ -10980,6 +10979,8 @@ var CustomFieldType;
10980
10979
  CustomFieldType["Any"] = "Any";
10981
10980
  CustomFieldType["Enum"] = "Enum";
10982
10981
  })(CustomFieldType || (CustomFieldType = {}));
10982
+
10983
+ var CustomFieldsComponent_1;
10983
10984
  const moment$5 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
10984
10985
  let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponent {
10985
10986
  constructor(customFieldsService, localeService, sanitizer, translateService, controlContainer) {
@@ -11004,12 +11005,82 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
11004
11005
  return this.parentForm.get("custom");
11005
11006
  }
11006
11007
  ngOnInit() {
11008
+ this._validateInputs();
11009
+ this._createForm();
11010
+ this.addDisplayTimeInfoSignToFields();
11011
+ }
11012
+ ngAfterViewInit() {
11013
+ this.enableOrDisableFields(this.disableFields);
11014
+ this.formGroup.valueChanges.subscribe(() => { var _a; return (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, this.parseFieldsValues()); });
11015
+ }
11016
+ ngOnChanges(changes) {
11017
+ if (changes.disableFields) {
11018
+ this.enableOrDisableFields(changes.disableFields.currentValue);
11019
+ }
11020
+ }
11021
+ ngOnDestroy() {
11022
+ this.ngUsubscribe.next();
11023
+ this.ngUsubscribe.complete();
11024
+ }
11025
+ registerOnChange(fn) {
11026
+ this.onChange = fn;
11027
+ }
11028
+ registerOnTouched(fn) {
11029
+ this.onTouched = fn;
11030
+ }
11031
+ writeValue(value) {
11032
+ if (this.ready) {
11033
+ const newValue = this.parseValuesForFields(value);
11034
+ this.formGroup.patchValue(newValue);
11035
+ this.value = newValue;
11036
+ this.createFilesIfSetFormValuesAfterInit();
11037
+ }
11038
+ else {
11039
+ this.formGroup.patchValue(value || {});
11040
+ this.value = value;
11041
+ }
11042
+ }
11043
+ setDisabledState(isDisabled) {
11044
+ if (isDisabled)
11045
+ this.formGroup.disable({ emitEvent: false });
11046
+ else
11047
+ this.formGroup.enable({ emitEvent: false });
11048
+ }
11049
+ getCustomFields() {
11050
+ if (this.entityObject && this.entityObject.entity_) {
11051
+ return of(this.entityObject);
11052
+ }
11053
+ return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
11054
+ }
11055
+ validate() {
11056
+ const errors = {};
11057
+ Object.keys(this.formGroup.controls).forEach((field) => {
11058
+ const { errors: controlErrors } = this.formGroup.get(field);
11059
+ if (controlErrors)
11060
+ errors[field] = controlErrors;
11061
+ });
11062
+ return errors;
11063
+ }
11064
+ cleanFields() {
11065
+ this.formGroup.reset();
11066
+ }
11067
+ enableOrDisableFields(disabled) {
11068
+ if (!this.formGroup) {
11069
+ return;
11070
+ }
11071
+ for (const controlName of Object.keys(this.formGroup.value)) {
11072
+ disabled ? this.formGroup.get(controlName).disable() : this.formGroup.get(controlName).enable();
11073
+ }
11074
+ }
11075
+ _validateInputs() {
11007
11076
  if (!this.domain)
11008
11077
  throw new Error("You need to specify the custom-fields domain!");
11009
11078
  if (!this.service)
11010
11079
  throw new Error("You need to specify the custom-fields service!");
11011
11080
  if (!this.entity)
11012
11081
  throw new Error("You need to specify the custom-fields entity!");
11082
+ }
11083
+ _createForm() {
11013
11084
  this.formGroup = new FormGroup({});
11014
11085
  const observables = [this.getCustomFields(), this.localeService.get()];
11015
11086
  forkJoin(observables)
@@ -11074,70 +11145,6 @@ let CustomFieldsComponent = CustomFieldsComponent_1 = class CustomFieldsComponen
11074
11145
  this.formGroup.patchValue(this.parseValuesForFields(this.value));
11075
11146
  this.ready = true;
11076
11147
  });
11077
- this.addDisplayTimeInfoSignToFields();
11078
- }
11079
- ngAfterViewInit() {
11080
- this.enableOrDisableFields(this.disableFields);
11081
- }
11082
- ngOnChanges(changes) {
11083
- if (changes.disableFields) {
11084
- this.enableOrDisableFields(changes.disableFields.currentValue);
11085
- }
11086
- }
11087
- ngOnDestroy() {
11088
- this.ngUsubscribe.next();
11089
- this.ngUsubscribe.complete();
11090
- }
11091
- registerOnChange(fn) {
11092
- this.onChange = fn;
11093
- this.formGroup.valueChanges.subscribe(() => this.onChange(this.parseFieldsValues()));
11094
- }
11095
- registerOnTouched(fn) {
11096
- this.onTouched = fn;
11097
- }
11098
- writeValue(value) {
11099
- if (this.ready) {
11100
- const newValue = this.parseValuesForFields(value);
11101
- this.formGroup.patchValue(newValue);
11102
- this.value = newValue;
11103
- this.createFilesIfSetFormValuesAfterInit();
11104
- }
11105
- else {
11106
- this.formGroup.patchValue(value || {});
11107
- this.value = value;
11108
- }
11109
- }
11110
- setDisabledState(isDisabled) {
11111
- if (isDisabled)
11112
- this.formGroup.disable({ emitEvent: false });
11113
- else
11114
- this.formGroup.enable({ emitEvent: false });
11115
- }
11116
- getCustomFields() {
11117
- if (this.entityObject && this.entityObject.entity_) {
11118
- return of(this.entityObject);
11119
- }
11120
- return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
11121
- }
11122
- validate() {
11123
- const errors = {};
11124
- Object.keys(this.formGroup.controls).forEach((field) => {
11125
- const { errors: controlErrors } = this.formGroup.get(field);
11126
- if (controlErrors)
11127
- errors[field] = controlErrors;
11128
- });
11129
- return errors;
11130
- }
11131
- enableOrDisableFields(disabled) {
11132
- if (!this.formGroup) {
11133
- return;
11134
- }
11135
- for (const controlName of Object.keys(this.formGroup.value)) {
11136
- disabled ? this.formGroup.get(controlName).disable() : this.formGroup.get(controlName).enable();
11137
- }
11138
- }
11139
- cleanFields() {
11140
- this.formGroup.reset();
11141
11148
  }
11142
11149
  parseValuesForFields(values) {
11143
11150
  const parsedValues = Object.assign({}, values);