@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.
@@ -8694,8 +8694,8 @@
8694
8694
  TokenListComponent = TokenListComponent_1 = __decorate([
8695
8695
  core.Component({
8696
8696
  selector: "s-token-list",
8697
- 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>",
8698
- 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}"]
8697
+ 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>",
8698
+ 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}"]
8699
8699
  })
8700
8700
  ], TokenListComponent);
8701
8701
  return TokenListComponent;
@@ -11860,6 +11860,7 @@
11860
11860
  CustomFieldType["Any"] = "Any";
11861
11861
  CustomFieldType["Enum"] = "Enum";
11862
11862
  })(CustomFieldType || (CustomFieldType = {}));
11863
+
11863
11864
  var moment$5 = moment_; // @HACK Necessary because of https://github.com/rollup/rollup/issues/670
11864
11865
  var CustomFieldsComponent = /** @class */ (function () {
11865
11866
  function CustomFieldsComponent(customFieldsService, localeService, sanitizer, translateService, controlContainer) {
@@ -11893,81 +11894,14 @@
11893
11894
  configurable: true
11894
11895
  });
11895
11896
  CustomFieldsComponent.prototype.ngOnInit = function () {
11896
- var _this = this;
11897
- if (!this.domain)
11898
- throw new Error("You need to specify the custom-fields domain!");
11899
- if (!this.service)
11900
- throw new Error("You need to specify the custom-fields service!");
11901
- if (!this.entity)
11902
- throw new Error("You need to specify the custom-fields entity!");
11903
- this.formGroup = new forms.FormGroup({});
11904
- var observables = [this.getCustomFields(), this.localeService.get()];
11905
- rxjs.forkJoin(observables)
11906
- .pipe(operators.takeUntil(this.ngUsubscribe), operators.finalize(function () {
11907
- var _a;
11908
- _this.formGroup.markAsPristine();
11909
- (_a = _this.parentControl) === null || _a === void 0 ? void 0 : _a.markAsPristine();
11910
- if (_this.ready$)
11911
- _this.ready$.next(true);
11912
- }))
11913
- .subscribe(function (response) {
11914
- var _a = __read(response, 2), customFieldsResponse = _a[0], localeOptions = _a[1];
11915
- var defaults = {};
11916
- defaults[CustomFieldType.String] = {};
11917
- defaults[CustomFieldType.Boolean] = { defaultValue: false };
11918
- defaults[CustomFieldType.Integer] = {};
11919
- defaults[CustomFieldType.Double] = { defaultMask: "" };
11920
- defaults[CustomFieldType.Money] = {};
11921
- defaults[CustomFieldType.Date] = {};
11922
- defaults[CustomFieldType.DateTime] = {};
11923
- defaults[CustomFieldType.LocalDateTime] = {};
11924
- defaults[CustomFieldType.Time] = {};
11925
- defaults[CustomFieldType.Blob] = {};
11926
- defaults[CustomFieldType.Enum] = {};
11927
- defaults[CustomFieldType.Binary] = {};
11928
- defaults[CustomFieldType.Any] = {};
11929
- if (!customFieldsResponse || !customFieldsResponse.entity_)
11930
- return;
11931
- var _b = customFieldsResponse.entity_, active = _b.active, fields = _b.fields;
11932
- if (!active)
11933
- return;
11934
- fields
11935
- .filter(function (field) { return field.customizable && field.customization && field.customization.active; })
11936
- .forEach(function (field) {
11937
- var _a;
11938
- var formField = _this.getFormField(field, localeOptions);
11939
- var fieldType = field.type;
11940
- if (field.type === CustomFieldType.Blob && _this.value && _this.value[formField.name])
11941
- _this.createBlobToFileUpload(formField);
11942
- var validationRegex = field.customization.validationRegex;
11943
- var asIsTypes = [
11944
- CustomFieldType.Boolean,
11945
- CustomFieldType.Money,
11946
- CustomFieldType.Date,
11947
- CustomFieldType.DateTime,
11948
- CustomFieldType.LocalDateTime,
11949
- CustomFieldType.Time,
11950
- ];
11951
- var validators = [];
11952
- if (validationRegex && !asIsTypes.includes(fieldType))
11953
- validators.push(forms.Validators.pattern(validationRegex));
11954
- if (fieldType === CustomFieldType.Integer && !formField.mask)
11955
- validators.push(forms.Validators.pattern(/^\-?\d*$/));
11956
- if ((_a = formField.required) === null || _a === void 0 ? void 0 : _a.call(formField)) {
11957
- validators.push(forms.Validators.required);
11958
- }
11959
- var control = new forms.FormControl({ value: defaults[fieldType].defaultValue, disabled: _this.formGroup.disabled }, validators);
11960
- _this.formGroup.addControl(formField.name, control);
11961
- _this.fields.push(formField);
11962
- });
11963
- _this.createFieldCustomization(fields);
11964
- _this.formGroup.patchValue(_this.parseValuesForFields(_this.value));
11965
- _this.ready = true;
11966
- });
11897
+ this._validateInputs();
11898
+ this._createForm();
11967
11899
  this.addDisplayTimeInfoSignToFields();
11968
11900
  };
11969
11901
  CustomFieldsComponent.prototype.ngAfterViewInit = function () {
11902
+ var _this = this;
11970
11903
  this.enableOrDisableFields(this.disableFields);
11904
+ this.formGroup.valueChanges.subscribe(function () { var _a; return (_a = _this.onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this.parseFieldsValues()); });
11971
11905
  };
11972
11906
  CustomFieldsComponent.prototype.ngOnChanges = function (changes) {
11973
11907
  if (changes.disableFields) {
@@ -11979,9 +11913,7 @@
11979
11913
  this.ngUsubscribe.complete();
11980
11914
  };
11981
11915
  CustomFieldsComponent.prototype.registerOnChange = function (fn) {
11982
- var _this = this;
11983
11916
  this.onChange = fn;
11984
- this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
11985
11917
  };
11986
11918
  CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
11987
11919
  this.onTouched = fn;
@@ -12020,6 +11952,9 @@
12020
11952
  });
