@atlaskit/link-datasource 1.17.2 → 1.17.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 +6 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +14 -7
- package/dist/cjs/ui/issue-like-table/index.js +11 -4
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +11 -4
- package/dist/es2019/ui/issue-like-table/index.js +11 -4
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +14 -5
- package/dist/esm/ui/issue-like-table/index.js +11 -4
- package/examples-helpers/buildIssueLikeTable.tsx +13 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43122](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43122) [`5690dd4a0d3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5690dd4a0d3) - When no onColumnResize is defined OR when columnCustomSizes in readonly more use max-width instead of width
|
|
8
|
+
|
|
3
9
|
## 1.17.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.DraggableTableHeading = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _react = require("react");
|
|
10
11
|
var _react2 = require("@emotion/react");
|
|
@@ -20,8 +21,8 @@ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/close
|
|
|
20
21
|
var _boxWithoutTerminal = require("@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal");
|
|
21
22
|
var _styled = require("./styled");
|
|
22
23
|
var _index = require("./index");
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
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; }
|
|
25
|
+
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 */
|
|
25
26
|
var verticallyAlignedStyles = (0, _react2.css)({
|
|
26
27
|
display: 'flex',
|
|
27
28
|
alignItems: 'center',
|
|
@@ -207,6 +208,9 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
207
208
|
|
|
208
209
|
// Handling column resizing
|
|
209
210
|
(0, _react.useEffect)(function () {
|
|
211
|
+
if (!onWidthChange) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
210
214
|
var resizeHandle = columnResizeHandleRef.current;
|
|
211
215
|
(0, _tinyInvariant.default)(resizeHandle);
|
|
212
216
|
var mainHeaderCell = mainHeaderCellRef.current;
|
|
@@ -265,18 +269,21 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
265
269
|
return (0, _react2.jsx)(_styled.TableHeading, {
|
|
266
270
|
ref: mainHeaderCellRef,
|
|
267
271
|
"data-testid": "".concat(id, "-column-heading"),
|
|
268
|
-
style: {
|
|
269
|
-
width: width,
|
|
272
|
+
style: _objectSpread({
|
|
270
273
|
cursor: 'grab'
|
|
271
|
-
}
|
|
272
|
-
|
|
274
|
+
}, onWidthChange ? {
|
|
275
|
+
width: width
|
|
276
|
+
} : {
|
|
277
|
+
maxWidth: width
|
|
278
|
+
})
|
|
279
|
+
}, onWidthChange ? (0, _react2.jsx)("div", {
|
|
273
280
|
ref: columnResizeHandleRef,
|
|
274
281
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
275
282
|
style: {
|
|
276
283
|
height: "".concat(dndPreviewHeight, "px")
|
|
277
284
|
},
|
|
278
285
|
"data-testid": "column-resize-handle"
|
|
279
|
-
}), (0, _react2.jsx)("div", {
|
|
286
|
+
}) : null, (0, _react2.jsx)("div", {
|
|
280
287
|
ref: dropTargetRef,
|
|
281
288
|
css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
|
|
282
289
|
style: {
|
|
@@ -57,7 +57,6 @@ var scrollableContainerStyles = (0, _react2.css)({
|
|
|
57
57
|
borderRadius: "var(--ds-border-radius-100, 3px)"
|
|
58
58
|
});
|
|
59
59
|
var tableStyles = (0, _react2.css)({
|
|
60
|
-
tableLayout: 'fixed',
|
|
61
60
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
62
61
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
63
62
|
borderCollapse: 'separate',
|
|
@@ -372,6 +371,7 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
372
371
|
}
|
|
373
372
|
}, _callee, null, [[3, 9]]);
|
|
374
373
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
374
|
+
var shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
375
375
|
return (0, _react2.jsx)("div", {
|
|
376
376
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
377
377
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -385,7 +385,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
385
385
|
} : undefined
|
|
386
386
|
}, (0, _react2.jsx)(_styled2.Table, {
|
|
387
387
|
css: tableStyles,
|
|
388
|
-
"data-testid": testId
|
|
388
|
+
"data-testid": testId,
|
|
389
|
+
style: shouldUseWidth ? {
|
|
390
|
+
tableLayout: 'fixed'
|
|
391
|
+
} : {}
|
|
389
392
|
}, (0, _react2.jsx)("thead", {
|
|
390
393
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
391
394
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
@@ -433,8 +436,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
433
436
|
return (0, _react2.jsx)(_styled2.TableHeading, {
|
|
434
437
|
key: key,
|
|
435
438
|
"data-testid": "".concat(key, "-column-heading"),
|
|
436
|
-
style: {
|
|
439
|
+
style: shouldUseWidth ? {
|
|
437
440
|
width: width
|
|
441
|
+
} : {
|
|
442
|
+
maxWidth: width
|
|
438
443
|
}
|
|
439
444
|
}, heading);
|
|
440
445
|
}
|
|
@@ -459,8 +464,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
459
464
|
var cellKey = _ref13.key,
|
|
460
465
|
content = _ref13.content,
|
|
461
466
|
width = _ref13.width;
|
|
462
|
-
var loadingRowStyle = {
|
|
467
|
+
var loadingRowStyle = shouldUseWidth ? {
|
|
463
468
|
width: width
|
|
469
|
+
} : {
|
|
470
|
+
maxWidth: width
|
|
464
471
|
};
|
|
465
472
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
466
473
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
@@ -192,6 +192,9 @@ export const DraggableTableHeading = ({
|
|
|
192
192
|
|
|
193
193
|
// Handling column resizing
|
|
194
194
|
useEffect(() => {
|
|
195
|
+
if (!onWidthChange) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
195
198
|
const resizeHandle = columnResizeHandleRef.current;
|
|
196
199
|
invariant(resizeHandle);
|
|
197
200
|
const mainHeaderCell = mainHeaderCellRef.current;
|
|
@@ -255,17 +258,21 @@ export const DraggableTableHeading = ({
|
|
|
255
258
|
ref: mainHeaderCellRef,
|
|
256
259
|
"data-testid": `${id}-column-heading`,
|
|
257
260
|
style: {
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
cursor: 'grab',
|
|
262
|
+
...(onWidthChange ? {
|
|
263
|
+
width
|
|
264
|
+
} : {
|
|
265
|
+
maxWidth: width
|
|
266
|
+
})
|
|
260
267
|
}
|
|
261
|
-
}, jsx("div", {
|
|
268
|
+
}, onWidthChange ? jsx("div", {
|
|
262
269
|
ref: columnResizeHandleRef,
|
|
263
270
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
264
271
|
style: {
|
|
265
272
|
height: `${dndPreviewHeight}px`
|
|
266
273
|
},
|
|
267
274
|
"data-testid": "column-resize-handle"
|
|
268
|
-
}), jsx("div", {
|
|
275
|
+
}) : null, jsx("div", {
|
|
269
276
|
ref: dropTargetRef,
|
|
270
277
|
css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
|
|
271
278
|
style: {
|
|
@@ -58,7 +58,6 @@ const scrollableContainerStyles = css({
|
|
|
58
58
|
borderRadius: "var(--ds-border-radius-100, 3px)"
|
|
59
59
|
});
|
|
60
60
|
const tableStyles = css({
|
|
61
|
-
tableLayout: 'fixed',
|
|
62
61
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
63
62
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
64
63
|
borderCollapse: 'separate',
|
|
@@ -325,6 +324,7 @@ export const IssueLikeDataTableView = ({
|
|
|
325
324
|
setHasFullSchema(false);
|
|
326
325
|
}
|
|
327
326
|
}, [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
327
|
+
const shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
328
328
|
return jsx("div", {
|
|
329
329
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
330
330
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -338,7 +338,10 @@ export const IssueLikeDataTableView = ({
|
|
|
338
338
|
} : undefined
|
|
339
339
|
}, jsx(Table, {
|
|
340
340
|
css: tableStyles,
|
|
341
|
-
"data-testid": testId
|
|
341
|
+
"data-testid": testId,
|
|
342
|
+
style: shouldUseWidth ? {
|
|
343
|
+
tableLayout: 'fixed'
|
|
344
|
+
} : {}
|
|
342
345
|
}, jsx("thead", {
|
|
343
346
|
"data-testid": testId && `${testId}--head`,
|
|
344
347
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
@@ -387,8 +390,10 @@ export const IssueLikeDataTableView = ({
|
|
|
387
390
|
return jsx(TableHeading, {
|
|
388
391
|
key: key,
|
|
389
392
|
"data-testid": `${key}-column-heading`,
|
|
390
|
-
style: {
|
|
393
|
+
style: shouldUseWidth ? {
|
|
391
394
|
width
|
|
395
|
+
} : {
|
|
396
|
+
maxWidth: width
|
|
392
397
|
}
|
|
393
398
|
}, heading);
|
|
394
399
|
}
|
|
@@ -414,8 +419,10 @@ export const IssueLikeDataTableView = ({
|
|
|
414
419
|
content,
|
|
415
420
|
width
|
|
416
421
|
}, cellIndex) => {
|
|
417
|
-
let loadingRowStyle = {
|
|
422
|
+
let loadingRowStyle = shouldUseWidth ? {
|
|
418
423
|
width
|
|
424
|
+
} : {
|
|
425
|
+
maxWidth: width
|
|
419
426
|
};
|
|
420
427
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
421
428
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
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; }
|
|
4
|
+
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) { _defineProperty(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; }
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
import { useEffect, useRef, useState } from 'react';
|
|
4
7
|
import { css, jsx } from '@emotion/react';
|
|
@@ -199,6 +202,9 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
199
202
|
|
|
200
203
|
// Handling column resizing
|
|
201
204
|
useEffect(function () {
|
|
205
|
+
if (!onWidthChange) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
202
208
|
var resizeHandle = columnResizeHandleRef.current;
|
|
203
209
|
invariant(resizeHandle);
|
|
204
210
|
var mainHeaderCell = mainHeaderCellRef.current;
|
|
@@ -257,18 +263,21 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
257
263
|
return jsx(TableHeading, {
|
|
258
264
|
ref: mainHeaderCellRef,
|
|
259
265
|
"data-testid": "".concat(id, "-column-heading"),
|
|
260
|
-
style: {
|
|
261
|
-
width: width,
|
|
266
|
+
style: _objectSpread({
|
|
262
267
|
cursor: 'grab'
|
|
263
|
-
}
|
|
264
|
-
|
|
268
|
+
}, onWidthChange ? {
|
|
269
|
+
width: width
|
|
270
|
+
} : {
|
|
271
|
+
maxWidth: width
|
|
272
|
+
})
|
|
273
|
+
}, onWidthChange ? jsx("div", {
|
|
265
274
|
ref: columnResizeHandleRef,
|
|
266
275
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
267
276
|
style: {
|
|
268
277
|
height: "".concat(dndPreviewHeight, "px")
|
|
269
278
|
},
|
|
270
279
|
"data-testid": "column-resize-handle"
|
|
271
|
-
}), jsx("div", {
|
|
280
|
+
}) : null, jsx("div", {
|
|
272
281
|
ref: dropTargetRef,
|
|
273
282
|
css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
|
|
274
283
|
style: {
|
|
@@ -50,7 +50,6 @@ var scrollableContainerStyles = css({
|
|
|
50
50
|
borderRadius: "var(--ds-border-radius-100, 3px)"
|
|
51
51
|
});
|
|
52
52
|
var tableStyles = css({
|
|
53
|
-
tableLayout: 'fixed',
|
|
54
53
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
55
54
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
56
55
|
borderCollapse: 'separate',
|
|
@@ -365,6 +364,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
365
364
|
}
|
|
366
365
|
}, _callee, null, [[3, 9]]);
|
|
367
366
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
367
|
+
var shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
368
368
|
return jsx("div", {
|
|
369
369
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
370
370
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -378,7 +378,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
378
378
|
} : undefined
|
|
379
379
|
}, jsx(Table, {
|
|
380
380
|
css: tableStyles,
|
|
381
|
-
"data-testid": testId
|
|
381
|
+
"data-testid": testId,
|
|
382
|
+
style: shouldUseWidth ? {
|
|
383
|
+
tableLayout: 'fixed'
|
|
384
|
+
} : {}
|
|
382
385
|
}, jsx("thead", {
|
|
383
386
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
384
387
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
@@ -426,8 +429,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
426
429
|
return jsx(TableHeading, {
|
|
427
430
|
key: key,
|
|
428
431
|
"data-testid": "".concat(key, "-column-heading"),
|
|
429
|
-
style: {
|
|
432
|
+
style: shouldUseWidth ? {
|
|
430
433
|
width: width
|
|
434
|
+
} : {
|
|
435
|
+
maxWidth: width
|
|
431
436
|
}
|
|
432
437
|
}, heading);
|
|
433
438
|
}
|
|
@@ -452,8 +457,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
452
457
|
var cellKey = _ref13.key,
|
|
453
458
|
content = _ref13.content,
|
|
454
459
|
width = _ref13.width;
|
|
455
|
-
var loadingRowStyle = {
|
|
460
|
+
var loadingRowStyle = shouldUseWidth ? {
|
|
456
461
|
width: width
|
|
462
|
+
} : {
|
|
463
|
+
maxWidth: width
|
|
457
464
|
};
|
|
458
465
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
459
466
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
@@ -22,6 +22,7 @@ mockDatasourceFetchRequests();
|
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
24
24
|
isReadonly?: boolean;
|
|
25
|
+
canResizeColumns?: boolean;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const TableViewWrapper = styled.div`
|
|
@@ -32,7 +33,7 @@ const TableViewWrapper = styled.div`
|
|
|
32
33
|
height: 100%;
|
|
33
34
|
`;
|
|
34
35
|
|
|
35
|
-
const ExampleBody = ({ isReadonly }: Props) => {
|
|
36
|
+
const ExampleBody = ({ isReadonly, canResizeColumns = true }: Props) => {
|
|
36
37
|
const parameters = useMemo<JiraIssueDatasourceParameters>(
|
|
37
38
|
() => ({
|
|
38
39
|
cloudId: 'some-cloud-id',
|
|
@@ -90,7 +91,9 @@ const ExampleBody = ({ isReadonly }: Props) => {
|
|
|
90
91
|
onVisibleColumnKeysChange={
|
|
91
92
|
isReadonly ? undefined : setVisibleColumnKeys
|
|
92
93
|
}
|
|
93
|
-
onColumnResize={
|
|
94
|
+
onColumnResize={
|
|
95
|
+
isReadonly || !canResizeColumns ? undefined : onColumnResize
|
|
96
|
+
}
|
|
94
97
|
columnCustomSizes={columnCustomSizes}
|
|
95
98
|
/>
|
|
96
99
|
) : (
|
|
@@ -100,11 +103,17 @@ const ExampleBody = ({ isReadonly }: Props) => {
|
|
|
100
103
|
);
|
|
101
104
|
};
|
|
102
105
|
|
|
103
|
-
export const ExampleIssueLikeTable = ({
|
|
106
|
+
export const ExampleIssueLikeTable = ({
|
|
107
|
+
isReadonly,
|
|
108
|
+
canResizeColumns,
|
|
109
|
+
}: Props) => {
|
|
104
110
|
return (
|
|
105
111
|
<IntlProvider locale="en">
|
|
106
112
|
<SmartCardProvider client={new SmartLinkClient()}>
|
|
107
|
-
<ExampleBody
|
|
113
|
+
<ExampleBody
|
|
114
|
+
isReadonly={isReadonly}
|
|
115
|
+
canResizeColumns={canResizeColumns}
|
|
116
|
+
/>
|
|
108
117
|
</SmartCardProvider>
|
|
109
118
|
</IntlProvider>
|
|
110
119
|
);
|