@seniorsistemas/angular-components 17.10.4 → 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.
- package/bundles/seniorsistemas-angular-components.umd.js +82 -75
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/custom-fields/custom-fields.component.d.ts +8 -6
- package/components/custom-fields/models/custom-field-type.d.ts +15 -0
- package/esm2015/components/custom-fields/custom-fields.component.js +74 -83
- package/esm2015/components/custom-fields/models/custom-field-type.js +17 -0
- package/esm5/components/custom-fields/custom-fields.component.js +85 -94
- package/esm5/components/custom-fields/models/custom-field-type.js +17 -0
- package/fesm2015/seniorsistemas-angular-components.js +72 -65
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +82 -75
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -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);
|