@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
@@ -3155,6 +3155,7 @@ var EnumColumnFieldType;
3155
3155
  EnumColumnFieldType["ENUM"] = "ENUM";
3156
3156
  EnumColumnFieldType["LOOKUP"] = "LOOKUP";
3157
3157
  EnumColumnFieldType["LINK"] = "LINK";
3158
+ EnumColumnFieldType["TOKENS"] = "TOKENS";
3158
3159
  })(EnumColumnFieldType || (EnumColumnFieldType = {}));
3159
3160
 
3160
3161
  var EnumBadgeColors;
@@ -3206,7 +3207,7 @@ let TableColumnsComponent = class TableColumnsComponent {
3206
3207
  let badgeClass = {
3207
3208
  "sds-badge": false
3208
3209
  };
3209
- let columnValue = column.attributes
3210
+ const columnValue = column.attributes
3210
3211
  .map((attribute) => {
3211
3212
  let attributeValue;
3212
3213
  attribute
@@ -3227,7 +3228,7 @@ let TableColumnsComponent = class TableColumnsComponent {
3227
3228
  });
3228
3229
  }
3229
3230
  });
3230
- if (attributeValue === null || attributeValue === undefined) {
3231
+ if (attributeValue === null || attributeValue === undefined || (this.isArray(attributeValue) && !attributeValue.length)) {
3231
3232
  return uninformed;
3232
3233
  }
3233
3234
  else {
@@ -3251,19 +3252,31 @@ let TableColumnsComponent = class TableColumnsComponent {
3251
3252
  return attributeValue;
3252
3253
  case EnumColumnFieldType.NUMBER:
3253
3254
  return this.applyMask(attributeValue, numberConfigs, false);
3255
+ case EnumColumnFieldType.TOKENS:
3256
+ return this.getTokens(attributeValue);
3254
3257
  }
3255
3258
  }
3256
- }).join(separator);
3257
- const uninformedNumber = columnValue
3259
+ });
3260
+ const unifiedColumnValues = columnValue.join(separator);
3261
+ const uninformedNumber = unifiedColumnValues
3258
3262
  .split(separator)
3259
3263
  .filter(value => value === uninformed).length;
3264
+ let formattedColumnValue;
3260
3265
  if (uninformedNumber === column.attributes.length) {
3261
- columnValue = uninformed;
3266
+ formattedColumnValue = uninformed;
3267
+ }
3268
+ else if (column.type === EnumColumnFieldType.TOKENS) {
3269
+ formattedColumnValue = [].concat.apply([], columnValue.filter(values => values !== uninformed));
3270
+ }
3271
+ else {
3272
+ formattedColumnValue = unifiedColumnValues;
3262
3273
  }
3263
3274
  return {
3264
3275
  style,
3265
- columnValue,
3276
+ columnValue: formattedColumnValue,
3266
3277
  badgeClass,
3278
+ separator,
3279
+ uninformed,
3267
3280
  type: column.type,
3268
3281
  tooltip: this.getColumnTooltip(column.tooltip),
3269
3282
  onLinkClick: column.onLinkClick,
@@ -3308,6 +3321,49 @@ let TableColumnsComponent = class TableColumnsComponent {
3308
3321
  const operator = rawValue.includes("-") && !isZero ? "-" : "";
3309
3322
  return `${operator}${currencySymbol} ${newValue}`;
3310
3323
  }
3324
+ getTokens(values) {
3325
+ if (!this.isArray(values))
3326
+ throw new Error("To use tokens an array must be informed");
3327
+ // tslint:disable-next-line: max-line-length
3328
+ if (!this.isValidTokenArray(values))
3329
+ throw new Error("Not a valid token array. Token array must be a primitive values array or an objects with label attribute array");
3330
+ if (this.isLabelObjectArray(values))
3331
+ return values;
3332
+ return values
3333
+ .filter((value) => value !== undefined && value !== null)
3334
+ .map((value) => {
3335
+ const label = typeof value === "symbol" ? value.toString() : `${value}`;
3336
+ return {
3337
+ label
3338
+ };
3339
+ });
3340
+ }
3341
+ isValidTokenArray(values) {
3342
+ return this.isPrimitiveValuesArray(values) || this.isLabelObjectArray(values);
3343
+ }
3344
+ isPrimitiveValuesArray(values) {
3345
+ return values.filter(value => value !== Object(value)).length === values.length;
3346
+ }
3347
+ isLabelObjectArray(values) {
3348
+ return values.filter(value => (value === null || value === void 0 ? void 0 : value.label) !== null && (value === null || value === void 0 ? void 0 : value.label) !== undefined).length === values.length;
3349
+ }
3350
+ isArray(value) {
3351
+ return Array.isArray(value);
3352
+ }
3353
+ getSplittedString(column) {
3354
+ const { columnValue, separator, uninformed } = column;
3355
+ if (typeof columnValue === "string") {
3356
+ const splittedString = columnValue.split(separator);
3357
+ return splittedString.map((string, index) => {
3358
+ const isLastIndex = splittedString.length - 1 === index;
3359
+ return {
3360
+ value: string,
3361
+ isUninformed: string === uninformed,
3362
+ separator: !isLastIndex ? separator : ""
3363
+ };
3364
+ });
3365
+ }
3366
+ }
3311
3367
  };
3312
3368
  TableColumnsComponent.ctorParameters = () => [
3313
3369
  { type: ViewContainerRef },
@@ -3328,20 +3384,68 @@ __decorate([
3328
3384
  ], TableColumnsComponent.prototype, "locale", void 0);
3329
3385
  TableColumnsComponent = __decorate([
3330
3386
  Component({
3331
- 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",
3387
+ 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",
3332
3388
  selector: "s-table-columns",
3333
3389
  styles: [":host { display: none; }"]
3334
3390
  }),
3335
3391
  __param(2, Inject("hostProjectConfigs"))
3336
3392
  ], TableColumnsComponent);
3337
3393
 
3394
+ var TokenListComponent_1;
3395
+ let TokenListComponent = TokenListComponent_1 = class TokenListComponent {
3396
+ constructor() {
3397
+ this.id = `s-token-list-${TokenListComponent_1.nextId++}`;
3398
+ this.removableTokens = false;
3399
+ this.hidePointerEvents = false;
3400
+ this.tokenSelected = new EventEmitter();
3401
+ this.tokenRemoved = new EventEmitter();
3402
+ }
3403
+ };
3404
+ TokenListComponent.nextId = 0;
3405
+ __decorate([
3406
+ Input()
3407
+ ], TokenListComponent.prototype, "id", void 0);
3408
+ __decorate([
3409
+ Input()
3410
+ ], TokenListComponent.prototype, "tokens", void 0);
3411
+ __decorate([
3412
+ Input()
3413
+ ], TokenListComponent.prototype, "removableTokens", void 0);
3414
+ __decorate([
3415
+ Input()
3416
+ ], TokenListComponent.prototype, "hidePointerEvents", void 0);
3417
+ __decorate([
3418
+ Output()
3419
+ ], TokenListComponent.prototype, "tokenSelected", void 0);
3420
+ __decorate([
3421
+ Output()
3422
+ ], TokenListComponent.prototype, "tokenRemoved", void 0);
3423
+ TokenListComponent = TokenListComponent_1 = __decorate([
3424
+ Component({
3425
+ selector: `s-token-list`,
3426
+ 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>",
3427
+ 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}"]
3428
+ })
3429
+ ], TokenListComponent);
3430
+
3431
+ let TokenListModule = class TokenListModule {
3432
+ };
3433
+ TokenListModule = __decorate([
3434
+ NgModule({
3435
+ imports: [CommonModule],
3436
+ declarations: [TokenListComponent],
3437
+ exports: [TokenListComponent],
3438
+ })
3439
+ ], TokenListModule);
3440
+
3338
3441
  let TableModule = class TableModule {
3339
3442
  };
3340
3443
  TableModule = __decorate([
3341
3444
  NgModule({
3342
3445
  imports: [
3343
3446
  CommonModule,
3344
- TooltipModule
3447
+ TooltipModule,
3448
+ TokenListModule
3345
3449
  ],
3346
3450
  exports: [
3347
3451
  RowTogllerDirective,
@@ -5822,49 +5926,6 @@ TileModule = __decorate([
5822
5926
  })
5823
5927
  ], TileModule);
5824
5928
 
5825
- var TokenListComponent_1;
5826
- let TokenListComponent = TokenListComponent_1 = class TokenListComponent {
5827
- constructor() {
5828
- this.id = `s-token-list-${TokenListComponent_1.nextId++}`;
5829
- this.removableTokens = false;
5830
- this.tokenSelected = new EventEmitter();
5831
- this.tokenRemoved = new EventEmitter();
5832
- }
5833
- };
5834
- TokenListComponent.nextId = 0;
5835
- __decorate([
5836
- Input()
5837
- ], TokenListComponent.prototype, "id", void 0);
5838
- __decorate([
5839
- Input()
5840
- ], TokenListComponent.prototype, "tokens", void 0);
5841
- __decorate([
5842
- Input()
5843
- ], TokenListComponent.prototype, "removableTokens", void 0);
5844
- __decorate([
5845
- Output()
5846
- ], TokenListComponent.prototype, "tokenSelected", void 0);
5847
- __decorate([
5848
- Output()
5849
- ], TokenListComponent.prototype, "tokenRemoved", void 0);
5850
- TokenListComponent = TokenListComponent_1 = __decorate([
5851
- Component({
5852
- selector: `s-token-list`,
5853
- 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>",
5854
- 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}"]
5855
- })
5856
- ], TokenListComponent);
5857
-
5858
- let TokenListModule = class TokenListModule {
5859
- };
5860
- TokenListModule = __decorate([
5861
- NgModule({
5862
- imports: [CommonModule],
5863
- declarations: [TokenListComponent],
5864
- exports: [TokenListComponent],
5865
- })
5866
- ], TokenListModule);
5867
-
5868
5929
  var GlobalSearchSizeEnum;
5869
5930
  (function (GlobalSearchSizeEnum) {
5870
5931
  GlobalSearchSizeEnum["STANDARD"] = "STANDARD";
@@ -6172,5 +6233,5 @@ AngularComponentsModule = AngularComponentsModule_1 = __decorate([
6172
6233
  * Generated bundle index. Do not edit.
6173
6234
  */
6174
6235
 
6175
- 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 };
6236
+ 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 };
6176
6237
  //# sourceMappingURL=seniorsistemas-angular-components.js.map