@helpdice/ui 1.3.5 → 1.3.6

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.
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import _JSXStyle from "../styled-jsx.es.js";
4
- import React, { useEffect, useState } from 'react';
4
+ import React, { useState } from 'react';
5
5
  import useTheme from '../use-theme';
6
6
  import TableCell from './table-cell';
7
7
  import { useTableContext } from './table-context';
8
8
  import useClasses from '../use-classes';
9
9
  import _ from 'lodash';
10
10
  import Placeholder from '../Placeholder';
11
+ import DataTable from './data-table';
11
12
  var TableBody = function TableBody(_ref) {
12
13
  var data = _ref.data,
13
14
  emptyText = _ref.emptyText,
@@ -46,6 +47,9 @@ var TableBody = function TableBody(_ref) {
46
47
  newSelected = newSelected.concat(selected.slice(0, selectedIndex), selected.slice(selectedIndex + 1));
47
48
  }
48
49
  setSelected(newSelected);
50
+ if (newSelected.length > 0 && onSelected) {
51
+ onSelected(newSelected);
52
+ }
49
53
  };
50
54
 
51
55
  // const handleSelectAllClick = (event: { target: { checked: any } }) => {
@@ -58,11 +62,12 @@ var TableBody = function TableBody(_ref) {
58
62
  // };
59
63
 
60
64
  // Push Selected Rows
61
- useEffect(function () {
62
- if (selected.length > 0 && onSelected) {
63
- onSelected(selected);
64
- }
65
- }, [selected]);
65
+ // useEffect(() => {
66
+ // if (selected.length > 0 && onSelected) {
67
+ // onSelected(selected);
68
+ // }
69
+ // }, [selected]);
70
+
66
71
  function renderRow(cols, row, index) {
67
72
  var _row$style;
68
73
  var urid = _.uniqueId();
@@ -122,6 +127,7 @@ var TableBody = function TableBody(_ref) {
122
127
  return /*#__PURE__*/React.createElement("tbody", {
123
128
  className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
124
129
  }, data.map(function (row, index) {
130
+ var _row$table, _row$table2, _row$table3, _row$table4, _row$table5;
125
131
  var qid = _.uniqueId();
126
132
  if (row === null || row === undefined) {
127
133
  var uid = _.uniqueId();
@@ -142,7 +148,17 @@ var TableBody = function TableBody(_ref) {
142
148
  },
143
149
  colSpan: columns.length,
144
150
  className: _JSXStyle.dynamic([["1422656197", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
145
- })));
151
+ }, /*#__PURE__*/React.createElement(DataTable, {
152
+ readOnly: true,
153
+ stickyHeader: false,
154
+ style: _extends({
155
+ height: 'auto !important'
156
+ }, row === null || row === void 0 || (_row$table = row.table) === null || _row$table === void 0 ? void 0 : _row$table.style),
157
+ menu: (_row$table2 = row.table) === null || _row$table2 === void 0 ? void 0 : _row$table2.menu,
158
+ rows: (_row$table3 = row.table) === null || _row$table3 === void 0 ? void 0 : _row$table3.rows,
159
+ heading: (_row$table4 = row.table) === null || _row$table4 === void 0 ? void 0 : _row$table4.heading,
160
+ cols: (_row$table5 = row.table) === null || _row$table5 === void 0 ? void 0 : _row$table5.cols
161
+ }))));
146
162
 
147
163
  // return (
148
164
  // <tr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",