@atlaskit/link-datasource 5.5.1 → 5.6.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/CHANGELOG.md +7 -0
- package/dist/cjs/ui/datasource-table-view/datasource-column-sort.js +51 -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 +120 -62
- package/dist/cjs/ui/issue-like-table/messages.js +10 -0
- package/dist/es2019/ui/datasource-table-view/datasource-column-sort.js +43 -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 +58 -4
- package/dist/es2019/ui/issue-like-table/messages.js +10 -0
- package/dist/esm/ui/datasource-table-view/datasource-column-sort.js +44 -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 +120 -62
- 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 +6 -3
|
@@ -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';
|
|
@@ -33,9 +39,11 @@ import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExp
|
|
|
33
39
|
import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
34
40
|
import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
|
|
35
41
|
import { ColumnPicker } from './column-picker';
|
|
42
|
+
import { GlyphPlaceholder } from './custom-icons';
|
|
36
43
|
import { DragColumnPreview } from './drag-column-preview';
|
|
37
44
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
38
45
|
import TableEmptyState from './empty-state';
|
|
46
|
+
import { issueLikeTableMessages } from './messages';
|
|
39
47
|
import { renderType } from './render-type';
|
|
40
48
|
import { TableCellContent } from './table-cell-content';
|
|
41
49
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
@@ -127,6 +135,22 @@ var tableStyles = null;
|
|
|
127
135
|
var noDefaultBorderStyles = null;
|
|
128
136
|
var headerStyles = null;
|
|
129
137
|
var headingHoverEffectStyles = null;
|
|
138
|
+
|
|
139
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled -- Matches DraggableTableHeading button normalization.
|
|
140
|
+
var SortableHeaderParent = forwardRef(function (_ref5, __cmplr) {
|
|
141
|
+
var _ref5$as = _ref5.as,
|
|
142
|
+
C = _ref5$as === void 0 ? "div" : _ref5$as,
|
|
143
|
+
__cmpls = _ref5.style,
|
|
144
|
+
__cmplp = _objectWithoutProperties(_ref5, _excluded5);
|
|
145
|
+
return /*#__PURE__*/React.createElement(C, _extends({}, __cmplp, {
|
|
146
|
+
style: __cmpls,
|
|
147
|
+
ref: __cmplr,
|
|
148
|
+
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _1wtnze3t _ficf1e5h _jq8g1wug _11lvze3t _yhjm1b66", __cmplp.className])
|
|
149
|
+
}));
|
|
150
|
+
});
|
|
151
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
152
|
+
SortableHeaderParent.displayName = 'SortableHeaderParent';
|
|
153
|
+
}
|
|
130
154
|
function extractIndex(data) {
|
|
131
155
|
var index = data.index;
|
|
132
156
|
invariant(typeof index === 'number');
|
|
@@ -173,26 +197,30 @@ function getDefaultColumnWidth(key, type) {
|
|
|
173
197
|
return DEFAULT_WIDTH;
|
|
174
198
|
}
|
|
175
199
|
}
|
|
176
|
-
export var IssueLikeDataTableView = function IssueLikeDataTableView(
|
|
200
|
+
export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
177
201
|
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
|
-
|
|
202
|
+
var testId = _ref6.testId,
|
|
203
|
+
onNextPage = _ref6.onNextPage,
|
|
204
|
+
onLoadDatasourceDetails = _ref6.onLoadDatasourceDetails,
|
|
205
|
+
items = _ref6.items,
|
|
206
|
+
itemIds = _ref6.itemIds,
|
|
207
|
+
columns = _ref6.columns,
|
|
208
|
+
_ref6$renderItem = _ref6.renderItem,
|
|
209
|
+
renderItem = _ref6$renderItem === void 0 ? renderType : _ref6$renderItem,
|
|
210
|
+
visibleColumnKeys = _ref6.visibleColumnKeys,
|
|
211
|
+
onVisibleColumnKeysChange = _ref6.onVisibleColumnKeysChange,
|
|
212
|
+
columnCustomSizes = _ref6.columnCustomSizes,
|
|
213
|
+
onColumnResize = _ref6.onColumnResize,
|
|
214
|
+
onColumnSort = _ref6.onColumnSort,
|
|
215
|
+
wrappedColumnKeys = _ref6.wrappedColumnKeys,
|
|
216
|
+
onWrappedColumnChange = _ref6.onWrappedColumnChange,
|
|
217
|
+
sortState = _ref6.sortState,
|
|
218
|
+
status = _ref6.status,
|
|
219
|
+
hasNextPage = _ref6.hasNextPage,
|
|
220
|
+
scrollableContainerHeight = _ref6.scrollableContainerHeight,
|
|
221
|
+
extensionKey = _ref6.extensionKey;
|
|
222
|
+
var _useIntl = useIntl(),
|
|
223
|
+
formatMessage = _useIntl.formatMessage;
|
|
196
224
|
var tableId = useMemo(function () {
|
|
197
225
|
return Symbol('unique-id');
|
|
198
226
|
}, []);
|
|
@@ -229,8 +257,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
229
257
|
}, [experienceId, status]);
|
|
230
258
|
var visibleSortedColumns = useMemo(function () {
|
|
231
259
|
return visibleColumnKeys.map(function (visibleKey) {
|
|
232
|
-
return orderedColumns.find(function (
|
|
233
|
-
var key =
|
|
260
|
+
return orderedColumns.find(function (_ref7) {
|
|
261
|
+
var key = _ref7.key;
|
|
234
262
|
return visibleKey === key;
|
|
235
263
|
});
|
|
236
264
|
}).filter(Boolean);
|
|
@@ -240,9 +268,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
240
268
|
// If data comes first, then columns and then visibleColumnKeys it blows up,
|
|
241
269
|
// or some other combination.
|
|
242
270
|
var columnsWidthsSum = useMemo(function () {
|
|
243
|
-
return visibleSortedColumns.map(function (
|
|
244
|
-
var key =
|
|
245
|
-
type =
|
|
271
|
+
return visibleSortedColumns.map(function (_ref8) {
|
|
272
|
+
var key = _ref8.key,
|
|
273
|
+
type = _ref8.type;
|
|
246
274
|
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
247
275
|
}).reduce(function (sum, width) {
|
|
248
276
|
return width + sum;
|
|
@@ -258,10 +286,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
258
286
|
}
|
|
259
287
|
}, [columnCustomSizes, columnsWidthsSum, shouldUseWidth, tableContainerWidth]);
|
|
260
288
|
var headerColumns = useMemo(function () {
|
|
261
|
-
return visibleSortedColumns.map(function (
|
|
262
|
-
var key =
|
|
263
|
-
title =
|
|
264
|
-
type =
|
|
289
|
+
return visibleSortedColumns.map(function (_ref9, index) {
|
|
290
|
+
var key = _ref9.key,
|
|
291
|
+
title = _ref9.title,
|
|
292
|
+
type = _ref9.type;
|
|
265
293
|
return {
|
|
266
294
|
key: key,
|
|
267
295
|
content: title,
|
|
@@ -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,
|
|
@@ -466,6 +494,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
466
494
|
}, _callee, null, [[2, 4]]);
|
|
467
495
|
})), [experienceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
468
496
|
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
497
|
+
// Sorting is enabled only when the table owns the header interaction (read-only mode).
|
|
498
|
+
// Editable tables reserve header interactions for drag/resize/wrap controls.
|
|
499
|
+
var shouldEnableColumnSort = !!onColumnSort && !onVisibleColumnKeysChange && !onColumnResize && !onWrappedColumnChange;
|
|
469
500
|
var orderedColumnsAreUpToDate = orderedColumns.length === columns.length;
|
|
470
501
|
var shouldDisplayColumnsInPicker = hasFullSchema && orderedColumnsAreUpToDate;
|
|
471
502
|
var view = /*#__PURE__*/React.createElement("div", {
|
|
@@ -495,10 +526,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
495
526
|
className: ax(["_n7zlidpf", "_bfhkchd4 _kqsw1if8 _154iidpf _1pbyzo7u", !!onVisibleColumnKeysChange ? 'has-column-picker' : ''])
|
|
496
527
|
}, /*#__PURE__*/React.createElement("tr", {
|
|
497
528
|
ref: tableHeaderRowRef
|
|
498
|
-
}, headerColumns.map(function (
|
|
499
|
-
var key =
|
|
500
|
-
content =
|
|
501
|
-
width =
|
|
529
|
+
}, headerColumns.map(function (_ref13, cellIndex) {
|
|
530
|
+
var key = _ref13.key,
|
|
531
|
+
content = _ref13.content,
|
|
532
|
+
width = _ref13.width;
|
|
502
533
|
var heading = /*#__PURE__*/React.createElement(Tooltip, {
|
|
503
534
|
content: content,
|
|
504
535
|
tag: "span",
|
|
@@ -509,17 +540,42 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
509
540
|
className: ax(["_11c8wadc _k48p1wq8"])
|
|
510
541
|
}, content));
|
|
511
542
|
var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
|
|
512
|
-
if (
|
|
543
|
+
if (shouldEnableColumnSort) {
|
|
544
|
+
var sortedDirection = (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key ? sortState.direction : undefined;
|
|
545
|
+
// Use directional icon only for the active sort column; keep width stable otherwise.
|
|
546
|
+
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon : GlyphPlaceholder;
|
|
547
|
+
var sortLabel = typeof content === 'string' ? content : key;
|
|
548
|
+
var sortButtonAriaLabel = sortedDirection === 'ASC' ? formatMessage(issueLikeTableMessages.sortByColumnDescendingAction, {
|
|
549
|
+
column: sortLabel
|
|
550
|
+
}) : formatMessage(issueLikeTableMessages.sortByColumnAscendingAction, {
|
|
551
|
+
column: sortLabel
|
|
552
|
+
});
|
|
553
|
+
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, {
|
|
554
|
+
appearance: "subtle",
|
|
555
|
+
spacing: "compact",
|
|
556
|
+
shouldFitContainer: true,
|
|
557
|
+
testId: "".concat(key, "-column-sort-button"),
|
|
558
|
+
"aria-label": sortButtonAriaLabel,
|
|
559
|
+
iconAfter: function iconAfter(iconProps) {
|
|
560
|
+
return /*#__PURE__*/React.createElement(SortIcon, _extends({}, iconProps, {
|
|
561
|
+
size: "small"
|
|
562
|
+
}));
|
|
563
|
+
},
|
|
564
|
+
onClick: function onClick() {
|
|
565
|
+
return onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort(key);
|
|
566
|
+
}
|
|
567
|
+
}, heading));
|
|
568
|
+
} else if (isHeadingOutsideButton) {
|
|
513
569
|
heading = /*#__PURE__*/React.createElement("div", {
|
|
514
570
|
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _8vu418qm _irr3l4ek"])
|
|
515
571
|
}, heading);
|
|
516
572
|
}
|
|
517
573
|
if (isEditable) {
|
|
518
574
|
var _containerRef$current4;
|
|
519
|
-
var previewRows = tableRows.map(function (
|
|
520
|
-
var cells =
|
|
521
|
-
var cell = cells.find(function (
|
|
522
|
-
var cellKey =
|
|
575
|
+
var previewRows = tableRows.map(function (_ref14) {
|
|
576
|
+
var cells = _ref14.cells;
|
|
577
|
+
var cell = cells.find(function (_ref15) {
|
|
578
|
+
var cellKey = _ref15.key;
|
|
523
579
|
return cellKey === key;
|
|
524
580
|
});
|
|
525
581
|
if (cell) {
|
|
@@ -543,16 +599,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
543
599
|
onIsWrappedChange: onWrappedColumnChange === null || onWrappedColumnChange === void 0 ? void 0 : onWrappedColumnChange.bind(null, key)
|
|
544
600
|
}, heading);
|
|
545
601
|
} else {
|
|
546
|
-
return /*#__PURE__*/React.createElement(TableHeading, {
|
|
602
|
+
return /*#__PURE__*/React.createElement(TableHeading, _extends({
|
|
547
603
|
key: key,
|
|
548
604
|
"data-testid": "".concat(key, "-column-heading")
|
|
605
|
+
}, fg('platform_lp_jira_sllv_renderer_column_sorting') ? {
|
|
606
|
+
'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
|
|
607
|
+
} : {}, {
|
|
549
608
|
// 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
609
|
style: getWidthCss({
|
|
552
610
|
shouldUseWidth: shouldUseWidth,
|
|
553
611
|
width: width
|
|
554
612
|
})
|
|
555
|
-
}, heading);
|
|
613
|
+
}), heading);
|
|
556
614
|
}
|
|
557
615
|
}), onVisibleColumnKeysChange && /*#__PURE__*/React.createElement(ColumnPickerHeader, null, /*#__PURE__*/React.createElement(ColumnPicker, {
|
|
558
616
|
columns: shouldDisplayColumnsInPicker ? orderedColumns : [],
|
|
@@ -562,18 +620,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
562
620
|
})))), /*#__PURE__*/React.createElement("tbody", {
|
|
563
621
|
"data-testid": testId && "".concat(testId, "--body"),
|
|
564
622
|
className: ax(["_n7zlidpf"])
|
|
565
|
-
}, rows.map(function (
|
|
566
|
-
var key =
|
|
567
|
-
cells =
|
|
568
|
-
ref =
|
|
623
|
+
}, rows.map(function (_ref16) {
|
|
624
|
+
var key = _ref16.key,
|
|
625
|
+
cells = _ref16.cells,
|
|
626
|
+
ref = _ref16.ref;
|
|
569
627
|
return /*#__PURE__*/React.createElement("tr", {
|
|
570
628
|
key: key,
|
|
571
629
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
572
630
|
ref: ref
|
|
573
|
-
}, cells.map(function (
|
|
574
|
-
var cellKey =
|
|
575
|
-
content =
|
|
576
|
-
width =
|
|
631
|
+
}, cells.map(function (_ref17, cellIndex) {
|
|
632
|
+
var cellKey = _ref17.key,
|
|
633
|
+
content = _ref17.content,
|
|
634
|
+
width = _ref17.width;
|
|
577
635
|
var isLastCell = cellIndex === cells.length - 1;
|
|
578
636
|
var loadingRowStyle = getWidthCss({
|
|
579
637
|
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;
|
|
@@ -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
|
/**
|