@dartech/arsenal-ui 1.3.0 → 1.3.2
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/{index.ts → index.d.ts} +5 -5
- package/index.js +1 -0
- package/package.json +10 -3
- package/src/consts/index.d.ts +12 -0
- package/src/interfaces/common.d.ts +17 -0
- package/src/interfaces/definition.d.ts +107 -0
- package/src/interfaces/{index.ts → index.d.ts} +3 -3
- package/src/interfaces/ui.d.ts +70 -0
- package/src/lib/Alert/Alert.d.ts +53 -0
- package/src/lib/Alert/index.d.ts +1 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.d.ts +2 -0
- package/src/lib/Breadcrumbs/{index.ts → index.d.ts} +1 -1
- package/src/lib/ContentLayout/ContentLayout.d.ts +9 -0
- package/src/lib/ContentLayout/index.d.ts +1 -0
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +11 -0
- package/src/lib/Definition/CreateDefinition/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +10 -0
- package/src/lib/Definition/DefinitionFiller/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +8 -0
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +9 -0
- package/src/lib/Definition/DefinitionValueView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Definition/{index.ts → index.d.ts} +3 -3
- package/src/lib/Forms/BackButton.d.ts +7 -0
- package/src/lib/Forms/ControlAceEditor.d.ts +24 -0
- package/src/lib/Forms/ControlAutocomplete.d.ts +69 -0
- package/src/lib/Forms/ControlCheckbox.d.ts +51 -0
- package/src/lib/Forms/ControlDate.d.ts +18 -0
- package/src/lib/Forms/ControlDateTime.d.ts +18 -0
- package/src/lib/Forms/ControlDebouncedInput.d.ts +4 -0
- package/src/lib/Forms/ControlInput.d.ts +59 -0
- package/src/lib/Forms/ControlNumberInput.d.ts +51 -0
- package/src/lib/Forms/ControlQueryAutocomplete.d.ts +16 -0
- package/src/lib/Forms/ControlRadio.d.ts +66 -0
- package/src/lib/Forms/ControlSelect.d.ts +67 -0
- package/src/lib/Forms/ControlSwitch.d.ts +19 -0
- package/src/lib/Forms/ControlTime.d.ts +18 -0
- package/src/lib/Forms/CopyButton.d.ts +20 -0
- package/src/lib/Forms/{index.ts → index.d.ts} +15 -15
- package/src/lib/Forms/useAutocomplete.d.ts +10 -0
- package/src/lib/InfoItem/InfoItem.d.ts +10 -0
- package/src/lib/InfoItem/{index.ts → index.d.ts} +1 -1
- package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +10 -0
- package/src/lib/JsonPathPicker/PropertyStep.d.ts +11 -0
- package/src/lib/JsonPathPicker/{index.ts → index.d.ts} +1 -1
- package/src/lib/JsonView/JsonView.d.ts +7 -0
- package/src/lib/JsonView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Loader/Loader.d.ts +21 -0
- package/src/lib/Loader/{index.ts → index.d.ts} +1 -1
- package/src/lib/Modals/JsonModalView.d.ts +10 -0
- package/src/lib/Modals/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +10 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +12 -0
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +11 -0
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +12 -0
- package/src/lib/Property/PropertyFiller/{index.ts → index.d.ts} +2 -2
- package/src/lib/Property/PropertyFiller/styled.d.ts +18 -0
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +24 -0
- package/src/lib/Property/PropertyValidator/NodeValidator.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/NodesList.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.d.ts +8 -0
- package/src/lib/Property/PropertyValidator/PropertyValidator.d.ts +6 -0
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.d.ts +3 -0
- package/src/lib/Property/PropertyValidator/StringTypeValidator.d.ts +8 -0
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.d.ts +7 -0
- package/src/lib/Property/PropertyValidator/index.d.ts +1 -0
- package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +7 -0
- package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/DateValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +10 -0
- package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/StringValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +9 -0
- package/src/lib/Property/PropertyValueField/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +13 -0
- package/src/lib/Property/PropertyWidget/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +13 -0
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +10 -0
- package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +7 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +7 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +8 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +10 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/UpsertProperty/{index.ts → index.d.ts} +2 -2
- package/src/lib/Property/UpsertProperty/useCustomFields.d.ts +6 -0
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +8 -0
- package/src/lib/Property/ViewPropertiesList/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +7 -0
- package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +8 -0
- package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +7 -0
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +9 -0
- package/src/lib/Property/ViewProperty/ViewProperty.d.ts +9 -0
- package/src/lib/Property/ViewProperty/{index.ts → index.d.ts} +1 -1
- package/src/lib/Property/{index.ts → index.d.ts} +5 -5
- package/src/lib/Sidebar/Sidebar.d.ts +10 -0
- package/src/lib/Sidebar/Sidebar.styled.d.ts +117 -0
- package/src/lib/Sidebar/SidebarContext.d.ts +11 -0
- package/src/lib/Sidebar/SidebarDrawer.d.ts +9 -0
- package/src/lib/Sidebar/SidebarLink/MenuIcon.d.ts +7 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLink.d.ts +7 -0
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.d.ts +8 -0
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.d.ts +10 -0
- package/src/lib/Sidebar/SidebarLink/{index.ts → index.d.ts} +2 -2
- package/src/lib/Sidebar/index.d.ts +2 -0
- package/src/lib/Status/Status.d.ts +8 -0
- package/src/lib/Status/{index.ts → index.d.ts} +1 -1
- package/src/lib/StepperView/StepperView.d.ts +11 -0
- package/src/lib/StepperView/{index.ts → index.d.ts} +1 -1
- package/src/lib/Table/DataGrid/JsonTypeCell.d.ts +7 -0
- package/src/lib/Table/DataGrid/Table.d.ts +49 -0
- package/src/lib/Table/DataGrid/TableAction.d.ts +13 -0
- package/src/lib/Table/DataGrid/TableColumnMenu.d.ts +3 -0
- package/src/lib/Table/DataGrid/TablePagination.d.ts +3 -0
- package/src/lib/Table/DataGrid/index.d.ts +2 -0
- package/src/lib/Table/DataGrid/styles.d.ts +44 -0
- package/src/lib/Table/DataGrid/usePagination.d.ts +5 -0
- package/src/lib/Table/DataGrid/useTableQueryPagination.d.ts +11 -0
- package/src/lib/Table/DataGrid/useTableQuerySorting.d.ts +6 -0
- package/src/lib/Table/SimpleTable/SimpleTable.d.ts +17 -0
- package/src/lib/Table/SimpleTable/TableActionCell.d.ts +10 -0
- package/src/lib/Table/SimpleTable/index.d.ts +2 -0
- package/src/lib/Table/SimpleTable/useTablePagination.d.ts +7 -0
- package/src/lib/Table/SimpleTable/useTableSorting.d.ts +6 -0
- package/src/lib/Table/index.d.ts +2 -0
- package/src/lib/Tabs/RouteTabs.d.ts +11 -0
- package/src/lib/Tabs/TabPanel.d.ts +25 -0
- package/src/lib/Tabs/{index.ts → index.d.ts} +2 -2
- package/src/lib/{index.ts → index.d.ts} +16 -16
- package/src/theme/baseTheme.d.ts +2 -0
- package/src/theme/index.d.ts +1 -0
- package/src/theme/inputThemeOptions.d.ts +117 -0
- package/src/theme/stepperThemeOptions.d.ts +16 -0
- package/src/theme/tableThemeOptions.d.ts +47 -0
- package/src/theme/typographyThemeOptions.d.ts +29 -0
- package/src/utils/common.d.ts +7 -0
- package/src/utils/dem.d.ts +27 -0
- package/src/utils/hooks.d.ts +7 -0
- package/src/utils/{index.ts → index.d.ts} +5 -5
- package/src/utils/ui-utils.d.ts +16 -0
- package/src/utils/validators.d.ts +5 -0
- package/.babelrc +0 -13
- package/.eslintrc.json +0 -22
- package/jest.config.ts +0 -11
- package/project.json +0 -89
- package/rollup.config.js +0 -146
- package/src/assets/chevron_left_gray.svg +0 -3
- package/src/consts/index.ts +0 -13
- package/src/interfaces/common.ts +0 -18
- package/src/interfaces/definition.ts +0 -143
- package/src/interfaces/ui.ts +0 -80
- package/src/lib/Alert/Alert.tsx +0 -108
- package/src/lib/Alert/index.ts +0 -1
- package/src/lib/Breadcrumbs/Breadcrumbs.styled.tsx +0 -16
- package/src/lib/Breadcrumbs/Breadcrumbs.tsx +0 -40
- package/src/lib/ContentLayout/ContentLayout.tsx +0 -31
- package/src/lib/ContentLayout/index.ts +0 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.tsx +0 -78
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.tsx +0 -71
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.tsx +0 -54
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.tsx +0 -67
- package/src/lib/Forms/BackButton.tsx +0 -46
- package/src/lib/Forms/ControlAceEditor.tsx +0 -125
- package/src/lib/Forms/ControlAutocomplete.tsx +0 -145
- package/src/lib/Forms/ControlCheckbox.tsx +0 -113
- package/src/lib/Forms/ControlDate.tsx +0 -75
- package/src/lib/Forms/ControlDateTime.tsx +0 -77
- package/src/lib/Forms/ControlDebouncedInput.tsx +0 -80
- package/src/lib/Forms/ControlInput.tsx +0 -111
- package/src/lib/Forms/ControlNumberInput.tsx +0 -121
- package/src/lib/Forms/ControlQueryAutocomplete.tsx +0 -197
- package/src/lib/Forms/ControlRadio.tsx +0 -136
- package/src/lib/Forms/ControlSelect.tsx +0 -164
- package/src/lib/Forms/ControlSwitch.tsx +0 -71
- package/src/lib/Forms/ControlTime.tsx +0 -93
- package/src/lib/Forms/CopyButton.tsx +0 -46
- package/src/lib/Forms/useAutocomplete.tsx +0 -47
- package/src/lib/InfoItem/InfoItem.tsx +0 -40
- package/src/lib/InfoItem/styles.ts +0 -17
- package/src/lib/JsonPathPicker/JsonPathPicker.tsx +0 -73
- package/src/lib/JsonPathPicker/PropertyStep.tsx +0 -70
- package/src/lib/JsonView/JsonView.tsx +0 -41
- package/src/lib/Loader/Loader.tsx +0 -41
- package/src/lib/Modals/JsonModalView.tsx +0 -53
- package/src/lib/Property/PropertyFiller/JsonEditor.tsx +0 -58
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.tsx +0 -129
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.tsx +0 -85
- package/src/lib/Property/PropertyFiller/PropertyFiller.tsx +0 -199
- package/src/lib/Property/PropertyFiller/usePropertyFiller.ts +0 -72
- package/src/lib/Property/PropertyFiller/useStyles.ts +0 -12
- package/src/lib/Property/PropertyValidator/NodeValidator.tsx +0 -92
- package/src/lib/Property/PropertyValidator/NodesList.tsx +0 -26
- package/src/lib/Property/PropertyValidator/NumericTypeValidator.tsx +0 -59
- package/src/lib/Property/PropertyValidator/PropertyValidator.tsx +0 -42
- package/src/lib/Property/PropertyValidator/PropertyValidatorContext.tsx +0 -4
- package/src/lib/Property/PropertyValidator/StringTypeValidator.tsx +0 -36
- package/src/lib/Property/PropertyValidator/ValidationNodeSelector.tsx +0 -62
- package/src/lib/Property/PropertyValidator/index.ts +0 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.tsx +0 -49
- package/src/lib/Property/PropertyValueField/DateTimeValueField.tsx +0 -58
- package/src/lib/Property/PropertyValueField/DateValueField.tsx +0 -58
- package/src/lib/Property/PropertyValueField/JsonValueField.tsx +0 -65
- package/src/lib/Property/PropertyValueField/PropertyValueField.tsx +0 -49
- package/src/lib/Property/PropertyValueField/StringValueField.tsx +0 -50
- package/src/lib/Property/PropertyValueField/TimeValueField.tsx +0 -67
- package/src/lib/Property/PropertyWidget/PropertyWidget.tsx +0 -115
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.tsx +0 -148
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.tsx +0 -158
- package/src/lib/Property/UpsertProperty/CustomPropertyField.tsx +0 -40
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.tsx +0 -41
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.tsx +0 -27
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.tsx +0 -133
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.tsx +0 -46
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.tsx +0 -52
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.tsx +0 -103
- package/src/lib/Property/UpsertProperty/useCustomFields.ts +0 -22
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.tsx +0 -37
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.tsx +0 -40
- package/src/lib/Property/ViewProperty/EntityPropertiesView.tsx +0 -48
- package/src/lib/Property/ViewProperty/PropertyDataTable.tsx +0 -148
- package/src/lib/Property/ViewProperty/PropertyItem.tsx +0 -43
- package/src/lib/Property/ViewProperty/ViewProperty.tsx +0 -52
- package/src/lib/Sidebar/Sidebar.styled.tsx +0 -157
- package/src/lib/Sidebar/Sidebar.tsx +0 -27
- package/src/lib/Sidebar/SidebarContext.tsx +0 -37
- package/src/lib/Sidebar/SidebarDrawer.tsx +0 -50
- package/src/lib/Sidebar/SidebarLink/MenuIcon.tsx +0 -16
- package/src/lib/Sidebar/SidebarLink/SidebarLink.tsx +0 -54
- package/src/lib/Sidebar/SidebarLink/SidebarLinkItem.tsx +0 -54
- package/src/lib/Sidebar/SidebarLink/SidebarNestedItem.tsx +0 -62
- package/src/lib/Sidebar/index.ts +0 -2
- package/src/lib/Status/Status.tsx +0 -16
- package/src/lib/Status/styles.ts +0 -21
- package/src/lib/StepperView/StepperView.tsx +0 -73
- package/src/lib/Table/DataGrid/JsonTypeCell.tsx +0 -51
- package/src/lib/Table/DataGrid/Table.tsx +0 -117
- package/src/lib/Table/DataGrid/TableAction.tsx +0 -43
- package/src/lib/Table/DataGrid/TableColumnMenu.tsx +0 -12
- package/src/lib/Table/DataGrid/TablePagination.tsx +0 -42
- package/src/lib/Table/DataGrid/index.ts +0 -2
- package/src/lib/Table/DataGrid/styles.ts +0 -59
- package/src/lib/Table/DataGrid/usePagination.ts +0 -15
- package/src/lib/Table/DataGrid/useTableQueryPagination.ts +0 -47
- package/src/lib/Table/DataGrid/useTableQuerySorting.ts +0 -47
- package/src/lib/Table/SimpleTable/SimpleTable.tsx +0 -138
- package/src/lib/Table/SimpleTable/TableActionCell.tsx +0 -67
- package/src/lib/Table/SimpleTable/index.ts +0 -2
- package/src/lib/Table/SimpleTable/useTablePagination.ts +0 -54
- package/src/lib/Table/SimpleTable/useTableSorting.ts +0 -50
- package/src/lib/Table/index.ts +0 -2
- package/src/lib/Tabs/RouteTabs.tsx +0 -54
- package/src/lib/Tabs/TabPanel.tsx +0 -42
- package/src/theme/baseTheme.ts +0 -41
- package/src/theme/fonts.d.ts +0 -2
- package/src/theme/index.ts +0 -126
- package/src/theme/inputThemeOptions.ts +0 -126
- package/src/theme/stepperThemeOptions.ts +0 -20
- package/src/theme/tableThemeOptions.ts +0 -50
- package/src/theme/typographyThemeOptions.ts +0 -32
- package/src/utils/common.ts +0 -73
- package/src/utils/dem.ts +0 -431
- package/src/utils/hooks.ts +0 -41
- package/src/utils/ui-utils.tsx +0 -134
- package/src/utils/validators.ts +0 -14
- package/tsconfig.json +0 -25
- package/tsconfig.lib.json +0 -23
- package/tsconfig.spec.json +0 -20
@@ -1,138 +0,0 @@
|
|
1
|
-
import { ReactNode, forwardRef, ForwardedRef } from 'react';
|
2
|
-
import MuiTable from '@mui/material/Table';
|
3
|
-
import TableBody from '@mui/material/TableBody';
|
4
|
-
import TableCell from '@mui/material/TableCell';
|
5
|
-
import TableContainer from '@mui/material/TableContainer';
|
6
|
-
import TableHead from '@mui/material/TableHead';
|
7
|
-
import TablePagination from '@mui/material/TablePagination';
|
8
|
-
import TableRow from '@mui/material/TableRow';
|
9
|
-
import TableSortLabel from '@mui/material/TableSortLabel';
|
10
|
-
import TableFooter from '@mui/material/TableFooter';
|
11
|
-
|
12
|
-
import { Column, Row } from '../../../interfaces';
|
13
|
-
import { Loader } from '../../Loader';
|
14
|
-
import Backdrop from '@mui/material/Backdrop';
|
15
|
-
import useTablePagination from './useTablePagination';
|
16
|
-
import useTableSorting from './useTableSorting';
|
17
|
-
|
18
|
-
type SortDirection = "asc" | "desc";
|
19
|
-
|
20
|
-
interface Props<T> {
|
21
|
-
columns: Column<T>[];
|
22
|
-
rows: Row<T>[];
|
23
|
-
totalCount: number;
|
24
|
-
loading?: boolean;
|
25
|
-
pagination?: boolean;
|
26
|
-
onRowClick?: (row: Row<T>) => void;
|
27
|
-
children?: ReactNode;
|
28
|
-
verticalAlign?: 'top' | 'middle' | 'bottom' | 'sub' | 'baseline';
|
29
|
-
}
|
30
|
-
|
31
|
-
function TableInner<T>({
|
32
|
-
columns = [],
|
33
|
-
rows = [],
|
34
|
-
totalCount,
|
35
|
-
children,
|
36
|
-
pagination = true,
|
37
|
-
loading = false,
|
38
|
-
onRowClick,
|
39
|
-
verticalAlign = 'middle'
|
40
|
-
}: Props<T>, ref: ForwardedRef<HTMLTableElement>) {
|
41
|
-
const { page, size, onPageChange, onSizeChange } = useTablePagination();
|
42
|
-
const { onSortChanged, getColumnSorting } = useTableSorting();
|
43
|
-
|
44
|
-
return (
|
45
|
-
<TableContainer sx={{ position: 'relative', overflow: 'visible' }}>
|
46
|
-
<Backdrop open={loading} sx={{ position: 'absolute', top: 0, left: 0 }}>
|
47
|
-
<Loader />
|
48
|
-
</Backdrop>
|
49
|
-
<MuiTable ref={ref}>
|
50
|
-
<TableHead>
|
51
|
-
<TableRow>
|
52
|
-
{columns.map((column, index) => {
|
53
|
-
const sortDirection = column.sortKey
|
54
|
-
? getColumnSorting(column.sortKey)
|
55
|
-
: false;
|
56
|
-
return (
|
57
|
-
<TableCell
|
58
|
-
key={index}
|
59
|
-
align={column.align ? column.align : 'left'}
|
60
|
-
sortDirection={sortDirection as SortDirection}
|
61
|
-
sx={{ width: column.width ? `${column.width}%` : 'unset' }}
|
62
|
-
>
|
63
|
-
<TableSortLabel
|
64
|
-
active={!!sortDirection}
|
65
|
-
hideSortIcon={!column.sortKey}
|
66
|
-
direction={(sortDirection as SortDirection) || 'asc'}
|
67
|
-
onClick={() =>
|
68
|
-
column.sortKey ? onSortChanged(column.sortKey) : {}
|
69
|
-
}
|
70
|
-
>
|
71
|
-
{column.label}
|
72
|
-
</TableSortLabel>
|
73
|
-
</TableCell>
|
74
|
-
);
|
75
|
-
})}
|
76
|
-
</TableRow>
|
77
|
-
</TableHead>
|
78
|
-
<TableBody>
|
79
|
-
{rows.map((row, index) => (
|
80
|
-
<TableRow
|
81
|
-
hover
|
82
|
-
onClick={onRowClick ? () => onRowClick(row) : row.onClick}
|
83
|
-
key={index}
|
84
|
-
sx={{ verticalAlign }}
|
85
|
-
>
|
86
|
-
{columns.map((column, idx) => (
|
87
|
-
<TableCell
|
88
|
-
key={idx}
|
89
|
-
align={column.align ? column.align : 'left'}
|
90
|
-
sx={{ width: column.width ? `${column.width}%` : 'unset' }}
|
91
|
-
>
|
92
|
-
{column.renderCell
|
93
|
-
? column.renderCell(row, index)
|
94
|
-
: ((row as any)[column.id] as string)}
|
95
|
-
</TableCell>
|
96
|
-
))}
|
97
|
-
</TableRow>
|
98
|
-
))}
|
99
|
-
</TableBody>
|
100
|
-
{(pagination || children) ? (
|
101
|
-
<TableFooter>
|
102
|
-
<TableRow>
|
103
|
-
{
|
104
|
-
children && (
|
105
|
-
<TableCell
|
106
|
-
colSpan={columns.length}
|
107
|
-
sx={{ background: '#F0F0F7', px: 4, py: 3 }}
|
108
|
-
>
|
109
|
-
{children}
|
110
|
-
</TableCell>
|
111
|
-
)
|
112
|
-
}
|
113
|
-
{
|
114
|
-
pagination && rows.length && (
|
115
|
-
<TablePagination
|
116
|
-
rowsPerPageOptions={[5, 10, 25]}
|
117
|
-
count={totalCount}
|
118
|
-
rowsPerPage={+size}
|
119
|
-
page={+page}
|
120
|
-
sx={{ borderBottom: 'none' }}
|
121
|
-
onPageChange={(_, page) => onPageChange(page)}
|
122
|
-
onRowsPerPageChange={(event) =>
|
123
|
-
onSizeChange(+event.target.value)
|
124
|
-
}
|
125
|
-
/>
|
126
|
-
)
|
127
|
-
}
|
128
|
-
</TableRow>
|
129
|
-
</TableFooter>
|
130
|
-
) : null}
|
131
|
-
</MuiTable>
|
132
|
-
</TableContainer>
|
133
|
-
);
|
134
|
-
}
|
135
|
-
export const SimpleTable = forwardRef(TableInner) as <T>(
|
136
|
-
props: Props<T> & { ref?: ForwardedRef<HTMLTableElement> }
|
137
|
-
) => ReturnType<typeof TableInner>;
|
138
|
-
export default SimpleTable;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import { useState, MouseEvent } from 'react';
|
2
|
-
import IconButton from '@mui/material/IconButton';
|
3
|
-
import Menu from '@mui/material/Menu';
|
4
|
-
import MenuItem from '@mui/material/MenuItem';
|
5
|
-
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
6
|
-
|
7
|
-
type ActionItem = {
|
8
|
-
title: string;
|
9
|
-
onClick: (e?: MouseEvent<HTMLElement>) => void;
|
10
|
-
}
|
11
|
-
|
12
|
-
type Props = {
|
13
|
-
actionsList: ActionItem[]
|
14
|
-
}
|
15
|
-
|
16
|
-
export const TableActionCell = ({ actionsList }: Props) => {
|
17
|
-
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
18
|
-
const open = Boolean(anchorEl);
|
19
|
-
const handleClick = (e: MouseEvent<HTMLElement>) => {
|
20
|
-
e.stopPropagation();
|
21
|
-
setAnchorEl(e.currentTarget);
|
22
|
-
};
|
23
|
-
const handleClose = () => {
|
24
|
-
setAnchorEl(null);
|
25
|
-
};
|
26
|
-
return (
|
27
|
-
<div>
|
28
|
-
<IconButton
|
29
|
-
aria-label="more"
|
30
|
-
id="more-button"
|
31
|
-
aria-controls={open ? 'more-menu' : undefined}
|
32
|
-
aria-expanded={open ? 'true' : undefined}
|
33
|
-
aria-haspopup="true"
|
34
|
-
onClick={handleClick}
|
35
|
-
>
|
36
|
-
<MoreHorizIcon />
|
37
|
-
</IconButton>
|
38
|
-
<Menu
|
39
|
-
id="more-menu"
|
40
|
-
MenuListProps={{
|
41
|
-
'aria-labelledby': 'more-button',
|
42
|
-
}}
|
43
|
-
anchorEl={anchorEl}
|
44
|
-
open={open}
|
45
|
-
onClose={(e: MouseEvent<HTMLElement>) => {
|
46
|
-
e.stopPropagation();
|
47
|
-
handleClose();
|
48
|
-
}}
|
49
|
-
PaperProps={{
|
50
|
-
style: {
|
51
|
-
minWidth: '127px'
|
52
|
-
}
|
53
|
-
}}
|
54
|
-
>
|
55
|
-
{actionsList.map((option) => (
|
56
|
-
<MenuItem key={option.title} onClick={(e: MouseEvent<HTMLElement>) => {
|
57
|
-
e.stopPropagation();
|
58
|
-
if (option.onClick) option.onClick();
|
59
|
-
handleClose();
|
60
|
-
}}>
|
61
|
-
{option.title}
|
62
|
-
</MenuItem>
|
63
|
-
))}
|
64
|
-
</Menu>
|
65
|
-
</div>
|
66
|
-
)
|
67
|
-
}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
2
|
-
import { useSearchParams } from 'react-router-dom';
|
3
|
-
|
4
|
-
const useTablePagination = () => {
|
5
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
6
|
-
|
7
|
-
const page = useMemo(
|
8
|
-
() => searchParams.get('page') ?? 0,
|
9
|
-
[searchParams]
|
10
|
-
);
|
11
|
-
const size = useMemo(
|
12
|
-
() => searchParams.get('size') ?? 10,
|
13
|
-
[searchParams]
|
14
|
-
);
|
15
|
-
|
16
|
-
const onPageChange = useCallback(
|
17
|
-
(newPage: number) => {
|
18
|
-
setSearchParams((params) => {
|
19
|
-
params.set('page', `${newPage}`);
|
20
|
-
return params;
|
21
|
-
});
|
22
|
-
},
|
23
|
-
[setSearchParams]
|
24
|
-
);
|
25
|
-
|
26
|
-
const onSizeChange = useCallback(
|
27
|
-
(newSize: number) => {
|
28
|
-
setSearchParams((params) => {
|
29
|
-
params.set('size', `${newSize}`);
|
30
|
-
return params;
|
31
|
-
});
|
32
|
-
},
|
33
|
-
[setSearchParams]
|
34
|
-
);
|
35
|
-
|
36
|
-
useEffect(() => {
|
37
|
-
if (!searchParams.has('page')) {
|
38
|
-
setSearchParams((params) => {
|
39
|
-
params.set('page', '0');
|
40
|
-
return params;
|
41
|
-
});
|
42
|
-
}
|
43
|
-
if (!searchParams.has('size')) {
|
44
|
-
setSearchParams((params) => {
|
45
|
-
params.set('size', '10');
|
46
|
-
return params;
|
47
|
-
});
|
48
|
-
}
|
49
|
-
}, [searchParams, setSearchParams]);
|
50
|
-
|
51
|
-
return { page, size, onPageChange, onSizeChange };
|
52
|
-
};
|
53
|
-
|
54
|
-
export default useTablePagination;
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
2
|
-
import { useSearchParams } from 'react-router-dom';
|
3
|
-
|
4
|
-
const useTableSorting = () => {
|
5
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
6
|
-
|
7
|
-
const sortParams = useMemo(
|
8
|
-
() => searchParams.getAll('sort').map((param) => param.split(',')),
|
9
|
-
[searchParams]
|
10
|
-
);
|
11
|
-
|
12
|
-
const onSortChanged = useCallback(
|
13
|
-
(sortKey: string) => {
|
14
|
-
setSearchParams((params) => {
|
15
|
-
console.log(sortKey, params.get('page'));
|
16
|
-
params.delete('sort');
|
17
|
-
|
18
|
-
let keyFound = false;
|
19
|
-
sortParams.forEach(([key, value]) => {
|
20
|
-
if (key === sortKey) {
|
21
|
-
keyFound = true;
|
22
|
-
if (value === 'asc') {
|
23
|
-
params.append('sort', `${key},desc`);
|
24
|
-
}
|
25
|
-
} else {
|
26
|
-
params.append('sort', `${key},${value}`);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
|
30
|
-
if (!keyFound) {
|
31
|
-
params.append('sort', `${sortKey},asc`);
|
32
|
-
}
|
33
|
-
|
34
|
-
return params;
|
35
|
-
});
|
36
|
-
},
|
37
|
-
[sortParams, setSearchParams]
|
38
|
-
);
|
39
|
-
|
40
|
-
const getColumnSorting = useCallback(
|
41
|
-
(sortKey: string) => {
|
42
|
-
const sort = sortParams.find(([key, _]) => key === sortKey);
|
43
|
-
return sort ? sort[1] : false;
|
44
|
-
},
|
45
|
-
[sortParams]
|
46
|
-
);
|
47
|
-
|
48
|
-
return { sortParams, onSortChanged, getColumnSorting };
|
49
|
-
};
|
50
|
-
export default useTableSorting;
|
package/src/lib/Table/index.ts
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
import { useMemo } from 'react';
|
2
|
-
import Box from '@mui/material/Box';
|
3
|
-
import Paper from '@mui/material/Paper';
|
4
|
-
import Tab from '@mui/material/Tab';
|
5
|
-
import Tabs from '@mui/material/Tabs';
|
6
|
-
import TabPanel from './TabPanel';
|
7
|
-
|
8
|
-
import { useNavigate, useLocation } from 'react-router-dom';
|
9
|
-
|
10
|
-
interface RouteTab {
|
11
|
-
name: string;
|
12
|
-
label: string;
|
13
|
-
component: React.ReactElement;
|
14
|
-
}
|
15
|
-
|
16
|
-
interface Props {
|
17
|
-
tabs: RouteTab[];
|
18
|
-
}
|
19
|
-
|
20
|
-
export const RouteTabs = (props: Props) => {
|
21
|
-
const { tabs } = props;
|
22
|
-
|
23
|
-
const navigate = useNavigate();
|
24
|
-
const location = useLocation();
|
25
|
-
|
26
|
-
const queryParams = useMemo(() => new URLSearchParams(location.search), [location.search]);
|
27
|
-
const value = queryParams.get('tab');
|
28
|
-
|
29
|
-
const handleChange = (event, newValue: string) => {
|
30
|
-
queryParams.set('tab', newValue);
|
31
|
-
navigate({ pathname: location.pathname, search: queryParams.toString() }, { replace: true });
|
32
|
-
};
|
33
|
-
|
34
|
-
return (
|
35
|
-
<Box>
|
36
|
-
<Paper>
|
37
|
-
<Tabs value={value || tabs[0]?.name} indicatorColor="primary" textColor="primary" onChange={handleChange}>
|
38
|
-
{tabs.map((tab) => (
|
39
|
-
<Tab key={tab.name} value={tab.name} label={tab.label} />
|
40
|
-
))}
|
41
|
-
</Tabs>
|
42
|
-
</Paper>
|
43
|
-
<Box mt={2}>
|
44
|
-
{tabs.map((tab) => (
|
45
|
-
<TabPanel key={tab.name} value={value || tabs[0]?.name} index={tab.name}>
|
46
|
-
{tab.component}
|
47
|
-
</TabPanel>
|
48
|
-
))}
|
49
|
-
</Box>
|
50
|
-
</Box>
|
51
|
-
);
|
52
|
-
};
|
53
|
-
|
54
|
-
export default RouteTabs;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* This interface is referencing the [[TabPanel]] component props.
|
5
|
-
* @category Common UI components
|
6
|
-
*/
|
7
|
-
export interface TabPanelProps {
|
8
|
-
/**
|
9
|
-
* Active tab value
|
10
|
-
*/
|
11
|
-
value: number | string;
|
12
|
-
/**
|
13
|
-
* Index of current panel
|
14
|
-
*/
|
15
|
-
index: number | string;
|
16
|
-
/**
|
17
|
-
* Rendered children component
|
18
|
-
*/
|
19
|
-
children: React.ReactElement;
|
20
|
-
}
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Tab panel component. Used with tabs component
|
24
|
-
* @category Common UI components
|
25
|
-
*/
|
26
|
-
export const TabPanel = (props: TabPanelProps) => {
|
27
|
-
const { children, value, index, ...other } = props;
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div
|
31
|
-
role="tabpanel"
|
32
|
-
hidden={value !== index}
|
33
|
-
id={`simple-tabpanel-${index}`}
|
34
|
-
aria-labelledby={`simple-tab-${index}`}
|
35
|
-
{...other}
|
36
|
-
>
|
37
|
-
{value === index ? children : null}
|
38
|
-
</div>
|
39
|
-
);
|
40
|
-
};
|
41
|
-
|
42
|
-
export default TabPanel;
|
package/src/theme/baseTheme.ts
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
import { createTheme } from '@mui/material/styles';
|
2
|
-
|
3
|
-
const baseThemeOptions = {
|
4
|
-
spacing: 4,
|
5
|
-
palette: {
|
6
|
-
primary: {
|
7
|
-
main: '#E0613A',
|
8
|
-
dark: '#d9512e',
|
9
|
-
light: '#E0613A',
|
10
|
-
},
|
11
|
-
secondary: {
|
12
|
-
main: '#007994',
|
13
|
-
dark: '#262842',
|
14
|
-
light: '#cbe8ee',
|
15
|
-
},
|
16
|
-
text: {
|
17
|
-
disabled: '#A9A9B8',
|
18
|
-
},
|
19
|
-
success: {
|
20
|
-
main: '#2DB77B',
|
21
|
-
light: '#DBFCEE',
|
22
|
-
},
|
23
|
-
grey: {
|
24
|
-
700: '#101F2B',
|
25
|
-
},
|
26
|
-
},
|
27
|
-
typography: {
|
28
|
-
fontSize: 14,
|
29
|
-
h1: {
|
30
|
-
fontWeight: 400,
|
31
|
-
},
|
32
|
-
h3: {
|
33
|
-
fontWeight: 500,
|
34
|
-
},
|
35
|
-
h4: {
|
36
|
-
fontWeight: 500,
|
37
|
-
},
|
38
|
-
},
|
39
|
-
};
|
40
|
-
|
41
|
-
export default createTheme(baseThemeOptions);
|
package/src/theme/fonts.d.ts
DELETED
package/src/theme/index.ts
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
import { createTheme, responsiveFontSizes } from '@mui/material/styles';
|
2
|
-
import baseTheme from './baseTheme';
|
3
|
-
import inputThemeOptions from './inputThemeOptions';
|
4
|
-
import tableThemeOptions from './tableThemeOptions';
|
5
|
-
import stepperThemeOptions from './stepperThemeOptions';
|
6
|
-
import typographyThemeOptions from './typographyThemeOptions';
|
7
|
-
|
8
|
-
export const theme = responsiveFontSizes(
|
9
|
-
createTheme(baseTheme, {
|
10
|
-
components: {
|
11
|
-
...inputThemeOptions.components,
|
12
|
-
...tableThemeOptions.components,
|
13
|
-
...stepperThemeOptions.components,
|
14
|
-
...typographyThemeOptions.components,
|
15
|
-
MuiToolbar: {
|
16
|
-
styleOverrides: {
|
17
|
-
root: {
|
18
|
-
[baseTheme.breakpoints.up('sm')]: {
|
19
|
-
minHeight: '56px',
|
20
|
-
},
|
21
|
-
},
|
22
|
-
},
|
23
|
-
},
|
24
|
-
// MuiBackdrop: {
|
25
|
-
// styleOverrides: {
|
26
|
-
// root: {
|
27
|
-
// backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
28
|
-
// },
|
29
|
-
// },
|
30
|
-
// },
|
31
|
-
MuiAppBar: {
|
32
|
-
styleOverrides: {
|
33
|
-
root: {
|
34
|
-
boxShadow: 'none',
|
35
|
-
backgroundColor: '#007F9B',
|
36
|
-
},
|
37
|
-
},
|
38
|
-
},
|
39
|
-
MuiButton: {
|
40
|
-
styleOverrides: {
|
41
|
-
root: {
|
42
|
-
borderRadius: baseTheme.spacing(2.5),
|
43
|
-
padding: baseTheme.spacing(2.5, 4),
|
44
|
-
lineHeight: '20px',
|
45
|
-
fontSize: '1rem',
|
46
|
-
textTransform: 'none'
|
47
|
-
},
|
48
|
-
outlined: {
|
49
|
-
color: '#262842',
|
50
|
-
backgroundColor: '#FFFFFF !important',
|
51
|
-
border: '1px solid rgba(38, 40, 66, 0.12)',
|
52
|
-
},
|
53
|
-
text: {
|
54
|
-
color: baseTheme.palette.secondary.dark
|
55
|
-
}
|
56
|
-
},
|
57
|
-
},
|
58
|
-
MuiDialog: {
|
59
|
-
styleOverrides: {
|
60
|
-
root: {
|
61
|
-
'& .MuiModal-backdrop': {
|
62
|
-
background: 'rgba(28, 55, 77, 0.5)',
|
63
|
-
backdropFilter: 'blur(2px)',
|
64
|
-
},
|
65
|
-
},
|
66
|
-
paper: {
|
67
|
-
borderRadius: baseTheme.spacing(3)
|
68
|
-
},
|
69
|
-
paperWidthXs: {
|
70
|
-
maxWidth: 500
|
71
|
-
}
|
72
|
-
},
|
73
|
-
},
|
74
|
-
// MuiPaper: {
|
75
|
-
// styleOverrides: {
|
76
|
-
// root: {
|
77
|
-
// borderRadius: baseTheme.spacing(3),
|
78
|
-
// },
|
79
|
-
// },
|
80
|
-
// },
|
81
|
-
MuiDialogContent: {
|
82
|
-
styleOverrides: {
|
83
|
-
root: {
|
84
|
-
color: '#6D6E85',
|
85
|
-
},
|
86
|
-
},
|
87
|
-
},
|
88
|
-
MuiDialogActions: {
|
89
|
-
styleOverrides: {
|
90
|
-
root: {
|
91
|
-
background: '#F7F8FC',
|
92
|
-
borderTop: '1px solid rgba(38, 40, 66, 0.08)',
|
93
|
-
padding: baseTheme.spacing(3, 6)
|
94
|
-
},
|
95
|
-
},
|
96
|
-
},
|
97
|
-
MuiTabs: {
|
98
|
-
styleOverrides: {
|
99
|
-
root: {
|
100
|
-
minHeight: '38px',
|
101
|
-
},
|
102
|
-
indicator: {
|
103
|
-
backgroundColor: baseTheme.palette.secondary.main
|
104
|
-
}
|
105
|
-
}
|
106
|
-
},
|
107
|
-
MuiTab: {
|
108
|
-
styleOverrides: {
|
109
|
-
root: {
|
110
|
-
fontSize: 14,
|
111
|
-
fontWeight: 500,
|
112
|
-
textTransform: 'none',
|
113
|
-
padding: '10px 12px',
|
114
|
-
lineHeight: '1.125rem',
|
115
|
-
minHeight: '38px',
|
116
|
-
color: '#8B8C9E',
|
117
|
-
'&.Mui-selected': {
|
118
|
-
color: baseTheme.palette.secondary.main
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
122
|
-
}
|
123
|
-
},
|
124
|
-
})
|
125
|
-
);
|
126
|
-
|