@atlaskit/link-datasource 1.9.1 → 1.10.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 +6 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/common/zindex.js +4 -2
- package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
- package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +75 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +12 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +12 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +28 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +42 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +76 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +121 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +38 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +31 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +5 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/index.js +40 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/index.js +11 -0
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +4 -2
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/common/zindex.js +3 -1
- package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
- package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +39 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +6 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +6 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +16 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +36 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +74 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +91 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +32 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +22 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +1 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/index.js +26 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/index.js +5 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +4 -2
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/common/zindex.js +3 -1
- package/dist/esm/ui/assets-modal/modal/index.js +1 -1
- package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.js +68 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +6 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.js +6 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.js +21 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.js +35 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +69 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +111 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +32 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.js +21 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +1 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/index.js +30 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/utils/index.js +5 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +4 -2
- package/dist/types/common/zindex.d.ts +1 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +12 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.d.ts +3 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.d.ts +3 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +5 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.d.ts +7 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +3 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +9 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +32 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +9 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +23 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +6 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/common/zindex.d.ts +1 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +12 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.d.ts +3 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useIsComplexQuery.d.ts +3 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +5 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/footer.d.ts +7 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +3 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +32 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +9 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +23 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/index.d.ts +1 -0
- package/package.json +5 -4
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -17
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -15
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -13
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -15
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -11
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -8
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -6
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -8
- package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.js +0 -11
- package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.js +0 -8
- package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.js +0 -6
- package/dist/esm/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.js +0 -8
- package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.d.ts +0 -4
- package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.d.ts +0 -3
- package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.d.ts +0 -3
- package/dist/types/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/hooks/useBasicFilterHook.d.ts +0 -4
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/common/dropdown/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/containers/project/index.d.ts +0 -3
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/basic-filters/ui/index.d.ts +0 -3
- /package/dist/cjs/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
- /package/dist/es2019/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
- /package/dist/esm/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.js +0 -0
- /package/dist/types/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.d.ts +0 -0
- /package/dist/types-ts4.5/ui/jira-issues-modal/{jira-search-container/basic-filters → basic-filters}/index.d.ts +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { components } from '@atlaskit/select';
|
|
4
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
5
|
+
const popupCustomControlStyles = () => ({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
padding: "var(--ds-space-050, 4px)",
|
|
8
|
+
borderBottom: `solid 1px ${`var(--ds-border, ${N40})`}`
|
|
9
|
+
});
|
|
10
|
+
export const CustomControl = ({
|
|
11
|
+
children,
|
|
12
|
+
...innerProps
|
|
13
|
+
}) => /*#__PURE__*/React.createElement(components.Control, _extends({}, innerProps, {
|
|
14
|
+
getStyles: popupCustomControlStyles
|
|
15
|
+
}), children);
|
|
16
|
+
export default CustomControl;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import { Flex, Inline, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { asyncPopupSelectMessages } from './messages';
|
|
7
|
+
const footerContainerStyles = xcss({
|
|
8
|
+
paddingTop: 'space.050',
|
|
9
|
+
paddingBottom: 'space.050',
|
|
10
|
+
borderTop: `${`var(--ds-border, ${N40})`} solid 1px`
|
|
11
|
+
});
|
|
12
|
+
const footerPaginationInfoStyles = xcss({
|
|
13
|
+
color: 'color.text.subtlest',
|
|
14
|
+
marginBlock: 'space.100',
|
|
15
|
+
marginInline: 'space.150'
|
|
16
|
+
});
|
|
17
|
+
const PopupFooter = ({
|
|
18
|
+
currentDisplayCount,
|
|
19
|
+
totalCount
|
|
20
|
+
}) => {
|
|
21
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
22
|
+
testId: "jlol-basic-filter-popup-select--footer",
|
|
23
|
+
direction: "row",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "end",
|
|
26
|
+
xcss: footerContainerStyles
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
28
|
+
xcss: footerPaginationInfoStyles
|
|
29
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, asyncPopupSelectMessages.paginationDetails, {
|
|
30
|
+
values: {
|
|
31
|
+
currentDisplayCount,
|
|
32
|
+
totalCount
|
|
33
|
+
}
|
|
34
|
+
}))));
|
|
35
|
+
};
|
|
36
|
+
export default PopupFooter;
|
package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from '@atlaskit/avatar';
|
|
3
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
4
|
+
import { Box, Flex, xcss } from '@atlaskit/primitives';
|
|
5
|
+
const commonLabelStyles = xcss({
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
textOverflow: 'ellipsis'
|
|
8
|
+
});
|
|
9
|
+
const avatarOptionLabelStyles = xcss({
|
|
10
|
+
marginLeft: 'space.050'
|
|
11
|
+
});
|
|
12
|
+
const IconOptionLabel = ({
|
|
13
|
+
data
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
label,
|
|
17
|
+
icon: avatar,
|
|
18
|
+
value
|
|
19
|
+
} = data;
|
|
20
|
+
const avatarOptionLabelData = {
|
|
21
|
+
label,
|
|
22
|
+
avatar,
|
|
23
|
+
value,
|
|
24
|
+
optionType: 'avatarLabel',
|
|
25
|
+
isSquare: true
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
|
|
28
|
+
data: avatarOptionLabelData,
|
|
29
|
+
testId: "jlol-basic-filter-popup-select-option--icon-label"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const LozengeOptionLabel = ({
|
|
33
|
+
data
|
|
34
|
+
}) => {
|
|
35
|
+
return /*#__PURE__*/React.createElement(Lozenge, {
|
|
36
|
+
isBold: data.isBold,
|
|
37
|
+
appearance: data.appearance,
|
|
38
|
+
testId: "jlol-basic-filter-popup-select-option--lozenge"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
40
|
+
xcss: [commonLabelStyles]
|
|
41
|
+
}, data.label));
|
|
42
|
+
};
|
|
43
|
+
const AvatarOptionLabel = ({
|
|
44
|
+
data,
|
|
45
|
+
testId
|
|
46
|
+
}) => {
|
|
47
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
testId: testId || 'jlol-basic-filter-popup-select-option--avatar'
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
51
|
+
appearance: data.isSquare ? 'square' : 'circle',
|
|
52
|
+
src: data.avatar,
|
|
53
|
+
size: "xsmall"
|
|
54
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
55
|
+
xcss: [commonLabelStyles, avatarOptionLabelStyles],
|
|
56
|
+
testId: "nidhin"
|
|
57
|
+
}, data.label));
|
|
58
|
+
};
|
|
59
|
+
const formatOptionLabel = data => {
|
|
60
|
+
if (data.optionType === 'lozengeLabel') {
|
|
61
|
+
return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
|
|
62
|
+
data: data
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (data.optionType === 'avatarLabel') {
|
|
66
|
+
return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
|
|
67
|
+
data: data
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/React.createElement(IconOptionLabel, {
|
|
71
|
+
data: data
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export default formatOptionLabel;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import { CheckboxOption, PopupSelect } from '@atlaskit/select';
|
|
5
|
+
import { useFieldValues } from '../../hooks/useFieldValues';
|
|
6
|
+
import CustomControl from './control';
|
|
7
|
+
import PopupFooter from './footer';
|
|
8
|
+
import formatOptionLabel from './formatOptionLabel';
|
|
9
|
+
import { asyncPopupSelectMessages } from './messages';
|
|
10
|
+
import PopupTrigger from './trigger';
|
|
11
|
+
// Needed to disable filtering from react-select
|
|
12
|
+
const noFilterOptions = () => true;
|
|
13
|
+
const AsyncPopupSelect = ({
|
|
14
|
+
filterType,
|
|
15
|
+
selection,
|
|
16
|
+
onSelectionChange = () => {}
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage
|
|
20
|
+
} = useIntl();
|
|
21
|
+
const pickerRef = useRef(null);
|
|
22
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
23
|
+
const [selectedOptions, setSelectedOptions] = useState(selection);
|
|
24
|
+
const {
|
|
25
|
+
filterOptions,
|
|
26
|
+
fetchFilterOptions,
|
|
27
|
+
totalCount,
|
|
28
|
+
status
|
|
29
|
+
} = useFieldValues({
|
|
30
|
+
filterType
|
|
31
|
+
});
|
|
32
|
+
const handleInputChange = useCallback((searchString, actionMeta) => {
|
|
33
|
+
if (actionMeta.action === 'input-change' && searchString !== searchTerm) {
|
|
34
|
+
setSearchTerm(searchString);
|
|
35
|
+
}
|
|
36
|
+
}, [searchTerm]);
|
|
37
|
+
const handleOptionSelection = newValue => {
|
|
38
|
+
setSelectedOptions(newValue);
|
|
39
|
+
onSelectionChange(newValue);
|
|
40
|
+
};
|
|
41
|
+
const handleOpenPopup = useCallback(async () => {
|
|
42
|
+
if (status === 'empty') {
|
|
43
|
+
fetchFilterOptions();
|
|
44
|
+
}
|
|
45
|
+
}, [fetchFilterOptions, status]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (status === 'resolved') {
|
|
48
|
+
var _pickerRef$current, _pickerRef$current$se, _pickerRef$current$se2;
|
|
49
|
+
// necessary to refocus the search input after the loading state
|
|
50
|
+
pickerRef === null || pickerRef === void 0 ? void 0 : (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 ? void 0 : (_pickerRef$current$se = _pickerRef$current.selectRef) === null || _pickerRef$current$se === void 0 ? void 0 : (_pickerRef$current$se2 = _pickerRef$current$se.inputRef) === null || _pickerRef$current$se2 === void 0 ? void 0 : _pickerRef$current$se2.focus();
|
|
51
|
+
}
|
|
52
|
+
}, [status]);
|
|
53
|
+
return /*#__PURE__*/React.createElement(PopupSelect, {
|
|
54
|
+
isMulti: true,
|
|
55
|
+
maxMenuWidth: 300,
|
|
56
|
+
minMenuWidth: 300,
|
|
57
|
+
ref: pickerRef,
|
|
58
|
+
testId: "jlol-basic-filter-popup-select",
|
|
59
|
+
inputId: "jlol-basic-filter-popup-select--input",
|
|
60
|
+
searchThreshold: 0,
|
|
61
|
+
inputValue: searchTerm,
|
|
62
|
+
closeMenuOnSelect: false,
|
|
63
|
+
hideSelectedOptions: false,
|
|
64
|
+
isLoading: status === 'loading',
|
|
65
|
+
placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
|
|
66
|
+
components: {
|
|
67
|
+
/* @ts-expect-error - This component has stricter OptionType, hence a temp setup untill its made generic */
|
|
68
|
+
Option: CheckboxOption,
|
|
69
|
+
Control: CustomControl
|
|
70
|
+
},
|
|
71
|
+
options: filterOptions,
|
|
72
|
+
value: selectedOptions,
|
|
73
|
+
filterOption: noFilterOptions,
|
|
74
|
+
formatOptionLabel: formatOptionLabel,
|
|
75
|
+
onChange: handleOptionSelection,
|
|
76
|
+
onInputChange: handleInputChange,
|
|
77
|
+
target: ({
|
|
78
|
+
isOpen,
|
|
79
|
+
...triggerProps
|
|
80
|
+
}) => /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
|
|
81
|
+
filterType: filterType,
|
|
82
|
+
isSelected: isOpen,
|
|
83
|
+
onClick: handleOpenPopup
|
|
84
|
+
})),
|
|
85
|
+
footer: /*#__PURE__*/React.createElement(PopupFooter, {
|
|
86
|
+
currentDisplayCount: filterOptions.length,
|
|
87
|
+
totalCount: totalCount
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
export default AsyncPopupSelect;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const asyncPopupSelectMessages = {
|
|
2
|
+
selectPlaceholder: {
|
|
3
|
+
id: 'linkDataSource.basic-filter.dropdown.select.placeholder',
|
|
4
|
+
description: 'Placeholder text to be displayed for the search input box.',
|
|
5
|
+
defaultMessage: 'Search'
|
|
6
|
+
},
|
|
7
|
+
paginationDetails: {
|
|
8
|
+
id: 'linkDataSource.basic-filter.footer.pagination-details',
|
|
9
|
+
description: 'Text to indicate page count and total count information.',
|
|
10
|
+
defaultMessage: '{currentDisplayCount} of {totalCount}'
|
|
11
|
+
},
|
|
12
|
+
projectLabel: {
|
|
13
|
+
id: 'linkDataSource.basic-filter.project.label',
|
|
14
|
+
description: 'Label to be displayed for project filter dropdown button.',
|
|
15
|
+
defaultMessage: 'Project'
|
|
16
|
+
},
|
|
17
|
+
statusLabel: {
|
|
18
|
+
id: 'linkDataSource.basic-filter.status.label',
|
|
19
|
+
description: 'Label to be displayed for status filter dropdown button.',
|
|
20
|
+
defaultMessage: 'Status'
|
|
21
|
+
},
|
|
22
|
+
issuetypeLabel: {
|
|
23
|
+
id: 'linkDataSource.basic-filter.issuetype.label',
|
|
24
|
+
description: 'Label to be displayed for issuetype filter dropdown button.',
|
|
25
|
+
defaultMessage: 'Type'
|
|
26
|
+
},
|
|
27
|
+
assigneeLabel: {
|
|
28
|
+
id: 'linkDataSource.basic-filter.assignee.label',
|
|
29
|
+
description: 'Label to be displayed for assignee filter dropdown button.',
|
|
30
|
+
defaultMessage: 'Assignee'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
3
|
+
import Button from '@atlaskit/button/standard-button';
|
|
4
|
+
import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
5
|
+
import { asyncPopupSelectMessages } from './messages';
|
|
6
|
+
const PopupTrigger = /*#__PURE__*/forwardRef(({
|
|
7
|
+
filterType,
|
|
8
|
+
isSelected,
|
|
9
|
+
onClick
|
|
10
|
+
}, ref) => {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
appearance: "default",
|
|
14
|
+
isSelected: isSelected,
|
|
15
|
+
onClick: onClick,
|
|
16
|
+
testId: `jlol-basic-filter-${filterType}-trigger`,
|
|
17
|
+
iconAfter: /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
18
|
+
label: ""
|
|
19
|
+
})
|
|
20
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, asyncPopupSelectMessages[`${filterType}Label`]));
|
|
21
|
+
});
|
|
22
|
+
export default PopupTrigger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Flex } from '@atlaskit/primitives';
|
|
3
|
+
import { isValidJql } from '../utils';
|
|
4
|
+
import AsyncPopupSelect from './async-popup-select';
|
|
5
|
+
const availableBasicFilterTypes = ['project', 'issuetype', 'status', 'assignee'];
|
|
6
|
+
const BasicFilterContainer = ({
|
|
7
|
+
jql
|
|
8
|
+
}) => {
|
|
9
|
+
const [selection] = useState([]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (isValidJql(jql)) {
|
|
12
|
+
// hydrate hook call goes in here
|
|
13
|
+
}
|
|
14
|
+
}, [jql]);
|
|
15
|
+
const handleSelectionChange = () => {};
|
|
16
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
17
|
+
gap: "space.100",
|
|
18
|
+
testId: "jlol-basic-filter-container"
|
|
19
|
+
}, availableBasicFilterTypes.map(filter => /*#__PURE__*/React.createElement(AsyncPopupSelect, {
|
|
20
|
+
filterType: filter,
|
|
21
|
+
key: filter,
|
|
22
|
+
selection: selection,
|
|
23
|
+
onSelectionChange: handleSelectionChange
|
|
24
|
+
})));
|
|
25
|
+
};
|
|
26
|
+
export default BasicFilterContainer;
|
|
@@ -4,10 +4,10 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
7
|
+
import { BasicFilters } from '../basic-filters';
|
|
7
8
|
import { BasicSearchInput } from '../basic-search-input';
|
|
8
9
|
import { JiraJQLEditor } from '../jql-editor';
|
|
9
10
|
import { ModeSwitcher } from '../mode-switcher';
|
|
10
|
-
import { BasicFilters } from './basic-filters';
|
|
11
11
|
import { buildJQL } from './buildJQL';
|
|
12
12
|
import { modeSwitcherMessages } from './messages';
|
|
13
13
|
const inputContainerStyles = css({
|
|
@@ -92,7 +92,9 @@ export const JiraSearchContainer = props => {
|
|
|
92
92
|
onChange: handleBasicSearchChange,
|
|
93
93
|
onSearch: handleSearch,
|
|
94
94
|
searchTerm: basicSearchTerm
|
|
95
|
-
}), showBasicFilters && jsx(BasicFilters,
|
|
95
|
+
}), showBasicFilters && jsx(BasicFilters, {
|
|
96
|
+
jql: jql
|
|
97
|
+
})), currentSearchMethod === 'jql' && jsx(JiraJQLEditor, {
|
|
96
98
|
cloudId: cloudId || '',
|
|
97
99
|
isSearching: isSearching,
|
|
98
100
|
onChange: onQueryChange,
|
|
@@ -225,7 +225,7 @@ var analyticsContextAttributes = {
|
|
|
225
225
|
};
|
|
226
226
|
var analyticsContextData = {
|
|
227
227
|
packageName: "@atlaskit/link-datasource",
|
|
228
|
-
packageVersion: "1.
|
|
228
|
+
packageVersion: "1.10.0",
|
|
229
229
|
source: 'datasourceConfigModal'
|
|
230
230
|
};
|
|
231
231
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { request } from '@atlaskit/linking-common';
|
|
6
|
+
// TODO: https://product-fabric.atlassian.net/browse/EDM-8118
|
|
7
|
+
export var useFieldValues = function useFieldValues(_ref) {
|
|
8
|
+
var filterType = _ref.filterType;
|
|
9
|
+
var _useState = useState([]),
|
|
10
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
+
filterOptions = _useState2[0],
|
|
12
|
+
setFilterOptions = _useState2[1];
|
|
13
|
+
var _useState3 = useState(100),
|
|
14
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
15
|
+
totalCount = _useState4[0];
|
|
16
|
+
var _useState5 = useState('empty'),
|
|
17
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
18
|
+
status = _useState6[0],
|
|
19
|
+
setStatus = _useState6[1];
|
|
20
|
+
var fetchFilterOptions = /*#__PURE__*/function () {
|
|
21
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
22
|
+
var _yield$request, data;
|
|
23
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_context.prev = 0;
|
|
27
|
+
setStatus('loading');
|
|
28
|
+
_context.next = 4;
|
|
29
|
+
return request('post', '/gateway/api/graphql', {
|
|
30
|
+
operationName: 'fieldValues',
|
|
31
|
+
variables: {
|
|
32
|
+
jqlTerm: filterType
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
'X-ExperimentalApi': 'JiraJqlBuilder'
|
|
37
|
+
});
|
|
38
|
+
case 4:
|
|
39
|
+
_yield$request = _context.sent;
|
|
40
|
+
data = _yield$request.data;
|
|
41
|
+
if (data) {
|
|
42
|
+
setFilterOptions(data);
|
|
43
|
+
setStatus('resolved');
|
|
44
|
+
}
|
|
45
|
+
_context.next = 13;
|
|
46
|
+
break;
|
|
47
|
+
case 9:
|
|
48
|
+
_context.prev = 9;
|
|
49
|
+
_context.t0 = _context["catch"](0);
|
|
50
|
+
setStatus('error');
|
|
51
|
+
return _context.abrupt("return", setFilterOptions([]));
|
|
52
|
+
case 13:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}, _callee, null, [[0, 9]]);
|
|
57
|
+
}));
|
|
58
|
+
return function fetchFilterOptions() {
|
|
59
|
+
return _ref2.apply(this, arguments);
|
|
60
|
+
};
|
|
61
|
+
}();
|
|
62
|
+
return {
|
|
63
|
+
filterOptions: filterOptions,
|
|
64
|
+
fetchFilterOptions: fetchFilterOptions,
|
|
65
|
+
totalCount: totalCount,
|
|
66
|
+
status: status
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { components } from '@atlaskit/select';
|
|
6
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
7
|
+
var popupCustomControlStyles = function popupCustomControlStyles() {
|
|
8
|
+
return {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
padding: "var(--ds-space-050, 4px)",
|
|
11
|
+
borderBottom: "solid 1px ".concat("var(--ds-border, ".concat(N40, ")"))
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export var CustomControl = function CustomControl(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
innerProps = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
return /*#__PURE__*/React.createElement(components.Control, _extends({}, innerProps, {
|
|
18
|
+
getStyles: popupCustomControlStyles
|
|
19
|
+
}), children);
|
|
20
|
+
};
|
|
21
|
+
export default CustomControl;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import { Flex, Inline, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { asyncPopupSelectMessages } from './messages';
|
|
7
|
+
var footerContainerStyles = xcss({
|
|
8
|
+
paddingTop: 'space.050',
|
|
9
|
+
paddingBottom: 'space.050',
|
|
10
|
+
borderTop: "".concat("var(--ds-border, ".concat(N40, ")"), " solid 1px")
|
|
11
|
+
});
|
|
12
|
+
var footerPaginationInfoStyles = xcss({
|
|
13
|
+
color: 'color.text.subtlest',
|
|
14
|
+
marginBlock: 'space.100',
|
|
15
|
+
marginInline: 'space.150'
|
|
16
|
+
});
|
|
17
|
+
var PopupFooter = function PopupFooter(_ref) {
|
|
18
|
+
var currentDisplayCount = _ref.currentDisplayCount,
|
|
19
|
+
totalCount = _ref.totalCount;
|
|
20
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
21
|
+
testId: "jlol-basic-filter-popup-select--footer",
|
|
22
|
+
direction: "row",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "end",
|
|
25
|
+
xcss: footerContainerStyles
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
27
|
+
xcss: footerPaginationInfoStyles
|
|
28
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, asyncPopupSelectMessages.paginationDetails, {
|
|
29
|
+
values: {
|
|
30
|
+
currentDisplayCount: currentDisplayCount,
|
|
31
|
+
totalCount: totalCount
|
|
32
|
+
}
|
|
33
|
+
}))));
|
|
34
|
+
};
|
|
35
|
+
export default PopupFooter;
|
package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Avatar from '@atlaskit/avatar';
|
|
3
|
+
import Lozenge from '@atlaskit/lozenge';
|
|
4
|
+
import { Box, Flex, xcss } from '@atlaskit/primitives';
|
|
5
|
+
var commonLabelStyles = xcss({
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
textOverflow: 'ellipsis'
|
|
8
|
+
});
|
|
9
|
+
var avatarOptionLabelStyles = xcss({
|
|
10
|
+
marginLeft: 'space.050'
|
|
11
|
+
});
|
|
12
|
+
var IconOptionLabel = function IconOptionLabel(_ref) {
|
|
13
|
+
var data = _ref.data;
|
|
14
|
+
var label = data.label,
|
|
15
|
+
avatar = data.icon,
|
|
16
|
+
value = data.value;
|
|
17
|
+
var avatarOptionLabelData = {
|
|
18
|
+
label: label,
|
|
19
|
+
avatar: avatar,
|
|
20
|
+
value: value,
|
|
21
|
+
optionType: 'avatarLabel',
|
|
22
|
+
isSquare: true
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
|
|
25
|
+
data: avatarOptionLabelData,
|
|
26
|
+
testId: "jlol-basic-filter-popup-select-option--icon-label"
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var LozengeOptionLabel = function LozengeOptionLabel(_ref2) {
|
|
30
|
+
var data = _ref2.data;
|
|
31
|
+
return /*#__PURE__*/React.createElement(Lozenge, {
|
|
32
|
+
isBold: data.isBold,
|
|
33
|
+
appearance: data.appearance,
|
|
34
|
+
testId: "jlol-basic-filter-popup-select-option--lozenge"
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
36
|
+
xcss: [commonLabelStyles]
|
|
37
|
+
}, data.label));
|
|
38
|
+
};
|
|
39
|
+
var AvatarOptionLabel = function AvatarOptionLabel(_ref3) {
|
|
40
|
+
var data = _ref3.data,
|
|
41
|
+
testId = _ref3.testId;
|
|
42
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
testId: testId || 'jlol-basic-filter-popup-select-option--avatar'
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
46
|
+
appearance: data.isSquare ? 'square' : 'circle',
|
|
47
|
+
src: data.avatar,
|
|
48
|
+
size: "xsmall"
|
|
49
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
50
|
+
xcss: [commonLabelStyles, avatarOptionLabelStyles],
|
|
51
|
+
testId: "nidhin"
|
|
52
|
+
}, data.label));
|
|
53
|
+
};
|
|
54
|
+
var formatOptionLabel = function formatOptionLabel(data) {
|
|
55
|
+
if (data.optionType === 'lozengeLabel') {
|
|
56
|
+
return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
|
|
57
|
+
data: data
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (data.optionType === 'avatarLabel') {
|
|
61
|
+
return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
|
|
62
|
+
data: data
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return /*#__PURE__*/React.createElement(IconOptionLabel, {
|
|
66
|
+
data: data
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
export default formatOptionLabel;
|