@seniorsistemas/angular-components 14.3.12 → 14.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 (27) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +146 -84
  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/table/table-column/models/column-values.interface.d.ts +4 -1
  6. package/components/table/table-column/models/enum-column-field-type.d.ts +2 -1
  7. package/components/table/table-column/table-columns.component.d.ts +10 -0
  8. package/components/token-list/token-list.component.d.ts +2 -1
  9. package/esm2015/components/table/table-column/models/column-values.interface.js +1 -1
  10. package/esm2015/components/table/table-column/models/enum-column-field-type.js +2 -1
  11. package/esm2015/components/table/table-column/table-columns.component.js +63 -8
  12. package/esm2015/components/table/table.module.js +4 -2
  13. package/esm2015/components/token-list/token-list.component.js +7 -3
  14. package/esm2015/seniorsistemas-angular-components.js +31 -30
  15. package/esm5/components/table/table-column/models/column-values.interface.js +1 -1
  16. package/esm5/components/table/table-column/models/enum-column-field-type.js +2 -1
  17. package/esm5/components/table/table-column/table-columns.component.js +62 -7
  18. package/esm5/components/table/table.module.js +4 -2
  19. package/esm5/components/token-list/token-list.component.js +7 -3
  20. package/esm5/seniorsistemas-angular-components.js +31 -30
  21. package/fesm2015/seniorsistemas-angular-components.js +113 -52
  22. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  23. package/fesm5/seniorsistemas-angular-components.js +117 -56
  24. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  25. package/package.json +1 -1
  26. package/seniorsistemas-angular-components.d.ts +30 -29
  27. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -3392,6 +3392,7 @@ var EnumColumnFieldType;
3392
3392
  EnumColumnFieldType["ENUM"] = "ENUM";
3393
3393
  EnumColumnFieldType["LOOKUP"] = "LOOKUP";
3394
3394
  EnumColumnFieldType["LINK"] = "LINK";
3395
+ EnumColumnFieldType["TOKENS"] = "TOKENS";
3395
3396
  })(EnumColumnFieldType || (EnumColumnFieldType = {}));
3396
3397
 
3397
3398
  var EnumBadgeColors;
@@ -3466,7 +3467,7 @@ var TableColumnsComponent = /** @class */ (function () {
3466
3467
  });
3467
3468
  }
3468
3469
  });
3469
- if (attributeValue === null || attributeValue === undefined) {
3470
+ if (attributeValue === null || attributeValue === undefined || (_this.isArray(attributeValue) && !attributeValue.length)) {
3470
3471
  return uninformed;
3471
3472
  }
3472
3473
  else {
@@ -3490,19 +3491,31 @@ var TableColumnsComponent = /** @class */ (function () {
3490
3491
  return attributeValue;
3491
3492
  case EnumColumnFieldType.NUMBER:
3492
3493
  return _this.applyMask(attributeValue, numberConfigs, false);
3494
+ case EnumColumnFieldType.TOKENS:
3495
+ return _this.getTokens(attributeValue);
3493
3496
  }
3494
3497
  }
3495
- }).join(separator);
3496
- var uninformedNumber = columnValue
3498
+ });
3499
+ var unifiedColumnValues = columnValue.join(separator);
3500
+ var uninformedNumber = unifiedColumnValues
3497
3501
  .split(separator)
3498
3502
  .filter(function (value) { return value === uninformed; }).length;
3503
+ var formattedColumnValue;
3499
3504
  if (uninformedNumber === column.attributes.length) {
3500
- columnValue = uninformed;
3505
+ formattedColumnValue = uninformed;
3506
+ }
3507
+ else if (column.type === EnumColumnFieldType.TOKENS) {
3508
+ formattedColumnValue = [].concat.apply([], columnValue.filter(function (values) { return values !== uninformed; }));
3509
+ }
3510
+ else {
3511
+ formattedColumnValue = unifiedColumnValues;
3501
3512
  }
