@popmenu/table 0.47.0 → 0.47.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,3 +1,4 @@
|
|
|
1
|
+
import { TextFieldProps } from '@material-ui/core';
|
|
1
2
|
import { Column, ColumnFiltersState, PaginationState } from '@tanstack/react-table';
|
|
2
3
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
4
|
export interface ColumnFilter {
|
|
@@ -21,6 +22,8 @@ export interface TableProps<T = unknown> {
|
|
|
21
22
|
paginationState?: [PaginationState, Dispatch<SetStateAction<PaginationState>>];
|
|
22
23
|
/** GlobalFiltering state. Expects the result of a React useState hook. Used only for manual filtering. */
|
|
23
24
|
globalFilterState?: [string, Dispatch<SetStateAction<string>>];
|
|
25
|
+
/** Props applied to the TextField for global filtering. */
|
|
26
|
+
GlobalFilterProps?: TextFieldProps;
|
|
24
27
|
/** Filtering state. Expects the result of a React useState hook. Used only for manual filtering. */
|
|
25
28
|
filterState?: [ColumnFiltersState, Dispatch<SetStateAction<Array<ColumnFilter>>>];
|
|
26
29
|
/** Filtering state. Expects the result of a React useState hook. Used only for manual filtering. */
|
package/build/index.es.js
CHANGED
|
@@ -3128,16 +3128,14 @@ var useStyles$1 = makeStyles({
|
|
|
3128
3128
|
|
|
3129
3129
|
var GlobalFilter = function (props) {
|
|
3130
3130
|
var value = props.value, setValue = props.setValue, restProps = __rest$3(props, ["value", "setValue"]);
|
|
3131
|
-
var onChange = restProps.onChange, InputProps = restProps.InputProps, cleanRestProps = __rest$3(restProps, ["onChange", "InputProps"]);
|
|
3132
3131
|
var classes = useStyles$1();
|
|
3133
3132
|
var handleChange = function (e) {
|
|
3134
3133
|
setValue(e.target.value);
|
|
3135
|
-
if (onChange) {
|
|
3136
|
-
onChange(e);
|
|
3137
|
-
}
|
|
3138
3134
|
};
|
|
3139
|
-
return (React__default.createElement(TextField, __assign$3({ className: classes.root, variant: "outlined", value: value, onChange: handleChange, InputProps:
|
|
3140
|
-
|
|
3135
|
+
return (React__default.createElement(TextField, __assign$3({ className: classes.root, variant: "outlined", value: value, onChange: handleChange, InputProps: {
|
|
3136
|
+
startAdornment: (React__default.createElement(InputAdornment, { position: "start" },
|
|
3137
|
+
React__default.createElement(Icon$1, { icon: SvgSearch }))),
|
|
3138
|
+
} }, restProps)));
|
|
3141
3139
|
};
|
|
3142
3140
|
|
|
3143
3141
|
var TableHeaderRow = function (props) {
|
|
@@ -3220,7 +3218,7 @@ var defaultTableProps = {
|
|
|
3220
3218
|
searchable: false,
|
|
3221
3219
|
};
|
|
3222
3220
|
var Table = function (props) {
|
|
3223
|
-
var data = props.data, columns = props.columns, loading = props.loading, searchable = props.searchable, sortable = props.sortable, externalFilterState = props.filterState, externalGlobalFilterState = props.globalFilterState, externalPaginationState = props.paginationState, externalVisibilityState = props.visibilityState, pageCount = props.pageCount, Empty = props.Empty;
|
|
3221
|
+
var data = props.data, columns = props.columns, loading = props.loading, searchable = props.searchable, sortable = props.sortable, externalFilterState = props.filterState, externalGlobalFilterState = props.globalFilterState, externalPaginationState = props.paginationState, externalVisibilityState = props.visibilityState, pageCount = props.pageCount, GlobalFilterProps = props.GlobalFilterProps, Empty = props.Empty;
|
|
3224
3222
|
var classes = useStyles$6(props);
|
|
3225
3223
|
var rootRef = useRef(null);
|
|
3226
3224
|
// Prepare Empty State
|
|
@@ -3254,7 +3252,7 @@ var Table = function (props) {
|
|
|
3254
3252
|
React__default.createElement(Box, __assign$3({ className: classes.root }, { ref: rootRef }, { "data-table-element": "root", minHeight: getTableMinHeight(rootRef, table.getState().pagination.pageSize) }),
|
|
3255
3253
|
React__default.createElement(Box, null,
|
|
3256
3254
|
React__default.createElement(Box, { display: "grid", gridAutoFlow: "column", marginBottom: 3 },
|
|
3257
|
-
(searchable || isControlledGlobalFilter) && (React__default.createElement(GlobalFilter, { value: table.getState().globalFilter, setValue: table.setGlobalFilter })),
|
|
3255
|
+
(searchable || isControlledGlobalFilter) && (React__default.createElement(GlobalFilter, __assign$3({}, GlobalFilterProps, { value: table.getState().globalFilter, setValue: table.setGlobalFilter }))),
|
|
3258
3256
|
hasColumnFilters && React__default.createElement(FilterPanel, null)),
|
|
3259
3257
|
React__default.createElement(Box, { display: "flex", flexWrap: "wrap", gridGap: 8 },
|
|
3260
3258
|
selectedColumnFilters.map(function (selectedColumnFilter, i) { return (React__default.createElement(ColumnFilterChip, { key: "selected-column-filter-chip-" + i, columnFilter: selectedColumnFilter, label: formatSelectedFilterText(selectedColumnFilter), onClick: deselectColumnFilter })); }),
|