@helpdice/ui 1.6.6 → 1.6.8

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.
@@ -2814,11 +2814,9 @@ var TableCell = function TableCell(_ref) {
2814
2814
  onCellClick = _ref.onCellClick;
2815
2815
  /* eslint-disable react/jsx-no-useless-fragment */
2816
2816
  return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
2817
- var _String;
2818
2817
  var currentRowValue = row[column.prop];
2819
2818
  var cellValue = currentRowValue || emptyText;
2820
2819
  var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
2821
- var dataName = (_String = String(column === null || column === void 0 ? void 0 : column.label)) === null || _String === void 0 ? void 0 : _String.replace(' ', '_').toLowerCase();
2822
2820
  return /*#__PURE__*/React.createElement("td", {
2823
2821
  style: _objectSpread2({
2824
2822
  fontSize: "".concat(column === null || column === void 0 ? void 0 : column.fontSize),
@@ -2829,7 +2827,7 @@ var TableCell = function TableCell(_ref) {
2829
2827
  boxSizing: 'border-box',
2830
2828
  whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
2831
2829
  }, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
2832
- "data-column": dataName,
2830
+ "data-column": column.prop,
2833
2831
  key: "row-td-".concat(index, "-").concat(column.prop.toString()),
2834
2832
  onClick: function onClick() {
2835
2833
  return onCellClick && onCellClick(currentRowValue, rowIndex, index);
@@ -31652,22 +31650,20 @@ function DataTable(_ref) {
31652
31650
  }
31653
31651
  React.useEffect(function () {
31654
31652
  cols.forEach(function (col) {
31655
- var _String2;
31656
- var dataName = (_String2 = String(col === null || col === void 0 ? void 0 : col.name)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
31657
31653
  if (hideColumn.includes(col.name)) {
31658
- document.querySelectorAll("[data-column=\"".concat(dataName, "\"]")).forEach(function (el) {
31654
+ document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
31659
31655
  el.style.display = 'none !important';
31660
31656
  });
31661
31657
  } else {
31662
- document.querySelectorAll("[data-column=\"".concat(dataName, "\"]")).forEach(function (el) {
31658
+ document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
31663
31659
  el.style.display = '';
31664
31660
  });
31665
31661
  }
31666
31662
  });
31667
31663
  }, [hideColumn, cols]);
31668
31664
  function handleHideColumnClick(_event, _id) {
31669
- var _String3;
31670
- var id = (_String3 = String(_id)) === null || _String3 === void 0 ? void 0 : _String3.replace(' ', '_').toLowerCase();
31665
+ var _String2;
31666
+ var id = (_String2 = String(_id)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
31671
31667
  var selectedIndex = hideColumn.indexOf(id);
31672
31668
  var newSelected = [];
31673
31669
  if (selectedIndex === -1) {
@@ -31779,16 +31775,14 @@ function DataTable(_ref) {
31779
31775
 
31780
31776
  var content = function content() {
31781
31777
  return /*#__PURE__*/React.createElement(React.Fragment, null, cols.map(function (option, _index) {
31782
- var _String4;
31783
31778
  // const colunqid = _.uniqueId(`${option.name}-${index}`);
31784
- var dataName = (_String4 = String(option.name)) === null || _String4 === void 0 ? void 0 : _String4.replace(' ', '_').toLowerCase();
31785
- var isSelected = !hideColumn.includes(dataName);
31779
+ var isSelected = !hideColumn.includes(option.id);
31786
31780
  return /*#__PURE__*/React.createElement(Popover.Item, {
31787
31781
  selected: isSelected
31788
31782
  // key={colunqid}
31789
31783
  ,
31790
31784
  onClick: function onClick(e) {
31791
- return handleHideColumnClick(e, option.name);
31785
+ return handleHideColumnClick(e, option.id);
31792
31786
  }
31793
31787
  }, /*#__PURE__*/React.createElement("span", null, option.name));
31794
31788
  }));
@@ -31806,7 +31800,7 @@ function DataTable(_ref) {
31806
31800
  // )
31807
31801
 
31808
31802
  var SELECTED = React.useMemo(function () {
31809
- if (selected.length > 0 && onSelected) {
31803
+ if (onSelected) {
31810
31804
  return onSelected(selected);
31811
31805
  }
31812
31806
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -31847,7 +31841,7 @@ function DataTable(_ref) {
31847
31841
  },
31848
31842
  justify: "flex-end",
31849
31843
  alignContent: "center"
31850
- }, menu, !children && !readOnly ? /*#__PURE__*/React.createElement(React.Fragment, null, SELECTED, onSelectedEdit && selected.length === 1 ? /*#__PURE__*/React.createElement(Tooltip, {
31844
+ }, menu, !children && !readOnly ? /*#__PURE__*/React.createElement(React.Fragment, null, (selected === null || selected === void 0 ? void 0 : selected.length) > 0 && SELECTED, onSelectedEdit && selected.length === 1 ? /*#__PURE__*/React.createElement(Tooltip, {
31851
31845
  text: "Edit Selected",
31852
31846
  placement: "bottom",
31853
31847
  font: 0.8,
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from 'react';
1
+ import React, { CSSProperties } from 'react';
2
2
  type CompactButtonProps = {
3
3
  children?: React.ReactNode;
4
4
  iconRight?: React.ReactNode;
@@ -11,5 +11,5 @@ type CompactButtonProps = {
11
11
  target?: string;
12
12
  onClick?: () => void;
13
13
  };
14
- declare const _default: import("react").NamedExoticComponent<CompactButtonProps>;
14
+ declare const _default: React.NamedExoticComponent<CompactButtonProps>;
15
15
  export default _default;
@@ -1,4 +1,4 @@
1
- import { memo } from 'react';
1
+ import React, { memo } from 'react';
2
2
  import Button from './button';
3
3
  var CompactButton = function CompactButton(_ref) {
4
4
  var _ref$to = _ref.to,
@@ -100,22 +100,20 @@ function DataTable(_ref) {
100
100
  }
101
101
  useEffect(function () {
102
102
  cols.forEach(function (col) {
103
- var _String2;
104
- var dataName = (_String2 = String(col === null || col === void 0 ? void 0 : col.name)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
105
103
  if (hideColumn.includes(col.name)) {
106
- document.querySelectorAll("[data-column=\"".concat(dataName, "\"]")).forEach(function (el) {
104
+ document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
107
105
  el.style.display = 'none !important';
108
106
  });
109
107
  } else {
110
- document.querySelectorAll("[data-column=\"".concat(dataName, "\"]")).forEach(function (el) {
108
+ document.querySelectorAll("[data-column=\"".concat(col.id, "\"]")).forEach(function (el) {
111
109
  el.style.display = '';
112
110
  });
113
111
  }
114
112
  });
115
113
  }, [hideColumn, cols]);
116
114
  function handleHideColumnClick(_event, _id) {
117
- var _String3;
118
- var id = (_String3 = String(_id)) === null || _String3 === void 0 ? void 0 : _String3.replace(' ', '_').toLowerCase();
115
+ var _String2;
116
+ var id = (_String2 = String(_id)) === null || _String2 === void 0 ? void 0 : _String2.replace(' ', '_').toLowerCase();
119
117
  var selectedIndex = hideColumn.indexOf(id);
120
118
  var newSelected = [];
121
119
  if (selectedIndex === -1) {
@@ -227,16 +225,14 @@ function DataTable(_ref) {
227
225
 
228
226
  var content = function content() {
229
227
  return /*#__PURE__*/React.createElement(React.Fragment, null, cols.map(function (option, _index) {
230
- var _String4;
231
228
  // const colunqid = _.uniqueId(`${option.name}-${index}`);
232
- var dataName = (_String4 = String(option.name)) === null || _String4 === void 0 ? void 0 : _String4.replace(' ', '_').toLowerCase();
233
- var isSelected = !hideColumn.includes(dataName);
229
+ var isSelected = !hideColumn.includes(option.id);
234
230
  return /*#__PURE__*/React.createElement(Popover.Item, {
235
231
  selected: isSelected
236
232
  // key={colunqid}
237
233
  ,
238
234
  onClick: function onClick(e) {
239
- return handleHideColumnClick(e, option.name);
235
+ return handleHideColumnClick(e, option.id);
240
236
  }
241
237
  }, /*#__PURE__*/React.createElement("span", null, option.name));
242
238
  }));
@@ -254,7 +250,7 @@ function DataTable(_ref) {
254
250
  // )
255
251
 
256
252
  var SELECTED = useMemo(function () {
257
- if (selected.length > 0 && onSelected) {
253
+ if (onSelected) {
258
254
  return onSelected(selected);
259
255
  }
260
256
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -295,7 +291,7 @@ function DataTable(_ref) {
295
291
  },
296
292
  justify: "flex-end",
297
293
  alignContent: "center"
298
- }, menu, !children && !readOnly ? /*#__PURE__*/React.createElement(React.Fragment, null, SELECTED, onSelectedEdit && selected.length === 1 ? /*#__PURE__*/React.createElement(Tooltip, {
294
+ }, menu, !children && !readOnly ? /*#__PURE__*/React.createElement(React.Fragment, null, (selected === null || selected === void 0 ? void 0 : selected.length) > 0 && SELECTED, onSelectedEdit && selected.length === 1 ? /*#__PURE__*/React.createElement(Tooltip, {
299
295
  text: "Edit Selected",
300
296
  placement: "bottom",
301
297
  font: 0.8,
@@ -8,11 +8,9 @@ var TableCell = function TableCell(_ref) {
8
8
  onCellClick = _ref.onCellClick;
9
9
  /* eslint-disable react/jsx-no-useless-fragment */
10
10
  return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
11
- var _String;
12
11
  var currentRowValue = row[column.prop];
13
12
  var cellValue = currentRowValue || emptyText;
14
13
  var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
15
- var dataName = (_String = String(column === null || column === void 0 ? void 0 : column.label)) === null || _String === void 0 ? void 0 : _String.replace(' ', '_').toLowerCase();
16
14
  return /*#__PURE__*/React.createElement("td", {
17
15
  style: _extends({
18
16
  fontSize: "".concat(column === null || column === void 0 ? void 0 : column.fontSize),
@@ -23,7 +21,7 @@ var TableCell = function TableCell(_ref) {
23
21
  boxSizing: 'border-box',
24
22
  whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
25
23
  }, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
26
- "data-column": dataName,
24
+ "data-column": column.prop,
27
25
  key: "row-td-".concat(index, "-").concat(column.prop.toString()),
28
26
  onClick: function onClick() {
29
27
  return onCellClick && onCellClick(currentRowValue, rowIndex, index);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "prettier": "@helpdice/prettier-config",
38
38
  "keywords": [
39
- "hui",
39
+ "iux",
40
40
  "helpdice ui",
41
41
  "components",
42
42
  "react components",