@seniorsistemas/angular-components 16.3.9 → 16.4.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 +86 -18
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/progressbar/index.d.ts +3 -0
  6. package/components/progressbar/models/index.d.ts +1 -0
  7. package/components/progressbar/models/progressbar-colors.d.ts +6 -0
  8. package/components/progressbar/progressbar.component.d.ts +11 -0
  9. package/components/progressbar/progressbar.module.d.ts +2 -0
  10. package/components/table/table-paging/table-paging.component.d.ts +4 -3
  11. package/esm2015/components/progressbar/index.js +4 -0
  12. package/esm2015/components/progressbar/models/index.js +2 -0
  13. package/esm2015/components/progressbar/models/progressbar-colors.js +8 -0
  14. package/esm2015/components/progressbar/progressbar.component.js +42 -0
  15. package/esm2015/components/progressbar/progressbar.module.js +15 -0
  16. package/esm2015/components/table/table-paging/table-paging.component.js +25 -17
  17. package/esm2015/public-api.js +2 -1
  18. package/esm5/components/progressbar/index.js +4 -0
  19. package/esm5/components/progressbar/models/index.js +2 -0
  20. package/esm5/components/progressbar/models/progressbar-colors.js +8 -0
  21. package/esm5/components/progressbar/progressbar.component.js +43 -0
  22. package/esm5/components/progressbar/progressbar.module.js +18 -0
  23. package/esm5/components/table/table-paging/table-paging.component.js +24 -19
  24. package/esm5/public-api.js +2 -1
  25. package/fesm2015/seniorsistemas-angular-components.js +84 -19
  26. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  27. package/fesm5/seniorsistemas-angular-components.js +87 -21
  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
@@ -5137,19 +5137,19 @@
5137
5137
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
5138
5138
  return this.mapColumnsTranslations(columns, this.table.selection);
5139
5139
  };
