@atlaskit/link-datasource 1.26.1 → 1.26.3
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/common/modal/basic-search-input/index.js +9 -18
- package/dist/cjs/ui/common/modal/popup-select/index.js +217 -0
- package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
- package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
- package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
- package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
- package/dist/cjs/ui/common/modal/popup-select/menu-list/showMoreButton.js +36 -0
- package/dist/cjs/ui/common/modal/popup-select/messages.js +19 -0
- package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +12 -13
- package/dist/cjs/ui/common/modal/popup-select/types.js +5 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/index.js +22 -0
- package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +18 -3
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +11 -2
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +27 -163
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +2 -1
- package/dist/es2019/ui/common/modal/basic-search-input/index.js +2 -10
- package/dist/es2019/ui/common/modal/popup-select/index.js +170 -0
- package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
- package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
- package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
- package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
- package/dist/es2019/ui/common/modal/popup-select/menu-list/showMoreButton.js +29 -0
- package/dist/es2019/ui/common/modal/popup-select/messages.js +13 -0
- package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +10 -11
- package/dist/es2019/ui/common/modal/popup-select/types.js +1 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/index.js +13 -0
- package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +19 -4
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +12 -2
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +25 -145
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +2 -1
- package/dist/esm/ui/common/modal/basic-search-input/index.js +2 -10
- package/dist/esm/ui/common/modal/popup-select/index.js +207 -0
- package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/errorMessage.js +3 -3
- package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/index.js +6 -5
- package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/messages.js +5 -0
- package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/noOptionsMessage.js +3 -3
- package/dist/esm/ui/common/modal/popup-select/menu-list/showMoreButton.js +26 -0
- package/dist/esm/ui/common/modal/popup-select/messages.js +13 -0
- package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.js +12 -13
- package/dist/esm/ui/common/modal/popup-select/types.js +1 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/index.js +15 -0
- package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +19 -4
- package/dist/esm/ui/confluence-search-modal/modal/index.js +12 -3
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +27 -163
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.js +0 -15
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +2 -1
- package/dist/types/analytics/generated/analytics.types.d.ts +6 -6
- package/dist/types/ui/common/modal/basic-search-input/index.d.ts +1 -0
- package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.d.ts +1 -1
- package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types/ui/common/modal/popup-select}/dropdownIndicator.d.ts +1 -1
- package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.d.ts +1 -1
- package/dist/types/ui/common/modal/popup-select/index.d.ts +21 -0
- package/dist/types/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +6 -0
- package/dist/types/ui/common/modal/popup-select/menu-list/index.d.ts +15 -0
- package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui → types/ui/common/modal/popup-select}/menu-list/messages.d.ts +5 -0
- package/dist/types/ui/common/modal/popup-select/menu-list/noOptionsMessage.d.ts +5 -0
- package/dist/{types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types/ui/common/modal/popup-select/menu-list}/showMoreButton.d.ts +2 -1
- package/dist/types/ui/common/modal/popup-select/messages.d.ts +12 -0
- package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.d.ts +3 -2
- package/dist/types/ui/common/modal/popup-select/types.d.ts +22 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/index.d.ts +5 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/types.d.ts +0 -2
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +0 -15
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +6 -6
- package/dist/types-ts4.5/ui/common/modal/basic-search-input/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.d.ts +1 -1
- package/dist/{types/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types-ts4.5/ui/common/modal/popup-select}/dropdownIndicator.d.ts +1 -1
- package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.d.ts +1 -1
- package/dist/types-ts4.5/ui/common/modal/popup-select/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/errorMessage.d.ts +6 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/index.d.ts +15 -0
- package/dist/{types/ui/jira-issues-modal/basic-filters/ui → types-ts4.5/ui/common/modal/popup-select}/menu-list/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/noOptionsMessage.d.ts +5 -0
- package/dist/{types/ui/jira-issues-modal/basic-filters/ui/async-popup-select → types-ts4.5/ui/common/modal/popup-select/menu-list}/showMoreButton.d.ts +2 -1
- package/dist/types-ts4.5/ui/common/modal/popup-select/messages.d.ts +12 -0
- package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/trigger.d.ts +3 -2
- package/dist/types-ts4.5/ui/common/modal/popup-select/types.d.ts +22 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/types.d.ts +0 -2
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/messages.d.ts +0 -15
- package/package.json +6 -3
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -22
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -17
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/showMoreButton.js +0 -15
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +0 -8
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +0 -5
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/menu-list/noOptionsMessage.d.ts +0 -6
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/errorMessage.d.ts +0 -8
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/index.d.ts +0 -5
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/menu-list/noOptionsMessage.d.ts +0 -6
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
- /package/dist/cjs/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
- /package/dist/es2019/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/control.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/dropdownIndicator.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/formatOptionLabel.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.js +0 -0
- /package/dist/esm/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.js +0 -0
- /package/dist/types/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.d.ts +0 -0
- /package/dist/types/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.d.ts +0 -0
- /package/dist/types/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui/async-popup-select → common/modal/popup-select}/footer.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/loadingMessage.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{jira-issues-modal/basic-filters/ui → common/modal/popup-select}/menu-list/selectMessage.d.ts +0 -0
|
@@ -133,6 +133,8 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
133
133
|
_useDatasourceTableSt2 = _useDatasourceTableSt.extensionKey,
|
|
134
134
|
extensionKey = _useDatasourceTableSt2 === void 0 ? null : _useDatasourceTableSt2,
|
|
135
135
|
destinationObjectTypes = _useDatasourceTableSt.destinationObjectTypes;
|
|
136
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
137
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
136
138
|
var hasNoConfluenceSites = availableSites && availableSites.length === 0;
|
|
137
139
|
var selectedConfluenceSite = (0, _react.useMemo)(function () {
|
|
138
140
|
if (cloudId) {
|
|
@@ -149,6 +151,9 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
149
151
|
})) || (availableSites === null || availableSites === void 0 ? void 0 : availableSites[0]);
|
|
150
152
|
}
|
|
151
153
|
}, [availableSites, cloudId]);
|
|
154
|
+
(0, _react.useEffect)(function () {
|
|
155
|
+
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
156
|
+
}, [fireEvent]);
|
|
152
157
|
|
|
153
158
|
// TODO: further refactoring in EDM-9573
|
|
154
159
|
// https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/82725/overview?commentId=6828283
|
|
@@ -182,7 +187,11 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
182
187
|
return a.displayName.localeCompare(b.displayName);
|
|
183
188
|
});
|
|
184
189
|
setAvailableSites(sortedAvailableSites);
|
|
185
|
-
|
|
190
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
191
|
+
instancesCount: sortedAvailableSites.length,
|
|
192
|
+
schemasCount: null
|
|
193
|
+
});
|
|
194
|
+
case 6:
|
|
186
195
|
case "end":
|
|
187
196
|
return _context.stop();
|
|
188
197
|
}
|
|
@@ -193,7 +202,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
193
202
|
};
|
|
194
203
|
}();
|
|
195
204
|
void fetchSiteDisplayNames();
|
|
196
|
-
}, []);
|
|
205
|
+
}, [fireEvent]);
|
|
197
206
|
(0, _react.useEffect)(function () {
|
|
198
207
|
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
199
208
|
visibleColumnCount.current = newVisibleColumnKeys.length;
|
|
@@ -6,33 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.SEARCH_DEBOUNCE_MS = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
17
14
|
var _reactIntlNext = require("react-intl-next");
|
|
18
15
|
var _useDebounce = require("use-debounce");
|
|
19
|
-
var
|
|
20
|
-
var _analytics = require("../../../../../analytics");
|
|
16
|
+
var _popupSelect = require("../../../../common/modal/popup-select");
|
|
21
17
|
var _useFilterOptions2 = require("../../hooks/useFilterOptions");
|
|
22
|
-
var _menuList = _interopRequireDefault(require("../menu-list"));
|
|
23
|
-
var _control = _interopRequireDefault(require("./control"));
|
|
24
|
-
var _dropdownIndicator = _interopRequireDefault(require("./dropdownIndicator"));
|
|
25
|
-
var _footer = _interopRequireDefault(require("./footer"));
|
|
26
|
-
var _formatOptionLabel = _interopRequireDefault(require("./formatOptionLabel"));
|
|
27
18
|
var _messages = require("./messages");
|
|
28
|
-
var _trigger = _interopRequireDefault(require("./trigger"));
|
|
29
|
-
var _excluded = ["isOpen"];
|
|
30
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
31
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
|
-
// Needed to disable filtering from react-select
|
|
33
|
-
var noFilterOptions = function noFilterOptions() {
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
21
|
var SEARCH_DEBOUNCE_MS = exports.SEARCH_DEBOUNCE_MS = 350;
|
|
37
22
|
var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
38
23
|
var filterType = _ref.filterType,
|
|
@@ -45,8 +30,6 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
45
30
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
46
31
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
47
32
|
formatMessage = _useIntl.formatMessage;
|
|
48
|
-
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
49
|
-
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
50
33
|
var _useState = (0, _react.useState)(''),
|
|
51
34
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
35
|
searchTerm = _useState2[0],
|
|
@@ -55,15 +38,9 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
55
38
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
56
39
|
selectedOptions = _useState4[0],
|
|
57
40
|
setSelectedOptions = _useState4[1];
|
|
58
|
-
var _useState5 = (0, _react.useState)([]),
|
|
59
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
60
|
-
sortedOptions = _useState6[0],
|
|
61
|
-
setSortedOptions = _useState6[1];
|
|
62
41
|
var _ref2 = site || {},
|
|
63
42
|
cloudId = _ref2.cloudId;
|
|
64
43
|
var currentSiteCloudId = (0, _react.useRef)(cloudId || '');
|
|
65
|
-
var sortPaginatedResults = (0, _react.useRef)(false); // this is to track pagination for sorting purpose
|
|
66
|
-
|
|
67
44
|
var _useFilterOptions = (0, _useFilterOptions2.useFilterOptions)({
|
|
68
45
|
filterType: filterType,
|
|
69
46
|
site: site
|
|
@@ -83,123 +60,44 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
83
60
|
_useDebouncedCallback2 = (0, _slicedToArray2.default)(_useDebouncedCallback, 1),
|
|
84
61
|
handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
|
|
85
62
|
var handleInputChange = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
86
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newSearchTerm
|
|
63
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newSearchTerm) {
|
|
87
64
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
88
65
|
while (1) switch (_context.prev = _context.next) {
|
|
89
66
|
case 0:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
case 1:
|
|
67
|
+
setSearchTerm(newSearchTerm);
|
|
68
|
+
handleDebouncedFetchFilterOptions(newSearchTerm);
|
|
69
|
+
case 2:
|
|
95
70
|
case "end":
|
|
96
71
|
return _context.stop();
|
|
97
72
|
}
|
|
98
73
|
}, _callee);
|
|
99
74
|
}));
|
|
100
|
-
return function (_x
|
|
75
|
+
return function (_x) {
|
|
101
76
|
return _ref3.apply(this, arguments);
|
|
102
77
|
};
|
|
103
|
-
}(), [handleDebouncedFetchFilterOptions
|
|
78
|
+
}(), [handleDebouncedFetchFilterOptions]);
|
|
104
79
|
var handleOptionSelection = (0, _react.useCallback)(function (newValue) {
|
|
105
80
|
onSelectionChange(filterType, newValue);
|
|
106
81
|
}, [filterType, onSelectionChange]);
|
|
107
|
-
var sortOptionsOnPopupOpen = (0, _react.useCallback)(function () {
|
|
108
|
-
if (selectedOptions.length === 0) {
|
|
109
|
-
return setSortedOptions(filterOptions);
|
|
110
|
-
}
|
|
111
|
-
var nonSelectedOptions = filterOptions.filter(function (option) {
|
|
112
|
-
return !selectedOptions.find(function (selectedOption) {
|
|
113
|
-
return selectedOption.value === option.value;
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
var newOptions = [].concat((0, _toConsumableArray2.default)(selectedOptions), (0, _toConsumableArray2.default)(nonSelectedOptions));
|
|
117
|
-
if (!(0, _isEqual.default)(newOptions, sortedOptions)) {
|
|
118
|
-
setSortedOptions(newOptions);
|
|
119
|
-
}
|
|
120
|
-
}, [selectedOptions, filterOptions, sortedOptions]);
|
|
121
|
-
var sortOptionsOnResolve = (0, _react.useCallback)(function () {
|
|
122
|
-
// when the user is searching, we want the search result to be displayed as it is, and the select component will take care of marking the selected items
|
|
123
|
-
if (searchTerm) {
|
|
124
|
-
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
125
|
-
return setSortedOptions(filterOptions);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// sortedOptions is empty initially, this will take care of setting the initial value and bring the selected items to the top
|
|
129
|
-
if (sortedOptions.length === 0) {
|
|
130
|
-
return sortOptionsOnPopupOpen();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// this block handles the pagination, where on pagination, we will just append newOptions to the current list
|
|
134
|
-
if (sortPaginatedResults.current) {
|
|
135
|
-
var newOptions = filterOptions.filter(function (option) {
|
|
136
|
-
return !sortedOptions.find(function (sortedOption) {
|
|
137
|
-
return sortedOption.value === option.value;
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
if (newOptions.length > 0) {
|
|
141
|
-
setSortedOptions([].concat((0, _toConsumableArray2.default)(sortedOptions), (0, _toConsumableArray2.default)(newOptions)));
|
|
142
|
-
}
|
|
143
|
-
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
147
|
-
sortOptionsOnPopupOpen();
|
|
148
|
-
}, [filterOptions, searchTerm, sortOptionsOnPopupOpen, sortedOptions]);
|
|
149
82
|
var handleShowMore = (0, _react.useCallback)(function () {
|
|
150
83
|
if (pageCursor) {
|
|
151
|
-
sortPaginatedResults.current = true;
|
|
152
84
|
fetchFilterOptions({
|
|
153
85
|
pageCursor: pageCursor,
|
|
154
86
|
searchString: searchTerm
|
|
155
87
|
});
|
|
156
|
-
fireEvent('ui.button.clicked.basicSearchDropdown', {
|
|
157
|
-
filterType: filterType,
|
|
158
|
-
type: 'showMore'
|
|
159
|
-
});
|
|
160
88
|
}
|
|
161
|
-
}, [fetchFilterOptions,
|
|
89
|
+
}, [fetchFilterOptions, pageCursor, searchTerm]);
|
|
162
90
|
var handleMenuOpen = (0, _react.useCallback)(function () {
|
|
163
91
|
if (status === 'empty' || status === 'rejected') {
|
|
164
92
|
// if user searches and gets status as rejected, we want the dropdown to try load the request with searchString when the user reopens the dropdown
|
|
165
93
|
fetchFilterOptions({
|
|
166
94
|
searchString: searchTerm
|
|
167
95
|
});
|
|
168
|
-
} else if (status === 'resolved') {
|
|
169
|
-
sortOptionsOnPopupOpen();
|
|
170
96
|
}
|
|
171
|
-
|
|
172
|
-
filterType: filterType,
|
|
173
|
-
selectionCount: selectedOptions.length
|
|
174
|
-
});
|
|
175
|
-
}, [fetchFilterOptions, filterType, fireEvent, searchTerm, selectedOptions.length, sortOptionsOnPopupOpen, status]);
|
|
176
|
-
var handleMenuClose = (0, _react.useCallback)(function () {
|
|
177
|
-
/**
|
|
178
|
-
* Clearing the search is to ensure that the sortOptionsOnPopupOpen logic does not mess up.
|
|
179
|
-
* Without this, when the user opens, sortOptionsOnPopupOpen will inject the selected options to the list and the list count and values will be off
|
|
180
|
-
*/
|
|
181
|
-
if (searchTerm) {
|
|
182
|
-
handleInputChange('', {
|
|
183
|
-
action: 'input-change',
|
|
184
|
-
prevInputValue: searchTerm
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
fireEvent('ui.dropdown.closed.basicSearchDropdown', {
|
|
188
|
-
filterType: filterType,
|
|
189
|
-
selectionCount: selectedOptions.length
|
|
190
|
-
});
|
|
191
|
-
}, [filterType, fireEvent, handleInputChange, searchTerm, selectedOptions.length]);
|
|
192
|
-
(0, _react.useEffect)(function () {
|
|
193
|
-
if (status === 'resolved') {
|
|
194
|
-
sortOptionsOnResolve();
|
|
195
|
-
}
|
|
196
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
197
|
-
}, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
|
|
198
|
-
|
|
97
|
+
}, [fetchFilterOptions, searchTerm, status]);
|
|
199
98
|
(0, _react.useEffect)(function () {
|
|
200
99
|
if (cloudId && currentSiteCloudId.current !== cloudId) {
|
|
201
100
|
currentSiteCloudId.current = cloudId;
|
|
202
|
-
setSortedOptions([]);
|
|
203
101
|
setSearchTerm('');
|
|
204
102
|
resetHook();
|
|
205
103
|
}
|
|
@@ -214,29 +112,27 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
214
112
|
var isLoading = status === 'loading' || status === 'empty';
|
|
215
113
|
var isLoadingMore = status === 'loadingMore';
|
|
216
114
|
var isEmpty = status === 'resolved' && filterOptionsLength === 0;
|
|
217
|
-
var popupSelectOptions = isLoading || isError ? [] :
|
|
115
|
+
var popupSelectOptions = isLoading || isError ? [] : filterOptions; // if not set to [], then on loading, no loading UI will be shown
|
|
218
116
|
var areAllResultsLoaded = filterOptionsLength === totalCount;
|
|
219
117
|
var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptionsLength > 0; // footer should not disappear when there is an inline spinner for loading more data
|
|
220
118
|
var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
isLoading: isLoading,
|
|
237
|
-
placeholder: formatMessage(_messages.asyncPopupSelectMessages.selectPlaceholder),
|
|
119
|
+
var triggerButtonLabel = formatMessage(_messages.asyncPopupSelectMessages["".concat(filterType, "Label")]);
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(_popupSelect.FilterPopupSelect, {
|
|
121
|
+
filterName: "jlol-basic-filter-".concat(filterType),
|
|
122
|
+
status: status,
|
|
123
|
+
showLoading: isLoading,
|
|
124
|
+
showHydrating: isJQLHydrating,
|
|
125
|
+
isDisabled: isDisabled,
|
|
126
|
+
totalCount: totalCount,
|
|
127
|
+
shouldShowFooter: shouldShowFooter,
|
|
128
|
+
selectedOptions: selectedOptions,
|
|
129
|
+
options: popupSelectOptions,
|
|
130
|
+
buttonLabel: triggerButtonLabel,
|
|
131
|
+
onInputChange: handleInputChange,
|
|
132
|
+
onSelectionChange: handleOptionSelection,
|
|
133
|
+
onMenuOpen: handleMenuOpen,
|
|
238
134
|
menuListProps: {
|
|
239
|
-
|
|
135
|
+
filterName: filterType,
|
|
240
136
|
isError: isError,
|
|
241
137
|
isEmpty: isEmpty,
|
|
242
138
|
isLoading: isLoading,
|
|
@@ -244,39 +140,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
244
140
|
handleShowMore: handleShowMore,
|
|
245
141
|
errors: errors,
|
|
246
142
|
showMore: shouldDisplayShowMoreButton
|
|
247
|
-
}
|
|
248
|
-
components: {
|
|
249
|
-
Option: _select.CheckboxOption,
|
|
250
|
-
Control: _control.default,
|
|
251
|
-
MenuList: _menuList.default,
|
|
252
|
-
DropdownIndicator: _dropdownIndicator.default,
|
|
253
|
-
LoadingIndicator: undefined,
|
|
254
|
-
// disables the three ... indicator in the searchbox when picker is loading
|
|
255
|
-
IndicatorSeparator: undefined // disables the | separator between search input and icon
|
|
256
|
-
},
|
|
257
|
-
options: popupSelectOptions,
|
|
258
|
-
value: selectedOptions,
|
|
259
|
-
filterOption: noFilterOptions,
|
|
260
|
-
formatOptionLabel: _formatOptionLabel.default,
|
|
261
|
-
onChange: handleOptionSelection,
|
|
262
|
-
onInputChange: handleInputChange,
|
|
263
|
-
onOpen: handleMenuOpen,
|
|
264
|
-
onClose: handleMenuClose,
|
|
265
|
-
target: function target(_ref4) {
|
|
266
|
-
var isOpen = _ref4.isOpen,
|
|
267
|
-
triggerProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded);
|
|
268
|
-
return /*#__PURE__*/_react.default.createElement(_trigger.default, (0, _extends2.default)({}, triggerProps, {
|
|
269
|
-
filterType: filterType,
|
|
270
|
-
selectedOptions: selectedOptions,
|
|
271
|
-
isSelected: isOpen,
|
|
272
|
-
isDisabled: isDisabled,
|
|
273
|
-
isLoading: isJQLHydrating
|
|
274
|
-
}));
|
|
275
|
-
},
|
|
276
|
-
footer: shouldShowFooter && /*#__PURE__*/_react.default.createElement(_footer.default, {
|
|
277
|
-
currentDisplayCount: popupSelectOptions.length,
|
|
278
|
-
totalCount: totalCount
|
|
279
|
-
})
|
|
143
|
+
}
|
|
280
144
|
});
|
|
281
145
|
};
|
|
282
146
|
var _default = exports.default = AsyncPopupSelect;
|
|
@@ -6,16 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.asyncPopupSelectMessages = void 0;
|
|
7
7
|
var _reactIntlNext = require("react-intl-next");
|
|
8
8
|
var asyncPopupSelectMessages = exports.asyncPopupSelectMessages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
-
selectPlaceholder: {
|
|
10
|
-
id: 'linkDataSource.basic-filter.dropdown.select.placeholder',
|
|
11
|
-
description: 'Placeholder text to be displayed for the search input box.',
|
|
12
|
-
defaultMessage: 'Search'
|
|
13
|
-
},
|
|
14
|
-
paginationDetails: {
|
|
15
|
-
id: 'linkDataSource.basic-filter.footer.pagination-details',
|
|
16
|
-
description: 'Text to indicate page count and total count information.',
|
|
17
|
-
defaultMessage: '{currentDisplayCount} of {totalCount}'
|
|
18
|
-
},
|
|
19
9
|
projectLabel: {
|
|
20
10
|
id: 'linkDataSource.basic-filter.project.label',
|
|
21
11
|
description: 'Label to be displayed for project filter dropdown button.',
|
|
@@ -35,10 +25,5 @@ var asyncPopupSelectMessages = exports.asyncPopupSelectMessages = (0, _reactIntl
|
|
|
35
25
|
id: 'linkDataSource.basic-filter.assignee.label',
|
|
36
26
|
description: 'Label to be displayed for assignee filter dropdown button.',
|
|
37
27
|
defaultMessage: 'Assignee'
|
|
38
|
-
},
|
|
39
|
-
showMoreMessage: {
|
|
40
|
-
id: 'linkDataSource.basic-filter.showMoreButton',
|
|
41
|
-
defaultMessage: 'Show more',
|
|
42
|
-
description: 'The text to show more options in dropdown'
|
|
43
28
|
}
|
|
44
29
|
});
|
|
@@ -227,7 +227,8 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
227
227
|
onSearch: handleSearch,
|
|
228
228
|
searchTerm: basicSearchTerm,
|
|
229
229
|
placeholder: _messages.basicSearchInputMessages.basicTextSearchLabel,
|
|
230
|
-
testId: "jira-datasource-modal"
|
|
230
|
+
testId: "jira-datasource-modal",
|
|
231
|
+
fullWidth: !showBasicFilters
|
|
231
232
|
}), showBasicFilters && (0, _react2.jsx)(_basicFilters.BasicFilters, {
|
|
232
233
|
jql: searchBarJql,
|
|
233
234
|
site: site,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
5
|
import { LoadingButton } from '@atlaskit/button';
|
|
6
6
|
import SearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import Textfield from '@atlaskit/textfield';
|
|
9
8
|
import { useDatasourceAnalyticsEvents } from '../../../../analytics';
|
|
10
9
|
import { basicSearchInputMessages } from './messages';
|
|
@@ -42,15 +41,8 @@ export const BasicSearchInput = ({
|
|
|
42
41
|
e.preventDefault();
|
|
43
42
|
handleSearchWithAnalytics();
|
|
44
43
|
};
|
|
45
|
-
const showBasicFilters = useMemo(() => {
|
|
46
|
-
if (getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters')) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}, []);
|
|
51
|
-
const isFullWidth = fullWidth || !showBasicFilters;
|
|
52
44
|
return jsx("form", {
|
|
53
|
-
css:
|
|
45
|
+
css: fullWidth ? formStyles : formWithMaxWidthStyles,
|
|
54
46
|
onSubmit: handleFormSubmit
|
|
55
47
|
}, jsx(Textfield, {
|
|
56
48
|
elemAfterInput: jsx(LoadingButton, {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import isEqual from 'lodash/isEqual';
|
|
4
|
+
import { useIntl } from 'react-intl-next';
|
|
5
|
+
import { CheckboxOption, PopupSelect } from '@atlaskit/select';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../../analytics';
|
|
7
|
+
import CustomControl from './control';
|
|
8
|
+
import CustomDropdownIndicator from './dropdownIndicator';
|
|
9
|
+
import PopupFooter from './footer';
|
|
10
|
+
import formatOptionLabel from './formatOptionLabel';
|
|
11
|
+
import CustomMenuList from './menu-list';
|
|
12
|
+
import { asyncPopupSelectMessages } from './messages';
|
|
13
|
+
import PopupTrigger from './trigger';
|
|
14
|
+
// Needed to disable filtering from react-select
|
|
15
|
+
const noFilterOptions = () => true;
|
|
16
|
+
export const FilterPopupSelect = ({
|
|
17
|
+
filterName,
|
|
18
|
+
totalCount,
|
|
19
|
+
status,
|
|
20
|
+
buttonLabel,
|
|
21
|
+
showLoading = false,
|
|
22
|
+
isDisabled = false,
|
|
23
|
+
showHydrating = false,
|
|
24
|
+
shouldShowFooter = true,
|
|
25
|
+
menuListProps,
|
|
26
|
+
options,
|
|
27
|
+
selectedOptions,
|
|
28
|
+
onSelectionChange,
|
|
29
|
+
onInputChange,
|
|
30
|
+
onMenuClose,
|
|
31
|
+
onMenuOpen
|
|
32
|
+
}) => {
|
|
33
|
+
const {
|
|
34
|
+
formatMessage
|
|
35
|
+
} = useIntl();
|
|
36
|
+
const {
|
|
37
|
+
fireEvent
|
|
38
|
+
} = useDatasourceAnalyticsEvents();
|
|
39
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
40
|
+
const [sortedOptions, setSortedOptions] = useState([]);
|
|
41
|
+
const sortPaginatedResults = useRef(false); // this is to track pagination for sorting purpose
|
|
42
|
+
|
|
43
|
+
const sortOptionsOnPopupOpen = useCallback(() => {
|
|
44
|
+
if (selectedOptions.length === 0) {
|
|
45
|
+
return setSortedOptions(options);
|
|
46
|
+
}
|
|
47
|
+
const nonSelectedOptions = options.filter(option => !selectedOptions.find(selectedOption => selectedOption.value === option.value));
|
|
48
|
+
const newOptions = [...selectedOptions, ...nonSelectedOptions];
|
|
49
|
+
if (!isEqual(newOptions, sortedOptions)) {
|
|
50
|
+
setSortedOptions(newOptions);
|
|
51
|
+
}
|
|
52
|
+
}, [selectedOptions, options, sortedOptions]);
|
|
53
|
+
const sortOptionsOnResolve = useCallback(() => {
|
|
54
|
+
// when the user is searching, we want the search result to be displayed as it is, and the select component will take care of marking the selected items
|
|
55
|
+
if (searchTerm) {
|
|
56
|
+
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
57
|
+
return setSortedOptions(options);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// sortedOptions is empty initially, this will take care of setting the initial value and bring the selected items to the top
|
|
61
|
+
if (sortedOptions.length === 0) {
|
|
62
|
+
return sortOptionsOnPopupOpen();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// this block handles the pagination, where on pagination, we will just append newOptions to the current list
|
|
66
|
+
if (sortPaginatedResults.current) {
|
|
67
|
+
const newOptions = options.filter(option => !sortedOptions.find(sortedOption => sortedOption.value === option.value));
|
|
68
|
+
if (newOptions.length > 0) {
|
|
69
|
+
setSortedOptions([...sortedOptions, ...newOptions]);
|
|
70
|
+
}
|
|
71
|
+
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
sortPaginatedResults.current = false; // set to false to indicate pagination resolve action is completed from the sorting perspective
|
|
75
|
+
sortOptionsOnPopupOpen();
|
|
76
|
+
}, [options, searchTerm, sortOptionsOnPopupOpen, sortedOptions]);
|
|
77
|
+
const handleMenuOpen = useCallback(() => {
|
|
78
|
+
if (status === 'resolved') {
|
|
79
|
+
sortOptionsOnPopupOpen();
|
|
80
|
+
}
|
|
81
|
+
fireEvent('ui.dropdown.opened.basicSearchDropdown', {
|
|
82
|
+
filterName,
|
|
83
|
+
selectionCount: selectedOptions.length
|
|
84
|
+
});
|
|
85
|
+
onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
|
|
86
|
+
}, [filterName, fireEvent, onMenuOpen, selectedOptions.length, sortOptionsOnPopupOpen, status]);
|
|
87
|
+
const handleMenuClose = useCallback(() => {
|
|
88
|
+
/**
|
|
89
|
+
* Clearing the search is to ensure that the sortOptionsOnPopupOpen logic does not mess up.
|
|
90
|
+
* Without this, when the user opens, sortOptionsOnPopupOpen will inject the selected options to the list and the list count and values will be off
|
|
91
|
+
*/
|
|
92
|
+
if (searchTerm) {
|
|
93
|
+
setSearchTerm('');
|
|
94
|
+
}
|
|
95
|
+
onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose();
|
|
96
|
+
fireEvent('ui.dropdown.closed.basicSearchDropdown', {
|
|
97
|
+
filterName,
|
|
98
|
+
selectionCount: selectedOptions.length
|
|
99
|
+
});
|
|
100
|
+
}, [filterName, fireEvent, onMenuClose, searchTerm, selectedOptions.length]);
|
|
101
|
+
const handleInputChange = useCallback(async (newSearchTerm, actionMeta) => {
|
|
102
|
+
if (actionMeta.action === 'input-change' && newSearchTerm !== searchTerm) {
|
|
103
|
+
setSearchTerm(newSearchTerm);
|
|
104
|
+
onInputChange(newSearchTerm, actionMeta);
|
|
105
|
+
}
|
|
106
|
+
}, [onInputChange, searchTerm]);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (status === 'resolved') {
|
|
109
|
+
sortOptionsOnResolve();
|
|
110
|
+
}
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
}, [status]); // we only want the sortOptionsOnResolve to run when there is a status change
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (status === 'loadingMore') {
|
|
116
|
+
sortPaginatedResults.current = true;
|
|
117
|
+
}
|
|
118
|
+
}, [status]);
|
|
119
|
+
return /*#__PURE__*/React.createElement(PopupSelect, {
|
|
120
|
+
isMulti: true,
|
|
121
|
+
maxMenuWidth: 300,
|
|
122
|
+
minMenuWidth: 300,
|
|
123
|
+
testId: `${filterName}-popup-select`,
|
|
124
|
+
inputId: `${filterName}-popup-select--input`
|
|
125
|
+
/*
|
|
126
|
+
this threshold controls the display of the search control (input field for search)
|
|
127
|
+
if this threshold is less than 0, when typing a search string that returns no results it will not remove the search control
|
|
128
|
+
if this threshold is 0 or higher, it will remove the search control when there are no results, the user will be unable to clear the search to see more results
|
|
129
|
+
*/,
|
|
130
|
+
searchThreshold: -1,
|
|
131
|
+
inputValue: searchTerm,
|
|
132
|
+
closeMenuOnSelect: false,
|
|
133
|
+
hideSelectedOptions: false,
|
|
134
|
+
isLoading: showLoading,
|
|
135
|
+
placeholder: formatMessage(asyncPopupSelectMessages.selectPlaceholder),
|
|
136
|
+
menuListProps: menuListProps,
|
|
137
|
+
components: {
|
|
138
|
+
Option: CheckboxOption,
|
|
139
|
+
Control: CustomControl,
|
|
140
|
+
MenuList: CustomMenuList,
|
|
141
|
+
DropdownIndicator: CustomDropdownIndicator,
|
|
142
|
+
LoadingIndicator: undefined,
|
|
143
|
+
// disables the three ... indicator in the searchbox when picker is loading
|
|
144
|
+
IndicatorSeparator: undefined // disables the | separator between search input and icon
|
|
145
|
+
},
|
|
146
|
+
options: sortedOptions,
|
|
147
|
+
value: selectedOptions,
|
|
148
|
+
filterOption: noFilterOptions,
|
|
149
|
+
formatOptionLabel: formatOptionLabel,
|
|
150
|
+
onChange: onSelectionChange,
|
|
151
|
+
onInputChange: handleInputChange,
|
|
152
|
+
onOpen: handleMenuOpen,
|
|
153
|
+
onClose: handleMenuClose,
|
|
154
|
+
target: ({
|
|
155
|
+
isOpen,
|
|
156
|
+
...triggerProps
|
|
157
|
+
}) => /*#__PURE__*/React.createElement(PopupTrigger, _extends({}, triggerProps, {
|
|
158
|
+
label: buttonLabel,
|
|
159
|
+
selectedOptions: selectedOptions,
|
|
160
|
+
isSelected: isOpen,
|
|
161
|
+
isDisabled: isDisabled,
|
|
162
|
+
isLoading: showHydrating,
|
|
163
|
+
testId: filterName
|
|
164
|
+
})),
|
|
165
|
+
footer: shouldShowFooter && /*#__PURE__*/React.createElement(PopupFooter, {
|
|
166
|
+
currentDisplayCount: options.length,
|
|
167
|
+
totalCount: totalCount
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
};
|
|
@@ -3,7 +3,7 @@ import { useDebouncedCallback } from 'use-debounce';
|
|
|
3
3
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
4
4
|
import { N500 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
|
|
6
|
-
import { SEARCH_DEBOUNCE_MS } from '
|
|
6
|
+
import { SEARCH_DEBOUNCE_MS } from '../../../../jira-issues-modal/basic-filters/ui/async-popup-select';
|
|
7
7
|
import { asyncPopupSelectMessages } from './messages';
|
|
8
8
|
import CustomSelectMessage from './selectMessage';
|
|
9
9
|
const getErrorReasonType = errors => {
|
|
@@ -17,7 +17,7 @@ const getErrorReasonType = errors => {
|
|
|
17
17
|
return 'unknown';
|
|
18
18
|
};
|
|
19
19
|
const CustomErrorMessage = ({
|
|
20
|
-
|
|
20
|
+
filterName,
|
|
21
21
|
errors
|
|
22
22
|
}) => {
|
|
23
23
|
const {
|
|
@@ -30,7 +30,7 @@ const CustomErrorMessage = ({
|
|
|
30
30
|
*/
|
|
31
31
|
const [debouncedAnalyticsCallback] = useDebouncedCallback(() => {
|
|
32
32
|
fireEvent('ui.error.shown.basicSearchDropdown', {
|
|
33
|
-
|
|
33
|
+
filterName,
|
|
34
34
|
reason: getErrorReasonType(errors)
|
|
35
35
|
});
|
|
36
36
|
}, SEARCH_DEBOUNCE_MS);
|
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { Box, Flex, xcss } from '@atlaskit/primitives';
|
|
3
3
|
import { components } from '@atlaskit/select';
|
|
4
4
|
import Spinner from '@atlaskit/spinner';
|
|
5
|
-
import ShowMoreButton from '../async-popup-select/showMoreButton';
|
|
6
5
|
import CustomErrorMessage from './errorMessage';
|
|
7
6
|
import CustomDropdownLoadingMessage from './loadingMessage';
|
|
8
7
|
import CustomNoOptionsMessage from './noOptionsMessage';
|
|
8
|
+
import ShowMoreButton from './showMoreButton';
|
|
9
9
|
const inlineSpinnerStyles = xcss({
|
|
10
10
|
paddingTop: 'space.075'
|
|
11
11
|
});
|
|
@@ -18,7 +18,7 @@ const CustomMenuList = ({
|
|
|
18
18
|
...props
|
|
19
19
|
}) => {
|
|
20
20
|
const {
|
|
21
|
-
|
|
21
|
+
filterName,
|
|
22
22
|
isLoading,
|
|
23
23
|
isLoadingMore,
|
|
24
24
|
isError,
|
|
@@ -41,19 +41,20 @@ const CustomMenuList = ({
|
|
|
41
41
|
}
|
|
42
42
|
if (isError) {
|
|
43
43
|
return /*#__PURE__*/React.createElement(CustomErrorMessage, {
|
|
44
|
-
|
|
44
|
+
filterName: filterName,
|
|
45
45
|
errors: errors
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
if (isEmpty) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(CustomNoOptionsMessage, {
|
|
50
|
-
|
|
50
|
+
filterName: filterName
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children, shouldDisplayShowMore && /*#__PURE__*/React.createElement(Box, {
|
|
54
54
|
xcss: showMoreButtonBoxStyles
|
|
55
55
|
}, /*#__PURE__*/React.createElement(ShowMoreButton, {
|
|
56
|
-
onShowMore: handleShowMore
|
|
56
|
+
onShowMore: handleShowMore,
|
|
57
|
+
filterName: filterName
|
|
57
58
|
})), isLoadingMoreData && /*#__PURE__*/React.createElement(InlineSpinner, null));
|
|
58
59
|
};
|
|
59
60
|
return /*#__PURE__*/React.createElement(components.MenuList, props, renderChildren());
|
|
@@ -14,5 +14,10 @@ export const asyncPopupSelectMessages = defineMessages({
|
|
|
14
14
|
id: 'linkDataSource.basic-filter.error-message',
|
|
15
15
|
defaultMessage: 'Something went wrong',
|
|
16
16
|
description: 'The text for when an error occurs when loading options'
|
|
17
|
+
},
|
|
18
|
+
showMoreMessage: {
|
|
19
|
+
id: 'linkDataSource.basic-filter.showMoreButton',
|
|
20
|
+
defaultMessage: 'Show more',
|
|
21
|
+
description: 'The text to show more options in dropdown'
|
|
17
22
|
}
|
|
18
23
|
});
|
|
@@ -3,11 +3,11 @@ import { useDebouncedCallback } from 'use-debounce';
|
|
|
3
3
|
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
4
4
|
import { N500 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { useDatasourceAnalyticsEvents } from '../../../../../analytics';
|
|
6
|
-
import { SEARCH_DEBOUNCE_MS } from '
|
|
6
|
+
import { SEARCH_DEBOUNCE_MS } from '../../../../jira-issues-modal/basic-filters/ui/async-popup-select';
|
|
7
7
|
import { asyncPopupSelectMessages } from './messages';
|
|
8
8
|
import CustomSelectMessage from './selectMessage';
|
|
9
9
|
const CustomNoOptionsMessage = ({
|
|
10
|
-
|
|
10
|
+
filterName
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
fireEvent
|
|
@@ -21,7 +21,7 @@ const CustomNoOptionsMessage = ({
|
|
|
21
21
|
*/
|
|
22
22
|
const [debouncedAnalyticsCallback] = useDebouncedCallback(() => {
|
|
23
23
|
fireEvent('ui.emptyResult.shown.basicSearchDropdown', {
|
|
24
|
-
|
|
24
|
+
filterName
|
|
25
25
|
});
|
|
26
26
|
}, SEARCH_DEBOUNCE_MS);
|
|
27
27
|
useEffect(debouncedAnalyticsCallback, [debouncedAnalyticsCallback]);
|