3502
3513
  return {
3503
3514
  style: style,
3504
- columnValue: columnValue,
3515
+ columnValue: formattedColumnValue,
3505
3516
  badgeClass: badgeClass,
3517
+ separator: separator,
3518
+ uninformed: uninformed,
3506
3519
  type: column.type,
3507
3520
  tooltip: this.getColumnTooltip(column.tooltip),
3508
3521
  onLinkClick: column.onLinkClick,
@@ -3548,6 +3561,49 @@ var TableColumnsComponent = /** @class */ (function () {
3548
3561
  var operator = rawValue.includes("-") && !isZero ? "-" : "";
3549
3562
  return "" + operator + currencySymbol + " " + newValue;
3550
3563
  };
3564
+ TableColumnsComponent.prototype.getTokens = function (values) {
3565
+ if (!this.isArray(values))
3566
+ throw new Error("To use tokens an array must be informed");
3567
+ // tslint:disable-next-line: max-line-length
3568
+ if (!this.isValidTokenArray(values))
3569
+ throw new Error("Not a valid token array. Token array must be a primitive values array or an objects with label attribute array");
3570
+ if (this.isLabelObjectArray(values))
3571
+ return values;
3572
+ return values
3573
+ .filter(function (value) { return value !== undefined && value !== null; })
3574
+ .map(function (value) {
3575
+ var label = typeof value === "symbol" ? value.toString() : "" + value;
3576
+ return {
3577
+ label: label
3578
+ };
3579
+ });
3580
+ };
3581
+ TableColumnsComponent.prototype.isValidTokenArray = function (values) {
3582
+ return this.isPrimitiveValuesArray(values) || this.isLabelObjectArray(values);
3583
+ };
3584
+ TableColumnsComponent.prototype.isPrimitiveValuesArray = function (values) {
3585
+ return values.filter(function (value) { return value !== Object(value); }).length === values.length;
3586
+ };
3587
+ TableColumnsComponent.prototype.isLabelObjectArray = function (values) {
3588
+ return values.filter(function (value) { return (value === null || value === void 0 ? void 0 : value.label) !== null && (value === null || value === void 0 ? void 0 : value.label) !== undefined; }).length === values.length;
3589
+ };
3590
+ TableColumnsComponent.prototype.isArray = function (value) {
3591
+ return Array.isArray(value);
3592
+ };
3593
+ TableColumnsComponent.prototype.getSplittedString = function (column) {
3594
+ var columnValue = column.columnValue, separator = column.separator, uninformed = column.uninformed;
3595
+ if (typeof columnValue === "string") {
3596
+ var splittedString_1 = columnValue.split(separator);
3597
+ return splittedString_1.map(function (string, index) {
3598
+ var isLastIndex = splittedString_1.length - 1 === index;
3599
+ return {
3600
+ value: string,
3601
+ isUninformed: string === uninformed,
3602
+ separator: !isLastIndex ? separator : ""
3603
+ };
3604
+ });
3605
+ }
3606
+ };
3551
3607
  TableColumnsComponent.ctorParameters = function () { return [
3552
3608
  { type: ViewContainerRef },
3553
3609
  { type: TranslateService },
@@ -3567,7 +3623,7 @@ var TableColumnsComponent = /** @class */ (function () {
3567
3623
  ], TableColumnsComponent.prototype, "locale", void 0);
3568
3624
  TableColumnsComponent = __decorate([
3569
3625
  Component({
3570
- template: "\n<ng-template #columnsTemplate>\n <td *ngFor=\"let column of formattedColumns\" [ngStyle]=\"column.style\" (click)=\"column.onColumnClick ? column.onColumnClick(rowValue) : null\">\n <span *ngIf=\"column.type !== 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" [ngClass]=\"column.badgeClass\">{{column.columnValue}}</span>\n <a *ngIf=\"column.type === 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" (click)=\"column.onLinkClick ? column.onLinkClick(rowValue) : null\">\n {{column.columnValue}}\n </a>\n </td>\n</ng-template>\n",
3626
+ template: "\n<ng-template #columnsTemplate>\n <td *ngFor=\"let column of formattedColumns\" [ngStyle]=\"column.style\" (click)=\"column.onColumnClick ? column.onColumnClick(rowValue) : null\">\n\n <div *ngIf=\"column.type !== 'TOKENS' || !isArray(column.columnValue); else tokensTemplate\">\n\n <span *ngIf=\"column.type !== 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" [ngClass]=\"column.badgeClass\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </span>\n\n <a *ngIf=\"column.type === 'LINK'\" [pTooltip]=\"column.tooltip\" [escape]=\"false\" (click)=\"column.onLinkClick ? column.onLinkClick(rowValue) : null\">\n <ng-container *ngTemplateOutlet=\"columnValueTemplate\"></ng-container> \n </a>\n\n <ng-template #columnValueTemplate>\n <span *ngFor=\"let value of getSplittedString(column)\">\n <span [ngClass]=\"{ 'sds-pale-text': value.isUninformed }\">{{value.value}}</span>\n <span>{{value.separator}}</span>\n </span>\n </ng-template>\n\n </div>\n\n <ng-template #tokensTemplate>\n <s-token-list\n [tokens]=\"column.columnValue\"\n [hidePointerEvents]=\"true\"\n >\n </s-token-list>\n </ng-template>\n\n </td>\n</ng-template>\n",
3571
3627
  selector: "s-table-columns",
3572
3628
  styles: [":host { display: none; }"]
3573
3629
  }),
@@ -3576,6 +3632,58 @@ var TableColumnsComponent = /** @class */ (function () {
3576
3632
  return TableColumnsComponent;
3577
3633
  }());
3578
3634
 
3635
+ var TokenListComponent = /** @class */ (function () {
3636
+ function TokenListComponent() {
3637
+ this.id = "s-token-list-" + TokenListComponent_1.nextId++;
3638
+ this.removableTokens = false;
3639
+ this.hidePointerEvents = false;
3640
+ this.tokenSelected = new EventEmitter();
3641
+ this.tokenRemoved = new EventEmitter();
3642
+ }
3643
+ TokenListComponent_1 = TokenListComponent;
3644
+ var TokenListComponent_1;
3645
+ TokenListComponent.nextId = 0;
3646
+ __decorate([
3647
+ Input()
3648
+ ], TokenListComponent.prototype, "id", void 0);
3649
+ __decorate([
3650
+ Input()
3651
+ ], TokenListComponent.prototype, "tokens", void 0);
3652
+ __decorate([
3653
+ Input()
3654
+ ], TokenListComponent.prototype, "removableTokens", void 0);
3655
+ __decorate([
3656
+ Input()
3657
+ ], TokenListComponent.prototype, "hidePointerEvents", void 0);
3658
+ __decorate([
3659
+ Output()
3660
+ ], TokenListComponent.prototype, "tokenSelected", void 0);
3661
+ __decorate([
3662
+ Output()
3663
+ ], TokenListComponent.prototype, "tokenRemoved", void 0);
3664
+ TokenListComponent = TokenListComponent_1 = __decorate([
3665
+ Component({
3666
+ selector: "s-token-list",
3667
+ template: "<div [id]=\"id\" class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span [id]=\"token.id\" class=\"sds-token\" [ngClass]=\"{ 'noPointerEvents': hidePointerEvents }\">\n <a [id]=\"(token.id || 'token') + '-label'\" (click)=\"tokenSelected.next(token)\">{{token.label}}</a>\n <span [id]=\"token.id + '-remove'\" class=\"sds-token-icon fa fa-fw fa-close\" *ngIf=\"removableTokens\" (click)=\"tokenRemoved.next(token)\"></span>\n </span>\n </ng-container>\n</div>",
3668
+ styles: ["a,a:focus,a:hover{text-decoration:none;color:#333}.token-list{display:inline-block;vertical-align:middle;padding-left:10px;padding-right:10px}.noPointerEvents{pointer-events:none}"]
3669
+ })
3670
+ ], TokenListComponent);
3671
+ return TokenListComponent;
3672
+ }());
3673
+
3674
+ var TokenListModule = /** @class */ (function () {
3675
+ function TokenListModule() {
3676
+ }
3677
+ TokenListModule = __decorate([
3678
+ NgModule({
3679
+ imports: [CommonModule],
3680
+ declarations: [TokenListComponent],
3681
+ exports: [TokenListComponent],
3682
+ })
3683
+ ], TokenListModule);
3684
+ return TokenListModule;
3685
+ }());
3686
+
3579
3687
  var TableModule = /** @class */ (function () {
3580
3688
  function TableModule() {
3581
3689
  }
@@ -3583,7 +3691,8 @@ var TableModule = /** @class */ (function () {
3583
3691
  NgModule({
3584
3692
  imports: [
3585
3693
  CommonModule,
3586
- TooltipModule
3694
+ TooltipModule,
3695
+ TokenListModule
3587
3696
  ],
3588
3697
  exports: [
3589
3698
  RowTogllerDirective,
@@ -6237,54 +6346,6 @@ var TileModule = /** @class */ (function () {
6237
6346
  return TileModule;
6238
6347
  }());
6239
6348
 
6240
- var TokenListComponent = /** @class */ (function () {
6241
- function TokenListComponent() {
6242
- this.id = "s-token-list-" + TokenListComponent_1.nextId++;
6243
- this.removableTokens = false;
6244
- this.tokenSelected = new EventEmitter();
6245
- this.tokenRemoved = new EventEmitter();
6246
- }
6247
- TokenListComponent_1 = TokenListComponent;
6248
- var TokenListComponent_1;
6249
- TokenListComponent.nextId = 0;
6250
- __decorate([
6251
- Input()
6252
- ], TokenListComponent.prototype, "id", void 0);
6253
- __decorate([
6254
- Input()
6255
- ], TokenListComponent.prototype, "tokens", void 0);
6256
- __decorate([
6257
- Input()
6258
- ], TokenListComponent.prototype, "removableTokens", void 0);
6259
- __decorate([
6260
- Output()
6261
- ], TokenListComponent.prototype, "tokenSelected", void 0);
6262
- __decorate([
6263
- Output()
6264
- ], TokenListComponent.prototype, "tokenRemoved", void 0);
6265
- TokenListComponent = TokenListComponent_1 = __decorate([
6266
- Component({
6267
- selector: "s-token-list",
6268
- template: "<div [id]=\"id\" class=\"token-list\">\n <ng-container *ngFor=\"let token of tokens\">\n <span [id]=\"token.id\" class=\"sds-token\">\n <a [id]=\"token.id + '-label'\" (click)=\"tokenSelected.next(token)\">{{token.label}}</a>\n <span [id]=\"token.id + '-remove'\" class=\"sds-token-icon fa fa-fw fa-close\" *ngIf=\"removableTokens\" (click)=\"tokenRemoved.next(token)\"></span>\n </span>\n </ng-container>\n</div>",
6269
- styles: ["a,a:focus,a:hover{text-decoration:none;color:#333}.token-list{display:inline-block;vertical-align:middle;padding-left:10px;padding-right:10px}"]
6270
- })
6271
- ], TokenListComponent);
6272
- return TokenListComponent;
6273
- }());
6274
-
6275
- var TokenListModule = /** @class */ (function () {
6276
- function TokenListModule() {
6277
- }
6278
- TokenListModule = __decorate([
6279
- NgModule({
6280
- imports: [CommonModule],
6281
- declarations: [TokenListComponent],
6282
- exports: [TokenListComponent],
6283
- })
6284
- ], TokenListModule);
6285
- return TokenListModule;
6286
- }());
6287
-
6288
6349
  var GlobalSearchSizeEnum;
6289
6350
  (function (GlobalSearchSizeEnum) {
6290
6351
  GlobalSearchSizeEnum["STANDARD"] = "STANDARD";
@@ -6607,5 +6668,5 @@ var AngularComponentsModule = /** @class */ (function () {
6607
6668
  * Generated bundle index. Do not edit.
6608
6669
  */
6609
6670
 
6610
- export { AngularComponentsModule, AutocompleteField, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonComponent, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, ChipsField, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CurrencyField, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FormField, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, ProductHeaderComponent, ProductHeaderModule, RadioButtonField, RationButtonOption, RowTogllerDirective, Section, SelectField, SelectOption, SidebarComponent, SidebarModule, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TextAreaField, TextField, ThumbnailComponent, ThumbnailModule, ThumbnailSize, TileComponent, TileModule, TokenListComponent, TokenListModule, ValidateErrors, LocalizedCurrencyImpurePipe as ɵa, TableColumnsComponent as ɵb, InfoSignComponent as ɵba, NumberLocaleOptions as ɵbb, ThumbnailService as ɵbc, InfiniteScrollModule as ɵbd, InfiniteScrollDirective as ɵbe, InfoSignModule as ɵc, AutocompleteFieldComponent as ɵd, BooleanFieldComponent as ɵe, CalendarFieldComponent as ɵf, ChipsFieldComponent as ɵg, CurrencyFieldComponent as ɵh, BaseFieldComponent as ɵi, DynamicFieldComponent as ɵj, DynamicFormDirective as ɵk, FieldsetComponent as ɵl, FileUploadComponent$1 as ɵm, LookupFieldComponent as ɵn, NumberFieldComponent as ɵo, RadioButtonComponent as ɵp, RowComponent as ɵq, SectionComponent as ɵr, SelectFieldComponent as ɵs, TextAreaFieldComponent as ɵt, TextFieldComponent as ɵu, DecimalField as ɵw, StructureModule as ɵx, HeaderComponent as ɵy, FooterComponent as ɵz };
6671
+ export { AngularComponentsModule, AutocompleteField, BooleanField, BooleanOptionsLabel, BreadcrumbComponent, BreadcrumbModule, Breakpoints, ButtonComponent, ButtonModule, ButtonPriority, ButtonSize, CalendarField, CalendarLocaleOptions, CalendarMaskDirective, CalendarMaskModule, ChipsField, CollapseLinkComponent, CollapseLinkModule, ControlErrorsComponent, ControlErrorsModule, CurrencyField, CustomFieldsComponent, CustomFieldsModule, CustomFieldsService, DEFAULT_CALENDAR_LOCALE_OPTIONS, DEFAULT_LOCALE_OPTIONS, DEFAULT_NUMBER_LOCALE_OPTIONS, DynamicConfig, DynamicFormComponent, DynamicFormModule, DynamicType, EditableOverlayDirective, EditableOverlayModule, EmptyStateComponent, EmptyStateModule, EnumBadgeColors, EnumColumnFieldType, ExportUtils, Field, FieldType, Fieldset, FileUploadComponent, FileUploadModule, FormField, GlobalSearchComponent, GlobalSearchDropdownItemComponent, GlobalSearchModule, GlobalSearchSizeEnum, ImageCropperComponent, ImageCropperModule, ImageCropperService, InfoSignDirective, InfoSignModule, LoadingStateComponent, LoadingStateDirective, LoadingStateModule, LocaleModule, LocaleOptions, LocaleService, LocalizedCurrencyPipe, LocalizedCurrencyPipeOptions, LocalizedDateImpurePipe, LocalizedDatePipe, LocalizedNumberInputDirective, LocalizedNumberInputModule, LocalizedNumberPipe, LocalizedTimeImpurePipe, LocalizedTimePipe, LongPressDirective, LookupComponent, LookupField, MaskFormatterModule, MaskFormatterPipe, MouseEventsModule, NavigationDirective, NumberAlignmentOption, NumberField, NumberInputDirective, NumberInputModule, NumberLocaleOptions, ObjectCardComponent, ObjectCardFieldComponent, ObjectCardMainComponent, ObjectCardModule, Option, ProductHeaderComponent, ProductHeaderModule, RadioButtonField, RationButtonOption, RowTogllerDirective, Section, SelectField, SelectOption, SidebarComponent, SidebarModule, StatsCardComponent, StatsCardModule, StepState, StepsComponent, StepsModule, Structure, TableHeaderCheckboxComponent, TableHeaderCheckboxModule, TableModule, TextAreaField, TextField, ThumbnailComponent, ThumbnailModule, ThumbnailSize, TileComponent, TileModule, TokenListComponent, TokenListModule, ValidateErrors, LocalizedCurrencyImpurePipe as ɵa, TokenListModule as ɵb, FooterComponent as ɵba, InfoSignComponent as ɵbb, NumberLocaleOptions as ɵbc, ThumbnailService as ɵbd, InfiniteScrollModule as ɵbe, InfiniteScrollDirective as ɵbf, TableColumnsComponent as ɵc, InfoSignModule as ɵd, AutocompleteFieldComponent as ɵe, BooleanFieldComponent as ɵf, CalendarFieldComponent as ɵg, ChipsFieldComponent as ɵh, CurrencyFieldComponent as ɵi, BaseFieldComponent as ɵj, DynamicFieldComponent as ɵk, DynamicFormDirective as ɵl, FieldsetComponent as ɵm, FileUploadComponent$1 as ɵn, LookupFieldComponent as ɵo, NumberFieldComponent as ɵp, RadioButtonComponent as ɵq, RowComponent as ɵr, SectionComponent as ɵs, SelectFieldComponent as ɵt, TextAreaFieldComponent as ɵu, TextFieldComponent as ɵv, DecimalField as ɵx, StructureModule as ɵy, HeaderComponent as ɵz };
6611
6672
  //# sourceMappingURL=seniorsistemas-angular-components.js.map