@vendorflow/components 2.0.92 → 2.0.94

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.
@@ -22,7 +22,8 @@ export interface TableFeatureOptions<D extends object> {
22
22
  rowExpanding?: {
23
23
  enabled: boolean;
24
24
  mode: Mode;
25
- Component: (props: {
25
+ /** @deprecated Use the ExpandedRow component prop instead. */
26
+ Component?: (props: {
26
27
  data: D;
27
28
  }) => JSX.Element;
28
29
  autoResetExpanded?: boolean;
@@ -74,8 +75,11 @@ interface Props<D extends object> {
74
75
  options?: TableFeatureOptions<D>;
75
76
  renderActions?: () => ReactNode;
76
77
  renderRowSelectActions?: () => ReactNode;
78
+ ExpandedRow?: (props: {
79
+ data: D;
80
+ }) => JSX.Element;
77
81
  }
78
- export default function DataTable<D extends object>({ title, labels, columns, instance, options, renderActions, renderRowSelectActions, ...restOfProps }: Props<D>): JSX.Element;
82
+ export default function DataTable<D extends object>({ title, labels, columns, instance, options, renderActions, renderRowSelectActions, ExpandedRow, ...restOfProps }: Props<D>): JSX.Element;
79
83
  export declare function usePluginConfig<D extends object>(options: TableFeatureOptions<D>): PluginHook<D>[];
80
84
  export interface UseDefaultTableInstanceProps<D extends object> {
81
85
  columns: EnhancedColumn<D>[];
@@ -101,7 +101,7 @@ var EXPAND_BTN_WIDTH = 24;
101
101
  var NO_MATCH_TEXT = 'Sorry, no matching records found';
102
102
  function DataTable(_a) {
103
103
  var _b;
104
- var title = _a.title, labels = _a.labels, columns = _a.columns, instance = _a.instance, options = _a.options, renderActions = _a.renderActions, renderRowSelectActions = _a.renderRowSelectActions, restOfProps = __rest(_a, ["title", "labels", "columns", "instance", "options", "renderActions", "renderRowSelectActions"]);
104
+ var title = _a.title, labels = _a.labels, columns = _a.columns, instance = _a.instance, options = _a.options, renderActions = _a.renderActions, renderRowSelectActions = _a.renderRowSelectActions, ExpandedRow = _a.ExpandedRow, restOfProps = __rest(_a, ["title", "labels", "columns", "instance", "options", "renderActions", "renderRowSelectActions", "ExpandedRow"]);
105
105
  var tableHeadRef = (0, react_2.useRef)(null);
106
106
  var tableBodyRef = (0, react_2.useRef)(null);
107
107
  var scrollContainerRef = (0, react_2.useRef)(null);
@@ -114,7 +114,7 @@ function DataTable(_a) {
114
114
  var _h = __read((0, react_2.useState)(0), 2), scrollLeft = _h[0], setScrollLeft = _h[1];
115
115
  var _j = (labels || { noMatchLabel: NO_MATCH_TEXT }).noMatchLabel, noMatchLabel = _j === void 0 ? NO_MATCH_TEXT : _j;
116
116
  var _k = options || {}, rowExpandingConfig = _k.rowExpanding, filtersConfig = _k.filters, globalSearchConfig = _k.globalSearch, columnHidingConfig = _k.columnHiding, paginationConfig = _k.pagination, sortingConfig = _k.sorting, tableConfig = _k.table, virtualizeConfig = _k.virtualize;
117
- var ExpandedComponent = (rowExpandingConfig || {}).Component;
117
+ var ExpandedComponent = ExpandedRow || (rowExpandingConfig === null || rowExpandingConfig === void 0 ? void 0 : rowExpandingConfig.Component) || null;
118
118
  var allColumns = instance.allColumns, getTableProps = instance.getTableProps, gotoPage = instance.gotoPage, headerGroups = instance.headerGroups, page = instance.page, prepareRow = instance.prepareRow, rows = instance.rows, setAllFilters = instance.setAllFilters, setPageSize = instance.setPageSize, setFilter = instance.setFilter, setGlobalFilter = instance.setGlobalFilter, state = instance.state, totalColumnsWidth = instance.totalColumnsWidth;
119
119
  var pageOptions = ((_b = options === null || options === void 0 ? void 0 : options.pagination) === null || _b === void 0 ? void 0 : _b.rowsPerPageOptions) || instance.pageOptions;
120
120
  var columnNameById = (0, react_2.useMemo)(function () {
@@ -30,7 +30,6 @@ function DataTable() {
30
30
  rowExpanding: {
31
31
  enabled: true,
32
32
  mode: 'multi',
33
- Component: function () { return react_1.default.createElement("div", null, "Hello"); },
34
33
  },
35
34
  filters: {
36
35
  enabled: true,
@@ -72,6 +71,6 @@ function DataTable() {
72
71
  });
73
72
  return (react_1.default.createElement(material_1.ThemeProvider, { theme: (0, material_1.createTheme)() },
74
73
  react_1.default.createElement("div", { style: { height: '700px', width: '640px' } },
75
- react_1.default.createElement(DataTable_1.default, { title: "People", columns: columns, instance: instance, options: options, renderActions: function () { return react_1.default.createElement(material_1.Button, { onClick: function () { return alert('Thanks!'); } }, "Click Me"); }, renderRowSelectActions: function () { return react_1.default.createElement(material_1.Button, { onClick: function () { return alert('Thanks!'); } }, "Click Me"); } }))));
74
+ react_1.default.createElement(DataTable_1.default, { title: "People", columns: columns, instance: instance, options: options, renderActions: function () { return react_1.default.createElement(material_1.Button, { onClick: function () { return alert('Thanks!'); } }, "Click Me"); }, renderRowSelectActions: function () { return react_1.default.createElement(material_1.Button, { onClick: function () { return alert('Thanks!'); } }, "Click Me"); }, ExpandedRow: function () { return react_1.default.createElement("div", null, "Hello"); } }))));
76
75
  }
77
76
  exports.default = DataTable;
@@ -7,7 +7,7 @@ import { TableRowProps } from 'react-table';
7
7
  interface Props<D extends object> {
8
8
  ExpandedComponent: ((props: {
9
9
  data: D;
10
- }) => JSX.Element) | undefined;
10
+ }) => JSX.Element) | null | undefined;
11
11
  row: EnhancedRow<D>;
12
12
  rowProps: Omit<TableRowProps, 'key'>;
13
13
  innerRef?: ((element?: Element | undefined) => void) | undefined;
@@ -6,9 +6,9 @@ import { Row } from 'react-table';
6
6
  import { HasScrollbar } from '@vendorflow/common/lib/hooks';
7
7
  interface Props<D extends object> {
8
8
  defaultRowHeight: number;
9
- ExpandedComponent: ((props: {
9
+ ExpandedComponent?: ((props: {
10
10
  data: D;
11
- }) => JSX.Element) | undefined;
11
+ }) => JSX.Element) | null | undefined;
12
12
  flexLayoutEnabled: boolean;
13
13
  hasScrollbar: HasScrollbar;
14
14
  hasScrollbarRefCallback: (node: HTMLDivElement | null) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendorflow/components",
3
- "version": "2.0.92",
3
+ "version": "2.0.94",
4
4
  "description": "React components for vendorflow",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",