@retikolo/drag-drop-content-types-strapi 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +77 -0
  2. package/dist/_chunks/Settings-BUJ6OWyE.js +3632 -0
  3. package/dist/_chunks/Settings-Cx22s5Bk.mjs +3615 -0
  4. package/dist/_chunks/en-I3-CH3Sy.js +31 -0
  5. package/dist/_chunks/en-bxpER_P-.mjs +31 -0
  6. package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
  7. package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
  8. package/dist/_chunks/index-CxWC49Ye.mjs +477 -0
  9. package/dist/_chunks/index-D5Ne-GrP.js +478 -0
  10. package/dist/admin/index.js +3 -0
  11. package/dist/admin/index.mjs +4 -0
  12. package/dist/admin/src/components/Initializer.d.ts +5 -0
  13. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  14. package/dist/admin/src/components/SettingsTextField.d.ts +14 -0
  15. package/dist/admin/src/components/SettingsToggleField.d.ts +13 -0
  16. package/dist/admin/src/components/SortModal/CustomItem.d.ts +12 -0
  17. package/dist/admin/src/components/SortModal/SortMenu.d.ts +3 -0
  18. package/dist/admin/src/components/SortModal/SortableList.d.ts +3 -0
  19. package/dist/admin/src/components/SortModal/SortableListItem.d.ts +7 -0
  20. package/dist/admin/src/components/SortModal/index.d.ts +2 -0
  21. package/dist/admin/src/components/SortModal/utils.d.ts +2 -0
  22. package/dist/admin/src/components/TooltipIconButton.d.ts +11 -0
  23. package/dist/admin/src/index.d.ts +13 -0
  24. package/dist/admin/src/pages/App.d.ts +2 -0
  25. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  26. package/dist/admin/src/pages/Settings.d.ts +2 -0
  27. package/dist/admin/src/permissions.d.ts +7 -0
  28. package/dist/admin/src/pluginId.d.ts +1 -0
  29. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  30. package/dist/admin/src/utils/strapi.d.ts +13 -0
  31. package/dist/admin/src/utils/useQueryParams.d.ts +7 -0
  32. package/dist/server/index.js +266 -0
  33. package/dist/server/index.mjs +267 -0
  34. package/dist/server/src/bootstrap.d.ts +5 -0
  35. package/dist/server/src/config/index.d.ts +5 -0
  36. package/dist/server/src/content-types/index.d.ts +2 -0
  37. package/dist/server/src/controllers/dragdrop.d.ts +9 -0
  38. package/dist/server/src/controllers/index.d.ts +16 -0
  39. package/dist/server/src/controllers/settings.d.ts +8 -0
  40. package/dist/server/src/destroy.d.ts +5 -0
  41. package/dist/server/src/index.d.ts +79 -0
  42. package/dist/server/src/middlewares/index.d.ts +2 -0
  43. package/dist/server/src/policies/index.d.ts +2 -0
  44. package/dist/server/src/register.d.ts +5 -0
  45. package/dist/server/src/routes/dragdrop.d.ts +13 -0
  46. package/dist/server/src/routes/index.d.ts +26 -0
  47. package/dist/server/src/routes/settings.d.ts +12 -0
  48. package/dist/server/src/services/dragdrop.d.ts +21 -0
  49. package/dist/server/src/services/index.d.ts +21 -0
  50. package/dist/server/src/services/settings.d.ts +8 -0
  51. package/package.json +98 -0
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ <div align="center">
2
+ <img src="https://user-images.githubusercontent.com/37687705/192227260-db082018-947a-4166-a3f4-983e1024dd59.png" width="20%">
3
+ <h1>Strapi plugin drag-drop-content-types</h1>
4
+ </div>
5
+
6
+ ![dragdropcrop](https://user-images.githubusercontent.com/37687705/212884821-356ec68c-b71a-4b89-9e99-8a625f84cfbe.gif)
7
+
8
+ Inspired by the [Drag-Drop-Content-Type Strapi 4 plugin](https://github.com/plantagoIT/strapi-drag-drop-content-type-plugin).
9
+ Drag-drop feature completely rewritten to use dndkit because react-sortable-hoc is deprecated and not compatible with React 18.
10
+
11
+ ## 🔄 Strapi 5 Compatibility
12
+
13
+ This version (2.0.0) has been updated for **Strapi 5** compatibility with the following changes:
14
+
15
+ ### Key Updates
16
+ - **Removed Redux dependency**: Strapi 5 changed its internal architecture, so the Redux-based list view refresh has been replaced with a page reload mechanism that triggers when closing the sort modal after making changes
17
+ - **Updated @dnd-kit**: Migrated from react-sortable-hoc to @dnd-kit for drag-and-drop functionality (React 18 compatible)
18
+ - **Strapi 5 Admin API**: Updated to use new Strapi 5 admin hooks (`useFetchClient`, `useNotification`, `useAPIErrorHandler`)
19
+ - **Improved UX**: You can now drag and reorder multiple items in one session - the page only refreshes once when you close the modal, preserving your changes
20
+
21
+ ### Known Considerations
22
+ - After sorting items, the content manager list view refreshes when you close the sort modal to display the updated order
23
+ - Uses Strapi 5's new Popover component with controlled state for better stability
24
+
25
+ ### Strapi 4 Compatibility
26
+ If you are still using Strapi 4, you can use version 1.7.1 of this plugin, which is available on the `strapi4` branch.
27
+
28
+ ## ⏳ Installation
29
+
30
+ Install with NPM.
31
+ ```bash
32
+ npm i @retikolo/drag-drop-content-types-strapi
33
+ ```
34
+ Install with Yarn.
35
+ ```bash
36
+ yarn add @retikolo/drag-drop-content-types-strapi
37
+ ```
38
+
39
+ ## 🔧 Configuration
40
+
41
+ ### In your config
42
+ 1. Add the following to your `config/plugins.ts` file. Create the file, if it doesn't exist.
43
+ ```js
44
+ export default () => ({
45
+ // ...
46
+ 'drag-drop-content-types': {
47
+ enabled: true
48
+ }
49
+ })
50
+ ```
51
+ 2. Run `npm run build` and restart the app using `npm run develop`.
52
+
53
+ ### In the app
54
+ 1. Go to `Settings` → `Drag Drop Content Type` → `Configuration`.
55
+ 2. Specify the `Rank Field Name` used for sorting or leave the default field name `rank`.
56
+ 3. Add a `Number` field with `Name: myRankFieldName` and `Number format: integer` to the sortable _ContentType_.
57
+ 4. Configure the view of your _ContentType_ by adding `Default sort attribute → rank` and `Default sort order → ASC` to update the view after dragging.
58
+ 5. If needed: grant permissions for the `rank` field to your roles.
59
+
60
+ #### Hints
61
+ * You can set a `title` value that will be displayed in the menu instead of the default field.
62
+ * A second field can be displayed in the menu via the `subtitle` setting. It can be either a string-like field or an object such as a relation, that has a `title` field as configured in the settings.
63
+ * You can enable webhooks to trigger something after updating the order.
64
+
65
+ ### In your frontend
66
+ You can make a request in the frontend to get the ordered items. In this example the _ContentType_ is called `Foo` and ordered via the `rank` field.
67
+
68
+ ```
69
+ http://localhost:1337/api/foo?sort=rank:asc
70
+ ```
71
+
72
+ ## 🤝 Contribute
73
+ Feel free to fork and make pull requests to this plugin. All input is welcome - thanks for all contributions so far!
74
+
75
+
76
+ ## ⭐️ Support
77
+ I you like this project, please give it a star ⭐️. Maybe this will help it getting integrated to strapi's core some day 😊.