@vendorflow/components 2.0.78 → 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);
@@ -67,9 +67,7 @@ function ViewColumnTool(_a) {
67
67
  (0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n "], ["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n "]))) }, allColumns
68
68
  .filter(function (column) { return column.id !== 'custom'; })
69
69
  .map(function (column) {
70
- var label = columnNameById[column.id];
71
- console.log('-> label', label);
72
- return ((0, react_1.jsx)(material_1.FormControlLabel, { key: column.id, label: label,
70
+ return ((0, react_1.jsx)(material_1.FormControlLabel, { key: column.id, label: columnNameById[column.id],
73
71
  // @ts-ignore
74
72
  control: (0, react_1.jsx)(IndeterminateCheckbox_1.default, __assign({}, column.getToggleHiddenProps())) }));
75
73
  }))))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendorflow/components",
3
- "version": "2.0.78",
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",