r1tsuu

docs reorder

by r1tsuu
payload-enchants
Admin customization
v3
^3.0.0-beta.61
MIT

Overview

Summary generated from the README

Adds drag and drop reordering of documents in the admin for selected collections, similar to array or block items. The order is stored in a docOrder field, so REST, Local API and GraphQL queries can sort by it. Access to the saveChanges endpoint is configurable, and a setup script is provided for collections that already contain documents. Targets Payload 3.0 beta.

Features

  • Drag and drop reordering of documents in enabled collections
  • Stores order in a docOrder field usable as a sort in REST, Local API and GraphQL
  • Per-collection enablement through a collections array
  • Configurable access function for the saveChanges endpoint
  • Setup script to initialize order for existing documents

Use cases

  • Order pages or menu entries manually and fetch them on the front end sorted by docOrder
  • Add manual ordering to a collection that already has documents using the setup script

Installation

npm i @payload-enchants/docs-reorder

335

Stars

28

Forks

28

Open Issues

1 years ago

Last Updated

286

Weekly Downloads

v1.2.2

npm Version

60.5 KB

Unpacked Size

3

Dependencies

Repository stars

335+2 since Sep 7

Show data
Repository stars by day (UTC)
DateStars
Dec 6, 2026335
Dec 5, 2026335
Dec 4, 2026335
Dec 3, 2026335
Dec 2, 2026335
Dec 1, 2026335
Nov 30, 2026335
Nov 29, 2026335
Nov 28, 2026335
Nov 27, 2026335
Nov 26, 2026335
Nov 25, 2026335
Nov 24, 2026335
Nov 23, 2026335
Nov 22, 2026335
Nov 21, 2026335
Nov 20, 2026335
Nov 19, 2026336
Nov 18, 2026336
Nov 17, 2026335
Nov 16, 2026335
Nov 15, 2026335
Nov 14, 2026335
Nov 13, 2026335
Nov 12, 2026335
Nov 11, 2026335
Nov 10, 2026335
Nov 9, 2026335
Nov 8, 2026335
Nov 7, 2026335
Nov 6, 2026335
Nov 5, 2026335
Nov 4, 2026335
Nov 3, 2026335
Nov 2, 2026335
Nov 1, 2026335
Oct 31, 2026335
Oct 30, 2026335
Oct 29, 2026335
Oct 28, 2026335
Oct 27, 2026335
Oct 26, 2026335
Oct 25, 2026335
Oct 24, 2026334
Oct 23, 2026334
Oct 22, 2026334
Oct 21, 2026334
Oct 20, 2026334
Oct 19, 2026334
Oct 18, 2026334
Oct 17, 2026334
Oct 16, 2026334
Oct 15, 2026334
Oct 14, 2026334
Oct 13, 2026334
Oct 12, 2026334
Oct 11, 2026333
Oct 10, 2026333
Oct 9, 2026333
Oct 8, 2026333
Oct 7, 2026333
Oct 6, 2026333
Oct 5, 2026333
Oct 4, 2026333
Oct 3, 2026333
Oct 2, 2026333
Oct 1, 2026333
Sep 30, 2026333
Sep 29, 2026333
Sep 28, 2026333
Sep 27, 2026333
Sep 26, 2026333
Sep 25, 2026333
Sep 24, 2026333
Sep 23, 2026333
Sep 22, 2026333
Sep 21, 2026333
Sep 20, 2026333
Sep 19, 2026333
Sep 18, 2026333
Sep 17, 2026333
Sep 16, 2026333
Sep 15, 2026333
Sep 14, 2026333
Sep 13, 2026333
Sep 12, 2026333
Sep 11, 2026333
Sep 10, 2026333
Sep 9, 2026333
Sep 8, 2026333
Sep 7, 2026333

Shared by 7 plugins in r1tsuu/payload-enchants.

npm weekly downloads

