@seniorsistemas/angular-components 16.12.3 → 16.13.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.
Files changed (31) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +133 -32
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/custom-fields/custom-fields.component.d.ts +9 -4
  6. package/components/rating-scale/index.d.ts +3 -0
  7. package/components/rating-scale/models/index.d.ts +1 -0
  8. package/components/rating-scale/models/rating-scale-node.d.ts +5 -0
  9. package/components/rating-scale/rating-scale.component.d.ts +15 -0
  10. package/components/rating-scale/rating-scale.module.d.ts +2 -0
  11. package/esm2015/components/custom-fields/custom-fields.component.js +54 -32
  12. package/esm2015/components/rating-scale/index.js +3 -0
  13. package/esm2015/components/rating-scale/models/index.js +1 -0
  14. package/esm2015/components/rating-scale/models/rating-scale-node.js +1 -0
  15. package/esm2015/components/rating-scale/rating-scale.component.js +52 -0
  16. package/esm2015/components/rating-scale/rating-scale.module.js +19 -0
  17. package/esm2015/public-api.js +2 -1
  18. package/esm5/components/custom-fields/custom-fields.component.js +67 -34
  19. package/esm5/components/rating-scale/index.js +3 -0
  20. package/esm5/components/rating-scale/models/index.js +1 -0
  21. package/esm5/components/rating-scale/models/rating-scale-node.js +1 -0
  22. package/esm5/components/rating-scale/rating-scale.component.js +54 -0
  23. package/esm5/components/rating-scale/rating-scale.module.js +22 -0
  24. package/esm5/public-api.js +2 -1
  25. package/fesm2015/seniorsistemas-angular-components.js +115 -32
  26. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  27. package/fesm5/seniorsistemas-angular-components.js +132 -33
  28. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  29. package/package.json +1 -1
  30. package/public-api.d.ts +1 -0
  31. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -8109,38 +8109,6 @@
8109
8109
  enumerable: true,
8110
8110
  configurable: true
8111
8111
  });
8112
- CustomFieldsComponent.prototype.registerOnChange = function (fn) {
8113
- var _this = this;
8114
- this.onChange = fn;
8115
- this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
8116
- };
8117
- CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
8118
- this.onTouched = fn;
8119
- };
8120
- CustomFieldsComponent.prototype.writeValue = function (value) {
8121
- if (this.ready) {
8122
- var newValue = this.parseValuesForFields(value);
8123
- this.formGroup.patchValue(newValue);
8124
- this.value = newValue;
8125
- this.createFilesIfSetFormValuesAfterInit();
8126
- }
8127
- else {
8128
- this.formGroup.patchValue(value || {});
8129
- this.value = value;
8130
- }
8131
- };
8132
- CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
8133
- if (isDisabled)
8134
- this.formGroup.disable({ emitEvent: false });
8135
- else
8136
- this.formGroup.enable({ emitEvent: false });
8137
- };
8138
- CustomFieldsComponent.prototype.getCustomFields = function () {
8139
- if (this.entityObject && this.entityObject.entity_) {
8140
- return rxjs.of(this.entityObject);
8141
- }
8142
- return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
8143
- };
8144
8112
  CustomFieldsComponent.prototype.ngOnInit = function () {
8145
8113
  var _this = this;
8146
8114
  if (!this.domain)
@@ -8213,10 +8181,50 @@
8213
8181
  _this.ready = true;
8214
8182
  });
8215
8183
  };
8184
+ CustomFieldsComponent.prototype.ngAfterViewInit = function () {
8185
+ this.enableOrDisableFields(this.disableFields);
8186
+ };
8187
+ CustomFieldsComponent.prototype.ngOnChanges = function (changes) {
8188
+ if (changes.disableFields) {
8189
+ this.enableOrDisableFields(changes.disableFields.currentValue);
8190
+ }
8191
+ };
8216
8192
  CustomFieldsComponent.prototype.ngOnDestroy = function () {
8217
8193
  this.ngUsubscribe.next();
8218
8194
  this.ngUsubscribe.complete();
8219
8195
  };
