@vendorflow/components 2.0.76 → 2.0.79

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.
@@ -119,21 +119,22 @@ function DataTable(_a) {
119
119
  var columnNameById = (0, react_2.useMemo)(function () {
120
120
  var result = {};
121
121
  function addNamesToMap(cols, result) {
122
- cols.forEach(function (col) {
122
+ cols.forEach(function (col, index) {
123
123
  var id = col.id != null ? col.id : typeof col.accessor === 'string' ? col.accessor : null;
124
- if (id) {
125
- if (col.filterName) {
126
- result[id] = col.filterName;
127
- }
128
- else if (typeof col.Header === 'string') {
129
- result[id] = col.Header;
130
- }
131
- else if (!col.name) {
132
- throw new Error("Please provide a name for column with id = " + col.id + ".");
133
- }
134
- else {
135
- result[id] = col.name;
136
- }
124
+ if (!id) {
125
+ throw new Error("Please provide an id for column " + (typeof col.Header === 'string' && !!col.Header ? col.Header : col.name ? col.name : "at index " + index));
126
+ }
127
+ if (col.filterName) {
128
+ result[id] = col.filterName;
129
+ }
130
+ else if (typeof col.Header === 'string') {
131
+ result[id] = col.Header;
132
+ }
133
+ else if (!col.name) {
134
+ throw new Error("Please provide a name for column with id = " + col.id + ".");
135
+ }
136
+ else {
137
+ result[id] = col.name;
137
138
  }
138
139
  if (Array.isArray(col === null || col === void 0 ? void 0 : col.columns)) {
139
140
  addNamesToMap(col.columns, result);
@@ -46,12 +46,12 @@ function DataTable() {
46
46
  enabled: true,
47
47
  },
48
48
  pagination: {
49
- enabled: true,
49
+ enabled: false,
50
50
  rowsPerPageOptions: [5, 10, 20],
51
51
  pageSize: 10,
52
52
  },
53
53
  virtualize: {
54
- enabled: false,
54
+ enabled: true,
55
55
  },
56
56
  rowSelect: {
57
57
  enabled: true,
@@ -68,7 +68,8 @@ function DataTable() {
68
68
  columns: columns,
69
69
  data: data,
70
70
  options: options,
71
- defaultColumn: { minWidth: 50, width: 150, maxWidth: 200 },
71
+ defaultColumn: { minWidth: 50, width: 150 },
72
+ initialState: { hiddenColumns: ['firstName'] },
72
73
  });
73
74
  return (react_1.default.createElement(material_1.ThemeProvider, { theme: (0, material_1.createTheme)() },
74
75
  react_1.default.createElement("div", { style: { height: '700px', width: '640px' } },
@@ -28,6 +28,16 @@ var react_2 = require("react");
28
28
  function TableBodyContent(_a) {
29
29
  var defaultRowHeight = _a.defaultRowHeight, ExpandedComponent = _a.ExpandedComponent, hasScrollbarRefCallback = _a.hasScrollbarRefCallback, height = _a.height, isVirtualizeEnabled = _a.isVirtualizeEnabled, noMatchLabel = _a.noMatchLabel, prepareRow = _a.prepareRow, scrollContainerRef = _a.scrollContainerRef, setScrollLeft = _a.setScrollLeft, tableBodyRef = _a.tableBodyRef, tableBodyMeasureRefCallback = _a.tableBodyMeasureRefCallback, tableRows = _a.tableRows, totalColumnsWidth = _a.totalColumnsWidth, width = _a.width;
30
30
  var cache = (0, react_2.useRef)(new react_virtualized_1.CellMeasurerCache({ fixedWidth: true, defaultHeight: defaultRowHeight, defaultWidth: totalColumnsWidth }));
31
+ (0, react_2.useEffect)(function () {
32
+ if (isVirtualizeEnabled) {
33
+ cache.current = new react_virtualized_1.CellMeasurerCache({
34
+ fixedWidth: true,
35
+ defaultHeight: defaultRowHeight,
36
+ defaultWidth: totalColumnsWidth,
37
+ });
38
+ cache.current.clearAll();
39
+ }
40
+ }, [totalColumnsWidth]);
31
41
  function renderRow(_a) {
32
42
  var columnIndex = _a.columnIndex, rowIndex = _a.rowIndex, key = _a.key, parent = _a.parent, style = _a.style;
33
43
  var row = tableRows[rowIndex];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendorflow/components",
3
- "version": "2.0.76",
3
+ "version": "2.0.79",
4
4
  "description": "React components for vendorflow",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",