@atlaskit/link-datasource 7.12.3 → 7.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/dist/cjs/ui/common/modal/basic-search-input/index.js +8 -3
- package/dist/cjs/ui/common/modal/mode-switcher/ModeSwitcher.compiled.css +1 -0
- package/dist/cjs/ui/common/modal/mode-switcher/ModeSwitcher.js +3 -1
- package/dist/cjs/ui/common/modal/popup-select/index.js +34 -5
- package/dist/cjs/ui/common/modal/popup-select/useInlinePopupLayout.js +123 -0
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +9 -3
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -1
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +5 -1
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/JiraSearchContainerWithWrappers.js +19 -0
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/buildJQL.js +12 -2
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/embedded.compiled.css +11 -0
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/embedded.js +321 -0
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +12 -0
- package/dist/cjs/ui/jira-issues-modal/jql-editor/index.js +9 -1
- package/dist/cjs/ui/jira-search-state/index.compiled.css +12 -0
- package/dist/cjs/ui/jira-search-state/index.js +90 -0
- package/dist/es2019/ui/common/modal/basic-search-input/index.js +5 -2
- package/dist/es2019/ui/common/modal/mode-switcher/ModeSwitcher.compiled.css +1 -0
- package/dist/es2019/ui/common/modal/mode-switcher/ModeSwitcher.js +3 -1
- package/dist/es2019/ui/common/modal/popup-select/index.js +34 -4
- package/dist/es2019/ui/common/modal/popup-select/useInlinePopupLayout.js +103 -0
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -3
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +3 -1
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +4 -1
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/JiraSearchContainerWithWrappers.js +11 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/buildJQL.js +10 -2
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/embedded.compiled.css +11 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/embedded.js +283 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +12 -0
- package/dist/es2019/ui/jira-issues-modal/jql-editor/index.js +7 -1
- package/dist/es2019/ui/jira-search-state/index.compiled.css +12 -0
- package/dist/es2019/ui/jira-search-state/index.js +82 -0
- package/dist/esm/ui/common/modal/basic-search-input/index.js +8 -3
- package/dist/esm/ui/common/modal/mode-switcher/ModeSwitcher.compiled.css +1 -0
- package/dist/esm/ui/common/modal/mode-switcher/ModeSwitcher.js +3 -1
- package/dist/esm/ui/common/modal/popup-select/index.js +35 -5
- package/dist/esm/ui/common/modal/popup-select/useInlinePopupLayout.js +116 -0
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +9 -3
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -1
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +5 -1
- package/dist/esm/ui/jira-issues-modal/jira-search-container/JiraSearchContainerWithWrappers.js +13 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/buildJQL.js +12 -2
- package/dist/esm/ui/jira-issues-modal/jira-search-container/embedded.compiled.css +11 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/embedded.js +312 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +12 -0
- package/dist/esm/ui/jira-issues-modal/jql-editor/index.js +9 -1
- package/dist/esm/ui/jira-search-state/index.compiled.css +12 -0
- package/dist/esm/ui/jira-search-state/index.js +83 -0
- package/dist/types/ui/common/modal/basic-search-input/index.d.ts +5 -1
- package/dist/types/ui/common/modal/mode-switcher/ModeSwitcher.d.ts +1 -0
- package/dist/types/ui/common/modal/popup-select/index.d.ts +2 -1
- package/dist/types/ui/common/modal/popup-select/useInlinePopupLayout.d.ts +9 -0
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +5 -1
- package/dist/types/ui/datasource-table-view/types.d.ts +5 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/jira-search-container/JiraSearchContainerWithWrappers.d.ts +4 -0
- package/dist/types/ui/jira-issues-modal/jira-search-container/buildJQL.d.ts +1 -0
- package/dist/types/ui/jira-issues-modal/jira-search-container/embedded.d.ts +9 -0
- package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +11 -0
- package/dist/types/ui/jira-issues-modal/jql-editor/index.d.ts +4 -1
- package/dist/types/ui/jira-search-state/index.d.ts +9 -0
- package/jira-search-container/package.json +10 -0
- package/jira-search-state/package.json +10 -0
- package/package.json +3 -3
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import Heading from '@atlaskit/heading/heading';
|
|
8
|
+
import IntlMessagesProvider from '@atlaskit/intl-messages-provider/main';
|
|
9
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
10
|
+
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
11
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
12
|
+
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
13
|
+
import { RichIconSearch } from '../../common/ui/rich-icon/search';
|
|
14
|
+
import { SpotSearchNoResult } from '../../common/ui/spot/error-state/search-no-result';
|
|
15
|
+
import { fetchMessagesForLocale } from '../../common/utils/locale/fetch-messages-for-locale';
|
|
16
|
+
import i18nEN from '../../i18n/en';
|
|
17
|
+
import { loadingErrorMessages } from '../common/error-state/messages';
|
|
18
|
+
import { initialStateViewMessages } from '../common/initial-state-view/messages';
|
|
19
|
+
import EmptyState from '../issue-like-table/empty-state';
|
|
20
|
+
const messages = defineMessages({
|
|
21
|
+
loading: {
|
|
22
|
+
id: 'link-datasource.jira-search-state.loading',
|
|
23
|
+
defaultMessage: 'Searching for work items…',
|
|
24
|
+
description: 'Loading label while an embedded Jira work-item search is running.'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const styles = {
|
|
28
|
+
loading: "_1reo15vq _18m915vq _4t3i1osq",
|
|
29
|
+
canvas: "_1rjcpxbi _18zrpxbi _1tkeva7c",
|
|
30
|
+
compactCanvas: "_1tke194s",
|
|
31
|
+
resolvedEmpty: "_j7hq1bym _5sag1ign _1pglindk _bl8aglyw",
|
|
32
|
+
content: "_p12f1gwv _y3gn1h6o"
|
|
33
|
+
};
|
|
34
|
+
const SearchState = ({
|
|
35
|
+
variant,
|
|
36
|
+
isCompact = false
|
|
37
|
+
}) => {
|
|
38
|
+
const {
|
|
39
|
+
formatMessage
|
|
40
|
+
} = useIntl();
|
|
41
|
+
const isEmpty = variant === 'empty';
|
|
42
|
+
if (variant === 'loading') {
|
|
43
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
44
|
+
xcss: styles.loading,
|
|
45
|
+
testId: "jira-search-state-loading"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, formatMessage(messages.loading)), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
"aria-hidden": "true"
|
|
48
|
+
}, /*#__PURE__*/React.createElement(EmptyState, {
|
|
49
|
+
isCompact: true,
|
|
50
|
+
testId: "jira-search-table-skeleton"
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
54
|
+
direction: "column",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
justifyContent: "center",
|
|
57
|
+
gap: isCompact ? 'space.100' : 'space.200',
|
|
58
|
+
xcss: cx(styles.canvas, isCompact && styles.compactCanvas, isEmpty && styles.resolvedEmpty),
|
|
59
|
+
testId: `jira-search-state-${variant}`
|
|
60
|
+
}, isEmpty ? /*#__PURE__*/React.createElement(SpotSearchNoResult, {
|
|
61
|
+
size: isCompact ? 'large' : 'xlarge',
|
|
62
|
+
alt: ""
|
|
63
|
+
}) : /*#__PURE__*/React.createElement(RichIconSearch, {
|
|
64
|
+
size: isCompact ? 'large' : 'xlarge',
|
|
65
|
+
alt: ""
|
|
66
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
67
|
+
xcss: styles.content
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
69
|
+
as: "h3",
|
|
70
|
+
size: "small"
|
|
71
|
+
}, formatMessage(isEmpty ? loadingErrorMessages.noResultsFound : initialStateViewMessages.jiraSearchTitle))), /*#__PURE__*/React.createElement(Box, {
|
|
72
|
+
xcss: styles.content
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
74
|
+
color: "color.text.subtle"
|
|
75
|
+
}, formatMessage(isEmpty ? loadingErrorMessages.noResultsFoundDescription : initialStateViewMessages.searchDescriptionForBasicSearchSllv))));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Reuses the work-item picker's illustrations and copy without emitting datasource analytics. */
|
|
79
|
+
export const JiraSearchState = props => /*#__PURE__*/React.createElement(IntlMessagesProvider, {
|
|
80
|
+
defaultMessages: i18nEN,
|
|
81
|
+
loaderFn: fetchMessagesForLocale
|
|
82
|
+
}, /*#__PURE__*/React.createElement(SearchState, props));
|
|
@@ -17,11 +17,15 @@ var styles = {
|
|
|
17
17
|
var formStyles = null;
|
|
18
18
|
var formWithMaxWidthStyles = null;
|
|
19
19
|
export var BasicSearchInput = function BasicSearchInput(_ref) {
|
|
20
|
-
var
|
|
20
|
+
var _ref$isCompact = _ref.isCompact,
|
|
21
|
+
isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
|
|
22
|
+
isDisabled = _ref.isDisabled,
|
|
21
23
|
isSearching = _ref.isSearching,
|
|
22
24
|
onChange = _ref.onChange,
|
|
23
25
|
onSearch = _ref.onSearch,
|
|
24
26
|
searchTerm = _ref.searchTerm,
|
|
27
|
+
_ref$showSearchButton = _ref.showSearchButton,
|
|
28
|
+
showSearchButton = _ref$showSearchButton === void 0 ? true : _ref$showSearchButton,
|
|
25
29
|
fullWidth = _ref.fullWidth,
|
|
26
30
|
testId = _ref.testId,
|
|
27
31
|
ariaLabel = _ref.ariaLabel;
|
|
@@ -41,7 +45,8 @@ export var BasicSearchInput = function BasicSearchInput(_ref) {
|
|
|
41
45
|
onSubmit: handleFormSubmit,
|
|
42
46
|
className: ax([fullWidth ? "_16jlkb7n _1o9zkb7n _i0dlf1ug" : "_16jlkb7n _1o9zkb7n _i0dlf1ug _p12f1mjv"])
|
|
43
47
|
}, /*#__PURE__*/React.createElement(Textfield, {
|
|
44
|
-
|
|
48
|
+
isCompact: isCompact,
|
|
49
|
+
elemAfterInput: showSearchButton ? /*#__PURE__*/React.createElement(Box, {
|
|
45
50
|
xcss: styles.searchButtonContainer
|
|
46
51
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
47
52
|
appearance: "primary",
|
|
@@ -58,7 +63,7 @@ export var BasicSearchInput = function BasicSearchInput(_ref) {
|
|
|
58
63
|
isDisabled: isDisabled,
|
|
59
64
|
testId: "".concat(testId, "--basic-search-button"),
|
|
60
65
|
onClick: handleSearchWithAnalytics
|
|
61
|
-
})),
|
|
66
|
+
})) : undefined,
|
|
62
67
|
autoFocus: true,
|
|
63
68
|
onChange: onChange,
|
|
64
69
|
testId: "".concat(testId, "--basic-search-input"),
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}
|
|
8
8
|
._1h6dq98m{border-color:var(--ds-border-selected,#1868db)}
|
|
9
9
|
._18u0v47k{margin-left:var(--ds-space-250,20px)}
|
|
10
|
+
._18u0ze3t{margin-left:var(--ds-space-0,0)}
|
|
10
11
|
._19bv1b66{padding-left:var(--ds-space-050,4px)}
|
|
11
12
|
._19bvutpp{padding-left:var(--ds-space-150,9pt)}
|
|
12
13
|
._1bah1h6o{justify-content:center}
|
|
@@ -6,6 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
7
7
|
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
8
8
|
var modeSwitcherStyles = null;
|
|
9
|
+
var inlineModeSwitcherStyles = null;
|
|
9
10
|
var compactModeSwitcherStyles = null;
|
|
10
11
|
var modeFocusStyles = null;
|
|
11
12
|
var modeSwitcherLabelStyles = null;
|
|
@@ -16,6 +17,7 @@ var compactModeSwitcherLabelStyles = null;
|
|
|
16
17
|
export var ModeSwitcher = function ModeSwitcher(props) {
|
|
17
18
|
var _options$;
|
|
18
19
|
var isCompact = props.isCompact,
|
|
20
|
+
isInline = props.isInline,
|
|
19
21
|
isDisabled = props.isDisabled,
|
|
20
22
|
onOptionValueChange = props.onOptionValueChange,
|
|
21
23
|
options = props.options,
|
|
@@ -27,7 +29,7 @@ export var ModeSwitcher = function ModeSwitcher(props) {
|
|
|
27
29
|
return options.length > 0 ? /*#__PURE__*/React.createElement("fieldset", {
|
|
28
30
|
"data-testid": "mode-toggle-container",
|
|
29
31
|
disabled: isDisabled,
|
|
30
|
-
className: ax(["_2rko1b66 _1h6d1l7x _189ee4h9 _1dqonqa1 _4cvr1h6o _vchhusvi _1e0c116y _u5f31b66 _19bv1b66 _18u0v47k _4t3izwfg _1j55105o", isCompact && "_zulpv77o _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66"])
|
|
32
|
+
className: ax(["_2rko1b66 _1h6d1l7x _189ee4h9 _1dqonqa1 _4cvr1h6o _vchhusvi _1e0c116y _u5f31b66 _19bv1b66 _18u0v47k _4t3izwfg _1j55105o", isCompact && "_zulpv77o _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66", isInline && "_18u0ze3t"])
|
|
31
33
|
}, options.map(function (_ref) {
|
|
32
34
|
var value = _ref.value,
|
|
33
35
|
label = _ref.label,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
5
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
7
7
|
var _excluded = ["isOpen"];
|
|
8
8
|
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; }
|
|
9
9
|
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,11 +21,40 @@ import formatOptionLabel from './formatOptionLabel';
|
|
|
21
21
|
import CustomMenuList from './menu-list';
|
|
22
22
|
import { asyncPopupSelectMessages } from './messages';
|
|
23
23
|
import PopupTrigger from './trigger';
|
|
24
|
+
import { useInlinePopupLayout } from './useInlinePopupLayout';
|
|
25
|
+
|
|
24
26
|
// Needed to disable filtering from react-select
|
|
25
27
|
var noFilterOptions = function noFilterOptions() {
|
|
26
28
|
return true;
|
|
27
29
|
};
|
|
28
|
-
export var FilterPopupSelect = function FilterPopupSelect(
|
|
30
|
+
export var FilterPopupSelect = function FilterPopupSelect(props) {
|
|
31
|
+
return props.isInline ? /*#__PURE__*/React.createElement(InlineFilterPopupSelect, props) : /*#__PURE__*/React.createElement(FilterPopupSelectBase, props);
|
|
32
|
+
};
|
|
33
|
+
var InlineFilterPopupSelect = function InlineFilterPopupSelect(props) {
|
|
34
|
+
var popupRef = useRef(null);
|
|
35
|
+
var layout = useInlinePopupLayout(true, popupRef);
|
|
36
|
+
var onMenuOpen = props.onMenuOpen,
|
|
37
|
+
onMenuClose = props.onMenuClose;
|
|
38
|
+
var handleOpen = useCallback(function () {
|
|
39
|
+
layout.onOpen();
|
|
40
|
+
onMenuOpen === null || onMenuOpen === void 0 || onMenuOpen();
|
|
41
|
+
}, [layout.onOpen, onMenuOpen]);
|
|
42
|
+
var handleClose = useCallback(function () {
|
|
43
|
+
layout.onClose();
|
|
44
|
+
onMenuClose === null || onMenuClose === void 0 || onMenuClose();
|
|
45
|
+
}, [layout.onClose, onMenuClose]);
|
|
46
|
+
return /*#__PURE__*/React.createElement(FilterPopupSelectBase, _extends({}, props, {
|
|
47
|
+
onMenuOpen: handleOpen,
|
|
48
|
+
onMenuClose: handleClose,
|
|
49
|
+
inlinePopupProps: {
|
|
50
|
+
ref: popupRef,
|
|
51
|
+
maxMenuHeight: layout.maxMenuHeight,
|
|
52
|
+
minMenuHeight: 0,
|
|
53
|
+
popperProps: layout.popperProps
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
var FilterPopupSelectBase = function FilterPopupSelectBase(_ref) {
|
|
29
58
|
var filterName = _ref.filterName,
|
|
30
59
|
_ref$totalCount = _ref.totalCount,
|
|
31
60
|
totalCount = _ref$totalCount === void 0 ? 0 : _ref$totalCount,
|
|
@@ -46,7 +75,8 @@ export var FilterPopupSelect = function FilterPopupSelect(_ref) {
|
|
|
46
75
|
onSelectionChange = _ref.onSelectionChange,
|
|
47
76
|
onInputChange = _ref.onInputChange,
|
|
48
77
|
onMenuClose = _ref.onMenuClose,
|
|
49
|
-
onMenuOpen = _ref.onMenuOpen
|
|
78
|
+
onMenuOpen = _ref.onMenuOpen,
|
|
79
|
+
inlinePopupProps = _ref.inlinePopupProps;
|
|
50
80
|
var _useIntl = useIntl(),
|
|
51
81
|
formatMessage = _useIntl.formatMessage;
|
|
52
82
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
@@ -162,7 +192,7 @@ export var FilterPopupSelect = function FilterPopupSelect(_ref) {
|
|
|
162
192
|
sortPaginatedResults.current = true;
|
|
163
193
|
}
|
|
164
194
|
}, [status]);
|
|
165
|
-
return /*#__PURE__*/React.createElement(PopupSelect, {
|
|
195
|
+
return /*#__PURE__*/React.createElement(PopupSelect, _extends({}, inlinePopupProps, {
|
|
166
196
|
isMulti: true,
|
|
167
197
|
maxMenuWidth: 300,
|
|
168
198
|
minMenuWidth: 300,
|
|
@@ -230,5 +260,5 @@ export var FilterPopupSelect = function FilterPopupSelect(_ref) {
|
|
|
230
260
|
totalCount: totalCount,
|
|
231
261
|
filterName: filterName
|
|
232
262
|
})
|
|
233
|
-
});
|
|
263
|
+
}));
|
|
234
264
|
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
var VIEWPORT_PADDING = 8;
|
|
4
|
+
var TRIGGER_GAP = 8;
|
|
5
|
+
var MAX_MENU_HEIGHT = 300;
|
|
6
|
+
var MIN_PREFERRED_SPACE = 180;
|
|
7
|
+
// Reserve the footer and container padding until the open popup can be measured.
|
|
8
|
+
var INITIAL_EXTRA_HEIGHT = 72;
|
|
9
|
+
var INITIAL_CONTROL_HEIGHT = 48;
|
|
10
|
+
var viewportModifiers = [{
|
|
11
|
+
name: 'offset',
|
|
12
|
+
options: {
|
|
13
|
+
offset: [0, TRIGGER_GAP]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
// Placement and height are calculated together; flipping independently can clip the search box.
|
|
17
|
+
{
|
|
18
|
+
name: 'flip',
|
|
19
|
+
enabled: false
|
|
20
|
+
}, {
|
|
21
|
+
name: 'preventOverflow',
|
|
22
|
+
enabled: true,
|
|
23
|
+
options: {
|
|
24
|
+
rootBoundary: 'viewport',
|
|
25
|
+
padding: VIEWPORT_PADDING,
|
|
26
|
+
altAxis: true,
|
|
27
|
+
tether: false
|
|
28
|
+
}
|
|
29
|
+
}];
|
|
30
|
+
export function useInlinePopupLayout(isInline, popupRef) {
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isOpen = _useState2[0],
|
|
34
|
+
setIsOpen = _useState2[1];
|
|
35
|
+
var _useState3 = useState({
|
|
36
|
+
maxMenuHeight: MAX_MENU_HEIGHT,
|
|
37
|
+
placement: 'bottom-start'
|
|
38
|
+
}),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
layout = _useState4[0],
|
|
41
|
+
setLayout = _useState4[1];
|
|
42
|
+
var updateLayout = useCallback(function () {
|
|
43
|
+
var _viewport$offsetTop, _viewport$height, _popup$selectRef$sele, _popup$selectRef;
|
|
44
|
+
var popup = popupRef.current;
|
|
45
|
+
var trigger = popup === null || popup === void 0 ? void 0 : popup.targetRef;
|
|
46
|
+
if (!isInline || !trigger) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var viewport = window.visualViewport;
|
|
50
|
+
var viewportTop = (_viewport$offsetTop = viewport === null || viewport === void 0 ? void 0 : viewport.offsetTop) !== null && _viewport$offsetTop !== void 0 ? _viewport$offsetTop : 0;
|
|
51
|
+
var viewportBottom = viewportTop + ((_viewport$height = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height !== void 0 ? _viewport$height : window.innerHeight);
|
|
52
|
+
var rect = trigger.getBoundingClientRect();
|
|
53
|
+
var below = Math.max(0, viewportBottom - rect.bottom - TRIGGER_GAP - VIEWPORT_PADDING);
|
|
54
|
+
var above = Math.max(0, rect.top - viewportTop - TRIGGER_GAP - VIEWPORT_PADDING);
|
|
55
|
+
var placement = below >= MIN_PREFERRED_SPACE || below >= above ? 'bottom-start' : 'top-start';
|
|
56
|
+
var available = placement === 'bottom-start' ? below : above;
|
|
57
|
+
var menu = popup.menuRef;
|
|
58
|
+
var list = menu === null || menu === void 0 ? void 0 : menu.querySelector('[role="listbox"]');
|
|
59
|
+
var controlHeight = (_popup$selectRef$sele = (_popup$selectRef = popup.selectRef) === null || _popup$selectRef === void 0 || (_popup$selectRef = _popup$selectRef.select) === null || _popup$selectRef === void 0 || (_popup$selectRef = _popup$selectRef.controlRef) === null || _popup$selectRef === void 0 ? void 0 : _popup$selectRef.offsetHeight) !== null && _popup$selectRef$sele !== void 0 ? _popup$selectRef$sele : INITIAL_CONTROL_HEIGHT;
|
|
60
|
+
// PopupSelect already subtracts the search control from maxMenuHeight. Reserve the
|
|
61
|
+
// remaining chrome separately, including the pagination footer outside its scroll area.
|
|
62
|
+
var extraHeight = menu && list ? Math.max(0, menu.offsetHeight - list.offsetHeight - controlHeight) : INITIAL_EXTRA_HEIGHT;
|
|
63
|
+
var maxMenuHeight = Math.max(controlHeight, Math.min(MAX_MENU_HEIGHT, available - extraHeight));
|
|
64
|
+
setLayout(function (previous) {
|
|
65
|
+
return previous.placement === placement && previous.maxMenuHeight === maxMenuHeight ? previous : {
|
|
66
|
+
placement: placement,
|
|
67
|
+
maxMenuHeight: maxMenuHeight
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}, [isInline, popupRef]);
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
var _popupRef$current;
|
|
73
|
+
if (!isInline || !isOpen) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
updateLayout();
|
|
77
|
+
var viewport = window.visualViewport;
|
|
78
|
+
var observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(updateLayout);
|
|
79
|
+
var menu = (_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.menuRef;
|
|
80
|
+
if (menu) {
|
|
81
|
+
observer === null || observer === void 0 || observer.observe(menu);
|
|
82
|
+
}
|
|
83
|
+
window.addEventListener('resize', updateLayout);
|
|
84
|
+
window.addEventListener('scroll', updateLayout, true);
|
|
85
|
+
viewport === null || viewport === void 0 || viewport.addEventListener('resize', updateLayout);
|
|
86
|
+
viewport === null || viewport === void 0 || viewport.addEventListener('scroll', updateLayout);
|
|
87
|
+
return function () {
|
|
88
|
+
observer === null || observer === void 0 || observer.disconnect();
|
|
89
|
+
window.removeEventListener('resize', updateLayout);
|
|
90
|
+
window.removeEventListener('scroll', updateLayout, true);
|
|
91
|
+
viewport === null || viewport === void 0 || viewport.removeEventListener('resize', updateLayout);
|
|
92
|
+
viewport === null || viewport === void 0 || viewport.removeEventListener('scroll', updateLayout);
|
|
93
|
+
};
|
|
94
|
+
}, [isInline, isOpen, popupRef, updateLayout]);
|
|
95
|
+
var onOpen = useCallback(function () {
|
|
96
|
+
if (isInline) {
|
|
97
|
+
updateLayout();
|
|
98
|
+
setIsOpen(true);
|
|
99
|
+
}
|
|
100
|
+
}, [isInline, updateLayout]);
|
|
101
|
+
var onClose = useCallback(function () {
|
|
102
|
+
return setIsOpen(false);
|
|
103
|
+
}, []);
|
|
104
|
+
var popperProps = useMemo(function () {
|
|
105
|
+
return {
|
|
106
|
+
placement: layout.placement,
|
|
107
|
+
modifiers: viewportModifiers
|
|
108
|
+
};
|
|
109
|
+
}, [layout.placement]);
|
|
110
|
+
return {
|
|
111
|
+
onOpen: onOpen,
|
|
112
|
+
onClose: onClose,
|
|
113
|
+
maxMenuHeight: isInline ? layout.maxMenuHeight : undefined,
|
|
114
|
+
popperProps: isInline ? popperProps : undefined
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -46,7 +46,10 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
46
46
|
onWrappedColumnsChange = _ref.onWrappedColumnsChange,
|
|
47
47
|
_ref$scrollableContai = _ref.scrollableContainerHeight,
|
|
48
48
|
scrollableContainerHeight = _ref$scrollableContai === void 0 ? DefaultScrollableContainerHeight : _ref$scrollableContai,
|
|
49
|
-
onRequestSettled = _ref.onRequestSettled
|
|
49
|
+
onRequestSettled = _ref.onRequestSettled,
|
|
50
|
+
_ref$enableRequestSet = _ref.enableRequestSettled,
|
|
51
|
+
enableRequestSettled = _ref$enableRequestSet === void 0 ? false : _ref$enableRequestSet,
|
|
52
|
+
renderEmptyState = _ref.renderEmptyState;
|
|
50
53
|
// Local copy lets us apply in-session sort mutations without mutating external parameters.
|
|
51
54
|
var _useState = useState(parameters),
|
|
52
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -141,7 +144,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
141
144
|
// settled request is reported exactly once.
|
|
142
145
|
var lastSettledResultRef = useRef(null);
|
|
143
146
|
useEffect(function () {
|
|
144
|
-
if (!fg('platform_lp_sllv_on_request_settled')) {
|
|
147
|
+
if (!fg('platform_lp_sllv_on_request_settled') && !enableRequestSettled) {
|
|
145
148
|
return;
|
|
146
149
|
}
|
|
147
150
|
if (status !== 'resolved' && status !== 'rejected' && status !== 'unauthorized' && status !== 'forbidden') {
|
|
@@ -158,7 +161,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
158
161
|
}
|
|
159
162
|
lastSettledResultRef.current = result;
|
|
160
163
|
onRequestSettled === null || onRequestSettled === void 0 || onRequestSettled(result);
|
|
161
|
-
}, [status, responseItems.length, totalCount, onRequestSettled]);
|
|
164
|
+
}, [status, responseItems.length, totalCount, onRequestSettled, enableRequestSettled]);
|
|
162
165
|
useEffect(function () {
|
|
163
166
|
var shouldStartUfoExperience = datasourceId && parameters && visibleColumnKeys && status === 'loading';
|
|
164
167
|
if (shouldStartUfoExperience) {
|
|
@@ -206,6 +209,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
206
209
|
});
|
|
207
210
|
}, [reset]);
|
|
208
211
|
var isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
212
|
+
if (isResolvedWithNoResults && renderEmptyState) {
|
|
213
|
+
return renderEmptyState();
|
|
214
|
+
}
|
|
209
215
|
// With columns available the table can keep its headers and footer and show the empty state
|
|
210
216
|
// in place of the rows, instead of replacing the whole view with it.
|
|
211
217
|
var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns;
|
|
@@ -17,7 +17,9 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
17
17
|
_ref$onSelectionChang = _ref.onSelectionChange,
|
|
18
18
|
onSelectionChange = _ref$onSelectionChang === void 0 ? function () {} : _ref$onSelectionChang,
|
|
19
19
|
_ref$isDisabled = _ref.isDisabled,
|
|
20
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled
|
|
20
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
21
|
+
_ref$isInline = _ref.isInline,
|
|
22
|
+
isInline = _ref$isInline === void 0 ? false : _ref$isInline;
|
|
21
23
|
var _useIntl = useIntl(),
|
|
22
24
|
formatMessage = _useIntl.formatMessage;
|
|
23
25
|
var _useState = useState(''),
|
|
@@ -109,6 +111,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
109
111
|
var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
|
|
110
112
|
var triggerButtonLabel = formatMessage(asyncPopupSelectMessages["".concat(filterType, "Label")]);
|
|
111
113
|
return /*#__PURE__*/React.createElement(FilterPopupSelect, {
|
|
114
|
+
isInline: isInline,
|
|
112
115
|
filterName: filterName,
|
|
113
116
|
status: status,
|
|
114
117
|
showLoading: isLoading,
|
|
@@ -14,7 +14,9 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
|
|
|
14
14
|
site = _ref.site,
|
|
15
15
|
onChange = _ref.onChange,
|
|
16
16
|
selections = _ref.selections,
|
|
17
|
-
isJQLHydrating = _ref.isJQLHydrating
|
|
17
|
+
isJQLHydrating = _ref.isJQLHydrating,
|
|
18
|
+
_ref$isInline = _ref.isInline,
|
|
19
|
+
isInline = _ref$isInline === void 0 ? false : _ref$isInline;
|
|
18
20
|
var extractedFilterValues = useMemo(function () {
|
|
19
21
|
return isJQLHydrating ? extractValuesFromNonComplexJQL(jql) : {};
|
|
20
22
|
}, [isJQLHydrating, jql]);
|
|
@@ -23,11 +25,13 @@ var BasicFilterContainer = function BasicFilterContainer(_ref) {
|
|
|
23
25
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
24
26
|
xcss: styles.basicFilterContainerStyles,
|
|
25
27
|
gap: "space.100",
|
|
28
|
+
wrap: isInline ? 'wrap' : 'nowrap',
|
|
26
29
|
testId: "jlol-basic-filter-container"
|
|
27
30
|
}, availableBasicFilterTypes.map(function (filter) {
|
|
28
31
|
var _extractedFilterValue;
|
|
29
32
|
var shouldShowHydrationLoader = isJQLHydrating && ((_extractedFilterValue = extractedFilterValues[filter]) === null || _extractedFilterValue === void 0 ? void 0 : _extractedFilterValue.length) > 0;
|
|
30
33
|
return /*#__PURE__*/React.createElement(AsyncPopupSelect, {
|
|
34
|
+
isInline: isInline,
|
|
31
35
|
site: site,
|
|
32
36
|
filterType: filter,
|
|
33
37
|
key: filter,
|
package/dist/esm/ui/jira-issues-modal/jira-search-container/JiraSearchContainerWithWrappers.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import IntlMessagesProvider from '@atlaskit/intl-messages-provider/main';
|
|
3
|
+
import { fetchMessagesForLocale } from '../../../common/utils/locale/fetch-messages-for-locale';
|
|
4
|
+
import i18nEN from '../../../i18n/en';
|
|
5
|
+
import { JiraSearchContainer as SearchContainer } from './index';
|
|
6
|
+
|
|
7
|
+
/** Embedded consumers need the same translated search controls as the configuration modal. */
|
|
8
|
+
export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(IntlMessagesProvider, {
|
|
10
|
+
defaultMessages: i18nEN,
|
|
11
|
+
loaderFn: fetchMessagesForLocale
|
|
12
|
+
}, /*#__PURE__*/React.createElement(SearchContainer, props));
|
|
13
|
+
};
|
|
@@ -12,6 +12,12 @@ export var fuzzyCharacter = '*';
|
|
|
12
12
|
var constructTerminalClause = function constructTerminalClause(field, operator, value) {
|
|
13
13
|
return creators.terminalClause(creators.field(field), creators.operator(operator), creators.valueOperand(value));
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
// The generic AST string sanitizer quotes values but does not escape backslashes.
|
|
17
|
+
// Embedded keyword search accepts literal user text, so quote both delimiters explicitly.
|
|
18
|
+
var escapedValueOperand = function escapedValueOperand(value) {
|
|
19
|
+
return creators.byText.valueOperand("\"".concat(value.replace(/\\/g, '\\\\').replace(/"/g, '\\"'), "\""));
|
|
20
|
+
};
|
|
15
21
|
export var buildJQL = function buildJQL(input) {
|
|
16
22
|
/**
|
|
17
23
|
* Jql ast - Transforming the ast
|
|
@@ -20,6 +26,7 @@ export var buildJQL = function buildJQL(input) {
|
|
|
20
26
|
var jast = new JastBuilder().build('');
|
|
21
27
|
var query = jast.query;
|
|
22
28
|
var rawSearch = input.rawSearch,
|
|
29
|
+
textSearchField = input.textSearchField,
|
|
23
30
|
_input$orderDirection = input.orderDirection,
|
|
24
31
|
orderDirection = _input$orderDirection === void 0 ? ORDER_BY_DIRECTION_DESC : _input$orderDirection,
|
|
25
32
|
_input$orderKey = input.orderKey,
|
|
@@ -40,7 +47,10 @@ export var buildJQL = function buildJQL(input) {
|
|
|
40
47
|
if (!query) {
|
|
41
48
|
return '';
|
|
42
49
|
}
|
|
43
|
-
if (trimmedRawSearch) {
|
|
50
|
+
if (trimmedRawSearch && textSearchField === 'textfields') {
|
|
51
|
+
var suffix = /["*?]$/.test(trimmedRawSearch) ? '' : fuzzyCharacter;
|
|
52
|
+
query.appendClause(creators.terminalClause(creators.field('textfields'), creators.operator(OPERATOR_LIKE), escapedValueOperand("".concat(trimmedRawSearch).concat(suffix))), COMPOUND_OPERATOR_AND);
|
|
53
|
+
} else if (trimmedRawSearch) {
|
|
44
54
|
var fuzzy = !trimmedRawSearch.match(fuzzySearchRegExp) ? fuzzyCharacter : '';
|
|
45
55
|
var basicSearch = trimmedRawSearch.replace(/['"?*]+/g, '');
|
|
46
56
|
var text = constructTerminalClause('text', OPERATOR_LIKE, "".concat(basicSearch).concat(fuzzy));
|
|
@@ -62,7 +72,7 @@ export var buildJQL = function buildJQL(input) {
|
|
|
62
72
|
return;
|
|
63
73
|
}
|
|
64
74
|
var filterInClause = creators.terminalClause(creators.field(key), creators.operator(OPERATOR_IN), creators.listOperand(filterFieldValues.map(function (filterFieldValue) {
|
|
65
|
-
return creators.valueOperand(filterFieldValue.value);
|
|
75
|
+
return textSearchField ? escapedValueOperand(filterFieldValue.value) : creators.valueOperand(filterFieldValue.value);
|
|
66
76
|
})));
|
|
67
77
|
query.appendClause(filterInClause, COMPOUND_OPERATOR_AND);
|
|
68
78
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
._16jlkb7n{flex-grow:1}
|
|
2
|
+
._19pk1b66{margin-top:var(--ds-space-050,4px)}
|
|
3
|
+
._1bsb1osq{width:100%}
|
|
4
|
+
._1e0c1txw{display:flex}
|
|
5
|
+
._1n261g80{flex-wrap:wrap}
|
|
6
|
+
._1o9zidpf{flex-shrink:0}
|
|
7
|
+
._1p57u2gc{row-gap:var(--ds-space-100,8px)}
|
|
8
|
+
._1tket9kd{min-height:72px}
|
|
9
|
+
._1ul9idpf{min-width:0}
|
|
10
|
+
._4cvr1y6m{align-items:flex-start}
|
|
11
|
+
._i0dlghg7{flex-basis:240px}
|