-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Column config reordering, sorting ability (#1280)
- adds metadata to columns indicating whether or not they support sorting, (e.g. false for fili dimensions) - update table with column metadata for sorting
- Loading branch information
1 parent
4acceb3
commit 1735bd3
Showing
55 changed files
with
1,218 additions
and
1,167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
/** | ||
* Copyright 2020, Yahoo Holdings Inc. | ||
* Copyright 2021, Yahoo Holdings Inc. | ||
* Licensed under the terms of the MIT license. See accompanying LICENSE.md file for terms. | ||
*/ | ||
import attr from 'ember-data/attr'; | ||
import BaseFragment from './base'; | ||
import { Column } from 'navi-data/adapters/facts/interface'; | ||
import { Column, SortDirection } from 'navi-data/adapters/facts/interface'; | ||
import { nanoid } from 'nanoid'; | ||
import { inject as service } from '@ember/service'; | ||
import { computed } from '@ember/object'; | ||
import NaviFormatterService from 'navi-data/services/navi-formatter'; | ||
import { ColumnType } from 'navi-data/models/metadata/column'; | ||
//@ts-ignore | ||
import { fragmentOwner } from 'ember-data-model-fragments/attributes'; | ||
import type NaviFormatterService from 'navi-data/services/navi-formatter'; | ||
import type { ColumnType } from 'navi-data/models/metadata/column'; | ||
import type RequestFragment from 'navi-core/models/bard-request-v2/request'; | ||
|
||
/** | ||
* @augments {BaseFragment} | ||
|
@@ -23,9 +26,19 @@ export default class ColumnFragment<T extends ColumnType = ColumnType> extends B | |
|
||
@service naviFormatter!: NaviFormatterService; | ||
|
||
@fragmentOwner() request?: RequestFragment; | ||
|
||
@computed('alias', 'parameters', 'columnMetadata') | ||
get displayName(): string { | ||
const { alias, parameters, columnMetadata } = this; | ||
return this.naviFormatter.formatColumnName(columnMetadata, parameters, alias); | ||
} | ||
|
||
@computed('[email protected]') | ||
get sortedDirection(): SortDirection | null { | ||
const sorts = this.request?.sorts || []; | ||
|
||
const sort = sorts.find(({ canonicalName }) => canonicalName === this.canonicalName); | ||
return sort?.direction || null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 34 additions & 38 deletions
72
packages/core/addon/templates/components/table-renderer-vertical-collection.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.