generated from obsidianmd/obsidian-sample-plugin
-
-
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.
Merge pull request #945 from trey-wallis/dev
* #937 Mulit-Tag sorting feature (#944) * #937 Mulit-Tag sorting feature + Added new Column property - contentsSortDir, it stores information about sorting the content in the cells of the column. At the moment the only type that can store several items in a cell is MultiTag, so the processing logic was added only for it. + Added a options submenu for columns with MultiTag type, where you can select the sorting type for the cell contents. * Renamed `contentsSortDir` to `multiTagSortDir` and `Contents sorting` to `Sort` * feat: add display name for sort direction * fix: don't close menu on sort select * build: fix build errors * chore: bump to 8.16.0 --------- Co-authored-by: Maxim <45532431+42ama@users.noreply.github.com>
- Loading branch information
Showing
21 changed files
with
626 additions
and
16 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
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
40 changes: 40 additions & 0 deletions
40
src/react/loom-app/header-menu/multitag-sort-dir-submenu.tsx
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import MenuItem from "src/react/shared/menu-item"; | ||
import Submenu from "../../shared/submenu"; | ||
import { SortDir } from "src/shared/loom-state/types/loom-state"; | ||
|
||
interface Props { | ||
title: string; | ||
value: SortDir; | ||
onValueClick: (value: SortDir) => void; | ||
onBackClick: () => void; | ||
} | ||
|
||
export default function MultiTagSortDirSubmenu({ | ||
title, | ||
value, | ||
onValueClick, | ||
onBackClick, | ||
}: Props) { | ||
return ( | ||
<Submenu title={title} onBackClick={onBackClick}> | ||
<MenuItem | ||
key={SortDir.ASC} | ||
name="Ascending" | ||
onClick={() => onValueClick(SortDir.ASC)} | ||
isSelected={value === SortDir.ASC} | ||
/> | ||
<MenuItem | ||
key={SortDir.DESC} | ||
name="Descending" | ||
onClick={() => onValueClick(SortDir.DESC)} | ||
isSelected={value === SortDir.DESC} | ||
/> | ||
<MenuItem | ||
key={SortDir.NONE} | ||
name="Default" | ||
onClick={() => onValueClick(SortDir.NONE)} | ||
isSelected={value === SortDir.NONE} | ||
/> | ||
</Submenu> | ||
); | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import MigrateState from "./migrate-state"; | ||
import { LoomState } from "../types"; | ||
import { SortDir, Column } from "../types/loom-state"; | ||
import { LoomState21 } from "../types/loom-state-21"; | ||
|
||
/** | ||
* Migrates to 8.16.0 | ||
*/ | ||
export default class MigrateState22 implements MigrateState { | ||
public migrate(prevState: LoomState21): LoomState { | ||
const { columns } = prevState.model; | ||
|
||
const nextColumns: Column[] = columns.map((column) => { | ||
return { | ||
...column, | ||
multiTagSortDir: SortDir.NONE, | ||
}; | ||
}); | ||
|
||
return { | ||
...prevState, | ||
model: { | ||
...prevState.model, | ||
columns: nextColumns, | ||
}, | ||
}; | ||
} | ||
} |
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.