diff --git a/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts b/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts index ac03b18de4..689c26ef7b 100644 --- a/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts +++ b/projects/ui/src/lib/components/po-table/interfaces/po-table-column.interface.ts @@ -167,7 +167,7 @@ export interface PoTableColumn { * { property: 'address.street', label: 'Rua' } * ``` */ - property?: string; + property: string; /** * @optional diff --git a/projects/ui/src/lib/components/po-table/po-table-base.component.spec.ts b/projects/ui/src/lib/components/po-table/po-table-base.component.spec.ts index b282bdde5c..cfc3ac7736 100644 --- a/projects/ui/src/lib/components/po-table/po-table-base.component.spec.ts +++ b/projects/ui/src/lib/components/po-table/po-table-base.component.spec.ts @@ -1576,7 +1576,7 @@ describe('PoTableBaseComponent:', () => { it('getFilteredColumns: should filter and map columns correctly', () => { component.columns = [ - { label: 'Currency', visible: true }, + { label: 'Currency', property: 'currency', visible: true }, { label: 'NĂºmeros', property: 'numberData', visible: true }, { label: 'Datas', property: 'dateData', visible: true }, { label: 'Textos', property: 'textData', visible: false } @@ -1584,7 +1584,7 @@ describe('PoTableBaseComponent:', () => { component['getFilteredColumns'](); - expect(component.filteredColumns).toEqual(['Currency', 'numberData', 'dateData']); + expect(component.filteredColumns).toEqual(['currency', 'numberData', 'dateData']); }); }); diff --git a/projects/ui/src/lib/components/po-table/po-table-base.component.ts b/projects/ui/src/lib/components/po-table/po-table-base.component.ts index 3bc08916ca..ee868b3f57 100644 --- a/projects/ui/src/lib/components/po-table/po-table-base.component.ts +++ b/projects/ui/src/lib/components/po-table/po-table-base.component.ts @@ -952,9 +952,7 @@ export abstract class PoTableBaseComponent implements OnChanges, OnDestroy { } private getFilteredColumns(): void { - this.filteredColumns = this.columns - .filter(column => column.visible !== false) - .map(column => column.property || column.label); + this.filteredColumns = this.columns.filter(column => column.visible !== false).map(column => column.property); } private get sortType(): PoTableColumnSortType { diff --git a/projects/ui/src/lib/components/po-table/po-table-column-manager/po-table-column-manager.component.spec.ts b/projects/ui/src/lib/components/po-table/po-table-column-manager/po-table-column-manager.component.spec.ts index f32ae233cc..68c8c3a4dd 100644 --- a/projects/ui/src/lib/components/po-table/po-table-column-manager/po-table-column-manager.component.spec.ts +++ b/projects/ui/src/lib/components/po-table/po-table-column-manager/po-table-column-manager.component.spec.ts @@ -1238,15 +1238,19 @@ describe('PoTableColumnManagerComponent:', () => { describe('stringify', () => { it(`should return stringify value with no difference`, () => { - const columns: Array = [{ icons: [{ value: 'value', tooltip: 'tooltip' }] }]; - const result = '[{"icons":[{"value":"value","tooltip":"tooltip"}]}]'; + const columns: Array = [ + { property: 'columnIcon', icons: [{ value: 'value', tooltip: 'tooltip' }] } + ]; + const result = `[{"property":"columnIcon","icons":[{"value":"value","tooltip":"tooltip"}]}]`; const filter = component['stringify'](columns); expect(filter).toEqual(result); }); it('should return stringify value with difference by filtered key', () => { - const columns: Array = [{ icons: [{ icon: 'icon', value: 'value', tooltip: 'tooltip' }] }]; - const result = '[{"icons":[{"value":"value","tooltip":"tooltip"}]}]'; + const columns: Array = [ + { property: 'columnIcon', icons: [{ icon: 'icon', value: 'value', tooltip: 'tooltip' }] } + ]; + const result = '[{"property":"columnIcon","icons":[{"value":"value","tooltip":"tooltip"}]}]'; const filter = component['stringify'](columns); expect(filter).toEqual(result); }); diff --git a/projects/ui/src/lib/components/po-table/po-table.component.spec.ts b/projects/ui/src/lib/components/po-table/po-table.component.spec.ts index 0985622a51..1576b3b0d7 100644 --- a/projects/ui/src/lib/components/po-table/po-table.component.spec.ts +++ b/projects/ui/src/lib/components/po-table/po-table.component.spec.ts @@ -1303,7 +1303,7 @@ describe('PoTableComponent:', () => { it(`checkingIfColumnHasTooltip: should call getColumnLabel and set tooltipText with columnLabel.tooltip if contains the column parameter and column.type is 'label'`, () => { - const column = { type: 'label', tooltip: 'Label Tooltip Value' }; + const column = { property: 'columnTooltip', type: 'label', tooltip: 'Label Tooltip Value' }; const row = {}; spyOn(component, 'getColumnLabel').and.returnValue({ tooltip: column.tooltip }); @@ -1315,7 +1315,7 @@ describe('PoTableComponent:', () => { }); it(`checkingIfColumnHasTooltip: should apply undefined to tooltipText if 'getColumnLabel' returns undefined`, () => { - const column = { type: 'label', tooltip: 'Label Tooltip Value' }; + const column = { property: 'columnTooltip', type: 'label', tooltip: 'Label Tooltip Value' }; const row = {}; spyOn(component, 'getColumnLabel').and.returnValue(undefined); @@ -2850,7 +2850,7 @@ describe('PoTableComponent:', () => { }); it('getTemplate: should be return null by column property', () => { - const column: PoTableColumn = {}; + const column: PoTableColumn = { property: '' }; column.property = 'status3'; const tableColumnTemplate: PoTableColumnTemplateDirective = { @@ -2873,7 +2873,7 @@ describe('PoTableComponent:', () => { }); it('getTemplate: should be return TemplateRef by column property', () => { - const column: PoTableColumn = {}; + const column: PoTableColumn = { property: '' }; column.property = 'status'; const tableColumnTemplate: PoTableColumnTemplateDirective = {