@strapi/plugin-users-permissions 4.9.1 → 4.9.2

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.
@@ -28,11 +28,12 @@ import {
28
28
  useQueryParams,
29
29
  EmptyStateLayout,
30
30
  ConfirmDialog,
31
+ useFilter,
32
+ useCollator,
31
33
  } from '@strapi/helper-plugin';
32
34
  import { useIntl } from 'react-intl';
33
35
  import { useHistory } from 'react-router-dom';
34
36
  import { useMutation, useQuery, useQueryClient } from 'react-query';
35
- import matchSorter from 'match-sorter';
36
37
 
37
38
  import { fetchData, deleteData } from './utils/api';
38
39
  import { getTrad } from '../../../utils';
@@ -42,7 +43,7 @@ import TableBody from './components/TableBody';
42
43
 
43
44
  const RoleListPage = () => {
44
45
  const { trackUsage } = useTracking();
45
- const { formatMessage } = useIntl();
46
+ const { formatMessage, locale } = useIntl();
46
47
  const { push } = useHistory();
47
48
  const toggleNotification = useNotification();
48
49
  const { notifyStatus } = useNotifyAT();
@@ -78,6 +79,17 @@ const RoleListPage = () => {
78
79
  enabled: canRead,
79
80
  });
80
81
 
82
+ const { includes } = useFilter(locale, {
83
+ sensitivity: 'base',
84
+ });
85
+
86
+ /**
87
+ * @type {Intl.Collator}
88
+ */
89
+ const formatter = useCollator(locale, {
90
+ sensitivity: 'base',
91
+ });
92
+
81
93
  const isLoading = isLoadingForData || isFetching;
82
94
 
83
95
  const handleNewRoleClick = () => {
@@ -118,7 +130,12 @@ const RoleListPage = () => {
118
130
  setIsConfirmButtonLoading(false);
119
131
  };
120
132
 
121
- const sortedRoles = matchSorter(roles || [], _q, { keys: ['name', 'description'] });
133
+ const sortedRoles = (roles || [])
134
+ .filter((role) => includes(role.name, _q) || includes(role.description, _q))
135
+ .sort(
136
+ (a, b) => formatter.compare(a.name, b.name) || formatter.compare(a.description, b.description)
137
+ );
138
+
122
139
  const emptyContent = _q && !sortedRoles.length ? 'search' : 'roles';
123
140
 
124
141
  const colCount = 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.9.1",
3
+ "version": "4.9.2",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@strapi/design-system": "1.6.6",
33
- "@strapi/helper-plugin": "4.9.1",
33
+ "@strapi/helper-plugin": "4.9.2",
34
34
  "@strapi/icons": "1.6.6",
35
- "@strapi/utils": "4.9.1",
35
+ "@strapi/utils": "4.9.2",
36
36
  "bcryptjs": "2.4.3",
37
37
  "formik": "2.2.9",
38
38
  "grant-koa": "5.4.8",
@@ -42,7 +42,6 @@
42
42
  "koa": "^2.13.4",
43
43
  "koa2-ratelimit": "^1.1.2",
44
44
  "lodash": "4.17.21",
45
- "match-sorter": "^4.0.2",
46
45
  "prop-types": "^15.7.2",
47
46
  "purest": "4.0.2",
48
47
  "react-intl": "6.3.2",
@@ -67,8 +66,8 @@
67
66
  "peerDependencies": {
68
67
  "react": "^17.0.2",
69
68
  "react-dom": "^17.0.2",
70
- "react-router-dom": "5.3.4",
71
- "styled-components": "5.3.3"
69
+ "react-router-dom": "^5.3.4",
70
+ "styled-components": "^5.3.3"
72
71
  },
73
72
  "engines": {
74
73
  "node": ">=14.19.1 <=18.x.x",
@@ -81,5 +80,5 @@
81
80
  "required": true,
82
81
  "kind": "plugin"
83
82
  },
84
- "gitHead": "c8f2f0543b45dda8eadde21a0782b64d156fc786"
83
+ "gitHead": "91e0be2708e4d1e8ec731c75e73e54c0dfacb67d"
85
84
  }