8196
+ CustomFieldsComponent.prototype.registerOnChange = function (fn) {
8197
+ var _this = this;
8198
+ this.onChange = fn;
8199
+ this.formGroup.valueChanges.subscribe(function () { return _this.onChange(_this.parseFieldsValues()); });
8200
+ };
8201
+ CustomFieldsComponent.prototype.registerOnTouched = function (fn) {
8202
+ this.onTouched = fn;
8203
+ };
8204
+ CustomFieldsComponent.prototype.writeValue = function (value) {
8205
+ if (this.ready) {
8206
+ var newValue = this.parseValuesForFields(value);
8207
+ this.formGroup.patchValue(newValue);
8208
+ this.value = newValue;
8209
+ this.createFilesIfSetFormValuesAfterInit();
8210
+ }
8211
+ else {
8212
+ this.formGroup.patchValue(value || {});
8213
+ this.value = value;
8214
+ }
8215
+ };
8216
+ CustomFieldsComponent.prototype.setDisabledState = function (isDisabled) {
8217
+ if (isDisabled)
8218
+ this.formGroup.disable({ emitEvent: false });
8219
+ else
8220
+ this.formGroup.enable({ emitEvent: false });
8221
+ };
8222
+ CustomFieldsComponent.prototype.getCustomFields = function () {
8223
+ if (this.entityObject && this.entityObject.entity_) {
8224
+ return rxjs.of(this.entityObject);
8225
+ }
8226
+ return this.customFieldsService.getCustomFields(this.domain, this.service, this.entity, this.customFieldsEndpoint);
8227
+ };
8220
8228
  CustomFieldsComponent.prototype.validate = function () {
8221
8229
  var _this = this;
8222
8230
  var errors = {};
@@ -8227,6 +8235,28 @@
8227
8235
  });
8228
8236
  return errors;
8229
8237
  };