286−2K since Sep 7

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 2026286
Dec 5, 2026266
Dec 4, 2026156
Dec 3, 2026143
Dec 2, 2026114
Dec 1, 202697
Nov 30, 202666
Nov 29, 2026116
Nov 28, 2026123
Nov 27, 2026121
Nov 26, 2026122
Nov 25, 202673
Nov 24, 202673
Nov 23, 202671
Nov 22, 202627
Nov 21, 202631
Nov 20, 202645
Nov 19, 202647
Nov 18, 202645
Nov 17, 202643
Nov 16, 202645
Nov 15, 202637
Nov 14, 202655
Nov 13, 202642
Nov 12, 202641
Nov 11, 202642
Nov 10, 202695
Nov 9, 202695
Nov 8, 2026107
Nov 7, 202682
Nov 6, 202680
Nov 5, 202679
Nov 4, 2026101
Nov 3, 202654
Nov 2, 202658
Nov 1, 202668
Oct 31, 202663
Oct 30, 202668
Oct 29, 202667
Oct 28, 202642
Oct 27, 202636
Oct 26, 202631
Oct 25, 202610
Oct 24, 202611
Oct 23, 20266
Oct 22, 202653
Oct 21, 202668
Oct 20, 202671
Oct 19, 202675
Oct 18, 202677
Oct 17, 202684
Oct 16, 202687
Oct 15, 202640
Oct 14, 202682
Oct 13, 202681
Oct 12, 202678
Oct 11, 202676
Oct 10, 202687
Oct 9, 2026115
Oct 8, 2026117
Oct 7, 202662
Oct 6, 202661
Oct 5, 202670
Oct 4, 202689
Oct 3, 202673
Oct 2, 202650
Oct 1, 202681
Sep 30, 202683
Sep 29, 202682
Sep 28, 202676
Sep 27, 2026193
Sep 26, 2026971
Sep 25, 20261,799
Sep 24, 20262,803
Sep 23, 20263,126
Sep 22, 20263,288
Sep 21, 20263,404
Sep 20, 20268,995
Sep 19, 202610,668
Sep 18, 202610,270
Sep 17, 20269,739
Sep 16, 20269,677
Sep 15, 202610,562
Sep 14, 202610,827
Sep 13, 20265,241
Sep 12, 20263,004
Sep 11, 20263,112
Sep 10, 20262,773
Sep 9, 20262,686
Sep 8, 20261,914
Sep 7, 20262,272

Each point is npm's rolling 7-day download count.

Health Score

50/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/684372049-docs-reorder.svg)](https://payloaddirectory.dev/plugins/684372049-docs-reorder)
HTML
<a href="https://payloaddirectory.dev/plugins/684372049-docs-reorder"><img src="https://payloaddirectory.dev/badge/684372049-docs-reorder.svg" alt="Payload Directory"></a>
Updated Jan 4, 2025Created Aug 29, 2023Published Jul 16, 2024

README

Docs reorder plugin for Payload 3.0 beta

Install

pnpm add @payload-enchants/docs-reorder

About

Adds an option to re-order collection documents with drag n drop (almost like array/blocks items). Then on your front end you can query documents with applied sort by docOrder field.

Video

https://github.com/r1tsuu/payload-plugin-collections-docs-order/assets/64744993/2c13cdd9-f809-4c40-82c6-0b6f78997f74

In your payload.config.ts:

/// ....
import { docsReorder } from '@payload-enchants/docs-reorder';

export default buildConfig({
  // ...
  plugins: [
    docsReorder({
      collections: [{ slug: 'pages' }], // The feature will be enabled only for collections that are in this array.,
      access: ({ req, data }) => {
        // Optional, configure access for `saveChanges` endpoint, default: Boolean(req.user)
        return req.user?.collection === 'admins';
      },
    }),
  ],
});

Querying with applied plugin's sort.

REST:

fetch('http://localhost:3000/api/examples?sort=docOrder').then((res) => res.json());

Local API:

payload.find({ collection: 'examples', sort: 'docOrder' });

GraphQL:

query {
  Examples(sort: "docOrder") {
    docs {
      title
    }
  }

Script to setup for collections that had documents before installing the plugin

  1. Place this file to your src/scripts directory
  2. Change here list to your list of collection slugs with enabled plugin
const collections: (keyof GeneratedTypes['collections'])[] = ['docs-reoder-examples'];
  1. Run pnpm tsx ./src/scripts/docsReorderSetupScript.ts

Similar plugins