@lgsm/modules 1.6.20-beta.3 → 1.6.20-beta.4
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/README.md +61 -1
- package/dist/assets/main.css +1 -1
- package/dist/components/ui/alert-dialog.d.ts +14 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +21 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +28841 -3858
- package/dist/shared-ui/DataTable/components/customFilterControl.d.ts +8 -0
- package/dist/shared-ui/DataTable/components/dataTable.d.ts +3 -0
- package/dist/shared-ui/DataTable/components/dataTableBody.d.ts +7 -0
- package/dist/shared-ui/DataTable/components/dataTablePagination.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/dataTableToolbar.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/detailTableCard.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/dropdownCell.d.ts +13 -0
- package/dist/shared-ui/DataTable/components/editableCell.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/errorWrapper.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/filterPanel.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/memoRow.d.ts +16 -0
- package/dist/shared-ui/DataTable/components/multiSelectCell.d.ts +11 -0
- package/dist/shared-ui/DataTable/components/pageInput.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/saveConfirmDialog.d.ts +2 -0
- package/dist/shared-ui/DataTable/components/serverTable.d.ts +34 -0
- package/dist/shared-ui/DataTable/components/sortableHeader.d.ts +7 -0
- package/dist/shared-ui/DataTable/components/uploadAssetImage.d.ts +2 -0
- package/dist/shared-ui/DataTable/hooks/hooks.d.ts +79 -0
- package/dist/shared-ui/DataTable/hooks/useColumnDefinitions.d.ts +6 -0
- package/dist/shared-ui/DataTable/hooks/useEditing.d.ts +21 -0
- package/dist/shared-ui/DataTable/hooks/useFilterPanel.d.ts +13 -0
- package/dist/shared-ui/DataTable/hooks/usePageInput.d.ts +6 -0
- package/dist/shared-ui/DataTable/hooks/useRowIdentity.d.ts +5 -0
- package/dist/shared-ui/DataTable/hooks/useSelection.d.ts +6 -0
- package/dist/shared-ui/DataTable/hooks/useTableData.d.ts +9 -0
- package/dist/shared-ui/DataTable/hooks/useTableStatus.d.ts +17 -0
- package/dist/shared-ui/DataTable/index.d.ts +25 -0
- package/dist/shared-ui/DataTable/types/button.d.ts +12 -0
- package/dist/shared-ui/DataTable/types/column/actionColumn.d.ts +4 -0
- package/dist/shared-ui/DataTable/types/column/baseColumn.d.ts +7 -0
- package/dist/shared-ui/DataTable/types/column/columnConfig.d.ts +13 -0
- package/dist/shared-ui/DataTable/types/column/columnDefinitions.d.ts +35 -0
- package/dist/shared-ui/DataTable/types/column/columnLayout.d.ts +5 -0
- package/dist/shared-ui/DataTable/types/column/columnType.d.ts +1 -0
- package/dist/shared-ui/DataTable/types/column/editableCell.d.ts +4 -0
- package/dist/shared-ui/DataTable/types/column/editableColumn.d.ts +5 -0
- package/dist/shared-ui/DataTable/types/column/optionColumn.d.ts +9 -0
- package/dist/shared-ui/DataTable/types/column/renderColumn.d.ts +6 -0
- package/dist/shared-ui/DataTable/types/column/treeColumn.d.ts +3 -0
- package/dist/shared-ui/DataTable/types/column/validateColumn.d.ts +4 -0
- package/dist/shared-ui/DataTable/types/column/visibilityColumn.d.ts +6 -0
- package/dist/shared-ui/DataTable/types/filtering.d.ts +43 -0
- package/dist/shared-ui/DataTable/types/hooks/useEditingProps.d.ts +8 -0
- package/dist/shared-ui/DataTable/types/hooks/useFilterPanel.d.ts +7 -0
- package/dist/shared-ui/DataTable/types/pagination.d.ts +5 -0
- package/dist/shared-ui/DataTable/types/sorting.d.ts +5 -0
- package/dist/shared-ui/DataTable/types/table/baseDataTable.d.ts +5 -0
- package/dist/shared-ui/DataTable/types/table/crudOptions.d.ts +12 -0
- package/dist/shared-ui/DataTable/types/table/dataTable.d.ts +46 -0
- package/dist/shared-ui/DataTable/types/table/dataTableBodyProps.d.ts +23 -0
- package/dist/shared-ui/DataTable/types/table/dataTablePaginationProps.d.ts +13 -0
- package/dist/shared-ui/DataTable/types/table/dataTableToolbarProps.d.ts +46 -0
- package/dist/shared-ui/DataTable/types/table/errorWrapper.d.ts +4 -0
- package/dist/shared-ui/DataTable/types/table/importExportOptions.d.ts +12 -0
- package/dist/shared-ui/DataTable/types/table/saveConfirmDialog.d.ts +11 -0
- package/dist/shared-ui/DataTable/types/table/serverSideConfig.d.ts +38 -0
- package/dist/shared-ui/DataTable/types/table/statusConfig.d.ts +15 -0
- package/dist/shared-ui/DataTable/types/table/tableMeta.d.ts +3 -0
- package/dist/shared-ui/DataTable/types/table/tablePermissions.d.ts +6 -0
- package/dist/shared-ui/DataTable/types/table/treeOptions.d.ts +7 -0
- package/dist/shared-ui/DataTable/types/table-panel/detailTableCard.d.ts +12 -0
- package/dist/shared-ui/DataTable/utils/column.d.ts +11 -0
- package/dist/shared-ui/DataTable/utils/compare.d.ts +2 -0
- package/dist/shared-ui/DataTable/utils/filter.d.ts +2 -0
- package/dist/shared-ui/DataTable/utils/image.d.ts +4 -0
- package/dist/shared-ui/DataTable/utils/index.d.ts +6 -0
- package/dist/shared-ui/DataTable/utils/row.d.ts +2 -0
- package/dist/shared-ui/DataTable/utils/search.d.ts +4 -0
- package/dist/shared-ui/DataTable/utils/status.d.ts +18 -0
- package/dist/shared-ui/DataTable/utils/tree.d.ts +3 -0
- package/dist/utils/date.d.ts +1 -0
- package/dist/utils/excel.d.ts +1 -0
- package/package.json +15 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomFilter } from '../types/filtering';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface CustomFilterControlProps {
|
|
4
|
+
filter: CustomFilter;
|
|
5
|
+
value: any;
|
|
6
|
+
onChange: (value: any) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CustomFilterControl: React.FC<CustomFilterControlProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TableBody } from '../../../components/ui/table';
|
|
2
|
+
import { DataTableBodyProps } from '../types/table/dataTableBodyProps';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export declare const MemoizedTableBody: React.MemoExoticComponent<({ freeze, ...props }: React.ComponentProps<typeof TableBody> & {
|
|
5
|
+
freeze?: boolean | string;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export declare function DataTableBody({ permissions, table, columnsCount, columnConfig, loading, editingRows, newRowIds, editedRows, rowsToDisable, rowsToEnable, rowsToDelete, selectedRows, errors, getRowId, onRowClick, activeRowId, statusKey, }: DataTableBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DataTablePaginationProps } from '../types/table/dataTablePaginationProps';
|
|
2
|
+
export declare function DataTablePagination({ pageIndex, pageSize, pageCount, totalRows, canPreviousPage, canNextPage, setPageSize, previousPage, nextPage, rowsPerPageOptions, }: DataTablePaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DataTableToolbarProps } from '../types/table/dataTableToolbarProps';
|
|
2
|
+
export declare function DataTableToolbar({ globalFilter, setQuery, searchPlaceholder, hasFilters, showFilterPanel, setShowFilterPanel, showStatusFilter, setStatusFilter, switchKey, displayFilter, setDisplayFilter, setPagination, customFilters, activeFilters, setActiveFilters, onResetFilters, hasActiveCustomFilters, exportAction, enableExport, handleExport, importAction, importOptions, canPerformGlobalAction, statusConfig, statusFilter, onAdd, addNewRow, markDisabled, markEnabled, markDeleted, onDeleteMulti, selectedRow, selectedRowCount, noneEligibleForDisable, noneEligibleForEnable, canDeleteSelection, hasChanges, saving, hasValidationErrors, setShowSaveDialog, }: DataTableToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface DropdownCellProps {
|
|
3
|
+
value: any;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
}[] | undefined;
|
|
8
|
+
searchable?: boolean;
|
|
9
|
+
isNew?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onChange: (value: any) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const DropdownCell: React.FC<DropdownCellProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TablePermissions } from '../types/table/tablePermissions';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare const MemoRow: React.FC<{
|
|
4
|
+
permissions: TablePermissions;
|
|
5
|
+
row: any;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
onClick?: any;
|
|
10
|
+
idKey: string;
|
|
11
|
+
canEdit: boolean;
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
hasError?: boolean;
|
|
14
|
+
isExpanded?: boolean;
|
|
15
|
+
columnConfig?: unknown;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface MultiSelectCellProps {
|
|
3
|
+
value: any;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
}[] | undefined;
|
|
8
|
+
onUpdate: (newIds: string[]) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const MultiSelectCell: React.FC<MultiSelectCellProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SaveConfirmDialogProps } from '../types/table/saveConfirmDialog';
|
|
2
|
+
export declare function SaveConfirmDialog({ open, onOpenChange, onConfirm, saving, newRowCount, editedRowCount, disableCount, enableCount, deleteCount, }: SaveConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { ColumnConfig } from '../types/column/columnConfig';
|
|
3
|
+
import { TablePermissions } from '../types/table/tablePermissions';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export interface ServerTableProps<TData = any> {
|
|
6
|
+
permissions?: TablePermissions;
|
|
7
|
+
columns?: ColumnConfig[];
|
|
8
|
+
/** Pass raw TanStack ColumnDef[] to bypass ColumnConfig conversion */
|
|
9
|
+
columnDefs?: ColumnDef<TData>[];
|
|
10
|
+
data: TData[];
|
|
11
|
+
totalCount: number;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
headerActions?: React.ReactNode;
|
|
15
|
+
filters?: React.ReactNode;
|
|
16
|
+
sorting?: {
|
|
17
|
+
id: string;
|
|
18
|
+
desc: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
onSortingChange?: (sorting: {
|
|
21
|
+
id: string;
|
|
22
|
+
desc: boolean;
|
|
23
|
+
}[]) => void;
|
|
24
|
+
pageIndex: number;
|
|
25
|
+
pageSize: number;
|
|
26
|
+
onPageChange?: (page: number) => void;
|
|
27
|
+
onPageSizeChange?: (size: number) => void;
|
|
28
|
+
pageSizeOptions?: number[];
|
|
29
|
+
getRowId?: (row: TData) => string;
|
|
30
|
+
onRowClick?: (row: TData) => void;
|
|
31
|
+
showStatusColumn?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function ServerTable<TData = any>({ permissions, columns, columnDefs, data, totalCount, loading, title, headerActions, filters, sorting, onSortingChange, pageIndex, pageSize, onPageChange, onPageSizeChange, pageSizeOptions, getRowId, onRowClick, showStatusColumn, className, }: ServerTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SortableHeaderProps {
|
|
3
|
+
column: any;
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function SortableHeader({ column, title, className }: SortableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PaginationState, SortingState } from '@tanstack/react-table';
|
|
2
|
+
import { DataTable } from '../types/table/dataTable';
|
|
3
|
+
import { canPerformAction } from '../utils';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export declare function useDataTableState(props: DataTable): {
|
|
6
|
+
state: {
|
|
7
|
+
editedRows: Set<string>;
|
|
8
|
+
newRowIds: Set<string>;
|
|
9
|
+
editingRows: Set<string>;
|
|
10
|
+
hasEditableRows: boolean;
|
|
11
|
+
filterValues: Record<string, string>;
|
|
12
|
+
statusFilter: string;
|
|
13
|
+
effectiveData: any[];
|
|
14
|
+
rowsToDisable: Set<string>;
|
|
15
|
+
rowsToEnable: Set<string>;
|
|
16
|
+
rowsToDelete: Set<string>;
|
|
17
|
+
selectedRows: Set<string>;
|
|
18
|
+
errors: Map<string, Map<string, string>>;
|
|
19
|
+
sorting: SortingState;
|
|
20
|
+
globalFilter: string;
|
|
21
|
+
pagination: PaginationState;
|
|
22
|
+
saving: boolean;
|
|
23
|
+
showSaveDialog: boolean;
|
|
24
|
+
displayFilter: "yes" | "no" | "all";
|
|
25
|
+
switchKey: string | undefined;
|
|
26
|
+
state: {
|
|
27
|
+
tableData: any[];
|
|
28
|
+
setTableData: React.Dispatch<React.SetStateAction<any[]>>;
|
|
29
|
+
originalData: Map<string, any>;
|
|
30
|
+
setOriginalData: React.Dispatch<React.SetStateAction<Map<string, any>>>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
set: {
|
|
34
|
+
setFilterValues: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
35
|
+
setStatusFilter: React.Dispatch<React.SetStateAction<string>>;
|
|
36
|
+
setSorting: React.Dispatch<React.SetStateAction<SortingState>>;
|
|
37
|
+
setPagination: React.Dispatch<React.SetStateAction<PaginationState>>;
|
|
38
|
+
setShowSaveDialog: React.Dispatch<React.SetStateAction<boolean>>;
|
|
39
|
+
setSaving: React.Dispatch<React.SetStateAction<boolean>>;
|
|
40
|
+
setDisplayFilter: React.Dispatch<React.SetStateAction<"yes" | "no" | "all">>;
|
|
41
|
+
setSelectedRows: (updater: Set<string> | ((prev: Set<string>) => Set<string>)) => void;
|
|
42
|
+
};
|
|
43
|
+
ids: {
|
|
44
|
+
getRowId: (row: any) => any;
|
|
45
|
+
rowIdentity: {
|
|
46
|
+
action: {
|
|
47
|
+
getRowId: (row: any) => any;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
utils: {
|
|
52
|
+
cancelEdit: (target: string | Set<string>) => void;
|
|
53
|
+
cancelNewRow: (id: string) => void;
|
|
54
|
+
updateData: (rowId: string, columnId: string, value: any) => void;
|
|
55
|
+
handleEditRow: (id: Set<string>) => void;
|
|
56
|
+
validateRow: (row: any, rowId: string) => Map<string, string>;
|
|
57
|
+
hasChanges: () => boolean;
|
|
58
|
+
setQuery: (q: string) => void;
|
|
59
|
+
handleSaveAll: () => Promise<boolean | undefined>;
|
|
60
|
+
hasValidationErrors: () => boolean;
|
|
61
|
+
isPendingActive: (id: string) => boolean;
|
|
62
|
+
canPerformAction: typeof canPerformAction;
|
|
63
|
+
getRowById: (id: string) => any;
|
|
64
|
+
};
|
|
65
|
+
actions: {
|
|
66
|
+
cancelEdit: (target: string | Set<string>) => void;
|
|
67
|
+
cancelNewRow: (id: string) => void;
|
|
68
|
+
updateData: (rowId: string, columnId: string, value: any) => void;
|
|
69
|
+
handleEditRow: (id: Set<string>) => void;
|
|
70
|
+
canPerformGlobalActionTable: (actionKey: string, config?: import('..').StatusConfig) => boolean;
|
|
71
|
+
addNewRow: () => void;
|
|
72
|
+
markDisabled: () => void;
|
|
73
|
+
cancelDeletion: (id: string) => void;
|
|
74
|
+
resetAfterSave: (finalData: any[]) => void;
|
|
75
|
+
markEnabled: () => void;
|
|
76
|
+
markDeleted: () => void;
|
|
77
|
+
cancelHardDelete: (id: string) => void;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ColumnDef, Row } from '@tanstack/react-table';
|
|
2
|
+
import { UseColumnDefinitionsOptions } from '../types/column/columnDefinitions';
|
|
3
|
+
export declare function useColumnDefinitions({ permissions, columnConfig, showStatusColumn, statusKey, enableExpand, statusConfig, defaultMinWidth, nonSortableKeys, editingRows, newRowIds, editedRows, rowsToDisable, rowsToEnable, rowsToDelete, selectedRows, errors, getRowId, updateData, setSelectedRows, cancelEdit, cancelNewRow, cancelDeletion, cancelHardDelete, canPerformAction, onImageUpload, onRowClick, }: UseColumnDefinitionsOptions): {
|
|
4
|
+
columns: ColumnDef<any>[];
|
|
5
|
+
handleRowSelection: (row: Row<any>, checked: boolean, currentVisibleRows?: Row<any>[]) => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UseEditingProps } from '../types/hooks/useEditingProps';
|
|
3
|
+
export declare function UseEditing({ setTableData, originalData, getRowId, subRowsKey, rowsToDisable, setSelectedRows, }: UseEditingProps): {
|
|
4
|
+
state: {
|
|
5
|
+
editedRows: Set<string>;
|
|
6
|
+
newRowIds: Set<string>;
|
|
7
|
+
editingRows: Set<string>;
|
|
8
|
+
hasEditableRows: boolean;
|
|
9
|
+
};
|
|
10
|
+
set: {
|
|
11
|
+
setEditedRows: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
12
|
+
setNewRowIds: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
13
|
+
setEditingRows: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
14
|
+
};
|
|
15
|
+
actions: {
|
|
16
|
+
cancelEdit: (target: string | Set<string>) => void;
|
|
17
|
+
cancelNewRow: (id: string) => void;
|
|
18
|
+
updateData: (rowId: string, columnId: string, value: any) => void;
|
|
19
|
+
handleEditRow: (id: Set<string>) => void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterField } from '../types/filtering';
|
|
2
|
+
import { UseFilterPanelOptions } from '../types/hooks/useFilterPanel';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export declare function useFilterPanel({ columnConfig, setFilterValues, setPagination, }: UseFilterPanelOptions): {
|
|
5
|
+
showFilterPanel: boolean;
|
|
6
|
+
setShowFilterPanel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
+
filterDraft: Record<string, string>;
|
|
8
|
+
setFilterDraft: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
9
|
+
filterFields: FilterField[];
|
|
10
|
+
hasFilters: boolean;
|
|
11
|
+
applyFilters: () => void;
|
|
12
|
+
resetFilters: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare function UseTableData(rows: any[], statusKey: string, subRowsKey: string, getRowId: (row: any) => string): {
|
|
3
|
+
state: {
|
|
4
|
+
tableData: any[];
|
|
5
|
+
setTableData: React.Dispatch<React.SetStateAction<any[]>>;
|
|
6
|
+
originalData: Map<string, any>;
|
|
7
|
+
setOriginalData: React.Dispatch<React.SetStateAction<Map<string, any>>>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StatusConfig } from '../types/table/statusConfig';
|
|
3
|
+
import { TablePermissions } from '../types/table/tablePermissions';
|
|
4
|
+
export declare function useTableStatus({ statusConfig, permissions, }: {
|
|
5
|
+
statusConfig?: StatusConfig;
|
|
6
|
+
permissions?: TablePermissions;
|
|
7
|
+
}): {
|
|
8
|
+
state: {
|
|
9
|
+
statusFilter: string;
|
|
10
|
+
};
|
|
11
|
+
set: {
|
|
12
|
+
setStatusFilter: React.Dispatch<React.SetStateAction<string>>;
|
|
13
|
+
};
|
|
14
|
+
actions: {
|
|
15
|
+
canPerformGlobalActionTable: (actionKey: string, config?: StatusConfig) => boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export { DataTable } from './components/dataTable';
|
|
2
|
+
export { ServerTable } from './components/serverTable';
|
|
3
|
+
export { SortableHeader } from './components/sortableHeader';
|
|
4
|
+
export { DetailTableCard } from './components/detailTableCard';
|
|
5
|
+
export { EditableCell } from './components/editableCell';
|
|
6
|
+
export { DataTableToolbar } from './components/dataTableToolbar';
|
|
7
|
+
export { DataTablePagination } from './components/dataTablePagination';
|
|
8
|
+
export { DataTableBody, MemoizedTableBody } from './components/dataTableBody';
|
|
9
|
+
export { SaveConfirmDialog } from './components/saveConfirmDialog';
|
|
10
|
+
export { CustomFilterControl } from './components/customFilterControl';
|
|
11
|
+
export { exportToExcel } from '../../utils/excel';
|
|
12
|
+
export { useDataTableState } from './hooks/hooks';
|
|
13
|
+
export type { DataTable as DataTableProps } from './types/table/dataTable';
|
|
14
|
+
export type { ServerTableProps } from './components/serverTable';
|
|
15
|
+
export type { ServerSideConfig, ServerFetchParams, ServerTableConfig, } from './types/table/serverSideConfig';
|
|
16
|
+
export type { ColumnConfig } from './types/column/columnConfig';
|
|
17
|
+
export type { ColumnType } from './types/column/columnType';
|
|
18
|
+
export type { ButtonSet, TableButton } from './types/button';
|
|
19
|
+
export type { ImportOption } from './types/table/importExportOptions';
|
|
20
|
+
export type { StatusConfig } from './types/table/statusConfig';
|
|
21
|
+
export type { CustomFilter } from './types/filtering';
|
|
22
|
+
export type { SortField, SortDirection } from './types/sorting';
|
|
23
|
+
export type { TableMeta } from './types/table/tableMeta';
|
|
24
|
+
export type { CellContext, ColumnDef, PaginationState, SortingState, ExpandedState, Row, } from '@tanstack/react-table';
|
|
25
|
+
export type { TablePermissions } from './types/table/tablePermissions';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CellContext } from '@tanstack/react-table';
|
|
2
|
+
export interface ButtonSet {
|
|
3
|
+
value: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TableButton {
|
|
7
|
+
key: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
action: (row?: any, ctx?: CellContext<any, any>) => void;
|
|
10
|
+
icons?: React.ReactNode | ((row: any) => React.ReactNode);
|
|
11
|
+
disabled?: boolean | ((row: any) => boolean);
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterableColumn } from '../filtering';
|
|
2
|
+
import { SortableColumn } from '../sorting';
|
|
3
|
+
import { ActionColumn } from './actionColumn';
|
|
4
|
+
import { BaseColumn } from './baseColumn';
|
|
5
|
+
import { ColumnLayout } from './columnLayout';
|
|
6
|
+
import { EditableColumn } from './editableColumn';
|
|
7
|
+
import { OptionColumn } from './optionColumn';
|
|
8
|
+
import { RenderColumn } from './renderColumn';
|
|
9
|
+
import { TreeColumn } from './treeColumn';
|
|
10
|
+
import { ValidateColumn } from './validateColumn';
|
|
11
|
+
import { VisibilityColumn } from './visibilityColumn';
|
|
12
|
+
export interface ColumnConfig extends BaseColumn, ColumnLayout, FilterableColumn, ActionColumn, TreeColumn, SortableColumn, OptionColumn, RenderColumn, ValidateColumn, EditableColumn, VisibilityColumn {
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { StatusConfig } from '../table/statusConfig';
|
|
2
|
+
import { ColumnConfig } from './columnConfig';
|
|
3
|
+
import { TablePermissions } from '../table/tablePermissions';
|
|
4
|
+
export interface UseColumnDefinitionsOptions {
|
|
5
|
+
permissions?: TablePermissions;
|
|
6
|
+
columnConfig: ColumnConfig[];
|
|
7
|
+
showStatusColumn: boolean;
|
|
8
|
+
statusKey: string;
|
|
9
|
+
enableExpand: boolean;
|
|
10
|
+
statusConfig?: StatusConfig;
|
|
11
|
+
editingRows: Set<string>;
|
|
12
|
+
newRowIds: Set<string>;
|
|
13
|
+
editedRows: Set<string>;
|
|
14
|
+
rowsToDisable: Set<string>;
|
|
15
|
+
rowsToEnable: Set<string>;
|
|
16
|
+
rowsToDelete: Set<string>;
|
|
17
|
+
selectedRows: Set<string>;
|
|
18
|
+
errors: Map<string, Map<string, string>>;
|
|
19
|
+
getRowId: (row: any) => string;
|
|
20
|
+
updateData: (rowId: string, columnId: string, value: any) => void;
|
|
21
|
+
setSelectedRows: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
22
|
+
cancelEdit: (id: string | Set<string>) => void;
|
|
23
|
+
cancelNewRow?: (id: string) => void;
|
|
24
|
+
cancelDeletion: (id: string) => void;
|
|
25
|
+
cancelHardDelete: (id: string) => void;
|
|
26
|
+
canPerformAction: (row: any, actionKey: string, statusConfig?: StatusConfig, permissions?: {
|
|
27
|
+
canCreate?: boolean;
|
|
28
|
+
canModify?: boolean;
|
|
29
|
+
canDelete?: boolean;
|
|
30
|
+
}) => boolean;
|
|
31
|
+
onImageUpload?: (row: any, file: File) => Promise<string>;
|
|
32
|
+
defaultMinWidth?: string;
|
|
33
|
+
nonSortableKeys?: string[];
|
|
34
|
+
onRowClick?: (row: any) => void;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ColumnType = "text" | "number" | "dropdown" | "checkbox" | "textarea" | "index" | "button" | "status" | "multi-select" | "image" | "error" | "date" | "switch";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StatusConfig } from './table/statusConfig';
|
|
2
|
+
export interface FilterableColumn {
|
|
3
|
+
filterable?: boolean;
|
|
4
|
+
searchable?: boolean;
|
|
5
|
+
filterPlaceholder?: string;
|
|
6
|
+
}
|
|
7
|
+
export type CustomFilter = {
|
|
8
|
+
key: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
options: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
defaultValue?: string | string[];
|
|
15
|
+
isMulti?: boolean;
|
|
16
|
+
searchable?: boolean;
|
|
17
|
+
multiMatchMode?: "all" | "any";
|
|
18
|
+
};
|
|
19
|
+
export interface FilterField {
|
|
20
|
+
key: string;
|
|
21
|
+
label: string;
|
|
22
|
+
control: "text" | "dropdown";
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
options?: {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}[];
|
|
28
|
+
}
|
|
29
|
+
export interface FilterPanelProps {
|
|
30
|
+
fields: FilterField[];
|
|
31
|
+
draft: Record<string, string>;
|
|
32
|
+
onChange: (key: string, value: string) => void;
|
|
33
|
+
onApply: () => void;
|
|
34
|
+
onReset: () => void;
|
|
35
|
+
}
|
|
36
|
+
export interface FilterRowsByStatusOptions {
|
|
37
|
+
statusFilter?: string;
|
|
38
|
+
statusConfig?: StatusConfig;
|
|
39
|
+
subRowsKey: string;
|
|
40
|
+
getRowId: (row: any) => string;
|
|
41
|
+
editedRows: Set<string>;
|
|
42
|
+
originalData: Map<string, any>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface UseEditingProps {
|
|
2
|
+
setTableData: React.Dispatch<React.SetStateAction<any[]>>;
|
|
3
|
+
originalData: Map<string, any>;
|
|
4
|
+
getRowId: (row: any) => string;
|
|
5
|
+
subRowsKey: string;
|
|
6
|
+
rowsToDisable: Set<string>;
|
|
7
|
+
setSelectedRows: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaginationState } from '@tanstack/react-table';
|
|
2
|
+
import { ColumnConfig } from '../column/columnConfig';
|
|
3
|
+
export interface UseFilterPanelOptions {
|
|
4
|
+
columnConfig: ColumnConfig[];
|
|
5
|
+
setFilterValues: (values: Record<string, string>) => void;
|
|
6
|
+
setPagination: React.Dispatch<React.SetStateAction<PaginationState>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface DataTableChanges {
|
|
2
|
+
added: any[];
|
|
3
|
+
updated: any[];
|
|
4
|
+
deleted: any[];
|
|
5
|
+
enabled: string[];
|
|
6
|
+
disabled: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface CRUDOptions {
|
|
9
|
+
onSave?: (changes: DataTableChanges) => Promise<void> | void | Promise<boolean> | boolean;
|
|
10
|
+
hardDelete?: boolean;
|
|
11
|
+
isRowDeletable?: (row: any) => boolean;
|
|
12
|
+
}
|