8238
+ CustomFieldsComponent.prototype.enableOrDisableFields = function (disabled) {
8239
+ var e_1, _a;
8240
+ if (!this.formGroup) {
8241
+ return;
8242
+ }
8243
+ try {
8244
+ for (var _b = __values(Object.keys(this.formGroup.value)), _c = _b.next(); !_c.done; _c = _b.next()) {
8245
+ var controlName = _c.value;
8246
+ disabled ? this.formGroup.get(controlName).disable() : this.formGroup.get(controlName).enable();
8247
+ }
8248
+ }
8249
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8250
+ finally {
8251
+ try {
8252
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8253
+ }
8254
+ finally { if (e_1) throw e_1.error; }
8255
+ }
8256
+ };
8257
+ CustomFieldsComponent.prototype.cleanFields = function () {
8258
+ this.formGroup.reset();
8259
+ };
8230
8260
  CustomFieldsComponent.prototype.parseValuesForFields = function (values) {
8231
8261
  var parsedValues = __assign({}, values);
8232
8262
  this.fields.forEach(function (field) {
@@ -8614,6 +8644,9 @@
8614
8644
  __decorate([
8615
8645
  core.Input()
8616
8646
  ], CustomFieldsComponent.prototype, "ready$", void 0);
8647
+ __decorate([
8648
+ core.Input()
8649
+ ], CustomFieldsComponent.prototype, "disableFields", void 0);
8617
8650
  CustomFieldsComponent = CustomFieldsComponent_1 = __decorate([
8618
8651
  core.Component({
8619
8652
  selector: "s-custom-fields",
@@ -12506,6 +12539,72 @@
12506
12539
  ProgressBarColors["Yellow"] = "yellow";
12507
12540
  })(exports.ProgressBarColors || (exports.ProgressBarColors = {}));
12508
12541
 
12542
+ var RatingScaleComponent = /** @class */ (function () {
12543
+ function RatingScaleComponent() {
12544
+ this.disabled = false;
12545
+ }
12546
+ RatingScaleComponent_1 = RatingScaleComponent;
12547
+ RatingScaleComponent.prototype.writeValue = function (value) {
12548
+ if (!this.disabled) {
12549
+ this.value = value;
12550
+ }
12551
+ };
12552
+ RatingScaleComponent.prototype.registerOnChange = function (onChange) {
12553
+ this._onChange = onChange;
12554
+ };
12555
+ RatingScaleComponent.prototype.registerOnTouched = function (onTouched) {
12556
+ this._onTouched = onTouched;
12557
+ };
12558
+ RatingScaleComponent.prototype.onSelect = function (rating) {
12559
+ this.value = rating;
12560
+ if (this._onChange) {
12561
+ this._onChange(this.value);
12562
+ }
12563
+ };
12564
+ var RatingScaleComponent_1;
12565
+ __decorate([
12566
+ core.Input()
12567
+ ], RatingScaleComponent.prototype, "nodes", void 0);
12568
+ __decorate([
12569
+ core.Input()
12570
+ ], RatingScaleComponent.prototype, "startLabel", void 0);
12571
+ __decorate([
12572
+ core.Input()
12573
+ ], RatingScaleComponent.prototype, "endLabel", void 0);
12574
+ __decorate([
12575
+ core.Input()
12576
+ ], RatingScaleComponent.prototype, "disabled", void 0);
12577
+ RatingScaleComponent = RatingScaleComponent_1 = __decorate([
12578
+ core.Component({
12579
+ selector: "s-rating-scale",
12580
+ template: "<div\n class=\"rating-scale\"\n [ngClass]=\"{ 'rating-scale--disabled': disabled }\">\n <div class=\"nodes\">\n <button\n *ngFor=\"let node of nodes; index as i\"\n class=\"node\"\n [ngClass]=\"{ 'node--selected': value?.id === node.id && !disabled }\"\n tabindex=\"0\"\n (click)=\"onSelect(node)\"> \n <span\n *ngIf=\"node.icon\"\n class=\"icon fas\"\n [ngClass]=\"node.icon\">\n </span>\n <span\n *ngIf=\"node.title\"\n class=\"label\">\n {{ node.title }}\n </span>\n </button>\n </div>\n <div class=\"labels\">\n <span>{{ startLabel }}</span>\n <span>{{ endLabel }}</span>\n </div>\n</div>",
12581
+ providers: [{
12582
+ provide: forms.NG_VALUE_ACCESSOR,
12583
+ useExisting: core.forwardRef(function () { return RatingScaleComponent_1; }),
12584
+ multi: true,
12585
+ }],
12586
+ styles: [".rating-scale{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.rating-scale .nodes{display:-ms-flexbox;display:flex}.rating-scale .nodes .node{-ms-flex-align:center;align-items:center;background-color:#fff;border-radius:6px;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-pack:center;justify-content:center;margin:0 2px;padding:8px;border:1px solid #7892a1}.rating-scale .nodes .node .icon{color:#6e7280;font-size:1rem}.rating-scale .nodes .node .label{color:#212533;font-size:.875rem;font-weight:400;line-height:150%}.rating-scale .nodes .node .icon,.rating-scale .nodes .node .label{margin:6px}.rating-scale .nodes .node--selected{background-color:#d5e8ec;border-color:#428bca;color:#428bca}.rating-scale .nodes .node:first-child{margin-left:0}.rating-scale .nodes .node:last-child{margin-right:0}.rating-scale .labels{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:12px 0}.rating-scale .labels span{color:#080808;font-family:\"Open Sans\" sans-serif;font-size:.875rem;font-weight:400;line-height:150%}.rating-scale--disabled{opacity:.5}.rating-scale:not(.rating-scale--disabled) .node{cursor:pointer}.rating-scale:not(.rating-scale--disabled) .node:hover{background-color:#dedce5}.rating-scale:not(.rating-scale--disabled) .node:focus{border-width:2px;outline:0}"]
12587
+ })
12588
+ ], RatingScaleComponent);
12589
+ return RatingScaleComponent;
12590
+ }());
12591
+
12592
+ var RatingScaleModule = /** @class */ (function () {
12593
+ function RatingScaleModule() {
12594
+ }
12595
+ RatingScaleModule = __decorate([
12596
+ core.NgModule({
12597
+ imports: [
12598
+ common.CommonModule,
12599
+ forms.ReactiveFormsModule,
12600
+ ],
12601
+ declarations: [RatingScaleComponent],
12602
+ exports: [RatingScaleComponent],
12603
+ })
12604
+ ], RatingScaleModule);
12605
+ return RatingScaleModule;
12606
+ }());
12607
+
12509
12608
 
12510
12609
  (function (SplitButtonType) {
12511
12610
  SplitButtonType["Primary"] = "primary";
@@ -12989,6 +13088,8 @@
12989
13088
  exports.ProgressBarComponent = ProgressBarComponent;
12990
13089
  exports.ProgressBarModule = ProgressBarModule;
12991
13090
  exports.RadioButtonField = RadioButtonField;
13091
+ exports.RatingScaleComponent = RatingScaleComponent;
13092
+ exports.RatingScaleModule = RatingScaleModule;
12992
13093
  exports.RationButtonOption = RationButtonOption;
12993
13094
  exports.RowTogllerDirective = RowTogllerDirective;
12994
13095
  exports.Section = Section;