@itilite/iui-user-management 1.1.0 → 1.2.1

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.
@@ -1,4 +1,4 @@
1
- import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
1
+ import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUIIconButton, IUICard, IUIBackdrop, IUICircularProgress, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUISearch, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
2
2
  import React, { useState, useEffect, useRef, Fragment as Fragment$1 } from 'react';
3
3
  import { configs, services, utilUrls } from '@itilite/utils';
4
4
  import axios from 'axios';
@@ -15,7 +15,8 @@ import Tooltip from '@material-ui/core/Tooltip';
15
15
  import Switch from '@material-ui/core/Switch';
16
16
  import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
17
17
  import Button from '@material-ui/core/Button';
18
- import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography } from '@material-ui/core';
18
+ import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography, Box } from '@material-ui/core';
19
+ import { useScrollPosition } from '@n8tb1t/use-scroll-position';
19
20
 
20
21
  function _extends() {
21
22
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -446,10 +447,10 @@ var userPanelUrl = {
446
447
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?action=delete&table=" + tableName;
447
448
  },
448
449
  getUnit: function getUnit(tableName, length, sort) {
449
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&order=" + sort;
450
+ return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&ordering=" + sort;
450
451
  },
451
452
  getPaginationUnit: function getPaginationUnit(tableName, length, page, sort) {
452
- return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&order=" + sort;
453
+ return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/table?table_name=" + tableName + "&length=" + length + "&page=" + page + "&ordering=" + sort;
453
454
  },
454
455
  moveUnit: function moveUnit() {
455
456
  return "api/v1/user-management/company/" + IUILocalStorageService.getCompanyId() + "/transfer-users";
@@ -6738,7 +6739,7 @@ var fetchBulkactionHistory = function fetchBulkactionHistory(url) {
6738
6739
  };
6739
6740
  };
6740
6741
 
6741
- var styles$5 = {"UUIUserManagementList":"_3WNHx","pageHeader":"_1WLpc","buttonWrapper":"_2egTG","headingWrapper":"_1He01","headingSignUpWrapper":"_Q8vqd","heading":"_1uPaO","headingLarge":"_2FsLd","headingMedium":"_nGXA9","headingSmall":"_2rpwF","description":"_25vb9","headerText":"_1Ny9J","letterImage":"_2hr3R","tablewrapper":"_1-RPw","rowText":"_1LXyO","textTransform":"_3kFQS","lightColor":"_3Ghgw","avatarClassName":"_2qO_X","tooltipText":"_151u_","tooltip":"_-LQNH","importModalBodyContainer":"_25xUk","dividerColor":"_2HZv9","w100":"_3vGmU","downloadTemplateContainer":"_3-Xu_","downloadTemplateDescContainer":"_tLw43","labelContainer":"_7TYUZ","downlTempHeader":"__CZpe","downlTempDescription":"_19jEe","downloadTemplateButton":"_1qXtq","fileUploaderContainer":"_1YVz2","colGap":"_3vnY5","deActivateModalContainer":"_28H9H","backdrop":"_1ky1x","errorText":"_26_if","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn"};
6742
+ var styles$5 = {"UUIUserManagementList":"_3WNHx","scrollOverlayMenu":"_2_WEg","overlaysearch":"_1Pbhb","pageHeader":"_1WLpc","buttonWrapper":"_2egTG","headingWrapper":"_1He01","headingSignUpWrapper":"_Q8vqd","heading":"_1uPaO","headingLarge":"_2FsLd","headingMedium":"_nGXA9","headingSmall":"_2rpwF","description":"_25vb9","headerText":"_1Ny9J","letterImage":"_2hr3R","tablewrapper":"_1-RPw","rowText":"_1LXyO","textTransform":"_3kFQS","lightColor":"_3Ghgw","avatarClassName":"_2qO_X","tooltipText":"_151u_","tooltip":"_-LQNH","importModalBodyContainer":"_25xUk","dividerColor":"_2HZv9","w100":"_3vGmU","downloadTemplateContainer":"_3-Xu_","downloadTemplateDescContainer":"_tLw43","labelContainer":"_7TYUZ","downlTempHeader":"__CZpe","downlTempDescription":"_19jEe","downloadTemplateButton":"_1qXtq","fileUploaderContainer":"_1YVz2","colGap":"_3vnY5","deActivateModalContainer":"_28H9H","backdrop":"_1ky1x","errorText":"_26_if","user_list_page_tabs":"_xWE7K","TabLabelCount":"_13pXn"};
6742
6743
 
6743
6744
  var BulkUploadModal = function BulkUploadModal(props) {
6744
6745
  var isOpenImportUsersModal = props.isOpenImportUsersModal,
@@ -8220,6 +8221,7 @@ var StickyHeadTable = function StickyHeadTable(props) {
8220
8221
  id: 'first_name',
8221
8222
  label: '',
8222
8223
  minWidth: 60,
8224
+ sortable: false,
8223
8225
  cell: function cell(row) {
8224
8226
  return /*#__PURE__*/React.createElement(IUIBox, {
8225
8227
  component: "div",
@@ -8390,7 +8392,8 @@ var StickyHeadTable = function StickyHeadTable(props) {
8390
8392
  isDataFetching: isDataFetching,
8391
8393
  disableRowCheckbox: disableRowCheckbox,
8392
8394
  searchBoxWidth: "400px",
8393
- searchValue: searchValue
8395
+ searchValue: searchValue,
8396
+ hideTopPagination: false
8394
8397
  });
8395
8398
  };
8396
8399
  var SingupRequests = function SingupRequests(props) {
@@ -8563,7 +8566,7 @@ var UserList = function UserList(_ref2) {
8563
8566
  var _React$useState = React.useState(1),
8564
8567
  page = _React$useState[0],
8565
8568
  setPage = _React$useState[1];
8566
- var _useState = useState(5),
8569
+ var _useState = useState(10),
8567
8570
  rowsPerPage = _useState[0],
8568
8571
  setRowsPerPage = _useState[1];
8569
8572
  var _React$useState2 = React.useState({}),
@@ -8615,18 +8618,41 @@ var UserList = function UserList(_ref2) {
8615
8618
  var _useState12 = useState(''),
8616
8619
  userIds = _useState12[0],
8617
8620
  setUserIds = _useState12[1];
8618
- var _React$useState5 = React.useState(1),
8619
- signup_page = _React$useState5[0],
8620
- setSignUpPage = _React$useState5[1];
8621
+ var _React$useState5 = React.useState(false),
8622
+ overlayMenu = _React$useState5[0],
8623
+ setOverlayMenu = _React$useState5[1];
8624
+ useScrollPosition(function (_ref3) {
8625
+ var prevPos = _ref3.prevPos,
8626
+ currPos = _ref3.currPos;
8627
+ if (prevPos.y - currPos.y > 0) {
8628
+ if (currPos.y <= -275) {
8629
+ setOverlayMenu(true);
8630
+ }
8631
+ } else {
8632
+ if (currPos.y > -295) {
8633
+ setOverlayMenu(false);
8634
+ }
8635
+ }
8636
+ }, [overlayMenu]);
8637
+ var scrollTo = function scrollTo(id) {
8638
+ var el = document.getElementById(id);
8639
+ window.scrollTo({
8640
+ top: el.offsetTop,
8641
+ behavior: 'smooth'
8642
+ });
8643
+ };
8644
+ var _React$useState6 = React.useState(1),
8645
+ signup_page = _React$useState6[0],
8646
+ setSignUpPage = _React$useState6[1];
8621
8647
  var _useState13 = useState(5),
8622
8648
  signup_rowsPerPage = _useState13[0],
8623
8649
  setSignUpRowsPerPage = _useState13[1];
8624
- var _React$useState6 = React.useState('asc'),
8625
- signup_order = _React$useState6[0],
8626
- setSignUpOrder = _React$useState6[1];
8627
- var _React$useState7 = React.useState('fname'),
8628
- signup_orderBy = _React$useState7[0],
8629
- setSignUpOrderBy = _React$useState7[1];
8650
+ var _React$useState7 = React.useState('asc'),
8651
+ signup_order = _React$useState7[0],
8652
+ setSignUpOrder = _React$useState7[1];
8653
+ var _React$useState8 = React.useState('fname'),
8654
+ signup_orderBy = _React$useState8[0],
8655
+ setSignUpOrderBy = _React$useState8[1];
8630
8656
  var _useState14 = useState(''),
8631
8657
  signup_searchValue = _useState14[0],
8632
8658
  set_signup_SearchValue = _useState14[1];
@@ -8683,7 +8709,8 @@ var UserList = function UserList(_ref2) {
8683
8709
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8684
8710
  length: signup_rowsPerPage,
8685
8711
  page: signup_page,
8686
- search: signup_searchValue.trim()
8712
+ search: signup_searchValue.trim(),
8713
+ pagename: 'company'
8687
8714
  })).then(function () {
8688
8715
  return dispatch(stopDataFetchingStatus());
8689
8716
  });
@@ -8885,6 +8912,7 @@ var UserList = function UserList(_ref2) {
8885
8912
  dispatch(fetchUsersList(url)).then(function () {
8886
8913
  setSearchingChange(false);
8887
8914
  setisApiFetching(false);
8915
+ scrollTo('table-root');
8888
8916
  });
8889
8917
  }, 1000);
8890
8918
  return function () {
@@ -8898,7 +8926,8 @@ var UserList = function UserList(_ref2) {
8898
8926
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8899
8927
  length: signup_rowsPerPage,
8900
8928
  page: signup_page,
8901
- search: signup_searchValue.trim()
8929
+ search: signup_searchValue.trim(),
8930
+ pagename: 'company'
8902
8931
  })).then(function () {
8903
8932
  setSignUpSearchingChange(false);
8904
8933
  setisApiFetching(false);
@@ -8910,6 +8939,7 @@ var UserList = function UserList(_ref2) {
8910
8939
  }
8911
8940
  if (isSortingChange) {
8912
8941
  setisApiFetching(true);
8942
+ scrollTo('table-root');
8913
8943
  dispatch(fetchUsersList(url)).then(function () {
8914
8944
  setisApiFetching(false);
8915
8945
  setSortingChange(false);
@@ -8924,7 +8954,8 @@ var UserList = function UserList(_ref2) {
8924
8954
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8925
8955
  length: signup_rowsPerPage,
8926
8956
  page: signup_page,
8927
- search: signup_searchValue.trim()
8957
+ search: signup_searchValue.trim(),
8958
+ pagename: 'company'
8928
8959
  })).then(function () {
8929
8960
  setisApiFetching(false);
8930
8961
  setSignUpSortingChange(false);
@@ -8940,7 +8971,8 @@ var UserList = function UserList(_ref2) {
8940
8971
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
8941
8972
  length: signup_rowsPerPage,
8942
8973
  page: signup_page,
8943
- search: signup_searchValue.trim()
8974
+ search: signup_searchValue.trim(),
8975
+ pagename: 'company'
8944
8976
  })).then(function () {
8945
8977
  return dispatch(stopDataFetchingStatus());
8946
8978
  });
@@ -8948,15 +8980,89 @@ var UserList = function UserList(_ref2) {
8948
8980
  }
8949
8981
  }
8950
8982
  }, [isTokenVerified, isSearchingChangeTemp, isSortingChangeTemp, isSignUpSearchingChangeTemp, isSignUpSortingChangeTemp]);
8983
+ var topRightButtons = function topRightButtons() {
8984
+ return /*#__PURE__*/React.createElement(IUIBox, {
8985
+ component: "div",
8986
+ className: styles$5.buttonWrapper,
8987
+ display: "flex",
8988
+ justifyContent: "space-between",
8989
+ alignItems: "center",
8990
+ alignSelf: "flex-start"
8991
+ }, /*#__PURE__*/React.createElement(IUIBox, {
8992
+ component: "div",
8993
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
8994
+ }, /*#__PURE__*/React.createElement(IUIButton, {
8995
+ buttonText: "Export all users",
8996
+ type: "outlined",
8997
+ startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
8998
+ width: "22",
8999
+ height: "22"
9000
+ }),
9001
+ onClick: handleExportUsers
9002
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9003
+ component: "div",
9004
+ className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9005
+ }, /*#__PURE__*/React.createElement(IUIDropdownButton, {
9006
+ buttonText: "Bulk actions",
9007
+ type: "outlined",
9008
+ menuListInfo: BulkUploadInfo
9009
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9010
+ component: "div",
9011
+ className: "pageHeader--button-single button-right"
9012
+ }, /*#__PURE__*/React.createElement(IUIButton, {
9013
+ buttonText: "Add user",
9014
+ type: "contained",
9015
+ startIcon: /*#__PURE__*/React.createElement(AddIcon, {
9016
+ width: "9",
9017
+ height: "9",
9018
+ color: "white"
9019
+ }),
9020
+ onClick: handleAddPageNavigation
9021
+ })));
9022
+ };
8951
9023
  return /*#__PURE__*/React.createElement(IUIBox, {
8952
9024
  component: "div",
8953
9025
  className: styles$5.UUIUserManagementList
8954
- }, !hasVerificationError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBackdrop, {
9026
+ }, overlayMenu ? /*#__PURE__*/React.createElement(Box, {
9027
+ className: styles$5.scrollOverlayMenu
9028
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9029
+ component: "div",
9030
+ className: clsx(styles$5.pageHeader)
9031
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9032
+ component: "div",
9033
+ display: "flex",
9034
+ justifyContent: "space-between",
9035
+ alignItems: "center",
9036
+ flexWrap: "wrap",
9037
+ style: {
9038
+ gap: '1rem'
9039
+ }
9040
+ }, /*#__PURE__*/React.createElement(IUIBox, {
9041
+ component: "div",
9042
+ display: "flex",
9043
+ flexDirection: "column",
9044
+ style: {
9045
+ gap: '0.5rem'
9046
+ }
9047
+ }, /*#__PURE__*/React.createElement(IUISearch, {
9048
+ placeholder: "Search by name, email & department",
9049
+ value: searchValue,
9050
+ onChangeHandler: function onChangeHandler(e) {
9051
+ return onSearchHandler(e.target.value);
9052
+ },
9053
+ className: styles$5.overlaysearch
9054
+ })), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
9055
+ component: "div",
9056
+ display: "flex",
9057
+ justifyContent: "space-between",
9058
+ alignItems: "center"
9059
+ }))) : '', !hasVerificationError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBackdrop, {
8955
9060
  open: isFileDownloading || isApiFetching,
8956
9061
  className: styles$5.backdrop
8957
9062
  }, /*#__PURE__*/React.createElement(IUICircularProgress, {
8958
9063
  color: "inherit"
8959
9064
  })), isDataFetching ? /*#__PURE__*/React.createElement(SkeletonLoader, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIBox, {
9065
+ id: "table-root",
8960
9066
  component: "div",
8961
9067
  className: clsx(styles$5.pageHeader)
8962
9068
  }, /*#__PURE__*/React.createElement(IUIBox, {
@@ -8981,44 +9087,7 @@ var UserList = function UserList(_ref2) {
8981
9087
  }, /*#__PURE__*/React.createElement(IUITypography, {
8982
9088
  variant: "h3",
8983
9089
  className: clsx(styles$5.heading, styles$5.headingLarge)
8984
- }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), /*#__PURE__*/React.createElement(IUIBox, {
8985
- component: "div",
8986
- className: styles$5.buttonWrapper,
8987
- display: "flex",
8988
- justifyContent: "space-between",
8989
- alignItems: "center",
8990
- alignSelf: "flex-start"
8991
- }, /*#__PURE__*/React.createElement(IUIBox, {
8992
- component: "div",
8993
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
8994
- }, /*#__PURE__*/React.createElement(IUIButton, {
8995
- buttonText: "Export all users",
8996
- type: "outlined",
8997
- startIcon: /*#__PURE__*/React.createElement(BulkDownloadIcon, {
8998
- width: "22",
8999
- height: "22"
9000
- }),
9001
- onClick: handleExportUsers
9002
- })), /*#__PURE__*/React.createElement(IUIBox, {
9003
- component: "div",
9004
- className: clsx(styles$5.buttonSingle, styles$5.buttonLeft)
9005
- }, /*#__PURE__*/React.createElement(IUIDropdownButton, {
9006
- buttonText: "Bulk actions",
9007
- type: "outlined",
9008
- menuListInfo: BulkUploadInfo
9009
- })), /*#__PURE__*/React.createElement(IUIBox, {
9010
- component: "div",
9011
- className: "pageHeader--button-single button-right"
9012
- }, /*#__PURE__*/React.createElement(IUIButton, {
9013
- buttonText: "Add user",
9014
- type: "contained",
9015
- startIcon: /*#__PURE__*/React.createElement(AddIcon, {
9016
- width: "9",
9017
- height: "9",
9018
- color: "white"
9019
- }),
9020
- onClick: handleAddPageNavigation
9021
- })))), /*#__PURE__*/React.createElement(IUIBox, {
9090
+ }, isILadmin && companyName ? companyName + " - Users" : 'Users'))), topRightButtons()), /*#__PURE__*/React.createElement(IUIBox, {
9022
9091
  component: "div",
9023
9092
  display: "flex",
9024
9093
  justifyContent: "space-between",
@@ -9181,8 +9250,8 @@ var UserList = function UserList(_ref2) {
9181
9250
  errMsg: hasVerificationError
9182
9251
  }));
9183
9252
  };
9184
- var TabLabelCount = function TabLabelCount(_ref3) {
9185
- var count = _ref3.count;
9253
+ var TabLabelCount = function TabLabelCount(_ref4) {
9254
+ var count = _ref4.count;
9186
9255
  return /*#__PURE__*/React.createElement(IUIBox, {
9187
9256
  className: styles$5.TabLabelCount
9188
9257
  }, " ", count, " ");
@@ -9288,7 +9357,7 @@ function Listview(_ref) {
9288
9357
  id: 'no_of_users',
9289
9358
  label: 'Number of users',
9290
9359
  width: '45%',
9291
- sortable: true,
9360
+ sortable: false,
9292
9361
  cell: function cell(row) {
9293
9362
  return /*#__PURE__*/React.createElement(IUIBox, {
9294
9363
  component: "div"