@helpdice/ui 1.3.5 → 1.3.7
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.
- package/dist/index.js +556 -535
- package/dist/popover/index.js +6 -1
- package/dist/popover/popover-item.d.ts +1 -0
- package/dist/table/index.js +1323 -1302
- package/esm/popover/popover-item.d.ts +1 -0
- package/esm/popover/popover-item.js +6 -1
- package/esm/table/data-table.js +7 -6
- package/esm/table/table-body.js +23 -7
- package/esm/table/table-cell.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "line", "showTitle", "className", "onClick", "disableAutoClose"];
|
|
3
|
+
var _excluded = ["children", "line", "showTitle", "className", "onClick", "selected", "disableAutoClose"];
|
|
4
4
|
import _JSXStyle from "../styled-jsx.es.js";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import useTheme from '../use-theme';
|
|
@@ -16,6 +16,8 @@ var PopoverItemComponent = function PopoverItemComponent(_ref) {
|
|
|
16
16
|
_ref$className = _ref.className,
|
|
17
17
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
18
18
|
onClick = _ref.onClick,
|
|
19
|
+
_ref$selected = _ref.selected,
|
|
20
|
+
selected = _ref$selected === void 0 ? false : _ref$selected,
|
|
19
21
|
_ref$disableAutoClose = _ref.disableAutoClose,
|
|
20
22
|
disableAutoClose = _ref$disableAutoClose === void 0 ? false : _ref$disableAutoClose,
|
|
21
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -39,6 +41,9 @@ var PopoverItemComponent = function PopoverItemComponent(_ref) {
|
|
|
39
41
|
onItemClick(event);
|
|
40
42
|
};
|
|
41
43
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
|
|
44
|
+
style: {
|
|
45
|
+
backgroundColor: selected ? '#efefef' : ''
|
|
46
|
+
},
|
|
42
47
|
onClick: clickHandler
|
|
43
48
|
}, props, {
|
|
44
49
|
className: _JSXStyle.dynamic([["190621384", [theme.palette.accents_5, SCALES.font(0.875), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0.5), SCALES.pr(0.75), SCALES.pb(0.5), SCALES.pl(0.75), hasHandler ? 'pointer' : 'default', theme.palette.foreground, theme.palette.border, SCALES.height(0.0625), SCALES.mt(0.35), SCALES.mr(0), SCALES.mb(0.35), SCALES.ml(0), SCALES.width(1, '100%'), SCALES.font(0.925), theme.palette.foreground]]]) + " " + (props && props.className != null && props.className || classes || "")
|
package/esm/table/data-table.js
CHANGED
|
@@ -86,11 +86,11 @@ function DataTable(_ref) {
|
|
|
86
86
|
useEffect(function () {
|
|
87
87
|
cols.forEach(function (col) {
|
|
88
88
|
if (hideColumn.includes(col.name)) {
|
|
89
|
-
document.querySelectorAll("[data-column=\"".concat(col.name, "\"]")).forEach(function (el) {
|
|
90
|
-
el.style.display = 'none';
|
|
89
|
+
document.querySelectorAll("[data-column=\"".concat(String(col.name).toLowerCase(), "\"]")).forEach(function (el) {
|
|
90
|
+
el.style.display = 'none !important';
|
|
91
91
|
});
|
|
92
92
|
} else {
|
|
93
|
-
document.querySelectorAll("[data-column=\"".concat(col.name, "\"]")).forEach(function (el) {
|
|
93
|
+
document.querySelectorAll("[data-column=\"".concat(String(col.name).toLowerCase(), "\"]")).forEach(function (el) {
|
|
94
94
|
el.style.display = '';
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -151,10 +151,10 @@ function DataTable(_ref) {
|
|
|
151
151
|
var content = function content() {
|
|
152
152
|
return /*#__PURE__*/React.createElement(React.Fragment, null, cols.map(function (option, index) {
|
|
153
153
|
var colunqid = _.uniqueId("".concat(option.name, "-").concat(index));
|
|
154
|
+
var isSelected = !hideColumn.includes(option.name);
|
|
154
155
|
return /*#__PURE__*/React.createElement(Popover.Item, {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
,
|
|
156
|
+
selected: isSelected,
|
|
157
|
+
key: colunqid,
|
|
158
158
|
onClick: function onClick(e) {
|
|
159
159
|
return handleHideColumnClick(e, option.name);
|
|
160
160
|
}
|
|
@@ -162,6 +162,7 @@ function DataTable(_ref) {
|
|
|
162
162
|
}));
|
|
163
163
|
};
|
|
164
164
|
return /*#__PURE__*/React.createElement(Container, {
|
|
165
|
+
className: "helpdice-ui-table-container",
|
|
165
166
|
direction: "column"
|
|
166
167
|
}, /*#__PURE__*/React.createElement(Grid.Container, {
|
|
167
168
|
style: {
|
package/esm/table/table-body.js
CHANGED
|
@@ -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, {
|
|
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(
|
|
62
|
-
|
|
63
|
-
|
|
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/esm/table/table-cell.js
CHANGED
|
@@ -20,7 +20,7 @@ var TableCell = function TableCell(_ref) {
|
|
|
20
20
|
color: "".concat(column === null || column === void 0 ? void 0 : column.color),
|
|
21
21
|
whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
|
|
22
22
|
}, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
|
|
23
|
-
"data-column": column.label,
|
|
23
|
+
"data-column": String(column.label).toLowerCase(),
|
|
24
24
|
key: "row-td-".concat(index, "-").concat(column.prop.toString()),
|
|
25
25
|
onClick: function onClick() {
|
|
26
26
|
return onCellClick && onCellClick(currentRowValue, rowIndex, index);
|