@bigbinary/neeto-team-members-frontend 4.5.18 → 4.5.19

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.
@@ -117,6 +117,7 @@
117
117
  "manageRole_one": "Manage role",
118
118
  "manageRole_other": "Manage roles",
119
119
  "neeto_": "Neeto{{product, anyCase}}",
120
+ "permissionsNotFound": "There are no permissions to show",
120
121
  "preferredDateFormat": "Preferred date format",
121
122
  "preferredTimeFormat": "Preferred time format",
122
123
  "removeMember": "Remove {{member}}?",
package/dist/Roles.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
- import require$$0, { useRef, memo, useCallback, useEffect, useState, createElement, Fragment as Fragment$1, useMemo } from 'react';
2
+ import require$$0, { useRef, Fragment as Fragment$1, memo, useCallback, useEffect, useState, useMemo, createElement } from 'react';
3
3
  import { c as commonjsGlobal } from './_commonjsHelpers-BFTU3MAI.js';
4
4
  import i18next, { t } from 'i18next';
5
5
  import { isNotEmpty, isPresent, _findBy, hyphenate, noop } from '@bigbinary/neeto-cist';
@@ -1893,6 +1893,43 @@ var getScrollBarWidth = function getScrollBarWidth() {
1893
1893
  return w1 - w2;
1894
1894
  };
1895
1895
 
