@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.
Files changed (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/ui/assets-modal/modal/index.js +2 -1
  3. package/dist/cjs/ui/assets-modal/modal/messages.js +5 -0
  4. package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +9 -12
  5. package/dist/cjs/ui/issue-like-table/index.js +30 -44
  6. package/dist/cjs/ui/issue-like-table/styled.js +15 -2
  7. package/dist/cjs/ui/issue-like-table/utils.js +26 -0
  8. package/dist/cjs/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +68 -0
  9. package/dist/cjs/ui/jira-issues-modal/modal/index.js +19 -39
  10. package/dist/cjs/ui/jira-issues-modal/modal/messages.js +19 -9
  11. package/dist/es2019/ui/assets-modal/modal/index.js +2 -1
  12. package/dist/es2019/ui/assets-modal/modal/messages.js +5 -0
  13. package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +8 -11
  14. package/dist/es2019/ui/issue-like-table/index.js +72 -56
  15. package/dist/es2019/ui/issue-like-table/styled.js +41 -11
  16. package/dist/es2019/ui/issue-like-table/utils.js +19 -0
  17. package/dist/es2019/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +55 -0
  18. package/dist/es2019/ui/jira-issues-modal/modal/index.js +20 -41
  19. package/dist/es2019/ui/jira-issues-modal/modal/messages.js +19 -9
  20. package/dist/esm/ui/assets-modal/modal/index.js +2 -1
  21. package/dist/esm/ui/assets-modal/modal/messages.js +5 -0
  22. package/dist/esm/ui/issue-like-table/draggable-table-heading.js +9 -12
  23. package/dist/esm/ui/issue-like-table/index.js +30 -44
  24. package/dist/esm/ui/issue-like-table/styled.js +14 -1
  25. package/dist/esm/ui/issue-like-table/utils.js +20 -0
  26. package/dist/esm/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.js +57 -0
  27. package/dist/esm/ui/jira-issues-modal/modal/index.js +20 -40
  28. package/dist/esm/ui/jira-issues-modal/modal/messages.js +19 -9
  29. package/dist/types/ui/assets-modal/modal/messages.d.ts +5 -0
  30. package/dist/types/ui/issue-like-table/index.d.ts +0 -1
  31. package/dist/types/ui/issue-like-table/styled.d.ts +9 -0
  32. package/dist/types/ui/issue-like-table/utils.d.ts +17 -0
  33. package/dist/types/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
  34. package/dist/types/ui/jira-issues-modal/modal/messages.d.ts +12 -2
  35. package/dist/types-ts4.5/ui/assets-modal/modal/messages.d.ts +5 -0
  36. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +0 -1
  37. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +9 -0
  38. package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +17 -0
  39. package/dist/types-ts4.5/ui/jira-issues-modal/modal/display-view-dropdown/display-view-drop-down.d.ts +8 -0
  40. package/dist/types-ts4.5/ui/jira-issues-modal/modal/messages.d.ts +12 -2
  41. package/package.json +5 -4
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _extends from "@babel/runtime/helpers/extends";
5
5
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
6
6
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
7
- var _templateObject;
7
+ var _templateObject, _templateObject2;
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  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; }
10
10
  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; }
@@ -21,6 +21,7 @@ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/r
21
21
  import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
22
22
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
23
23
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
24
+ import { Flex } from '@atlaskit/primitives';
24
25
  import { N40 } from '@atlaskit/theme/colors';
25
26
  import Tooltip from '@atlaskit/tooltip';
26
27
  import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
@@ -30,8 +31,9 @@ import { DragColumnPreview } from './drag-column-preview';
30
31
  import { DraggableTableHeading } from './draggable-table-heading';
31
32
  import TableEmptyState from './empty-state';
32
33
  import { fallbackRenderType, stringifyType } from './render-type';
33
- import { Table, TableHeading } from './styled';
34
+ import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
34
35
  import { useIsOnScreen } from './useIsOnScreen';
36
+ import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
35
37
  var tableSidePadding = "var(--ds-space-200, 16px)";
