@campxdev/shared 1.11.3 → 1.11.5

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.11.3",
3
+ "version": "1.11.5",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -34,6 +34,7 @@ export interface TableColumn {
34
34
  dataType?: DataType
35
35
  }
36
36
  interface TableProps {
37
+ showSerialNumber?: boolean
37
38
  columns: Array<TableColumn>
38
39
  rowKey?: string
39
40
  dataSource?: any[]
@@ -54,6 +55,7 @@ interface TableProps {
54
55
  showTotalInFirstCellOfTotalRow?: boolean
55
56
  }
56
57
  export default function Table({
58
+ showSerialNumber = false,
57
59
  columns,
58
60
  dataSource,
59
61
  onRowClick,
@@ -135,6 +137,16 @@ export default function Table({
135
137
  <StyledMuiTable sx={sx}>
136
138
  <TableHead>
137
139
  <TableRow>
140
+ {showSerialNumber && (
141
+ <StyledTableCell
142
+ sx={sx}
143
+ columnIndex={0}
144
+ rowIndex={0}
145
+ columnsLength={1}
146
+ >
147
+ S. No.
148
+ </StyledTableCell>
149
+ )}
138
150
  {columns.map((col, columnIndex) => (
139
151
  <StyledTableCell
140
152
  key={columnIndex}
@@ -177,6 +189,16 @@ export default function Table({
177
189
  return onRowClick && onRowClick(row)
178
190
  }}
179
191
  >
192
+ {showSerialNumber && (
193
+ <StyledTableCell
194
+ sx={sx}
195
+ columnIndex={0}
196
+ rowIndex={rowIndex + 1}
197
+ columnsLength={1}
198
+ >
199
+ {rowIndex + 1}
200
+ </StyledTableCell>
201
+ )}
180
202
  <> {showTotal && calculateTotal(row)}</>
181
203
  {columns.map((col, colIndex) => (
182
204
  <StyledTableCell
@@ -5,7 +5,7 @@ export interface StyledCellProps {
5
5
  columnsLength: number
6
6
  columnIndex: number
7
7
  rowIndex: number
8
- col: any
8
+ col?: any
9
9
  sx?: Record<string, SxProps<Theme>>
10
10
  isBodyCell?: boolean
11
11
  isHeaderCell?: boolean
@@ -74,6 +74,7 @@ const getTableCol = (headerItem: ColumnProps) => {
74
74
  }
75
75
 
76
76
  export default function ReactTable({
77
+ showSerialNumber = false,
77
78
  columns,
78
79
  rowKey = 'id',
79
80
  dataSource,
@@ -197,6 +198,7 @@ export default function ReactTable({
197
198
  <TableHead>
198
199
  {headerGroups.map((headerGroup, index) => (
199
200
  <TableRow key={index} {...headerGroup.getHeaderGroupProps()}>
201
+ {showSerialNumber && <TableCell>S. No.</TableCell>}
200
202
  {headerGroup.headers.map((column: any, index) => (
201
203
  <TableCell key={index} {...column.getHeaderProps()}>
202
204
  {column.render('Header')}
@@ -219,6 +221,7 @@ export default function ReactTable({
219
221
  ))}
220
222
  </TableHead>
221
223
  <RenderTableBody
224
+ showSerialNumber={showSerialNumber}
222
225
  onRowClick={onRowClick}
223
226
  colLength={columns?.length}
224
227
  loading={loading || refetching}
@@ -1,9 +1,10 @@
1
- import { Box, TableBody, TableCell, Typography } from '@mui/material'
1
+ import { TableBody, TableCell } from '@mui/material'
2
2
  import Spinner from '../../Spinner'
3
- import { StyledTableRow } from '../common/styles'
4
3
  import NoRecordsFound from '../common/NoRecordsFound'
4
+ import { StyledTableRow } from '../common/styles'
5
5
 
6
6
  export const RenderTableBody = ({
7
+ showSerialNumber,
7
8
  getTableBodyProps,
8
9
  prepareRow,
9
10
  rows,
@@ -34,6 +35,7 @@ export const RenderTableBody = ({
34
35
  {...row.getRowProps()}
35
36
  isSelected={row?.isSelected}
36
37
  >
38
+ {showSerialNumber && <TableCell>{index + 1}</TableCell>}
37
39
  {row.cells?.map((cell, index) => {
38
40
  return (
39
41
  <TableCell key={index} {...cell.getCellProps()}>
@@ -12,6 +12,7 @@ export interface ColumnProps {
12
12
 
13
13
  export interface TableProps {
14
14
  tableKey?: string
15
+ showSerialNumber?: boolean
15
16
  columns: Array<ColumnProps>
16
17
  rowKey?: string
17
18
  dataSource?: any[]
@@ -8,9 +8,9 @@ export enum PaymentsPermission {
8
8
  CAN_MANAGE_PAYMENTS_PROFILE_PERMISSIONS_EDIT = 'can_manage_payments_profile_permissions_edit',
9
9
  CAN_MANAGE_PAYMENTS_PROFILE_PERMISSIONS_DELETE = 'can_manage_payments_profile_permissions_delete',
10
10
 
11
- //Payments imports
12
- CAN_IMPORT_RECEIPTS='can_import_receipts_view',
13
- CAN_IMPORT_CREDITS='can_import_credits_view',
11
+ //Payments imports
12
+ CAN_IMPORT_RECEIPTS = 'can_import_receipts_view',
13
+ CAN_IMPORT_CREDITS = 'can_import_credits_view',
14
14
 
15
15
  // Fee Counter
16
16
  CAN_FEE_COUNTER_ACADEMIC_FEE = 'can_fee_counter_academic_fee',
@@ -218,6 +218,9 @@ export enum SquarePermissions {
218
218
  CAN_CLASSROOM_SUBJECTS_VIEW = 'can_classroom_subjects_view',
219
219
  CAN_CLASSROOM_SUBJECT_ATTENDANCE_EDIT = 'can_classroom_subject_attendance_edit',
220
220
 
221
+ //my subjects
222
+ CAN_VIEW_MY_SUBJECTS = 'can_view_my_subjects',
223
+
221
224
  // Feed
222
225
  CAN_ADD_FEED = 'can_feed_add',
223
226
 
@@ -563,9 +566,9 @@ export enum Permission {
563
566
  CAN_FEE_COUNTER_ACADEMIC_FEE = 'can_fee_counter_academic_fee',
564
567
  CAN_FEE_COUNTER_EXAM_FEE = 'can_fee_counter_exam_fee',
565
568
 
566
- //Payments imports
567
- CAN_IMPORT_RECEIPTS='can_import_receipts_view',
568
- CAN_IMPORT_CREDITS='can_import_credits_view',
569
+ //Payments imports
570
+ CAN_IMPORT_RECEIPTS = 'can_import_receipts_view',
571
+ CAN_IMPORT_CREDITS = 'can_import_credits_view',
569
572
 
570
573
  // Fee Groups
571
574
  CAN_FEE_GROUP_VIEW = 'can_fee_groups_view',