@atlaskit/link-datasource 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +26 -46
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/cjs/ui/issue-like-table/index.js +86 -48
- package/dist/cjs/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/cjs/ui/issue-like-table/styled.js +11 -0
- package/dist/cjs/ui/issue-like-table/utils.js +13 -6
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +2 -2
- package/dist/es2019/hooks/useDatasourceTableState.js +25 -40
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/es2019/ui/issue-like-table/index.js +50 -17
- package/dist/es2019/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/es2019/ui/issue-like-table/styled.js +11 -0
- package/dist/es2019/ui/issue-like-table/utils.js +14 -5
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +2 -2
- package/dist/esm/hooks/useDatasourceTableState.js +26 -46
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +12 -5
- package/dist/esm/ui/issue-like-table/index.js +86 -48
- package/dist/esm/ui/issue-like-table/render-type/richtext/index.js +2 -3
- package/dist/esm/ui/issue-like-table/styled.js +11 -0
- package/dist/esm/ui/issue-like-table/utils.js +13 -6
- package/dist/esm/ui/jira-issues-modal/modal/index.js +2 -2
- package/dist/types/common/utils/adf.d.ts +1 -1
- package/dist/types/hooks/useDatasourceTableState.d.ts +1 -1
- package/dist/types/ui/datasource-table-view/datasourceTableView.d.ts +0 -1
- package/dist/types/ui/datasource-table-view/types.d.ts +1 -2
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -2
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/utils.d.ts +2 -2
- package/dist/types-ts4.5/common/utils/adf.d.ts +1 -1
- package/dist/types-ts4.5/hooks/useDatasourceTableState.d.ts +1 -1
- package/dist/types-ts4.5/ui/datasource-table-view/datasourceTableView.d.ts +0 -1
- package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +1 -2
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -2
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +2 -2
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#97435](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97435)
|
|
8
|
+
[`74d425408d1e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/74d425408d1e) -
|
|
9
|
+
[ux] Fix a bug where when sum of all column widths is less than container total width the
|
|
10
|
+
resizing is somewhat broken
|
|
11
|
+
- [#99133](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99133)
|
|
12
|
+
[`2de9d30e7ac6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2de9d30e7ac6) -
|
|
13
|
+
Updates docs to include in atlaskit for use of smart link list view and configuration modals and
|
|
14
|
+
respective props and examples.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 2.3.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#96902](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96902)
|
|
22
|
+
[`c5881211d3fd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c5881211d3fd) -
|
|
23
|
+
removing abort controller FF after rollout
|
|
24
|
+
- [#101524](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101524)
|
|
25
|
+
[`4821570088e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4821570088e6) -
|
|
26
|
+
ED-23362 Bump ADF schema to version 36.8.1 and add support for adf validation and transformation
|
|
27
|
+
|
|
3
28
|
## 2.3.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
|
@@ -12,7 +12,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _linkClientExtension = require("@atlaskit/link-client-extension");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _analytics = require("../analytics");
|
|
17
16
|
var _useErrorLogger2 = _interopRequireDefault(require("./useErrorLogger"));
|
|
18
17
|
var useDatasourceTableState = exports.useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
@@ -203,6 +202,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
203
202
|
shouldForceRequest,
|
|
204
203
|
isFullSchemaLoaded,
|
|
205
204
|
datasourceDataRequest,
|
|
205
|
+
_currentAbortControll,
|
|
206
206
|
_yield$getDatasourceD3,
|
|
207
207
|
_yield$getDatasourceD4,
|
|
208
208
|
access,
|
|
@@ -215,7 +215,6 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
215
215
|
nextPageCursor,
|
|
216
216
|
_totalCount,
|
|
217
217
|
schema,
|
|
218
|
-
_currentAbortControll,
|
|
219
218
|
isUserLoadingNextPage,
|
|
220
219
|
currentLoadedItemCount,
|
|
221
220
|
newlyLoadedItemCount,
|
|
@@ -224,23 +223,21 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
224
223
|
while (1) switch (_context2.prev = _context2.next) {
|
|
225
224
|
case 0:
|
|
226
225
|
requestInfo = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
currentAbortController = abortController.current;
|
|
237
|
-
}
|
|
226
|
+
/**
|
|
227
|
+
* Abort whichever request was made before this one.
|
|
228
|
+
*/
|
|
229
|
+
abortController.current.abort();
|
|
230
|
+
/**
|
|
231
|
+
* Setup new abort controller for this request.
|
|
232
|
+
*/
|
|
233
|
+
abortController.current = new AbortController();
|
|
234
|
+
currentAbortController = abortController.current;
|
|
238
235
|
if (parameters) {
|
|
239
|
-
_context2.next =
|
|
236
|
+
_context2.next = 6;
|
|
240
237
|
break;
|
|
241
238
|
}
|
|
242
239
|
return _context2.abrupt("return");
|
|
243
|
-
case
|
|
240
|
+
case 6:
|
|
244
241
|
_requestInfo$isSchema = requestInfo.isSchemaFromData, isSchemaFromData = _requestInfo$isSchema === void 0 ? true : _requestInfo$isSchema, shouldRequestFirstPage = requestInfo.shouldRequestFirstPage, _requestInfo$shouldFo = requestInfo.shouldForceRequest, shouldForceRequest = _requestInfo$shouldFo === void 0 ? false : _requestInfo$shouldFo;
|
|
245
242
|
isFullSchemaLoaded = fullSchema.properties.length > 0;
|
|
246
243
|
datasourceDataRequest = {
|
|
@@ -251,10 +248,10 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
251
248
|
includeSchema: isFullSchemaLoaded ? false : isSchemaFromData
|
|
252
249
|
};
|
|
253
250
|
setStatus('loading');
|
|
254
|
-
_context2.prev =
|
|
255
|
-
_context2.next =
|
|
251
|
+
_context2.prev = 10;
|
|
252
|
+
_context2.next = 13;
|
|
256
253
|
return getDatasourceData(datasourceId, datasourceDataRequest, shouldForceRequest);
|
|
257
|
-
case
|
|
254
|
+
case 13:
|
|
258
255
|
_yield$getDatasourceD3 = _context2.sent;
|
|
259
256
|
_yield$getDatasourceD4 = _yield$getDatasourceD3.meta;
|
|
260
257
|
access = _yield$getDatasourceD4.access;
|
|
@@ -267,37 +264,26 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
267
264
|
nextPageCursor = _yield$getDatasourceD5.nextPageCursor;
|
|
268
265
|
_totalCount = _yield$getDatasourceD5.totalCount;
|
|
269
266
|
schema = _yield$getDatasourceD5.schema;
|
|
270
|
-
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.enable-abort-controller')) {
|
|
271
|
-
_context2.next = 26;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
267
|
if (!((_currentAbortControll = currentAbortController) !== null && _currentAbortControll !== void 0 && _currentAbortControll.signal.aborted)) {
|
|
275
|
-
_context2.next =
|
|
268
|
+
_context2.next = 27;
|
|
276
269
|
break;
|
|
277
270
|
}
|
|
278
271
|
throw new Error('Aborted');
|
|
279
|
-
case
|
|
272
|
+
case 27:
|
|
280
273
|
setExtensionKey(_extensionKey);
|
|
281
274
|
setProviderName(_providerName);
|
|
282
275
|
if (!(access === 'unauthorized' || access === 'forbidden')) {
|
|
283
|
-
_context2.next =
|
|
276
|
+
_context2.next = 33;
|
|
284
277
|
break;
|
|
285
278
|
}
|
|
286
279
|
setStatus(access);
|
|
287
280
|
setAuthDetails(auth || initialEmptyArray);
|
|
288
281
|
return _context2.abrupt("return");
|
|
289
|
-
case
|
|
282
|
+
case 33:
|
|
290
283
|
setDestinationObjectTypes(_destinationObjectTypes);
|
|
291
284
|
setTotalCount(_totalCount);
|
|
292
285
|
setNextCursor(nextPageCursor);
|
|
293
286
|
setResponseItems(function (currentResponseItems) {
|
|
294
|
-
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.enable-abort-controller')) {
|
|
295
|
-
var hasIdenticalResponseItems = (0, _isEqual.default)(currentResponseItems, items);
|
|
296
|
-
if (hasIdenticalResponseItems || shouldRequestFirstPage) {
|
|
297
|
-
return items;
|
|
298
|
-
}
|
|
299
|
-
return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(items));
|
|
300
|
-
}
|
|
301
287
|
if (shouldRequestFirstPage) {
|
|
302
288
|
return items;
|
|
303
289
|
}
|
|
@@ -323,13 +309,9 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
323
309
|
setStatus('resolved');
|
|
324
310
|
_context2.next = 57;
|
|
325
311
|
break;
|
|
326
|
-
case
|
|
327
|
-
_context2.prev =
|
|
328
|
-
_context2.t0 = _context2["catch"](
|
|
329
|
-
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.enable-abort-controller')) {
|
|
330
|
-
_context2.next = 49;
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
312
|
+
case 45:
|
|
313
|
+
_context2.prev = 45;
|
|
314
|
+
_context2.t0 = _context2["catch"](10);
|
|
333
315
|
if (!(_context2.t0.message === 'Aborted')) {
|
|
334
316
|
_context2.next = 49;
|
|
335
317
|
break;
|
|
@@ -356,7 +338,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
356
338
|
case "end":
|
|
357
339
|
return _context2.stop();
|
|
358
340
|
}
|
|
359
|
-
}, _callee2, null, [[
|
|
341
|
+
}, _callee2, null, [[10, 45]]);
|
|
360
342
|
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray]);
|
|
361
343
|
var reset = (0, _react.useCallback)(function (options) {
|
|
362
344
|
setResponseItems(initialEmptyArray);
|
|
@@ -417,11 +399,9 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
417
399
|
}
|
|
418
400
|
}, [fieldKeys, lastRequestedFieldKeys, responseItems, reset, onNextPage]);
|
|
419
401
|
(0, _react.useEffect)(function () {
|
|
420
|
-
|
|
421
|
-
return
|
|
422
|
-
|
|
423
|
-
};
|
|
424
|
-
}
|
|
402
|
+
return function () {
|
|
403
|
+
return abortController.current.abort();
|
|
404
|
+
};
|
|
425
405
|
}, []);
|
|
426
406
|
return {
|
|
427
407
|
status: status,
|
|
@@ -124,6 +124,11 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
124
124
|
closestEdge = _useState6[0],
|
|
125
125
|
setClosestEdge = _useState6[1];
|
|
126
126
|
var dropTargetRef = (0, _react.useRef)(null);
|
|
127
|
+
/**
|
|
128
|
+
* When width is not set (or callback is not set) we assume not resizing is needed.
|
|
129
|
+
* In our case width won't be set for last cell when table container is bigger than sum of all columns
|
|
130
|
+
*/
|
|
131
|
+
var resizeIsEnabled = !!onWidthChange && !!width;
|
|
127
132
|
(0, _react.useEffect)(function () {
|
|
128
133
|
var cell = mainHeaderCellRef.current;
|
|
129
134
|
(0, _tinyInvariant.default)(cell);
|
|
@@ -231,7 +236,7 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
231
236
|
|
|
232
237
|
// Handling column resizing
|
|
233
238
|
(0, _react.useEffect)(function () {
|
|
234
|
-
if (!
|
|
239
|
+
if (!resizeIsEnabled) {
|
|
235
240
|
return;
|
|
236
241
|
}
|
|
237
242
|
var resizeHandle = columnResizeHandleRef.current;
|
|
@@ -287,7 +292,7 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
287
292
|
}
|
|
288
293
|
}
|
|
289
294
|
});
|
|
290
|
-
}, [id, index, onWidthChange, state, tableId, width]);
|
|
295
|
+
}, [id, index, onWidthChange, resizeIsEnabled, state, tableId, width]);
|
|
291
296
|
var _useState7 = (0, _react.useState)(false),
|
|
292
297
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
293
298
|
buttonHovered = _useState8[0],
|
|
@@ -296,7 +301,9 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
296
301
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
297
302
|
isDropdownOpen = _useState10[0],
|
|
298
303
|
setIsDropdownOpen = _useState10[1];
|
|
299
|
-
|
|
304
|
+
// Width is not set when it is a last cell in a wide table.
|
|
305
|
+
// We make assumption thus that there is enough width for chevron.
|
|
306
|
+
var isWideEnoughToHaveChevron = !width || width > 76;
|
|
300
307
|
var shouldShowTriggerIcon = (buttonHovered || isDropdownOpen) && isWideEnoughToHaveChevron;
|
|
301
308
|
var triggerIcon = (0, _react.useMemo)(function () {
|
|
302
309
|
return shouldShowTriggerIcon ? isDropdownOpen ? _chevronUp.default : _chevronDown.default : isWideEnoughToHaveChevron ? _customIcons.GlyphPlaceholder : undefined;
|
|
@@ -332,10 +339,10 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
332
339
|
style: _objectSpread({
|
|
333
340
|
cursor: 'grab'
|
|
334
341
|
}, (0, _utils.getWidthCss)({
|
|
335
|
-
shouldUseWidth:
|
|
342
|
+
shouldUseWidth: resizeIsEnabled,
|
|
336
343
|
width: width
|
|
337
344
|
}))
|
|
338
|
-
},
|
|
345
|
+
}, resizeIsEnabled ? (0, _react2.jsx)("div", {
|
|
339
346
|
ref: columnResizeHandleRef,
|
|
340
347
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
341
348
|
style: {
|
|
@@ -14,6 +14,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
16
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
17
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
17
18
|
var _reactIntlNext = require("react-intl-next");
|
|
18
19
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
19
20
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
@@ -25,6 +26,7 @@ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
|
25
26
|
var _colors = require("@atlaskit/theme/colors");
|
|
26
27
|
var _typography = require("@atlaskit/theme/typography");
|
|
27
28
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
29
|
+
var _widthDetector = require("@atlaskit/width-detector");
|
|
28
30
|
var _ufoExperiences = require("../../analytics/ufoExperiences");
|
|
29
31
|
var _zindex = require("../../common/zindex");
|
|
30
32
|
var _columnPicker = require("./column-picker");
|
|
@@ -35,7 +37,7 @@ var _renderType = require("./render-type");
|
|
|
35
37
|
var _styled2 = require("./styled");
|
|
36
38
|
var _useIsOnScreen = require("./useIsOnScreen");
|
|
37
39
|
var _utils = require("./utils");
|
|
38
|
-
var _styled$
|
|
40
|
+
var _styled$td;
|
|
39
41
|
/** @jsx jsx */
|
|
40
42
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
43
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -51,27 +53,30 @@ var truncateTextStyles = (0, _react2.css)({
|
|
|
51
53
|
textOverflow: 'ellipsis',
|
|
52
54
|
whiteSpace: 'nowrap'
|
|
53
55
|
});
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
+
var columnPickerWidth = 80;
|
|
57
|
+
var ColumnPickerHeader = _styled.default.th((0, _defineProperty2.default)({}, "".concat((0, _styled2.withTablePluginHeaderPrefix)('&:last-of-type')), {
|
|
58
|
+
boxSizing: 'border-box',
|
|
56
59
|
border: 0,
|
|
57
|
-
width:
|
|
60
|
+
width: "".concat(columnPickerWidth, "px"),
|
|
58
61
|
zIndex: 10,
|
|
59
62
|
position: 'sticky',
|
|
60
63
|
right: "calc(-1 * ".concat(tableSidePadding, ")"),
|
|
61
64
|
backgroundColor: "var(--ds-elevation-surface-current, #FFF)",
|
|
65
|
+
/* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
62
66
|
borderBottom: "2px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
63
|
-
paddingRight:
|
|
67
|
+
paddingRight: tableSidePadding,
|
|
64
68
|
background: "linear-gradient( 90deg, rgba(255, 255, 255, 0) 0%, ".concat("var(--ds-elevation-surface-current, #FFF)", " 10% )"),
|
|
69
|
+
/* Keeps dropdown button in the middle */
|
|
65
70
|
verticalAlign: 'middle',
|
|
71
|
+
/* In case when TH itself is bigger we want to keep picker at the right side */
|
|
66
72
|
textAlign: 'right'
|
|
67
|
-
})
|
|
68
|
-
paddingRight: tableSidePadding
|
|
69
|
-
}), _styled$th));
|
|
73
|
+
}));
|
|
70
74
|
var truncateStyles = (0, _react2.css)({
|
|
71
75
|
textOverflow: 'ellipsis',
|
|
72
76
|
whiteSpace: 'nowrap'
|
|
73
77
|
});
|
|
74
78
|
var TableCell = _styled.default.td((_styled$td = {}, (0, _defineProperty2.default)(_styled$td, "".concat((0, _styled2.withTablePluginBodyPrefix)()), {
|
|
79
|
+
/* First section here is to override things editor table plugin css defines */
|
|
75
80
|
font: _styled2.fieldTextFontSize,
|
|
76
81
|
padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
|
|
77
82
|
border: 0,
|
|
@@ -92,7 +97,8 @@ var TableCell = _styled.default.td((_styled$td = {}, (0, _defineProperty2.defaul
|
|
|
92
97
|
var tableContainerStyles = (0, _react2.css)({
|
|
93
98
|
borderRadius: 'inherit',
|
|
94
99
|
borderBottomLeftRadius: 0,
|
|
95
|
-
borderBottomRightRadius: 0
|
|
100
|
+
borderBottomRightRadius: 0,
|
|
101
|
+
position: 'relative'
|
|
96
102
|
});
|
|
97
103
|
|
|
98
104
|
/**
|
|
@@ -189,7 +195,10 @@ var tableStyles = (0, _react2.css)({
|
|
|
189
195
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
190
196
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
191
197
|
borderCollapse: 'separate',
|
|
192
|
-
borderSpacing: 0
|
|
198
|
+
borderSpacing: 0,
|
|
199
|
+
// There is a strange table:first-of-type rule that sets margin-top to 0 coming from container,
|
|
200
|
+
// but because our table is now not the first child (there is an empty div to measure width) we need to set it manually.
|
|
201
|
+
margin: 0
|
|
193
202
|
});
|
|
194
203
|
|
|
195
204
|
// By default tbody and thead have border-bottom: 2px ...
|
|
@@ -301,6 +310,19 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
301
310
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
302
311
|
orderedColumns = _useState6[0],
|
|
303
312
|
setOrderedColumns = _useState6[1];
|
|
313
|
+
|
|
314
|
+
// Table container width is used to know if sum of all column widths is bigger of container or not.
|
|
315
|
+
// When sum of all columns is less than container size we make last column stretchable (width: undefined)
|
|
316
|
+
var _useState7 = (0, _react.useState)(),
|
|
317
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
318
|
+
tableContainerWidth = _useState8[0],
|
|
319
|
+
setTableContainerWidth = _useState8[1];
|
|
320
|
+
(0, _react.useEffect)(function () {
|
|
321
|
+
var current = containerRef.current;
|
|
322
|
+
if (containerRef && current) {
|
|
323
|
+
setTableContainerWidth(current.getBoundingClientRect().width);
|
|
324
|
+
}
|
|
325
|
+
}, [containerRef]);
|
|
304
326
|
(0, _react.useEffect)(function () {
|
|
305
327
|
if (!hasFullSchema) {
|
|
306
328
|
setOrderedColumns(getOrderedColumns((0, _toConsumableArray2.default)(columns), (0, _toConsumableArray2.default)(visibleColumnKeys)));
|
|
@@ -327,19 +349,33 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
327
349
|
// or some other combination.
|
|
328
350
|
|
|
329
351
|
var identityColumnKey = 'id';
|
|
330
|
-
var
|
|
331
|
-
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
332
|
-
}, [columnCustomSizes]);
|
|
333
|
-
var headerColumns = (0, _react.useMemo)(function () {
|
|
352
|
+
var columnsWidthsSum = (0, _react.useMemo)(function () {
|
|
334
353
|
return visibleSortedColumns.map(function (_ref7) {
|
|
335
354
|
var key = _ref7.key,
|
|
336
|
-
title = _ref7.title,
|
|
337
355
|
type = _ref7.type;
|
|
356
|
+
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
357
|
+
}).reduce(function (sum, width) {
|
|
358
|
+
return width + sum;
|
|
359
|
+
}, 0) + (onVisibleColumnKeysChange ? columnPickerWidth : 0);
|
|
360
|
+
}, [columnCustomSizes, onVisibleColumnKeysChange, visibleSortedColumns]);
|
|
361
|
+
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
362
|
+
var getColumnWidth = (0, _react.useCallback)(function (key, type, isLastCell) {
|
|
363
|
+
if (isLastCell && shouldUseWidth && (!tableContainerWidth || tableContainerWidth > columnsWidthsSum)) {
|
|
364
|
+
return undefined;
|
|
365
|
+
} else {
|
|
366
|
+
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
367
|
+
}
|
|
368
|
+
}, [columnCustomSizes, columnsWidthsSum, shouldUseWidth, tableContainerWidth]);
|
|
369
|
+
var headerColumns = (0, _react.useMemo)(function () {
|
|
370
|
+
return visibleSortedColumns.map(function (_ref8, index) {
|
|
371
|
+
var key = _ref8.key,
|
|
372
|
+
title = _ref8.title,
|
|
373
|
+
type = _ref8.type;
|
|
338
374
|
return {
|
|
339
375
|
key: key,
|
|
340
376
|
content: title,
|
|
341
377
|
shouldTruncate: true,
|
|
342
|
-
width: getColumnWidth(key, type)
|
|
378
|
+
width: getColumnWidth(key, type, index === visibleSortedColumns.length - 1)
|
|
343
379
|
};
|
|
344
380
|
});
|
|
345
381
|
}, [getColumnWidth, visibleSortedColumns]);
|
|
@@ -376,9 +412,9 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
376
412
|
return;
|
|
377
413
|
}
|
|
378
414
|
return (0, _combine.combine)((0, _adapter.monitorForElements)({
|
|
379
|
-
onDragStart: function onDragStart(
|
|
380
|
-
var location =
|
|
381
|
-
source =
|
|
415
|
+
onDragStart: function onDragStart(_ref9) {
|
|
416
|
+
var location = _ref9.location,
|
|
417
|
+
source = _ref9.source;
|
|
382
418
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
383
419
|
if (source.data.type === 'table-header') {
|
|
384
420
|
var _containerRef$current;
|
|
@@ -394,9 +430,9 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
394
430
|
});
|
|
395
431
|
}
|
|
396
432
|
},
|
|
397
|
-
onDrag: function onDrag(
|
|
398
|
-
var location =
|
|
399
|
-
source =
|
|
433
|
+
onDrag: function onDrag(_ref10) {
|
|
434
|
+
var location = _ref10.location,
|
|
435
|
+
source = _ref10.source;
|
|
400
436
|
if (source.data.type === 'table-header') {
|
|
401
437
|
var _containerRef$current2;
|
|
402
438
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.updateInput({
|
|
@@ -406,9 +442,9 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
406
442
|
});
|
|
407
443
|
}
|
|
408
444
|
},
|
|
409
|
-
onDrop: function onDrop(
|
|
410
|
-
var source =
|
|
411
|
-
location =
|
|
445
|
+
onDrop: function onDrop(_ref11) {
|
|
446
|
+
var source = _ref11.source,
|
|
447
|
+
location = _ref11.location;
|
|
412
448
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.stop();
|
|
413
449
|
if (location.current.dropTargets.length === 0) {
|
|
414
450
|
return;
|
|
@@ -443,10 +479,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
443
479
|
return items.map(function (newRowData, rowIndex) {
|
|
444
480
|
return {
|
|
445
481
|
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
446
|
-
cells: visibleSortedColumns.map(function (
|
|
482
|
+
cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
|
|
447
483
|
var _newRowData$key;
|
|
448
|
-
var key =
|
|
449
|
-
type =
|
|
484
|
+
var key = _ref12.key,
|
|
485
|
+
type = _ref12.type;
|
|
450
486
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
451
487
|
var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
|
|
452
488
|
var values = Array.isArray(value) ? value : [value];
|
|
@@ -470,7 +506,7 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
470
506
|
return {
|
|
471
507
|
key: key,
|
|
472
508
|
content: contentComponent,
|
|
473
|
-
width: getColumnWidth(key, type)
|
|
509
|
+
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
474
510
|
};
|
|
475
511
|
}),
|
|
476
512
|
ref: rowIndex === items.length - 1 ? function (el) {
|
|
@@ -536,7 +572,6 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
536
572
|
}
|
|
537
573
|
}, _callee, null, [[3, 9]]);
|
|
538
574
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
539
|
-
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
540
575
|
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
541
576
|
return (0, _react2.jsx)("div", {
|
|
542
577
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
@@ -548,8 +583,11 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
548
583
|
css: [tableContainerStyles, scrollableContainerHeight && scrollableContainerStyles],
|
|
549
584
|
style: scrollableContainerHeight ? {
|
|
550
585
|
maxHeight: "".concat(scrollableContainerHeight, "px")
|
|
551
|
-
} : undefined
|
|
552
|
-
|
|
586
|
+
} : undefined,
|
|
587
|
+
"data-testid": 'issue-like-table-container'
|
|
588
|
+
}, (0, _react2.jsx)(_widthDetector.WidthObserver, {
|
|
589
|
+
setWidth: (0, _debounce.default)(setTableContainerWidth, 100)
|
|
590
|
+
}), (0, _react2.jsx)(_styled2.Table, {
|
|
553
591
|
css: tableStyles,
|
|
554
592
|
"data-testid": testId,
|
|
555
593
|
style: shouldUseWidth ? {
|
|
@@ -561,10 +599,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
561
599
|
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
562
600
|
}, (0, _react2.jsx)("tr", {
|
|
563
601
|
ref: tableHeaderRowRef
|
|
564
|
-
}, headerColumns.map(function (
|
|
565
|
-
var key =
|
|
566
|
-
content =
|
|
567
|
-
width =
|
|
602
|
+
}, headerColumns.map(function (_ref14, cellIndex) {
|
|
603
|
+
var key = _ref14.key,
|
|
604
|
+
content = _ref14.content,
|
|
605
|
+
width = _ref14.width;
|
|
568
606
|
var heading = (0, _react2.jsx)(_tooltip.default, {
|
|
569
607
|
content: content,
|
|
570
608
|
tag: "span",
|
|
@@ -581,10 +619,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
581
619
|
}
|
|
582
620
|
if (isEditable) {
|
|
583
621
|
var _containerRef$current3;
|
|
584
|
-
var previewRows = tableRows.map(function (
|
|
585
|
-
var cells =
|
|
586
|
-
var cell = cells.find(function (
|
|
587
|
-
var cellKey =
|
|
622
|
+
var previewRows = tableRows.map(function (_ref15) {
|
|
623
|
+
var cells = _ref15.cells;
|
|
624
|
+
var cell = cells.find(function (_ref16) {
|
|
625
|
+
var cellKey = _ref16.key;
|
|
588
626
|
return cellKey === key;
|
|
589
627
|
});
|
|
590
628
|
if (cell) {
|
|
@@ -626,18 +664,18 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
626
664
|
})))), (0, _react2.jsx)("tbody", {
|
|
627
665
|
css: noDefaultBorderStyles,
|
|
628
666
|
"data-testid": testId && "".concat(testId, "--body")
|
|
629
|
-
}, rows.map(function (
|
|
630
|
-
var key =
|
|
631
|
-
cells =
|
|
632
|
-
ref =
|
|
667
|
+
}, rows.map(function (_ref17) {
|
|
668
|
+
var key = _ref17.key,
|
|
669
|
+
cells = _ref17.cells,
|
|
670
|
+
ref = _ref17.ref;
|
|
633
671
|
return (0, _react2.jsx)("tr", {
|
|
634
672
|
key: key,
|
|
635
673
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
636
674
|
ref: ref
|
|
637
|
-
}, cells.map(function (
|
|
638
|
-
var cellKey =
|
|
639
|
-
content =
|
|
640
|
-
width =
|
|
675
|
+
}, cells.map(function (_ref18, cellIndex) {
|
|
676
|
+
var cellKey = _ref18.key,
|
|
677
|
+
content = _ref18.content,
|
|
678
|
+
width = _ref18.width;
|
|
641
679
|
var isLastCell = cellIndex === cells.length - 1;
|
|
642
680
|
var loadingRowStyle = (0, _utils.getWidthCss)({
|
|
643
681
|
shouldUseWidth: shouldUseWidth,
|
|
@@ -14,8 +14,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
16
16
|
var rootStyles = (0, _react2.css)({
|
|
17
|
-
position: 'relative'
|
|
18
|
-
display: 'block'
|
|
17
|
+
position: 'relative'
|
|
19
18
|
});
|
|
20
19
|
var smartLinkNodeToUrl = function smartLinkNodeToUrl(node) {
|
|
21
20
|
var _node$attrs$url;
|
|
@@ -52,7 +51,7 @@ var RichTextType = function RichTextType(_ref) {
|
|
|
52
51
|
return parseRichText(value);
|
|
53
52
|
}, [value]);
|
|
54
53
|
if (adfPlainText) {
|
|
55
|
-
return (0, _react2.jsx)("
|
|
54
|
+
return (0, _react2.jsx)("span", {
|
|
56
55
|
css: rootStyles,
|
|
57
56
|
"data-testid": "richtext-plaintext"
|
|
58
57
|
}, adfPlainText);
|
|
@@ -33,11 +33,19 @@ var withTablePluginBodyPrefix = exports.withTablePluginBodyPrefix = withTablePlu
|
|
|
33
33
|
var TableHeading = exports.TableHeading = _styled.default.th((_styled$th = {}, (0, _defineProperty2.default)(_styled$th, "".concat(withTablePluginHeaderPrefix()), {
|
|
34
34
|
border: 0,
|
|
35
35
|
position: 'relative',
|
|
36
|
+
/* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
|
|
36
37
|
boxSizing: 'border-box',
|
|
37
38
|
lineHeight: lineHeight,
|
|
38
39
|
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
39
40
|
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
40
41
|
borderBottom: "2px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
42
|
+
/*
|
|
43
|
+
lineHeight * 2 -> Max height of two lined header
|
|
44
|
+
verticalPadding * 2 -> padding for this component itself
|
|
45
|
+
verticalPadding * 2 -> padding inside span (--container)
|
|
46
|
+
2px -> Bottom border
|
|
47
|
+
Last two terms are needed because of border-box box sizing.
|
|
48
|
+
*/
|
|
41
49
|
height: "calc(".concat(lineHeight, " * 2 + ").concat(verticalPadding, " * 4 + 2px)"),
|
|
42
50
|
verticalAlign: 'bottom',
|
|
43
51
|
backgroundColor: "var(--ds-elevation-surface-current, #FFF)"
|
|
@@ -49,6 +57,9 @@ var TableHeading = exports.TableHeading = _styled.default.th((_styled$th = {}, (
|
|
|
49
57
|
borderRight: 0
|
|
50
58
|
}), (0, _defineProperty2.default)(_styled$th, "& [data-testid='datasource-header-content--container']", {
|
|
51
59
|
width: '100%',
|
|
60
|
+
/* With Button now being a parent for this component it adds its lineHeight value and spoils
|
|
61
|
+
`height` calculation above. */
|
|
62
|
+
lineHeight: lineHeight,
|
|
52
63
|
padding: "".concat(verticalPadding, " ", "var(--ds-space-050, 4px)"),
|
|
53
64
|
display: '-webkit-box',
|
|
54
65
|
WebkitLineClamp: 2,
|
|
@@ -14,16 +14,23 @@ var COLUMN_MIN_WIDTH = exports.COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
|
14
14
|
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
15
15
|
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
16
16
|
* column widths we treat all width as custom hardcoded widths.
|
|
17
|
-
* @param width
|
|
17
|
+
* @param width Sometimes set to undefined for last column to make it occupy remainder of the table width
|
|
18
18
|
*/
|
|
19
19
|
var getWidthCss = exports.getWidthCss = function getWidthCss(_ref) {
|
|
20
20
|
var shouldUseWidth = _ref.shouldUseWidth,
|
|
21
21
|
width = _ref.width;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (!width) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
if (shouldUseWidth) {
|
|
26
|
+
return {
|
|
27
|
+
width: width
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
return {
|
|
31
|
+
maxWidth: width
|
|
32
|
+
};
|
|
33
|
+
}
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
/**
|
|
@@ -276,7 +276,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
276
276
|
// During insertion, we want the JQL of the datasource to be whatever is in the search bar,
|
|
277
277
|
// even if the user didn't previously click search
|
|
278
278
|
var upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
|
|
279
|
-
var upToDateJqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(
|
|
279
|
+
var upToDateJqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURIComponent(upToDateJql));
|
|
280
280
|
var filterSelectionCount = _ui.availableBasicFilterTypes.reduce(function (current, filter) {
|
|
281
281
|
var _basicFilterSelection;
|
|
282
282
|
return _objectSpread(_objectSpread({}, current), {}, (0, _defineProperty2.default)({}, "".concat(filter, "BasicFilterSelectionCount"), ((_basicFilterSelection = basicFilterSelectionsSearchedWith.current[filter]) === null || _basicFilterSelection === void 0 ? void 0 : _basicFilterSelection.length) || 0));
|
|
@@ -401,7 +401,7 @@ var PlainJiraIssuesConfigModal = exports.PlainJiraIssuesConfigModal = function P
|
|
|
401
401
|
if (responseItems.length === 1 && retrieveUrlForSmartCardRender()) {
|
|
402
402
|
url = retrieveUrlForSmartCardRender();
|
|
403
403
|
} else {
|
|
404
|
-
url = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(
|
|
404
|
+
url = "".concat(selectedJiraSiteUrl, "/issues/?jql=").concat(encodeURIComponent(jql));
|
|
405
405
|
}
|
|
406
406
|
return (0, _react2.jsx)(_countViewSmartLink.SmartLink, {
|
|
407
407
|
url: url
|