mig-schema-table 3.0.11 → 3.0.13

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # schema-table-component
2
2
 
3
- This component will render fields dynamically based on openApi schema JSON.
3
+ This component will render fields dynamically based on openApi schema JSON. Styling can be done using Bootstrap 5 compatible classes
4
4
 
5
5
  # Install
6
6
  ```
@@ -55,7 +55,6 @@ export default function ColumnFilterRow({ columnNames, getWidth, config, value,
55
55
  return (_jsx("div", Object.assign({ className: "schema-table__th-row", style: { display: "flex", flex: "row" } }, { children: columnNames.map((columnName, index) => {
56
56
  return (_jsx("div", Object.assign({ className: "schema-table__column-filter", style: {
57
57
  width: getWidth(index),
58
- height: 25,
59
58
  paddingBottom: 7,
60
59
  } }, { children: SchemaColumnFilter(index) }), `filter-${index}`));
61
60
  }) })));
@@ -26,15 +26,15 @@ const Th = ({ config, isSortable, name, schema, setSortAsc, setSortColumn, sortA
26
26
  }
27
27
  switch (schema.type) {
28
28
  case "boolean":
29
- thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "center"}`;
29
+ thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "center"} justify-content-${(config === null || config === void 0 ? void 0 : config.align) || "center"}`;
30
30
  break;
31
31
  case "integer":
32
32
  case "number":
33
- thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "end"}`;
33
+ thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "end"} justify-content-${(config === null || config === void 0 ? void 0 : config.align) || "end"}`;
34
34
  break;
35
35
  case "string":
36
36
  if (schema.format && ["date", "date-time"].indexOf(schema.format) >= 0) {
37
- thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "end"}`;
37
+ thDivProps.className += ` text-${(config === null || config === void 0 ? void 0 : config.align) || "end"} justify-content-${(config === null || config === void 0 ? void 0 : config.align) || "end"}`;
38
38
  }
39
39
  }
40
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 }))) })));
@@ -146,7 +146,7 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
146
146
  if (!result) {
147
147
  return result;
148
148
  }
149
- if (isColumnSearchable || searchQuery) {
149
+ if (isColumnSearchable || isSearchable) {
150
150
  return result.filter((item) => {
151
151
  const globalSearchFilterResult = searchQuery
152
152
  ? !!columnNames.find((columnName) =>
@@ -175,6 +175,7 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
175
175
  columnNames,
176
176
  columnSearchObj,
177
177
  isColumnSearchable,
178
+ isSearchable,
178
179
  renderData,
179
180
  searchQuery,
180
181
  ]);
@@ -278,5 +279,5 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
278
279
  ? rowsMaxHeight
279
280
  : rowsHeight;
280
281
  }, [maxHeight, isSearchable, rowCount, rowHeight]);
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}`)] })));
282
+ 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}`), isColumnSearchable ? (_jsx(ColumnFilterRow, { schema: schema, columnNames: columnNames, config: config, value: columnSearchObj, columnSearchHandler: columnSearchHandler, getWidth: getColumnWidth })) : null, _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}`)] })));
282
283
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "3.0.11",
3
+ "version": "3.0.13",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"