@atlaskit/link-datasource 0.33.0 → 0.33.2
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 +12 -0
- package/dist/cjs/ui/assets-modal/search-container/aql-search-input/index.js +27 -2
- package/dist/cjs/ui/assets-modal/search-container/aql-search-input/messages.js +5 -0
- package/dist/cjs/ui/assets-modal/search-container/object-schema-select/index.js +27 -18
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/assets-modal/search-container/aql-search-input/index.js +28 -3
- package/dist/es2019/ui/assets-modal/search-container/aql-search-input/messages.js +5 -0
- package/dist/es2019/ui/assets-modal/search-container/object-schema-select/index.js +20 -10
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/assets-modal/search-container/aql-search-input/index.js +28 -3
- package/dist/esm/ui/assets-modal/search-container/aql-search-input/messages.js +5 -0
- package/dist/esm/ui/assets-modal/search-container/object-schema-select/index.js +23 -13
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/assets-modal/search-container/aql-search-input/messages.d.ts +5 -0
- package/dist/types/ui/assets-modal/search-container/object-schema-select/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/assets-modal/search-container/aql-search-input/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/assets-modal/search-container/object-schema-select/index.d.ts +11 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 0.33.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7e77ad40512`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7e77ad40512) - [ux] Add question mark to search field with link to aql docs
|
|
8
|
+
|
|
9
|
+
## 0.33.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`3c77a5b1377`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3c77a5b1377) - Change behaviour of Assets Config Modal schema select to fetch on mount
|
|
14
|
+
|
|
3
15
|
## 0.33.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -16,8 +16,11 @@ var _form = require("@atlaskit/form");
|
|
|
16
16
|
var _checkCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/check-circle"));
|
|
17
17
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-circle"));
|
|
18
18
|
var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
|
|
19
|
+
var _questionCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/question-circle"));
|
|
19
20
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
20
21
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
22
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
23
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
21
24
|
var _useValidateAqlText2 = require("../../../../hooks/useValidateAqlText");
|
|
22
25
|
var _types = require("../../../../types/assets/types");
|
|
23
26
|
var _styled = require("../styled");
|
|
@@ -27,6 +30,16 @@ var _messages = require("./messages");
|
|
|
27
30
|
/* Meta isn't exported in @atlaskit/form
|
|
28
31
|
Taken from packages/design-system/form/src/field.tsx */
|
|
29
32
|
|
|
33
|
+
var buttonBaseStyles = (0, _react2.css)({
|
|
34
|
+
display: 'flex',
|
|
35
|
+
height: '100%',
|
|
36
|
+
position: 'relative',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
flexDirection: 'column',
|
|
40
|
+
marginRight: "var(--ds-space-100, 0.5em)"
|
|
41
|
+
});
|
|
42
|
+
var AQLSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-assets-query-language-aql/';
|
|
30
43
|
var searchButtonStyles = (0, _react2.css)({
|
|
31
44
|
marginRight: "var(--ds-space-075, 6px)"
|
|
32
45
|
});
|
|
@@ -143,7 +156,19 @@ var AqlSearchInput = function AqlSearchInput(_ref) {
|
|
|
143
156
|
width: 24
|
|
144
157
|
}
|
|
145
158
|
}, renderValidatorIcon(fieldProps.value, error, meta)),
|
|
146
|
-
elemAfterInput: (0, _react2.jsx)(
|
|
159
|
+
elemAfterInput: (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_tooltip.default, {
|
|
160
|
+
content: formatMessage(_messages.searchInputMessages.helpTooltipText),
|
|
161
|
+
position: "bottom"
|
|
162
|
+
}, (0, _react2.jsx)("a", {
|
|
163
|
+
href: AQLSupportDocumentLink,
|
|
164
|
+
target: "_blank",
|
|
165
|
+
css: buttonBaseStyles
|
|
166
|
+
}, (0, _react2.jsx)(_questionCircle.default, {
|
|
167
|
+
label: "label",
|
|
168
|
+
primaryColor: "var(--ds-icon, ".concat(_colors.N500, ")"),
|
|
169
|
+
size: "medium",
|
|
170
|
+
testId: "assets-datasource-modal-help"
|
|
171
|
+
}))), (0, _react2.jsx)(_button.LoadingButton, {
|
|
147
172
|
appearance: "primary",
|
|
148
173
|
css: searchButtonStyles,
|
|
149
174
|
iconBefore: (0, _react2.jsx)(_search.default, {
|
|
@@ -154,7 +179,7 @@ var AqlSearchInput = function AqlSearchInput(_ref) {
|
|
|
154
179
|
spacing: "none",
|
|
155
180
|
testId: "assets-datasource-modal--aql-search-button",
|
|
156
181
|
type: "submit"
|
|
157
|
-
}),
|
|
182
|
+
})),
|
|
158
183
|
placeholder: formatMessage(_messages.searchInputMessages.placeholder),
|
|
159
184
|
testId: testId
|
|
160
185
|
}));
|
|
@@ -10,6 +10,11 @@ var searchInputMessages = (0, _reactIntlNext.defineMessages)({
|
|
|
10
10
|
id: 'linkDataSource.assets.configModal.aqlSearchInput.placeholder',
|
|
11
11
|
description: 'Display text for AQL search button',
|
|
12
12
|
defaultMessage: 'Search via AQL'
|
|
13
|
+
},
|
|
14
|
+
helpTooltipText: {
|
|
15
|
+
id: 'linkDataSource.assets.configModal.aqlSearchInput.helpTooltipText',
|
|
16
|
+
description: 'Link to AQL Syntax help document',
|
|
17
|
+
defaultMessage: 'Syntax help'
|
|
13
18
|
}
|
|
14
19
|
});
|
|
15
20
|
exports.searchInputMessages = searchInputMessages;
|
|
@@ -4,27 +4,44 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.SEARCH_DEBOUNCE_MS = exports.AssetsObjectSchemaSelect = void 0;
|
|
7
|
+
exports.selectInAModalStyleFixProps = exports.SEARCH_DEBOUNCE_MS = exports.AssetsObjectSchemaSelect = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
-
var
|
|
13
|
-
var _react = require("react");
|
|
14
|
-
var _react2 = require("@emotion/react");
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _react = require("@emotion/react");
|
|
15
14
|
var _debouncePromise = _interopRequireDefault(require("debounce-promise"));
|
|
16
15
|
var _reactIntlNext = require("react-intl-next");
|
|
17
16
|
var _form = require("@atlaskit/form");
|
|
18
17
|
var _select = require("@atlaskit/select");
|
|
18
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
19
19
|
var _useObjectSchemas2 = require("../../../../hooks/useObjectSchemas");
|
|
20
20
|
var _types = require("../../../../types/assets/types");
|
|
21
21
|
var _styled = require("../styled");
|
|
22
22
|
var _messages = require("./messages");
|
|
23
23
|
var _utils = require("./utils");
|
|
24
24
|
var _excluded = ["onChange", "onFocus"];
|
|
25
|
-
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
|
|
26
27
|
var SEARCH_DEBOUNCE_MS = 350;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
31
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
32
|
+
*/
|
|
27
33
|
exports.SEARCH_DEBOUNCE_MS = SEARCH_DEBOUNCE_MS;
|
|
34
|
+
var selectInAModalStyleFixProps = {
|
|
35
|
+
styles: {
|
|
36
|
+
menuPortal: function menuPortal(base) {
|
|
37
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
38
|
+
zIndex: _constants.layers.modal()
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
menuPortalTarget: document.body
|
|
43
|
+
};
|
|
44
|
+
exports.selectInAModalStyleFixProps = selectInAModalStyleFixProps;
|
|
28
45
|
var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
29
46
|
var value = _ref.value,
|
|
30
47
|
workspaceId = _ref.workspaceId,
|
|
@@ -35,10 +52,6 @@ var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
|
35
52
|
var _useObjectSchemas = (0, _useObjectSchemas2.useObjectSchemas)(workspaceId),
|
|
36
53
|
fetchObjectSchemas = _useObjectSchemas.fetchObjectSchemas,
|
|
37
54
|
objectSchemasLoading = _useObjectSchemas.objectSchemasLoading;
|
|
38
|
-
var _useState = (0, _react.useState)(undefined),
|
|
39
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
|
-
defaultOptions = _useState2[0],
|
|
41
|
-
setDefaultOptions = _useState2[1];
|
|
42
55
|
var selectedObjectSchema = value ? (0, _utils.objectSchemaToSelectOption)(value) : undefined;
|
|
43
56
|
var loadOptions = /*#__PURE__*/function () {
|
|
44
57
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(inputValue) {
|
|
@@ -71,7 +84,7 @@ var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
|
71
84
|
}
|
|
72
85
|
return undefined;
|
|
73
86
|
};
|
|
74
|
-
return (0,
|
|
87
|
+
return (0, _react.jsx)(_styled.FieldContainer, null, (0, _react.jsx)(_form.Field, {
|
|
75
88
|
name: _types.objectSchemaKey,
|
|
76
89
|
defaultValue: selectedObjectSchema,
|
|
77
90
|
validate: function validate(value) {
|
|
@@ -82,22 +95,18 @@ var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
|
82
95
|
_onChange = _ref3$fieldProps.onChange,
|
|
83
96
|
onFocus = _ref3$fieldProps.onFocus,
|
|
84
97
|
restFieldProps = (0, _objectWithoutProperties2.default)(_ref3$fieldProps, _excluded);
|
|
85
|
-
return (0,
|
|
98
|
+
return (0, _react.jsx)(_select.AsyncSelect, (0, _extends2.default)({
|
|
86
99
|
classNamePrefix: classNamePrefix,
|
|
87
100
|
isLoading: objectSchemasLoading,
|
|
88
|
-
defaultOptions:
|
|
101
|
+
defaultOptions: true // setting to true causes the loadOptions to be called on mount
|
|
102
|
+
,
|
|
89
103
|
isSearchable: true,
|
|
90
104
|
loadOptions: debouncedLoadOptions,
|
|
91
105
|
placeholder: formatMessage(_messages.objectSchemaSelectMessages.placeholder),
|
|
92
106
|
onChange: function onChange(newOption) {
|
|
93
107
|
return newOption && _onChange(newOption);
|
|
94
|
-
},
|
|
95
|
-
onFocus: function onFocus() {
|
|
96
|
-
if (!defaultOptions) {
|
|
97
|
-
loadOptions('').then(setDefaultOptions);
|
|
98
|
-
}
|
|
99
108
|
}
|
|
100
|
-
}, restFieldProps));
|
|
109
|
+
}, selectInAModalStyleFixProps, restFieldProps));
|
|
101
110
|
}));
|
|
102
111
|
};
|
|
103
112
|
exports.AssetsObjectSchemaSelect = AssetsObjectSchemaSelect;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { useCallback, useRef } from 'react';
|
|
3
|
+
import { Fragment, useCallback, useRef } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
import { LoadingButton } from '@atlaskit/button';
|
|
@@ -8,8 +8,11 @@ import { Field } from '@atlaskit/form';
|
|
|
8
8
|
import CheckCircleIcon from '@atlaskit/icon/glyph/check-circle';
|
|
9
9
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
10
10
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
11
|
+
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
11
12
|
import Spinner from '@atlaskit/spinner';
|
|
12
13
|
import Textfield from '@atlaskit/textfield';
|
|
14
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
15
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
13
16
|
import { useValidateAqlText } from '../../../../hooks/useValidateAqlText';
|
|
14
17
|
import { aqlKey } from '../../../../types/assets/types';
|
|
15
18
|
import { FieldContainer } from '../styled';
|
|
@@ -18,6 +21,16 @@ import { searchInputMessages } from './messages';
|
|
|
18
21
|
/* Meta isn't exported in @atlaskit/form
|
|
19
22
|
Taken from packages/design-system/form/src/field.tsx */
|
|
20
23
|
|
|
24
|
+
const buttonBaseStyles = css({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
height: '100%',
|
|
27
|
+
position: 'relative',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
marginRight: "var(--ds-space-100, 0.5em)"
|
|
32
|
+
});
|
|
33
|
+
const AQLSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-assets-query-language-aql/';
|
|
21
34
|
const searchButtonStyles = css({
|
|
22
35
|
marginRight: "var(--ds-space-075, 6px)"
|
|
23
36
|
});
|
|
@@ -113,7 +126,19 @@ export const AqlSearchInput = ({
|
|
|
113
126
|
width: 24
|
|
114
127
|
}
|
|
115
128
|
}, renderValidatorIcon(fieldProps.value, error, meta)),
|
|
116
|
-
elemAfterInput: jsx(
|
|
129
|
+
elemAfterInput: jsx(Fragment, null, jsx(Tooltip, {
|
|
130
|
+
content: formatMessage(searchInputMessages.helpTooltipText),
|
|
131
|
+
position: "bottom"
|
|
132
|
+
}, jsx("a", {
|
|
133
|
+
href: AQLSupportDocumentLink,
|
|
134
|
+
target: "_blank",
|
|
135
|
+
css: buttonBaseStyles
|
|
136
|
+
}, jsx(QuestionCircleIcon, {
|
|
137
|
+
label: "label",
|
|
138
|
+
primaryColor: `var(--ds-icon, ${N500})`,
|
|
139
|
+
size: "medium",
|
|
140
|
+
testId: "assets-datasource-modal-help"
|
|
141
|
+
}))), jsx(LoadingButton, {
|
|
117
142
|
appearance: "primary",
|
|
118
143
|
css: searchButtonStyles,
|
|
119
144
|
iconBefore: jsx(SearchIcon, {
|
|
@@ -124,7 +149,7 @@ export const AqlSearchInput = ({
|
|
|
124
149
|
spacing: "none",
|
|
125
150
|
testId: "assets-datasource-modal--aql-search-button",
|
|
126
151
|
type: "submit"
|
|
127
|
-
}),
|
|
152
|
+
})),
|
|
128
153
|
placeholder: formatMessage(searchInputMessages.placeholder),
|
|
129
154
|
testId: testId
|
|
130
155
|
}))));
|
|
@@ -4,5 +4,10 @@ export const searchInputMessages = defineMessages({
|
|
|
4
4
|
id: 'linkDataSource.assets.configModal.aqlSearchInput.placeholder',
|
|
5
5
|
description: 'Display text for AQL search button',
|
|
6
6
|
defaultMessage: 'Search via AQL'
|
|
7
|
+
},
|
|
8
|
+
helpTooltipText: {
|
|
9
|
+
id: 'linkDataSource.assets.configModal.aqlSearchInput.helpTooltipText',
|
|
10
|
+
description: 'Link to AQL Syntax help document',
|
|
11
|
+
defaultMessage: 'Syntax help'
|
|
7
12
|
}
|
|
8
13
|
});
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import debounce from 'debounce-promise';
|
|
6
6
|
import { useIntl } from 'react-intl-next';
|
|
7
7
|
import { Field } from '@atlaskit/form';
|
|
8
8
|
import { AsyncSelect } from '@atlaskit/select';
|
|
9
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
9
10
|
import { useObjectSchemas } from '../../../../hooks/useObjectSchemas';
|
|
10
11
|
import { objectSchemaKey } from '../../../../types/assets/types';
|
|
11
12
|
import { FieldContainer } from '../styled';
|
|
12
13
|
import { objectSchemaSelectMessages } from './messages';
|
|
13
14
|
import { objectSchemaToSelectOption } from './utils';
|
|
14
15
|
export const SEARCH_DEBOUNCE_MS = 350;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
19
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
20
|
+
*/
|
|
21
|
+
export const selectInAModalStyleFixProps = {
|
|
22
|
+
styles: {
|
|
23
|
+
menuPortal: base => ({
|
|
24
|
+
...base,
|
|
25
|
+
zIndex: layers.modal()
|
|
26
|
+
})
|
|
27
|
+
},
|
|
28
|
+
menuPortalTarget: document.body
|
|
29
|
+
};
|
|
15
30
|
export const AssetsObjectSchemaSelect = ({
|
|
16
31
|
value,
|
|
17
32
|
workspaceId,
|
|
@@ -24,7 +39,6 @@ export const AssetsObjectSchemaSelect = ({
|
|
|
24
39
|
fetchObjectSchemas,
|
|
25
40
|
objectSchemasLoading
|
|
26
41
|
} = useObjectSchemas(workspaceId);
|
|
27
|
-
const [defaultOptions, setDefaultOptions] = useState(undefined);
|
|
28
42
|
const selectedObjectSchema = value ? objectSchemaToSelectOption(value) : undefined;
|
|
29
43
|
const loadOptions = async inputValue => {
|
|
30
44
|
const objectSchemas = await fetchObjectSchemas(inputValue);
|
|
@@ -51,15 +65,11 @@ export const AssetsObjectSchemaSelect = ({
|
|
|
51
65
|
}) => jsx(AsyncSelect, _extends({
|
|
52
66
|
classNamePrefix: classNamePrefix,
|
|
53
67
|
isLoading: objectSchemasLoading,
|
|
54
|
-
defaultOptions:
|
|
68
|
+
defaultOptions: true // setting to true causes the loadOptions to be called on mount
|
|
69
|
+
,
|
|
55
70
|
isSearchable: true,
|
|
56
71
|
loadOptions: debouncedLoadOptions,
|
|
57
72
|
placeholder: formatMessage(objectSchemaSelectMessages.placeholder),
|
|
58
|
-
onChange: newOption => newOption && onChange(newOption)
|
|
59
|
-
|
|
60
|
-
if (!defaultOptions) {
|
|
61
|
-
loadOptions('').then(setDefaultOptions);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, restFieldProps))));
|
|
73
|
+
onChange: newOption => newOption && onChange(newOption)
|
|
74
|
+
}, selectInAModalStyleFixProps, restFieldProps))));
|
|
65
75
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
import { useCallback, useRef } from 'react';
|
|
5
|
+
import { Fragment, useCallback, useRef } from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import { LoadingButton } from '@atlaskit/button';
|
|
@@ -10,8 +10,11 @@ import { Field } from '@atlaskit/form';
|
|
|
10
10
|
import CheckCircleIcon from '@atlaskit/icon/glyph/check-circle';
|
|
11
11
|
import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
|
|
12
12
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
13
|
+
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
13
14
|
import Spinner from '@atlaskit/spinner';
|
|
14
15
|
import Textfield from '@atlaskit/textfield';
|
|
16
|
+
import { N500 } from '@atlaskit/theme/colors';
|
|
17
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
15
18
|
import { useValidateAqlText } from '../../../../hooks/useValidateAqlText';
|
|
16
19
|
import { aqlKey } from '../../../../types/assets/types';
|
|
17
20
|
import { FieldContainer } from '../styled';
|
|
@@ -20,6 +23,16 @@ import { searchInputMessages } from './messages';
|
|
|
20
23
|
/* Meta isn't exported in @atlaskit/form
|
|
21
24
|
Taken from packages/design-system/form/src/field.tsx */
|
|
22
25
|
|
|
26
|
+
var buttonBaseStyles = css({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
height: '100%',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
flexDirection: 'column',
|
|
33
|
+
marginRight: "var(--ds-space-100, 0.5em)"
|
|
34
|
+
});
|
|
35
|
+
var AQLSupportDocumentLink = 'https://support.atlassian.com/jira-service-management-cloud/docs/use-assets-query-language-aql/';
|
|
23
36
|
var searchButtonStyles = css({
|
|
24
37
|
marginRight: "var(--ds-space-075, 6px)"
|
|
25
38
|
});
|
|
@@ -135,7 +148,19 @@ export var AqlSearchInput = function AqlSearchInput(_ref) {
|
|
|
135
148
|
width: 24
|
|
136
149
|
}
|
|
137
150
|
}, renderValidatorIcon(fieldProps.value, error, meta)),
|
|
138
|
-
elemAfterInput: jsx(
|
|
151
|
+
elemAfterInput: jsx(Fragment, null, jsx(Tooltip, {
|
|
152
|
+
content: formatMessage(searchInputMessages.helpTooltipText),
|
|
153
|
+
position: "bottom"
|
|
154
|
+
}, jsx("a", {
|
|
155
|
+
href: AQLSupportDocumentLink,
|
|
156
|
+
target: "_blank",
|
|
157
|
+
css: buttonBaseStyles
|
|
158
|
+
}, jsx(QuestionCircleIcon, {
|
|
159
|
+
label: "label",
|
|
160
|
+
primaryColor: "var(--ds-icon, ".concat(N500, ")"),
|
|
161
|
+
size: "medium",
|
|
162
|
+
testId: "assets-datasource-modal-help"
|
|
163
|
+
}))), jsx(LoadingButton, {
|
|
139
164
|
appearance: "primary",
|
|
140
165
|
css: searchButtonStyles,
|
|
141
166
|
iconBefore: jsx(SearchIcon, {
|
|
@@ -146,7 +171,7 @@ export var AqlSearchInput = function AqlSearchInput(_ref) {
|
|
|
146
171
|
spacing: "none",
|
|
147
172
|
testId: "assets-datasource-modal--aql-search-button",
|
|
148
173
|
type: "submit"
|
|
149
|
-
}),
|
|
174
|
+
})),
|
|
150
175
|
placeholder: formatMessage(searchInputMessages.placeholder),
|
|
151
176
|
testId: testId
|
|
152
177
|
}));
|
|
@@ -4,5 +4,10 @@ export var searchInputMessages = defineMessages({
|
|
|
4
4
|
id: 'linkDataSource.assets.configModal.aqlSearchInput.placeholder',
|
|
5
5
|
description: 'Display text for AQL search button',
|
|
6
6
|
defaultMessage: 'Search via AQL'
|
|
7
|
+
},
|
|
8
|
+
helpTooltipText: {
|
|
9
|
+
id: 'linkDataSource.assets.configModal.aqlSearchInput.helpTooltipText',
|
|
10
|
+
description: 'Link to AQL Syntax help document',
|
|
11
|
+
defaultMessage: 'Syntax help'
|
|
7
12
|
}
|
|
8
13
|
});
|
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
-
import
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
var _excluded = ["onChange", "onFocus"];
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
9
|
/** @jsx jsx */
|
|
8
|
-
|
|
10
|
+
|
|
9
11
|
import { jsx } from '@emotion/react';
|
|
10
12
|
import debounce from 'debounce-promise';
|
|
11
13
|
import { useIntl } from 'react-intl-next';
|
|
12
14
|
import { Field } from '@atlaskit/form';
|
|
13
15
|
import { AsyncSelect } from '@atlaskit/select';
|
|
16
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
14
17
|
import { useObjectSchemas } from '../../../../hooks/useObjectSchemas';
|
|
15
18
|
import { objectSchemaKey } from '../../../../types/assets/types';
|
|
16
19
|
import { FieldContainer } from '../styled';
|
|
17
20
|
import { objectSchemaSelectMessages } from './messages';
|
|
18
21
|
import { objectSchemaToSelectOption } from './utils';
|
|
19
22
|
export var SEARCH_DEBOUNCE_MS = 350;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
26
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
27
|
+
*/
|
|
28
|
+
export var selectInAModalStyleFixProps = {
|
|
29
|
+
styles: {
|
|
30
|
+
menuPortal: function menuPortal(base) {
|
|
31
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
32
|
+
zIndex: layers.modal()
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
menuPortalTarget: document.body
|
|
37
|
+
};
|
|
20
38
|
export var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
21
39
|
var value = _ref.value,
|
|
22
40
|
workspaceId = _ref.workspaceId,
|
|
@@ -27,10 +45,6 @@ export var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
|
27
45
|
var _useObjectSchemas = useObjectSchemas(workspaceId),
|
|
28
46
|
fetchObjectSchemas = _useObjectSchemas.fetchObjectSchemas,
|
|
29
47
|
objectSchemasLoading = _useObjectSchemas.objectSchemasLoading;
|
|
30
|
-
var _useState = useState(undefined),
|
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
defaultOptions = _useState2[0],
|
|
33
|
-
setDefaultOptions = _useState2[1];
|
|
34
48
|
var selectedObjectSchema = value ? objectSchemaToSelectOption(value) : undefined;
|
|
35
49
|
var loadOptions = /*#__PURE__*/function () {
|
|
36
50
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(inputValue) {
|
|
@@ -77,18 +91,14 @@ export var AssetsObjectSchemaSelect = function AssetsObjectSchemaSelect(_ref) {
|
|
|
77
91
|
return jsx(AsyncSelect, _extends({
|
|
78
92
|
classNamePrefix: classNamePrefix,
|
|
79
93
|
isLoading: objectSchemasLoading,
|
|
80
|
-
defaultOptions:
|
|
94
|
+
defaultOptions: true // setting to true causes the loadOptions to be called on mount
|
|
95
|
+
,
|
|
81
96
|
isSearchable: true,
|
|
82
97
|
loadOptions: debouncedLoadOptions,
|
|
83
98
|
placeholder: formatMessage(objectSchemaSelectMessages.placeholder),
|
|
84
99
|
onChange: function onChange(newOption) {
|
|
85
100
|
return newOption && _onChange(newOption);
|
|
86
|
-
},
|
|
87
|
-
onFocus: function onFocus() {
|
|
88
|
-
if (!defaultOptions) {
|
|
89
|
-
loadOptions('').then(setDefaultOptions);
|
|
90
|
-
}
|
|
91
101
|
}
|
|
92
|
-
}, restFieldProps));
|
|
102
|
+
}, selectInAModalStyleFixProps, restFieldProps));
|
|
93
103
|
}));
|
|
94
104
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import { jsx } from '@emotion/react';
|
|
2
3
|
import { ObjectSchema } from '../../../../types/assets/types';
|
|
3
4
|
type AssetsObjectSchemaSelectProps = {
|
|
@@ -6,5 +7,15 @@ type AssetsObjectSchemaSelectProps = {
|
|
|
6
7
|
classNamePrefix?: string;
|
|
7
8
|
};
|
|
8
9
|
export declare const SEARCH_DEBOUNCE_MS = 350;
|
|
10
|
+
/**
|
|
11
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
12
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
13
|
+
*/
|
|
14
|
+
export declare const selectInAModalStyleFixProps: {
|
|
15
|
+
styles: {
|
|
16
|
+
menuPortal: (base: any) => any;
|
|
17
|
+
};
|
|
18
|
+
menuPortalTarget: HTMLElement;
|
|
19
|
+
};
|
|
9
20
|
export declare const AssetsObjectSchemaSelect: ({ value, workspaceId, classNamePrefix, }: AssetsObjectSchemaSelectProps) => jsx.JSX.Element;
|
|
10
21
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import { jsx } from '@emotion/react';
|
|
2
3
|
import { ObjectSchema } from '../../../../types/assets/types';
|
|
3
4
|
type AssetsObjectSchemaSelectProps = {
|
|
@@ -6,5 +7,15 @@ type AssetsObjectSchemaSelectProps = {
|
|
|
6
7
|
classNamePrefix?: string;
|
|
7
8
|
};
|
|
8
9
|
export declare const SEARCH_DEBOUNCE_MS = 350;
|
|
10
|
+
/**
|
|
11
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
12
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
13
|
+
*/
|
|
14
|
+
export declare const selectInAModalStyleFixProps: {
|
|
15
|
+
styles: {
|
|
16
|
+
menuPortal: (base: any) => any;
|
|
17
|
+
};
|
|
18
|
+
menuPortalTarget: HTMLElement;
|
|
19
|
+
};
|
|
9
20
|
export declare const AssetsObjectSchemaSelect: ({ value, workspaceId, classNamePrefix, }: AssetsObjectSchemaSelectProps) => jsx.JSX.Element;
|
|
10
21
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.2",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@atlaskit/textfield": "5.6.3",
|
|
57
57
|
"@atlaskit/theme": "^12.5.0",
|
|
58
58
|
"@atlaskit/tokens": "^1.14.0",
|
|
59
|
+
"@atlaskit/tooltip": "^17.8.0",
|
|
59
60
|
"@atlassianlabs/jql-editor": "^2.0.1",
|
|
60
61
|
"@atlassianlabs/jql-editor-autocomplete-rest": "^1.1.2",
|
|
61
62
|
"@babel/runtime": "^7.0.0",
|