1896
+ var _renderDescription = function renderDescription(permissions, filteredPermissions) {
1897
+ return permissions === null || permissions === void 0 ? void 0 : permissions.map(function (_ref) {
1898
+ var id = _ref.id,
1899
+ description = _ref.description,
1900
+ children = _ref.children;
1901
+ return /*#__PURE__*/jsxs(Fragment$1, {
1902
+ children: [filteredPermissions.includes(id) && /*#__PURE__*/jsx("div", {
1903
+ className: "ntm-roles-table-sidebar__list-item",
1904
+ "data-name": description,
1905
+ children: /*#__PURE__*/jsx(Typography, {
1906
+ "data-cy": "ntm-permission-category-description",
1907
+ lineHeight: "normal",
1908
+ style: "body2",
1909
+ children: description
1910
+ })
1911
+ }, id), /*#__PURE__*/jsx("div", {
1912
+ className: "neeto-ui-relative neeto-ui-pl-6 ntm-roles-table-sidebar__sub-blocks",
1913
+ children: _renderDescription(children, filteredPermissions)
1914
+ })]
1915
+ }, id);
1916
+ });
1917
+ };
1918
+ var getSearchWrapperStyle = function getSearchWrapperStyle() {
1919
+ var scrollBarWidth = getScrollBarWidth();
1920
+ document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", "".concat(scrollBarWidth, "px"));
1921
+ return {
1922
+ marginBottom: "".concat(scrollBarWidth, "px")
1923
+ };
1924
+ };
1925
+ var getFilteredCategories = function getFilteredCategories(filteredGroupPermissions) {
1926
+ return Array.from((filteredGroupPermissions === null || filteredGroupPermissions === void 0 ? void 0 : filteredGroupPermissions.keys()) || []).filter(function (category) {
1927
+ var groupedPermissions = filteredGroupPermissions.get(category);
1928
+ var permissions = groupedPermissions.get("permissions") || [];
1929
+ return permissions.length > 0;
1930
+ });
1931
+ };
1932
+
1896
1933
  var TableHeader = function TableHeader(_ref) {
1897
1934
  var config = _ref.config,
1898
1935
  roles = _ref.roles,
@@ -2013,7 +2050,9 @@ var Columns = function Columns(_ref) {
2013
2050
  _useState2 = _slicedToArray(_useState, 2),
2014
2051
  manageRole = _useState2[0],
2015
2052
  setManageRole = _useState2[1];
2016
- var categories = Array.from(filteredGroupPermissions === null || filteredGroupPermissions === void 0 ? void 0 : filteredGroupPermissions.keys());
2053
+ var categories = useMemo(function () {
2054
+ return getFilteredCategories(filteredGroupPermissions);
2055
+ }, [filteredGroupPermissions]);
2017
2056
  var onClose = function onClose() {
2018
2057
  return setManageRole(DEFAULT_MANAGE_ROLE_VALUES);
2019
2058
  };
@@ -2028,7 +2067,19 @@ var Columns = function Columns(_ref) {
2028
2067
  group: ["horizontal", "vertical"],
2029
2068
  children: /*#__PURE__*/jsx("div", {
2030
2069
  className: "ntm-roles-table__rows",
2031
- children: categories.map(function (category, index) {
2070
+ children: categories.length === 0 ? /*#__PURE__*/jsx("div", {
2071
+ className: "ntm-roles-table__empty-row",
2072
+ children: /*#__PURE__*/jsx("div", {
2073
+ className: "ntm-roles-table__row",
2074
+ children: /*#__PURE__*/jsx("div", {
2075
+ className: "ntm-roles-table__cell",
2076
+ children: /*#__PURE__*/jsx("div", {
2077
+ className: "ntm-roles-table__cell-content",
2078
+ children: "\xA0"
2079
+ })
2080
+ })
2081
+ })
2082
+ }) : categories.map(function (category, index) {
2032
2083
  var groupedPermissions = filteredGroupPermissions.get(category);
2033
2084
  var isPermissionVisible = groupedPermissions.get("isPermissionVisible");
2034
2085
  var permissions = groupedPermissions.get("permissions");
@@ -2082,36 +2133,6 @@ var ToggleDropdown = function ToggleDropdown(_ref) {
2082
2133
  });
2083
2134
  };
2084
2135
 
2085
- var _renderDescription = function renderDescription(permissions, filteredPermissions) {
2086
- return permissions === null || permissions === void 0 ? void 0 : permissions.map(function (_ref) {
2087
- var id = _ref.id,
2088
- description = _ref.description,
2089
- children = _ref.children;
2090
- return /*#__PURE__*/jsxs(Fragment$1, {
2091
- children: [filteredPermissions.includes(id) && /*#__PURE__*/jsx("div", {
2092
- className: "ntm-roles-table-sidebar__list-item",
2093
- "data-name": description,
2094
- children: /*#__PURE__*/jsx(Typography, {
2095
- "data-cy": "ntm-permission-category-description",
2096
- lineHeight: "normal",
2097
- style: "body2",
2098
- children: description
2099
- })
2100
- }, id), /*#__PURE__*/jsx("div", {
2101
- className: "neeto-ui-relative neeto-ui-pl-6 ntm-roles-table-sidebar__sub-blocks",
2102
- children: _renderDescription(children, filteredPermissions)
2103
- })]
2104
- }, id);
2105
- });
2106
- };
2107
- var getSearchWrapperStyle = function getSearchWrapperStyle() {
2108
- var scrollBarWidth = getScrollBarWidth();
2109
- document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", "".concat(scrollBarWidth, "px"));
2110
- return {
2111
- marginBottom: "".concat(scrollBarWidth, "px")
2112
- };
2113
- };
2114
-
2115
2136
  var Sidebar = function Sidebar(_ref) {
2116
2137
  var filteredGroupPermissions = _ref.filteredGroupPermissions,
2117
2138
  toggleDropdown = _ref.toggleDropdown,
@@ -2122,7 +2143,9 @@ var Sidebar = function Sidebar(_ref) {
2122
2143
  permissionRelationConfig = _ref$permissionRelati === void 0 ? {} : _ref$permissionRelati;
2123
2144
  var _useTranslation = useTranslation(),
2124
2145
  t = _useTranslation.t;
2125
- var categories = Array.from(filteredGroupPermissions.keys());
2146
+ var categories = useMemo(function () {
2147
+ return getFilteredCategories(filteredGroupPermissions);
2148
+ }, [filteredGroupPermissions]);
2126
2149
  var searchWrapperStyle = isScrollPresent ? getSearchWrapperStyle() : {};
2127
2150
  var permissionsNameMap = groupBy(prop("name"))(permissions);
2128
2151
  var groupedPermissionsWithChildren = useMemo(function () {
@@ -2148,7 +2171,19 @@ var Sidebar = function Sidebar(_ref) {
2148
2171
  group: "vertical",
2149
2172
  children: /*#__PURE__*/jsx("div", {
2150
2173
  className: "ntm-roles-table-sidebar__list",
2151
- children: categories.map(function (category, index) {
2174
+ children: categories.length === 0 ? /*#__PURE__*/jsx("div", {
2175
+ className: "ntm-roles-table-sidebar__list-item-cell",
2176
+ children: /*#__PURE__*/jsx("div", {
2177
+ className: "ntm-roles-table-sidebar__list-item ntm-roles-table-sidebar__list-item--highlighted",
2178
+ children: /*#__PURE__*/jsx(Typography, {
2179
+ "data-cy": "ntm-empty-category-row",
2180
+ lineHeight: "normal",
2181
+ style: "body2",
2182
+ weight: "semibold",
2183
+ children: t("neetoTeamMembers.labels.permissionsNotFound")
2184
+ })
2185
+ })
2186
+ }) : categories.map(function (category, index) {
2152
2187
  var groupedPermissions = filteredGroupPermissions.get(category);
2153
2188
  var isPermissionVisible = groupedPermissions.get("isPermissionVisible");
2154
2189
  return /*#__PURE__*/jsxs("div", {