mig-schema-table 3.0.92 → 3.0.93
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/index.d.ts +2 -1
- package/dist/SchemaTable/index.js +2 -8
- package/dist/inc/string.js +1 -0
- package/dist/index.css +3 -0
- package/dist/types.d.ts +0 -3
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ export interface ISchemaTableProps<T> {
|
|
|
25
25
|
defaultSortColumn?: keyof T;
|
|
26
26
|
disabledCheckedIndexes?: number[];
|
|
27
27
|
enableAutoFocus?: boolean;
|
|
28
|
+
enableRowCounter?: boolean;
|
|
28
29
|
getRowClassName?: (rowData: T, dataIndex: number, filteredSortedData: IRenderData[]) => string;
|
|
29
30
|
getRowSelected?: (rowData: T, dataIndex: number) => boolean;
|
|
30
31
|
isColumnFilterable?: boolean;
|
|
@@ -50,6 +51,6 @@ export interface IDateColumnFilterValue {
|
|
|
50
51
|
filterEmpty?: true;
|
|
51
52
|
}
|
|
52
53
|
export type TColumnFilterValue = string | number | boolean | IDateColumnFilterValue;
|
|
53
|
-
declare function SchemaTable<T>({ Heading, checkedIndexes, config, customElement, data, defaultColumnFilters, defaultSortAsc, defaultSortColumn, disabledCheckedIndexes, enableAutoFocus, getRowClassName, getRowSelected, isColumnFilterable, isExportable, isSearchable, isSortable, maxHeight, onCheckedIndexesChange, onRowClick, onRowDoubleClick, onSearchEnter, rowHeight, schema, searchPlaceholder, style, translate, useFilterStateHash, width, }: ISchemaTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function SchemaTable<T>({ Heading, checkedIndexes, config, customElement, data, defaultColumnFilters, defaultSortAsc, defaultSortColumn, disabledCheckedIndexes, enableAutoFocus, enableRowCounter, getRowClassName, getRowSelected, isColumnFilterable, isExportable, isSearchable, isSortable, maxHeight, onCheckedIndexesChange, onRowClick, onRowDoubleClick, onSearchEnter, rowHeight, schema, searchPlaceholder, style, translate, useFilterStateHash, width, }: ISchemaTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
54
55
|
declare const _default: typeof SchemaTable;
|
|
55
56
|
export default _default;
|
|
@@ -46,7 +46,7 @@ function getIsColumnSortable(isTableSortable, propSchema, propConfig) {
|
|
|
46
46
|
return !!(isTableSortable &&
|
|
47
47
|
(propSchema || (propConfig === null || propConfig === void 0 ? void 0 : propConfig.renderData) || (propConfig === null || propConfig === void 0 ? void 0 : propConfig.sort)));
|
|
48
48
|
}
|
|
49
|
-
function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, customElement, data, defaultColumnFilters = {}, defaultSortAsc = false, defaultSortColumn, disabledCheckedIndexes, enableAutoFocus, getRowClassName, getRowSelected, isColumnFilterable = true, isExportable = true, isSearchable = true, isSortable = true, maxHeight, onCheckedIndexesChange, onRowClick, onRowDoubleClick, onSearchEnter, rowHeight = 36, schema, searchPlaceholder, style, translate = defaultTranslate, useFilterStateHash, width, }) {
|
|
49
|
+
function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, customElement, data, defaultColumnFilters = {}, defaultSortAsc = false, defaultSortColumn, disabledCheckedIndexes, enableAutoFocus = true, enableRowCounter = true, getRowClassName, getRowSelected, isColumnFilterable = true, isExportable = true, isSearchable = true, isSortable = true, maxHeight, onCheckedIndexesChange, onRowClick, onRowDoubleClick, onSearchEnter, rowHeight = 36, schema, searchPlaceholder, style, translate = defaultTranslate, useFilterStateHash, width, }) {
|
|
50
50
|
const [sortColumn, setSortColumn] = React.useState(defaultSortColumn);
|
|
51
51
|
const [sortAsc, setSortAsc] = React.useState(defaultSortAsc);
|
|
52
52
|
const [thMenuConfig, setThMenuConfig] = React.useState();
|
|
@@ -532,12 +532,6 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
532
532
|
thMenuConfig,
|
|
533
533
|
useFilterStateHash,
|
|
534
534
|
]);
|
|
535
|
-
const searchInputAutoFocus = React.useMemo(() => {
|
|
536
|
-
if (enableAutoFocus === undefined) {
|
|
537
|
-
return true;
|
|
538
|
-
}
|
|
539
|
-
return enableAutoFocus;
|
|
540
|
-
}, [enableAutoFocus]);
|
|
541
535
|
const onClearFiltersButtonClick = React.useCallback(() => {
|
|
542
536
|
if (useFilterStateHash) {
|
|
543
537
|
window.location.hash = "";
|
|
@@ -569,7 +563,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
569
563
|
type: "text/csv;charset=utf-8",
|
|
570
564
|
}), "export.csv");
|
|
571
565
|
}, [sortedRenderData]);
|
|
572
|
-
return (_jsxs("div", Object.assign({ className: `schema-table${onRowClick ? " schema-table--clickable-rows" : ""}`, style: Object.assign(Object.assign({}, style), { width: rowWidth }), role: "table" }, { children: [_jsxs("div", Object.assign({ className: "schema-table__action-container" }, { children: [_jsx("div", { children: isSearchable ? (_jsx("input", { className: "schema-table__search", type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, onKeyDown: onInputKeyDown, autoFocus:
|
|
566
|
+
return (_jsxs("div", Object.assign({ className: `schema-table${onRowClick ? " schema-table--clickable-rows" : ""}`, style: Object.assign(Object.assign({}, style), { width: rowWidth }), role: "table" }, { children: [_jsxs("div", Object.assign({ className: "schema-table__action-container" }, { children: [_jsx("div", { children: isSearchable ? (_jsx("input", { className: "schema-table__search", type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, onKeyDown: onInputKeyDown, autoFocus: enableAutoFocus, onBlur: onSearchBlur })) : null }), customElement || (_jsx("div", { className: "schema-table__custom_element_placeholder" })), enableRowCounter ? (_jsx("span", Object.assign({ className: "schema-table__row_counter" }, { children: translate("showingFilteredCountOfTotalCount", (sortedRenderData === null || sortedRenderData === void 0 ? void 0 : sortedRenderData.length) || 0, data.length) }))) : null, isExportable ? (_jsx("button", Object.assign({ onClick: onExportDataClick, style: { marginLeft: 8 }, disabled: !(sortedRenderData === null || sortedRenderData === void 0 ? void 0 : sortedRenderData.length) }, { children: translate("exportData") }))) : null, isSearchable || isColumnFilterable ? (_jsx("button", Object.assign({ onClick: onClearFiltersButtonClick, style: { marginLeft: 8 }, disabled: Object.keys(columnFilterMap).length + searchQuery.length === 0 }, { children: translate("clearFilters") }))) : null] })), _jsx(Heading, Object.assign({ height: 50, itemCount: columnCount, itemSize: getColumnWidth, layout: "horizontal", width: rowWidth, sortAsc: sortAsc, setSortAsc: onSetSortAsc, setSortColumn: onSetSortColumn, sortColumn: sortColumn, sortedRenderData: sortedRenderData, className: "schema-table__th-row" }, { children: ConfiguredTh }), `thead_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}`), sourceData && !isDirty ? (_jsx(VariableSizeGrid, Object.assign({ className: "schema-table__tbody", height: tableBodyHeight, width: rowWidth, columnWidth: getColumnWidth, rowHeight: getRowHeight, columnCount: columnCount, rowCount: rowCount }, { children: SchemaTableTd }), `tbody_${tableBodyHeight}_${rowWidth}_${sortColumn}_${sortAsc}_${searchQuery}_${columnCount}`)) : (_jsx("div", Object.assign({ style: {
|
|
573
567
|
width: rowWidth,
|
|
574
568
|
height: Math.max(50, tableBodyHeight),
|
|
575
569
|
border: "1px solid #BBB",
|
package/dist/inc/string.js
CHANGED
package/dist/index.css
CHANGED
package/dist/types.d.ts
CHANGED