mig-schema-table 3.0.41 → 3.0.42

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.
@@ -314,6 +314,18 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, disabledCheck
314
314
  delete newColumnFilterMap[propName];
315
315
  setColumnFilterMap(newColumnFilterMap);
316
316
  }, [columnFilterMap]);
317
+ const onSetSortColumn = React.useCallback((x) => {
318
+ if (data instanceof Function) {
319
+ setIsDirty(true);
320
+ }
321
+ setSortColumn(x);
322
+ }, [data]);
323
+ const onSetSortAsc = React.useCallback((x) => {
324
+ if (data instanceof Function) {
325
+ setIsDirty(true);
326
+ }
327
+ setSortAsc(x);
328
+ }, [data]);
317
329
  const SchemaTableTh = React.useCallback(({ style, index }) => {
318
330
  const propName = columnNames[index];
319
331
  const propConfig = config ? config[propName] : undefined;
@@ -326,7 +338,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, disabledCheck
326
338
  const schema = (propName === SELECT_ALL_COLUMN_NAME
327
339
  ? { type: "boolean" }
328
340
  : properties[propName]);
329
- return (_jsx(Th, { isAllChecked: isAllRowsChecked, columnFilterStatus: columnFilterStatus, disableColumnFilter: disableColumnFilter, isSortable: !!isSortable, numberOfSelectedRows: checkedIndexes === null || checkedIndexes === void 0 ? void 0 : checkedIndexes.length, onSelectAllIndexesHandler: onSelectAllIndexesHandler, propConfig: propConfig, propName: propName, schema: schema, setPopoverConfig: setPopoverConfig, setSortAsc: setSortAsc, setSortColumn: setSortColumn, sortAsc: sortColumn === propName ? sortAsc : undefined, style: style }));
341
+ return (_jsx(Th, { isAllChecked: isAllRowsChecked, columnFilterStatus: columnFilterStatus, disableColumnFilter: disableColumnFilter, isSortable: !!isSortable, numberOfSelectedRows: checkedIndexes === null || checkedIndexes === void 0 ? void 0 : checkedIndexes.length, onSelectAllIndexesHandler: onSelectAllIndexesHandler, propConfig: propConfig, propName: propName, schema: schema, setPopoverConfig: setPopoverConfig, setSortAsc: onSetSortAsc, setSortColumn: onSetSortColumn, sortAsc: sortColumn === propName ? sortAsc : undefined, style: style }));
330
342
  }, [
331
343
  checkedIndexes === null || checkedIndexes === void 0 ? void 0 : checkedIndexes.length,
332
344
  columnFilterMap,
@@ -337,6 +349,8 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, disabledCheck
337
349
  isColumnFilterable,
338
350
  isSortable,
339
351
  onSelectAllIndexesHandler,
352
+ onSetSortAsc,
353
+ onSetSortColumn,
340
354
  properties,
341
355
  sortAsc,
342
356
  sortColumn,
@@ -393,13 +407,16 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, disabledCheck
393
407
  if (!popoverConfig) {
394
408
  return;
395
409
  }
410
+ if (data instanceof Function) {
411
+ setIsDirty(true);
412
+ }
396
413
  if (newColumnFilterValue === undefined) {
397
414
  disableColumnFilter(popoverConfig.propName);
398
415
  return;
399
416
  }
400
417
  setColumnFilterMap((columnFilterMap) => (Object.assign(Object.assign({}, columnFilterMap), { [popoverConfig.propName]: newColumnFilterValue })));
401
- }, [disableColumnFilter, popoverConfig]);
402
- 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", Object.assign({ style: { flex: 1 } }, { children: isSearchable ? (_jsx("input", { type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, onKeyDown: onSearchKeyDown, 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}`), 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: {
418
+ }, [data, disableColumnFilter, popoverConfig]);
419
+ 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", Object.assign({ style: { flex: 1 } }, { children: isSearchable ? (_jsx("input", { type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, onKeyDown: onSearchKeyDown, autoFocus: true })) : null })), customElement] })), _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: SchemaTableTh }), `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: {
403
420
  width: rowWidth,
404
421
  height: Math.max(50, tableBodyHeight),
405
422
  border: "1px solid #BBB",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "3.0.41",
3
+ "version": "3.0.42",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"