@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.
package/dist/cjs/Roles.js CHANGED
@@ -1895,6 +1895,43 @@ var getScrollBarWidth = function getScrollBarWidth() {
1895
1895
  return w1 - w2;
1896
1896
  };
1897
1897
 
1898
+ var _renderDescription = function renderDescription(permissions, filteredPermissions) {
1899
+ return permissions === null || permissions === void 0 ? void 0 : permissions.map(function (_ref) {
1900
+ var id = _ref.id,
1901
+ description = _ref.description,
1902
+ children = _ref.children;
1903
+ return /*#__PURE__*/jsxRuntime.jsxs(require$$0.Fragment, {
1904
+ children: [filteredPermissions.includes(id) && /*#__PURE__*/jsxRuntime.jsx("div", {
1905
+ className: "ntm-roles-table-sidebar__list-item",
1906
+ "data-name": description,
1907
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
1908
+ "data-cy": "ntm-permission-category-description",
1909
+ lineHeight: "normal",
1910
+ style: "body2",
1911
+ children: description
1912
+ })
1913
+ }, id), /*#__PURE__*/jsxRuntime.jsx("div", {
1914
+ className: "neeto-ui-relative neeto-ui-pl-6 ntm-roles-table-sidebar__sub-blocks",
1915
+ children: _renderDescription(children, filteredPermissions)
1916
+ })]
1917
+ }, id);
1918
+ });
1919
+ };
1920
+ var getSearchWrapperStyle = function getSearchWrapperStyle() {
1921
+ var scrollBarWidth = getScrollBarWidth();
1922
+ document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", "".concat(scrollBarWidth, "px"));
1923
+ return {
1924
+ marginBottom: "".concat(scrollBarWidth, "px")
1925
+ };
1926
+ };
1927
+ var getFilteredCategories = function getFilteredCategories(filteredGroupPermissions) {
1928
+ return Array.from((filteredGroupPermissions === null || filteredGroupPermissions === void 0 ? void 0 : filteredGroupPermissions.keys()) || []).filter(function (category) {
1929
+ var groupedPermissions = filteredGroupPermissions.get(category);
1930
+ var permissions = groupedPermissions.get("permissions") || [];
1931
+ return permissions.length > 0;
1932
+ });
1933
+ };
1934
+
1898
1935
  var TableHeader = function TableHeader(_ref) {
1899
1936
  var config = _ref.config,
1900
1937
  roles = _ref.roles,
@@ -2015,7 +2052,9 @@ var Columns = function Columns(_ref) {
2015
2052
  _useState2 = _slicedToArray(_useState, 2),
2016
2053
  manageRole = _useState2[0],
2017
2054
  setManageRole = _useState2[1];
2018
- var categories = Array.from(filteredGroupPermissions === null || filteredGroupPermissions === void 0 ? void 0 : filteredGroupPermissions.keys());
2055
+ var categories = require$$0.useMemo(function () {
2056
+ return getFilteredCategories(filteredGroupPermissions);
2057
+ }, [filteredGroupPermissions]);
2019
2058
  var onClose = function onClose() {
2020
2059
  return setManageRole(DEFAULT_MANAGE_ROLE_VALUES);
2021
2060
  };
@@ -2030,7 +2069,19 @@ var Columns = function Columns(_ref) {
2030
2069
  group: ["horizontal", "vertical"],
2031
2070
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
2032
2071
  className: "ntm-roles-table__rows",
2033
- children: categories.map(function (category, index) {
2072
+ children: categories.length === 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
2073
+ className: "ntm-roles-table__empty-row",
2074
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
2075
+ className: "ntm-roles-table__row",
2076
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
2077
+ className: "ntm-roles-table__cell",
2078
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
2079
+ className: "ntm-roles-table__cell-content",
2080
+ children: "\xA0"
2081
+ })
2082
+ })
2083
+ })
2084
+ }) : categories.map(function (category, index) {
2034
2085
  var groupedPermissions = filteredGroupPermissions.get(category);
2035
2086
  var isPermissionVisible = groupedPermissions.get("isPermissionVisible");
2036
2087
  var permissions = groupedPermissions.get("permissions");
@@ -2084,36 +2135,6 @@ var ToggleDropdown = function ToggleDropdown(_ref) {
2084
2135
  });
2085
2136
  };
