@pingux/astro 2.65.0 → 2.65.1-alpha.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/lib/cjs/components/DataTable/DataTable.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTable.js +28 -108
- package/lib/cjs/components/DataTable/DataTable.stories.d.ts +202 -0
- package/lib/cjs/components/DataTable/DataTable.stories.js +37 -41
- package/lib/cjs/components/DataTable/DataTable.styles.d.ts +141 -0
- package/lib/cjs/components/DataTable/DataTable.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTable.test.js +119 -116
- package/lib/cjs/components/DataTable/DataTableBadge.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTableBadge.js +2 -6
- package/lib/cjs/components/DataTable/DataTableBadge.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMenu.d.ts +3 -0
- package/lib/cjs/components/DataTable/DataTableMenu.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.d.ts +4 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.js +2 -2
- package/lib/cjs/components/DataTable/DataTableMultiLine.test.d.ts +1 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.test.js +1 -2
- package/lib/cjs/components/DataTable/DataTableVirtualizer.d.ts +8 -0
- package/lib/cjs/components/DataTable/DataTableVirtualizer.js +12 -36
- package/lib/cjs/components/DataTable/index.d.ts +5 -0
- package/lib/cjs/types/dataTable.d.ts +88 -0
- package/lib/cjs/types/dataTable.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +45 -34
- package/lib/cjs/types/shared/index.d.ts +1 -0
- package/lib/cjs/types/shared/index.js +16 -5
- package/lib/cjs/types/shared/loadingState.d.ts +1 -0
- package/lib/cjs/types/shared/loadingState.js +6 -0
- package/lib/components/DataTable/DataTable.js +28 -108
- package/lib/components/DataTable/DataTable.stories.js +37 -41
- package/lib/components/DataTable/DataTable.test.js +118 -116
- package/lib/components/DataTable/DataTableBadge.js +2 -6
- package/lib/components/DataTable/DataTableMultiLine.js +2 -2
- package/lib/components/DataTable/DataTableMultiLine.test.js +1 -2
- package/lib/components/DataTable/DataTableVirtualizer.js +13 -37
- package/lib/types/dataTable.js +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/shared/index.js +1 -0
- package/lib/types/shared/loadingState.js +1 -0
- package/package.json +3 -2
@@ -28,7 +28,6 @@ var _table = require("@react-aria/table");
|
|
28
28
|
var _virtualizer = require("@react-aria/virtualizer");
|
29
29
|
var _layout = require("@react-stately/layout");
|
30
30
|
var _table2 = require("@react-stately/table");
|
31
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
32
31
|
var _DataTableContext = require("../../context/DataTableContext");
|
33
32
|
var _hooks = require("../../hooks");
|
34
33
|
var _index = require("../../index");
|
@@ -59,14 +58,18 @@ var ROW_HEIGHTS = {
|
|
59
58
|
large: 50
|
60
59
|
},
|
61
60
|
spacious: {
|
62
|
-
medium: 48
|
61
|
+
medium: 48,
|
62
|
+
large: 60
|
63
63
|
}
|
64
64
|
};
|
65
65
|
var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
66
|
-
var scale = 'large';
|
67
66
|
var direction = 'ltr';
|
68
|
-
var onAction = props.onAction
|
69
|
-
|
67
|
+
var onAction = props.onAction,
|
68
|
+
_props$scale = props.scale,
|
69
|
+
scale = _props$scale === void 0 ? 'large' : _props$scale;
|
70
|
+
|
71
|
+
// const getDefaultWidth = useCallback(() => null, []) as GetDefaultWidth;
|
72
|
+
|
70
73
|
var getDefaultMinWidth = (0, _react.useCallback)(function (_ref) {
|
71
74
|
var _ref$props = _ref.props,
|
72
75
|
hideHeader = _ref$props.hideHeader,
|
@@ -89,23 +92,22 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
89
92
|
// with table layout, so we need to track it here
|
90
93
|
var state = (0, _table2.useTableState)(_objectSpread({}, props));
|
91
94
|
var domRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
92
|
-
var headerRef = (0, _react.useRef)();
|
93
|
-
var bodyRef = (0, _react.useRef)();
|
95
|
+
var headerRef = (0, _react.useRef)(null);
|
96
|
+
var bodyRef = (0, _react.useRef)(null);
|
94
97
|
var density = props.density || 'regular';
|
95
98
|
var columnLayout = (0, _react.useMemo)(function () {
|
96
99
|
return new _table2.TableColumnLayout({
|
97
|
-
getDefaultWidth: getDefaultWidth,
|
98
100
|
getDefaultMinWidth: getDefaultMinWidth
|
99
101
|
});
|
100
|
-
}, [
|
102
|
+
}, [getDefaultMinWidth]);
|
101
103
|
var layout = (0, _react.useMemo)(function () {
|
102
104
|
return new _layout.TableLayout({
|
103
105
|
// If props.rowHeight is auto,
|
104
106
|
// then use estimated heights based on scale, otherwise use fixed heights.
|
105
107
|
rowHeight: props.overflowMode === 'wrap' ? null : ROW_HEIGHTS[density][scale],
|
106
108
|
estimatedRowHeight: props.overflowMode === 'wrap' ? ROW_HEIGHTS[density][scale] : null,
|
107
|
-
headingHeight: props.overflowMode === 'wrap' ?
|
108
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] :
|
109
|
+
headingHeight: props.overflowMode === 'wrap' ? undefined : DEFAULT_HEADER_HEIGHT[scale],
|
110
|
+
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] : undefined,
|
109
111
|
columnLayout: columnLayout,
|
110
112
|
initialCollection: state.collection
|
111
113
|
});
|
@@ -127,10 +129,6 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
127
129
|
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
128
130
|
var renderWrapper = function renderWrapper(parent, reusableView, children, renderChildren) {
|
129
131
|
var style = (0, _virtualizer.layoutInfoToStyle)(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
|
130
|
-
if (style.overflow === 'hidden') {
|
131
|
-
style.overflow = 'visible'; // needed to support position: sticky
|
132
|
-
}
|
133
|
-
|
134
132
|
if (reusableView.viewType === 'rowgroup') {
|
135
133
|
return (0, _react2.jsx)(TableRowGroup, {
|
136
134
|
key: reusableView.key,
|
@@ -175,7 +173,7 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
175
173
|
case 'rowgroup':
|
176
174
|
case 'row':
|
177
175
|
case 'headerrow':
|
178
|
-
return
|
176
|
+
return undefined;
|
179
177
|
case 'cell':
|
180
178
|
{
|
181
179
|
return (0, _react2.jsx)(TableCell, {
|
@@ -194,7 +192,7 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
194
192
|
"aria-label": state.collection.size > 0 ? 'loadingMore' : 'loading'
|
195
193
|
}));
|
196
194
|
default:
|
197
|
-
return
|
195
|
+
return undefined;
|
198
196
|
}
|
199
197
|
};
|
200
198
|
var viewport = (0, _react.useRef)({
|
@@ -215,7 +213,9 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
215
213
|
var isEmpty = state.collection.size === 0;
|
216
214
|
var onFocusedResizer = function onFocusedResizer() {
|
217
215
|
/* istanbul ignore next */
|
218
|
-
bodyRef.current
|
216
|
+
if (bodyRef.current && headerRef.current) {
|
217
|
+
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
218
|
+
}
|
219
219
|
};
|
220
220
|
var mergedProps = (0, _reactAria.mergeProps)(gridProps, focusProps);
|
221
221
|
return (0, _react2.jsx)(_DataTableContext.DataTableContext.Provider, {
|
@@ -245,47 +245,6 @@ var DataTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
245
245
|
}
|
246
246
|
})));
|
247
247
|
});
|
248
|
-
DataTable.propTypes = {
|
249
|
-
/**
|
250
|
-
* Sets the amount of vertical padding within each cell.
|
251
|
-
* density: 'compact' | 'regular' | 'spacious'
|
252
|
-
* @default 'regular'
|
253
|
-
*/
|
254
|
-
density: _propTypes["default"].string,
|
255
|
-
/** Sets the height of table. */
|
256
|
-
height: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
257
|
-
/** Determine if the header should be hidden. */
|
258
|
-
hasHiddenHeader: _propTypes["default"].bool,
|
259
|
-
/** Bool that determines if the items are sortable. */
|
260
|
-
isSortable: _propTypes["default"].bool,
|
261
|
-
/** The list of DataTable items. */
|
262
|
-
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({})),
|
263
|
-
/** Reflects current loading state. */
|
264
|
-
loadingState: _propTypes["default"].oneOf(['error', 'filtering', 'idle', 'loading', 'loadingMore', 'sorting']),
|
265
|
-
/** Handler that is called when a user performs an action on a row. */
|
266
|
-
onAction: _propTypes["default"].func,
|
267
|
-
/**
|
268
|
-
* Sets the overflow behavior for the cell contents.
|
269
|
-
* overflowMode: 'wrap' | 'truncate'
|
270
|
-
* @default 'truncate'
|
271
|
-
*/
|
272
|
-
overflowMode: _propTypes["default"].string,
|
273
|
-
/** Callback function that fires when more data should be loaded on demand as user scrolls. */
|
274
|
-
onLoadMore: _propTypes["default"].func,
|
275
|
-
/** Callback function that fires when sortable column header is pressed. */
|
276
|
-
onSortChange: _propTypes["default"].func,
|
277
|
-
/** Defines the current column key to sort by and the sort direction. */
|
278
|
-
sortDescriptor: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
279
|
-
column: _propTypes["default"].string,
|
280
|
-
direction: _propTypes["default"].oneOf(['ascending', 'descending'])
|
281
|
-
}), _propTypes["default"].string]),
|
282
|
-
/** Sets the width of table. */
|
283
|
-
width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
284
|
-
};
|
285
|
-
DataTable.defaultProps = {
|
286
|
-
width: '100%',
|
287
|
-
height: 565
|
288
|
-
};
|
289
248
|
var TableHeader = function TableHeader(_ref2) {
|
290
249
|
var children = _ref2.children,
|
291
250
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
@@ -322,7 +281,7 @@ var TableColumnHeader = function TableColumnHeader(props) {
|
|
322
281
|
}
|
323
282
|
});
|
324
283
|
var allProps = [columnHeaderProps];
|
325
|
-
var _useStatusClasses = (0, _hooks.useStatusClasses)((_useStatusClasses2 = {
|
284
|
+
var _useStatusClasses = (0, _hooks.useStatusClasses)('', (_useStatusClasses2 = {
|
326
285
|
'is-column-sortable': columnProps.allowsSorting
|
327
286
|
}, (0, _defineProperty2["default"])(_useStatusClasses2, "is-align-".concat(columnProps.align), columnProps.align), (0, _defineProperty2["default"])(_useStatusClasses2, 'is-first-column', isFirst), (0, _defineProperty2["default"])(_useStatusClasses2, 'is-last-column', isLast), _useStatusClasses2)),
|
328
287
|
classNames = _useStatusClasses.classNames;
|
@@ -334,7 +293,7 @@ var TableColumnHeader = function TableColumnHeader(props) {
|
|
334
293
|
ref: ref,
|
335
294
|
variant: "dataTable.tableHeadCell",
|
336
295
|
className: classNames
|
337
|
-
}, _reactAria.mergeProps.apply(void 0, (0, _concat["default"])(allProps).call(allProps, [column.props
|
296
|
+
}, _reactAria.mergeProps.apply(void 0, (0, _concat["default"])(allProps).call(allProps, [column.props]))), columnProps.hideHeader ? (0, _react2.jsx)(_reactAria.VisuallyHidden, null, column.rendered) : (0, _react2.jsx)(_index.Box, null, column.rendered), columnProps.allowsSorting && ((_state$sortDescriptor3 = state.sortDescriptor) === null || _state$sortDescriptor3 === void 0 ? void 0 : _state$sortDescriptor3.column) === column.key && (0, _react2.jsx)(_index.Box, null, arrowIcon)));
|
338
297
|
};
|
339
298
|
var TableRowGroup = function TableRowGroup(_ref3) {
|
340
299
|
var children = _ref3.children,
|
@@ -348,7 +307,7 @@ var TableRow = function TableRow(_ref4) {
|
|
348
307
|
children = _ref4.children,
|
349
308
|
hasActions = _ref4.hasActions,
|
350
309
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded3);
|
351
|
-
var ref = (0, _react.useRef)();
|
310
|
+
var ref = (0, _react.useRef)(null);
|
352
311
|
var _useDataTableContext2 = (0, _DataTableContext.useDataTableContext)(),
|
353
312
|
state = _useDataTableContext2.state;
|
354
313
|
var _useTableRow = (0, _table.useTableRow)({
|
@@ -365,7 +324,7 @@ var TableRow = function TableRow(_ref4) {
|
|
365
324
|
isFocusVisible = _useFocusRing3.isFocusVisible,
|
366
325
|
focusProps = _useFocusRing3.focusProps;
|
367
326
|
var props = (0, _reactAria.mergeProps)(rowProps, otherProps, focusWithinProps, focusProps);
|
368
|
-
var _useStatusClasses3 = (0, _hooks.useStatusClasses)({
|
327
|
+
var _useStatusClasses3 = (0, _hooks.useStatusClasses)('', {
|
369
328
|
'is-row-focus-visible': isFocusVisible || isFocusVisibleWithin
|
370
329
|
}),
|
371
330
|
classNames = _useStatusClasses3.classNames;
|
@@ -381,7 +340,7 @@ var TableHeaderRow = function TableHeaderRow(_ref5) {
|
|
381
340
|
style = _ref5.style;
|
382
341
|
var _useDataTableContext3 = (0, _DataTableContext.useDataTableContext)(),
|
383
342
|
state = _useDataTableContext3.state;
|
384
|
-
var ref = (0, _react.useRef)();
|
343
|
+
var ref = (0, _react.useRef)(null);
|
385
344
|
var _useTableHeaderRow = (0, _table.useTableHeaderRow)({
|
386
345
|
node: item,
|
387
346
|
isVirtualized: true
|
@@ -393,17 +352,18 @@ var TableHeaderRow = function TableHeaderRow(_ref5) {
|
|
393
352
|
}), children);
|
394
353
|
};
|
395
354
|
var TableCell = function TableCell(_ref6) {
|
355
|
+
var _cell$column;
|
396
356
|
var cell = _ref6.cell;
|
397
357
|
var _useDataTableContext4 = (0, _DataTableContext.useDataTableContext)(),
|
398
358
|
state = _useDataTableContext4.state;
|
399
|
-
var ref = (0, _react.useRef)();
|
400
|
-
var columnProps = cell.column.props;
|
359
|
+
var ref = (0, _react.useRef)(null);
|
360
|
+
var columnProps = (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.props;
|
401
361
|
var _useTableCell = (0, _table.useTableCell)({
|
402
362
|
node: cell,
|
403
363
|
isVirtualized: true
|
404
364
|
}, state, ref),
|
405
365
|
gridCellProps = _useTableCell.gridCellProps;
|
406
|
-
var _useStatusClasses4 = (0, _hooks.useStatusClasses)((0, _defineProperty2["default"])({}, "is-align-".concat(columnProps.align), columnProps.align)),
|
366
|
+
var _useStatusClasses4 = (0, _hooks.useStatusClasses)('', (0, _defineProperty2["default"])({}, "is-align-".concat(columnProps.align), columnProps.align)),
|
407
367
|
classNames = _useStatusClasses4.classNames;
|
408
368
|
return (0, _react2.jsx)(_reactAria.FocusRing, {
|
409
369
|
focusRingClass: "is-key-focused"
|
@@ -412,7 +372,7 @@ var TableCell = function TableCell(_ref6) {
|
|
412
372
|
ref: ref,
|
413
373
|
variant: "dataTable.tableCell",
|
414
374
|
className: classNames
|
415
|
-
}, (0, _reactAria.mergeProps)(gridCellProps, cell.props
|
375
|
+
}, (0, _reactAria.mergeProps)(gridCellProps, cell.props)), (0, _react2.jsx)(_index.Box, {
|
416
376
|
variant: "dataTable.tableCellContents"
|
417
377
|
}, cell.rendered)));
|
418
378
|
};
|
@@ -429,45 +389,5 @@ var CenteredWrapper = function CenteredWrapper(_ref7) {
|
|
429
389
|
"aria-colspan": state.collection.columns.length
|
430
390
|
}, children));
|
431
391
|
};
|
432
|
-
TableCell.propTypes = {
|
433
|
-
cell: _propTypes["default"].shape({
|
434
|
-
column: _propTypes["default"].shape({
|
435
|
-
props: _propTypes["default"].shape({
|
436
|
-
align: _propTypes["default"].string
|
437
|
-
})
|
438
|
-
}),
|
439
|
-
index: _propTypes["default"].number,
|
440
|
-
parentKey: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
|
441
|
-
props: _propTypes["default"].shape({
|
442
|
-
cellProps: _propTypes["default"].shape({})
|
443
|
-
}),
|
444
|
-
rendered: _propTypes["default"].node
|
445
|
-
})
|
446
|
-
};
|
447
|
-
TableHeaderRow.propTypes = {
|
448
|
-
children: _propTypes["default"].node,
|
449
|
-
item: _propTypes["default"].shape({}),
|
450
|
-
style: _propTypes["default"].shape({})
|
451
|
-
};
|
452
|
-
TableRow.propTypes = {
|
453
|
-
children: _propTypes["default"].node,
|
454
|
-
hasActions: _propTypes["default"].func,
|
455
|
-
item: _propTypes["default"].shape({})
|
456
|
-
};
|
457
|
-
TableColumnHeader.propTypes = {
|
458
|
-
column: _propTypes["default"].shape({
|
459
|
-
index: _propTypes["default"].number,
|
460
|
-
key: _propTypes["default"].string,
|
461
|
-
props: _propTypes["default"].shape({
|
462
|
-
align: _propTypes["default"].string,
|
463
|
-
allowsSorting: _propTypes["default"].bool,
|
464
|
-
cellProps: _propTypes["default"].shape({}),
|
465
|
-
hideHeader: _propTypes["default"].bool
|
466
|
-
}),
|
467
|
-
rendered: _propTypes["default"].node
|
468
|
-
}),
|
469
|
-
isFirst: _propTypes["default"].bool,
|
470
|
-
isLast: _propTypes["default"].bool
|
471
|
-
};
|
472
392
|
var _default = DataTable;
|
473
393
|
exports["default"] = _default;
|
@@ -0,0 +1,202 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: React.ForwardRefExoticComponent<import("../../index").DataTableProps & React.RefAttributes<HTMLDivElement>>;
|
5
|
+
parameters: {
|
6
|
+
docs: {
|
7
|
+
page: () => React.JSX.Element;
|
8
|
+
source: {
|
9
|
+
type: string;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
};
|
13
|
+
argTypes: {
|
14
|
+
'aria-controls': {
|
15
|
+
control: {
|
16
|
+
type: string;
|
17
|
+
};
|
18
|
+
table: {
|
19
|
+
type: {
|
20
|
+
summary: string;
|
21
|
+
};
|
22
|
+
category: string;
|
23
|
+
};
|
24
|
+
description: string;
|
25
|
+
};
|
26
|
+
'aria-describedby': {
|
27
|
+
control: {
|
28
|
+
type: string;
|
29
|
+
};
|
30
|
+
table: {
|
31
|
+
type: {
|
32
|
+
summary: string;
|
33
|
+
};
|
34
|
+
category: string;
|
35
|
+
};
|
36
|
+
description: string;
|
37
|
+
};
|
38
|
+
'aria-details': {
|
39
|
+
control: {
|
40
|
+
type: string;
|
41
|
+
};
|
42
|
+
table: {
|
43
|
+
type: {
|
44
|
+
summary: string;
|
45
|
+
};
|
46
|
+
category: string;
|
47
|
+
};
|
48
|
+
description: string;
|
49
|
+
};
|
50
|
+
'aria-errormessage': {
|
51
|
+
control: {
|
52
|
+
type: string;
|
53
|
+
};
|
54
|
+
table: {
|
55
|
+
type: {
|
56
|
+
summary: string;
|
57
|
+
};
|
58
|
+
category: string;
|
59
|
+
};
|
60
|
+
description: string;
|
61
|
+
};
|
62
|
+
'aria-label': {
|
63
|
+
control: {
|
64
|
+
type: string;
|
65
|
+
};
|
66
|
+
table: {
|
67
|
+
type: {
|
68
|
+
summary: string;
|
69
|
+
};
|
70
|
+
category: string;
|
71
|
+
};
|
72
|
+
description: string;
|
73
|
+
};
|
74
|
+
'aria-labelledby': {
|
75
|
+
control: {
|
76
|
+
type: string;
|
77
|
+
};
|
78
|
+
table: {
|
79
|
+
type: {
|
80
|
+
summary: string;
|
81
|
+
};
|
82
|
+
category: string;
|
83
|
+
};
|
84
|
+
description: string;
|
85
|
+
};
|
86
|
+
density: {
|
87
|
+
control: {
|
88
|
+
disable: boolean;
|
89
|
+
};
|
90
|
+
};
|
91
|
+
overflowMode: {
|
92
|
+
control: {
|
93
|
+
disable: boolean;
|
94
|
+
};
|
95
|
+
};
|
96
|
+
width: {
|
97
|
+
description: string;
|
98
|
+
control: {
|
99
|
+
disable: boolean;
|
100
|
+
};
|
101
|
+
};
|
102
|
+
height: {
|
103
|
+
description: string;
|
104
|
+
control: {
|
105
|
+
disable: boolean;
|
106
|
+
};
|
107
|
+
};
|
108
|
+
sortDescriptor: {
|
109
|
+
description: string;
|
110
|
+
control: {
|
111
|
+
disable: boolean;
|
112
|
+
};
|
113
|
+
};
|
114
|
+
onSortChange: {
|
115
|
+
description: string;
|
116
|
+
};
|
117
|
+
allowsSorting: {
|
118
|
+
description: string;
|
119
|
+
control: {
|
120
|
+
disable: boolean;
|
121
|
+
};
|
122
|
+
};
|
123
|
+
hideHeader: {
|
124
|
+
description: string;
|
125
|
+
control: {
|
126
|
+
disable: boolean;
|
127
|
+
};
|
128
|
+
};
|
129
|
+
loadingState: {
|
130
|
+
description: string;
|
131
|
+
control: {
|
132
|
+
disable: boolean;
|
133
|
+
};
|
134
|
+
};
|
135
|
+
onLoadMore: {
|
136
|
+
description: string;
|
137
|
+
};
|
138
|
+
items: {
|
139
|
+
control: {
|
140
|
+
disable: boolean;
|
141
|
+
};
|
142
|
+
description: string;
|
143
|
+
};
|
144
|
+
};
|
145
|
+
args: {
|
146
|
+
density: string;
|
147
|
+
overflowMode: string;
|
148
|
+
};
|
149
|
+
};
|
150
|
+
export default _default;
|
151
|
+
export declare const Default: {
|
152
|
+
(args: any): React.JSX.Element;
|
153
|
+
parameters: {
|
154
|
+
a11y: {
|
155
|
+
config: {
|
156
|
+
rules: {
|
157
|
+
id: string;
|
158
|
+
enabled: boolean;
|
159
|
+
}[];
|
160
|
+
};
|
161
|
+
};
|
162
|
+
};
|
163
|
+
};
|
164
|
+
export declare const Dynamic: {
|
165
|
+
(args: any): React.JSX.Element;
|
166
|
+
parameters: {
|
167
|
+
a11y: {
|
168
|
+
config: {
|
169
|
+
rules: {
|
170
|
+
id: string;
|
171
|
+
enabled: boolean;
|
172
|
+
}[];
|
173
|
+
};
|
174
|
+
};
|
175
|
+
};
|
176
|
+
};
|
177
|
+
export declare const Sortable: {
|
178
|
+
(args: any): React.JSX.Element;
|
179
|
+
parameters: {
|
180
|
+
a11y: {
|
181
|
+
config: {
|
182
|
+
rules: {
|
183
|
+
id: string;
|
184
|
+
enabled: boolean;
|
185
|
+
}[];
|
186
|
+
};
|
187
|
+
};
|
188
|
+
};
|
189
|
+
};
|
190
|
+
export declare const AsyncLoading: {
|
191
|
+
(args: any): React.JSX.Element;
|
192
|
+
parameters: {
|
193
|
+
a11y: {
|
194
|
+
config: {
|
195
|
+
rules: {
|
196
|
+
id: string;
|
197
|
+
enabled: boolean;
|
198
|
+
}[];
|
199
|
+
};
|
200
|
+
};
|
201
|
+
};
|
202
|
+
};
|
@@ -124,10 +124,12 @@ var _default = {
|
|
124
124
|
}
|
125
125
|
};
|
126
126
|
exports["default"] = _default;
|
127
|
-
var getCellProps = function getCellProps(columnKey) {
|
127
|
+
var getCellProps = function getCellProps(columnKey, align) {
|
128
128
|
return {
|
129
129
|
pr: columnKey !== 'menu' ? 'lg' : 0,
|
130
|
-
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
130
|
+
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg',
|
131
|
+
hideHeader: columnKey === 'menu',
|
132
|
+
align: align
|
131
133
|
};
|
132
134
|
};
|
133
135
|
var Default = function Default(args) {
|
@@ -216,19 +218,15 @@ var Default = function Default(args) {
|
|
216
218
|
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
217
219
|
columns: columns
|
218
220
|
}, function (column) {
|
219
|
-
return (0, _react2.jsx)(_index.DataTableColumn, {
|
220
|
-
cellProps: getCellProps(column.key),
|
221
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, false), {
|
221
222
|
minWidth: column.key !== 'menu' ? 175 : 32,
|
222
|
-
width: column.key !== 'menu' ? '19.4%' : 32
|
223
|
-
|
224
|
-
}, column.name);
|
223
|
+
width: column.key !== 'menu' ? '19.4%' : 32
|
224
|
+
}), column.name);
|
225
225
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
226
226
|
items: rows
|
227
227
|
}, function (item) {
|
228
228
|
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
229
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
230
|
-
cellProps: getCellProps(columnKey)
|
231
|
-
}, item[columnKey]);
|
229
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
232
230
|
});
|
233
231
|
}));
|
234
232
|
};
|
@@ -310,22 +308,20 @@ var Dynamic = function Dynamic(args) {
|
|
310
308
|
}
|
311
309
|
});
|
312
310
|
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
313
|
-
"aria-label": "Dynamic table"
|
311
|
+
"aria-label": "Dynamic table",
|
312
|
+
density: "compact",
|
313
|
+
scale: "medium"
|
314
314
|
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
315
315
|
columns: columns
|
316
316
|
}, function (column) {
|
317
|
-
return (0, _react2.jsx)(_index.DataTableColumn, {
|
318
|
-
|
319
|
-
|
320
|
-
align: "center"
|
321
|
-
}, column.name);
|
317
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, 'center'), {
|
318
|
+
minWidth: 155
|
319
|
+
}), column.name);
|
322
320
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
323
321
|
items: list.items
|
324
322
|
}, function (item) {
|
325
323
|
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
326
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
327
|
-
cellProps: getCellProps(columnKey)
|
328
|
-
}, item[columnKey]);
|
324
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, 'left'), item[columnKey]);
|
329
325
|
});
|
330
326
|
}));
|
331
327
|
};
|
@@ -427,12 +423,15 @@ var Sortable = function Sortable(args) {
|
|
427
423
|
};
|
428
424
|
return _context3.abrupt("return", {
|
429
425
|
items: (0, _sort["default"])(items).call(items, function (a, b) {
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
426
|
+
if (sortDescriptor.column) {
|
427
|
+
var first = a[sortDescriptor.column];
|
428
|
+
var second = b[sortDescriptor.column];
|
429
|
+
var firstNumericValue = getNumericValue(first);
|
430
|
+
var secondNumericValue = getNumericValue(second);
|
431
|
+
var cmp = firstNumericValue && secondNumericValue ? firstNumericValue - secondNumericValue : collator.compare(first, second);
|
432
|
+
return sortDescriptor.direction === 'descending' ? -cmp : cmp;
|
433
|
+
}
|
434
|
+
return 1;
|
436
435
|
})
|
437
436
|
});
|
438
437
|
case 3:
|
@@ -455,23 +454,21 @@ var Sortable = function Sortable(args) {
|
|
455
454
|
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
456
455
|
"aria-label": "Sortable table",
|
457
456
|
sortDescriptor: list.sortDescriptor,
|
458
|
-
onSortChange: (0, _sort["default"])(list)
|
457
|
+
onSortChange: (0, _sort["default"])(list),
|
458
|
+
density: "compact",
|
459
|
+
scale: "medium"
|
459
460
|
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
460
461
|
columns: columns
|
461
462
|
}, function (column) {
|
462
|
-
return (0, _react2.jsx)(_index.DataTableColumn, {
|
463
|
-
cellProps: getCellProps(column.key),
|
463
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, 'center'), {
|
464
464
|
allowsSorting: true,
|
465
|
-
minWidth: 155
|
466
|
-
|
467
|
-
}, column.name);
|
465
|
+
minWidth: 155
|
466
|
+
}), column.name);
|
468
467
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
469
468
|
items: list.items
|
470
469
|
}, function (item) {
|
471
470
|
return (0, _react2.jsx)(_index.DataTableRow, null, function (columnKey) {
|
472
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
473
|
-
cellProps: getCellProps(columnKey)
|
474
|
-
}, item[columnKey]);
|
471
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
475
472
|
});
|
476
473
|
}));
|
477
474
|
};
|
@@ -549,14 +546,15 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
549
546
|
});
|
550
547
|
return (0, _react2.jsx)(_index.DataTable, (0, _extends2["default"])({}, args, {
|
551
548
|
"aria-label": "Custom content table",
|
552
|
-
onAction: (0, _addonActions.action)('onAction')
|
549
|
+
onAction: (0, _addonActions.action)('onAction'),
|
550
|
+
density: "compact",
|
551
|
+
scale: "medium"
|
553
552
|
}), (0, _react2.jsx)(_index.DataTableHeader, {
|
554
553
|
columns: columns
|
555
554
|
}, function (column) {
|
556
|
-
return (0, _react2.jsx)(_index.DataTableColumn, {
|
557
|
-
cellProps: getCellProps(column.key),
|
555
|
+
return (0, _react2.jsx)(_index.DataTableColumn, (0, _extends2["default"])({}, getCellProps(column.key, false), {
|
558
556
|
minWidth: 155
|
559
|
-
}, column.name);
|
557
|
+
}), column.name);
|
560
558
|
}), (0, _react2.jsx)(_index.DataTableBody, {
|
561
559
|
items: list.items,
|
562
560
|
loadingState: list.loadingState,
|
@@ -565,9 +563,7 @@ var AsyncLoading = function AsyncLoading(args) {
|
|
565
563
|
return (0, _react2.jsx)(_index.DataTableRow, {
|
566
564
|
key: item.name
|
567
565
|
}, function (columnKey) {
|
568
|
-
return (0, _react2.jsx)(_index.DataTableCell,
|
569
|
-
cellProps: getCellProps(columnKey)
|
570
|
-
}, item[columnKey]);
|
566
|
+
return (0, _react2.jsx)(_index.DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
571
567
|
});
|
572
568
|
}));
|
573
569
|
};
|