mig-schema-table 3.0.102 → 3.0.104
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.js +10 -9
- package/dist/inc/data.d.ts +1 -1
- package/dist/inc/data.js +1 -1
- package/package.json +1 -1
|
@@ -49,16 +49,16 @@ function getIsColumnSortable(isTableSortable, propSchema, propConfig) {
|
|
|
49
49
|
(propConfig === null || propConfig === void 0 ? void 0 : propConfig.isSortable) !== false &&
|
|
50
50
|
(propSchema || (propConfig === null || propConfig === void 0 ? void 0 : propConfig.renderData) || (propConfig === null || propConfig === void 0 ? void 0 : propConfig.sort)));
|
|
51
51
|
}
|
|
52
|
-
function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, customElement, data, defaultColumnFilters
|
|
52
|
+
function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, customElement, data, defaultColumnFilters, defaultSortAsc = false, defaultSortColumn, disabledCheckedIndexes, enableAutoFocus = true, enableRowCounter = true, getRowClassName, getRowSelected, isColumnFilterable = true, isExportable = true, isResizable = true, isSearchable = true, isSortable = true, maxHeight, onCheckedIndexesChange, onRowClick, onRowDoubleClick, onSearchEnter, rowHeight = 36, schema, searchPlaceholder, style, translate = defaultTranslate, useFilterStateHash, width, }) {
|
|
53
53
|
const [sortColumn, setSortColumn] = React.useState(defaultSortColumn);
|
|
54
54
|
const [sortAsc, setSortAsc] = React.useState(defaultSortAsc);
|
|
55
55
|
const [thMenuConfig, setThMenuConfig] = React.useState();
|
|
56
56
|
const isDataFunction = data instanceof Function;
|
|
57
57
|
const [sourceData, setSourceData] = React.useState(isDataFunction ? undefined : data);
|
|
58
58
|
const [columnWidths, setColumnWidths] = React.useState();
|
|
59
|
-
const [locationHash, setLocationHash] = React.useState(useFilterStateHash ? parseLocationHash(window.location.hash) :
|
|
60
|
-
const [searchQuery, setSearchQuery] = React.useState(locationHash.searchQuery || "");
|
|
61
|
-
const [columnFilterMap, setColumnFilterMap] = React.useState(locationHash.columnFilterMap || defaultColumnFilters);
|
|
59
|
+
const [locationHash, setLocationHash] = React.useState(useFilterStateHash ? parseLocationHash(window.location.hash) : null);
|
|
60
|
+
const [searchQuery, setSearchQuery] = React.useState((locationHash === null || locationHash === void 0 ? void 0 : locationHash.searchQuery) || "");
|
|
61
|
+
const [columnFilterMap, setColumnFilterMap] = React.useState((locationHash === null || locationHash === void 0 ? void 0 : locationHash.columnFilterMap) || defaultColumnFilters || {});
|
|
62
62
|
const [isDirty, setIsDirty] = React.useState(false);
|
|
63
63
|
React.useEffect(() => {
|
|
64
64
|
if (isDataFunction) {
|
|
@@ -543,9 +543,9 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
543
543
|
if (!useFilterStateHash) {
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
|
-
setColumnFilterMap(locationHash.columnFilterMap || {});
|
|
547
|
-
setSearchQuery(locationHash.searchQuery || "");
|
|
548
|
-
}, [locationHash, useFilterStateHash]);
|
|
546
|
+
setColumnFilterMap((locationHash === null || locationHash === void 0 ? void 0 : locationHash.columnFilterMap) || defaultColumnFilters || {});
|
|
547
|
+
setSearchQuery((locationHash === null || locationHash === void 0 ? void 0 : locationHash.searchQuery) || "");
|
|
548
|
+
}, [locationHash, useFilterStateHash, defaultColumnFilters]);
|
|
549
549
|
const onSchemaColumnFilterChange = React.useCallback((newColumnFilterValue, persistState) => {
|
|
550
550
|
if (!thMenuConfig) {
|
|
551
551
|
return;
|
|
@@ -579,10 +579,11 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
|
|
|
579
579
|
setSearchQuery("");
|
|
580
580
|
}, [useFilterStateHash]);
|
|
581
581
|
const onSearchBlur = React.useCallback(() => {
|
|
582
|
+
const oldSearchQuery = (locationHash === null || locationHash === void 0 ? void 0 : locationHash.searchQuery) || "";
|
|
582
583
|
if (useFilterStateHash &&
|
|
583
584
|
// prevent hash change for undefined vs empty string compare
|
|
584
|
-
(searchQuery ||
|
|
585
|
-
searchQuery !==
|
|
585
|
+
(searchQuery || oldSearchQuery) &&
|
|
586
|
+
searchQuery !== oldSearchQuery) {
|
|
586
587
|
window.location.hash = serializeLocationHash(Object.assign(Object.assign({}, locationHash), { searchQuery }));
|
|
587
588
|
}
|
|
588
589
|
}, [locationHash, searchQuery, useFilterStateHash]);
|
package/dist/inc/data.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const parseLocationHash: <T extends {}>(search: string) => T;
|
|
1
|
+
export declare const parseLocationHash: <T extends {}>(search: string) => T | null;
|
|
2
2
|
export declare const serializeLocationHash: (params: {}) => string;
|
package/dist/inc/data.js
CHANGED