2086
2137
 
2087
- var _renderDescription = function renderDescription(permissions, filteredPermissions) {
2088
- return permissions === null || permissions === void 0 ? void 0 : permissions.map(function (_ref) {
2089
- var id = _ref.id,
2090
- description = _ref.description,
2091
- children = _ref.children;
2092
- return /*#__PURE__*/jsxRuntime.jsxs(require$$0.Fragment, {
2093
- children: [filteredPermissions.includes(id) && /*#__PURE__*/jsxRuntime.jsx("div", {
2094
- className: "ntm-roles-table-sidebar__list-item",
2095
- "data-name": description,
2096
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2097
- "data-cy": "ntm-permission-category-description",
2098
- lineHeight: "normal",
2099
- style: "body2",
2100
- children: description
2101
- })
2102
- }, id), /*#__PURE__*/jsxRuntime.jsx("div", {
2103
- className: "neeto-ui-relative neeto-ui-pl-6 ntm-roles-table-sidebar__sub-blocks",
2104
- children: _renderDescription(children, filteredPermissions)
2105
- })]
2106
- }, id);
2107
- });
2108
- };
2109
- var getSearchWrapperStyle = function getSearchWrapperStyle() {
2110
- var scrollBarWidth = getScrollBarWidth();
2111
- document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", "".concat(scrollBarWidth, "px"));
2112
- return {
2113
- marginBottom: "".concat(scrollBarWidth, "px")
2114
- };
2115
- };
2116
-
2117
2138
  var Sidebar = function Sidebar(_ref) {
2118
2139
  var filteredGroupPermissions = _ref.filteredGroupPermissions,
2119
2140
  toggleDropdown = _ref.toggleDropdown,
@@ -2124,7 +2145,9 @@ var Sidebar = function Sidebar(_ref) {
2124
2145
  permissionRelationConfig = _ref$permissionRelati === void 0 ? {} : _ref$permissionRelati;
2125
2146
  var _useTranslation = reactI18next.useTranslation(),
2126
2147
  t = _useTranslation.t;
2127
- var categories = Array.from(filteredGroupPermissions.keys());
2148
+ var categories = require$$0.useMemo(function () {
2149
+ return getFilteredCategories(filteredGroupPermissions);
2150
+ }, [filteredGroupPermissions]);
2128
2151
  var searchWrapperStyle = isScrollPresent ? getSearchWrapperStyle() : {};
2129
2152
  var permissionsNameMap = ramda.groupBy(ramda.prop("name"))(permissions);
2130
2153
  var groupedPermissionsWithChildren = require$$0.useMemo(function () {
@@ -2150,7 +2173,19 @@ var Sidebar = function Sidebar(_ref) {
2150
2173
  group: "vertical",
2151
2174
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
2152
2175
  className: "ntm-roles-table-sidebar__list",
2153
- children: categories.map(function (category, index) {
2176
+ children: categories.length === 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
2177
+ className: "ntm-roles-table-sidebar__list-item-cell",
2178
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
2179
+ className: "ntm-roles-table-sidebar__list-item ntm-roles-table-sidebar__list-item--highlighted",
2180
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
2181
+ "data-cy": "ntm-empty-category-row",
2182
+ lineHeight: "normal",
2183
+ style: "body2",
2184
+ weight: "semibold",
2185
+ children: t("neetoTeamMembers.labels.permissionsNotFound")
2186
+ })
2187
+ })
2188
+ }) : categories.map(function (category, index) {
2154
2189
  var groupedPermissions = filteredGroupPermissions.get(category);
2155
2190
  var isPermissionVisible = groupedPermissions.get("isPermissionVisible");
2156
2191
  return /*#__PURE__*/jsxRuntime.jsxs("div", {