@campxdev/shared 1.4.13 → 1.4.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  StyledLeftNavContainer,
3
3
  StyledMainContentContainer,
4
- } from '../layouts/Components/styles'
4
+ } from '../../layouts/Components/styles'
5
+ import ErrorBoundary from '../ErrorBoundary'
5
6
  import SideNav from './SideNav'
6
7
  interface Props {
7
8
  children?: React.ReactNode
@@ -15,11 +16,13 @@ export default function LayoutWrapper({
15
16
  sideMenuHeader,
16
17
  }: Props) {
17
18
  return (
18
- <>
19
+ <ErrorBoundary>
19
20
  <StyledLeftNavContainer>
20
21
  <SideNav menuItems={menu as any[]} header={sideMenuHeader} />
21
22
  </StyledLeftNavContainer>
22
- <StyledMainContentContainer>{children}</StyledMainContentContainer>
23
- </>
23
+ <StyledMainContentContainer>
24
+ <ErrorBoundary>{children}</ErrorBoundary>
25
+ </StyledMainContentContainer>
26
+ </ErrorBoundary>
24
27
  )
25
28
  }
@@ -9,12 +9,12 @@ import {
9
9
  import { Store } from 'pullstate'
10
10
  import { memo, ReactNode } from 'react'
11
11
  import { Link, useMatch, useResolvedPath } from 'react-router-dom'
12
- import { PermissionsStore } from '../shared-state'
12
+ import { PermissionsStore } from '../../shared-state'
13
13
  import {
14
14
  ListItemButton,
15
15
  StyledChevronIcon,
16
16
  StyledListItemButton,
17
- } from './ListItemButton'
17
+ } from '../ListItemButton'
18
18
 
19
19
  const accessIfNoKey = process.env.NODE_ENV === 'development' ? true : false
20
20
 
@@ -1,5 +1,4 @@
1
- import { Box, styled } from '@mui/material'
2
- import ErrorBoundary from './ErrorBoundary'
1
+ import { Box, BoxProps, styled } from '@mui/material'
3
2
 
4
3
  const StyledPageContent = styled(Box)(() => ({
5
4
  paddingLeft: '25px',
@@ -8,10 +7,6 @@ const StyledPageContent = styled(Box)(() => ({
8
7
  paddingBottom: '3rem',
9
8
  }))
10
9
 
11
- export function PageContent(props) {
12
- return (
13
- <StyledPageContent style={props.style}>
14
- <ErrorBoundary>{props.children}</ErrorBoundary>
15
- </StyledPageContent>
16
- )
10
+ export function PageContent(props: BoxProps) {
11
+ return <StyledPageContent {...props}>{props.children}</StyledPageContent>
17
12
  }
@@ -1,7 +1,8 @@
1
1
  import { Search, Tune } from '@mui/icons-material'
2
- import { Box, InputAdornment, styled, TextField } from '@mui/material'
2
+ import { Box, InputAdornment, styled } from '@mui/material'
3
3
  import { useMemo, useState } from 'react'
4
4
  import _ from 'lodash'
5
+ import { TextField } from './Input'
5
6
 
6
7
  interface SearchBarProps {
7
8
  onSearch: (v: string) => void
@@ -35,10 +35,20 @@ type ReactTableCell = {
35
35
  const selectColumn = {
36
36
  id: 'selection',
37
37
  Header: ({ getToggleAllPageRowsSelectedProps }) => (
38
- <Checkbox size="small" {...getToggleAllPageRowsSelectedProps()} />
38
+ <Checkbox
39
+ onClick={(e) => {
40
+ e.stopPropagation()
41
+ }}
42
+ {...getToggleAllPageRowsSelectedProps()}
43
+ />
39
44
  ),
40
45
  Cell: ({ row }) => (
41
- <Checkbox size="small" {...row.getToggleRowSelectedProps()} />
46
+ <Checkbox
47
+ onClick={(e) => {
48
+ e.stopPropagation()
49
+ }}
50
+ {...row.getToggleRowSelectedProps()}
51
+ />
42
52
  ),
43
53
  }
44
54
 
@@ -106,11 +116,7 @@ export default function TableComponent({
106
116
  stateReducer: (newState, action) => {
107
117
  switch (action.type) {
108
118
  case 'toggleAllRowsSelected':
109
- return {
110
- ...newState,
111
- selectedRowIds: {},
112
- }
113
-
119
+ return { ...newState, selectedRowIds: {} }
114
120
  default:
115
121
  return newState
116
122
  }
@@ -122,11 +128,7 @@ export default function TableComponent({
122
128
  manualPagination: true,
123
129
  autoResetSelectedRows: false,
124
130
  pageCount: pagination?.totalCount ?? dataSource?.length,
125
- getRowId: select?.enable
126
- ? (row) => {
127
- return row?.id
128
- }
129
- : undefined,
131
+ getRowId: select?.enable ? (row) => row?.id : undefined,
130
132
  },
131
133
  // useSortBy,
132
134
  usePagination,
@@ -46,7 +46,9 @@ export const RenderTableBody = ({
46
46
  prepareRow(row)
47
47
  return (
48
48
  <StyledTableRow
49
- onClick={onRowClick && onRowClick}
49
+ onClick={() => {
50
+ if (onRowClick) onRowClick(row)
51
+ }}
50
52
  key={index}
51
53
  {...row.getRowProps()}
52
54
  isSelected={row?.isSelected}
@@ -102,12 +102,9 @@ export default function Table({
102
102
  }),
103
103
  }}
104
104
  >
105
- <>
106
- <Box sx={{ fontWeight: 600, fontSize: '14px' }}>
107
- {' '}
108
- {col.title}
109
- </Box>
110
- </>
105
+ <Box sx={{ fontWeight: 600, fontSize: '14px' }}>
106
+ {col.title}
107
+ </Box>
111
108
  {col.sort && (
112
109
  <IconButton onClick={() => handleSortClick(col.dataIndex)}>
113
110
  <ListItemIcon>
@@ -14,10 +14,10 @@ import { Table as StyledTable } from './Table'
14
14
  import ErrorBoundary from './ErrorBoundary'
15
15
  import FullScreenLoader from './FullScreenLoader'
16
16
  import LoginForm from './LoginForm'
17
- import { SideMenuHeader } from './SideMenuHeader'
18
- import SideNav from './SideNav'
17
+ import { SideMenuHeader } from './Layout/SideMenuHeader'
18
+ import SideNav from './Layout/SideNav'
19
19
  import { ListItemButton } from './ListItemButton'
20
- import LayoutWrapper from './LayoutWrapper'
20
+ import LayoutWrapper from './Layout/LayoutWrapper'
21
21
  import PageNotFound from './PageNotFound'
22
22
  import ChangePassword from './ChangePassword'
23
23
  import UploadButton from './UploadButton'
@@ -18,10 +18,12 @@ export default function Providers({ children }: { children: ReactNode }) {
18
18
  const [isInvalid, setIsInvalid] = useState(false)
19
19
 
20
20
  useEffect(() => {
21
- if (!urlTenantKey && campxTenantKey) {
22
- return window.location.replace(
23
- window.location.origin + `/${campxTenantKey}`,
24
- )
21
+ if (!urlTenantKey) {
22
+ if (campxTenantKey) {
23
+ return window.location.replace(
24
+ window.location.origin + `/${campxTenantKey}`,
25
+ )
26
+ }
25
27
  }
26
28
 
27
29
  if (!urlTenantKey) {
@@ -57,4 +57,18 @@ export const StyledMainContentContainer = muiStyled('main')(() => ({
57
57
  top: headerHeight,
58
58
  left: sideNavWidth,
59
59
  overflowY: 'auto',
60
+
61
+ '&::-webkit-scrollbar': {
62
+ width: '0.6em',
63
+ height: '0.6em',
64
+ },
65
+
66
+ '&::-webkit-scrollbar-thumb': {
67
+ backgroundColor: 'rgba(0,0,0, 0.3)',
68
+ borderRadius: '3px',
69
+
70
+ '&:hover': {
71
+ background: 'rgba(0,0,0, 0.4)',
72
+ },
73
+ },
60
74
  }))