12021
11953
  return errors;
12022
11954
  };
11955
+ CustomFieldsComponent.prototype.cleanFields = function () {
11956
+ this.formGroup.reset();
11957
+ };
12023
11958
  CustomFieldsComponent.prototype.enableOrDisableFields = function (disabled) {
12024
11959
  var e_1, _a;
12025
11960
  if (!this.formGroup) {
@@ -12039,8 +11974,80 @@
12039
11974
  finally { if (e_1) throw e_1.error; }
12040
11975
  }
12041
11976
  };
12042
- CustomFieldsComponent.prototype.cleanFields = function () {
12043
- this.formGroup.reset();
11977
+ CustomFieldsComponent.prototype._validateInputs = function () {
11978
+ if (!this.domain)
11979
+ throw new Error("You need to specify the custom-fields domain!");
11980
+ if (!this.service)
11981
+ throw new Error("You need to specify the custom-fields service!");
11982
+ if (!this.entity)
11983
+ throw new Error("You need to specify the custom-fields entity!");
11984
+ };
11985
+ CustomFieldsComponent.prototype._createForm = function () {
11986
+ var _this = this;
11987
+ this.formGroup = new forms.FormGroup({});
11988
+ var observables = [this.getCustomFields(), this.localeService.get()];
11989
+ rxjs.forkJoin(observables)
11990
+ .pipe(operators.takeUntil(this.ngUsubscribe), operators.finalize(function () {
11991
+ var _a;
11992
+ _this.formGroup.markAsPristine();
11993
+ (_a = _this.parentControl) === null || _a === void 0 ? void 0 : _a.markAsPristine();
11994
+ if (_this.ready$)
11995
+ _this.ready$.next(true);
11996
+ }))
11997
+ .subscribe(function (response) {
11998
+ var _a = __read(response, 2), customFieldsResponse = _a[0], localeOptions = _a[1];
11999
+ var defaults = {};
12000
+ defaults[CustomFieldType.String] = {};
12001
+ defaults[CustomFieldType.Boolean] = { defaultValue: false };
12002
+ defaults[CustomFieldType.Integer] = {};
12003
+ defaults[CustomFieldType.Double] = { defaultMask: "" };
12004
+ defaults[CustomFieldType.Money] = {};
12005
+ defaults[CustomFieldType.Date] = {};
12006
+ defaults[CustomFieldType.DateTime] = {};
12007
+ defaults[CustomFieldType.LocalDateTime] = {};
12008
+ defaults[CustomFieldType.Time] = {};
12009
+ defaults[CustomFieldType.Blob] = {};
12010
+ defaults[CustomFieldType.Enum] = {};
12011
+ defaults[CustomFieldType.Binary] = {};
12012
+ defaults[CustomFieldType.Any] = {};
12013
+ if (!customFieldsResponse || !customFieldsResponse.entity_)
12014
+ return;
12015
+ var _b = customFieldsResponse.entity_, active = _b.active, fields = _b.fields;
12016
+ if (!active)
12017
+ return;
12018
+ fields
12019
+ .filter(function (field) { return field.customizable && field.customization && field.customization.active; })
12020
+ .forEach(function (field) {
12021
+ var _a;
12022
+ var formField = _this.getFormField(field, localeOptions);
12023
+ var fieldType = field.type;
12024
+ if (field.type === CustomFieldType.Blob && _this.value && _this.value[formField.name])
12025
+ _this.createBlobToFileUpload(formField);
12026
+ var validationRegex = field.customization.validationRegex;
12027
+ var asIsTypes = [
12028
+ CustomFieldType.Boolean,
12029
+ CustomFieldType.Money,
12030
+ CustomFieldType.Date,
12031
+ CustomFieldType.DateTime,
12032
+ CustomFieldType.LocalDateTime,
12033
+ CustomFieldType.Time,
12034
+ ];
12035
+ var validators = [];
12036
+ if (validationRegex && !asIsTypes.includes(fieldType))
12037
+ validators.push(forms.Validators.pattern(validationRegex));
12038
+ if (fieldType === CustomFieldType.Integer && !formField.mask)
12039
+ validators.push(forms.Validators.pattern(/^\-?\d*$/));
12040
+ if ((_a = formField.required) === null || _a === void 0 ? void 0 : _a.call(formField)) {
12041
+ validators.push(forms.Validators.required);
12042
+ }
12043
+ var control = new forms.FormControl({ value: defaults[fieldType].defaultValue, disabled: _this.formGroup.disabled }, validators);
12044
+ _this.formGroup.addControl(formField.name, control);
12045
+ _this.fields.push(formField);
12046
+ });
12047
+ _this.createFieldCustomization(fields);
12048
+ _this.formGroup.patchValue(_this.parseValuesForFields(_this.value));
12049
+ _this.ready = true;
12050
+ });
12044
12051
  };
12045
12052
  CustomFieldsComponent.prototype.parseValuesForFields = function (values) {
12046
12053
  var parsedValues = __assign({}, values);