@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
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -29,8 +29,19 @@ _forEachInstanceProperty(_context2 = _Object$keys(_events)).call(_context2, func
|
|
29
29
|
}
|
30
30
|
});
|
31
31
|
});
|
32
|
+
var _loadingState = require("./loadingState");
|
33
|
+
_forEachInstanceProperty(_context3 = _Object$keys(_loadingState)).call(_context3, function (key) {
|
34
|
+
if (key === "default" || key === "__esModule") return;
|
35
|
+
if (key in exports && exports[key] === _loadingState[key]) return;
|
36
|
+
_Object$defineProperty(exports, key, {
|
37
|
+
enumerable: true,
|
38
|
+
get: function get() {
|
39
|
+
return _loadingState[key];
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
32
43
|
var _orientation = require("./orientation");
|
33
|
-
_forEachInstanceProperty(
|
44
|
+
_forEachInstanceProperty(_context4 = _Object$keys(_orientation)).call(_context4, function (key) {
|
34
45
|
if (key === "default" || key === "__esModule") return;
|
35
46
|
if (key in exports && exports[key] === _orientation[key]) return;
|
36
47
|
_Object$defineProperty(exports, key, {
|
@@ -41,7 +52,7 @@ _forEachInstanceProperty(_context3 = _Object$keys(_orientation)).call(_context3,
|
|
41
52
|
});
|
42
53
|
});
|
43
54
|
var _style = require("./style");
|
44
|
-
_forEachInstanceProperty(
|
55
|
+
_forEachInstanceProperty(_context5 = _Object$keys(_style)).call(_context5, function (key) {
|
45
56
|
if (key === "default" || key === "__esModule") return;
|
46
57
|
if (key in exports && exports[key] === _style[key]) return;
|
47
58
|
_Object$defineProperty(exports, key, {
|
@@ -52,7 +63,7 @@ _forEachInstanceProperty(_context4 = _Object$keys(_style)).call(_context4, funct
|
|
52
63
|
});
|
53
64
|
});
|
54
65
|
var _utils = require("./utils");
|
55
|
-
_forEachInstanceProperty(
|
66
|
+
_forEachInstanceProperty(_context6 = _Object$keys(_utils)).call(_context6, function (key) {
|
56
67
|
if (key === "default" || key === "__esModule") return;
|
57
68
|
if (key in exports && exports[key] === _utils[key]) return;
|
58
69
|
_Object$defineProperty(exports, key, {
|
@@ -63,7 +74,7 @@ _forEachInstanceProperty(_context5 = _Object$keys(_utils)).call(_context5, funct
|
|
63
74
|
});
|
64
75
|
});
|
65
76
|
var _validPositiveInteger = require("./validPositiveInteger");
|
66
|
-
_forEachInstanceProperty(
|
77
|
+
_forEachInstanceProperty(_context7 = _Object$keys(_validPositiveInteger)).call(_context7, function (key) {
|
67
78
|
if (key === "default" || key === "__esModule") return;
|
68
79
|
if (key in exports && exports[key] === _validPositiveInteger[key]) return;
|
69
80
|
_Object$defineProperty(exports, key, {
|
@@ -0,0 +1 @@
|
|
1
|
+
export type loadingState = 'error' | 'filtering' | 'idle' | 'loading' | 'loadingMore' | 'sorting';
|
@@ -24,7 +24,6 @@ import { useTable, useTableCell, useTableColumnHeader, useTableHeaderRow, useTab
|
|
24
24
|
import { layoutInfoToStyle, VirtualizerItem } from '@react-aria/virtualizer';
|
25
25
|
import { TableLayout } from '@react-stately/layout';
|
26
26
|
import { TableColumnLayout, useTableState } from '@react-stately/table';
|
27
|
-
import PropTypes from 'prop-types';
|
28
27
|
import { DataTableContext, useDataTableContext } from '../../context/DataTableContext';
|
29
28
|
import { useLocalOrForwardRef, useStatusClasses } from '../../hooks';
|
30
29
|
import { Box, Icon, Loader } from '../../index';
|
@@ -48,14 +47,18 @@ var ROW_HEIGHTS = {
|
|
48
47
|
large: 50
|
49
48
|
},
|
50
49
|
spacious: {
|
51
|
-
medium: 48
|
50
|
+
medium: 48,
|
51
|
+
large: 60
|
52
52
|
}
|
53
53
|
};
|
54
54
|
var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
55
|
-
var scale = 'large';
|
56
55
|
var direction = 'ltr';
|
57
|
-
var onAction = props.onAction
|
58
|
-
|
56
|
+
var onAction = props.onAction,
|
57
|
+
_props$scale = props.scale,
|
58
|
+
scale = _props$scale === void 0 ? 'large' : _props$scale;
|
59
|
+
|
60
|
+
// const getDefaultWidth = useCallback(() => null, []) as GetDefaultWidth;
|
61
|
+
|
59
62
|
var getDefaultMinWidth = useCallback(function (_ref) {
|
60
63
|
var _ref$props = _ref.props,
|
61
64
|
hideHeader = _ref$props.hideHeader,
|
@@ -78,23 +81,22 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
78
81
|
// with table layout, so we need to track it here
|
79
82
|
var state = useTableState(_objectSpread({}, props));
|
80
83
|
var domRef = useLocalOrForwardRef(ref);
|
81
|
-
var headerRef = useRef();
|
82
|
-
var bodyRef = useRef();
|
84
|
+
var headerRef = useRef(null);
|
85
|
+
var bodyRef = useRef(null);
|
83
86
|
var density = props.density || 'regular';
|
84
87
|
var columnLayout = useMemo(function () {
|
85
88
|
return new TableColumnLayout({
|
86
|
-
getDefaultWidth: getDefaultWidth,
|
87
89
|
getDefaultMinWidth: getDefaultMinWidth
|
88
90
|
});
|
89
|
-
}, [
|
91
|
+
}, [getDefaultMinWidth]);
|
90
92
|
var layout = useMemo(function () {
|
91
93
|
return new TableLayout({
|
92
94
|
// If props.rowHeight is auto,
|
93
95
|
// then use estimated heights based on scale, otherwise use fixed heights.
|
94
96
|
rowHeight: props.overflowMode === 'wrap' ? null : ROW_HEIGHTS[density][scale],
|
95
97
|
estimatedRowHeight: props.overflowMode === 'wrap' ? ROW_HEIGHTS[density][scale] : null,
|
96
|
-
headingHeight: props.overflowMode === 'wrap' ?
|
97
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] :
|
98
|
+
headingHeight: props.overflowMode === 'wrap' ? undefined : DEFAULT_HEADER_HEIGHT[scale],
|
99
|
+
estimatedHeadingHeight: props.overflowMode === 'wrap' ? DEFAULT_HEADER_HEIGHT[scale] : undefined,
|
98
100
|
columnLayout: columnLayout,
|
99
101
|
initialCollection: state.collection
|
100
102
|
});
|
@@ -116,10 +118,6 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
116
118
|
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
117
119
|
var renderWrapper = function renderWrapper(parent, reusableView, children, renderChildren) {
|
118
120
|
var style = layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
|
119
|
-
if (style.overflow === 'hidden') {
|
120
|
-
style.overflow = 'visible'; // needed to support position: sticky
|
121
|
-
}
|
122
|
-
|
123
121
|
if (reusableView.viewType === 'rowgroup') {
|
124
122
|
return ___EmotionJSX(TableRowGroup, {
|
125
123
|
key: reusableView.key,
|
@@ -164,7 +162,7 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
164
162
|
case 'rowgroup':
|
165
163
|
case 'row':
|
166
164
|
case 'headerrow':
|
167
|
-
return
|
165
|
+
return undefined;
|
168
166
|
case 'cell':
|
169
167
|
{
|
170
168
|
return ___EmotionJSX(TableCell, {
|
@@ -183,7 +181,7 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
183
181
|
"aria-label": state.collection.size > 0 ? 'loadingMore' : 'loading'
|
184
182
|
}));
|
185
183
|
default:
|
186
|
-
return
|
184
|
+
return undefined;
|
187
185
|
}
|
188
186
|
};
|
189
187
|
var viewport = useRef({
|
@@ -204,7 +202,9 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
204
202
|
var isEmpty = state.collection.size === 0;
|
205
203
|
var onFocusedResizer = function onFocusedResizer() {
|
206
204
|
/* istanbul ignore next */
|
207
|
-
bodyRef.current
|
205
|
+
if (bodyRef.current && headerRef.current) {
|
206
|
+
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
207
|
+
}
|
208
208
|
};
|
209
209
|
var mergedProps = mergeProps(gridProps, focusProps);
|
210
210
|
return ___EmotionJSX(DataTableContext.Provider, {
|
@@ -234,47 +234,6 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
234
234
|
}
|
235
235
|
})));
|
236
236
|
});
|
237
|
-
DataTable.propTypes = {
|
238
|
-
/**
|
239
|
-
* Sets the amount of vertical padding within each cell.
|
240
|
-
* density: 'compact' | 'regular' | 'spacious'
|
241
|
-
* @default 'regular'
|
242
|
-
*/
|
243
|
-
density: PropTypes.string,
|
244
|
-
/** Sets the height of table. */
|
245
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
246
|
-
/** Determine if the header should be hidden. */
|
247
|
-
hasHiddenHeader: PropTypes.bool,
|
248
|
-
/** Bool that determines if the items are sortable. */
|
249
|
-
isSortable: PropTypes.bool,
|
250
|
-
/** The list of DataTable items. */
|
251
|
-
items: PropTypes.arrayOf(PropTypes.shape({})),
|
252
|
-
/** Reflects current loading state. */
|
253
|
-
loadingState: PropTypes.oneOf(['error', 'filtering', 'idle', 'loading', 'loadingMore', 'sorting']),
|
254
|
-
/** Handler that is called when a user performs an action on a row. */
|
255
|
-
onAction: PropTypes.func,
|
256
|
-
/**
|
257
|
-
* Sets the overflow behavior for the cell contents.
|
258
|
-
* overflowMode: 'wrap' | 'truncate'
|
259
|
-
* @default 'truncate'
|
260
|
-
*/
|
261
|
-
overflowMode: PropTypes.string,
|
262
|
-
/** Callback function that fires when more data should be loaded on demand as user scrolls. */
|
263
|
-
onLoadMore: PropTypes.func,
|
264
|
-
/** Callback function that fires when sortable column header is pressed. */
|
265
|
-
onSortChange: PropTypes.func,
|
266
|
-
/** Defines the current column key to sort by and the sort direction. */
|
267
|
-
sortDescriptor: PropTypes.oneOfType([PropTypes.shape({
|
268
|
-
column: PropTypes.string,
|
269
|
-
direction: PropTypes.oneOf(['ascending', 'descending'])
|
270
|
-
}), PropTypes.string]),
|
271
|
-
/** Sets the width of table. */
|
272
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
273
|
-
};
|
274
|
-
DataTable.defaultProps = {
|
275
|
-
width: '100%',
|
276
|
-
height: 565
|
277
|
-
};
|
278
237
|
var TableHeader = function TableHeader(_ref2) {
|
279
238
|
var children = _ref2.children,
|
280
239
|
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
@@ -311,7 +270,7 @@ var TableColumnHeader = function TableColumnHeader(props) {
|
|
311
270
|
}
|
312
271
|
});
|
313
272
|
var allProps = [columnHeaderProps];
|
314
|
-
var _useStatusClasses = useStatusClasses((_useStatusClasses2 = {
|
273
|
+
var _useStatusClasses = useStatusClasses('', (_useStatusClasses2 = {
|
315
274
|
'is-column-sortable': columnProps.allowsSorting
|
316
275
|
}, _defineProperty(_useStatusClasses2, "is-align-".concat(columnProps.align), columnProps.align), _defineProperty(_useStatusClasses2, 'is-first-column', isFirst), _defineProperty(_useStatusClasses2, 'is-last-column', isLast), _useStatusClasses2)),
|
317
276
|
classNames = _useStatusClasses.classNames;
|
@@ -323,7 +282,7 @@ var TableColumnHeader = function TableColumnHeader(props) {
|
|
323
282
|
ref: ref,
|
324
283
|
variant: "dataTable.tableHeadCell",
|
325
284
|
className: classNames
|
326
|
-
}, mergeProps.apply(void 0, _concatInstanceProperty(allProps).call(allProps, [column.props
|
285
|
+
}, mergeProps.apply(void 0, _concatInstanceProperty(allProps).call(allProps, [column.props]))), columnProps.hideHeader ? ___EmotionJSX(VisuallyHidden, null, column.rendered) : ___EmotionJSX(Box, null, column.rendered), columnProps.allowsSorting && ((_state$sortDescriptor3 = state.sortDescriptor) === null || _state$sortDescriptor3 === void 0 ? void 0 : _state$sortDescriptor3.column) === column.key && ___EmotionJSX(Box, null, arrowIcon)));
|
327
286
|
};
|
328
287
|
var TableRowGroup = function TableRowGroup(_ref3) {
|
329
288
|
var children = _ref3.children,
|
@@ -337,7 +296,7 @@ var TableRow = function TableRow(_ref4) {
|
|
337
296
|
children = _ref4.children,
|
338
297
|
hasActions = _ref4.hasActions,
|
339
298
|
otherProps = _objectWithoutProperties(_ref4, _excluded3);
|
340
|
-
var ref = useRef();
|
299
|
+
var ref = useRef(null);
|
341
300
|
var _useDataTableContext2 = useDataTableContext(),
|
342
301
|
state = _useDataTableContext2.state;
|
343
302
|
var _useTableRow = useTableRow({
|
@@ -354,7 +313,7 @@ var TableRow = function TableRow(_ref4) {
|
|
354
313
|
isFocusVisible = _useFocusRing3.isFocusVisible,
|
355
314
|
focusProps = _useFocusRing3.focusProps;
|
356
315
|
var props = mergeProps(rowProps, otherProps, focusWithinProps, focusProps);
|
357
|
-
var _useStatusClasses3 = useStatusClasses({
|
316
|
+
var _useStatusClasses3 = useStatusClasses('', {
|
358
317
|
'is-row-focus-visible': isFocusVisible || isFocusVisibleWithin
|
359
318
|
}),
|
360
319
|
classNames = _useStatusClasses3.classNames;
|
@@ -370,7 +329,7 @@ var TableHeaderRow = function TableHeaderRow(_ref5) {
|
|
370
329
|
style = _ref5.style;
|
371
330
|
var _useDataTableContext3 = useDataTableContext(),
|
372
331
|
state = _useDataTableContext3.state;
|
373
|
-
var ref = useRef();
|
332
|
+
var ref = useRef(null);
|
374
333
|
var _useTableHeaderRow = useTableHeaderRow({
|
375
334
|
node: item,
|
376
335
|
isVirtualized: true
|
@@ -382,17 +341,18 @@ var TableHeaderRow = function TableHeaderRow(_ref5) {
|
|
382
341
|
}), children);
|
383
342
|
};
|
384
343
|
var TableCell = function TableCell(_ref6) {
|
344
|
+
var _cell$column;
|
385
345
|
var cell = _ref6.cell;
|
386
346
|
var _useDataTableContext4 = useDataTableContext(),
|
387
347
|
state = _useDataTableContext4.state;
|
388
|
-
var ref = useRef();
|
389
|
-
var columnProps = cell.column.props;
|
348
|
+
var ref = useRef(null);
|
349
|
+
var columnProps = (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.props;
|
390
350
|
var _useTableCell = useTableCell({
|
391
351
|
node: cell,
|
392
352
|
isVirtualized: true
|
393
353
|
}, state, ref),
|
394
354
|
gridCellProps = _useTableCell.gridCellProps;
|
395
|
-
var _useStatusClasses4 = useStatusClasses(_defineProperty({}, "is-align-".concat(columnProps.align), columnProps.align)),
|
355
|
+
var _useStatusClasses4 = useStatusClasses('', _defineProperty({}, "is-align-".concat(columnProps.align), columnProps.align)),
|
396
356
|
classNames = _useStatusClasses4.classNames;
|
397
357
|
return ___EmotionJSX(FocusRing, {
|
398
358
|
focusRingClass: "is-key-focused"
|
@@ -401,7 +361,7 @@ var TableCell = function TableCell(_ref6) {
|
|
401
361
|
ref: ref,
|
402
362
|
variant: "dataTable.tableCell",
|
403
363
|
className: classNames
|
404
|
-
}, mergeProps(gridCellProps, cell.props
|
364
|
+
}, mergeProps(gridCellProps, cell.props)), ___EmotionJSX(Box, {
|
405
365
|
variant: "dataTable.tableCellContents"
|
406
366
|
}, cell.rendered)));
|
407
367
|
};
|
@@ -418,44 +378,4 @@ var CenteredWrapper = function CenteredWrapper(_ref7) {
|
|
418
378
|
"aria-colspan": state.collection.columns.length
|
419
379
|
}, children));
|
420
380
|
};
|
421
|
-
TableCell.propTypes = {
|
422
|
-
cell: PropTypes.shape({
|
423
|
-
column: PropTypes.shape({
|
424
|
-
props: PropTypes.shape({
|
425
|
-
align: PropTypes.string
|
426
|
-
})
|
427
|
-
}),
|
428
|
-
index: PropTypes.number,
|
429
|
-
parentKey: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
430
|
-
props: PropTypes.shape({
|
431
|
-
cellProps: PropTypes.shape({})
|
432
|
-
}),
|
433
|
-
rendered: PropTypes.node
|
434
|
-
})
|
435
|
-
};
|
436
|
-
TableHeaderRow.propTypes = {
|
437
|
-
children: PropTypes.node,
|
438
|
-
item: PropTypes.shape({}),
|
439
|
-
style: PropTypes.shape({})
|
440
|
-
};
|
441
|
-
TableRow.propTypes = {
|
442
|
-
children: PropTypes.node,
|
443
|
-
hasActions: PropTypes.func,
|
444
|
-
item: PropTypes.shape({})
|
445
|
-
};
|
446
|
-
TableColumnHeader.propTypes = {
|
447
|
-
column: PropTypes.shape({
|
448
|
-
index: PropTypes.number,
|
449
|
-
key: PropTypes.string,
|
450
|
-
props: PropTypes.shape({
|
451
|
-
align: PropTypes.string,
|
452
|
-
allowsSorting: PropTypes.bool,
|
453
|
-
cellProps: PropTypes.shape({}),
|
454
|
-
hideHeader: PropTypes.bool
|
455
|
-
}),
|
456
|
-
rendered: PropTypes.node
|
457
|
-
}),
|
458
|
-
isFirst: PropTypes.bool,
|
459
|
-
isLast: PropTypes.bool
|
460
|
-
};
|
461
381
|
export default DataTable;
|
@@ -112,10 +112,12 @@ export default {
|
|
112
112
|
overflowMode: 'truncate'
|
113
113
|
}
|
114
114
|
};
|
115
|
-
var getCellProps = function getCellProps(columnKey) {
|
115
|
+
var getCellProps = function getCellProps(columnKey, align) {
|
116
116
|
return {
|
117
117
|
pr: columnKey !== 'menu' ? 'lg' : 0,
|
118
|
-
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg'
|
118
|
+
pl: columnKey === 'timestamp' || columnKey === 'menu' ? 0 : 'lg',
|
119
|
+
hideHeader: columnKey === 'menu',
|
120
|
+
align: align
|
119
121
|
};
|
120
122
|
};
|
121
123
|
export var Default = function Default(args) {
|
@@ -204,19 +206,15 @@ export var Default = function Default(args) {
|
|
204
206
|
}), ___EmotionJSX(DataTableHeader, {
|
205
207
|
columns: columns
|
206
208
|
}, function (column) {
|
207
|
-
return ___EmotionJSX(DataTableColumn, {
|
208
|
-
cellProps: getCellProps(column.key),
|
209
|
+
return ___EmotionJSX(DataTableColumn, _extends({}, getCellProps(column.key, false), {
|
209
210
|
minWidth: column.key !== 'menu' ? 175 : 32,
|
210
|
-
width: column.key !== 'menu' ? '19.4%' : 32
|
211
|
-
|
212
|
-
}, column.name);
|
211
|
+
width: column.key !== 'menu' ? '19.4%' : 32
|
212
|
+
}), column.name);
|
213
213
|
}), ___EmotionJSX(DataTableBody, {
|
214
214
|
items: rows
|
215
215
|
}, function (item) {
|
216
216
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
217
|
-
return ___EmotionJSX(DataTableCell,
|
218
|
-
cellProps: getCellProps(columnKey)
|
219
|
-
}, item[columnKey]);
|
217
|
+
return ___EmotionJSX(DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
220
218
|
});
|
221
219
|
}));
|
222
220
|
};
|
@@ -297,22 +295,20 @@ export var Dynamic = function Dynamic(args) {
|
|
297
295
|
}
|
298
296
|
});
|
299
297
|
return ___EmotionJSX(DataTable, _extends({}, args, {
|
300
|
-
"aria-label": "Dynamic table"
|
298
|
+
"aria-label": "Dynamic table",
|
299
|
+
density: "compact",
|
300
|
+
scale: "medium"
|
301
301
|
}), ___EmotionJSX(DataTableHeader, {
|
302
302
|
columns: columns
|
303
303
|
}, function (column) {
|
304
|
-
return ___EmotionJSX(DataTableColumn, {
|
305
|
-
|
306
|
-
|
307
|
-
align: "center"
|
308
|
-
}, column.name);
|
304
|
+
return ___EmotionJSX(DataTableColumn, _extends({}, getCellProps(column.key, 'center'), {
|
305
|
+
minWidth: 155
|
306
|
+
}), column.name);
|
309
307
|
}), ___EmotionJSX(DataTableBody, {
|
310
308
|
items: list.items
|
311
309
|
}, function (item) {
|
312
310
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
313
|
-
return ___EmotionJSX(DataTableCell,
|
314
|
-
cellProps: getCellProps(columnKey)
|
315
|
-
}, item[columnKey]);
|
311
|
+
return ___EmotionJSX(DataTableCell, getCellProps(columnKey, 'left'), item[columnKey]);
|
316
312
|
});
|
317
313
|
}));
|
318
314
|
};
|
@@ -413,12 +409,15 @@ export var Sortable = function Sortable(args) {
|
|
413
409
|
};
|
414
410
|
return _context3.abrupt("return", {
|
415
411
|
items: _sortInstanceProperty(items).call(items, function (a, b) {
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
412
|
+
if (sortDescriptor.column) {
|
413
|
+
var first = a[sortDescriptor.column];
|
414
|
+
var second = b[sortDescriptor.column];
|
415
|
+
var firstNumericValue = getNumericValue(first);
|
416
|
+
var secondNumericValue = getNumericValue(second);
|
417
|
+
var cmp = firstNumericValue && secondNumericValue ? firstNumericValue - secondNumericValue : collator.compare(first, second);
|
418
|
+
return sortDescriptor.direction === 'descending' ? -cmp : cmp;
|
419
|
+
}
|
420
|
+
return 1;
|
422
421
|
})
|
423
422
|
});
|
424
423
|
case 3:
|
@@ -441,23 +440,21 @@ export var Sortable = function Sortable(args) {
|
|
441
440
|
return ___EmotionJSX(DataTable, _extends({}, args, {
|
442
441
|
"aria-label": "Sortable table",
|
443
442
|
sortDescriptor: list.sortDescriptor,
|
444
|
-
onSortChange: _sortInstanceProperty(list)
|
443
|
+
onSortChange: _sortInstanceProperty(list),
|
444
|
+
density: "compact",
|
445
|
+
scale: "medium"
|
445
446
|
}), ___EmotionJSX(DataTableHeader, {
|
446
447
|
columns: columns
|
447
448
|
}, function (column) {
|
448
|
-
return ___EmotionJSX(DataTableColumn, {
|
449
|
-
cellProps: getCellProps(column.key),
|
449
|
+
return ___EmotionJSX(DataTableColumn, _extends({}, getCellProps(column.key, 'center'), {
|
450
450
|
allowsSorting: true,
|
451
|
-
minWidth: 155
|
452
|
-
|
453
|
-
}, column.name);
|
451
|
+
minWidth: 155
|
452
|
+
}), column.name);
|
454
453
|
}), ___EmotionJSX(DataTableBody, {
|
455
454
|
items: list.items
|
456
455
|
}, function (item) {
|
457
456
|
return ___EmotionJSX(DataTableRow, null, function (columnKey) {
|
458
|
-
return ___EmotionJSX(DataTableCell,
|
459
|
-
cellProps: getCellProps(columnKey)
|
460
|
-
}, item[columnKey]);
|
457
|
+
return ___EmotionJSX(DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
461
458
|
});
|
462
459
|
}));
|
463
460
|
};
|
@@ -534,14 +531,15 @@ export var AsyncLoading = function AsyncLoading(args) {
|
|
534
531
|
});
|
535
532
|
return ___EmotionJSX(DataTable, _extends({}, args, {
|
536
533
|
"aria-label": "Custom content table",
|
537
|
-
onAction: action('onAction')
|
534
|
+
onAction: action('onAction'),
|
535
|
+
density: "compact",
|
536
|
+
scale: "medium"
|
538
537
|
}), ___EmotionJSX(DataTableHeader, {
|
539
538
|
columns: columns
|
540
539
|
}, function (column) {
|
541
|
-
return ___EmotionJSX(DataTableColumn, {
|
542
|
-
cellProps: getCellProps(column.key),
|
540
|
+
return ___EmotionJSX(DataTableColumn, _extends({}, getCellProps(column.key, false), {
|
543
541
|
minWidth: 155
|
544
|
-
}, column.name);
|
542
|
+
}), column.name);
|
545
543
|
}), ___EmotionJSX(DataTableBody, {
|
546
544
|
items: list.items,
|
547
545
|
loadingState: list.loadingState,
|
@@ -550,9 +548,7 @@ export var AsyncLoading = function AsyncLoading(args) {
|
|
550
548
|
return ___EmotionJSX(DataTableRow, {
|
551
549
|
key: item.name
|
552
550
|
}, function (columnKey) {
|
553
|
-
return ___EmotionJSX(DataTableCell,
|
554
|
-
cellProps: getCellProps(columnKey)
|
555
|
-
}, item[columnKey]);
|
551
|
+
return ___EmotionJSX(DataTableCell, getCellProps(columnKey, false), item[columnKey]);
|
556
552
|
});
|
557
553
|
}));
|
558
554
|
};
|