36
38
  var tableHeadStyles = css({
37
39
  background: "var(--ds-elevation-surface-current, #FFF)",
@@ -44,21 +46,8 @@ var truncateTextStyles = css({
44
46
  textOverflow: 'ellipsis',
45
47
  whiteSpace: 'nowrap'
46
48
  });
47
- var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 56px;\n z-index: 10;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business below */\n\n padding-right: ", ";\n\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n &:last-of-type {\n padding-right: ", ";\n }\n text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n"])), tableSidePadding, "var(--ds-elevation-surface-current, #FFF)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-space-100, 4px)", "var(--ds-elevation-surface-current, #FFF)", tableSidePadding);
48
- var truncatedCellStyles = css({
49
- overflow: 'hidden',
50
- textOverflow: 'ellipsis',
51
- whiteSpace: 'nowrap',
52
- borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
53
- borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
54
- '&:first-child': {
55
- paddingLeft: "var(--ds-space-100, 8px)"
56
- },
57
- '&:last-child': {
58
- borderRight: 0,
59
- paddingRight: "var(--ds-space-100, 8px)"
60
- }
61
- });
49
+ var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n box-sizing: content-box;\n border: 0;\n\n width: 56px;\n z-index: 10;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business below */\n\n padding-right: ", ";\n\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n }\n\n ", " {\n padding-right: ", ";\n }\n"])), withTablePluginHeaderPrefix(), tableSidePadding, "var(--ds-elevation-surface-current, #FFF)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-space-100, 4px)", "var(--ds-elevation-surface-current, #FFF)", withTablePluginHeaderPrefix('&:last-of-type'), tableSidePadding);
50
+ var TableCell = styled.td(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n /* First section here is to override things editor table plugin css defines */\n padding: ", " ", ";\n border: 0;\n min-width: auto;\n vertical-align: inherit;\n box-sizing: border-box;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-right: 0.5px solid ", ";\n border-bottom: 0.5px solid ", ";\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n padding-right: ", ";\n }\n"])), withTablePluginBodyPrefix(), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), withTablePluginBodyPrefix('&:first-child'), "var(--ds-space-100, 8px)", withTablePluginBodyPrefix('&:last-child'), "var(--ds-space-100, 8px)");
62
51
  var tableContainerStyles = css({
63
52
  borderRadius: 'inherit',
64
53
  borderBottomLeftRadius: 0,
@@ -188,16 +177,14 @@ export var getOrderedColumns = function getOrderedColumns(columns, visibleColumn
188
177
  }).sort(sortColumns);
189
178
  return [].concat(_toConsumableArray(visibleColumns), _toConsumableArray(alphabeticallySortedInvisibleColumns));
190
179
  };
191
- var BASE_WIDTH = 8;
192
- var DEFAULT_WIDTH = BASE_WIDTH * 22;
193
- export var COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
180
+ var DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
194
181
  var keyBasedWidthMap = {
195
- priority: BASE_WIDTH * 5,
196
- status: BASE_WIDTH * 18,
197
- summary: BASE_WIDTH * 45,
198
- description: BASE_WIDTH * 31.25,
199
- type: BASE_WIDTH * 5,
200
- key: BASE_WIDTH * 13
182
+ priority: COLUMN_BASE_WIDTH * 5,
183
+ status: COLUMN_BASE_WIDTH * 18,
184
+ summary: COLUMN_BASE_WIDTH * 45,
185
+ description: COLUMN_BASE_WIDTH * 31,
186
+ type: COLUMN_BASE_WIDTH * 6,
187
+ key: COLUMN_BASE_WIDTH * 15
201
188
  };
202
189
  function getDefaultColumnWidth(key, type) {
203
190
  var keyBasedWidth = keyBasedWidthMap[key];
@@ -206,9 +193,9 @@ function getDefaultColumnWidth(key, type) {
206
193
  }
207
194
  switch (type) {
208
195
  case 'date':
209
- return BASE_WIDTH * 14;
196
+ return COLUMN_BASE_WIDTH * 16;
210
197
  case 'icon':
211
- return BASE_WIDTH * 5;
198
+ return COLUMN_BASE_WIDTH * 7;
212
199
  default:
213
200
  return DEFAULT_WIDTH;
214
201
  }
@@ -495,7 +482,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
495
482
  }
496
483
  }, _callee, null, [[3, 9]]);
497
484
  })), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
