@spark-web/data-table 1.0.0-rc.1 → 1.0.0-rc.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @spark-web/data-table
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.2
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- add parser
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @spark-web/checkbox@2.0.0-rc.2
|
|
13
|
+
- @spark-web/spinner@2.0.0-rc.2
|
|
14
|
+
- @spark-web/theme@4.0.0-rc.2
|
|
15
|
+
- @spark-web/utils@2.0.0-rc.2
|
|
16
|
+
- @spark-web/a11y@2.0.0-rc.2
|
|
17
|
+
- @spark-web/text@2.0.0-rc.2
|
|
18
|
+
- @spark-web/box@2.0.0-rc.2
|
|
19
|
+
|
|
3
20
|
## 1.0.0-rc.1
|
|
4
21
|
|
|
5
22
|
### Major Changes
|
|
@@ -12,7 +12,7 @@ var internal = require('@spark-web/utils/internal');
|
|
|
12
12
|
var reactTable = require('@tanstack/react-table');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var reactIntersectionObserver = require('react-intersection-observer');
|
|
15
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
16
16
|
|
|
17
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
18
18
|
|
|
@@ -60,15 +60,15 @@ function DataTable(_ref) {
|
|
|
60
60
|
var defaultOnRowClick = function defaultOnRowClick(row) {
|
|
61
61
|
return row.toggleSelected();
|
|
62
62
|
};
|
|
63
|
-
return
|
|
63
|
+
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
64
64
|
as: "table"
|
|
65
65
|
}, data ? internal.buildDataAttributes(data) : undefined), {}, {
|
|
66
66
|
className: className,
|
|
67
|
-
children: [headerGroups.length > 0 ?
|
|
67
|
+
children: [headerGroups.length > 0 ? jsxRuntime.jsx(react.ClassNames, {
|
|
68
68
|
children: function children(_ref2) {
|
|
69
69
|
var css = _ref2.css,
|
|
70
70
|
cx = _ref2.cx;
|
|
71
|
-
return
|
|
71
|
+
return jsxRuntime.jsx(box.Box, {
|
|
72
72
|
as: "thead",
|
|
73
73
|
background: "neutral",
|
|
74
74
|
className: cx(css({
|
|
@@ -78,10 +78,10 @@ function DataTable(_ref) {
|
|
|
78
78
|
boxShadow: "inset 0 -2px 0 ".concat(theme$1.border.color.primary)
|
|
79
79
|
}, headerClassName)),
|
|
80
80
|
children: headerGroups.map(function (headerGroup) {
|
|
81
|
-
return
|
|
81
|
+
return jsxRuntime.jsx(box.Box, {
|
|
82
82
|
as: "tr",
|
|
83
83
|
children: headerGroup.headers.map(function (header) {
|
|
84
|
-
return
|
|
84
|
+
return jsxRuntime.jsx(box.Box, {
|
|
85
85
|
as: "th",
|
|
86
86
|
color: theme$1.color.foreground.muted,
|
|
87
87
|
padding: "medium",
|
|
@@ -98,11 +98,11 @@ function DataTable(_ref) {
|
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
}) : null,
|
|
101
|
+
}) : null, jsxRuntime.jsxs(box.Box, {
|
|
102
102
|
as: "tbody",
|
|
103
103
|
children: [!renderRow ? table.getRowModel().rows.map(function (row) {
|
|
104
|
-
return
|
|
105
|
-
children: [
|
|
104
|
+
return jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
105
|
+
children: [jsxRuntime.jsx(box.Box, {
|
|
106
106
|
as: "tr",
|
|
107
107
|
css: react.css({
|
|
108
108
|
'&[data-is-selected="true"],&[data-is-expanded="true"]': {
|
|
@@ -119,7 +119,7 @@ function DataTable(_ref) {
|
|
|
119
119
|
"data-is-selected": row.getIsSelected(),
|
|
120
120
|
"data-is-expanded": row.getIsExpanded(),
|
|
121
121
|
children: row.getVisibleCells().map(function (cell) {
|
|
122
|
-
return
|
|
122
|
+
return jsxRuntime.jsx(box.Box, {
|
|
123
123
|
as: "td",
|
|
124
124
|
padding: "large",
|
|
125
125
|
css: react.css({
|
|
@@ -134,7 +134,7 @@ function DataTable(_ref) {
|
|
|
134
134
|
})
|
|
135
135
|
}), enableExpanding && row.getIsExpanded() && expandedRowComponent && expandedRowComponent(row, table)]
|
|
136
136
|
}, row.id);
|
|
137
|
-
}) : renderRow(table), showSpinner &&
|
|
137
|
+
}) : renderRow(table), showSpinner && jsxRuntime.jsx(reactIntersectionObserver.InView, {
|
|
138
138
|
as: "tr"
|
|
139
139
|
// @ts-ignore
|
|
140
140
|
,
|
|
@@ -142,7 +142,7 @@ function DataTable(_ref) {
|
|
|
142
142
|
columnSpan: 'all'
|
|
143
143
|
}),
|
|
144
144
|
onChange: onBottomSpinnerShown,
|
|
145
|
-
children:
|
|
145
|
+
children: jsxRuntime.jsx(box.Box, {
|
|
146
146
|
as: "td",
|
|
147
147
|
padding: "large",
|
|
148
148
|
colSpan: headerGroups.map(function (hg) {
|
|
@@ -154,7 +154,7 @@ function DataTable(_ref) {
|
|
|
154
154
|
textAlign: 'center',
|
|
155
155
|
verticalAlign: 'middle'
|
|
156
156
|
}),
|
|
157
|
-
children:
|
|
157
|
+
children: jsxRuntime.jsx(spinner.Spinner, {
|
|
158
158
|
data: {
|
|
159
159
|
testId: 'data-table-spinner'
|
|
160
160
|
},
|
|
@@ -162,17 +162,17 @@ function DataTable(_ref) {
|
|
|
162
162
|
})
|
|
163
163
|
})
|
|
164
164
|
})]
|
|
165
|
-
}), footerGroups.length > 0 ?
|
|
165
|
+
}), footerGroups.length > 0 ? jsxRuntime.jsx(react.ClassNames, {
|
|
166
166
|
children: function children(_ref3) {
|
|
167
167
|
var cx = _ref3.cx;
|
|
168
|
-
return
|
|
168
|
+
return jsxRuntime.jsx(box.Box, {
|
|
169
169
|
as: "tfoot",
|
|
170
170
|
className: cx(footerClassName),
|
|
171
171
|
children: footerGroups.map(function (footerGroup) {
|
|
172
|
-
return
|
|
172
|
+
return jsxRuntime.jsx(box.Box, {
|
|
173
173
|
as: "tr",
|
|
174
174
|
children: footerGroup.headers.map(function (footer) {
|
|
175
|
-
return
|
|
175
|
+
return jsxRuntime.jsx(box.Box, {
|
|
176
176
|
as: "td",
|
|
177
177
|
children: reactTable.flexRender(footer.column.columnDef.footer, footer.getContext())
|
|
178
178
|
}, footer.id);
|
|
@@ -12,7 +12,7 @@ var internal = require('@spark-web/utils/internal');
|
|
|
12
12
|
var reactTable = require('@tanstack/react-table');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var reactIntersectionObserver = require('react-intersection-observer');
|
|
15
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
16
16
|
|
|
17
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
18
18
|
|
|
@@ -60,15 +60,15 @@ function DataTable(_ref) {
|
|
|
60
60
|
var defaultOnRowClick = function defaultOnRowClick(row) {
|
|
61
61
|
return row.toggleSelected();
|
|
62
62
|
};
|
|
63
|
-
return
|
|
63
|
+
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
64
64
|
as: "table"
|
|
65
65
|
}, data ? internal.buildDataAttributes(data) : undefined), {}, {
|
|
66
66
|
className: className,
|
|
67
|
-
children: [headerGroups.length > 0 ?
|
|
67
|
+
children: [headerGroups.length > 0 ? jsxRuntime.jsx(react.ClassNames, {
|
|
68
68
|
children: function children(_ref2) {
|
|
69
69
|
var css = _ref2.css,
|
|
70
70
|
cx = _ref2.cx;
|
|
71
|
-
return
|
|
71
|
+
return jsxRuntime.jsx(box.Box, {
|
|
72
72
|
as: "thead",
|
|
73
73
|
background: "neutral",
|
|
74
74
|
className: cx(css({
|
|
@@ -78,10 +78,10 @@ function DataTable(_ref) {
|
|
|
78
78
|
boxShadow: "inset 0 -2px 0 ".concat(theme$1.border.color.primary)
|
|
79
79
|
}, headerClassName)),
|
|
80
80
|
children: headerGroups.map(function (headerGroup) {
|
|
81
|
-
return
|
|
81
|
+
return jsxRuntime.jsx(box.Box, {
|
|
82
82
|
as: "tr",
|
|
83
83
|
children: headerGroup.headers.map(function (header) {
|
|
84
|
-
return
|
|
84
|
+
return jsxRuntime.jsx(box.Box, {
|
|
85
85
|
as: "th",
|
|
86
86
|
color: theme$1.color.foreground.muted,
|
|
87
87
|
padding: "medium",
|
|
@@ -98,11 +98,11 @@ function DataTable(_ref) {
|
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
}) : null,
|
|
101
|
+
}) : null, jsxRuntime.jsxs(box.Box, {
|
|
102
102
|
as: "tbody",
|
|
103
103
|
children: [!renderRow ? table.getRowModel().rows.map(function (row) {
|
|
104
|
-
return
|
|
105
|
-
children: [
|
|
104
|
+
return jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
105
|
+
children: [jsxRuntime.jsx(box.Box, {
|
|
106
106
|
as: "tr",
|
|
107
107
|
css: react.css({
|
|
108
108
|
'&[data-is-selected="true"],&[data-is-expanded="true"]': {
|
|
@@ -119,7 +119,7 @@ function DataTable(_ref) {
|
|
|
119
119
|
"data-is-selected": row.getIsSelected(),
|
|
120
120
|
"data-is-expanded": row.getIsExpanded(),
|
|
121
121
|
children: row.getVisibleCells().map(function (cell) {
|
|
122
|
-
return
|
|
122
|
+
return jsxRuntime.jsx(box.Box, {
|
|
123
123
|
as: "td",
|
|
124
124
|
padding: "large",
|
|
125
125
|
css: react.css({
|
|
@@ -134,7 +134,7 @@ function DataTable(_ref) {
|
|
|
134
134
|
})
|
|
135
135
|
}), enableExpanding && row.getIsExpanded() && expandedRowComponent && expandedRowComponent(row, table)]
|
|
136
136
|
}, row.id);
|
|
137
|
-
}) : renderRow(table), showSpinner &&
|
|
137
|
+
}) : renderRow(table), showSpinner && jsxRuntime.jsx(reactIntersectionObserver.InView, {
|
|
138
138
|
as: "tr"
|
|
139
139
|
// @ts-ignore
|
|
140
140
|
,
|
|
@@ -142,7 +142,7 @@ function DataTable(_ref) {
|
|
|
142
142
|
columnSpan: 'all'
|
|
143
143
|
}),
|
|
144
144
|
onChange: onBottomSpinnerShown,
|
|
145
|
-
children:
|
|
145
|
+
children: jsxRuntime.jsx(box.Box, {
|
|
146
146
|
as: "td",
|
|
147
147
|
padding: "large",
|
|
148
148
|
colSpan: headerGroups.map(function (hg) {
|
|
@@ -154,7 +154,7 @@ function DataTable(_ref) {
|
|
|
154
154
|
textAlign: 'center',
|
|
155
155
|
verticalAlign: 'middle'
|
|
156
156
|
}),
|
|
157
|
-
children:
|
|
157
|
+
children: jsxRuntime.jsx(spinner.Spinner, {
|
|
158
158
|
data: {
|
|
159
159
|
testId: 'data-table-spinner'
|
|
160
160
|
},
|
|
@@ -162,17 +162,17 @@ function DataTable(_ref) {
|
|
|
162
162
|
})
|
|
163
163
|
})
|
|
164
164
|
})]
|
|
165
|
-
}), footerGroups.length > 0 ?
|
|
165
|
+
}), footerGroups.length > 0 ? jsxRuntime.jsx(react.ClassNames, {
|
|
166
166
|
children: function children(_ref3) {
|
|
167
167
|
var cx = _ref3.cx;
|
|
168
|
-
return
|
|
168
|
+
return jsxRuntime.jsx(box.Box, {
|
|
169
169
|
as: "tfoot",
|
|
170
170
|
className: cx(footerClassName),
|
|
171
171
|
children: footerGroups.map(function (footerGroup) {
|
|
172
|
-
return
|
|
172
|
+
return jsxRuntime.jsx(box.Box, {
|
|
173
173
|
as: "tr",
|
|
174
174
|
children: footerGroup.headers.map(function (footer) {
|
|
175
|
-
return
|
|
175
|
+
return jsxRuntime.jsx(box.Box, {
|
|
176
176
|
as: "td",
|
|
177
177
|
children: reactTable.flexRender(footer.column.columnDef.footer, footer.getContext())
|
|
178
178
|
}, footer.id);
|
|
@@ -9,7 +9,7 @@ import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-tabl
|
|
|
9
9
|
export { createColumnHelper, flexRender } from '@tanstack/react-table';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { InView } from 'react-intersection-observer';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
var _excluded = ["data", "items", "className", "columns", "enableExpanding", "enableHiding", "enableMultiRowSelection", "enableClickableRow", "headerClassName", "footerClassName", "showBottomSpinner", "rowClassName", "expandedRowComponent", "onBottomSpinnerShown", "onRowClick", "onRowSelectionChange", "renderRow"];
|
|
15
15
|
function DataTable(_ref) {
|
|
@@ -53,15 +53,15 @@ function DataTable(_ref) {
|
|
|
53
53
|
var defaultOnRowClick = function defaultOnRowClick(row) {
|
|
54
54
|
return row.toggleSelected();
|
|
55
55
|
};
|
|
56
|
-
return
|
|
56
|
+
return jsxs(Box, _objectSpread(_objectSpread({
|
|
57
57
|
as: "table"
|
|
58
58
|
}, data ? buildDataAttributes(data) : undefined), {}, {
|
|
59
59
|
className: className,
|
|
60
|
-
children: [headerGroups.length > 0 ?
|
|
60
|
+
children: [headerGroups.length > 0 ? jsx(ClassNames, {
|
|
61
61
|
children: function children(_ref2) {
|
|
62
62
|
var css = _ref2.css,
|
|
63
63
|
cx = _ref2.cx;
|
|
64
|
-
return
|
|
64
|
+
return jsx(Box, {
|
|
65
65
|
as: "thead",
|
|
66
66
|
background: "neutral",
|
|
67
67
|
className: cx(css({
|
|
@@ -71,10 +71,10 @@ function DataTable(_ref) {
|
|
|
71
71
|
boxShadow: "inset 0 -2px 0 ".concat(theme.border.color.primary)
|
|
72
72
|
}, headerClassName)),
|
|
73
73
|
children: headerGroups.map(function (headerGroup) {
|
|
74
|
-
return
|
|
74
|
+
return jsx(Box, {
|
|
75
75
|
as: "tr",
|
|
76
76
|
children: headerGroup.headers.map(function (header) {
|
|
77
|
-
return
|
|
77
|
+
return jsx(Box, {
|
|
78
78
|
as: "th",
|
|
79
79
|
color: theme.color.foreground.muted,
|
|
80
80
|
padding: "medium",
|
|
@@ -91,11 +91,11 @@ function DataTable(_ref) {
|
|
|
91
91
|
})
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
}) : null,
|
|
94
|
+
}) : null, jsxs(Box, {
|
|
95
95
|
as: "tbody",
|
|
96
96
|
children: [!renderRow ? table.getRowModel().rows.map(function (row) {
|
|
97
|
-
return
|
|
98
|
-
children: [
|
|
97
|
+
return jsxs(React.Fragment, {
|
|
98
|
+
children: [jsx(Box, {
|
|
99
99
|
as: "tr",
|
|
100
100
|
css: css({
|
|
101
101
|
'&[data-is-selected="true"],&[data-is-expanded="true"]': {
|
|
@@ -112,7 +112,7 @@ function DataTable(_ref) {
|
|
|
112
112
|
"data-is-selected": row.getIsSelected(),
|
|
113
113
|
"data-is-expanded": row.getIsExpanded(),
|
|
114
114
|
children: row.getVisibleCells().map(function (cell) {
|
|
115
|
-
return
|
|
115
|
+
return jsx(Box, {
|
|
116
116
|
as: "td",
|
|
117
117
|
padding: "large",
|
|
118
118
|
css: css({
|
|
@@ -127,7 +127,7 @@ function DataTable(_ref) {
|
|
|
127
127
|
})
|
|
128
128
|
}), enableExpanding && row.getIsExpanded() && expandedRowComponent && expandedRowComponent(row, table)]
|
|
129
129
|
}, row.id);
|
|
130
|
-
}) : renderRow(table), showSpinner &&
|
|
130
|
+
}) : renderRow(table), showSpinner && jsx(InView, {
|
|
131
131
|
as: "tr"
|
|
132
132
|
// @ts-ignore
|
|
133
133
|
,
|
|
@@ -135,7 +135,7 @@ function DataTable(_ref) {
|
|
|
135
135
|
columnSpan: 'all'
|
|
136
136
|
}),
|
|
137
137
|
onChange: onBottomSpinnerShown,
|
|
138
|
-
children:
|
|
138
|
+
children: jsx(Box, {
|
|
139
139
|
as: "td",
|
|
140
140
|
padding: "large",
|
|
141
141
|
colSpan: headerGroups.map(function (hg) {
|
|
@@ -147,7 +147,7 @@ function DataTable(_ref) {
|
|
|
147
147
|
textAlign: 'center',
|
|
148
148
|
verticalAlign: 'middle'
|
|
149
149
|
}),
|
|
150
|
-
children:
|
|
150
|
+
children: jsx(Spinner, {
|
|
151
151
|
data: {
|
|
152
152
|
testId: 'data-table-spinner'
|
|
153
153
|
},
|
|
@@ -155,17 +155,17 @@ function DataTable(_ref) {
|
|
|
155
155
|
})
|
|
156
156
|
})
|
|
157
157
|
})]
|
|
158
|
-
}), footerGroups.length > 0 ?
|
|
158
|
+
}), footerGroups.length > 0 ? jsx(ClassNames, {
|
|
159
159
|
children: function children(_ref3) {
|
|
160
160
|
var cx = _ref3.cx;
|
|
161
|
-
return
|
|
161
|
+
return jsx(Box, {
|
|
162
162
|
as: "tfoot",
|
|
163
163
|
className: cx(footerClassName),
|
|
164
164
|
children: footerGroups.map(function (footerGroup) {
|
|
165
|
-
return
|
|
165
|
+
return jsx(Box, {
|
|
166
166
|
as: "tr",
|
|
167
167
|
children: footerGroup.headers.map(function (footer) {
|
|
168
|
-
return
|
|
168
|
+
return jsx(Box, {
|
|
169
169
|
as: "td",
|
|
170
170
|
children: flexRender(footer.column.columnDef.footer, footer.getContext())
|
|
171
171
|
}, footer.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/data-table",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.25.0",
|
|
20
20
|
"@emotion/react": "^11.13.5",
|
|
21
|
-
"@spark-web/a11y": "^2.0.0-rc.
|
|
22
|
-
"@spark-web/box": "^2.0.0-rc.
|
|
23
|
-
"@spark-web/checkbox": "^2.0.0-rc.
|
|
24
|
-
"@spark-web/spinner": "^2.0.0-rc.
|
|
25
|
-
"@spark-web/text": "^2.0.0-rc.
|
|
26
|
-
"@spark-web/theme": "^4.0.0-rc.
|
|
27
|
-
"@spark-web/utils": "^2.0.0-rc.
|
|
21
|
+
"@spark-web/a11y": "^2.0.0-rc.2",
|
|
22
|
+
"@spark-web/box": "^2.0.0-rc.2",
|
|
23
|
+
"@spark-web/checkbox": "^2.0.0-rc.2",
|
|
24
|
+
"@spark-web/spinner": "^2.0.0-rc.2",
|
|
25
|
+
"@spark-web/text": "^2.0.0-rc.2",
|
|
26
|
+
"@spark-web/theme": "^4.0.0-rc.2",
|
|
27
|
+
"@spark-web/utils": "^2.0.0-rc.2",
|
|
28
28
|
"@tanstack/react-table": "^8.14.0",
|
|
29
29
|
"react-intersection-observer": "^9.8.2"
|
|
30
30
|
},
|