@atlaskit/link-datasource 5.5.1 → 5.6.1
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 +15 -0
- package/dist/cjs/ui/datasource-table-view/datasource-column-sort.js +60 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +52 -5
- package/dist/cjs/ui/issue-like-table/index.compiled.css +5 -0
- package/dist/cjs/ui/issue-like-table/index.js +148 -65
- package/dist/cjs/ui/issue-like-table/messages.js +10 -0
- package/dist/es2019/ui/datasource-table-view/datasource-column-sort.js +52 -0
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +46 -6
- package/dist/es2019/ui/issue-like-table/index.compiled.css +5 -0
- package/dist/es2019/ui/issue-like-table/index.js +87 -8
- package/dist/es2019/ui/issue-like-table/messages.js +10 -0
- package/dist/esm/ui/datasource-table-view/datasource-column-sort.js +53 -0
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +53 -6
- package/dist/esm/ui/issue-like-table/index.compiled.css +5 -0
- package/dist/esm/ui/issue-like-table/index.js +148 -65
- package/dist/esm/ui/issue-like-table/messages.js +10 -0
- package/dist/types/ui/datasource-table-view/datasource-column-sort.d.ts +12 -0
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +2 -2
- package/dist/types/ui/datasource-table-view/types.d.ts +1 -1
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/messages.d.ts +33 -23
- package/dist/types/ui/issue-like-table/types.d.ts +10 -0
- package/dist/types-ts4.5/ui/datasource-table-view/datasource-column-sort.d.ts +12 -0
- package/dist/types-ts4.5/ui/datasource-table-view/datasourceTableView.d.ts +2 -2
- package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/messages.d.ts +33 -23
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +10 -0
- package/package.json +14 -11
|
@@ -8,7 +8,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
8
8
|
var _excluded = ["as", "style"],
|
|
9
9
|
_excluded2 = ["as", "style"],
|
|
10
10
|
_excluded3 = ["as", "style"],
|
|
11
|
-
_excluded4 = ["as", "style"]
|
|
11
|
+
_excluded4 = ["as", "style"],
|
|
12
|
+
_excluded5 = ["as", "style"];
|
|
12
13
|
import "./index.compiled.css";
|
|
13
14
|
import { forwardRef } from 'react';
|
|
14
15
|
import * as React from 'react';
|
|
@@ -19,9 +20,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
20
|
/* eslint-disable @atlaskit/design-system/use-tokens-typography */
|
|
20
21
|
|
|
21
22
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
23
|
+
import { useIntl } from 'react-intl';
|
|
22
24
|
import invariant from 'tiny-invariant';
|
|
25
|
+
import Button from '@atlaskit/button/new';
|
|
23
26
|
import { FlagsProvider } from '@atlaskit/flag';
|
|
27
|
+
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
28
|
+
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
24
29
|
import { Skeleton } from '@atlaskit/linking-common';
|
|
30
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
31
|
import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
26
32
|
import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
|
|
27
33
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
@@ -36,6 +42,7 @@ import { ColumnPicker } from './column-picker';
|
|
|
36
42
|
import { DragColumnPreview } from './drag-column-preview';
|
|
37
43
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
38
44
|
import TableEmptyState from './empty-state';
|
|
45
|
+
import { issueLikeTableMessages } from './messages';
|
|
39
46
|
import { renderType } from './render-type';
|
|
40
47
|
import { TableCellContent } from './table-cell-content';
|
|
41
48
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
@@ -127,6 +134,22 @@ var tableStyles = null;
|
|
|
127
134
|
var noDefaultBorderStyles = null;
|
|
128
135
|
var headerStyles = null;
|
|
129
136
|
var headingHoverEffectStyles = null;
|
|
137
|
+
|
|
138
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- Matches DraggableTableHeading button normalization.
|
|
139
|
+
var SortableHeaderParent = forwardRef(function (_ref5, __cmplr) {
|
|
140
|
+
var _ref5$as = _ref5.as,
|
|
141
|
+
C = _ref5$as === void 0 ? "div" : _ref5$as,
|
|
142
|
+
__cmpls = _ref5.style,
|
|
143
|
+
__cmplp = _objectWithoutProperties(_ref5, _excluded5);
|
|
144
|
+
return /*#__PURE__*/React.createElement(C, _extends({}, __cmplp, {
|
|
145
|
+
style: __cmpls,
|
|
146
|
+
ref: __cmplr,
|
|
147
|
+
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _1wtnze3t _ficf1e5h _jq8g1wug _11lvze3t _yhjm1b66", __cmplp.className])
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
151
|
+
SortableHeaderParent.displayName = 'SortableHeaderParent';
|
|
152
|
+
}
|
|
130
153
|
function extractIndex(data) {
|
|
131
154
|
var index = data.index;
|
|
132
155
|
invariant(typeof index === 'number');
|
|
@@ -173,26 +196,30 @@ function getDefaultColumnWidth(key, type) {
|
|
|
173
196
|
return DEFAULT_WIDTH;
|
|
174
197
|
}
|
|
175
198
|
}
|
|
176
|
-
export var IssueLikeDataTableView = function IssueLikeDataTableView(
|
|
199
|
+
export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
177
200
|
var _containerRef$current;
|
|
178
|
-
var testId =
|
|
179
|
-
onNextPage =
|
|
180
|
-
onLoadDatasourceDetails =
|
|
181
|
-
items =
|
|
182
|
-
itemIds =
|
|
183
|
-
columns =
|
|
184
|
-
|
|
185
|
-
renderItem =
|
|
186
|
-
visibleColumnKeys =
|
|
187
|
-
onVisibleColumnKeysChange =
|
|
188
|
-
columnCustomSizes =
|
|
189
|
-
onColumnResize =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
var testId = _ref6.testId,
|
|
202
|
+
onNextPage = _ref6.onNextPage,
|
|
203
|
+
onLoadDatasourceDetails = _ref6.onLoadDatasourceDetails,
|
|
204
|
+
items = _ref6.items,
|
|
205
|
+
itemIds = _ref6.itemIds,
|
|
206
|
+
columns = _ref6.columns,
|
|
207
|
+
_ref6$renderItem = _ref6.renderItem,
|
|
208
|
+
renderItem = _ref6$renderItem === void 0 ? renderType : _ref6$renderItem,
|
|
209
|
+
visibleColumnKeys = _ref6.visibleColumnKeys,
|
|
210
|
+
onVisibleColumnKeysChange = _ref6.onVisibleColumnKeysChange,
|
|
211
|
+
columnCustomSizes = _ref6.columnCustomSizes,
|
|
212
|
+
onColumnResize = _ref6.onColumnResize,
|
|
213
|
+
onColumnSort = _ref6.onColumnSort,
|
|
214
|
+
wrappedColumnKeys = _ref6.wrappedColumnKeys,
|
|
215
|
+
onWrappedColumnChange = _ref6.onWrappedColumnChange,
|
|
216
|
+
sortState = _ref6.sortState,
|
|
217
|
+
status = _ref6.status,
|
|
218
|
+
hasNextPage = _ref6.hasNextPage,
|
|
219
|
+
scrollableContainerHeight = _ref6.scrollableContainerHeight,
|
|
220
|
+
extensionKey = _ref6.extensionKey;
|
|
221
|
+
var _useIntl = useIntl(),
|
|
222
|
+
formatMessage = _useIntl.formatMessage;
|
|
196
223
|
var tableId = useMemo(function () {
|
|
197
224
|
return Symbol('unique-id');
|
|
198
225
|
}, []);
|
|
@@ -229,8 +256,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
229
256
|
}, [experienceId, status]);
|
|
230
257
|
var visibleSortedColumns = useMemo(function () {
|
|
231
258
|
return visibleColumnKeys.map(function (visibleKey) {
|
|
232
|
-
return orderedColumns.find(function (
|
|
233
|
-
var key =
|
|
259
|
+
return orderedColumns.find(function (_ref7) {
|
|
260
|
+
var key = _ref7.key;
|
|
234
261
|
return visibleKey === key;
|
|
235
262
|
});
|
|
236
263
|
}).filter(Boolean);
|
|
@@ -240,9 +267,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
240
267
|
// If data comes first, then columns and then visibleColumnKeys it blows up,
|
|
241
268
|
// or some other combination.
|
|
242
269
|
var columnsWidthsSum = useMemo(function () {
|
|
243
|
-
return visibleSortedColumns.map(function (
|
|
244
|
-
var key =
|
|
245
|
-
type =
|
|
270
|
+
return visibleSortedColumns.map(function (_ref8) {
|
|
271
|
+
var key = _ref8.key,
|
|
272
|
+
type = _ref8.type;
|
|
246
273
|
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
247
274
|
}).reduce(function (sum, width) {
|
|
248
275
|
return width + sum;
|
|
@@ -258,10 +285,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
258
285
|
}
|
|
259
286
|
}, [columnCustomSizes, columnsWidthsSum, shouldUseWidth, tableContainerWidth]);
|
|
260
287
|
var headerColumns = useMemo(function () {
|
|
261
|
-
return visibleSortedColumns.map(function (
|
|
262
|
-
var key =
|
|
263
|
-
title =
|
|
264
|
-
type =
|
|
288
|
+
return visibleSortedColumns.map(function (_ref9, index) {
|
|
289
|
+
var key = _ref9.key,
|
|
290
|
+
title = _ref9.title,
|
|
291
|
+
type = _ref9.type;
|
|
265
292
|
return {
|
|
266
293
|
key: key,
|
|
267
294
|
content: title,
|
|
@@ -283,7 +310,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
283
310
|
height: 14,
|
|
284
311
|
testId: "issues-table-row-loading"
|
|
285
312
|
})),
|
|
286
|
-
key: column.key
|
|
313
|
+
key: column.key,
|
|
314
|
+
width: column.width
|
|
287
315
|
};
|
|
288
316
|
})
|
|
289
317
|
};
|
|
@@ -316,9 +344,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
316
344
|
return;
|
|
317
345
|
}
|
|
318
346
|
return combine(monitorForElements({
|
|
319
|
-
onDragStart: function onDragStart(
|
|
320
|
-
var location =
|
|
321
|
-
source =
|
|
347
|
+
onDragStart: function onDragStart(_ref0) {
|
|
348
|
+
var location = _ref0.location,
|
|
349
|
+
source = _ref0.source;
|
|
322
350
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
323
351
|
if (source.data.type === 'table-header') {
|
|
324
352
|
var _containerRef$current2;
|
|
@@ -334,9 +362,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
334
362
|
});
|
|
335
363
|
}
|
|
336
364
|
},
|
|
337
|
-
onDrag: function onDrag(
|
|
338
|
-
var location =
|
|
339
|
-
source =
|
|
365
|
+
onDrag: function onDrag(_ref1) {
|
|
366
|
+
var location = _ref1.location,
|
|
367
|
+
source = _ref1.source;
|
|
340
368
|
if (source.data.type === 'table-header') {
|
|
341
369
|
var _containerRef$current3;
|
|
342
370
|
autoScroller.updateInput({
|
|
@@ -346,9 +374,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
346
374
|
});
|
|
347
375
|
}
|
|
348
376
|
},
|
|
349
|
-
onDrop: function onDrop(
|
|
350
|
-
var source =
|
|
351
|
-
location =
|
|
377
|
+
onDrop: function onDrop(_ref10) {
|
|
378
|
+
var source = _ref10.source,
|
|
379
|
+
location = _ref10.location;
|
|
352
380
|
autoScroller.stop();
|
|
353
381
|
if (location.current.dropTargets.length === 0) {
|
|
354
382
|
return;
|
|
@@ -383,10 +411,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
383
411
|
return itemIds.map(function (id, rowIndex) {
|
|
384
412
|
return {
|
|
385
413
|
key: id,
|
|
386
|
-
cells: visibleSortedColumns.map(function (
|
|
387
|
-
var key =
|
|
388
|
-
type =
|
|
389
|
-
title =
|
|
414
|
+
cells: visibleSortedColumns.map(function (_ref11, cellIndex) {
|
|
415
|
+
var key = _ref11.key,
|
|
416
|
+
type = _ref11.type,
|
|
417
|
+
title = _ref11.title;
|
|
390
418
|
return {
|
|
391
419
|
key: key,
|
|
392
420
|
columnKey: key,
|
|
@@ -407,10 +435,25 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
407
435
|
};
|
|
408
436
|
});
|
|
409
437
|
}, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth]);
|
|
438
|
+
var previousRealRowsCountRef = useRef(undefined);
|
|
439
|
+
useEffect(function () {
|
|
440
|
+
if (tableRows.length > 0) {
|
|
441
|
+
previousRealRowsCountRef.current = tableRows.length;
|
|
442
|
+
}
|
|
443
|
+
}, [tableRows.length]);
|
|
410
444
|
var rows = useMemo(function () {
|
|
411
|
-
if (
|
|
412
|
-
|
|
445
|
+
if (fg('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
446
|
+
var hasPreviousRealRows = !!previousRealRowsCountRef.current;
|
|
447
|
+
var isLoadingState = status === 'loading' || status === 'empty' && hasPreviousRealRows;
|
|
448
|
+
if (!isLoadingState) {
|
|
449
|
+
return tableRows;
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
if (status !== 'loading') {
|
|
453
|
+
return tableRows;
|
|
454
|
+
}
|
|
413
455
|
}
|
|
456
|
+
|
|
414
457
|
// if there are table rows, only add 1 loading row
|
|
415
458
|
if (tableRows.length > 0) {
|
|
416
459
|
return [].concat(_toConsumableArray(tableRows), [_objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
@@ -420,6 +463,14 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
420
463
|
// if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
|
|
421
464
|
// add 10 rows if it is modal (no scrollableContainerHeight)
|
|
422
465
|
var loadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
466
|
+
if (fg('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
467
|
+
var defaultLoadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
468
|
+
var previousRealRowsCount = previousRealRowsCountRef.current;
|
|
469
|
+
loadingRowsCount = defaultLoadingRowsCount;
|
|
470
|
+
if (previousRealRowsCount && previousRealRowsCount < defaultLoadingRowsCount) {
|
|
471
|
+
loadingRowsCount = previousRealRowsCount;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
423
474
|
return _toConsumableArray(Array(loadingRowsCount)).map(function (_, index) {
|
|
424
475
|
return _objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
425
476
|
key: "loading-".concat(index)
|
|
@@ -466,6 +517,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
466
517
|
}, _callee, null, [[2, 4]]);
|
|
467
518
|
})), [experienceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
468
519
|
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
520
|
+
// Sorting is enabled only when the table owns the header interaction (read-only mode).
|
|
521
|
+
// Editable tables reserve header interactions for drag/resize/wrap controls.
|
|
522
|
+
var shouldEnableColumnSort = !!onColumnSort && !onVisibleColumnKeysChange && !onColumnResize && !onWrappedColumnChange;
|
|
469
523
|
var orderedColumnsAreUpToDate = orderedColumns.length === columns.length;
|
|
470
524
|
var shouldDisplayColumnsInPicker = hasFullSchema && orderedColumnsAreUpToDate;
|
|
471
525
|
var view = /*#__PURE__*/React.createElement("div", {
|
|
@@ -495,10 +549,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
495
549
|
className: ax(["_n7zlidpf", "_bfhkchd4 _kqsw1if8 _154iidpf _1pbyzo7u", !!onVisibleColumnKeysChange ? 'has-column-picker' : ''])
|
|
496
550
|
}, /*#__PURE__*/React.createElement("tr", {
|
|
497
551
|
ref: tableHeaderRowRef
|
|
498
|
-
}, headerColumns.map(function (
|
|
499
|
-
var key =
|
|
500
|
-
content =
|
|
501
|
-
width =
|
|
552
|
+
}, headerColumns.map(function (_ref13, cellIndex) {
|
|
553
|
+
var key = _ref13.key,
|
|
554
|
+
content = _ref13.content,
|
|
555
|
+
width = _ref13.width;
|
|
502
556
|
var heading = /*#__PURE__*/React.createElement(Tooltip, {
|
|
503
557
|
content: content,
|
|
504
558
|
tag: "span",
|
|
@@ -509,17 +563,44 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
509
563
|
className: ax(["_11c8wadc _k48p1wq8"])
|
|
510
564
|
}, content));
|
|
511
565
|
var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
|
|
512
|
-
if (
|
|
566
|
+
if (shouldEnableColumnSort) {
|
|
567
|
+
var sortedDirection = (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key ? sortState.direction : undefined;
|
|
568
|
+
// Use directional icon only for the active sort column; keep width stable otherwise.
|
|
569
|
+
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon : null;
|
|
570
|
+
var sortLabel = typeof content === 'string' ? content : key;
|
|
571
|
+
var sortButtonAriaLabel = sortedDirection === 'ASC' ? formatMessage(issueLikeTableMessages.sortByColumnDescendingAction, {
|
|
572
|
+
column: sortLabel
|
|
573
|
+
}) : formatMessage(issueLikeTableMessages.sortByColumnAscendingAction, {
|
|
574
|
+
column: sortLabel
|
|
575
|
+
});
|
|
576
|
+
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
577
|
+
appearance: "subtle",
|
|
578
|
+
spacing: "compact",
|
|
579
|
+
shouldFitContainer: true,
|
|
580
|
+
testId: "".concat(key, "-column-sort-button"),
|
|
581
|
+
"aria-label": sortButtonAriaLabel
|
|
582
|
+
}, SortIcon ? {
|
|
583
|
+
iconAfter: function iconAfter(iconProps) {
|
|
584
|
+
return /*#__PURE__*/React.createElement(SortIcon, _extends({}, iconProps, {
|
|
585
|
+
size: "small"
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
} : {}, {
|
|
589
|
+
onClick: function onClick() {
|
|
590
|
+
return onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort(key);
|
|
591
|
+
}
|
|
592
|
+
}), heading));
|
|
593
|
+
} else if (isHeadingOutsideButton) {
|
|
513
594
|
heading = /*#__PURE__*/React.createElement("div", {
|
|
514
595
|
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _8vu418qm _irr3l4ek"])
|
|
515
596
|
}, heading);
|
|
516
597
|
}
|
|
517
598
|
if (isEditable) {
|
|
518
599
|
var _containerRef$current4;
|
|
519
|
-
var previewRows = tableRows.map(function (
|
|
520
|
-
var cells =
|
|
521
|
-
var cell = cells.find(function (
|
|
522
|
-
var cellKey =
|
|
600
|
+
var previewRows = tableRows.map(function (_ref14) {
|
|
601
|
+
var cells = _ref14.cells;
|
|
602
|
+
var cell = cells.find(function (_ref15) {
|
|
603
|
+
var cellKey = _ref15.key;
|
|
523
604
|
return cellKey === key;
|
|
524
605
|
});
|
|
525
606
|
if (cell) {
|
|
@@ -543,16 +624,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
543
624
|
onIsWrappedChange: onWrappedColumnChange === null || onWrappedColumnChange === void 0 ? void 0 : onWrappedColumnChange.bind(null, key)
|
|
544
625
|
}, heading);
|
|
545
626
|
} else {
|
|
546
|
-
return /*#__PURE__*/React.createElement(TableHeading, {
|
|
627
|
+
return /*#__PURE__*/React.createElement(TableHeading, _extends({
|
|
547
628
|
key: key,
|
|
548
629
|
"data-testid": "".concat(key, "-column-heading")
|
|
630
|
+
}, fg('platform_lp_jira_sllv_renderer_column_sorting') ? {
|
|
631
|
+
'aria-sort': (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key && sortState.direction === 'ASC' ? 'ascending' : (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key && sortState.direction === 'DESC' ? 'descending' : undefined
|
|
632
|
+
} : {}, {
|
|
549
633
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
550
|
-
,
|
|
551
634
|
style: getWidthCss({
|
|
552
635
|
shouldUseWidth: shouldUseWidth,
|
|
553
636
|
width: width
|
|
554
637
|
})
|
|
555
|
-
}, heading);
|
|
638
|
+
}), heading);
|
|
556
639
|
}
|
|
557
640
|
}), onVisibleColumnKeysChange && /*#__PURE__*/React.createElement(ColumnPickerHeader, null, /*#__PURE__*/React.createElement(ColumnPicker, {
|
|
558
641
|
columns: shouldDisplayColumnsInPicker ? orderedColumns : [],
|
|
@@ -562,18 +645,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
562
645
|
})))), /*#__PURE__*/React.createElement("tbody", {
|
|
563
646
|
"data-testid": testId && "".concat(testId, "--body"),
|
|
564
647
|
className: ax(["_n7zlidpf"])
|
|
565
|
-
}, rows.map(function (
|
|
566
|
-
var key =
|
|
567
|
-
cells =
|
|
568
|
-
ref =
|
|
648
|
+
}, rows.map(function (_ref16) {
|
|
649
|
+
var key = _ref16.key,
|
|
650
|
+
cells = _ref16.cells,
|
|
651
|
+
ref = _ref16.ref;
|
|
569
652
|
return /*#__PURE__*/React.createElement("tr", {
|
|
570
653
|
key: key,
|
|
571
654
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
572
655
|
ref: ref
|
|
573
|
-
}, cells.map(function (
|
|
574
|
-
var cellKey =
|
|
575
|
-
content =
|
|
576
|
-
width =
|
|
656
|
+
}, cells.map(function (_ref17, cellIndex) {
|
|
657
|
+
var cellKey = _ref17.key,
|
|
658
|
+
content = _ref17.content,
|
|
659
|
+
width = _ref17.width;
|
|
577
660
|
var isLastCell = cellIndex === cells.length - 1;
|
|
578
661
|
var loadingRowStyle = getWidthCss({
|
|
579
662
|
shouldUseWidth: shouldUseWidth,
|
|
@@ -40,6 +40,16 @@ export var issueLikeTableMessages = defineMessages({
|
|
|
40
40
|
description: 'Table header Dropdown item for making whole column to not wrap text',
|
|
41
41
|
defaultMessage: 'Unwrap text'
|
|
42
42
|
},
|
|
43
|
+
sortByColumnAscendingAction: {
|
|
44
|
+
id: 'linkDataSource.issue-line-table.sort-by-column-ascending-action',
|
|
45
|
+
description: 'Accessible label for sorting a table column in ascending order',
|
|
46
|
+
defaultMessage: 'Sort by {column} ascending.'
|
|
47
|
+
},
|
|
48
|
+
sortByColumnDescendingAction: {
|
|
49
|
+
id: 'linkDataSource.issue-line-table.sort-by-column-descending-action',
|
|
50
|
+
description: 'Accessible label for sorting a table column in descending order',
|
|
51
|
+
defaultMessage: 'Sort by {column} descending.'
|
|
52
|
+
},
|
|
43
53
|
fetchActionErrorGenericDescriptionGalaxia: {
|
|
44
54
|
id: 'linkDataSource.issue-line-table.fetch-action-error-generic-description-galaxia',
|
|
45
55
|
description: 'Generic error message description shown when fetching inline edit dropdown field fails',
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
2
|
+
import type { DatasourceTableSortState } from '../issue-like-table/types';
|
|
3
|
+
export type { DatasourceTableSortState } from '../issue-like-table/types';
|
|
4
|
+
export type DatasourceColumnSortGetter = ({ parameters, columnKey, currentSort, }: {
|
|
5
|
+
columnKey: string;
|
|
6
|
+
currentSort?: DatasourceTableSortState;
|
|
7
|
+
parameters: DatasourceParameters;
|
|
8
|
+
}) => {
|
|
9
|
+
parameters: DatasourceParameters;
|
|
10
|
+
sort?: DatasourceTableSortState;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare const getDatasourceColumnSortGetter: (datasourceId: string) => DatasourceColumnSortGetter | undefined;
|
|
@@ -10,9 +10,9 @@ export declare const DatasourceTableView: ForwardRefExoticComponent<{
|
|
|
10
10
|
datasourceId: string;
|
|
11
11
|
parameters: DatasourceParameters;
|
|
12
12
|
url?: string;
|
|
13
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
13
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
14
14
|
export declare const DataSourceTableViewNoSuspense: ForwardRefExoticComponent<{
|
|
15
15
|
datasourceId: string;
|
|
16
16
|
parameters: DatasourceParameters;
|
|
17
17
|
url?: string;
|
|
18
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
18
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
@@ -7,4 +7,4 @@ export type DatasourceTableViewProps = {
|
|
|
7
7
|
parameters: DatasourceParameters;
|
|
8
8
|
/** Url for an existing datasource, initially used for displaying to a user unauthorized to query that site */
|
|
9
9
|
url?: string;
|
|
10
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>>;
|
|
10
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>>;
|
|
@@ -2,5 +2,5 @@ import { type DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/d
|
|
|
2
2
|
import { type Props } from './empty-state';
|
|
3
3
|
import { type IssueLikeDataTableViewProps } from './types';
|
|
4
4
|
export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
5
|
-
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, itemIds, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, status, hasNextPage, scrollableContainerHeight, extensionKey, }: IssueLikeDataTableViewProps) => JSX.Element;
|
|
5
|
+
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, itemIds, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, onColumnSort, wrappedColumnKeys, onWrappedColumnChange, sortState, status, hasNextPage, scrollableContainerHeight, extensionKey, }: IssueLikeDataTableViewProps) => JSX.Element;
|
|
6
6
|
export declare const EmptyState: ({ isCompact, testId }: Props) => JSX.Element;
|
|
@@ -1,47 +1,57 @@
|
|
|
1
1
|
export declare const issueLikeTableMessages: {
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
description: string;
|
|
2
|
+
fetchActionErrorGenericDescription: {
|
|
5
3
|
defaultMessage: string;
|
|
6
|
-
};
|
|
7
|
-
updateError403Title: {
|
|
8
|
-
id: string;
|
|
9
4
|
description: string;
|
|
10
|
-
defaultMessage: string;
|
|
11
|
-
};
|
|
12
|
-
updateErrorGenericDescription: {
|
|
13
5
|
id: string;
|
|
14
|
-
description: string;
|
|
15
|
-
defaultMessage: string;
|
|
16
6
|
};
|
|
17
|
-
|
|
18
|
-
id: string;
|
|
19
|
-
description: string;
|
|
7
|
+
fetchActionErrorGenericDescriptionGalaxia: {
|
|
20
8
|
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
fetchActionErrorGenericDescription: {
|
|
23
|
-
id: string;
|
|
24
9
|
description: string;
|
|
25
|
-
|
|
10
|
+
id: string;
|
|
26
11
|
};
|
|
27
12
|
fetchActionErrorGenericTitle: {
|
|
28
|
-
id: string;
|
|
29
|
-
description: string;
|
|
30
13
|
defaultMessage: string;
|
|
31
|
-
|
|
32
|
-
wrapText: {
|
|
14
|
+
description: string;
|
|
33
15
|
id: string;
|
|
16
|
+
};
|
|
17
|
+
sortByColumnAscendingAction: {
|
|
18
|
+
defaultMessage: string;
|
|
34
19
|
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
sortByColumnDescendingAction: {
|
|
35
23
|
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
id: string;
|
|
36
26
|
};
|
|
37
27
|
unwrapText: {
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description: string;
|
|
38
30
|
id: string;
|
|
31
|
+
};
|
|
32
|
+
updateError403Description: {
|
|
33
|
+
defaultMessage: string;
|
|
39
34
|
description: string;
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
37
|
+
updateError403Title: {
|
|
40
38
|
defaultMessage: string;
|
|
39
|
+
description: string;
|
|
40
|
+
id: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
updateErrorGenericDescription: {
|
|
43
|
+
defaultMessage: string;
|
|
44
|
+
description: string;
|
|
43
45
|
id: string;
|
|
46
|
+
};
|
|
47
|
+
updateErrorGenericTitle: {
|
|
48
|
+
defaultMessage: string;
|
|
44
49
|
description: string;
|
|
50
|
+
id: string;
|
|
51
|
+
};
|
|
52
|
+
wrapText: {
|
|
45
53
|
defaultMessage: string;
|
|
54
|
+
description: string;
|
|
55
|
+
id: string;
|
|
46
56
|
};
|
|
47
57
|
};
|
|
@@ -23,6 +23,11 @@ export type TableViewPropsRenderType = (item: DatasourceTypeWithOnlyValues) => R
|
|
|
23
23
|
export interface ColumnSizesMap {
|
|
24
24
|
[key: string]: number;
|
|
25
25
|
}
|
|
26
|
+
export type DatasourceTableSortDirection = 'ASC' | 'DESC';
|
|
27
|
+
export type DatasourceTableSortState = {
|
|
28
|
+
direction: DatasourceTableSortDirection;
|
|
29
|
+
key: string;
|
|
30
|
+
};
|
|
26
31
|
export interface IssueLikeDataTableViewProps {
|
|
27
32
|
/**
|
|
28
33
|
* Map of column key to custom column width
|
|
@@ -42,6 +47,10 @@ export interface IssueLikeDataTableViewProps {
|
|
|
42
47
|
itemIds: string[];
|
|
43
48
|
items: DatasourceDataResponseItem[];
|
|
44
49
|
onColumnResize?: (key: string, width: number) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback to be invoked whenever a user sorts a datasource table by a column.
|
|
52
|
+
*/
|
|
53
|
+
onColumnSort?: (key: string) => void;
|
|
45
54
|
onLoadDatasourceDetails: () => Promise<void>;
|
|
46
55
|
onNextPage: NextPageType;
|
|
47
56
|
/**
|
|
@@ -76,6 +85,7 @@ export interface IssueLikeDataTableViewProps {
|
|
|
76
85
|
* It this number is 0 it will not restrict height and not make container scrollable.
|
|
77
86
|
*/
|
|
78
87
|
scrollableContainerHeight?: number;
|
|
88
|
+
sortState?: DatasourceTableSortState;
|
|
79
89
|
status: DatasourceTableStatusType;
|
|
80
90
|
testId?: string;
|
|
81
91
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
2
|
+
import type { DatasourceTableSortState } from '../issue-like-table/types';
|
|
3
|
+
export type { DatasourceTableSortState } from '../issue-like-table/types';
|
|
4
|
+
export type DatasourceColumnSortGetter = ({ parameters, columnKey, currentSort, }: {
|
|
5
|
+
columnKey: string;
|
|
6
|
+
currentSort?: DatasourceTableSortState;
|
|
7
|
+
parameters: DatasourceParameters;
|
|
8
|
+
}) => {
|
|
9
|
+
parameters: DatasourceParameters;
|
|
10
|
+
sort?: DatasourceTableSortState;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare const getDatasourceColumnSortGetter: (datasourceId: string) => DatasourceColumnSortGetter | undefined;
|
|
@@ -10,9 +10,9 @@ export declare const DatasourceTableView: ForwardRefExoticComponent<{
|
|
|
10
10
|
datasourceId: string;
|
|
11
11
|
parameters: DatasourceParameters;
|
|
12
12
|
url?: string;
|
|
13
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
13
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
14
14
|
export declare const DataSourceTableViewNoSuspense: ForwardRefExoticComponent<{
|
|
15
15
|
datasourceId: string;
|
|
16
16
|
parameters: DatasourceParameters;
|
|
17
17
|
url?: string;
|
|
18
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
18
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>> & WithContextProps & RefAttributes<any>>;
|
|
@@ -7,4 +7,4 @@ export type DatasourceTableViewProps = {
|
|
|
7
7
|
parameters: DatasourceParameters;
|
|
8
8
|
/** Url for an existing datasource, initially used for displaying to a user unauthorized to query that site */
|
|
9
9
|
url?: string;
|
|
10
|
-
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'columnCustomSizes' | 'scrollableContainerHeight'>>;
|
|
10
|
+
} & Partial<Pick<IssueLikeDataTableViewProps, 'visibleColumnKeys' | 'onVisibleColumnKeysChange' | 'wrappedColumnKeys' | 'onWrappedColumnChange' | 'onColumnResize' | 'onColumnSort' | 'sortState' | 'columnCustomSizes' | 'scrollableContainerHeight'>>;
|
|
@@ -2,5 +2,5 @@ import { type DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/d
|
|
|
2
2
|
import { type Props } from './empty-state';
|
|
3
3
|
import { type IssueLikeDataTableViewProps } from './types';
|
|
4
4
|
export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
5
|
-
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, itemIds, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, wrappedColumnKeys, onWrappedColumnChange, status, hasNextPage, scrollableContainerHeight, extensionKey, }: IssueLikeDataTableViewProps) => JSX.Element;
|
|
5
|
+
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, itemIds, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, onColumnSort, wrappedColumnKeys, onWrappedColumnChange, sortState, status, hasNextPage, scrollableContainerHeight, extensionKey, }: IssueLikeDataTableViewProps) => JSX.Element;
|
|
6
6
|
export declare const EmptyState: ({ isCompact, testId }: Props) => JSX.Element;
|