grommet 2.49.0 → 2.50.0
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/components/DataTable/ExpanderCell.js +6 -3
- package/components/DataTable/Header.js +2 -1
- package/components/DataTable/Resizer.js +18 -7
- package/components/DataTable/stories/ResizePinned.stories.js +321 -0
- package/es6/components/DataTable/ExpanderCell.js +4 -1
- package/es6/components/DataTable/Header.js +2 -1
- package/es6/components/DataTable/Resizer.js +18 -7
- package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -0
- package/es6/themes/base.d.ts +3 -0
- package/es6/themes/base.js +4 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +7 -7
- package/themes/base.d.ts +3 -0
- package/themes/base.js +4 -1
|
@@ -9,7 +9,7 @@ var _Button = require("../Button");
|
|
|
9
9
|
var _TableCell = require("../TableCell");
|
|
10
10
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
11
11
|
var _utils = require("../../utils");
|
|
12
|
-
var
|
|
12
|
+
var _useThemeValue3 = require("../../utils/useThemeValue");
|
|
13
13
|
var _excluded = ["context", "expanded", "onToggle", "messages", "pad", "expandLabel"],
|
|
14
14
|
_excluded2 = ["background", "border", "context", "expandLabel"];
|
|
15
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -25,7 +25,7 @@ var ExpanderControl = function ExpanderControl(_ref) {
|
|
|
25
25
|
pad = _ref.pad,
|
|
26
26
|
expandLabel = _ref.expandLabel,
|
|
27
27
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
|
-
var _useThemeValue = (0,
|
|
28
|
+
var _useThemeValue = (0, _useThemeValue3.useThemeValue)(),
|
|
29
29
|
theme = _useThemeValue.theme;
|
|
30
30
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
31
31
|
format = _useContext.format;
|
|
@@ -100,15 +100,18 @@ var ExpanderControl = function ExpanderControl(_ref) {
|
|
|
100
100
|
return content;
|
|
101
101
|
};
|
|
102
102
|
var ExpanderCell = exports.ExpanderCell = function ExpanderCell(_ref2) {
|
|
103
|
+
var _theme$dataTable$expa;
|
|
103
104
|
var background = _ref2.background,
|
|
104
105
|
border = _ref2.border,
|
|
105
106
|
context = _ref2.context,
|
|
106
107
|
expandLabel = _ref2.expandLabel,
|
|
107
108
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
109
|
+
var _useThemeValue2 = (0, _useThemeValue3.useThemeValue)(),
|
|
110
|
+
theme = _useThemeValue2.theme;
|
|
108
111
|
return /*#__PURE__*/_react["default"].createElement(_TableCell.TableCell, {
|
|
109
112
|
background: background,
|
|
110
113
|
border: border,
|
|
111
|
-
size:
|
|
114
|
+
size: (_theme$dataTable$expa = theme.dataTable.expand) == null ? void 0 : _theme$dataTable$expa.size,
|
|
112
115
|
plain: "noPad",
|
|
113
116
|
verticalAlign: context === 'groupEnd' ? 'bottom' : 'top'
|
|
114
117
|
}, /*#__PURE__*/_react["default"].createElement(ExpanderControl, _extends({
|
|
@@ -402,7 +402,8 @@ var Header = exports.Header = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
402
402
|
style: {
|
|
403
403
|
width: widths != null && widths[property] ? widths[property] + "px" : undefined,
|
|
404
404
|
boxSizing: _onResize ? 'border-box' : undefined,
|
|
405
|
-
|
|
405
|
+
// Don't override positioning when DataTable has pin prop
|
|
406
|
+
position: _onResize && !columnPin && !pinProp ? 'relative' : undefined,
|
|
406
407
|
overflow: _onResize ? 'visible' : undefined
|
|
407
408
|
},
|
|
408
409
|
onResize: _onResize,
|
|
@@ -12,24 +12,34 @@ var _DropButton = require("../DropButton");
|
|
|
12
12
|
var _Keyboard = require("../Keyboard");
|
|
13
13
|
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
14
14
|
var _MessageContext = require("../../contexts/MessageContext");
|
|
15
|
+
var _styles = require("../../utils/styles");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
18
|
// We determined 12 empirically as being wide enough to hit but
|
|
18
19
|
// not too wide to cause false hits.
|
|
19
20
|
var STEP = 12; // Used to determine the width change on resize
|
|
21
|
+
var resizerWidth = 24; // minimum width required for WCAG compliance
|
|
20
22
|
|
|
21
23
|
var StyledResizer = (0, _styledComponents["default"])(_DropButton.DropButton).withConfig({
|
|
22
24
|
displayName: "Resizer__StyledResizer",
|
|
23
25
|
componentId: "sc-8l808w-0"
|
|
24
|
-
})(["display:flex;justify-content:center;
|
|
25
|
-
|
|
26
|
+
})(["display:flex;justify-content:center;", ";", ";", " ", " ", " ", " position:absolute;width:", "px;height:100%;top:0;cursor:col-resize;z-index:1;"], function (props) {
|
|
27
|
+
var _props$theme$dataTabl;
|
|
28
|
+
return (0, _styles.edgeStyle)('padding-top', (_props$theme$dataTabl = props.theme.dataTable) == null || (_props$theme$dataTabl = _props$theme$dataTabl.resize) == null || (_props$theme$dataTabl = _props$theme$dataTabl.padding) == null ? void 0 : _props$theme$dataTabl.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
26
29
|
}, function (props) {
|
|
27
|
-
|
|
30
|
+
var _props$theme$dataTabl2;
|
|
31
|
+
return (0, _styles.edgeStyle)('padding-bottom', (_props$theme$dataTabl2 = props.theme.dataTable) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.resize) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.padding) == null ? void 0 : _props$theme$dataTabl2.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
28
32
|
}, function (props) {
|
|
29
|
-
return props.theme.global.
|
|
30
|
-
})
|
|
33
|
+
return props.side === 'start' && "margin-left: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
34
|
+
}, function (props) {
|
|
35
|
+
return props.side === 'start' && "left: 0;";
|
|
36
|
+
}, function (props) {
|
|
37
|
+
return props.side === 'end' && "margin-right: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.side === 'end' && "right: 0;";
|
|
40
|
+
}, resizerWidth);
|
|
31
41
|
var Resizer = exports.Resizer = function Resizer(_ref) {
|
|
32
|
-
var _theme$dataTable$icon, _theme$dataTable$icon2;
|
|
42
|
+
var _theme$dataTable$icon, _theme$dataTable$icon2, _border;
|
|
33
43
|
var onResize = _ref.onResize,
|
|
34
44
|
property = _ref.property,
|
|
35
45
|
headerText = _ref.headerText,
|
|
@@ -219,7 +229,8 @@ var Resizer = exports.Resizer = function Resizer(_ref) {
|
|
|
219
229
|
})),
|
|
220
230
|
dropAlign: {
|
|
221
231
|
top: 'bottom'
|
|
222
|
-
}
|
|
232
|
+
},
|
|
233
|
+
side: (_border = border) == null ? void 0 : _border.side
|
|
223
234
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
224
235
|
border: hover || active ? hoverBorder : border,
|
|
225
236
|
height: "100%",
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ResizablePinnedDataTable = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
8
|
+
var data = [{
|
|
9
|
+
id: 'b0:2a:43:52:48:c5',
|
|
10
|
+
macAddress: 'b0:2a:43:52:48:c5',
|
|
11
|
+
ipAddress: '192.168.0.20',
|
|
12
|
+
hostname: 'wh7-dureal50',
|
|
13
|
+
connectionType: 'Wireless',
|
|
14
|
+
category: 'Network',
|
|
15
|
+
status: 'Active',
|
|
16
|
+
deviceName: 'Chromecast',
|
|
17
|
+
networkBand: {
|
|
18
|
+
value: 2.4,
|
|
19
|
+
unit: 'GHz'
|
|
20
|
+
},
|
|
21
|
+
linkRate: {
|
|
22
|
+
value: 72,
|
|
23
|
+
unit: 'Mbps'
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
id: '00:d0:2d:32:b6:cd',
|
|
27
|
+
macAddress: '00:d0:2d:32:b6:cd',
|
|
28
|
+
ipAddress: '192.168.0.24',
|
|
29
|
+
hostname: 'wh7-dureal50',
|
|
30
|
+
connectionType: 'Wireless',
|
|
31
|
+
category: 'Network',
|
|
32
|
+
status: 'Active',
|
|
33
|
+
deviceName: 'Gateway32B6CD',
|
|
34
|
+
networkBand: {
|
|
35
|
+
value: 2.4,
|
|
36
|
+
unit: 'GHz'
|
|
37
|
+
},
|
|
38
|
+
linkRate: {
|
|
39
|
+
value: 72,
|
|
40
|
+
unit: 'Mbps'
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
id: 'd8:6c:63:46:13:03',
|
|
44
|
+
macAddress: 'd8:6c:63:46:13:03',
|
|
45
|
+
ipAddress: '192.168.0.19',
|
|
46
|
+
hostname: 'wh7-dureal50',
|
|
47
|
+
connectionType: 'Wireless',
|
|
48
|
+
category: 'Network',
|
|
49
|
+
status: 'Active',
|
|
50
|
+
deviceName: 'Amazon-Firestick',
|
|
51
|
+
networkBand: {
|
|
52
|
+
value: 2.4,
|
|
53
|
+
unit: 'GHz'
|
|
54
|
+
},
|
|
55
|
+
linkRate: {
|
|
56
|
+
value: 72,
|
|
57
|
+
unit: 'Mbps'
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
id: 'f4:f5:d8:c0:e2:9c',
|
|
61
|
+
macAddress: 'f4:f5:d8:c0:e2:9c',
|
|
62
|
+
ipAddress: '192.168.0.21',
|
|
63
|
+
hostname: 'wh7-dureal50',
|
|
64
|
+
connectionType: 'Wireless',
|
|
65
|
+
category: 'Network',
|
|
66
|
+
status: 'Active',
|
|
67
|
+
deviceName: 'Google-Home',
|
|
68
|
+
networkBand: {
|
|
69
|
+
value: 2.4,
|
|
70
|
+
unit: 'GHz'
|
|
71
|
+
},
|
|
72
|
+
linkRate: {
|
|
73
|
+
value: 72,
|
|
74
|
+
unit: 'Mbps'
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
id: '38:f9:d3:b7:09:4e',
|
|
78
|
+
macAddress: '38:f9:d3:b7:09:4e',
|
|
79
|
+
ipAddress: '192.168.0.21',
|
|
80
|
+
hostname: 'wh7-dureal50',
|
|
81
|
+
connectionType: 'Wireless',
|
|
82
|
+
category: 'Network',
|
|
83
|
+
status: 'Active',
|
|
84
|
+
deviceName: 'Daras-MBP',
|
|
85
|
+
networkBand: {
|
|
86
|
+
value: 5,
|
|
87
|
+
unit: 'GHz'
|
|
88
|
+
},
|
|
89
|
+
linkRate: {
|
|
90
|
+
value: 702,
|
|
91
|
+
unit: 'Mbps'
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
id: '10:40:f3:85:67:44',
|
|
95
|
+
macAddress: '10:40:f3:85:67:44',
|
|
96
|
+
ipAddress: '192.168.0.13',
|
|
97
|
+
hostname: 'wh7-dureal50',
|
|
98
|
+
connectionType: 'Wireless',
|
|
99
|
+
category: 'Network',
|
|
100
|
+
status: 'Active',
|
|
101
|
+
deviceName: 'Daras-Air',
|
|
102
|
+
networkBand: {
|
|
103
|
+
value: 2.4,
|
|
104
|
+
unit: 'GHz'
|
|
105
|
+
},
|
|
106
|
+
linkRate: {
|
|
107
|
+
value: 78,
|
|
108
|
+
unit: 'Mbps'
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
id: 'a4:f1:e8:27:e7:1c',
|
|
112
|
+
macAddress: 'a4:f1:e8:27:e7:1c',
|
|
113
|
+
ipAddress: '192.168.0.11',
|
|
114
|
+
hostname: 'wh7-dureal50',
|
|
115
|
+
connectionType: 'Wireless',
|
|
116
|
+
category: 'Network',
|
|
117
|
+
status: 'Active',
|
|
118
|
+
deviceName: 'iPhone',
|
|
119
|
+
networkBand: {
|
|
120
|
+
value: 2.4,
|
|
121
|
+
unit: 'GHz'
|
|
122
|
+
},
|
|
123
|
+
linkRate: {
|
|
124
|
+
value: 24,
|
|
125
|
+
unit: 'Mbps'
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
id: '10:e7:c6:cb:f8:58',
|
|
129
|
+
macAddress: '10:e7:c6:cb:f8:58',
|
|
130
|
+
ipAddress: '192.168.0.22',
|
|
131
|
+
hostname: 'wh7-dureal50',
|
|
132
|
+
connectionType: 'Wireless',
|
|
133
|
+
category: 'Network',
|
|
134
|
+
status: 'Active',
|
|
135
|
+
deviceName: 'HPCBF857',
|
|
136
|
+
networkBand: {
|
|
137
|
+
value: 2.4,
|
|
138
|
+
unit: 'GHz'
|
|
139
|
+
},
|
|
140
|
+
linkRate: {
|
|
141
|
+
value: 24,
|
|
142
|
+
unit: 'Mbps'
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
id: '44:07:0b:ba:1e:eb',
|
|
146
|
+
macAddress: '44:07:0b:ba:1e:eb',
|
|
147
|
+
ipAddress: '192.168.0.18',
|
|
148
|
+
hostname: 'wh7-dureal50',
|
|
149
|
+
connectionType: 'Wireless',
|
|
150
|
+
category: 'Network',
|
|
151
|
+
status: 'Active',
|
|
152
|
+
deviceName: 'Google-Home-Mini',
|
|
153
|
+
networkBand: {
|
|
154
|
+
value: 2.4,
|
|
155
|
+
unit: 'GHz'
|
|
156
|
+
},
|
|
157
|
+
linkRate: {
|
|
158
|
+
value: 72,
|
|
159
|
+
unit: 'Mbps'
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
id: '00:f6:20:60:15:d0',
|
|
163
|
+
macAddress: '00:f6:20:60:15:d0',
|
|
164
|
+
ipAddress: '192.168.0.17',
|
|
165
|
+
hostname: 'wh7-dureal50',
|
|
166
|
+
connectionType: 'Wireless',
|
|
167
|
+
category: 'Network',
|
|
168
|
+
status: 'Active',
|
|
169
|
+
deviceName: 'Amazon-Alexa',
|
|
170
|
+
networkBand: {
|
|
171
|
+
value: 2.4,
|
|
172
|
+
unit: 'GHz'
|
|
173
|
+
},
|
|
174
|
+
linkRate: {
|
|
175
|
+
value: 72,
|
|
176
|
+
unit: 'Mbps'
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
id: '30:fd:38:88:49:f4',
|
|
180
|
+
macAddress: '30:fd:38:88:49:f4',
|
|
181
|
+
ipAddress: '192.168.0.16',
|
|
182
|
+
hostname: 'wh7-dureal50',
|
|
183
|
+
connectionType: 'Wireless',
|
|
184
|
+
category: 'Network',
|
|
185
|
+
status: 'Active',
|
|
186
|
+
deviceName: 'Google-Home-Mini',
|
|
187
|
+
networkBand: {
|
|
188
|
+
value: 2.4,
|
|
189
|
+
unit: 'GHz'
|
|
190
|
+
},
|
|
191
|
+
linkRate: {
|
|
192
|
+
value: 292,
|
|
193
|
+
unit: 'Mbps'
|
|
194
|
+
}
|
|
195
|
+
}, {
|
|
196
|
+
id: '7c:b0:c2:5c:94:a5',
|
|
197
|
+
macAddress: '7c:b0:c2:5c:94:a5',
|
|
198
|
+
ipAddress: '192.168.0.26',
|
|
199
|
+
hostname: 'wh7-dureal50',
|
|
200
|
+
connectionType: 'Wireless',
|
|
201
|
+
category: 'Network',
|
|
202
|
+
status: 'Active',
|
|
203
|
+
deviceName: 'N/A',
|
|
204
|
+
networkBand: {
|
|
205
|
+
value: 2.4,
|
|
206
|
+
unit: 'GHz'
|
|
207
|
+
},
|
|
208
|
+
linkRate: {
|
|
209
|
+
value: 6,
|
|
210
|
+
unit: 'Mbps'
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
id: 'E0:5F:45:96:F4:DD',
|
|
214
|
+
macAddress: 'E0:5F:45:96:F4:DD',
|
|
215
|
+
ipAddress: '192.168.0.25',
|
|
216
|
+
hostname: 'wh7-dureal50',
|
|
217
|
+
connectionType: 'Wireless',
|
|
218
|
+
category: 'Network',
|
|
219
|
+
status: 'Active',
|
|
220
|
+
deviceName: 'N/A',
|
|
221
|
+
networkBand: {
|
|
222
|
+
value: 2.4,
|
|
223
|
+
unit: 'GHz'
|
|
224
|
+
},
|
|
225
|
+
linkRate: {
|
|
226
|
+
value: 1,
|
|
227
|
+
unit: 'Mbps'
|
|
228
|
+
}
|
|
229
|
+
}];
|
|
230
|
+
var columns = [{
|
|
231
|
+
primary: true,
|
|
232
|
+
property: 'macAddress',
|
|
233
|
+
header: 'MAC address',
|
|
234
|
+
render: function render(datum) {
|
|
235
|
+
return datum.macAddress;
|
|
236
|
+
},
|
|
237
|
+
pin: true
|
|
238
|
+
}, {
|
|
239
|
+
property: 'ipAddress',
|
|
240
|
+
header: 'IP V4',
|
|
241
|
+
render: function render(datum) {
|
|
242
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
243
|
+
truncate: "tip"
|
|
244
|
+
}, datum.ipAddress);
|
|
245
|
+
},
|
|
246
|
+
size: 'xsmall',
|
|
247
|
+
align: 'end'
|
|
248
|
+
}, {
|
|
249
|
+
property: 'hostname',
|
|
250
|
+
header: 'Hostname',
|
|
251
|
+
render: function render(datum) {
|
|
252
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
253
|
+
truncate: "tip"
|
|
254
|
+
}, datum.hostname);
|
|
255
|
+
},
|
|
256
|
+
size: 'xsmall'
|
|
257
|
+
}, {
|
|
258
|
+
property: 'connectionType',
|
|
259
|
+
header: 'Connection type'
|
|
260
|
+
}, {
|
|
261
|
+
property: 'category',
|
|
262
|
+
header: 'Category'
|
|
263
|
+
}, {
|
|
264
|
+
property: 'deviceName',
|
|
265
|
+
header: 'Device name',
|
|
266
|
+
render: function render(datum) {
|
|
267
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Text, {
|
|
268
|
+
truncate: "tip"
|
|
269
|
+
}, datum.deviceName);
|
|
270
|
+
},
|
|
271
|
+
size: 'xsmall'
|
|
272
|
+
}, {
|
|
273
|
+
property: 'status',
|
|
274
|
+
header: 'Status'
|
|
275
|
+
}, {
|
|
276
|
+
property: 'networkBand.value',
|
|
277
|
+
header: 'Network band',
|
|
278
|
+
units: 'GHz',
|
|
279
|
+
render: function render(datum) {
|
|
280
|
+
return datum.networkBand.value;
|
|
281
|
+
},
|
|
282
|
+
align: 'end'
|
|
283
|
+
}, {
|
|
284
|
+
property: 'linkRate.value',
|
|
285
|
+
header: 'Link rate',
|
|
286
|
+
units: 'Mbps',
|
|
287
|
+
render: function render(datum) {
|
|
288
|
+
return datum.linkRate.value;
|
|
289
|
+
},
|
|
290
|
+
align: 'end'
|
|
291
|
+
}];
|
|
292
|
+
var ResizablePinnedDataTable = exports.ResizablePinnedDataTable = function ResizablePinnedDataTable() {
|
|
293
|
+
return /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
294
|
+
align: "center",
|
|
295
|
+
pad: "large"
|
|
296
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Heading, {
|
|
297
|
+
level: "3"
|
|
298
|
+
}, "Table with resizable & column sizes"), /*#__PURE__*/_react["default"].createElement(_grommet.Box, {
|
|
299
|
+
align: "start",
|
|
300
|
+
height: "medium"
|
|
301
|
+
// restricting width to demonstrate pinned column behavior
|
|
302
|
+
,
|
|
303
|
+
width: {
|
|
304
|
+
width: 'xxlarge',
|
|
305
|
+
max: '100%'
|
|
306
|
+
},
|
|
307
|
+
overflow: "auto"
|
|
308
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.DataTable, {
|
|
309
|
+
"aria-describedby": "connected-heading",
|
|
310
|
+
data: data,
|
|
311
|
+
columns: columns,
|
|
312
|
+
pin: true,
|
|
313
|
+
resizeable: true
|
|
314
|
+
})))
|
|
315
|
+
// </Grommet>
|
|
316
|
+
;
|
|
317
|
+
};
|
|
318
|
+
ResizablePinnedDataTable.storyName = 'Resizable pinned columns';
|
|
319
|
+
var _default = exports["default"] = {
|
|
320
|
+
title: 'Visualizations/DataTable/Resizable pinned columns'
|
|
321
|
+
};
|
|
@@ -96,15 +96,18 @@ var ExpanderControl = function ExpanderControl(_ref) {
|
|
|
96
96
|
return content;
|
|
97
97
|
};
|
|
98
98
|
var ExpanderCell = function ExpanderCell(_ref2) {
|
|
99
|
+
var _theme$dataTable$expa;
|
|
99
100
|
var background = _ref2.background,
|
|
100
101
|
border = _ref2.border,
|
|
101
102
|
context = _ref2.context,
|
|
102
103
|
expandLabel = _ref2.expandLabel,
|
|
103
104
|
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
105
|
+
var _useThemeValue2 = useThemeValue(),
|
|
106
|
+
theme = _useThemeValue2.theme;
|
|
104
107
|
return /*#__PURE__*/React.createElement(TableCell, {
|
|
105
108
|
background: background,
|
|
106
109
|
border: border,
|
|
107
|
-
size:
|
|
110
|
+
size: (_theme$dataTable$expa = theme.dataTable.expand) == null ? void 0 : _theme$dataTable$expa.size,
|
|
108
111
|
plain: "noPad",
|
|
109
112
|
verticalAlign: context === 'groupEnd' ? 'bottom' : 'top'
|
|
110
113
|
}, /*#__PURE__*/React.createElement(ExpanderControl, _extends({
|
|
@@ -398,7 +398,8 @@ var Header = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
398
398
|
style: {
|
|
399
399
|
width: widths != null && widths[property] ? widths[property] + "px" : undefined,
|
|
400
400
|
boxSizing: _onResize ? 'border-box' : undefined,
|
|
401
|
-
|
|
401
|
+
// Don't override positioning when DataTable has pin prop
|
|
402
|
+
position: _onResize && !columnPin && !pinProp ? 'relative' : undefined,
|
|
402
403
|
overflow: _onResize ? 'visible' : undefined
|
|
403
404
|
},
|
|
404
405
|
onResize: _onResize,
|
|
@@ -8,23 +8,33 @@ import { DropButton } from '../DropButton';
|
|
|
8
8
|
import { Keyboard } from '../Keyboard';
|
|
9
9
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
10
10
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
11
|
+
import { edgeStyle } from '../../utils/styles';
|
|
11
12
|
|
|
12
13
|
// We determined 12 empirically as being wide enough to hit but
|
|
13
14
|
// not too wide to cause false hits.
|
|
14
15
|
var STEP = 12; // Used to determine the width change on resize
|
|
16
|
+
var resizerWidth = 24; // minimum width required for WCAG compliance
|
|
15
17
|
|
|
16
18
|
var StyledResizer = styled(DropButton).withConfig({
|
|
17
19
|
displayName: "Resizer__StyledResizer",
|
|
18
20
|
componentId: "sc-8l808w-0"
|
|
19
|
-
})(["display:flex;justify-content:center;
|
|
20
|
-
|
|
21
|
+
})(["display:flex;justify-content:center;", ";", ";", " ", " ", " ", " position:absolute;width:", "px;height:100%;top:0;cursor:col-resize;z-index:1;"], function (props) {
|
|
22
|
+
var _props$theme$dataTabl;
|
|
23
|
+
return edgeStyle('padding-top', (_props$theme$dataTabl = props.theme.dataTable) == null || (_props$theme$dataTabl = _props$theme$dataTabl.resize) == null || (_props$theme$dataTabl = _props$theme$dataTabl.padding) == null ? void 0 : _props$theme$dataTabl.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
21
24
|
}, function (props) {
|
|
22
|
-
|
|
25
|
+
var _props$theme$dataTabl2;
|
|
26
|
+
return edgeStyle('padding-bottom', (_props$theme$dataTabl2 = props.theme.dataTable) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.resize) == null || (_props$theme$dataTabl2 = _props$theme$dataTabl2.padding) == null ? void 0 : _props$theme$dataTabl2.vertical, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
23
27
|
}, function (props) {
|
|
24
|
-
return props.theme.global.
|
|
25
|
-
})
|
|
28
|
+
return props.side === 'start' && "margin-left: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.side === 'start' && "left: 0;";
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.side === 'end' && "margin-right: -" + (resizerWidth / 2 - props.theme.global.borderSize.xsmall.replace('px', '')) + "px;";
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return props.side === 'end' && "right: 0;";
|
|
35
|
+
}, resizerWidth);
|
|
26
36
|
var Resizer = function Resizer(_ref) {
|
|
27
|
-
var _theme$dataTable$icon, _theme$dataTable$icon2;
|
|
37
|
+
var _theme$dataTable$icon, _theme$dataTable$icon2, _border;
|
|
28
38
|
var onResize = _ref.onResize,
|
|
29
39
|
property = _ref.property,
|
|
30
40
|
headerText = _ref.headerText,
|
|
@@ -214,7 +224,8 @@ var Resizer = function Resizer(_ref) {
|
|
|
214
224
|
})),
|
|
215
225
|
dropAlign: {
|
|
216
226
|
top: 'bottom'
|
|
217
|
-
}
|
|
227
|
+
},
|
|
228
|
+
side: (_border = border) == null ? void 0 : _border.side
|
|
218
229
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
219
230
|
border: hover || active ? hoverBorder : border,
|
|
220
231
|
height: "100%",
|