Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(QTable): add sortOrder & active header #318

Merged
merged 4 commits into from
Jul 4, 2022
Merged

Conversation

cheesytim
Copy link
Member

No description provided.

@cheesytim cheesytim requested a review from ViZhe July 4, 2022 09:04
@netlify
Copy link

netlify bot commented Jul 4, 2022

Deploy Preview for qui-max ready!

Name Link
🔨 Latest commit 33ba5b7
🔍 Latest deploy log https://app.netlify.com/sites/qui-max/deploys/62c2cf6411719e0008338e9f
😎 Deploy Preview https://deploy-preview-318--qui-max.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jul 4, 2022

Deploy Preview for qui-docs canceled.

Name Link
🔨 Latest commit 33ba5b7
🔍 Latest deploy log https://app.netlify.com/sites/qui-docs/deploys/62c2cf645c0e2100092f5c61

const currentDirection = props.sortBy?.direction ?? null;
let newDirection: Nullable<'ascending' | 'descending'> = null;

const sortOrder = props.column.sortOrder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { sortOrder } = props.column;

@@ -14,6 +14,7 @@ export interface Column {
value: Nullable<string | number>;
isHidden?: boolean;
sortable?: boolean;
sortOrder?: Nullable<'ascending' | 'descending'>[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullable<'ascending' | 'descending'> в отдельный тип?

let newDirection: Nullable<'ascending' | 'descending'> = null;

const sortOrder = props.column.sortOrder;
if (sortOrder && Array.isArray(sortOrder)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (Array.isArray(sortOrder)) достаточно

const makeCounter = (): (() => number) => {
return () => {
sortCounter =
sortOrderLength - 1 === sortCounter ? 0 : (sortCounter += 1);
Copy link
Contributor

@VasiliyRusin VasiliyRusin Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortOrderLength - 1 === sortCounter ? 0 : ++sortCounter

@ViZhe ViZhe changed the title feat: add sortOrder & active header feat(QTable): add sortOrder & active header Jul 4, 2022
@cheesytim cheesytim merged commit aeb3289 into main Jul 4, 2022
@cheesytim cheesytim deleted the feat/qtable-sorting branch July 4, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants