mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
feat: allow grouping by none
This commit is contained in:
@@ -34,7 +34,7 @@ export class AutoSync {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
schedule(id, item) {
|
schedule(id, item) {
|
||||||
if (item && (item.remote || item.localOnly)) return;
|
if (item && (item.remote || item.localOnly || item.failed)) return;
|
||||||
|
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
this.timeout = setTimeout(() => {
|
this.timeout = setTimeout(() => {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { qclone } from "qclone";
|
import { qclone } from "qclone";
|
||||||
import sort from "fast-sort";
|
|
||||||
import { deleteItem, findById } from "../utils/array";
|
import { deleteItem, findById } from "../utils/array";
|
||||||
|
|
||||||
export default class Topic {
|
export default class Topic {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
* groupBy: "abc" | "year" | "month" | "week" | undefined,
|
* groupBy: "abc" | "year" | "month" | "week" | "none" | undefined,
|
||||||
* sortBy: "dateCreated" | "dateDeleted" | "dateEdited" | "title",
|
* sortBy: "dateCreated" | "dateDeleted" | "dateEdited" | "title",
|
||||||
* sortDirection: "desc" | "asc"
|
* sortDirection: "desc" | "asc"
|
||||||
* }} GroupOptions
|
* }} GroupOptions
|
||||||
|
|||||||
@@ -47,10 +47,15 @@ export function groupArray(
|
|||||||
sortDirection: "desc",
|
sortDirection: "desc",
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const keySelector = KEY_SELECTORS[options.groupBy || "default"];
|
|
||||||
if (options.sortBy && options.sortDirection)
|
if (options.sortBy && options.sortDirection)
|
||||||
fastsort(array).by(getSortSelectors(options));
|
fastsort(array).by(getSortSelectors(options));
|
||||||
|
|
||||||
|
if (options.groupBy === "none") {
|
||||||
|
array.splice(0, 0, { title: "All", type: "header" });
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
const keySelector = KEY_SELECTORS[options.groupBy || "default"];
|
||||||
let groups = new Map();
|
let groups = new Map();
|
||||||
array.forEach((item) => {
|
array.forEach((item) => {
|
||||||
let groupTitle = item.pinned
|
let groupTitle = item.pinned
|
||||||
|
|||||||
Reference in New Issue
Block a user