mig-schema-table 3.0.84 → 3.0.86

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,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { oas31 } from "openapi3-ts";
3
3
  import { IColumnConfig, IRenderData } from "../../types";
4
+ import "./index.scss";
4
5
  interface ITdProps<T> {
5
6
  checkedIndexes?: number[];
6
7
  disabledCheckedIndexes?: number[];
@@ -8,7 +9,6 @@ interface ITdProps<T> {
8
9
  data: T[];
9
10
  getRowClassName?: (rowData: T, dataIndex: number, filteredSortedData: IRenderData[]) => string;
10
11
  getRowSelected?: (rowData: T, dataIndex: number) => boolean;
11
- rowHeight: number;
12
12
  rowIndex: number;
13
13
  onCheckedIndexesChange?: (dataIndex: number[]) => void;
14
14
  onRowClick?: (rowData: T, dataIndex: number, event: React.MouseEvent) => void;
@@ -20,6 +20,6 @@ interface ITdProps<T> {
20
20
  style: React.CSSProperties;
21
21
  translate: (key: string, ...args: Array<string | number>) => string;
22
22
  }
23
- declare function Td<T>({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowClassName, getRowSelected, onCheckedIndexesChange, onRowClick, onRowDoubleClick, propConfig, propName, propSchema, rowHeight, rowIndex, sortedRenderData, style, translate, }: ITdProps<T>): import("react/jsx-runtime").JSX.Element | null;
23
+ declare function Td<T>({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowClassName, getRowSelected, onCheckedIndexesChange, onRowClick, onRowDoubleClick, propConfig, propName, propSchema, rowIndex, sortedRenderData, style, translate, }: ITdProps<T>): import("react/jsx-runtime").JSX.Element | null;
24
24
  declare const _default: typeof Td;
25
25
  export default _default;
@@ -3,7 +3,8 @@ import React from "react";
3
3
  import { SELECT_ALL_COLUMN_NAME } from "../constants";
4
4
  import { localeFormatInTimeZone, timeZone } from "../../inc/date";
5
5
  import { DEFAULT_DATE_TIME_FORMAT } from "../../inc/constant";
6
- function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowClassName, getRowSelected, onCheckedIndexesChange, onRowClick, onRowDoubleClick, propConfig, propName, propSchema, rowHeight, rowIndex, sortedRenderData, style, translate, }) {
6
+ import "./index.scss";
7
+ function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowClassName, getRowSelected, onCheckedIndexesChange, onRowClick, onRowDoubleClick, propConfig, propName, propSchema, rowIndex, sortedRenderData, style, translate, }) {
7
8
  const onTdClick = React.useCallback((e) => {
8
9
  if (!sortedRenderData || !onRowClick) {
9
10
  return;
@@ -60,7 +61,7 @@ function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowC
60
61
  "data-row-index": rowIndex,
61
62
  "data-column-index": columnIndex,
62
63
  key: propName,
63
- style: Object.assign(Object.assign({}, style), { lineHeight: `${rowHeight}px` }),
64
+ style,
64
65
  onClick: onTdClick,
65
66
  onDoubleClick: onTdDoubleClick,
66
67
  className: classNames.join(" "),
@@ -77,7 +78,6 @@ function Td({ checkedIndexes, disabledCheckedIndexes, columnIndex, data, getRowC
77
78
  propName,
78
79
  propSchema === null || propSchema === void 0 ? void 0 : propSchema.format,
79
80
  row,
80
- rowHeight,
81
81
  rowIndex,
82
82
  sortedRenderData,
83
83
  style,
@@ -436,7 +436,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
436
436
  const propSchema = (propName === SELECT_ALL_COLUMN_NAME
437
437
  ? { type: "boolean" }
438
438
  : properties[propName]);
439
- return sourceData ? (_jsx(Td, { checkedIndexes: checkedIndexes, disabledCheckedIndexes: disabledCheckedIndexes, columnIndex: columnIndex, data: sourceData, getRowClassName: getRowClassName, getRowSelected: getRowSelected, onCheckedIndexesChange: onCheckedIndexesChange, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick, propConfig: config ? config[propName] : undefined, propName: propName, propSchema: propSchema, rowHeight: rowHeight, rowIndex: rowIndex, sortedRenderData: sortedRenderData, style: style, translate: translate })) : null;
439
+ return sourceData ? (_jsx(Td, { checkedIndexes: checkedIndexes, disabledCheckedIndexes: disabledCheckedIndexes, columnIndex: columnIndex, data: sourceData, getRowClassName: getRowClassName, getRowSelected: getRowSelected, onCheckedIndexesChange: onCheckedIndexesChange, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick, propConfig: config ? config[propName] : undefined, propName: propName, propSchema: propSchema, rowIndex: rowIndex, sortedRenderData: sortedRenderData, style: style, translate: translate })) : null;
440
440
  }, [
441
441
  columnNames,
442
442
  properties,
@@ -449,7 +449,6 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
449
449
  onRowClick,
450
450
  onRowDoubleClick,
451
451
  config,
452
- rowHeight,
453
452
  sortedRenderData,
454
453
  translate,
455
454
  ]);
@@ -570,7 +569,7 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, config, custo
570
569
  type: "text/csv;charset=utf-8",
571
570
  }), "export.csv");
572
571
  }, [sortedRenderData]);