498
- var shouldUseWidth = onColumnResize || columnCustomSizes;
485
+ var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
486
+ var isEditable = onVisibleColumnKeysChange && hasData;
499
487
  return jsx("div", {
500
488
  /* There is required contentEditable={true} in editor-card-plugin
501
489
  * But this brakes how DND works. We set contentEditable={false} to allow DND to work
@@ -515,7 +503,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
515
503
  } : {}
516
504
  }, jsx("thead", {
517
505
  "data-testid": testId && "".concat(testId, "--head"),
518
- css: [noDefaultBorderStyles, tableHeadStyles]
506
+ css: [noDefaultBorderStyles, tableHeadStyles],
507
+ className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
519
508
  }, jsx("tr", {
520
509
  ref: tableHeaderRowRef
521
510
  }, headerColumns.map(function (_ref13, cellIndex) {
@@ -530,7 +519,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
530
519
  level: "h200",
531
520
  as: 'span'
532
521
  }, content));
533
- if (onVisibleColumnKeysChange && hasData) {
522
+ if (isEditable) {
534
523
  var _containerRef$current3;
535
524
  var previewRows = tableRows.map(function (_ref14) {
536
525
  var cells = _ref14.cells;
@@ -559,14 +548,12 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
559
548
  } else {
560
549
  return jsx(TableHeading, {
561
550
  key: key,
562
- className: !!onVisibleColumnKeysChange ? 'has-column-picker' : '',
563
551
  "data-testid": "".concat(key, "-column-heading"),
564
- style: shouldUseWidth ? {
552
+ style: getWidthCss({
553
+ shouldUseWidth: shouldUseWidth,
565
554
  width: width
566
- } : {
567
- maxWidth: width
568
- }
569
- }, heading);
555
+ })
556
+ }, jsx(Flex, null, heading));
570
557
  }
571
558
  }), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
572
559
  columns: hasFullSchema ? orderedColumns : [],
@@ -589,22 +576,21 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
589
576
  var cellKey = _ref17.key,
590
577
  content = _ref17.content,
591
578
  width = _ref17.width;
592
- var loadingRowStyle = shouldUseWidth ? {
579
+ var isLastCell = cellIndex === cells.length - 1;
580
+ var loadingRowStyle = getWidthCss({
581
+ shouldUseWidth: shouldUseWidth,
593
582
  width: width
594
- } : {
595
- maxWidth: width
596
- };
583
+ });
597
584
  // extra padding is required around skeleton loader to avoid vertical jumps when data loads
598
585
  if (key !== null && key !== void 0 && key.includes('loading')) {
599
586
  loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
600
587
  paddingBlock: "var(--ds-space-100, 8px)"
601
588
  });
602
589
  }
603
- return jsx("td", {
590
+ return jsx(TableCell, {
604
591
  key: cellKey,
605
592
  "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
606
- colSpan: cellIndex + 1 === cells.length ? 2 : undefined,
607
- css: truncatedCellStyles,
593
+ colSpan: isEditable && isLastCell ? 2 : undefined,
608
594
  style: loadingRowStyle
609
595
  }, content);
610
596
  }));
@@ -7,4 +7,17 @@ export var FieldTextFontSize = '14px';
7
7
  export var Table = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
8
8
  var lineHeight = "var(--ds-font-lineHeight-300, 24px)";
9
9
  var verticalPadding = "var(--ds-space-025, 2px)";
10
- export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n line-height: ", ";\n padding: ", " ", ";\n border-right: 0.5px solid ", ";\n border-bottom: 2px solid ", ";\n height: calc(", " * 2 + ", " * 2);\n vertical-align: bottom;\n\n &.has-column-picker:nth-last-of-type(2) {\n border-right: 0;\n }\n\n &:first-child {\n padding-left: ", ";\n }\n\n &:last-child {\n border-right: 0;\n }\n\n & [data-testid='datasource-header-content--container'] {\n width: 100%;\n padding: ", " ", ";\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n white-space: normal;\n overflow: hidden;\n word-wrap: break-word;\n\n &:hover {\n background: ", ";\n border-radius: 3px;\n }\n }\n"])), lineHeight, verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), lineHeight, verticalPadding, "var(--ds-space-050, 4px)", verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-background-input-hovered, #F7F8F9)");
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 var withTablePluginPrefix = function withTablePluginPrefix(tableSection) {
18
+ var mainRule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '&';
19
+ return "\n .pm-table-wrapper > table ".concat(tableSection, " ").concat(mainRule, ",\n .ProseMirror .pm-table-wrapper > table ").concat(tableSection, " ").concat(mainRule, ",\n ").concat(mainRule, "\n");
20
+ };
21
+ export var withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
22
+ export var withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
23
+ export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n border: 0;\n position: relative;\n\n /* This makes resizing work with out jumping due to padding + changes overall width for same default values. */\n box-sizing: border-box;\n\n line-height: ", ";\n padding: ", " ", ";\n border-right: 0.5px solid ", ";\n border-bottom: 2px solid ", ";\n\n /*\n lineHeight * 2 -> Max height of two lined header\n verticalPadding * 2 -> padding for this component itself\n verticalPadding * 2 -> padding inside span (--container)\n 2px -> Bottom border\n Last two terms are needed because of border-box box sizing.\n */\n height: calc(", " * 2 + ", " * 4 + 2px);\n vertical-align: bottom;\n background-color: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n & [data-testid='datasource-header-content--container'] {\n width: 100%;\n padding: ", " ", ";\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n white-space: normal;\n overflow: hidden;\n word-wrap: break-word;\n\n &:hover {\n background: ", ";\n border-radius: 3px;\n }\n }\n"])), withTablePluginHeaderPrefix(), lineHeight, verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), lineHeight, verticalPadding, "var(--ds-elevation-surface-current, #FFF)", withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)'), withTablePluginHeaderPrefix('&:first-child'), "var(--ds-space-050, 4px)", withTablePluginHeaderPrefix('&:last-child'), verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-background-input-hovered, #F7F8F9)");
@@ -0,0 +1,20 @@
1
+ export var COLUMN_BASE_WIDTH = 8;
2
+ export var 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 var getWidthCss = function getWidthCss(_ref) {
13
+ var shouldUseWidth = _ref.shouldUseWidth,
14
+ width = _ref.width;
15
+ return shouldUseWidth ? {
16
+ width: width
17
+ } : {
18
+ maxWidth: width
19
+ };
20
+ };
@@ -0,0 +1,57 @@
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
+ var 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
+ var 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 var DisplayViewDropDown = function DisplayViewDropDown(_ref) {
28
+ var onViewModeChange = _ref.onViewModeChange,
29
+ viewMode = _ref.viewMode;
30
+ var _useIntl = useIntl(),
31
+ formatMessage = _useIntl.formatMessage;
32
+ var triggerText = viewMode === 'issue' ? formatMessage(modalMessages.tableViewModeLabel) : formatMessage(modalMessages.inlineLinkViewModeLabel);
33
+ return jsx(DropdownMenu, {
34
+ trigger: triggerText,
35
+ testId: "jira-jql-datasource-modal--view-drop-down"
36
+ }, jsx(Box, {
37
+ xcss: dropDownItemGroupStyles
38
+ }, jsx(DropdownItemGroup, null, jsx(DropdownItem, {
39
+ testId: "dropdown-item-table",
40
+ onClick: function onClick() {
41
+ return onViewModeChange('issue');
42
+ },
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: function onClick() {
51
+ return onViewModeChange('count');
52
+ },
53
+ isSelected: viewMode === 'count',
54
+ description: formatMessage(modalMessages.inlineLinkViewModeDescription),
55
+ elemBefore: InlineIcon
56
+ }, jsx(FormattedMessage, modalMessages.inlineLinkViewModeLabel)))));
57
+ };
@@ -9,7 +9,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
9
9
  /** @jsx jsx */
10
10
  import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
11
  import { css, jsx } from '@emotion/react';
12
- import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
12
+ import { FormattedMessage, FormattedNumber } from 'react-intl-next';
13
13
  import { v4 as uuidv4 } from 'uuid';
14
14
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
15
15
  import Button from '@atlaskit/button/standard-button';
@@ -39,8 +39,8 @@ import { availableBasicFilterTypes } from '../basic-filters/ui';
39
39
  import { isQueryTooComplex } from '../basic-filters/utils/isQueryTooComplex';
40
40
  import { InitialStateView } from '../initial-state-view';
41
41
  import { JiraSearchContainer } from '../jira-search-container';
42
- import { ModeSwitcher } from '../mode-switcher';
43
42
  import { JiraSiteSelector } from '../site-selector';
43
+ import { DisplayViewDropDown } from './display-view-dropdown/display-view-drop-down';
44
44
  import { modalMessages } from './messages';
45
45
  var dropdownContainerStyles = css({
46
46
  display: 'flex',
@@ -80,10 +80,10 @@ var smartLinkContainerStyles = css({
80
80
  paddingLeft: '1px'
81
81
  });
82
82
  var getDisplayValue = function getDisplayValue(currentViewMode, itemCount) {
83
- if (currentViewMode === 'count') {
84
- return DatasourceDisplay.DATASOURCE_INLINE;
83
+ if (currentViewMode === 'issue') {
84
+ return DatasourceDisplay.DATASOURCE_TABLE;
85
85
  }
86
- return itemCount > 1 ? DatasourceDisplay.DATASOURCE_TABLE : DatasourceDisplay.INLINE;
86
+ return itemCount === 1 ? DatasourceDisplay.INLINE : DatasourceDisplay.DATASOURCE_INLINE;
87
87
  };
88
88
 
89
89
  /**
@@ -179,8 +179,6 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
179
179
  _useDatasourceTableSt2 = _useDatasourceTableSt.extensionKey,
180
180
  extensionKey = _useDatasourceTableSt2 === void 0 ? null : _useDatasourceTableSt2,
181
181
  destinationObjectTypes = _useDatasourceTableSt.destinationObjectTypes;
182
- var _useIntl = useIntl(),
183
- formatMessage = _useIntl.formatMessage;
184
182
  var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
185
183
  fireEvent = _useDatasourceAnalyti.fireEvent;
186
184
  var _useRef = useRef(uuidv4()),
@@ -403,18 +401,11 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
403
401
  var firstIssueUrl = retrieveUrlForSmartCardRender();
404
402
  if (currentViewMode === 'count') {
405
403
  macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
404
+ var url = responseItems.length === 1 ? firstIssueUrl : upToDateJqlUrl;
406
405
  onInsert({
407
406
  type: 'inlineCard',
408
407
  attrs: {
409
- url: upToDateJqlUrl
410
- }
411
- }, consumerEvent);
412
- } else if (responseItems.length === 1 && firstIssueUrl) {
413
- macroInsertedEvent === null || macroInsertedEvent === void 0 || macroInsertedEvent.fire(EVENT_CHANNEL);
414
- onInsert({
415
- type: 'inlineCard',
416
- attrs: {
417
- url: firstIssueUrl
408
+ url: url
418
409
  }
419
410
  }, consumerEvent);
420
411
  } else {
@@ -444,7 +435,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
444
435
  }
445
436
  }, consumerEvent);
446
437
  }
447
- }, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql]);
438
+ }, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql, responseItems]);
448
439
  var handleViewModeChange = function handleViewModeChange(selectedMode) {
449
440
  userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
450
441
  setCurrentViewMode(selectedMode);
@@ -494,14 +485,19 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
494
485
  css: placeholderSmartLinkStyles
495
486
  }, jsx(FormattedMessage, modalMessages.issuesCountSmartCardPlaceholderText)));
496
487
  } else {
497
- var urlWithEncodedJql = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(encodeURI(jql));
488
+ var url;
489
+ if (responseItems.length === 1 && retrieveUrlForSmartCardRender()) {
490
+ url = retrieveUrlForSmartCardRender();
491
+ } else {
492
+ url = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(encodeURI(jql));
493
+ }
498
494
  return jsx("div", {
499
495
  css: smartLinkContainerStyles
500
496
  }, jsx(LinkRenderType, {
501
- url: urlWithEncodedJql
497
+ url: url
502
498
  }));
503
499
  }
504
- }, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
500
+ }, [jql, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited, responseItems, retrieveUrlForSmartCardRender]);
505
501
  var renderIssuesModeContent = useCallback(function () {
506
502
  var selectedJiraSiteUrl = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
507
503
  if (status === 'rejected' && jqlUrl) {
@@ -524,16 +520,8 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
524
520
  searchMethod: currentSearchMethod
525
521
  }));
526
522
  }
527
- var firstIssueUrl = retrieveUrlForSmartCardRender();
528
- if (responseItems.length === 1 && firstIssueUrl) {
529
- return jsx("div", {
530
- css: smartLinkContainerStyles
531
- }, jsx(LinkRenderType, {
532
- url: firstIssueUrl
533
- }));
534
- }
535
523
  return issueLikeDataTableView;
536
- }, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, responseItems.length, retrieveUrlForSmartCardRender, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
524
+ }, [columns.length, currentSearchMethod, issueLikeDataTableView, jql, jqlUrl, resolvedWithNoResults, selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url, status, urlBeingEdited]);
537
525
  return jsx(IntlMessagesProvider, {
538
526
  defaultMessages: i18nEN,
539
527
  loaderFn: fetchMessagesForLocale
@@ -549,17 +537,9 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
549
537
  onSiteSelection: onSiteSelection,
550
538
  selectedJiraSite: selectedJiraSite,
551
539
  testId: "jira-jql-datasource-modal--site-selector"
552
- })) : jsx(FormattedMessage, modalMessages.insertIssuesTitle))), !hasNoJiraSites && jsx(ModeSwitcher, {
553
- isCompact: true,
554
- options: [{
555
- label: formatMessage(modalMessages.issueViewModeLabel),
556
- value: 'issue'
557
- }, {
558
- label: formatMessage(modalMessages.countViewModeLabel),
559
- value: 'count'
560
- }],
561
- onOptionValueChange: handleViewModeChange,
562
- selectedOptionValue: currentViewMode
540
+ })) : jsx(FormattedMessage, modalMessages.insertIssuesTitle))), !hasNoJiraSites && jsx(DisplayViewDropDown, {
541
+ onViewModeChange: handleViewModeChange,
542
+ viewMode: currentViewMode
563
543
  })), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
564
544
  setSearchBarJql: setSearchBarJql,
565
545
  searchBarJql: searchBarJql,
@@ -20,15 +20,25 @@ export var 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
- issueViewModeLabel: {
24
- id: 'linkDataSource.jira-issues.configmodal.issueViewModeLabel',
25
- description: 'Label for toggle to enable a view mode showing issues in a table list view',
26
- defaultMessage: 'Issue view'
27
- },
28
- countViewModeLabel: {
29
- id: 'linkDataSource.jira-issues.configmodal.countViewModeLabel',
30
- description: 'Label for toggle to enable a view mode showing issues in as a total count',
31
- defaultMessage: 'Count view'
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',
@@ -4,6 +4,11 @@ export declare const modalMessages: {
4
4
  description: string;
5
5
  defaultMessage: string;
6
6
  };
7
+ updateObjectsButtonText: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
7
12
  insertIssuesButtonText: {
8
13
  id: string;
9
14
  description: string;
@@ -22,6 +22,5 @@ export interface RowCellType {
22
22
  content?: React.ReactNode | string;
23
23
  }
24
24
  export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
25
- export declare const COLUMN_MIN_WIDTH: number;
26
25
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
27
26
  export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -5,6 +5,15 @@ export declare const Table: import("@emotion/styled").StyledComponent<{
5
5
  theme?: import("@emotion/react").Theme | undefined;
6
6
  as?: import("react").ElementType<any> | undefined;
7
7
  }, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
8
+ /**
9
+ * This is a hack used to override styles that are leaking to our table html element
10
+ * from editor table plugin.
11
+ * This css prefix can be used in front of our main css rule to make its weight bigger
12
+ * and force make browser use it first and editor plugin css second.
13
+ */
14
+ export declare const withTablePluginPrefix: (tableSection: 'thead' | 'tbody' | '', mainRule?: string) => string;
15
+ export declare const withTablePluginHeaderPrefix: (mainRule?: string | undefined) => string;
16
+ export declare const withTablePluginBodyPrefix: (mainRule?: string | undefined) => string;
8
17
  export declare const TableHeading: import("@emotion/styled").StyledComponent<{
9
18
  theme?: import("@emotion/react").Theme | undefined;
10
19
  as?: import("react").ElementType<any> | undefined;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ export declare const COLUMN_BASE_WIDTH = 8;
3
+ export declare const COLUMN_MIN_WIDTH: number;
4
+ export type GetWidthCss = (arg: {
5
+ shouldUseWidth: boolean;
6
+ width: number;
7
+ }) => React.CSSProperties;
8
+ /**
9
+ * Generate width related portion of css for table cell.
10
+ *
11
+ * @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
12
+ * or rather default width that should be treated as a maximum width. When table inserted initially
13
+ * and no user custom width defined we set this value to `false`. As soon as user changes any of the
14
+ * column widths we treat all width as custom hardcoded widths.
15
+ * @param width
16
+ */
17
+ export declare const getWidthCss: GetWidthCss;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { JiraIssueViewModes } from '../../types';
4
+ export type DisplayViewDropDownProps = {
5
+ onViewModeChange: (value: JiraIssueViewModes) => void;
6
+ viewMode: JiraIssueViewModes;
7
+ };
8
+ export declare const DisplayViewDropDown: ({ onViewModeChange, viewMode, }: DisplayViewDropDownProps) => jsx.JSX.Element;
@@ -19,12 +19,22 @@ export declare const modalMessages: {
19
19
  description: string;
20
20
  defaultMessage: string;
21
21
  };
22
- issueViewModeLabel: {
22
+ tableViewModeLabel: {
23
23
  id: string;
24
24
  description: string;
25
25
  defaultMessage: string;
26
26
  };
27
- countViewModeLabel: {
27
+ tableViewModeDescription: {
28
+ id: string;
29
+ description: string;
30
+ defaultMessage: string;
31
+ };
32
+ inlineLinkViewModeLabel: {
33
+ id: string;
34
+ description: string;
35
+ defaultMessage: string;
36
+ };
37
+ inlineLinkViewModeDescription: {
28
38
  id: string;
29
39
  description: string;
30
40
  defaultMessage: string;
@@ -4,6 +4,11 @@ export declare const modalMessages: {
4
4
  description: string;
5
5
  defaultMessage: string;
6
6
  };
7
+ updateObjectsButtonText: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
7
12
  insertIssuesButtonText: {
8
13
  id: string;
9
14
  description: string;
@@ -22,6 +22,5 @@ export interface RowCellType {
22
22
  content?: React.ReactNode | string;
23
23
  }
24
24
  export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
25
- export declare const COLUMN_MIN_WIDTH: number;
26
25
  export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
27
26
  export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
@@ -5,6 +5,15 @@ export declare const Table: import("@emotion/styled").StyledComponent<{
5
5
  theme?: import("@emotion/react").Theme | undefined;
6
6
  as?: import("react").ElementType<any> | undefined;
7
7
  }, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
8
+ /**
9
+ * This is a hack used to override styles that are leaking to our table html element
10
+ * from editor table plugin.
11
+ * This css prefix can be used in front of our main css rule to make its weight bigger
12
+ * and force make browser use it first and editor plugin css second.
13
+ */
14
+ export declare const withTablePluginPrefix: (tableSection: 'thead' | 'tbody' | '', mainRule?: string) => string;
15
+ export declare const withTablePluginHeaderPrefix: (mainRule?: string | undefined) => string;
16
+ export declare const withTablePluginBodyPrefix: (mainRule?: string | undefined) => string;
8
17
  export declare const TableHeading: import("@emotion/styled").StyledComponent<{
9
18
  theme?: import("@emotion/react").Theme | undefined;
10
19
  as?: import("react").ElementType<any> | undefined;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ export declare const COLUMN_BASE_WIDTH = 8;
3
+ export declare const COLUMN_MIN_WIDTH: number;
4
+ export type GetWidthCss = (arg: {
5
+ shouldUseWidth: boolean;
6
+ width: number;
7
+ }) => React.CSSProperties;
8
+ /**
9
+ * Generate width related portion of css for table cell.
10
+ *
11
+ * @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
12
+ * or rather default width that should be treated as a maximum width. When table inserted initially
13
+ * and no user custom width defined we set this value to `false`. As soon as user changes any of the
14
+ * column widths we treat all width as custom hardcoded widths.
15
+ * @param width
16
+ */
17
+ export declare const getWidthCss: GetWidthCss;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { JiraIssueViewModes } from '../../types';
4
+ export type DisplayViewDropDownProps = {
5
+ onViewModeChange: (value: JiraIssueViewModes) => void;
6
+ viewMode: JiraIssueViewModes;
7
+ };
8
+ export declare const DisplayViewDropDown: ({ onViewModeChange, viewMode, }: DisplayViewDropDownProps) => jsx.JSX.Element;
@@ -19,12 +19,22 @@ export declare const modalMessages: {
19
19
  description: string;
20
20
  defaultMessage: string;
21
21
  };
22
- issueViewModeLabel: {
22
+ tableViewModeLabel: {
23
23
  id: string;
24
24
  description: string;
25
25
  defaultMessage: string;
26
26
  };
27
- countViewModeLabel: {
27
+ tableViewModeDescription: {
28
+ id: string;
29
+ description: string;
30
+ defaultMessage: string;
31
+ };
32
+ inlineLinkViewModeLabel: {
33
+ id: string;
34
+ description: string;
35
+ defaultMessage: string;
36
+ };
37
+ inlineLinkViewModeDescription: {
28
38
  id: string;
29
39
  description: string;
30
40
  defaultMessage: string;