mig-schema-table 3.0.9 → 3.0.11
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/dist/SchemaTable/ColumnFilterRow/index.d.ts +17 -0
- package/dist/SchemaTable/ColumnFilterRow/index.js +62 -0
- package/dist/SchemaTable/Th/index.d.ts +1 -7
- package/dist/SchemaTable/Th/index.js +2 -11
- package/dist/SchemaTable/index.js +29 -49
- package/dist/inc/constant.d.ts +2 -0
- package/dist/inc/constant.js +2 -0
- package/dist/index.css +17 -0
- package/dist/types.d.ts +2 -2
- package/package.json +3 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IColumnConfig } from "../../types";
|
|
2
|
+
import { oas31 } from "openapi3-ts";
|
|
3
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
4
|
+
interface IColumnFilterRowProps {
|
|
5
|
+
columnNames: string[];
|
|
6
|
+
getWidth: (index: number) => number;
|
|
7
|
+
config?: {
|
|
8
|
+
[propName: string]: IColumnConfig<any>;
|
|
9
|
+
};
|
|
10
|
+
columnSearchHandler: (propName: string, value: string | number | boolean) => void;
|
|
11
|
+
value: {
|
|
12
|
+
[propName: string]: string | number | boolean;
|
|
13
|
+
};
|
|
14
|
+
schema: oas31.SchemaObject;
|
|
15
|
+
}
|
|
16
|
+
export default function ColumnFilterRow({ columnNames, getWidth, config, value, columnSearchHandler, schema, }: IColumnFilterRowProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { SELECT_ALL_COLUMN_NAME } from "../constants";
|
|
4
|
+
import DatePicker from "react-datepicker";
|
|
5
|
+
import nl from "date-fns/locale/nl";
|
|
6
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
7
|
+
import { localeFormat } from "../../inc/date";
|
|
8
|
+
import { DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, } from "../../inc/constant";
|
|
9
|
+
export default function ColumnFilterRow({ columnNames, getWidth, config, value, columnSearchHandler, schema, }) {
|
|
10
|
+
const { properties = {} } = schema;
|
|
11
|
+
const getSelectComponent = React.useCallback((propSchema, propName, value, inputChangeHandler) => {
|
|
12
|
+
const enumItems = propSchema.type === "boolean" ? ["true", "false"] : propSchema.enum;
|
|
13
|
+
return (_jsxs("select", Object.assign({ value: value, "data-prop-name": propName, onChange: inputChangeHandler }, { children: [_jsx("option", Object.assign({ value: "" }, { children: "All" }), "all"), enumItems.map((name) => (_jsx("option", Object.assign({ value: name }, { children: name }), `column-filter-select-${name}`)))] })));
|
|
14
|
+
}, []);
|
|
15
|
+
const field = React.useCallback((propSchema, propName, propValue, propConfig) => {
|
|
16
|
+
const { type, format, minimum, maximum } = propSchema;
|
|
17
|
+
const inputChangeHandler = (event) => {
|
|
18
|
+
columnSearchHandler(propName, event.target.value);
|
|
19
|
+
};
|
|
20
|
+
const strValue = (propValue || "");
|
|
21
|
+
switch (type) {
|
|
22
|
+
case "string":
|
|
23
|
+
if (propSchema.enum) {
|
|
24
|
+
return getSelectComponent(propSchema, propName, strValue, inputChangeHandler);
|
|
25
|
+
}
|
|
26
|
+
if (format === "date-time" || format === "date") {
|
|
27
|
+
const dateFormat = (propConfig === null || propConfig === void 0 ? void 0 : propConfig.dateFormat) ||
|
|
28
|
+
(format === "date"
|
|
29
|
+
? DEFAULT_DATE_FORMAT
|
|
30
|
+
: DEFAULT_DATE_TIME_FORMAT);
|
|
31
|
+
const dateChangeHandler = (date) => {
|
|
32
|
+
columnSearchHandler(propName, date ? localeFormat(date, dateFormat) : "");
|
|
33
|
+
};
|
|
34
|
+
return (_jsx(DatePicker, { id: "filter-date", dateFormat: dateFormat, "data-prop-name": propName, showTimeSelect: format === "date-time", locale: nl, selected: propValue ? new Date(propValue) : null, onChange: dateChangeHandler, value: propValue || undefined, placeholderText: dateFormat, isClearable: true }));
|
|
35
|
+
}
|
|
36
|
+
return (_jsx("input", { value: strValue, "data-prop-name": propName, onChange: inputChangeHandler, placeholder: `Search ${propName}` }));
|
|
37
|
+
case "integer":
|
|
38
|
+
return (_jsx("input", { type: "number", value: strValue, "data-prop-name": propName, onChange: inputChangeHandler, placeholder: `Search ${propName}`, min: minimum, max: maximum }));
|
|
39
|
+
case "boolean":
|
|
40
|
+
return getSelectComponent(propSchema, propName, strValue, inputChangeHandler);
|
|
41
|
+
default:
|
|
42
|
+
return _jsx(_Fragment, {});
|
|
43
|
+
}
|
|
44
|
+
}, [columnSearchHandler, getSelectComponent]);
|
|
45
|
+
const SchemaColumnFilter = React.useCallback((index) => {
|
|
46
|
+
const propName = columnNames[index];
|
|
47
|
+
const propSchema = properties[propName];
|
|
48
|
+
const propConfig = config ? config[propName] : undefined;
|
|
49
|
+
const propValue = value === null || value === void 0 ? void 0 : value[propName];
|
|
50
|
+
if (propName === SELECT_ALL_COLUMN_NAME || !(propConfig === null || propConfig === void 0 ? void 0 : propConfig.isFilterable)) {
|
|
51
|
+
return _jsx("div", { className: "schema-table__th" });
|
|
52
|
+
}
|
|
53
|
+
return (_jsx("div", Object.assign({ className: "schema-table__th" }, { children: field(propSchema, propName, propValue, propConfig) }), `filter-col-${propName}`));
|
|
54
|
+
}, [columnNames, config, field, properties, value]);
|
|
55
|
+
return (_jsx("div", Object.assign({ className: "schema-table__th-row", style: { display: "flex", flex: "row" } }, { children: columnNames.map((columnName, index) => {
|
|
56
|
+
return (_jsx("div", Object.assign({ className: "schema-table__column-filter", style: {
|
|
57
|
+
width: getWidth(index),
|
|
58
|
+
height: 25,
|
|
59
|
+
paddingBottom: 7,
|
|
60
|
+
} }, { children: SchemaColumnFilter(index) }), `filter-${index}`));
|
|
61
|
+
}) })));
|
|
62
|
+
}
|
|
@@ -2,16 +2,10 @@ import { oas31 } from "openapi3-ts";
|
|
|
2
2
|
import React, { CSSProperties, Dispatch, SetStateAction } from "react";
|
|
3
3
|
import { IColumnConfig } from "../../types";
|
|
4
4
|
interface IThProps {
|
|
5
|
-
columnFilters?: {
|
|
6
|
-
[prop: string]: any;
|
|
7
|
-
};
|
|
8
5
|
config?: IColumnConfig<any>;
|
|
9
6
|
isSortable: boolean;
|
|
10
7
|
name: string;
|
|
11
8
|
schema: oas31.SchemaObject;
|
|
12
|
-
setColumnFilters?: Dispatch<SetStateAction<{
|
|
13
|
-
[prop: string]: any;
|
|
14
|
-
} | undefined>>;
|
|
15
9
|
setSortAsc: Dispatch<SetStateAction<boolean>>;
|
|
16
10
|
setSortColumn: Dispatch<SetStateAction<string>>;
|
|
17
11
|
sortAsc?: boolean;
|
|
@@ -20,5 +14,5 @@ interface IThProps {
|
|
|
20
14
|
isAllChecked?: boolean;
|
|
21
15
|
numberOfSelectedRows?: number;
|
|
22
16
|
}
|
|
23
|
-
declare const _default: ({
|
|
17
|
+
declare const _default: ({ config, isSortable, name, schema, setSortAsc, setSortColumn, sortAsc, style, onSelectAllIndexesHandler, isAllChecked, numberOfSelectedRows, }: IThProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
18
|
export default _default;
|
|
@@ -2,20 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { uncamel } from "../../inc/string";
|
|
4
4
|
import { SELECT_ALL_COLUMN_NAME } from "../constants";
|
|
5
|
-
const Th = ({
|
|
5
|
+
const Th = ({ config, isSortable, name, schema, setSortAsc, setSortColumn, sortAsc, style, onSelectAllIndexesHandler, isAllChecked, numberOfSelectedRows, }) => {
|
|
6
6
|
const thDivProps = {
|
|
7
7
|
style,
|
|
8
8
|
className: `schema-table__th ${isSortable ? "schema-table__th--sortable" : "schema-table__th--unsortable"}`,
|
|
9
9
|
};
|
|
10
|
-
const onFilterButtonClick = React.useCallback(() => {
|
|
11
|
-
if (!setColumnFilters) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (columnFilters) {
|
|
15
|
-
setColumnFilters(undefined);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}, [columnFilters, setColumnFilters]);
|
|
19
10
|
const onSortButtonClick = React.useCallback(() => {
|
|
20
11
|
if (sortAsc === undefined) {
|
|
21
12
|
setSortColumn(name);
|
|
@@ -46,6 +37,6 @@ const Th = ({ columnFilters, config, isSortable, name, schema, setColumnFilters,
|
|
|
46
37
|
thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "end"}`;
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
|
-
return (
|
|
40
|
+
return (_jsx("div", Object.assign({}, thDivProps, { children: isSortable ? (_jsxs("button", Object.assign({ className: "px-0", disabled: (config === null || config === void 0 ? void 0 : config.sortable) === false, onClick: onSortButtonClick }, { children: [(config === null || config === void 0 ? void 0 : config.title) === undefined ? uncamel(name) : config === null || config === void 0 ? void 0 : config.title, sortAsc === undefined ? null : sortAsc ? "▲" : "▼"] }))) : (_jsx("div", Object.assign({ style: { lineHeight: "44px" } }, { children: (config === null || config === void 0 ? void 0 : config.title) === undefined ? uncamel(name) : config === null || config === void 0 ? void 0 : config.title }))) })));
|
|
50
41
|
};
|
|
51
42
|
export default React.memo(Th);
|
|
@@ -6,11 +6,12 @@ import { uncamel } from "../inc/string";
|
|
|
6
6
|
import Th from "./Th";
|
|
7
7
|
import { SELECT_ALL_COLUMN_NAME, SELECT_ALL_COLUMN_WIDTH } from "./constants";
|
|
8
8
|
import Td from "./Td";
|
|
9
|
+
import ColumnFilterRow from "./ColumnFilterRow";
|
|
10
|
+
import { DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT } from "../inc/constant";
|
|
9
11
|
export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, customElement, data, defaultSortAsc = false, defaultSortColumn, getRowClassName, getRowSelected, maxHeight, isSearchable, isColumnSearchable, isSortable, onCheckedIndexesChange, onRowClick, rowHeight = 36, schema, searchPlaceholder, style, width, }) {
|
|
10
12
|
const [sortColumn, setSortColumn] = React.useState(defaultSortColumn);
|
|
11
13
|
const [sortAsc, setSortAsc] = React.useState(defaultSortAsc);
|
|
12
14
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
13
|
-
const [columnFilters, setColumnFilters] = React.useState();
|
|
14
15
|
const [columnSearchObj, setColumnSearchObj] = React.useState({});
|
|
15
16
|
const { properties = {} } = schema;
|
|
16
17
|
const columnNames = React.useMemo(() => {
|
|
@@ -87,11 +88,11 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
87
88
|
prev[propName] =
|
|
88
89
|
rawValue === "2999-12-31"
|
|
89
90
|
? "-"
|
|
90
|
-
: localeFormat(new Date(rawValue),
|
|
91
|
+
: localeFormat(new Date(rawValue), (propConfig === null || propConfig === void 0 ? void 0 : propConfig.dateFormat) || DEFAULT_DATE_FORMAT);
|
|
91
92
|
return prev;
|
|
92
93
|
}
|
|
93
94
|
if (schema.format === "date-time" && rawValue) {
|
|
94
|
-
prev[propName] = localeFormat(new Date(rawValue),
|
|
95
|
+
prev[propName] = localeFormat(new Date(rawValue), (propConfig === null || propConfig === void 0 ? void 0 : propConfig.dateFormat) || DEFAULT_DATE_TIME_FORMAT);
|
|
95
96
|
return prev;
|
|
96
97
|
}
|
|
97
98
|
if (schema.enum) {
|
|
@@ -145,36 +146,34 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
145
146
|
if (!result) {
|
|
146
147
|
return result;
|
|
147
148
|
}
|
|
148
|
-
if (searchQuery) {
|
|
149
|
-
const lcQuery = searchQuery.toLowerCase();
|
|
150
|
-
result = result.filter((item) => !!columnNames.find((columnName) =>
|
|
151
|
-
// @ts-ignore
|
|
152
|
-
`${item[columnName]}`.toLowerCase().includes(lcQuery)));
|
|
153
|
-
}
|
|
154
|
-
if (isColumnSearchable) {
|
|
149
|
+
if (isColumnSearchable || searchQuery) {
|
|
155
150
|
return result.filter((item) => {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
const globalSearchFilterResult = searchQuery
|
|
152
|
+
? !!columnNames.find((columnName) =>
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
`${item[columnName]}`
|
|
159
155
|
.toLowerCase()
|
|
160
|
-
.includes(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
.includes(searchQuery.toLowerCase()))
|
|
157
|
+
: true;
|
|
158
|
+
const rowColumnValidation = isColumnSearchable
|
|
159
|
+
? Object.keys(columnSearchObj).reduce((previousValue, propName) => {
|
|
160
|
+
const columnSearchText = columnSearchObj[propName];
|
|
161
|
+
const isBooleanValue = item[propName] === "✓" || item[propName] === "✕";
|
|
162
|
+
const rawValue = isBooleanValue
|
|
163
|
+
? `${item[propName] === "✓"}`
|
|
164
|
+
: `${item[propName]}`;
|
|
165
|
+
previousValue.push(rawValue
|
|
166
|
+
.toLowerCase()
|
|
167
|
+
.includes(`${columnSearchText}`.toLowerCase()));
|
|
168
|
+
return previousValue;
|
|
169
|
+
}, [])
|
|
170
|
+
: [true];
|
|
171
|
+
return (globalSearchFilterResult && rowColumnValidation.every((el) => el));
|
|
164
172
|
});
|
|
165
173
|
}
|
|
166
|
-
if (!columnFilters) {
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
const columnFilterEntries = Object.entries(columnFilters);
|
|
170
|
-
return result.filter((item) => columnFilterEntries.find(([columnName, columnFilterValue]) =>
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
data[item._index][columnName] === columnFilterValue));
|
|
173
174
|
}, [
|
|
174
|
-
columnFilters,
|
|
175
175
|
columnNames,
|
|
176
176
|
columnSearchObj,
|
|
177
|
-
data,
|
|
178
177
|
isColumnSearchable,
|
|
179
178
|
renderData,
|
|
180
179
|
searchQuery,
|
|
@@ -236,10 +235,9 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
236
235
|
}, [checkedIndexes, filteredRenderData]);
|
|
237
236
|
const SchemaTableTh = React.useCallback(({ style, index }) => {
|
|
238
237
|
const propName = columnNames[index];
|
|
239
|
-
return (_jsx(Th, {
|
|
238
|
+
return (_jsx(Th, { config: config ? config[propName] : undefined, isSortable: !!isSortable, name: propName, schema: properties[propName], setSortColumn: setSortColumn, setSortAsc: setSortAsc, sortAsc: sortColumn === propName ? sortAsc : undefined, style: style, onSelectAllIndexesHandler: onSelectAllIndexesHandler, isAllChecked: isAllRowsChecked, numberOfSelectedRows: checkedIndexes === null || checkedIndexes === void 0 ? void 0 : checkedIndexes.length }));
|
|
240
239
|
}, [
|
|
241
240
|
columnNames,
|
|
242
|
-
columnFilters,
|
|
243
241
|
config,
|
|
244
242
|
isSortable,
|
|
245
243
|
properties,
|
|
@@ -264,21 +262,9 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
264
262
|
rowHeight,
|
|
265
263
|
sortedRenderData,
|
|
266
264
|
]);
|
|
267
|
-
const columnSearchHandler = React.useCallback((
|
|
268
|
-
setColumnSearchObj((columnSearch) => (Object.assign(Object.assign({}, columnSearch), { [
|
|
265
|
+
const columnSearchHandler = React.useCallback((propName, value) => {
|
|
266
|
+
setColumnSearchObj((columnSearch) => (Object.assign(Object.assign({}, columnSearch), { [propName]: value })));
|
|
269
267
|
}, []);
|
|
270
|
-
const SchemaColumnFilter = React.useCallback((index) => {
|
|
271
|
-
const propName = columnNames[index];
|
|
272
|
-
// const propSchema = properties[propName] as oas31.SchemaObject;
|
|
273
|
-
const propConfig = config ? config[propName] : undefined;
|
|
274
|
-
if (propName === SELECT_ALL_COLUMN_NAME || !(propConfig === null || propConfig === void 0 ? void 0 : propConfig.isSearchable)) {
|
|
275
|
-
return _jsx("div", { className: "schema-table__th", style: style });
|
|
276
|
-
}
|
|
277
|
-
return (_jsx("div", Object.assign({ className: "schema-table__th" }, { children: _jsx("input", { value: columnSearchObj === null || columnSearchObj === void 0 ? void 0 : columnSearchObj[propName], "data-prop-name": propName, onChange: columnSearchHandler, style: {
|
|
278
|
-
marginRight: 2,
|
|
279
|
-
width: "90%",
|
|
280
|
-
} }) }), `filter-col-${propName}`));
|
|
281
|
-
}, [columnNames, columnSearchHandler, columnSearchObj, config, style]);
|
|
282
268
|
const onSearchChange = React.useCallback((e) => {
|
|
283
269
|
setSearchQuery(e.currentTarget.value);
|
|
284
270
|
}, []);
|
|
@@ -292,11 +278,5 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
292
278
|
? rowsMaxHeight
|
|
293
279
|
: rowsHeight;
|
|
294
280
|
}, [maxHeight, isSearchable, rowCount, rowHeight]);
|
|
295
|
-
return (_jsxs("div", Object.assign({ className: `schema-table${onRowClick ? " schema-table--clickable-rows" : ""}`, style: Object.assign(Object.assign({}, style), { width: rowWidth }) }, { children: [_jsxs("div", Object.assign({ className: "schema-table__action-container" }, { children: [_jsx("div", Object.assign({ style: { flex: 1 } }, { children: isSearchable ? (_jsx("input", { type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, autoFocus: true })) : null })), customElement] })), _jsx(Heading, Object.assign({ height: 50, itemCount: columnCount, itemSize: getColumnWidth, layout: "horizontal", width: rowWidth, sortAsc: sortAsc, setSortAsc: setSortAsc, setSortColumn: setSortColumn, sortColumn: sortColumn, sortedRenderData: sortedRenderData, className: "schema-table__th-row" }, { children: SchemaTableTh }), `thead_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}`), _jsx(
|
|
296
|
-
return (_jsx("div", Object.assign({ className: "schema-table__th", style: {
|
|
297
|
-
width: getColumnWidth(index),
|
|
298
|
-
height: 20,
|
|
299
|
-
paddingBottom: 8,
|
|
300
|
-
} }, { children: SchemaColumnFilter(index) }), `filter-${index}`));
|
|
301
|
-
}) })), _jsx(VariableSizeGrid, Object.assign({ className: "schema-table__tbody", height: tableBodyHeight, width: rowWidth, columnWidth: getColumnWidth, rowHeight: getRowHeight, columnCount: columnCount, rowCount: rowCount }, { children: SchemaTableTd }), `tbody_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}_${columnCount}`)] })));
|
|
281
|
+
return (_jsxs("div", Object.assign({ className: `schema-table${onRowClick ? " schema-table--clickable-rows" : ""}`, style: Object.assign(Object.assign({}, style), { width: rowWidth }) }, { children: [_jsxs("div", Object.assign({ className: "schema-table__action-container" }, { children: [_jsx("div", Object.assign({ style: { flex: 1 } }, { children: isSearchable ? (_jsx("input", { type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, autoFocus: true })) : null })), customElement] })), _jsx(Heading, Object.assign({ height: 50, itemCount: columnCount, itemSize: getColumnWidth, layout: "horizontal", width: rowWidth, sortAsc: sortAsc, setSortAsc: setSortAsc, setSortColumn: setSortColumn, sortColumn: sortColumn, sortedRenderData: sortedRenderData, className: "schema-table__th-row" }, { children: SchemaTableTh }), `thead_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}`), _jsx(ColumnFilterRow, { schema: schema, columnNames: columnNames, config: config, value: columnSearchObj, columnSearchHandler: columnSearchHandler, getWidth: getColumnWidth }), _jsx(VariableSizeGrid, Object.assign({ className: "schema-table__tbody", height: tableBodyHeight, width: rowWidth, columnWidth: getColumnWidth, rowHeight: getRowHeight, columnCount: columnCount, rowCount: rowCount }, { children: SchemaTableTd }), `tbody_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}_${columnCount}`)] })));
|
|
302
282
|
}
|
package/dist/index.css
CHANGED
|
@@ -9,6 +9,23 @@
|
|
|
9
9
|
.schema-table__th-row {
|
|
10
10
|
overflow: hidden !important;
|
|
11
11
|
}
|
|
12
|
+
.schema-table__column-filter {
|
|
13
|
+
background-color: #eee;
|
|
14
|
+
}
|
|
15
|
+
.schema-table__column-filter input, .schema-table__column-filter select {
|
|
16
|
+
width: 90%;
|
|
17
|
+
padding: 3px;
|
|
18
|
+
margin-top: 3px;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
}
|
|
21
|
+
.schema-table__column-filter input[type=checkbox] {
|
|
22
|
+
width: fit-content;
|
|
23
|
+
margin-top: 10px;
|
|
24
|
+
margin-left: 30px;
|
|
25
|
+
}
|
|
26
|
+
.schema-table__column-filter .react-datepicker {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
12
29
|
.schema-table__th {
|
|
13
30
|
background-color: #eee;
|
|
14
31
|
align-items: center;
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export interface IColumnConfig<T> {
|
|
|
4
4
|
defaultSortDesc?: boolean;
|
|
5
5
|
hidden?: boolean;
|
|
6
6
|
hoverTitle?: string;
|
|
7
|
-
isFilterable?: boolean;
|
|
8
7
|
renderCell?: (rowData: T, dataIndex: number, rowIndex: number) => React.ReactElement | null;
|
|
9
8
|
renderData?: (rowData: T, dataIndex: number) => string;
|
|
10
9
|
sort?: (a: T, b: T, sortAsc: boolean) => number;
|
|
@@ -13,7 +12,8 @@ export interface IColumnConfig<T> {
|
|
|
13
12
|
title?: string | React.ReactElement;
|
|
14
13
|
width?: number;
|
|
15
14
|
order?: number;
|
|
16
|
-
|
|
15
|
+
isFilterable?: boolean;
|
|
16
|
+
dateFormat?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface IRenderData {
|
|
19
19
|
_index: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mig-schema-table",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/"
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
"@types/jest": "^27.5.2",
|
|
12
12
|
"@types/node": "^16.18.31",
|
|
13
13
|
"@types/react": "^18.2.6",
|
|
14
|
+
"@types/react-datepicker": "^4.11.2",
|
|
14
15
|
"@types/react-dom": "^18.2.4",
|
|
15
16
|
"date-fns": "^2.30.0",
|
|
16
17
|
"lodash": "^4.17.21",
|
|
17
18
|
"openapi3-ts": "^4.1.2",
|
|
18
19
|
"react": "^18.2.0",
|
|
20
|
+
"react-datepicker": "^4.14.0",
|
|
19
21
|
"react-dom": "^18.2.0",
|
|
20
22
|
"react-scripts": "5.0.1",
|
|
21
23
|
"react-window": "^1.8.9"
|