573
- 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", { className: "schema-table__search", type: "text", placeholder: searchPlaceholder || "Search...", value: searchQuery, onChange: onSearchChange, onKeyDown: onInputKeyDown, autoFocus: searchInputAutoFocus, onBlur: onSearchBlur })) : null })), customElement, isExportable ? (_jsx("button", Object.assign({ onClick: onExportDataClick, style: { marginLeft: 8 }, disabled: !(sortedRenderData === null || sortedRenderData === void 0 ? void 0 : sortedRenderData.length) }, { children: "Export data" }))) : null, isSearchable || isColumnFilterable ? (_jsx("button", Object.assign({ onClick: onClearFiltersButtonClick, style: { marginLeft: 8 }, disabled: Object.keys(columnFilterMap).length + searchQuery.length === 0 }, { children: "Clear filters" }))) : 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: {
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: searchInputAutoFocus, onBlur: onSearchBlur })) : null }), customElement || (_jsx("div", { className: "schema-table__custom_element_placeholder" })), isExportable ? (_jsx("button", Object.assign({ onClick: onExportDataClick, style: { marginLeft: 8 }, disabled: !(sortedRenderData === null || sortedRenderData === void 0 ? void 0 : sortedRenderData.length) }, { children: "Export data" }))) : null, isSearchable || isColumnFilterable ? (_jsx("button", Object.assign({ onClick: onClearFiltersButtonClick, style: { marginLeft: 8 }, disabled: Object.keys(columnFilterMap).length + searchQuery.length === 0 }, { children: "Clear filters" }))) : 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: {
574
573
  width: rowWidth,
575
574
  height: Math.max(50, tableBodyHeight),
576
575
  border: "1px solid #BBB",
package/dist/index.css CHANGED
@@ -24,6 +24,9 @@
24
24
  .schema-table select {
25
25
  height: 33px;
26
26
  }
27
+ .schema-table__custom_element_placeholder {
28
+ flex: 1;
29
+ }
27
30
  .schema-table__tbody {
28
31
  overflow-x: hidden !important;
29
32
  border-collapse: collapse;
@@ -32,23 +35,6 @@
32
35
  .schema-table__th-row {
33
36
  overflow: hidden !important;
34
37
  }
35
- .schema-table__td {
36
- overflow: hidden;
37
- white-space: nowrap;
38
- text-overflow: ellipsis;
39
- padding-left: 8px;
40
- padding-right: 8px;
41
- align-items: center;
42
- }
43
- .schema-table__td--odd {
44
- background-color: var(--bs-gray-100, #f8f9fa);
45
- }
46
- .schema-table__td--even {
47
- background-color: var(--bs-white, #fff);
48
- }
49
- .schema-table__td--selected {
50
- background-color: var(--bs-gray-300, #dee2e6);
51
- }
52
38
  .schema-table--clickable-rows .schema-table__td {
53
39
  cursor: pointer;
54
40
  }
@@ -56,6 +42,7 @@
56
42
  display: flex;
57
43
  flex-direction: row;
58
44
  padding-bottom: 1rem;
45
+ align-items: center;
59
46
  }
60
47
 
61
48
  .schema-table__th {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "3.0.84",
3
+ "version": "3.0.86",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"