5140
- TablePagingComponent.prototype.getInnerPropValue = function (obj, path) {
5140
+ TablePagingComponent.prototype.getPropertyValue = function (obj, path) {
5141
5141
  return path.split(".").reduce(function (result, prop) { return (result[prop] === undefined ? undefined : result[prop]); }, obj);
5142
5142
  };
5143
- TablePagingComponent.prototype.setInnerPropValue = function (obj, path, value) {
5144
- this.recursionSet(obj, path.split("."), value);
5143
+ TablePagingComponent.prototype.setPropertyValue = function (obj, path, value) {
5144
+ this.recursionSetValue(obj, path.split("."), value);
5145
5145
  };
5146
- TablePagingComponent.prototype.recursionSet = function (obj, keysList, value) {
5146
+ TablePagingComponent.prototype.recursionSetValue = function (obj, keysList, value) {
5147
5147
  var key = keysList[0];
5148
5148
  if (keysList.length === 1) {
5149
5149
  obj[key] = value;
5150
5150
  return obj;
5151
5151
  }
5152
- obj[key] = (this.recursionSet((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value));
5152
+ obj[key] = (this.recursionSetValue((obj === null || obj === void 0 ? void 0 : obj[key]) || {}, keysList.slice(1), value));
5153
5153
  return obj;
5154
5154
  };
5155
5155
  TablePagingComponent.prototype.mapColumnsTranslations = function (columns, rows) {
@@ -5160,37 +5160,42 @@
5160
5160
  }
5161
5161
  return __spread(rows).map(function (row) {
5162
5162
  var newRow = __assign({}, row);
5163
- var _loop_1 = function (i) {
5164
- var column = enumColumns[i];
5165
- var fields = column.field;
5166
- if (!Array.isArray(fields)) {
5167
- fields = [fields];
5168
- }
5163
+ enumColumns.forEach(function (column) {
5164
+ var fields = !Array.isArray(column.field) ? [column.field] : column.field;
5169
5165
  fields.forEach(function (fieldName) {
5170
- var columnData = _this.getInnerPropValue(row, fieldName);
5166
+ var columnData = _this.getPropertyValue(row, fieldName);
5171
5167
  if (columnData === null || columnData === undefined) {
5172
5168
  return;
5173
5169
  }
5174
5170
  var newValue = _this.translateValue(column, columnData);
5175
- _this.setInnerPropValue(newRow, fieldName, newValue);
5171
+ _this.setPropertyValue(newRow, fieldName, newValue);
5176
5172
  });
5177
- };
5178
- for (var i = 0; i <= enumColumns.length - 1; i++) {
5179
- _loop_1(i);
5180
- }
5173
+ });
5181
5174
  return newRow;
5182
5175
  });
5183
5176
  };
5184
5177
  TablePagingComponent.prototype.translateValue = function (column, columnData) {
5178
+ // Default usage: ENUM_VALUE -> domain.service.enum_value
5185
5179
  var enumValue = columnData.toString().toLowerCase();
5186
5180
  var translationKey = column.enumPrefix + enumValue;
5187
5181
  var translatedValue = this.translate.instant(translationKey);
5182
+ // Custom usage 1: V9 -> domain.service.v_9
5188
5183
  if (translationKey === translatedValue && enumValue.length > 1) {
5189
5184
  translationKey = "" + column.enumPrefix + enumValue.substring(0, 1) + "_" + enumValue.substr(1);
5190
- return this.translate.instant(translationKey);
5185
+ translatedValue = this.translate.instant(translationKey);
5186
+ }
5187
+ // Custom usage 2: EnumValue -> domain.service.enum_value
5188
+ if (translationKey === translatedValue) {
5189
+ var enumKey = this.convertToSnakeCase(columnData.toString());
5190
+ translationKey = "" + column.enumPrefix + enumKey;
5191
+ translatedValue = this.translate.instant(translationKey);
5191
5192
  }
5192
5193
  return translatedValue;
5193
5194
  };
5195
+ TablePagingComponent.prototype.convertToSnakeCase = function (str) {
5196
+ return str.replace(/([A-Z])/g, function (match, group) { return "_" + group.toLowerCase(); })
5197
+ .replace(/^_/, '');
5198
+ };
5194
5199
  TablePagingComponent.prototype.getExportFileName = function () {
5195
5200
  var _a;
5196
5201
  var fileName = (_a = this.exportFileName) !== null && _a !== void 0 ? _a : "download";
@@ -10565,6 +10570,67 @@
10565
10570
  return CodeEditorModule;
10566
10571
  }());
10567
10572
 
10573
+ var ProgressBarComponent = /** @class */ (function () {
10574
+ function ProgressBarComponent() {
10575
+ this.showValue = true;
10576
+ }
10577
+ ProgressBarComponent.prototype.ngOnInit = function () {
10578
+ this.validateValues();
10579
+ };
10580
+ ProgressBarComponent.prototype.validateValues = function () {
10581
+ if (this.value < 0 || this.value > 100) {
10582
+ throw new Error("Invalid value for value");
10583
+ }
10584
+ if (this.targetValue < 0 || this.targetValue > 100) {
10585
+ throw new Error("Invalid value for targetValue");
10586
+ }
10587
+ };
10588
+ __decorate([
10589
+ core.Input()
10590
+ ], ProgressBarComponent.prototype, "value", void 0);
10591
+ __decorate([
10592
+ core.Input()
10593
+ ], ProgressBarComponent.prototype, "targetValue", void 0);
10594
+ __decorate([
10595
+ core.Input()
10596
+ ], ProgressBarComponent.prototype, "targetLabel", void 0);
10597
+ __decorate([
10598
+ core.Input()
10599
+ ], ProgressBarComponent.prototype, "activeColor", void 0);
10600
+ __decorate([
10601
+ core.Input()
10602
+ ], ProgressBarComponent.prototype, "showValue", void 0);
10603
+ ProgressBarComponent = __decorate([
10604
+ core.Component({
10605
+ selector: "s-progressbar",
10606
+ template: "<div class=\"progress-bar\">\n <div class=\"progress-bar-all\">\n <div\n class=\"progress-bar-active\"\n [ngClass]=\"{\n 'progress-bar-active--blue' : activeColor == 'blue',\n 'progress-bar-active--green': activeColor == 'green',\n 'progress-bar-active--red': activeColor == 'red',\n 'progress-bar-active--yellow': activeColor == 'yellow'\n }\"\n [ngStyle]=\"{ 'width': value + '%' }\">\n {{ showValue && value ? value + '%' : '' }}\n </div>\n </div>\n <div\n *ngIf=\"targetValue\"\n class=\"target\"\n [ngStyle]=\"{\n 'left': targetValue <= 50 ? targetValue + '%' : 'unset',\n 'right': targetValue > 50 ? 100 - targetValue + '%' : 'unset',\n 'align-items': targetValue > 50 ? 'flex-end' : 'flex-start'\n }\">\n <span class=\"target-line\"></span>\n <span class=\"target-label\">\n {{ targetLabel || value + '%' }}\n </span>\n </div>\n</div>\n",
10607
+ styles: [".progress-bar{position:relative}.progress-bar .progress-bar-all{background-color:#d8d8d8;border-radius:4px;height:24px;overflow:hidden;width:100%}.progress-bar .progress-bar-all .progress-bar-active{-ms-flex-align:center;align-items:center;color:#fff;display:-ms-flexbox;display:flex;font-family:\"Open Sans\",sans-serif;font-size:14px;height:100%;-ms-flex-pack:center;justify-content:center;line-height:150%;width:80%}.progress-bar .progress-bar-all .progress-bar-active--blue{background-color:#428bca}.progress-bar .progress-bar-all .progress-bar-active--green{background-color:#0c9348}.progress-bar .progress-bar-all .progress-bar-active--red{background-color:#c13018}.progress-bar .progress-bar-all .progress-bar-active--yellow{background-color:#fcbf10}.progress-bar .target{-ms-flex-align:start;align-items:flex-start;bottom:-38px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:absolute}.progress-bar .target .target-line{background-color:#333;height:40px;margin:8px 0;width:1px}.progress-bar .target .target-label{background-color:#426e78;border-radius:10px;color:#e5eaea;font-family:\"Open Sans\",sans-serif;font-size:12px;line-height:150%;padding:2px 12px}"]
10608
+ })
10609
+ ], ProgressBarComponent);
10610
+ return ProgressBarComponent;
10611
+ }());
10612
+
10613
+ var ProgressBarModule = /** @class */ (function () {
10614
+ function ProgressBarModule() {
10615
+ }
10616
+ ProgressBarModule = __decorate([
10617
+ core.NgModule({
10618
+ imports: [common.CommonModule],
10619
+ declarations: [ProgressBarComponent],
10620
+ exports: [ProgressBarComponent],
10621
+ })
10622
+ ], ProgressBarModule);
10623
+ return ProgressBarModule;
10624
+ }());
10625
+
10626
+
10627
+ (function (ProgressBarColors) {
10628
+ ProgressBarColors["Blue"] = "blue";
10629
+ ProgressBarColors["Green"] = "green";
10630
+ ProgressBarColors["Red"] = "red";
10631
+ ProgressBarColors["Yellow"] = "yellow";
10632
+ })(exports.ProgressBarColors || (exports.ProgressBarColors = {}));
10633
+
10568
10634
  exports.AngularComponentsModule = AngularComponentsModule;
10569
10635
  exports.AutocompleteField = AutocompleteField;
10570
10636
  exports.BaseFieldComponent = BaseFieldComponent;
@@ -10653,6 +10719,8 @@
10653
10719
  exports.ProductHeaderModule = ProductHeaderModule;
10654
10720
  exports.ProfilePicturePickerComponent = ProfilePicturePickerComponent;
10655
10721
  exports.ProfilePicturePickerModule = ProfilePicturePickerModule;
10722
+ exports.ProgressBarComponent = ProgressBarComponent;
10723
+ exports.ProgressBarModule = ProgressBarModule;
10656
10724
  exports.RadioButtonField = RadioButtonField;
10657
10725
  exports.RationButtonOption = RationButtonOption;
10658
10726
  exports.RowTogllerDirective = RowTogllerDirective;