@atlaskit/link-datasource 1.27.3 → 1.28.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 +12 -0
- package/dist/cjs/ui/common/modal/popup-select/constants.js +8 -0
- package/dist/cjs/ui/common/modal/popup-select/footer.js +3 -2
- package/dist/cjs/ui/common/modal/popup-select/formatOptionLabel.js +11 -6
- package/dist/cjs/ui/common/modal/popup-select/index.js +2 -1
- package/dist/cjs/ui/common/modal/popup-select/menu-list/errorMessage.js +3 -3
- package/dist/cjs/ui/common/modal/popup-select/menu-list/index.js +4 -2
- package/dist/cjs/ui/common/modal/popup-select/menu-list/loadingMessage.js +3 -2
- package/dist/cjs/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +3 -3
- package/dist/cjs/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +19 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +89 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +49 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +75 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +32 -0
- package/dist/cjs/ui/confluence-search-modal/basic-filters/index.js +5 -3
- package/dist/cjs/ui/confluence-search-modal/basic-filters/types.js +11 -0
- package/dist/cjs/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
- package/dist/cjs/ui/confluence-search-modal/modal/index.js +36 -15
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +6 -5
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +3 -3
- package/dist/cjs/ui/table-footer/index.js +8 -2
- package/dist/cjs/ui/table-footer/messages.js +5 -0
- package/dist/cjs/ui/table-footer/powered-by-jsm-assets/index.js +53 -0
- package/dist/es2019/ui/common/modal/popup-select/constants.js +2 -0
- package/dist/es2019/ui/common/modal/popup-select/footer.js +3 -2
- package/dist/es2019/ui/common/modal/popup-select/formatOptionLabel.js +8 -6
- package/dist/es2019/ui/common/modal/popup-select/index.js +2 -1
- package/dist/es2019/ui/common/modal/popup-select/menu-list/errorMessage.js +2 -2
- package/dist/es2019/ui/common/modal/popup-select/menu-list/index.js +4 -2
- package/dist/es2019/ui/common/modal/popup-select/menu-list/loadingMessage.js +4 -2
- package/dist/es2019/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +2 -2
- package/dist/es2019/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +7 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +68 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +66 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +26 -0
- package/dist/es2019/ui/confluence-search-modal/basic-filters/index.js +7 -2
- package/dist/es2019/ui/confluence-search-modal/basic-filters/types.js +5 -0
- package/dist/es2019/ui/confluence-search-modal/confluence-search-container/index.js +13 -1
- package/dist/es2019/ui/confluence-search-modal/modal/index.js +27 -8
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -3
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +1 -1
- package/dist/es2019/ui/table-footer/index.js +7 -1
- package/dist/es2019/ui/table-footer/messages.js +5 -0
- package/dist/es2019/ui/table-footer/powered-by-jsm-assets/index.js +45 -0
- package/dist/esm/ui/common/modal/popup-select/constants.js +2 -0
- package/dist/esm/ui/common/modal/popup-select/footer.js +3 -2
- package/dist/esm/ui/common/modal/popup-select/formatOptionLabel.js +8 -6
- package/dist/esm/ui/common/modal/popup-select/index.js +2 -1
- package/dist/esm/ui/common/modal/popup-select/menu-list/errorMessage.js +2 -2
- package/dist/esm/ui/common/modal/popup-select/menu-list/index.js +4 -2
- package/dist/esm/ui/common/modal/popup-select/menu-list/loadingMessage.js +3 -2
- package/dist/esm/ui/common/modal/popup-select/menu-list/noOptionsMessage.js +2 -2
- package/dist/esm/ui/common/modal/popup-select/menu-list/showMoreButton.js +1 -1
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.js +9 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js +79 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +43 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.js +68 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.js +25 -0
- package/dist/esm/ui/confluence-search-modal/basic-filters/index.js +5 -3
- package/dist/esm/ui/confluence-search-modal/basic-filters/types.js +5 -0
- package/dist/esm/ui/confluence-search-modal/confluence-search-container/index.js +16 -1
- package/dist/esm/ui/confluence-search-modal/modal/index.js +36 -15
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +4 -3
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +1 -1
- package/dist/esm/ui/table-footer/index.js +8 -2
- package/dist/esm/ui/table-footer/messages.js +5 -0
- package/dist/esm/ui/table-footer/powered-by-jsm-assets/index.js +46 -0
- package/dist/types/analytics/generated/analytics.types.d.ts +7 -0
- package/dist/types/ui/common/modal/popup-select/constants.d.ts +2 -0
- package/dist/types/ui/common/modal/popup-select/footer.d.ts +2 -1
- package/dist/types/ui/common/modal/popup-select/index.d.ts +5 -4
- package/dist/types/ui/common/modal/popup-select/menu-list/index.d.ts +1 -1
- package/dist/types/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +3 -1
- package/dist/types/ui/common/modal/popup-select/types.d.ts +6 -1
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
- package/dist/types/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
- package/dist/types/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
- package/dist/types/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
- package/dist/types/ui/confluence-search-modal/types.d.ts +4 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/types.d.ts +1 -20
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -2
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/index.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -1
- package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +0 -1
- package/dist/types/ui/table-footer/index.d.ts +2 -1
- package/dist/types/ui/table-footer/messages.d.ts +5 -0
- package/dist/types/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +7 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/constants.d.ts +2 -0
- package/dist/types-ts4.5/ui/common/modal/popup-select/footer.d.ts +2 -1
- package/dist/types-ts4.5/ui/common/modal/popup-select/index.d.ts +5 -4
- package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/common/modal/popup-select/menu-list/loadingMessage.d.ts +3 -1
- package/dist/types-ts4.5/ui/common/modal/popup-select/types.d.ts +6 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/PopupComponent.d.ts +3 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.d.ts +42 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/styled.d.ts +31 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/filters/date-range-picker/trigger.d.ts +10 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/index.d.ts +4 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/basic-filters/types.d.ts +20 -0
- package/dist/types-ts4.5/ui/confluence-search-modal/confluence-search-container/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/confluence-search-modal/types.d.ts +4 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.d.ts +2 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/types.d.ts +1 -20
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +2 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/table-footer/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/table-footer/messages.d.ts +5 -0
- package/dist/types-ts4.5/ui/table-footer/powered-by-jsm-assets/index.d.ts +4 -0
- package/examples-helpers/buildAssetsIssuesTable.tsx +71 -0
- package/examples-helpers/useAssetsTableProps.tsx +57 -0
- package/package.json +10 -5
|
@@ -84,7 +84,10 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
84
84
|
viewMode = _props$viewMode === void 0 ? 'table' : _props$viewMode,
|
|
85
85
|
initialParameters = props.parameters,
|
|
86
86
|
urlBeingEdited = props.url,
|
|
87
|
-
initialVisibleColumnKeys = props.visibleColumnKeys
|
|
87
|
+
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
88
|
+
_props$disableDisplay = props.disableDisplayDropdown,
|
|
89
|
+
disableDisplayDropdown = _props$disableDisplay === void 0 ? false : _props$disableDisplay,
|
|
90
|
+
overrideParameters = props.overrideParameters;
|
|
88
91
|
var _useState = (0, _react.useState)(undefined),
|
|
89
92
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
90
93
|
availableSites = _useState2[0],
|
|
@@ -105,6 +108,10 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
105
108
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
106
109
|
visibleColumnKeys = _useState10[0],
|
|
107
110
|
setVisibleColumnKeys = _useState10[1];
|
|
111
|
+
var _useState11 = (0, _react.useState)(),
|
|
112
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
113
|
+
lastModified = _useState12[0],
|
|
114
|
+
setLastModified = _useState12[1];
|
|
108
115
|
|
|
109
116
|
// analytics related parameters
|
|
110
117
|
var searchCount = (0, _react.useRef)(0);
|
|
@@ -117,16 +124,24 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
117
124
|
return _objectSpread(_objectSpread({}, initialParameters), {}, {
|
|
118
125
|
cloudId: cloudId,
|
|
119
126
|
searchString: searchString
|
|
127
|
+
}, lastModified && {
|
|
128
|
+
lastModified: lastModified
|
|
120
129
|
});
|
|
121
|
-
}, [cloudId, initialParameters, searchString /** Add more parameters when more filters are added */]);
|
|
130
|
+
}, [cloudId, lastModified, initialParameters, searchString /** Add more parameters when more filters are added */]);
|
|
122
131
|
var isParametersSet = (0, _react.useMemo)(function () {
|
|
123
132
|
return !!cloudId && Object.values(parameters !== null && parameters !== void 0 ? parameters : {}).filter(function (v) {
|
|
124
133
|
return v !== undefined;
|
|
125
134
|
}).length > 1;
|
|
126
135
|
}, [cloudId, parameters]);
|
|
136
|
+
var parametersToSend = (0, _react.useMemo)(function () {
|
|
137
|
+
if (!isParametersSet) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
return _objectSpread(_objectSpread({}, parameters), overrideParameters !== null && overrideParameters !== void 0 ? overrideParameters : {});
|
|
141
|
+
}, [parameters, overrideParameters, isParametersSet]);
|
|
127
142
|
var _useDatasourceTableSt = (0, _useDatasourceTableState.useDatasourceTableState)({
|
|
128
143
|
datasourceId: datasourceId,
|
|
129
|
-
parameters:
|
|
144
|
+
parameters: parametersToSend,
|
|
130
145
|
fieldKeys: visibleColumnKeys
|
|
131
146
|
}),
|
|
132
147
|
reset = _useDatasourceTableSt.reset,
|
|
@@ -218,17 +233,17 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
218
233
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
219
234
|
}, [initialVisibleColumnKeys, defaultVisibleColumnKeys]);
|
|
220
235
|
var siteSelectorLabel = availableSites && availableSites.length > 1 ? _messages.confluenceSearchModalMessages.insertIssuesTitleManySites : _messages.confluenceSearchModalMessages.insertIssuesTitle;
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
columnCustomSizes =
|
|
224
|
-
setColumnCustomSizes =
|
|
236
|
+
var _useState13 = (0, _react.useState)(initialColumnCustomSizes),
|
|
237
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
238
|
+
columnCustomSizes = _useState14[0],
|
|
239
|
+
setColumnCustomSizes = _useState14[1];
|
|
225
240
|
var onColumnResize = (0, _react.useCallback)(function (key, width) {
|
|
226
241
|
setColumnCustomSizes(_objectSpread(_objectSpread({}, columnCustomSizes), {}, (0, _defineProperty2.default)({}, key, width)));
|
|
227
242
|
}, [columnCustomSizes]);
|
|
228
|
-
var
|
|
229
|
-
|
|
230
|
-
wrappedColumnKeys =
|
|
231
|
-
setWrappedColumnKeys =
|
|
243
|
+
var _useState15 = (0, _react.useState)(initialWrappedColumnKeys),
|
|
244
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
245
|
+
wrappedColumnKeys = _useState16[0],
|
|
246
|
+
setWrappedColumnKeys = _useState16[1];
|
|
232
247
|
var onWrappedColumnChange = (0, _react.useCallback)(function (key, isWrapped) {
|
|
233
248
|
var set = new Set(wrappedColumnKeys);
|
|
234
249
|
if (isWrapped) {
|
|
@@ -381,7 +396,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
381
396
|
} else {
|
|
382
397
|
onInsert((0, _adf.buildDatasourceAdf)({
|
|
383
398
|
id: datasourceId,
|
|
384
|
-
parameters: _objectSpread(_objectSpread({},
|
|
399
|
+
parameters: _objectSpread(_objectSpread({}, parametersToSend), {}, {
|
|
385
400
|
cloudId: cloudId
|
|
386
401
|
}),
|
|
387
402
|
views: [{
|
|
@@ -402,14 +417,20 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
402
417
|
}]
|
|
403
418
|
}, confluenceSearchUrl), consumerEvent);
|
|
404
419
|
}
|
|
405
|
-
}, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId,
|
|
420
|
+
}, [isParametersSet, cloudId, analyticsPayload, totalCount, currentViewMode, onInsert, confluenceSearchUrl, datasourceId, parametersToSend, visibleColumnKeys, columnCustomSizes, wrappedColumnKeys]);
|
|
406
421
|
var handleViewModeChange = function handleViewModeChange(selectedMode) {
|
|
407
422
|
userInteractionActions.current.add(_types.DatasourceAction.DISPLAY_VIEW_CHANGED);
|
|
408
423
|
setCurrentViewMode(selectedMode);
|
|
409
424
|
};
|
|
410
|
-
var onSearch = (0, _react.useCallback)(function (newSearchString) {
|
|
425
|
+
var onSearch = (0, _react.useCallback)(function (newSearchString, filters) {
|
|
411
426
|
searchCount.current++;
|
|
412
427
|
userInteractionActions.current.add(_types.DatasourceAction.QUERY_UPDATED);
|
|
428
|
+
if (filters !== null && filters !== void 0 && filters.lastModified) {
|
|
429
|
+
var lastModifiedValue = filters.lastModified.find(function (range) {
|
|
430
|
+
return range.value;
|
|
431
|
+
});
|
|
432
|
+
setLastModified(lastModifiedValue === null || lastModifiedValue === void 0 ? void 0 : lastModifiedValue.value);
|
|
433
|
+
}
|
|
413
434
|
setSearchString(newSearchString);
|
|
414
435
|
reset({
|
|
415
436
|
shouldForceRequest: true
|
|
@@ -438,7 +459,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
438
459
|
selectedSite: selectedConfluenceSite,
|
|
439
460
|
testId: "confluence-search-datasource-modal--site-selector",
|
|
440
461
|
label: siteSelectorLabel
|
|
441
|
-
})), !hasNoConfluenceSites && (0, _react2.jsx)(_displayViewDropDown.DisplayViewDropDown, {
|
|
462
|
+
})), !hasNoConfluenceSites && !disableDisplayDropdown && (0, _react2.jsx)(_displayViewDropDown.DisplayViewDropDown, {
|
|
442
463
|
onViewModeChange: handleViewModeChange,
|
|
443
464
|
viewMode: currentViewMode
|
|
444
465
|
})), (0, _react2.jsx)(_modalDialog.ModalBody, null, !hasNoConfluenceSites ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_primitives.Box, {
|
|
@@ -178,6 +178,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
178
178
|
testId: "datasource-table-view-skeleton",
|
|
179
179
|
isCompact: true
|
|
180
180
|
}), (0, _react2.jsx)(_tableFooter.TableFooter, {
|
|
181
|
+
datasourceId: datasourceId,
|
|
181
182
|
itemCount: isDataReady ? totalCount : undefined,
|
|
182
183
|
onRefresh: onRefresh,
|
|
183
184
|
isLoading: !isDataReady || status === 'loading',
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -14,11 +14,11 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
14
14
|
var _reactIntlNext = require("react-intl-next");
|
|
15
15
|
var _useDebounce = require("use-debounce");
|
|
16
16
|
var _popupSelect = require("../../../../common/modal/popup-select");
|
|
17
|
+
var _constants = require("../../../../common/modal/popup-select/constants");
|
|
17
18
|
var _useFilterOptions2 = require("../../hooks/useFilterOptions");
|
|
18
19
|
var _messages = require("./messages");
|
|
19
20
|
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); }
|
|
20
21
|
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; }
|
|
21
|
-
var SEARCH_DEBOUNCE_MS = exports.SEARCH_DEBOUNCE_MS = 350;
|
|
22
22
|
var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
23
23
|
var filterType = _ref.filterType,
|
|
24
24
|
site = _ref.site,
|
|
@@ -56,7 +56,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
56
56
|
fetchFilterOptions({
|
|
57
57
|
searchString: searchString
|
|
58
58
|
});
|
|
59
|
-
}, SEARCH_DEBOUNCE_MS),
|
|
59
|
+
}, _constants.SEARCH_DEBOUNCE_MS),
|
|
60
60
|
_useDebouncedCallback2 = (0, _slicedToArray2.default)(_useDebouncedCallback, 1),
|
|
61
61
|
handleDebouncedFetchFilterOptions = _useDebouncedCallback2[0];
|
|
62
62
|
var handleInputChange = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
@@ -114,11 +114,12 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
114
114
|
var isEmpty = status === 'resolved' && filterOptionsLength === 0;
|
|
115
115
|
var popupSelectOptions = isLoading || isError ? [] : filterOptions; // if not set to [], then on loading, no loading UI will be shown
|
|
116
116
|
var areAllResultsLoaded = filterOptionsLength === totalCount;
|
|
117
|
+
var filterName = "jlol-basic-filter-".concat(filterType);
|
|
117
118
|
var shouldShowFooter = (status === 'resolved' || isLoadingMore) && filterOptionsLength > 0; // footer should not disappear when there is an inline spinner for loading more data
|
|
118
119
|
var shouldDisplayShowMoreButton = status === 'resolved' && !!pageCursor && !areAllResultsLoaded;
|
|
119
120
|
var triggerButtonLabel = formatMessage(_messages.asyncPopupSelectMessages["".concat(filterType, "Label")]);
|
|
120
121
|
return /*#__PURE__*/_react.default.createElement(_popupSelect.FilterPopupSelect, {
|
|
121
|
-
filterName:
|
|
122
|
+
filterName: filterName,
|
|
122
123
|
status: status,
|
|
123
124
|
showLoading: isLoading,
|
|
124
125
|
showHydrating: isJQLHydrating,
|
|
@@ -132,7 +133,7 @@ var AsyncPopupSelect = function AsyncPopupSelect(_ref) {
|
|
|
132
133
|
onSelectionChange: handleOptionSelection,
|
|
133
134
|
onMenuOpen: handleMenuOpen,
|
|
134
135
|
menuListProps: {
|
|
135
|
-
filterName:
|
|
136
|
+
filterName: filterName,
|
|
136
137
|
isError: isError,
|
|
137
138
|
isEmpty: isEmpty,
|
|
138
139
|
isLoading: isLoading,
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.JiraSearchContainer = exports.
|
|
8
|
+
exports.JiraSearchContainer = exports.DEFAULT_JQL_QUERY = exports.ALLOWED_ORDER_BY_KEYS = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -18,6 +18,7 @@ var _primitives = require("@atlaskit/primitives");
|
|
|
18
18
|
var _analytics = require("../../../analytics");
|
|
19
19
|
var _basicSearchInput = require("../../common/modal/basic-search-input");
|
|
20
20
|
var _messages = require("../../common/modal/basic-search-input/messages");
|
|
21
|
+
var _constants = require("../../common/modal/popup-select/constants");
|
|
21
22
|
var _basicFilters = require("../basic-filters");
|
|
22
23
|
var _useHydrateJqlQuery2 = require("../basic-filters/hooks/useHydrateJqlQuery");
|
|
23
24
|
var _isQueryTooComplex = require("../basic-filters/utils/isQueryTooComplex");
|
|
@@ -40,7 +41,6 @@ var basicSearchInputContainerStyles = (0, _primitives.xcss)({
|
|
|
40
41
|
});
|
|
41
42
|
var DEFAULT_JQL_QUERY = exports.DEFAULT_JQL_QUERY = 'ORDER BY created DESC';
|
|
42
43
|
var ALLOWED_ORDER_BY_KEYS = exports.ALLOWED_ORDER_BY_KEYS = ['key', 'summary', 'assignee', 'status', 'created'];
|
|
43
|
-
var FILTER_SELECTION_DEBOUNCE_MS = exports.FILTER_SELECTION_DEBOUNCE_MS = 500;
|
|
44
44
|
var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchContainer(props) {
|
|
45
45
|
var isSearching = props.isSearching,
|
|
46
46
|
parameters = props.parameters,
|
|
@@ -178,7 +178,7 @@ var JiraSearchContainer = exports.JiraSearchContainer = function JiraSearchConta
|
|
|
178
178
|
basicFilterSelections: filterSelections,
|
|
179
179
|
isQueryComplex: isCurrentQueryComplex
|
|
180
180
|
});
|
|
181
|
-
}, FILTER_SELECTION_DEBOUNCE_MS),
|
|
181
|
+
}, _constants.FILTER_SELECTION_DEBOUNCE_MS),
|
|
182
182
|
_useDebouncedCallback2 = (0, _slicedToArray2.default)(_useDebouncedCallback, 1),
|
|
183
183
|
debouncedBasicFilterSelectionChange = _useDebouncedCallback2[0];
|
|
184
184
|
var handleBasicFilterSelectionChange = (0, _react.useCallback)(function (filterType, options) {
|
|
@@ -14,9 +14,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
14
14
|
var _button = _interopRequireDefault(require("@atlaskit/button"));
|
|
15
15
|
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
16
16
|
var _refresh = _interopRequireDefault(require("@atlaskit/icon/glyph/refresh"));
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
18
|
var _linkUrl = _interopRequireDefault(require("@atlaskit/smart-card/link-url"));
|
|
18
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
20
|
+
var _assetsModal = require("../assets-modal");
|
|
19
21
|
var _messages = require("./messages");
|
|
22
|
+
var _poweredByJsmAssets = require("./powered-by-jsm-assets");
|
|
20
23
|
var _syncInfo = require("./sync-info");
|
|
21
24
|
/** @jsx jsx */
|
|
22
25
|
|
|
@@ -49,7 +52,8 @@ var SyncTextWrapper = _styled.default.div({
|
|
|
49
52
|
fontSize: '12px'
|
|
50
53
|
});
|
|
51
54
|
var TableFooter = exports.TableFooter = function TableFooter(_ref) {
|
|
52
|
-
var
|
|
55
|
+
var datasourceId = _ref.datasourceId,
|
|
56
|
+
itemCount = _ref.itemCount,
|
|
53
57
|
onRefresh = _ref.onRefresh,
|
|
54
58
|
isLoading = _ref.isLoading,
|
|
55
59
|
url = _ref.url;
|
|
@@ -88,7 +92,9 @@ var TableFooter = exports.TableFooter = function TableFooter(_ref) {
|
|
|
88
92
|
values: {
|
|
89
93
|
itemCount: itemCount
|
|
90
94
|
}
|
|
91
|
-
}))))), (0,
|
|
95
|
+
}))))), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_objects_add_jsm_promotional_tag') && datasourceId === _assetsModal.ASSETS_LIST_OF_LINKS_DATASOURCE_ID ? (0, _react2.jsx)(_poweredByJsmAssets.PoweredByJSMAssets, {
|
|
96
|
+
text: intl.formatMessage(_messages.footerMessages.powerByJSM)
|
|
97
|
+
}) : null, (0, _react2.jsx)(SyncWrapper, null, onRefresh && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(SyncTextWrapper, {
|
|
92
98
|
"data-testid": "sync-text"
|
|
93
99
|
}, isLoading ? (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.footerMessages.loadingText) : (0, _react2.jsx)(_syncInfo.SyncInfo, {
|
|
94
100
|
lastSyncTime: lastSyncTime
|
|
@@ -20,5 +20,10 @@ var footerMessages = exports.footerMessages = (0, _reactIntlNext.defineMessages)
|
|
|
20
20
|
id: 'linkDataSource.table-footer.refresh',
|
|
21
21
|
description: 'Label for refresh icon',
|
|
22
22
|
defaultMessage: 'Refresh'
|
|
23
|
+
},
|
|
24
|
+
powerByJSM: {
|
|
25
|
+
id: 'linkDataSource.table-footer.power-by-jsm',
|
|
26
|
+
description: 'Displayed on the issue like table footer to increase JSM Assets visibility',
|
|
27
|
+
defaultMessage: 'Powered by Assets in Jira Service Management'
|
|
23
28
|
}
|
|
24
29
|
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PoweredByJSMAssets = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _logo = require("@atlaskit/logo");
|
|
10
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
|
+
var _analytics = require("../../../analytics");
|
|
12
|
+
var jsmTextStyles = (0, _primitives.xcss)({
|
|
13
|
+
fontSize: 'small',
|
|
14
|
+
color: 'color.text.subtle',
|
|
15
|
+
marginLeft: "var(--ds-space-075, 6px)",
|
|
16
|
+
':hover': {
|
|
17
|
+
color: 'color.link.pressed'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var jsmContainerStyles = (0, _primitives.xcss)({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'row-reverse'
|
|
23
|
+
});
|
|
24
|
+
var PoweredByJSMAssets = exports.PoweredByJSMAssets = function PoweredByJSMAssets(props) {
|
|
25
|
+
var ASSETS_LINK = '/jira/servicedesk/assets';
|
|
26
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
27
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
29
|
+
xcss: jsmContainerStyles,
|
|
30
|
+
padding: "space.150"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
32
|
+
"data-testid": 'powered-by-jsm-assets-link',
|
|
33
|
+
onClick: function onClick() {
|
|
34
|
+
return fireEvent('ui.link.clicked.poweredBy', {
|
|
35
|
+
componentHierarchy: 'datasourceTable',
|
|
36
|
+
extensionKey: 'jsm-cmdb-gateway'
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
href: ASSETS_LINK,
|
|
40
|
+
rel: "noreferrer",
|
|
41
|
+
target: "_blank",
|
|
42
|
+
style: {
|
|
43
|
+
display: 'inline-flex',
|
|
44
|
+
alignItems: 'center'
|
|
45
|
+
}
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_logo.JiraServiceManagementIcon, {
|
|
47
|
+
size: "xsmall",
|
|
48
|
+
appearance: "brand",
|
|
49
|
+
label: props.text
|
|
50
|
+
}), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
51
|
+
xcss: jsmTextStyles
|
|
52
|
+
}, props.text)));
|
|
53
|
+
};
|
|
@@ -16,10 +16,11 @@ const footerPaginationInfoStyles = xcss({
|
|
|
16
16
|
});
|
|
17
17
|
const PopupFooter = ({
|
|
18
18
|
currentDisplayCount,
|
|
19
|
-
totalCount
|
|
19
|
+
totalCount,
|
|
20
|
+
filterName
|
|
20
21
|
}) => {
|
|
21
22
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
22
|
-
testId:
|
|
23
|
+
testId: `${filterName}--footer`,
|
|
23
24
|
direction: "row",
|
|
24
25
|
alignItems: "center",
|
|
25
26
|
justifyContent: "end",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
2
|
import Avatar from '@atlaskit/avatar';
|
|
3
3
|
import PeopleGroupIcon from '@atlaskit/icon/glyph/people-group';
|
|
4
4
|
import Lozenge from '@atlaskit/lozenge';
|
|
@@ -32,7 +32,7 @@ const IconOptionLabel = ({
|
|
|
32
32
|
};
|
|
33
33
|
return /*#__PURE__*/React.createElement(AvatarOptionLabel, {
|
|
34
34
|
data: avatarOptionLabelData,
|
|
35
|
-
testId: "
|
|
35
|
+
testId: "basic-filter-popup-select-option--icon-label"
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
const LozengeOptionLabel = ({
|
|
@@ -40,7 +40,7 @@ const LozengeOptionLabel = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
return /*#__PURE__*/React.createElement(Lozenge, {
|
|
42
42
|
appearance: data.appearance,
|
|
43
|
-
testId: "
|
|
43
|
+
testId: "basic-filter-popup-select-option--lozenge"
|
|
44
44
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
45
45
|
xcss: [commonLabelStyles]
|
|
46
46
|
}, data.label));
|
|
@@ -51,7 +51,7 @@ const AvatarOptionLabel = ({
|
|
|
51
51
|
}) => {
|
|
52
52
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
53
53
|
alignItems: "center",
|
|
54
|
-
testId: testId || '
|
|
54
|
+
testId: testId || 'basic-filter-popup-select-option--avatar'
|
|
55
55
|
}, data.isGroup ? /*#__PURE__*/React.createElement(Flex, {
|
|
56
56
|
alignItems: "center",
|
|
57
57
|
justifyContent: "center",
|
|
@@ -64,11 +64,13 @@ const AvatarOptionLabel = ({
|
|
|
64
64
|
src: data.avatar,
|
|
65
65
|
size: "xsmall"
|
|
66
66
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
67
|
-
xcss: [commonLabelStyles, avatarOptionLabelStyles]
|
|
68
|
-
testId: "nidhin"
|
|
67
|
+
xcss: [commonLabelStyles, avatarOptionLabelStyles]
|
|
69
68
|
}, data.label));
|
|
70
69
|
};
|
|
71
70
|
const formatOptionLabel = data => {
|
|
71
|
+
if (data.optionType === 'defaultOption') {
|
|
72
|
+
return /*#__PURE__*/React.createElement(Fragment, null);
|
|
73
|
+
}
|
|
72
74
|
if (data.optionType === 'lozengeLabel') {
|
|
73
75
|
return /*#__PURE__*/React.createElement(LozengeOptionLabel, {
|
|
74
76
|
data: data
|
|
@@ -168,7 +168,8 @@ export const FilterPopupSelect = ({
|
|
|
168
168
|
})),
|
|
169
169
|
footer: shouldShowFooter && /*#__PURE__*/React.createElement(PopupFooter, {
|
|
170
170
|
currentDisplayCount: options.length,
|
|
171
|
-
totalCount: totalCount
|
|
171
|
+
totalCount: totalCount,
|
|
172
|
+
filterName: filterName
|
|
172
173
|
})
|
|
173
174
|
});
|
|
174
175
|
};
|
|
@@ -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 '../constants';
|
|
7
7
|
import { asyncPopupSelectMessages } from './messages';
|
|
8
8
|
import CustomSelectMessage from './selectMessage';
|
|
9
9
|
const getErrorReasonType = errors => {
|
|
@@ -42,7 +42,7 @@ const CustomErrorMessage = ({
|
|
|
42
42
|
size: "xlarge"
|
|
43
43
|
}),
|
|
44
44
|
message: asyncPopupSelectMessages.errorMessage,
|
|
45
|
-
testId:
|
|
45
|
+
testId: `${filterName}--error-message`
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
export default CustomErrorMessage;
|
|
@@ -37,7 +37,9 @@ const CustomMenuList = ({
|
|
|
37
37
|
}));
|
|
38
38
|
const renderChildren = () => {
|
|
39
39
|
if (isLoading) {
|
|
40
|
-
return /*#__PURE__*/React.createElement(CustomDropdownLoadingMessage,
|
|
40
|
+
return /*#__PURE__*/React.createElement(CustomDropdownLoadingMessage, {
|
|
41
|
+
filterName: filterName
|
|
42
|
+
});
|
|
41
43
|
}
|
|
42
44
|
if (isError) {
|
|
43
45
|
return /*#__PURE__*/React.createElement(CustomErrorMessage, {
|
|
@@ -50,7 +52,7 @@ const CustomMenuList = ({
|
|
|
50
52
|
filterName: filterName
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children, shouldDisplayShowMore && /*#__PURE__*/React.createElement(Box, {
|
|
55
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children, shouldDisplayShowMore && handleShowMore && /*#__PURE__*/React.createElement(Box, {
|
|
54
56
|
xcss: showMoreButtonBoxStyles
|
|
55
57
|
}, /*#__PURE__*/React.createElement(ShowMoreButton, {
|
|
56
58
|
onShowMore: handleShowMore,
|
|
@@ -2,13 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import Spinner from '@atlaskit/spinner';
|
|
3
3
|
import { asyncPopupSelectMessages } from './messages';
|
|
4
4
|
import CustomSelectMessage from './selectMessage';
|
|
5
|
-
const CustomDropdownLoadingMessage = (
|
|
5
|
+
const CustomDropdownLoadingMessage = ({
|
|
6
|
+
filterName
|
|
7
|
+
}) => {
|
|
6
8
|
return /*#__PURE__*/React.createElement(CustomSelectMessage, {
|
|
7
9
|
icon: /*#__PURE__*/React.createElement(Spinner, {
|
|
8
10
|
size: "large"
|
|
9
11
|
}),
|
|
10
12
|
message: asyncPopupSelectMessages.loadingMessage,
|
|
11
|
-
testId:
|
|
13
|
+
testId: `${filterName}--loading-message`
|
|
12
14
|
});
|
|
13
15
|
};
|
|
14
16
|
export default CustomDropdownLoadingMessage;
|
|
@@ -3,7 +3,7 @@ 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 '../constants';
|
|
7
7
|
import { asyncPopupSelectMessages } from './messages';
|
|
8
8
|
import CustomSelectMessage from './selectMessage';
|
|
9
9
|
const CustomNoOptionsMessage = ({
|
|
@@ -32,7 +32,7 @@ const CustomNoOptionsMessage = ({
|
|
|
32
32
|
label: ""
|
|
33
33
|
}),
|
|
34
34
|
message: asyncPopupSelectMessages.noOptionsMessage,
|
|
35
|
-
testId:
|
|
35
|
+
testId: `${filterName}--no-options-message`
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
export default CustomNoOptionsMessage;
|
|
@@ -23,7 +23,7 @@ const ShowMoreButton = ({
|
|
|
23
23
|
return /*#__PURE__*/React.createElement(Button, {
|
|
24
24
|
onClick: handleShowMore,
|
|
25
25
|
appearance: "link",
|
|
26
|
-
testId:
|
|
26
|
+
testId: `${filterName}--show-more-button`
|
|
27
27
|
}, formatMessage(asyncPopupSelectMessages.showMoreMessage));
|
|
28
28
|
};
|
|
29
29
|
export default ShowMoreButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { PopupComponentContainer } from './styled';
|
|
4
|
+
export const PopupComponent = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement(PopupComponentContainer, _extends({}, props, {
|
|
5
|
+
"data-testId": 'confluence-search-datasource-popup-container',
|
|
6
|
+
ref: ref
|
|
7
|
+
})));
|
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
3
|
+
import Popup from '@atlaskit/popup';
|
|
4
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
5
|
+
import { CLOLBasicFilters } from '../../types';
|
|
6
|
+
import { dateRangeMessages } from './messages';
|
|
7
|
+
import { PopupComponent } from './PopupComponent';
|
|
8
|
+
import { CustomDropdown, CustomDropdownItem } from './styled';
|
|
9
|
+
import { PopupTrigger } from './trigger';
|
|
10
|
+
const lastModifiedValues = ['anyTime', 'today', 'yesterday', 'past7Days', 'past30Days', 'pastYear', 'custom'];
|
|
11
|
+
const defaultOptionValue = 'anyTime';
|
|
12
|
+
const filterName = CLOLBasicFilters.lastModified;
|
|
13
|
+
export const DateRangePicker = ({
|
|
14
|
+
onSelectionChange
|
|
15
|
+
}) => {
|
|
16
|
+
const [currentOption, setCurrentOption] = useState(null);
|
|
17
|
+
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
|
18
|
+
const {
|
|
19
|
+
formatMessage
|
|
20
|
+
} = useIntl();
|
|
21
|
+
const onClickFilterOption = useCallback(option => {
|
|
22
|
+
setCurrentOption(option);
|
|
23
|
+
setIsPickerOpen(false);
|
|
24
|
+
onSelectionChange(filterName, [{
|
|
25
|
+
optionType: 'defaultOption',
|
|
26
|
+
label: option,
|
|
27
|
+
value: option
|
|
28
|
+
}]);
|
|
29
|
+
}, [onSelectionChange]);
|
|
30
|
+
const handleTogglePopup = useCallback(() => {
|
|
31
|
+
setIsPickerOpen(!isPickerOpen);
|
|
32
|
+
}, [isPickerOpen]);
|
|
33
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
34
|
+
isOpen: isPickerOpen,
|
|
35
|
+
onClose: handleTogglePopup,
|
|
36
|
+
popupComponent: PopupComponent,
|
|
37
|
+
zIndex: layers.modal(),
|
|
38
|
+
content: () => {
|
|
39
|
+
return /*#__PURE__*/React.createElement(CustomDropdown, null, lastModifiedValues.map(option => /*#__PURE__*/React.createElement(CustomDropdownItem, {
|
|
40
|
+
key: option
|
|
41
|
+
//want to show Anytime as selected if none of the other options are selected
|
|
42
|
+
,
|
|
43
|
+
isSelected: currentOption ? option === currentOption : option === defaultOptionValue,
|
|
44
|
+
onClick: () => onClickFilterOption(option)
|
|
45
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, getCurrentOptionLabel(option)))));
|
|
46
|
+
},
|
|
47
|
+
placement: "bottom-start",
|
|
48
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement(PopupTrigger, {
|
|
49
|
+
triggerProps: triggerProps,
|
|
50
|
+
optionSelected: !!currentOption,
|
|
51
|
+
label: formatMessage(dateRangeMessages.dateRangeTitle),
|
|
52
|
+
selectedLabel: formatMessage(getCurrentOptionLabel(currentOption)),
|
|
53
|
+
onClickButton: handleTogglePopup
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const getCurrentOptionLabel = option => {
|
|
58
|
+
const mapping = {
|
|
59
|
+
anyTime: 'dateRangeAnyTime',
|
|
60
|
+
today: 'dateRangeToday',
|
|
61
|
+
yesterday: 'dateRangeYesterday',
|
|
62
|
+
past7Days: 'dateRangeLastWeek',
|
|
63
|
+
past30Days: 'dateRangeLastMonth',
|
|
64
|
+
pastYear: 'dateRangeLastYear',
|
|
65
|
+
custom: 'dateRangeCustom'
|
|
66
|
+
};
|
|
67
|
+
return option ? dateRangeMessages[mapping[option]] : dateRangeMessages[mapping['anyTime']];
|
|
68
|
+
};
|
package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const dateRangeMessages = defineMessages({
|
|
3
|
+
dateRangeTitle: {
|
|
4
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.title',
|
|
5
|
+
defaultMessage: 'Last updated',
|
|
6
|
+
description: 'Filter by the date content was modified'
|
|
7
|
+
},
|
|
8
|
+
dateRangeAnyTime: {
|
|
9
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.any.time',
|
|
10
|
+
defaultMessage: 'Anytime',
|
|
11
|
+
description: 'Option to show content from any time'
|
|
12
|
+
},
|
|
13
|
+
dateRangeToday: {
|
|
14
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.today',
|
|
15
|
+
defaultMessage: 'Today',
|
|
16
|
+
description: 'Date range of content modified today'
|
|
17
|
+
},
|
|
18
|
+
dateRangeYesterday: {
|
|
19
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.yesterday',
|
|
20
|
+
defaultMessage: 'Yesterday',
|
|
21
|
+
description: 'Date range of content modified yesterday'
|
|
22
|
+
},
|
|
23
|
+
dateRangeLastWeek: {
|
|
24
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.week',
|
|
25
|
+
defaultMessage: 'Past 7 days',
|
|
26
|
+
description: 'Date range of content modified in the last 7 days'
|
|
27
|
+
},
|
|
28
|
+
dateRangeLastMonth: {
|
|
29
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.month',
|
|
30
|
+
defaultMessage: 'Past 30 days',
|
|
31
|
+
description: 'Date range of content modified in the last 30 days'
|
|
32
|
+
},
|
|
33
|
+
dateRangeLastYear: {
|
|
34
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.last.year',
|
|
35
|
+
defaultMessage: 'Past year',
|
|
36
|
+
description: 'Date range of content modified in the last 365 days'
|
|
37
|
+
},
|
|
38
|
+
dateRangeCustom: {
|
|
39
|
+
id: 'linkDataSource.confluence-search.configmodal.date.range.custom',
|
|
40
|
+
defaultMessage: 'Custom',
|
|
41
|
+
description: 'Custom date range'
|
|
42
|
+
}
|
|
43
|
+
});
|