@atlaskit/link-datasource 5.6.0 → 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 +8 -0
- package/dist/cjs/ui/datasource-table-view/datasource-column-sort.js +14 -5
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +2 -2
- package/dist/cjs/ui/issue-like-table/index.js +34 -9
- package/dist/es2019/ui/datasource-table-view/datasource-column-sort.js +14 -5
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +2 -2
- package/dist/es2019/ui/issue-like-table/index.js +35 -10
- package/dist/esm/ui/datasource-table-view/datasource-column-sort.js +14 -5
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +2 -2
- package/dist/esm/ui/issue-like-table/index.js +34 -9
- package/dist/types/ui/datasource-table-view/datasource-column-sort.d.ts +1 -1
- package/dist/types-ts4.5/ui/datasource-table-view/datasource-column-sort.d.ts +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 5.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c7fb26d1c5d03`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7fb26d1c5d03) -
|
|
8
|
+
Fixing read-only SLLV sorting problems with default type losing the label visually and introducing
|
|
9
|
+
third state of sorting - going back to default
|
|
10
|
+
|
|
3
11
|
## 5.6.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -10,10 +10,13 @@ var _jiraIssuesModal = require("../jira-issues-modal");
|
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
var getNextSortDirection = function getNextSortDirection(columnKey, currentSort) {
|
|
13
|
-
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key)
|
|
14
|
-
return
|
|
13
|
+
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key) !== columnKey) {
|
|
14
|
+
return 'ASC';
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if (currentSort.direction === 'ASC') {
|
|
17
|
+
return 'DESC';
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
17
20
|
};
|
|
18
21
|
// Match and remove an existing trailing ORDER BY clause before appending the next sort:
|
|
19
22
|
// - (?:^|\\s+) allows ORDER BY at the start of the JQL or after whitespace.
|
|
@@ -27,15 +30,21 @@ var getJiraColumnSortParameters = function getJiraColumnSortParameters(_ref) {
|
|
|
27
30
|
var parameters = _ref.parameters,
|
|
28
31
|
columnKey = _ref.columnKey,
|
|
29
32
|
currentSort = _ref.currentSort;
|
|
33
|
+
var direction = getNextSortDirection(columnKey, currentSort);
|
|
34
|
+
if (!direction) {
|
|
35
|
+
return {
|
|
36
|
+
parameters: parameters,
|
|
37
|
+
sort: undefined
|
|
38
|
+
};
|
|
39
|
+
}
|
|
30
40
|
if (typeof parameters.jql !== 'string') {
|
|
31
41
|
return undefined;
|
|
32
42
|
}
|
|
33
|
-
var direction = getNextSortDirection(columnKey, currentSort);
|
|
34
43
|
var jqlWithoutOrder = parameters.jql.replace(JIRA_ORDER_BY_PATTERN, '').trim();
|
|
35
44
|
var nextOrderByClause = "ORDER BY ".concat(columnKey, " ").concat(direction);
|
|
36
45
|
return {
|
|
37
46
|
parameters: _objectSpread(_objectSpread({}, parameters), {}, {
|
|
38
|
-
jql:
|
|
47
|
+
jql: [jqlWithoutOrder, nextOrderByClause].filter(Boolean).join(' ')
|
|
39
48
|
}),
|
|
40
49
|
sort: {
|
|
41
50
|
key: columnKey,
|
|
@@ -186,7 +186,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
186
186
|
var onColumnSort = (0, _react.useCallback)(function (columnKey) {
|
|
187
187
|
// Build next params/sort atomically so UI state and query state stay in sync.
|
|
188
188
|
var result = columnSortGetter === null || columnSortGetter === void 0 ? void 0 : columnSortGetter({
|
|
189
|
-
parameters:
|
|
189
|
+
parameters: sessionBaseParametersRef.current,
|
|
190
190
|
columnKey: columnKey,
|
|
191
191
|
currentSort: sortState
|
|
192
192
|
});
|
|
@@ -195,7 +195,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
195
195
|
}
|
|
196
196
|
setSortState(result.sort);
|
|
197
197
|
setSessionParameters(result.parameters);
|
|
198
|
-
}, [columnSortGetter,
|
|
198
|
+
}, [columnSortGetter, sortState]);
|
|
199
199
|
var handleErrorRefresh = (0, _react.useCallback)(function () {
|
|
200
200
|
reset({
|
|
201
201
|
shouldForceRequest: true
|
|
@@ -37,7 +37,6 @@ var _ufoExperiences = require("../../analytics/ufoExperiences");
|
|
|
37
37
|
var _datasourceExperienceId = require("../../contexts/datasource-experience-id");
|
|
38
38
|
var _useIsInPDFRender = require("../../hooks/useIsInPDFRender");
|
|
39
39
|
var _columnPicker = require("./column-picker");
|
|
40
|
-
var _customIcons = require("./custom-icons");
|
|
41
40
|
var _dragColumnPreview = require("./drag-column-preview");
|
|
42
41
|
var _draggableTableHeading = require("./draggable-table-heading");
|
|
43
42
|
var _emptyState = _interopRequireDefault(require("./empty-state"));
|
|
@@ -318,7 +317,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
318
317
|
height: 14,
|
|
319
318
|
testId: "issues-table-row-loading"
|
|
320
319
|
})),
|
|
321
|
-
key: column.key
|
|
320
|
+
key: column.key,
|
|
321
|
+
width: column.width
|
|
322
322
|
};
|
|
323
323
|
})
|
|
324
324
|
};
|
|
@@ -442,10 +442,25 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
444
|
}, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth]);
|
|
445
|
+
var previousRealRowsCountRef = (0, _react.useRef)(undefined);
|
|
446
|
+
(0, _react.useEffect)(function () {
|
|
447
|
+
if (tableRows.length > 0) {
|
|
448
|
+
previousRealRowsCountRef.current = tableRows.length;
|
|
449
|
+
}
|
|
450
|
+
}, [tableRows.length]);
|
|
445
451
|
var rows = (0, _react.useMemo)(function () {
|
|
446
|
-
if (
|
|
447
|
-
|
|
452
|
+
if ((0, _platformFeatureFlags.fg)('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
453
|
+
var hasPreviousRealRows = !!previousRealRowsCountRef.current;
|
|
454
|
+
var isLoadingState = status === 'loading' || status === 'empty' && hasPreviousRealRows;
|
|
455
|
+
if (!isLoadingState) {
|
|
456
|
+
return tableRows;
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
if (status !== 'loading') {
|
|
460
|
+
return tableRows;
|
|
461
|
+
}
|
|
448
462
|
}
|
|
463
|
+
|
|
449
464
|
// if there are table rows, only add 1 loading row
|
|
450
465
|
if (tableRows.length > 0) {
|
|
451
466
|
return [].concat((0, _toConsumableArray2.default)(tableRows), [_objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
@@ -455,6 +470,14 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
455
470
|
// if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
|
|
456
471
|
// add 10 rows if it is modal (no scrollableContainerHeight)
|
|
457
472
|
var loadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
473
|
+
if ((0, _platformFeatureFlags.fg)('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
474
|
+
var defaultLoadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
475
|
+
var previousRealRowsCount = previousRealRowsCountRef.current;
|
|
476
|
+
loadingRowsCount = defaultLoadingRowsCount;
|
|
477
|
+
if (previousRealRowsCount && previousRealRowsCount < defaultLoadingRowsCount) {
|
|
478
|
+
loadingRowsCount = previousRealRowsCount;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
458
481
|
return (0, _toConsumableArray2.default)(Array(loadingRowsCount)).map(function (_, index) {
|
|
459
482
|
return _objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
460
483
|
key: "loading-".concat(index)
|
|
@@ -550,28 +573,30 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
550
573
|
if (shouldEnableColumnSort) {
|
|
551
574
|
var sortedDirection = (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key ? sortState.direction : undefined;
|
|
552
575
|
// Use directional icon only for the active sort column; keep width stable otherwise.
|
|
553
|
-
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? _sortAscending.default : _sortDescending.default :
|
|
576
|
+
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? _sortAscending.default : _sortDescending.default : null;
|
|
554
577
|
var sortLabel = typeof content === 'string' ? content : key;
|
|
555
578
|
var sortButtonAriaLabel = sortedDirection === 'ASC' ? formatMessage(_messages.issueLikeTableMessages.sortByColumnDescendingAction, {
|
|
556
579
|
column: sortLabel
|
|
557
580
|
}) : formatMessage(_messages.issueLikeTableMessages.sortByColumnAscendingAction, {
|
|
558
581
|
column: sortLabel
|
|
559
582
|
});
|
|
560
|
-
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(_new.default, {
|
|
583
|
+
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(_new.default, (0, _extends2.default)({
|
|
561
584
|
appearance: "subtle",
|
|
562
585
|
spacing: "compact",
|
|
563
586
|
shouldFitContainer: true,
|
|
564
587
|
testId: "".concat(key, "-column-sort-button"),
|
|
565
|
-
"aria-label": sortButtonAriaLabel
|
|
588
|
+
"aria-label": sortButtonAriaLabel
|
|
589
|
+
}, SortIcon ? {
|
|
566
590
|
iconAfter: function iconAfter(iconProps) {
|
|
567
591
|
return /*#__PURE__*/React.createElement(SortIcon, (0, _extends2.default)({}, iconProps, {
|
|
568
592
|
size: "small"
|
|
569
593
|
}));
|
|
570
|
-
}
|
|
594
|
+
}
|
|
595
|
+
} : {}, {
|
|
571
596
|
onClick: function onClick() {
|
|
572
597
|
return onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort(key);
|
|
573
598
|
}
|
|
574
|
-
}, heading));
|
|
599
|
+
}), heading));
|
|
575
600
|
} else if (isHeadingOutsideButton) {
|
|
576
601
|
heading = /*#__PURE__*/React.createElement("div", {
|
|
577
602
|
className: (0, _runtime.ax)(["_1e0c1txw _4cvr1h6o _o5721q9c _8vu418qm _irr3l4ek"])
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '../jira-issues-modal';
|
|
2
2
|
const getNextSortDirection = (columnKey, currentSort) => {
|
|
3
|
-
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key)
|
|
4
|
-
return
|
|
3
|
+
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key) !== columnKey) {
|
|
4
|
+
return 'ASC';
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
if (currentSort.direction === 'ASC') {
|
|
7
|
+
return 'DESC';
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
7
10
|
};
|
|
8
11
|
// Match and remove an existing trailing ORDER BY clause before appending the next sort:
|
|
9
12
|
// - (?:^|\\s+) allows ORDER BY at the start of the JQL or after whitespace.
|
|
@@ -18,16 +21,22 @@ const getJiraColumnSortParameters = ({
|
|
|
18
21
|
columnKey,
|
|
19
22
|
currentSort
|
|
20
23
|
}) => {
|
|
24
|
+
const direction = getNextSortDirection(columnKey, currentSort);
|
|
25
|
+
if (!direction) {
|
|
26
|
+
return {
|
|
27
|
+
parameters,
|
|
28
|
+
sort: undefined
|
|
29
|
+
};
|
|
30
|
+
}
|
|
21
31
|
if (typeof parameters.jql !== 'string') {
|
|
22
32
|
return undefined;
|
|
23
33
|
}
|
|
24
|
-
const direction = getNextSortDirection(columnKey, currentSort);
|
|
25
34
|
const jqlWithoutOrder = parameters.jql.replace(JIRA_ORDER_BY_PATTERN, '').trim();
|
|
26
35
|
const nextOrderByClause = `ORDER BY ${columnKey} ${direction}`;
|
|
27
36
|
return {
|
|
28
37
|
parameters: {
|
|
29
38
|
...parameters,
|
|
30
|
-
jql:
|
|
39
|
+
jql: [jqlWithoutOrder, nextOrderByClause].filter(Boolean).join(' ')
|
|
31
40
|
},
|
|
32
41
|
sort: {
|
|
33
42
|
key: columnKey,
|
|
@@ -167,7 +167,7 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
167
167
|
const onColumnSort = useCallback(columnKey => {
|
|
168
168
|
// Build next params/sort atomically so UI state and query state stay in sync.
|
|
169
169
|
const result = columnSortGetter === null || columnSortGetter === void 0 ? void 0 : columnSortGetter({
|
|
170
|
-
parameters:
|
|
170
|
+
parameters: sessionBaseParametersRef.current,
|
|
171
171
|
columnKey,
|
|
172
172
|
currentSort: sortState
|
|
173
173
|
});
|
|
@@ -176,7 +176,7 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
176
176
|
}
|
|
177
177
|
setSortState(result.sort);
|
|
178
178
|
setSessionParameters(result.parameters);
|
|
179
|
-
}, [columnSortGetter,
|
|
179
|
+
}, [columnSortGetter, sortState]);
|
|
180
180
|
const handleErrorRefresh = useCallback(() => {
|
|
181
181
|
reset({
|
|
182
182
|
shouldForceRequest: true
|
|
@@ -26,7 +26,6 @@ import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExp
|
|
|
26
26
|
import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
27
27
|
import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
|
|
28
28
|
import { ColumnPicker } from './column-picker';
|
|
29
|
-
import { GlyphPlaceholder } from './custom-icons';
|
|
30
29
|
import { DragColumnPreview } from './drag-column-preview';
|
|
31
30
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
32
31
|
import TableEmptyState from './empty-state';
|
|
@@ -269,7 +268,8 @@ export const IssueLikeDataTableView = ({
|
|
|
269
268
|
height: 14,
|
|
270
269
|
testId: "issues-table-row-loading"
|
|
271
270
|
})),
|
|
272
|
-
key: column.key
|
|
271
|
+
key: column.key,
|
|
272
|
+
width: column.width
|
|
273
273
|
}))
|
|
274
274
|
}), [headerColumns]);
|
|
275
275
|
useEffect(() => {
|
|
@@ -391,10 +391,25 @@ export const IssueLikeDataTableView = ({
|
|
|
391
391
|
ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
|
|
392
392
|
};
|
|
393
393
|
}), [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth]);
|
|
394
|
+
const previousRealRowsCountRef = useRef(undefined);
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
if (tableRows.length > 0) {
|
|
397
|
+
previousRealRowsCountRef.current = tableRows.length;
|
|
398
|
+
}
|
|
399
|
+
}, [tableRows.length]);
|
|
394
400
|
const rows = useMemo(() => {
|
|
395
|
-
if (
|
|
396
|
-
|
|
401
|
+
if (fg('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
402
|
+
const hasPreviousRealRows = !!previousRealRowsCountRef.current;
|
|
403
|
+
const isLoadingState = status === 'loading' || status === 'empty' && hasPreviousRealRows;
|
|
404
|
+
if (!isLoadingState) {
|
|
405
|
+
return tableRows;
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
if (status !== 'loading') {
|
|
409
|
+
return tableRows;
|
|
410
|
+
}
|
|
397
411
|
}
|
|
412
|
+
|
|
398
413
|
// if there are table rows, only add 1 loading row
|
|
399
414
|
if (tableRows.length > 0) {
|
|
400
415
|
return [...tableRows, {
|
|
@@ -404,7 +419,15 @@ export const IssueLikeDataTableView = ({
|
|
|
404
419
|
}
|
|
405
420
|
// if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
|
|
406
421
|
// add 10 rows if it is modal (no scrollableContainerHeight)
|
|
407
|
-
|
|
422
|
+
let loadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
423
|
+
if (fg('platform_lp_jira_sllv_renderer_column_sorting')) {
|
|
424
|
+
const defaultLoadingRowsCount = scrollableContainerHeight ? 14 : 10;
|
|
425
|
+
const previousRealRowsCount = previousRealRowsCountRef.current;
|
|
426
|
+
loadingRowsCount = defaultLoadingRowsCount;
|
|
427
|
+
if (previousRealRowsCount && previousRealRowsCount < defaultLoadingRowsCount) {
|
|
428
|
+
loadingRowsCount = previousRealRowsCount;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
408
431
|
return [...Array(loadingRowsCount)].map((_, index) => ({
|
|
409
432
|
...loadingRow,
|
|
410
433
|
key: `loading-${index}`
|
|
@@ -483,24 +506,26 @@ export const IssueLikeDataTableView = ({
|
|
|
483
506
|
if (shouldEnableColumnSort) {
|
|
484
507
|
const sortedDirection = (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key ? sortState.direction : undefined;
|
|
485
508
|
// Use directional icon only for the active sort column; keep width stable otherwise.
|
|
486
|
-
const SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon :
|
|
509
|
+
const SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon : null;
|
|
487
510
|
const sortLabel = typeof content === 'string' ? content : key;
|
|
488
511
|
const sortButtonAriaLabel = sortedDirection === 'ASC' ? formatMessage(issueLikeTableMessages.sortByColumnDescendingAction, {
|
|
489
512
|
column: sortLabel
|
|
490
513
|
}) : formatMessage(issueLikeTableMessages.sortByColumnAscendingAction, {
|
|
491
514
|
column: sortLabel
|
|
492
515
|
});
|
|
493
|
-
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, {
|
|
516
|
+
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
494
517
|
appearance: "subtle",
|
|
495
518
|
spacing: "compact",
|
|
496
519
|
shouldFitContainer: true,
|
|
497
520
|
testId: `${key}-column-sort-button`,
|
|
498
|
-
"aria-label": sortButtonAriaLabel
|
|
521
|
+
"aria-label": sortButtonAriaLabel
|
|
522
|
+
}, SortIcon ? {
|
|
499
523
|
iconAfter: iconProps => /*#__PURE__*/React.createElement(SortIcon, _extends({}, iconProps, {
|
|
500
524
|
size: "small"
|
|
501
|
-
}))
|
|
525
|
+
}))
|
|
526
|
+
} : {}, {
|
|
502
527
|
onClick: () => onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort(key)
|
|
503
|
-
}, heading));
|
|
528
|
+
}), heading));
|
|
504
529
|
} else if (isHeadingOutsideButton) {
|
|
505
530
|
heading = /*#__PURE__*/React.createElement("div", {
|
|
506
531
|
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _8vu418qm _irr3l4ek"])
|
|
@@ -3,10 +3,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '../jira-issues-modal';
|
|
5
5
|
var getNextSortDirection = function getNextSortDirection(columnKey, currentSort) {
|
|
6
|
-
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key)
|
|
7
|
-
return
|
|
6
|
+
if ((currentSort === null || currentSort === void 0 ? void 0 : currentSort.key) !== columnKey) {
|
|
7
|
+
return 'ASC';
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
if (currentSort.direction === 'ASC') {
|
|
10
|
+
return 'DESC';
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
10
13
|
};
|
|
11
14
|
// Match and remove an existing trailing ORDER BY clause before appending the next sort:
|
|
12
15
|
// - (?:^|\\s+) allows ORDER BY at the start of the JQL or after whitespace.
|
|
@@ -20,15 +23,21 @@ var getJiraColumnSortParameters = function getJiraColumnSortParameters(_ref) {
|
|
|
20
23
|
var parameters = _ref.parameters,
|
|
21
24
|
columnKey = _ref.columnKey,
|
|
22
25
|
currentSort = _ref.currentSort;
|
|
26
|
+
var direction = getNextSortDirection(columnKey, currentSort);
|
|
27
|
+
if (!direction) {
|
|
28
|
+
return {
|
|
29
|
+
parameters: parameters,
|
|
30
|
+
sort: undefined
|
|
31
|
+
};
|
|
32
|
+
}
|
|
23
33
|
if (typeof parameters.jql !== 'string') {
|
|
24
34
|
return undefined;
|
|
25
35
|
}
|
|
26
|
-
var direction = getNextSortDirection(columnKey, currentSort);
|
|
27
36
|
var jqlWithoutOrder = parameters.jql.replace(JIRA_ORDER_BY_PATTERN, '').trim();
|
|
28
37
|
var nextOrderByClause = "ORDER BY ".concat(columnKey, " ").concat(direction);
|
|
29
38
|
return {
|
|
30
39
|
parameters: _objectSpread(_objectSpread({}, parameters), {}, {
|
|
31
|
-
jql:
|
|
40
|
+
jql: [jqlWithoutOrder, nextOrderByClause].filter(Boolean).join(' ')
|
|
32
41
|
}),
|
|
33
42
|
sort: {
|
|
34
43
|
key: columnKey,
|
|
@@ -177,7 +177,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
177
177
|
var onColumnSort = useCallback(function (columnKey) {
|
|
178
178
|
// Build next params/sort atomically so UI state and query state stay in sync.
|
|
179
179
|
var result = columnSortGetter === null || columnSortGetter === void 0 ? void 0 : columnSortGetter({
|
|
180
|
-
parameters:
|
|
180
|
+
parameters: sessionBaseParametersRef.current,
|
|
181
181
|
columnKey: columnKey,
|
|
182
182
|
currentSort: sortState
|
|
183
183
|
});
|
|
@@ -186,7 +186,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
186
186
|
}
|
|
187
187
|
setSortState(result.sort);
|
|
188
188
|
setSessionParameters(result.parameters);
|
|
189
|
-
}, [columnSortGetter,
|
|
189
|
+
}, [columnSortGetter, sortState]);
|
|
190
190
|
var handleErrorRefresh = useCallback(function () {
|
|
191
191
|
reset({
|
|
192
192
|
shouldForceRequest: true
|
|
@@ -39,7 +39,6 @@ import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExp
|
|
|
39
39
|
import { useDatasourceExperienceId } from '../../contexts/datasource-experience-id';
|
|
40
40
|
import { useIsInPDFRender } from '../../hooks/useIsInPDFRender';
|
|
41
41
|
import { ColumnPicker } from './column-picker';
|
|
42
|
-
import { GlyphPlaceholder } from './custom-icons';
|
|
43
42
|
import { DragColumnPreview } from './drag-column-preview';
|
|
44
43
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
45
44
|
import TableEmptyState from './empty-state';
|
|
@@ -311,7 +310,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
|
311
310
|
height: 14,
|
|
312
311
|
testId: "issues-table-row-loading"
|
|
313
312
|
})),
|
|
314
|
-
key: column.key
|
|
313
|
+
key: column.key,
|
|
314
|
+
width: column.width
|
|
315
315
|
};
|
|
316
316
|
})
|
|
317
317
|
};
|
|
@@ -435,10 +435,25 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
|
435
435
|
};
|
|
436
436
|
});
|
|
437
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]);
|
|
438
444
|
var rows = useMemo(function () {
|
|
439
|
-
if (
|
|
440
|
-
|
|
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
|
+
}
|
|
441
455
|
}
|
|
456
|
+
|
|
442
457
|
// if there are table rows, only add 1 loading row
|
|
443
458
|
if (tableRows.length > 0) {
|
|
444
459
|
return [].concat(_toConsumableArray(tableRows), [_objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
@@ -448,6 +463,14 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
|
448
463
|
// if there are no table rows add 14 rows if it is compact (has scrollableContainerHeight or non-modal)
|
|
449
464
|
// add 10 rows if it is modal (no scrollableContainerHeight)
|
|
450
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
|
+
}
|
|
451
474
|
return _toConsumableArray(Array(loadingRowsCount)).map(function (_, index) {
|
|
452
475
|
return _objectSpread(_objectSpread({}, loadingRow), {}, {
|
|
453
476
|
key: "loading-".concat(index)
|
|
@@ -543,28 +566,30 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref6) {
|
|
|
543
566
|
if (shouldEnableColumnSort) {
|
|
544
567
|
var sortedDirection = (sortState === null || sortState === void 0 ? void 0 : sortState.key) === key ? sortState.direction : undefined;
|
|
545
568
|
// Use directional icon only for the active sort column; keep width stable otherwise.
|
|
546
|
-
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon :
|
|
569
|
+
var SortIcon = sortedDirection ? sortedDirection === 'ASC' ? SortAscendingIcon : SortDescendingIcon : null;
|
|
547
570
|
var sortLabel = typeof content === 'string' ? content : key;
|
|
548
571
|
var sortButtonAriaLabel = sortedDirection === 'ASC' ? formatMessage(issueLikeTableMessages.sortByColumnDescendingAction, {
|
|
549
572
|
column: sortLabel
|
|
550
573
|
}) : formatMessage(issueLikeTableMessages.sortByColumnAscendingAction, {
|
|
551
574
|
column: sortLabel
|
|
552
575
|
});
|
|
553
|
-
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, {
|
|
576
|
+
heading = /*#__PURE__*/React.createElement(SortableHeaderParent, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
554
577
|
appearance: "subtle",
|
|
555
578
|
spacing: "compact",
|
|
556
579
|
shouldFitContainer: true,
|
|
557
580
|
testId: "".concat(key, "-column-sort-button"),
|
|
558
|
-
"aria-label": sortButtonAriaLabel
|
|
581
|
+
"aria-label": sortButtonAriaLabel
|
|
582
|
+
}, SortIcon ? {
|
|
559
583
|
iconAfter: function iconAfter(iconProps) {
|
|
560
584
|
return /*#__PURE__*/React.createElement(SortIcon, _extends({}, iconProps, {
|
|
561
585
|
size: "small"
|
|
562
586
|
}));
|
|
563
|
-
}
|
|
587
|
+
}
|
|
588
|
+
} : {}, {
|
|
564
589
|
onClick: function onClick() {
|
|
565
590
|
return onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort(key);
|
|
566
591
|
}
|
|
567
|
-
}, heading));
|
|
592
|
+
}), heading));
|
|
568
593
|
} else if (isHeadingOutsideButton) {
|
|
569
594
|
heading = /*#__PURE__*/React.createElement("div", {
|
|
570
595
|
className: ax(["_1e0c1txw _4cvr1h6o _o5721q9c _8vu418qm _irr3l4ek"])
|
|
@@ -7,6 +7,6 @@ export type DatasourceColumnSortGetter = ({ parameters, columnKey, currentSort,
|
|
|
7
7
|
parameters: DatasourceParameters;
|
|
8
8
|
}) => {
|
|
9
9
|
parameters: DatasourceParameters;
|
|
10
|
-
sort
|
|
10
|
+
sort?: DatasourceTableSortState;
|
|
11
11
|
} | undefined;
|
|
12
12
|
export declare const getDatasourceColumnSortGetter: (datasourceId: string) => DatasourceColumnSortGetter | undefined;
|
|
@@ -7,6 +7,6 @@ export type DatasourceColumnSortGetter = ({ parameters, columnKey, currentSort,
|
|
|
7
7
|
parameters: DatasourceParameters;
|
|
8
8
|
}) => {
|
|
9
9
|
parameters: DatasourceParameters;
|
|
10
|
-
sort
|
|
10
|
+
sort?: DatasourceTableSortState;
|
|
11
11
|
} | undefined;
|
|
12
12
|
export declare const getDatasourceColumnSortGetter: (datasourceId: string) => DatasourceColumnSortGetter | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"ak-postbuild": "ls -d dist/* | xargs -n 1 copyfiles -u 1 -V src/**/*.{svg,png}"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@atlaskit/adf-schema": "^52.
|
|
46
|
+
"@atlaskit/adf-schema": "^52.16.0",
|
|
47
47
|
"@atlaskit/afm-i18n-platform-linking-platform-link-datasource": "2.7.0",
|
|
48
|
-
"@atlaskit/analytics-next": "^11.
|
|
48
|
+
"@atlaskit/analytics-next": "^11.3.0",
|
|
49
49
|
"@atlaskit/atlassian-context": "^0.9.0",
|
|
50
50
|
"@atlaskit/avatar": "^25.15.0",
|
|
51
51
|
"@atlaskit/avatar-group": "^12.10.0",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"@atlaskit/flag": "^17.12.0",
|
|
61
61
|
"@atlaskit/form": "^15.5.0",
|
|
62
62
|
"@atlaskit/heading": "^5.4.0",
|
|
63
|
-
"@atlaskit/icon": "^35.
|
|
63
|
+
"@atlaskit/icon": "^35.4.0",
|
|
64
64
|
"@atlaskit/image": "^3.0.0",
|
|
65
65
|
"@atlaskit/inline-edit": "^15.6.0",
|
|
66
66
|
"@atlaskit/intl-messages-provider": "^3.3.0",
|
|
67
67
|
"@atlaskit/jql-ast": "^3.5.0",
|
|
68
68
|
"@atlaskit/jql-editor": "^6.4.0",
|
|
69
69
|
"@atlaskit/jql-editor-autocomplete-rest": "^3.3.0",
|
|
70
|
-
"@atlaskit/layering": "^3.
|
|
70
|
+
"@atlaskit/layering": "^3.8.0",
|
|
71
71
|
"@atlaskit/link": "^3.4.0",
|
|
72
72
|
"@atlaskit/link-client-extension": "^6.1.0",
|
|
73
|
-
"@atlaskit/link-provider": "^4.
|
|
74
|
-
"@atlaskit/linking-common": "^9.
|
|
73
|
+
"@atlaskit/link-provider": "^4.5.0",
|
|
74
|
+
"@atlaskit/linking-common": "^9.13.0",
|
|
75
75
|
"@atlaskit/linking-types": "^14.4.0",
|
|
76
76
|
"@atlaskit/logo": "^20.1.0",
|
|
77
77
|
"@atlaskit/lozenge": "^13.8.0",
|
|
@@ -81,20 +81,20 @@
|
|
|
81
81
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
82
82
|
"@atlaskit/popup": "^4.23.0",
|
|
83
83
|
"@atlaskit/pragmatic-drag-and-drop": "^1.8.0",
|
|
84
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.
|
|
84
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.2.0",
|
|
85
85
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^2.0.0",
|
|
86
86
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
87
87
|
"@atlaskit/primitives": "^19.0.0",
|
|
88
88
|
"@atlaskit/react-select": "^3.16.0",
|
|
89
89
|
"@atlaskit/select": "^21.12.0",
|
|
90
|
-
"@atlaskit/smart-card": "^44.
|
|
90
|
+
"@atlaskit/smart-card": "^44.21.0",
|
|
91
91
|
"@atlaskit/smart-user-picker": "^10.2.0",
|
|
92
92
|
"@atlaskit/spinner": "^19.1.0",
|
|
93
93
|
"@atlaskit/tag": "^14.15.0",
|
|
94
94
|
"@atlaskit/textfield": "^8.3.0",
|
|
95
95
|
"@atlaskit/theme": "^25.0.0",
|
|
96
96
|
"@atlaskit/tokens": "^13.1.0",
|
|
97
|
-
"@atlaskit/tooltip": "^22.
|
|
97
|
+
"@atlaskit/tooltip": "^22.6.0",
|
|
98
98
|
"@atlaskit/ufo": "^0.5.0",
|
|
99
99
|
"@atlaskit/width-detector": "^5.1.0",
|
|
100
100
|
"@atlassian/assets-workspace-host": "^0.5.0",
|