@atlaskit/link-datasource 1.19.40 → 1.19.42
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 +13 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +2 -1
- package/dist/cjs/ui/assets-modal/modal/messages.js +5 -0
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +9 -12
- package/dist/cjs/ui/issue-like-table/index.js +30 -44
- package/dist/cjs/ui/issue-like-table/styled.js +15 -2
- package/dist/cjs/ui/issue-like-table/utils.js +26 -0
- package/dist/cjs/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +68 -0
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +19 -39
- package/dist/cjs/ui/jira-issues-modal/modal/messages.js +19 -9
- package/dist/es2019/ui/assets-modal/modal/index.js +2 -1
- package/dist/es2019/ui/assets-modal/modal/messages.js +5 -0
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +8 -11
- package/dist/es2019/ui/issue-like-table/index.js +72 -56
- package/dist/es2019/ui/issue-like-table/styled.js +41 -11
- package/dist/es2019/ui/issue-like-table/utils.js +19 -0
- package/dist/es2019/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +55 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +20 -41
- package/dist/es2019/ui/jira-issues-modal/modal/messages.js +19 -9
- package/dist/esm/ui/assets-modal/modal/index.js +2 -1
- package/dist/esm/ui/assets-modal/modal/messages.js +5 -0
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +9 -12
- package/dist/esm/ui/issue-like-table/index.js +30 -44
- package/dist/esm/ui/issue-like-table/styled.js +14 -1
- package/dist/esm/ui/issue-like-table/utils.js +20 -0
- package/dist/esm/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +57 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +20 -40
- package/dist/esm/ui/jira-issues-modal/modal/messages.js +19 -9
- package/dist/types/ui/assets-modal/modal/messages.d.ts +5 -0
- package/dist/types/ui/issue-like-table/index.d.ts +0 -1
- package/dist/types/ui/issue-like-table/styled.d.ts +9 -0
- package/dist/types/ui/issue-like-table/utils.d.ts +17 -0
- package/dist/types/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
- package/dist/types/ui/jira-issues-modal/modal/messages.d.ts +12 -2
- package/dist/types-ts4.5/ui/assets-modal/modal/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +9 -0
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +17 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/messages.d.ts +12 -2
- package/package.json +5 -4
|
@@ -12,7 +12,7 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
12
12
|
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
13
13
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
14
14
|
import { TableHeading } from './styled';
|
|
15
|
-
import { COLUMN_MIN_WIDTH } from './
|
|
15
|
+
import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
|
|
16
16
|
const verticallyAlignedStyles = css({
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
@@ -236,9 +236,6 @@ export const DraggableTableHeading = ({
|
|
|
236
236
|
|
|
237
237
|
// Set the width of our header being resized
|
|
238
238
|
let proposedWidth = initialWidth + relativeDistanceX;
|
|
239
|
-
if (initialWidth >= COLUMN_MIN_WIDTH && proposedWidth < COLUMN_MIN_WIDTH) {
|
|
240
|
-
proposedWidth = COLUMN_MIN_WIDTH;
|
|
241
|
-
}
|
|
242
239
|
|
|
243
240
|
// We update width css directly live
|
|
244
241
|
mainHeaderCell.style.setProperty('width', `${proposedWidth}px`);
|
|
@@ -247,23 +244,23 @@ export const DraggableTableHeading = ({
|
|
|
247
244
|
cancelUnhandled.stop();
|
|
248
245
|
setState(idleState);
|
|
249
246
|
if (onWidthChange) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
let cssWidth = +mainHeaderCell.style.getPropertyValue('width').slice(0, -2);
|
|
248
|
+
if (cssWidth < COLUMN_MIN_WIDTH) {
|
|
249
|
+
cssWidth = COLUMN_MIN_WIDTH;
|
|
250
|
+
}
|
|
251
|
+
onWidthChange(cssWidth);
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
254
|
});
|
|
256
255
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
257
256
|
return jsx(TableHeading, {
|
|
258
257
|
ref: mainHeaderCellRef,
|
|
259
|
-
className: "has-column-picker",
|
|
260
258
|
"data-testid": `${id}-column-heading`,
|
|
261
259
|
style: {
|
|
262
260
|
cursor: 'grab',
|
|
263
|
-
...(
|
|
261
|
+
...getWidthCss({
|
|
262
|
+
shouldUseWidth: !!onWidthChange,
|
|
264
263
|
width
|
|
265
|
-
} : {
|
|
266
|
-
maxWidth: width
|
|
267
264
|
})
|
|
268
265
|
}
|
|
269
266
|
}, onWidthChange ? jsx("div", {
|
|
@@ -12,6 +12,7 @@ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/r
|
|
|
12
12
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
13
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
14
14
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
15
|
+
import { Flex } from '@atlaskit/primitives';
|
|
15
16
|
import { N40 } from '@atlaskit/theme/colors';
|
|
16
17
|
import Tooltip from '@atlaskit/tooltip';
|
|
17
18
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
@@ -21,8 +22,9 @@ import { DragColumnPreview } from './drag-column-preview';
|
|
|
21
22
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
22
23
|
import TableEmptyState from './empty-state';
|
|
23
24
|
import { fallbackRenderType, stringifyType } from './render-type';
|
|
24
|
-
import { Table, TableHeading } from './styled';
|
|
25
|
+
import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
|
|
25
26
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
27
|
+
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
26
28
|
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
27
29
|
const tableHeadStyles = css({
|
|
28
30
|
background: "var(--ds-elevation-surface-current, #FFF)",
|
|
@@ -36,40 +38,57 @@ const truncateTextStyles = css({
|
|
|
36
38
|
whiteSpace: 'nowrap'
|
|
37
39
|
});
|
|
38
40
|
const ColumnPickerHeader = styled.th`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
right: calc(-1 * ${tableSidePadding});
|
|
43
|
-
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
44
|
-
border-bottom: 2px solid ${`var(--ds-border, ${N40})`}; /* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
41
|
+
${withTablePluginHeaderPrefix()} {
|
|
42
|
+
box-sizing: content-box;
|
|
43
|
+
border: 0;
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
width: 56px;
|
|
46
|
+
z-index: 10;
|
|
47
|
+
position: sticky;
|
|
48
|
+
right: calc(-1 * ${tableSidePadding});
|
|
49
|
+
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
50
|
+
border-bottom: 2px solid ${`var(--ds-border, ${N40})`}; /* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
padding-right: ${"var(--ds-space-100, 4px)"};
|
|
53
|
+
|
|
54
|
+
background: linear-gradient(
|
|
55
|
+
90deg,
|
|
56
|
+
rgba(255, 255, 255, 0) 0%,
|
|
57
|
+
${"var(--ds-elevation-surface-current, #FFF)"} 10%
|
|
58
|
+
);
|
|
59
|
+
vertical-align: middle; /* Keeps dropdown button in the middle */
|
|
60
|
+
text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
${withTablePluginHeaderPrefix('&:last-of-type')} {
|
|
55
64
|
padding-right: ${tableSidePadding};
|
|
56
65
|
}
|
|
57
|
-
text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */
|
|
58
66
|
`;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const TableCell = styled.td`
|
|
68
|
+
${withTablePluginBodyPrefix()} {
|
|
69
|
+
/* First section here is to override things editor table plugin css defines */
|
|
70
|
+
padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"};
|
|
71
|
+
border: 0;
|
|
72
|
+
min-width: auto;
|
|
73
|
+
vertical-align: inherit;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
border-right: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
80
|
+
border-bottom: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
71
81
|
}
|
|
72
|
-
|
|
82
|
+
|
|
83
|
+
${withTablePluginBodyPrefix('&:first-child')} {
|
|
84
|
+
padding-left: ${"var(--ds-space-100, 8px)"};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
${withTablePluginBodyPrefix('&:last-child')} {
|
|
88
|
+
border-right: 0;
|
|
89
|
+
padding-right: ${"var(--ds-space-100, 8px)"};
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
73
92
|
const tableContainerStyles = css({
|
|
74
93
|
borderRadius: 'inherit',
|
|
75
94
|
borderBottomLeftRadius: 0,
|
|
@@ -233,16 +252,14 @@ export const getOrderedColumns = (columns, visibleColumnKeys) => {
|
|
|
233
252
|
const alphabeticallySortedInvisibleColumns = columns.filter(column => !visibleColumnKeys.includes(column.key)).sort(sortColumns);
|
|
234
253
|
return [...visibleColumns, ...alphabeticallySortedInvisibleColumns];
|
|
235
254
|
};
|
|
236
|
-
const
|
|
237
|
-
const DEFAULT_WIDTH = BASE_WIDTH * 22;
|
|
238
|
-
export const COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
|
|
255
|
+
const DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
|
|
239
256
|
const keyBasedWidthMap = {
|
|
240
|
-
priority:
|
|
241
|
-
status:
|
|
242
|
-
summary:
|
|
243
|
-
description:
|
|
244
|
-
type:
|
|
245
|
-
key:
|
|
257
|
+
priority: COLUMN_BASE_WIDTH * 5,
|
|
258
|
+
status: COLUMN_BASE_WIDTH * 18,
|
|
259
|
+
summary: COLUMN_BASE_WIDTH * 45,
|
|
260
|
+
description: COLUMN_BASE_WIDTH * 31,
|
|
261
|
+
type: COLUMN_BASE_WIDTH * 6,
|
|
262
|
+
key: COLUMN_BASE_WIDTH * 15
|
|
246
263
|
};
|
|
247
264
|
function getDefaultColumnWidth(key, type) {
|
|
248
265
|
const keyBasedWidth = keyBasedWidthMap[key];
|
|
@@ -251,9 +268,9 @@ function getDefaultColumnWidth(key, type) {
|
|
|
251
268
|
}
|
|
252
269
|
switch (type) {
|
|
253
270
|
case 'date':
|
|
254
|
-
return
|
|
271
|
+
return COLUMN_BASE_WIDTH * 16;
|
|
255
272
|
case 'icon':
|
|
256
|
-
return
|
|
273
|
+
return COLUMN_BASE_WIDTH * 7;
|
|
257
274
|
default:
|
|
258
275
|
return DEFAULT_WIDTH;
|
|
259
276
|
}
|
|
@@ -490,7 +507,8 @@ export const IssueLikeDataTableView = ({
|
|
|
490
507
|
setHasFullSchema(false);
|
|
491
508
|
}
|
|
492
509
|
}, [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
493
|
-
const shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
510
|
+
const shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
511
|
+
const isEditable = onVisibleColumnKeysChange && hasData;
|
|
494
512
|
return jsx("div", {
|
|
495
513
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
496
514
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -510,7 +528,8 @@ export const IssueLikeDataTableView = ({
|
|
|
510
528
|
} : {}
|
|
511
529
|
}, jsx("thead", {
|
|
512
530
|
"data-testid": testId && `${testId}--head`,
|
|
513
|
-
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
531
|
+
css: [noDefaultBorderStyles, tableHeadStyles],
|
|
532
|
+
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
514
533
|
}, jsx("tr", {
|
|
515
534
|
ref: tableHeaderRowRef
|
|
516
535
|
}, headerColumns.map(({
|
|
@@ -526,7 +545,7 @@ export const IssueLikeDataTableView = ({
|
|
|
526
545
|
level: "h200",
|
|
527
546
|
as: 'span'
|
|
528
547
|
}, content));
|
|
529
|
-
if (
|
|
548
|
+
if (isEditable) {
|
|
530
549
|
var _containerRef$current3;
|
|
531
550
|
const previewRows = tableRows.map(({
|
|
532
551
|
cells
|
|
@@ -555,14 +574,12 @@ export const IssueLikeDataTableView = ({
|
|
|
555
574
|
} else {
|
|
556
575
|
return jsx(TableHeading, {
|
|
557
576
|
key: key,
|
|
558
|
-
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : '',
|
|
559
577
|
"data-testid": `${key}-column-heading`,
|
|
560
|
-
style:
|
|
578
|
+
style: getWidthCss({
|
|
579
|
+
shouldUseWidth,
|
|
561
580
|
width
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
}, heading);
|
|
581
|
+
})
|
|
582
|
+
}, jsx(Flex, null, heading));
|
|
566
583
|
}
|
|
567
584
|
}), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
568
585
|
columns: hasFullSchema ? orderedColumns : [],
|
|
@@ -586,11 +603,11 @@ export const IssueLikeDataTableView = ({
|
|
|
586
603
|
content,
|
|
587
604
|
width
|
|
588
605
|
}, cellIndex) => {
|
|
589
|
-
|
|
606
|
+
const isLastCell = cellIndex === cells.length - 1;
|
|
607
|
+
let loadingRowStyle = getWidthCss({
|
|
608
|
+
shouldUseWidth,
|
|
590
609
|
width
|
|
591
|
-
}
|
|
592
|
-
maxWidth: width
|
|
593
|
-
};
|
|
610
|
+
});
|
|
594
611
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
595
612
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
596
613
|
loadingRowStyle = {
|
|
@@ -598,11 +615,10 @@ export const IssueLikeDataTableView = ({
|
|
|
598
615
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
599
616
|
};
|
|
600
617
|
}
|
|
601
|
-
return jsx(
|
|
618
|
+
return jsx(TableCell, {
|
|
602
619
|
key: cellKey,
|
|
603
620
|
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
604
|
-
colSpan:
|
|
605
|
-
css: truncatedCellStyles,
|
|
621
|
+
colSpan: isEditable && isLastCell ? 2 : undefined,
|
|
606
622
|
style: loadingRowStyle
|
|
607
623
|
}, content);
|
|
608
624
|
}))))));
|
|
@@ -7,24 +7,54 @@ export const Table = styled.table`
|
|
|
7
7
|
`;
|
|
8
8
|
const lineHeight = "var(--ds-font-lineHeight-300, 24px)";
|
|
9
9
|
const verticalPadding = "var(--ds-space-025, 2px)";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
13
|
+
* from editor table plugin.
|
|
14
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
15
|
+
* and force make browser use it first and editor plugin css second.
|
|
16
|
+
*/
|
|
17
|
+
export const withTablePluginPrefix = (tableSection, mainRule = '&') => `
|
|
18
|
+
.pm-table-wrapper > table ${tableSection} ${mainRule},
|
|
19
|
+
.ProseMirror .pm-table-wrapper > table ${tableSection} ${mainRule},
|
|
20
|
+
${mainRule}
|
|
21
|
+
`;
|
|
22
|
+
export const withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
|
|
23
|
+
export const withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
|
|
10
24
|
export const TableHeading = styled.th`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
${withTablePluginHeaderPrefix()} {
|
|
26
|
+
border: 0;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
/* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
|
|
32
|
+
line-height: ${lineHeight};
|
|
33
|
+
padding: ${verticalPadding} ${"var(--ds-space-050, 4px)"};
|
|
34
|
+
border-right: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
35
|
+
border-bottom: 2px solid ${`var(--ds-border, ${N40})`};
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
lineHeight * 2 -> Max height of two lined header
|
|
39
|
+
verticalPadding * 2 -> padding for this component itself
|
|
40
|
+
verticalPadding * 2 -> padding inside span (--container)
|
|
41
|
+
2px -> Bottom border
|
|
42
|
+
Last two terms are needed because of border-box box sizing.
|
|
43
|
+
*/
|
|
44
|
+
height: calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px);
|
|
45
|
+
vertical-align: bottom;
|
|
46
|
+
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)')} {
|
|
20
50
|
border-right: 0;
|
|
21
51
|
}
|
|
22
52
|
|
|
23
|
-
&:first-child {
|
|
53
|
+
${withTablePluginHeaderPrefix('&:first-child')} {
|
|
24
54
|
padding-left: ${"var(--ds-space-050, 4px)"};
|
|
25
55
|
}
|
|
26
56
|
|
|
27
|
-
&:last-child {
|
|
57
|
+
${withTablePluginHeaderPrefix('&:last-child')} {
|
|
28
58
|
border-right: 0;
|
|
29
59
|
}
|
|
30
60
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const COLUMN_BASE_WIDTH = 8;
|
|
2
|
+
export const COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
3
|
+
/**
|
|
4
|
+
* Generate width related portion of css for table cell.
|
|
5
|
+
*
|
|
6
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
7
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
8
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
9
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
10
|
+
* @param width
|
|
11
|
+
*/
|
|
12
|
+
export const getWidthCss = ({
|
|
13
|
+
shouldUseWidth,
|
|
14
|
+
width
|
|
15
|
+
}) => shouldUseWidth ? {
|
|
16
|
+
width
|
|
17
|
+
} : {
|
|
18
|
+
maxWidth: width
|
|
19
|
+
};
|
package/dist/es2019/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
4
|
+
import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdown-menu';
|
|
5
|
+
import TableIcon from '@atlaskit/icon/glyph/table';
|
|
6
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
7
|
+
import { modalMessages } from '../messages';
|
|
8
|
+
const dropDownItemGroupStyles = xcss({
|
|
9
|
+
width: '320px',
|
|
10
|
+
height: '140px',
|
|
11
|
+
paddingTop: "var(--ds-space-050, 4px)",
|
|
12
|
+
paddingBottom: "var(--ds-space-050, 4px)",
|
|
13
|
+
borderRadius: 'border.radius'
|
|
14
|
+
});
|
|
15
|
+
const InlineIcon = jsx("svg", {
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
width: "24",
|
|
18
|
+
height: "24",
|
|
19
|
+
viewBox: "0 0 24 24",
|
|
20
|
+
fill: "none"
|
|
21
|
+
}, jsx("path", {
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
clipRule: "evenodd",
|
|
24
|
+
d: "M4 9C2.89543 9 2 9.67155 2 10.5V13.5C2 14.3285 2.89543 15 4 15H20C21.1046 15 22 14.3285 22 13.5V10.5C22 9.67155 21.1046 9 20 9H4ZM4.22222 11.25C4.22222 10.5 4.22222 10.5 5 10.5H7C7.55556 10.5 7.55556 10.5 7.55556 11.25V13C7.55556 13.5 7.55556 13.5 7 13.5H5C4.22222 13.5 4.22222 13.5 4.22222 13V11.25ZM9 12C9 11.7929 9.2239 11.625 9.5 11.625H19.5C19.7761 11.625 20 11.7929 20 12C20 12.2071 19.7761 12.375 19.5 12.375H9.5C9.2239 12.375 9 12.2071 9 12Z",
|
|
25
|
+
fill: 'currentColor'
|
|
26
|
+
}));
|
|
27
|
+
export const DisplayViewDropDown = ({
|
|
28
|
+
onViewModeChange,
|
|
29
|
+
viewMode
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
formatMessage
|
|
33
|
+
} = useIntl();
|
|
34
|
+
const triggerText = viewMode === 'issue' ? formatMessage(modalMessages.tableViewModeLabel) : formatMessage(modalMessages.inlineLinkViewModeLabel);
|
|
35
|
+
return jsx(DropdownMenu, {
|
|
36
|
+
trigger: triggerText,
|
|
37
|
+
testId: "jira-jql-datasource-modal--view-drop-down"
|
|
38
|
+
}, jsx(Box, {
|
|
39
|
+
xcss: dropDownItemGroupStyles
|
|
40
|
+
}, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
|
|
41
|
+
testId: "dropdown-item-table",
|
|
42
|
+
onClick: () => onViewModeChange('issue'),
|
|
43
|
+
isSelected: viewMode === 'issue',
|
|
44
|
+
description: formatMessage(modalMessages.tableViewModeDescription),
|
|
45
|
+
elemBefore: jsx(TableIcon, {
|
|
46
|
+
label: "table icon"
|
|
47
|
+
})
|
|
48
|
+
}, jsx(FormattedMessage, modalMessages.tableViewModeLabel)), jsx(DropdownItem, {
|
|
49
|
+
testId: "dropdown-item-inline-link",
|
|
50
|
+
onClick: () => onViewModeChange('count'),
|
|
51
|
+
isSelected: viewMode === 'count',
|
|
52
|
+
description: formatMessage(modalMessages.inlineLinkViewModeDescription),
|
|
53
|
+
elemBefore: InlineIcon
|
|
54
|
+
}, jsx(FormattedMessage, modalMessages.inlineLinkViewModeLabel)))));
|
|
55
|
+
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { FormattedMessage, FormattedNumber
|
|
5
|
+
import { FormattedMessage, FormattedNumber } from 'react-intl-next';
|
|
6
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
7
7
|
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
8
8
|
import Button from '@atlaskit/button/standard-button';
|
|
@@ -32,8 +32,8 @@ import { availableBasicFilterTypes } from '../basic-filters/ui';
|
|
|
32
32
|
import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
|
|
33
33
|
import { InitialStateView } from '../initial-state-view';
|
|
34
34
|
import { JiraSearchContainer } from '../jira-search-container';
|
|
35
|
-
import { ModeSwitcher } from '../mode-switcher';
|
|
36
35
|
import { JiraSiteSelector } from '../site-selector';
|
|
36
|
+
import { DisplayViewDropDown } from './display-view-dropdown/display-view-drop-down';
|
|
37
37
|
import { modalMessages } from './messages';
|
|
38
38
|
const dropdownContainerStyles = css({
|
|
39
39
|
display: 'flex',
|
|
@@ -73,10 +73,10 @@ const smartLinkContainerStyles = css({
|
|
|
73
73
|
paddingLeft: '1px'
|
|
74
74
|
});
|
|
75
75
|
const getDisplayValue = (currentViewMode, itemCount) => {
|
|
76
|
-
if (currentViewMode === '
|
|
77
|
-
return DatasourceDisplay.
|
|
76
|
+
if (currentViewMode === 'issue') {
|
|
77
|
+
return DatasourceDisplay.DATASOURCE_TABLE;
|
|
78
78
|
}
|
|
79
|
-
return itemCount
|
|
79
|
+
return itemCount === 1 ? DatasourceDisplay.INLINE : DatasourceDisplay.DATASOURCE_INLINE;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -150,9 +150,6 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
150
150
|
parameters: isParametersSet ? parameters : undefined,
|
|
151
151
|
fieldKeys: visibleColumnKeys
|
|
152
152
|
});
|
|
153
|
-
const {
|
|
154
|
-
formatMessage
|
|
155
|
-
} = useIntl();
|
|
156
153
|
const {
|
|
157
154
|
fireEvent
|
|
158
155
|
} = useDatasourceAnalyticsEvents();
|
|
@@ -366,18 +363,11 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
366
363
|
const firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
367
364
|
if (currentViewMode === 'count') {
|
|
368
365
|
macroInsertedEvent === null || macroInsertedEvent === void 0 ? void 0 : macroInsertedEvent.fire(EVENT_CHANNEL);
|
|
366
|
+
const url = responseItems.length === 1 ? firstIssueUrl : upToDateJqlUrl;
|
|
369
367
|
onInsert({
|
|
370
368
|
type: 'inlineCard',
|
|
371
369
|
attrs: {
|
|
372
|
-
url
|
|
373
|
-
}
|
|
374
|
-
}, consumerEvent);
|
|
375
|
-
} else if (responseItems.length === 1 && firstIssueUrl) {
|
|
376
|
-
macroInsertedEvent === null || macroInsertedEvent === void 0 ? void 0 : macroInsertedEvent.fire(EVENT_CHANNEL);
|
|
377
|
-
onInsert({
|
|
378
|
-
type: 'inlineCard',
|
|
379
|
-
attrs: {
|
|
380
|
-
url: firstIssueUrl
|
|
370
|
+
url
|
|
381
371
|
}
|
|
382
372
|
}, consumerEvent);
|
|
383
373
|
} else {
|
|
@@ -405,7 +395,7 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
405
395
|
}
|
|
406
396
|
}, consumerEvent);
|
|
407
397
|
}
|
|
408
|
-
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender,
|
|
398
|
+
}, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql, responseItems]);
|
|
409
399
|
const handleViewModeChange = selectedMode => {
|
|
410
400
|
userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
411
401
|
setCurrentViewMode(selectedMode);
|
|
@@ -451,14 +441,19 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
451
441
|
css: placeholderSmartLinkStyles
|
|
452
442
|
}, jsx(FormattedMessage, modalMessages.issuesCountSmartCardPlaceholderText)));
|
|
453
443
|
} else {
|
|
454
|
-
|
|
444
|
+
let url;
|
|
445
|
+
if (responseItems.length === 1 && retrieveUrlForSmartCardRender()) {
|
|
446
|
+
url = retrieveUrlForSmartCardRender();
|
|
447
|
+
} else {
|
|
448
|
+
url = `${selectedJiraSiteUrl}/issues/?jql=${encodeURI(jql)}`;
|
|
449
|
+
}
|
|
455
450
|
return jsx("div", {
|
|
456
451
|
css: smartLinkContainerStyles
|
|
457
452
|
}, jsx(LinkRenderType, {
|
|
458
|
-
url:
|
|
453
|
+
url: url
|
|
459
454
|
}));
|
|
460
455
|
}
|
|
461
|
-
}, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
456
|
+
}, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, responseItems, retrieveUrlForSmartCardRender]);
|
|
462
457
|
const renderIssuesModeContent = useCallback(() => {
|
|
463
458
|
const selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
464
459
|
if (status === 'rejected' && jqlUrl) {
|
|
@@ -481,16 +476,8 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
481
476
|
searchMethod: currentSearchMethod
|
|
482
477
|
}));
|
|
483
478
|
}
|
|
484
|
-
const firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
485
|
-
if (responseItems.length === 1 && firstIssueUrl) {
|
|
486
|
-
return jsx("div", {
|
|
487
|
-
css: smartLinkContainerStyles
|
|
488
|
-
}, jsx(LinkRenderType, {
|
|
489
|
-
url: firstIssueUrl
|
|
490
|
-
}));
|
|
491
|
-
}
|
|
492
479
|
return issueLikeDataTableView;
|
|
493
|
-
}, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults,
|
|
480
|
+
}, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
|
|
494
481
|
return jsx(IntlMessagesProvider, {
|
|
495
482
|
defaultMessages: i18nEN,
|
|
496
483
|
loaderFn: fetchMessagesForLocale
|
|
@@ -506,17 +493,9 @@ export const PlainJiraIssuesConfigModal = props => {
|
|
|
506
493
|
onSiteSelection: onSiteSelection,
|
|
507
494
|
selectedJiraSite: selectedJiraSite,
|
|
508
495
|
testId: "jira-jql-datasource-modal--site-selector"
|
|
509
|
-
})) : jsx(FormattedMessage, modalMessages.insertIssuesTitle))), !hasNoJiraSites && jsx(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
label: formatMessage(modalMessages.issueViewModeLabel),
|
|
513
|
-
value: 'issue'
|
|
514
|
-
}, {
|
|
515
|
-
label: formatMessage(modalMessages.countViewModeLabel),
|
|
516
|
-
value: 'count'
|
|
517
|
-
}],
|
|
518
|
-
onOptionValueChange: handleViewModeChange,
|
|
519
|
-
selectedOptionValue: currentViewMode
|
|
496
|
+
})) : jsx(FormattedMessage, modalMessages.insertIssuesTitle))), !hasNoJiraSites && jsx(DisplayViewDropDown, {
|
|
497
|
+
onViewModeChange: handleViewModeChange,
|
|
498
|
+
viewMode: currentViewMode
|
|
520
499
|
})), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
|
|
521
500
|
setSearchBarJql: setSearchBarJql,
|
|
522
501
|
searchBarJql: searchBarJql,
|
|
@@ -20,15 +20,25 @@ export const modalMessages = defineMessages({
|
|
|
20
20
|
description: 'Title for the Jira Issues modal when a user has to select a site to inserting issues from',
|
|
21
21
|
defaultMessage: 'Insert Jira issues from'
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
id: 'linkDataSource.jira-issues.configmodal.
|
|
25
|
-
description: '
|
|
26
|
-
defaultMessage: '
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
id: 'linkDataSource.jira-issues.configmodal.
|
|
30
|
-
description: '
|
|
31
|
-
defaultMessage: '
|
|
23
|
+
tableViewModeLabel: {
|
|
24
|
+
id: 'linkDataSource.jira-issues.configmodal.tableViewModeLabel',
|
|
25
|
+
description: 'Display Jira search results as a table',
|
|
26
|
+
defaultMessage: 'Table'
|
|
27
|
+
},
|
|
28
|
+
tableViewModeDescription: {
|
|
29
|
+
id: 'linkDataSource.jira-issues.configmodal.tableViewModeDescription',
|
|
30
|
+
description: 'Description for table view mode',
|
|
31
|
+
defaultMessage: 'Display Jira search results as a table'
|
|
32
|
+
},
|
|
33
|
+
inlineLinkViewModeLabel: {
|
|
34
|
+
id: 'linkDataSource.jira-issues.configmodal.inlineLinkViewModeLabel',
|
|
35
|
+
description: 'Display the number of search results as an inline smart link',
|
|
36
|
+
defaultMessage: 'Inline link'
|
|
37
|
+
},
|
|
38
|
+
inlineLinkViewModeDescription: {
|
|
39
|
+
id: 'linkDataSource.jira-issues.configmodal.inlineLinkViewModeDescription',
|
|
40
|
+
description: 'Description for inline link view mode',
|
|
41
|
+
defaultMessage: 'Display the number of search results or as an inline smart link'
|
|
32
42
|
},
|
|
33
43
|
issuesCountSmartCardPlaceholderText: {
|
|
34
44
|
id: 'linkDataSource.jira-issues.configmodal.placeholder.issues',
|
|
@@ -204,6 +204,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
204
204
|
}
|
|
205
205
|
}, [defaultVisibleColumnKeys, isNewSearch]);
|
|
206
206
|
var isDisabled = !!errorState || status !== 'resolved' || assetsClientLoading || !aql || !schemaId;
|
|
207
|
+
var isEditingExistingTable = !!(initialParameters !== null && initialParameters !== void 0 && initialParameters.aql && initialParameters !== null && initialParameters !== void 0 && initialParameters.schemaId && initialParameters !== null && initialParameters !== void 0 && initialParameters.workspaceId);
|
|
207
208
|
var retrieveUrlForSmartCardRender = useCallback(function () {
|
|
208
209
|
var _data$key;
|
|
209
210
|
var _responseItems = _slicedToArray(responseItems, 1),
|
|
@@ -362,7 +363,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
362
363
|
onClick: onInsertPressed,
|
|
363
364
|
isDisabled: isDisabled,
|
|
364
365
|
testId: 'assets-datasource-modal--insert-button'
|
|
365
|
-
}, jsx(FormattedMessage, _extends({}, modalMessages.insertIssuesButtonText, {
|
|
366
|
+
}, jsx(FormattedMessage, _extends({}, isEditingExistingTable ? modalMessages.updateObjectsButtonText : modalMessages.insertIssuesButtonText, {
|
|
366
367
|
values: {
|
|
367
368
|
objectsCount: responseItems.length
|
|
368
369
|
}
|
|
@@ -5,6 +5,11 @@ export var modalMessages = defineMessages({
|
|
|
5
5
|
description: 'Button text to close the modal with no changes being made',
|
|
6
6
|
defaultMessage: 'Cancel'
|
|
7
7
|
},
|
|
8
|
+
updateObjectsButtonText: {
|
|
9
|
+
id: 'linkDataSource.assets.configmodal.updateObjectsButtonText',
|
|
10
|
+
description: 'Button text to update the displayed content',
|
|
11
|
+
defaultMessage: 'Update table'
|
|
12
|
+
},
|
|
8
13
|
insertIssuesButtonText: {
|
|
9
14
|
id: 'linkDataSource.assets.configmodal.insertIssuesButtonText',
|
|
10
15
|
description: 'Button text to insert the displayed content',
|
|
@@ -16,7 +16,7 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
16
16
|
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
17
17
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
18
18
|
import { TableHeading } from './styled';
|
|
19
|
-
import { COLUMN_MIN_WIDTH } from './
|
|
19
|
+
import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
|
|
20
20
|
var verticallyAlignedStyles = css({
|
|
21
21
|
display: 'flex',
|
|
22
22
|
alignItems: 'center',
|
|
@@ -242,9 +242,6 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
242
242
|
|
|
243
243
|
// Set the width of our header being resized
|
|
244
244
|
var proposedWidth = initialWidth + relativeDistanceX;
|
|
245
|
-
if (initialWidth >= COLUMN_MIN_WIDTH && proposedWidth < COLUMN_MIN_WIDTH) {
|
|
246
|
-
proposedWidth = COLUMN_MIN_WIDTH;
|
|
247
|
-
}
|
|
248
245
|
|
|
249
246
|
// We update width css directly live
|
|
250
247
|
mainHeaderCell.style.setProperty('width', "".concat(proposedWidth, "px"));
|
|
@@ -253,24 +250,24 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
253
250
|
cancelUnhandled.stop();
|
|
254
251
|
setState(idleState);
|
|
255
252
|
if (onWidthChange) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
var cssWidth = +mainHeaderCell.style.getPropertyValue('width').slice(0, -2);
|
|
254
|
+
if (cssWidth < COLUMN_MIN_WIDTH) {
|
|
255
|
+
cssWidth = COLUMN_MIN_WIDTH;
|
|
256
|
+
}
|
|
257
|
+
onWidthChange(cssWidth);
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
260
|
});
|
|
262
261
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
263
262
|
return jsx(TableHeading, {
|
|
264
263
|
ref: mainHeaderCellRef,
|
|
265
|
-
className: "has-column-picker",
|
|
266
264
|
"data-testid": "".concat(id, "-column-heading"),
|
|
267
265
|
style: _objectSpread({
|
|
268
266
|
cursor: 'grab'
|
|
269
|
-
},
|
|
267
|
+
}, getWidthCss({
|
|
268
|
+
shouldUseWidth: !!onWidthChange,
|
|
270
269
|
width: width
|
|
271
|
-
}
|
|
272
|
-
maxWidth: width
|
|
273
|
-
})
|
|
270
|
+
}))
|
|
274
271
|
}, onWidthChange ? jsx("div", {
|
|
275
272
|
ref: columnResizeHandleRef,
|
|
276
273
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|