@yunusemrejs/drag-drop-content-types-strapi5
Version:
A powerful Strapi plugin that enables intuitive drag-and-drop sorting of content types with real-time updates, optimized performance, and a seamless user experience.
51 lines (50 loc) • 2.19 kB
TypeScript
import type { Core } from '@strapi/strapi';
import type * as StrapiTypes from '@strapi/types/dist';
import { PluginSettingsResponse, RankUpdate } from '../../../typings';
/**
* @typedef {object} DragDropService
* @property {() => { body: string }} getWelcomeMessage - Returns a welcome message.
* @property {(contentType: StrapiTypes.UID.CollectionType, start: number, limit: number, locale: string, rankFieldName: string) => Promise<any>} sortIndex - Retrieves sorted index data for a content type.
* @property {(config: PluginSettingsResponse, updates: RankUpdate[], contentType: StrapiTypes.UID.CollectionType) => Promise<any>} batchUpdate - Updates the rank of multiple entries in a content type.
*/
/**
* Drag Drop service.
* @param {object} params - The parameters object.
* @param {Core.Strapi} params.strapi - The Strapi instance.
* @returns {DragDropService}
*/
declare const dragdrop: ({ strapi }: {
strapi: Core.Strapi;
}) => {
/**
* Returns a welcome message.
* @returns {{ body: string }}
*/
getWelcomeMessage(): {
body: string;
};
/**
* Retrieves sorted index data for a content type.
* @async
* @param {StrapiTypes.UID.CollectionType} contentType - The content type UID.
* @param {number} start - The start index.
* @param {number} limit - The limit of results.
* @param {string} locale - The locale.
* @param {string} rankFieldName - The field name to sort by.
* @returns {Promise<any>}
*/
sortIndex(contentType: StrapiTypes.UID.CollectionType, start: number, limit: number, locale: string, rankFieldName: string): Promise<{}>;
/**
* Updates the rank of multiple entries in a content type.
* @async
* @param {PluginSettingsResponse} config - The plugin settings.
* @param {RankUpdate[]} updates - The array of rank updates.
* @param {StrapiTypes.UID.CollectionType} contentType - The content type UID.
* @returns {Promise<any>}
*/
batchUpdate(config: PluginSettingsResponse, updates: RankUpdate[], contentType: StrapiTypes.UID.CollectionType): Promise<{
id: any;
rank: any;
}[]>;
};
export default dragdrop;