@atlaskit/link-datasource 1.19.39 → 1.19.41
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/hooks/useDatasourceTableState.js +6 -2
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +9 -12
- package/dist/cjs/ui/issue-like-table/index.js +30 -44
- package/dist/cjs/ui/issue-like-table/styled.js +15 -2
- package/dist/cjs/ui/issue-like-table/utils.js +26 -0
- package/dist/es2019/hooks/useDatasourceTableState.js +6 -2
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +8 -11
- package/dist/es2019/ui/issue-like-table/index.js +72 -56
- package/dist/es2019/ui/issue-like-table/styled.js +41 -11
- package/dist/es2019/ui/issue-like-table/utils.js +19 -0
- package/dist/esm/hooks/useDatasourceTableState.js +6 -2
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +9 -12
- package/dist/esm/ui/issue-like-table/index.js +30 -44
- package/dist/esm/ui/issue-like-table/styled.js +14 -1
- package/dist/esm/ui/issue-like-table/utils.js +20 -0
- package/dist/types/ui/issue-like-table/index.d.ts +0 -1
- package/dist/types/ui/issue-like-table/styled.d.ts +9 -0
- package/dist/types/ui/issue-like-table/utils.d.ts +17 -0
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +9 -0
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +17 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.19.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#65779](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65779) [`a68623048896`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a68623048896) - Improve handling of column resizing and remove standard table css styles bleeding to datasource table when it is inside table
|
|
8
|
+
|
|
9
|
+
## 1.19.40
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#64455](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64455) [`fcb3bcdbead3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fcb3bcdbead3) - Fixes issue duplication in list of links after adding columns through the config modal by checking responseItems for duplications
|
|
14
|
+
|
|
3
15
|
## 1.19.39
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -258,7 +258,11 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
258
258
|
setTotalCount(_totalCount);
|
|
259
259
|
setNextCursor(nextPageCursor);
|
|
260
260
|
setResponseItems(function (currentResponseItems) {
|
|
261
|
-
|
|
261
|
+
// FIXME EDM-8977 (https://product-fabric.atlassian.net/browse/EDM-8977)
|
|
262
|
+
// once the onNextPage and reset loop issue has been thoroughly investigated
|
|
263
|
+
// in the above card, remove this isEqual check, ensure onNextPage isn't called twice
|
|
264
|
+
var hasIdenticalResponseItems = (0, _isEqual.default)(currentResponseItems, items);
|
|
265
|
+
if (hasIdenticalResponseItems || shouldRequestFirstPage) {
|
|
262
266
|
return items;
|
|
263
267
|
}
|
|
264
268
|
return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(items));
|
|
@@ -307,7 +311,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
307
311
|
return _context2.stop();
|
|
308
312
|
}
|
|
309
313
|
}, _callee2, null, [[7, 39]]);
|
|
310
|
-
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems
|
|
314
|
+
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems, applySchemaProperties, fireEvent, fullSchema]);
|
|
311
315
|
var reset = (0, _react.useCallback)(function (options) {
|
|
312
316
|
setStatus('empty');
|
|
313
317
|
setResponseItems([]);
|
|
@@ -20,7 +20,7 @@ var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/util/
|
|
|
20
20
|
var _offsetFromPointer = require("@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer");
|
|
21
21
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview");
|
|
22
22
|
var _styled = require("./styled");
|
|
23
|
-
var
|
|
23
|
+
var _utils = require("./utils");
|
|
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
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 */
|
|
26
26
|
var verticallyAlignedStyles = (0, _react2.css)({
|
|
@@ -248,9 +248,6 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
248
248
|
|
|
249
249
|
// Set the width of our header being resized
|
|
250
250
|
var proposedWidth = initialWidth + relativeDistanceX;
|
|
251
|
-
if (initialWidth >= _index.COLUMN_MIN_WIDTH && proposedWidth < _index.COLUMN_MIN_WIDTH) {
|
|
252
|
-
proposedWidth = _index.COLUMN_MIN_WIDTH;
|
|
253
|
-
}
|
|
254
251
|
|
|
255
252
|
// We update width css directly live
|
|
256
253
|
mainHeaderCell.style.setProperty('width', "".concat(proposedWidth, "px"));
|
|
@@ -259,24 +256,24 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
259
256
|
_cancelUnhandled.cancelUnhandled.stop();
|
|
260
257
|
setState(idleState);
|
|
261
258
|
if (onWidthChange) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
var cssWidth = +mainHeaderCell.style.getPropertyValue('width').slice(0, -2);
|
|
260
|
+
if (cssWidth < _utils.COLUMN_MIN_WIDTH) {
|
|
261
|
+
cssWidth = _utils.COLUMN_MIN_WIDTH;
|
|
262
|
+
}
|
|
263
|
+
onWidthChange(cssWidth);
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
266
|
});
|
|
268
267
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
269
268
|
return (0, _react2.jsx)(_styled.TableHeading, {
|
|
270
269
|
ref: mainHeaderCellRef,
|
|
271
|
-
className: "has-column-picker",
|
|
272
270
|
"data-testid": "".concat(id, "-column-heading"),
|
|
273
271
|
style: _objectSpread({
|
|
274
272
|
cursor: 'grab'
|
|
275
|
-
},
|
|
273
|
+
}, (0, _utils.getWidthCss)({
|
|
274
|
+
shouldUseWidth: !!onWidthChange,
|
|
276
275
|
width: width
|
|
277
|
-
}
|
|
278
|
-
maxWidth: width
|
|
279
|
-
})
|
|
276
|
+
}))
|
|
280
277
|
}, onWidthChange ? (0, _react2.jsx)("div", {
|
|
281
278
|
ref: columnResizeHandleRef,
|
|
282
279
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.scrollableContainerShadowsCssComponents = exports.getOrderedColumns = exports.IssueLikeDataTableView = exports.EmptyState =
|
|
7
|
+
exports.scrollableContainerShadowsCssComponents = exports.getOrderedColumns = exports.IssueLikeDataTableView = exports.EmptyState = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -24,6 +24,7 @@ var _reorderWithEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/util/re
|
|
|
24
24
|
var _pragmaticDragAndDropReactBeautifulDndAutoscroll = require("@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll");
|
|
25
25
|
var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
|
|
26
26
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/util/combine");
|
|
27
|
+
var _primitives = require("@atlaskit/primitives");
|
|
27
28
|
var _colors = require("@atlaskit/theme/colors");
|
|
28
29
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
29
30
|
var _ufoExperiences = require("../../analytics/ufoExperiences");
|
|
@@ -35,7 +36,8 @@ var _emptyState = _interopRequireDefault(require("./empty-state"));
|
|
|
35
36
|
var _renderType = require("./render-type");
|
|
36
37
|
var _styled2 = require("./styled");
|
|
37
38
|
var _useIsOnScreen = require("./useIsOnScreen");
|
|
38
|
-
var
|
|
39
|
+
var _utils = require("./utils");
|
|
40
|
+
var _templateObject, _templateObject2;
|
|
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,21 +53,8 @@ var truncateTextStyles = (0, _react2.css)({
|
|
|
51
53
|
textOverflow: 'ellipsis',
|
|
52
54
|
whiteSpace: 'nowrap'
|
|
53
55
|
});
|
|
54
|
-
var ColumnPickerHeader = _styled.default.th(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 56px;\n
|
|
55
|
-
var
|
|
56
|
-
overflow: 'hidden',
|
|
57
|
-
textOverflow: 'ellipsis',
|
|
58
|
-
whiteSpace: 'nowrap',
|
|
59
|
-
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
60
|
-
borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
61
|
-
'&:first-child': {
|
|
62
|
-
paddingLeft: "var(--ds-space-100, 8px)"
|
|
63
|
-
},
|
|
64
|
-
'&:last-child': {
|
|
65
|
-
borderRight: 0,
|
|
66
|
-
paddingRight: "var(--ds-space-100, 8px)"
|
|
67
|
-
}
|
|
68
|
-
});
|
|
56
|
+
var ColumnPickerHeader = _styled.default.th(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", " {\n box-sizing: content-box;\n border: 0;\n\n width: 56px;\n z-index: 10;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business below */\n\n padding-right: ", ";\n\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n }\n\n ", " {\n padding-right: ", ";\n }\n"])), (0, _styled2.withTablePluginHeaderPrefix)(), tableSidePadding, "var(--ds-elevation-surface-current, #FFF)", "var(--ds-border, ".concat(_colors.N40, ")"), "var(--ds-space-100, 4px)", "var(--ds-elevation-surface-current, #FFF)", (0, _styled2.withTablePluginHeaderPrefix)('&:last-of-type'), tableSidePadding);
|
|
57
|
+
var TableCell = _styled.default.td(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", " {\n /* First section here is to override things editor table plugin css defines */\n padding: ", " ", ";\n border: 0;\n min-width: auto;\n vertical-align: inherit;\n box-sizing: border-box;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-right: 0.5px solid ", ";\n border-bottom: 0.5px solid ", ";\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n padding-right: ", ";\n }\n"])), (0, _styled2.withTablePluginBodyPrefix)(), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-border, ".concat(_colors.N40, ")"), "var(--ds-border, ".concat(_colors.N40, ")"), (0, _styled2.withTablePluginBodyPrefix)('&:first-child'), "var(--ds-space-100, 8px)", (0, _styled2.withTablePluginBodyPrefix)('&:last-child'), "var(--ds-space-100, 8px)");
|
|
69
58
|
var tableContainerStyles = (0, _react2.css)({
|
|
70
59
|
borderRadius: 'inherit',
|
|
71
60
|
borderBottomLeftRadius: 0,
|
|
@@ -195,16 +184,14 @@ var getOrderedColumns = exports.getOrderedColumns = function getOrderedColumns(c
|
|
|
195
184
|
}).sort(sortColumns);
|
|
196
185
|
return [].concat((0, _toConsumableArray2.default)(visibleColumns), (0, _toConsumableArray2.default)(alphabeticallySortedInvisibleColumns));
|
|
197
186
|
};
|
|
198
|
-
var
|
|
199
|
-
var DEFAULT_WIDTH = BASE_WIDTH * 22;
|
|
200
|
-
var COLUMN_MIN_WIDTH = exports.COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
|
|
187
|
+
var DEFAULT_WIDTH = _utils.COLUMN_BASE_WIDTH * 22;
|
|
201
188
|
var keyBasedWidthMap = {
|
|
202
|
-
priority:
|
|
203
|
-
status:
|
|
204
|
-
summary:
|
|
205
|
-
description:
|
|
206
|
-
type:
|
|
207
|
-
key:
|
|
189
|
+
priority: _utils.COLUMN_BASE_WIDTH * 5,
|
|
190
|
+
status: _utils.COLUMN_BASE_WIDTH * 18,
|
|
191
|
+
summary: _utils.COLUMN_BASE_WIDTH * 45,
|
|
192
|
+
description: _utils.COLUMN_BASE_WIDTH * 31,
|
|
193
|
+
type: _utils.COLUMN_BASE_WIDTH * 6,
|
|
194
|
+
key: _utils.COLUMN_BASE_WIDTH * 15
|
|
208
195
|
};
|
|
209
196
|
function getDefaultColumnWidth(key, type) {
|
|
210
197
|
var keyBasedWidth = keyBasedWidthMap[key];
|
|
@@ -213,9 +200,9 @@ function getDefaultColumnWidth(key, type) {
|
|
|
213
200
|
}
|
|
214
201
|
switch (type) {
|
|
215
202
|
case 'date':
|
|
216
|
-
return
|
|
203
|
+
return _utils.COLUMN_BASE_WIDTH * 16;
|
|
217
204
|
case 'icon':
|
|
218
|
-
return
|
|
205
|
+
return _utils.COLUMN_BASE_WIDTH * 7;
|
|
219
206
|
default:
|
|
220
207
|
return DEFAULT_WIDTH;
|
|
221
208
|
}
|
|
@@ -502,7 +489,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
502
489
|
}
|
|
503
490
|
}, _callee, null, [[3, 9]]);
|
|
504
491
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
505
|
-
var shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
492
|
+
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
493
|
+
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
506
494
|
return (0, _react2.jsx)("div", {
|
|
507
495
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
508
496
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -522,7 +510,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
522
510
|
} : {}
|
|
523
511
|
}, (0, _react2.jsx)("thead", {
|
|
524
512
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
525
|
-
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
513
|
+
css: [noDefaultBorderStyles, tableHeadStyles],
|
|
514
|
+
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
526
515
|
}, (0, _react2.jsx)("tr", {
|
|
527
516
|
ref: tableHeaderRowRef
|
|
528
517
|
}, headerColumns.map(function (_ref13, cellIndex) {
|
|
@@ -537,7 +526,7 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
537
526
|
level: "h200",
|
|
538
527
|
as: 'span'
|
|
539
528
|
}, content));
|
|
540
|
-
if (
|
|
529
|
+
if (isEditable) {
|
|
541
530
|
var _containerRef$current3;
|
|
542
531
|
var previewRows = tableRows.map(function (_ref14) {
|
|
543
532
|
var cells = _ref14.cells;
|
|
@@ -566,14 +555,12 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
566
555
|
} else {
|
|
567
556
|
return (0, _react2.jsx)(_styled2.TableHeading, {
|
|
568
557
|
key: key,
|
|
569
|
-
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : '',
|
|
570
558
|
"data-testid": "".concat(key, "-column-heading"),
|
|
571
|
-
style:
|
|
559
|
+
style: (0, _utils.getWidthCss)({
|
|
560
|
+
shouldUseWidth: shouldUseWidth,
|
|
572
561
|
width: width
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
}, heading);
|
|
562
|
+
})
|
|
563
|
+
}, (0, _react2.jsx)(_primitives.Flex, null, heading));
|
|
577
564
|
}
|
|
578
565
|
}), onVisibleColumnKeysChange && (0, _react2.jsx)(ColumnPickerHeader, null, (0, _react2.jsx)(_columnPicker.ColumnPicker, {
|
|
579
566
|
columns: hasFullSchema ? orderedColumns : [],
|
|
@@ -596,22 +583,21 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
596
583
|
var cellKey = _ref17.key,
|
|
597
584
|
content = _ref17.content,
|
|
598
585
|
width = _ref17.width;
|
|
599
|
-
var
|
|
586
|
+
var isLastCell = cellIndex === cells.length - 1;
|
|
587
|
+
var loadingRowStyle = (0, _utils.getWidthCss)({
|
|
588
|
+
shouldUseWidth: shouldUseWidth,
|
|
600
589
|
width: width
|
|
601
|
-
}
|
|
602
|
-
maxWidth: width
|
|
603
|
-
};
|
|
590
|
+
});
|
|
604
591
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
605
592
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
606
593
|
loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
|
|
607
594
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
608
595
|
});
|
|
609
596
|
}
|
|
610
|
-
return (0, _react2.jsx)(
|
|
597
|
+
return (0, _react2.jsx)(TableCell, {
|
|
611
598
|
key: cellKey,
|
|
612
599
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
613
|
-
colSpan:
|
|
614
|
-
css: truncatedCellStyles,
|
|
600
|
+
colSpan: isEditable && isLastCell ? 2 : undefined,
|
|
615
601
|
style: loadingRowStyle
|
|
616
602
|
}, content);
|
|
617
603
|
}));
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.TableHeading = exports.Table = exports.ScrollableContainerHeight = exports.FieldTextFontSize = void 0;
|
|
7
|
+
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.TableHeading = exports.Table = exports.ScrollableContainerHeight = exports.FieldTextFontSize = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -14,4 +14,17 @@ var FieldTextFontSize = exports.FieldTextFontSize = '14px';
|
|
|
14
14
|
var Table = exports.Table = _styled.default.table(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n"])));
|
|
15
15
|
var lineHeight = "var(--ds-font-lineHeight-300, 24px)";
|
|
16
16
|
var verticalPadding = "var(--ds-space-025, 2px)";
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
20
|
+
* from editor table plugin.
|
|
21
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
22
|
+
* and force make browser use it first and editor plugin css second.
|
|
23
|
+
*/
|
|
24
|
+
var withTablePluginPrefix = exports.withTablePluginPrefix = function withTablePluginPrefix(tableSection) {
|
|
25
|
+
var mainRule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '&';
|
|
26
|
+
return "\n .pm-table-wrapper > table ".concat(tableSection, " ").concat(mainRule, ",\n .ProseMirror .pm-table-wrapper > table ").concat(tableSection, " ").concat(mainRule, ",\n ").concat(mainRule, "\n");
|
|
27
|
+
};
|
|
28
|
+
var withTablePluginHeaderPrefix = exports.withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
|
|
29
|
+
var withTablePluginBodyPrefix = exports.withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
|
|
30
|
+
var TableHeading = exports.TableHeading = _styled.default.th(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", " {\n border: 0;\n position: relative;\n\n /* This makes resizing work with out jumping due to padding + changes overall width for same default values. */\n box-sizing: border-box;\n\n line-height: ", ";\n padding: ", " ", ";\n border-right: 0.5px solid ", ";\n border-bottom: 2px solid ", ";\n\n /*\n lineHeight * 2 -> Max height of two lined header\n verticalPadding * 2 -> padding for this component itself\n verticalPadding * 2 -> padding inside span (--container)\n 2px -> Bottom border\n Last two terms are needed because of border-box box sizing.\n */\n height: calc(", " * 2 + ", " * 4 + 2px);\n vertical-align: bottom;\n background-color: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n & [data-testid='datasource-header-content--container'] {\n width: 100%;\n padding: ", " ", ";\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n white-space: normal;\n overflow: hidden;\n word-wrap: break-word;\n\n &:hover {\n background: ", ";\n border-radius: 3px;\n }\n }\n"])), withTablePluginHeaderPrefix(), lineHeight, verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-border, ".concat(_colors.N40, ")"), "var(--ds-border, ".concat(_colors.N40, ")"), lineHeight, verticalPadding, "var(--ds-elevation-surface-current, #FFF)", withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)'), withTablePluginHeaderPrefix('&:first-child'), "var(--ds-space-050, 4px)", withTablePluginHeaderPrefix('&:last-child'), verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-background-input-hovered, #F7F8F9)");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getWidthCss = exports.COLUMN_MIN_WIDTH = exports.COLUMN_BASE_WIDTH = void 0;
|
|
7
|
+
var COLUMN_BASE_WIDTH = exports.COLUMN_BASE_WIDTH = 8;
|
|
8
|
+
var COLUMN_MIN_WIDTH = exports.COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
9
|
+
/**
|
|
10
|
+
* Generate width related portion of css for table cell.
|
|
11
|
+
*
|
|
12
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
13
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
14
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
15
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
16
|
+
* @param width
|
|
17
|
+
*/
|
|
18
|
+
var getWidthCss = exports.getWidthCss = function getWidthCss(_ref) {
|
|
19
|
+
var shouldUseWidth = _ref.shouldUseWidth,
|
|
20
|
+
width = _ref.width;
|
|
21
|
+
return shouldUseWidth ? {
|
|
22
|
+
width: width
|
|
23
|
+
} : {
|
|
24
|
+
maxWidth: width
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -153,7 +153,11 @@ export const useDatasourceTableState = ({
|
|
|
153
153
|
setTotalCount(totalCount);
|
|
154
154
|
setNextCursor(nextPageCursor);
|
|
155
155
|
setResponseItems(currentResponseItems => {
|
|
156
|
-
|
|
156
|
+
// FIXME EDM-8977 (https://product-fabric.atlassian.net/browse/EDM-8977)
|
|
157
|
+
// once the onNextPage and reset loop issue has been thoroughly investigated
|
|
158
|
+
// in the above card, remove this isEqual check, ensure onNextPage isn't called twice
|
|
159
|
+
const hasIdenticalResponseItems = isEqual(currentResponseItems, items);
|
|
160
|
+
if (hasIdenticalResponseItems || shouldRequestFirstPage) {
|
|
157
161
|
return items;
|
|
158
162
|
}
|
|
159
163
|
return [...currentResponseItems, ...items];
|
|
@@ -188,7 +192,7 @@ export const useDatasourceTableState = ({
|
|
|
188
192
|
}
|
|
189
193
|
setStatus('rejected');
|
|
190
194
|
}
|
|
191
|
-
}, [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems
|
|
195
|
+
}, [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems, applySchemaProperties, fireEvent, fullSchema]);
|
|
192
196
|
const reset = useCallback(options => {
|
|
193
197
|
setStatus('empty');
|
|
194
198
|
setResponseItems([]);
|
|
@@ -12,7 +12,7 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
12
12
|
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
13
13
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
14
14
|
import { TableHeading } from './styled';
|
|
15
|
-
import { COLUMN_MIN_WIDTH } from './
|
|
15
|
+
import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
|
|
16
16
|
const verticallyAlignedStyles = css({
|
|
17
17
|
display: 'flex',
|
|
18
18
|
alignItems: 'center',
|
|
@@ -236,9 +236,6 @@ export const DraggableTableHeading = ({
|
|
|
236
236
|
|
|
237
237
|
// Set the width of our header being resized
|
|
238
238
|
let proposedWidth = initialWidth + relativeDistanceX;
|
|
239
|
-
if (initialWidth >= COLUMN_MIN_WIDTH && proposedWidth < COLUMN_MIN_WIDTH) {
|
|
240
|
-
proposedWidth = COLUMN_MIN_WIDTH;
|
|
241
|
-
}
|
|
242
239
|
|
|
243
240
|
// We update width css directly live
|
|
244
241
|
mainHeaderCell.style.setProperty('width', `${proposedWidth}px`);
|
|
@@ -247,23 +244,23 @@ export const DraggableTableHeading = ({
|
|
|
247
244
|
cancelUnhandled.stop();
|
|
248
245
|
setState(idleState);
|
|
249
246
|
if (onWidthChange) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
247
|
+
let cssWidth = +mainHeaderCell.style.getPropertyValue('width').slice(0, -2);
|
|
248
|
+
if (cssWidth < COLUMN_MIN_WIDTH) {
|
|
249
|
+
cssWidth = COLUMN_MIN_WIDTH;
|
|
250
|
+
}
|
|
251
|
+
onWidthChange(cssWidth);
|
|
253
252
|
}
|
|
254
253
|
}
|
|
255
254
|
});
|
|
256
255
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
257
256
|
return jsx(TableHeading, {
|
|
258
257
|
ref: mainHeaderCellRef,
|
|
259
|
-
className: "has-column-picker",
|
|
260
258
|
"data-testid": `${id}-column-heading`,
|
|
261
259
|
style: {
|
|
262
260
|
cursor: 'grab',
|
|
263
|
-
...(
|
|
261
|
+
...getWidthCss({
|
|
262
|
+
shouldUseWidth: !!onWidthChange,
|
|
264
263
|
width
|
|
265
|
-
} : {
|
|
266
|
-
maxWidth: width
|
|
267
264
|
})
|
|
268
265
|
}
|
|
269
266
|
}, onWidthChange ? jsx("div", {
|
|
@@ -12,6 +12,7 @@ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/r
|
|
|
12
12
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
13
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
14
14
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
15
|
+
import { Flex } from '@atlaskit/primitives';
|
|
15
16
|
import { N40 } from '@atlaskit/theme/colors';
|
|
16
17
|
import Tooltip from '@atlaskit/tooltip';
|
|
17
18
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
@@ -21,8 +22,9 @@ import { DragColumnPreview } from './drag-column-preview';
|
|
|
21
22
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
22
23
|
import TableEmptyState from './empty-state';
|
|
23
24
|
import { fallbackRenderType, stringifyType } from './render-type';
|
|
24
|
-
import { Table, TableHeading } from './styled';
|
|
25
|
+
import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
|
|
25
26
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
27
|
+
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
26
28
|
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
27
29
|
const tableHeadStyles = css({
|
|
28
30
|
background: "var(--ds-elevation-surface-current, #FFF)",
|
|
@@ -36,40 +38,57 @@ const truncateTextStyles = css({
|
|
|
36
38
|
whiteSpace: 'nowrap'
|
|
37
39
|
});
|
|
38
40
|
const ColumnPickerHeader = styled.th`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
right: calc(-1 * ${tableSidePadding});
|
|
43
|
-
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
44
|
-
border-bottom: 2px solid ${`var(--ds-border, ${N40})`}; /* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
41
|
+
${withTablePluginHeaderPrefix()} {
|
|
42
|
+
box-sizing: content-box;
|
|
43
|
+
border: 0;
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
width: 56px;
|
|
46
|
+
z-index: 10;
|
|
47
|
+
position: sticky;
|
|
48
|
+
right: calc(-1 * ${tableSidePadding});
|
|
49
|
+
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
50
|
+
border-bottom: 2px solid ${`var(--ds-border, ${N40})`}; /* It is required to have solid (not half-transparent) color because of this gradient business below */
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
padding-right: ${"var(--ds-space-100, 4px)"};
|
|
53
|
+
|
|
54
|
+
background: linear-gradient(
|
|
55
|
+
90deg,
|
|
56
|
+
rgba(255, 255, 255, 0) 0%,
|
|
57
|
+
${"var(--ds-elevation-surface-current, #FFF)"} 10%
|
|
58
|
+
);
|
|
59
|
+
vertical-align: middle; /* Keeps dropdown button in the middle */
|
|
60
|
+
text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
${withTablePluginHeaderPrefix('&:last-of-type')} {
|
|
55
64
|
padding-right: ${tableSidePadding};
|
|
56
65
|
}
|
|
57
|
-
text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */
|
|
58
66
|
`;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const TableCell = styled.td`
|
|
68
|
+
${withTablePluginBodyPrefix()} {
|
|
69
|
+
/* First section here is to override things editor table plugin css defines */
|
|
70
|
+
padding: ${"var(--ds-space-050, 4px)"} ${"var(--ds-space-100, 8px)"};
|
|
71
|
+
border: 0;
|
|
72
|
+
min-width: auto;
|
|
73
|
+
vertical-align: inherit;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
border-right: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
80
|
+
border-bottom: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
71
81
|
}
|
|
72
|
-
|
|
82
|
+
|
|
83
|
+
${withTablePluginBodyPrefix('&:first-child')} {
|
|
84
|
+
padding-left: ${"var(--ds-space-100, 8px)"};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
${withTablePluginBodyPrefix('&:last-child')} {
|
|
88
|
+
border-right: 0;
|
|
89
|
+
padding-right: ${"var(--ds-space-100, 8px)"};
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
73
92
|
const tableContainerStyles = css({
|
|
74
93
|
borderRadius: 'inherit',
|
|
75
94
|
borderBottomLeftRadius: 0,
|
|
@@ -233,16 +252,14 @@ export const getOrderedColumns = (columns, visibleColumnKeys) => {
|
|
|
233
252
|
const alphabeticallySortedInvisibleColumns = columns.filter(column => !visibleColumnKeys.includes(column.key)).sort(sortColumns);
|
|
234
253
|
return [...visibleColumns, ...alphabeticallySortedInvisibleColumns];
|
|
235
254
|
};
|
|
236
|
-
const
|
|
237
|
-
const DEFAULT_WIDTH = BASE_WIDTH * 22;
|
|
238
|
-
export const COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
|
|
255
|
+
const DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
|
|
239
256
|
const keyBasedWidthMap = {
|
|
240
|
-
priority:
|
|
241
|
-
status:
|
|
242
|
-
summary:
|
|
243
|
-
description:
|
|
244
|
-
type:
|
|
245
|
-
key:
|
|
257
|
+
priority: COLUMN_BASE_WIDTH * 5,
|
|
258
|
+
status: COLUMN_BASE_WIDTH * 18,
|
|
259
|
+
summary: COLUMN_BASE_WIDTH * 45,
|
|
260
|
+
description: COLUMN_BASE_WIDTH * 31,
|
|
261
|
+
type: COLUMN_BASE_WIDTH * 6,
|
|
262
|
+
key: COLUMN_BASE_WIDTH * 15
|
|
246
263
|
};
|
|
247
264
|
function getDefaultColumnWidth(key, type) {
|
|
248
265
|
const keyBasedWidth = keyBasedWidthMap[key];
|
|
@@ -251,9 +268,9 @@ function getDefaultColumnWidth(key, type) {
|
|
|
251
268
|
}
|
|
252
269
|
switch (type) {
|
|
253
270
|
case 'date':
|
|
254
|
-
return
|
|
271
|
+
return COLUMN_BASE_WIDTH * 16;
|
|
255
272
|
case 'icon':
|
|
256
|
-
return
|
|
273
|
+
return COLUMN_BASE_WIDTH * 7;
|
|
257
274
|
default:
|
|
258
275
|
return DEFAULT_WIDTH;
|
|
259
276
|
}
|
|
@@ -490,7 +507,8 @@ export const IssueLikeDataTableView = ({
|
|
|
490
507
|
setHasFullSchema(false);
|
|
491
508
|
}
|
|
492
509
|
}, [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
493
|
-
const shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
510
|
+
const shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
511
|
+
const isEditable = onVisibleColumnKeysChange && hasData;
|
|
494
512
|
return jsx("div", {
|
|
495
513
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
496
514
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -510,7 +528,8 @@ export const IssueLikeDataTableView = ({
|
|
|
510
528
|
} : {}
|
|
511
529
|
}, jsx("thead", {
|
|
512
530
|
"data-testid": testId && `${testId}--head`,
|
|
513
|
-
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
531
|
+
css: [noDefaultBorderStyles, tableHeadStyles],
|
|
532
|
+
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
514
533
|
}, jsx("tr", {
|
|
515
534
|
ref: tableHeaderRowRef
|
|
516
535
|
}, headerColumns.map(({
|
|
@@ -526,7 +545,7 @@ export const IssueLikeDataTableView = ({
|
|
|
526
545
|
level: "h200",
|
|
527
546
|
as: 'span'
|
|
528
547
|
}, content));
|
|
529
|
-
if (
|
|
548
|
+
if (isEditable) {
|
|
530
549
|
var _containerRef$current3;
|
|
531
550
|
const previewRows = tableRows.map(({
|
|
532
551
|
cells
|
|
@@ -555,14 +574,12 @@ export const IssueLikeDataTableView = ({
|
|
|
555
574
|
} else {
|
|
556
575
|
return jsx(TableHeading, {
|
|
557
576
|
key: key,
|
|
558
|
-
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : '',
|
|
559
577
|
"data-testid": `${key}-column-heading`,
|
|
560
|
-
style:
|
|
578
|
+
style: getWidthCss({
|
|
579
|
+
shouldUseWidth,
|
|
561
580
|
width
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
}, heading);
|
|
581
|
+
})
|
|
582
|
+
}, jsx(Flex, null, heading));
|
|
566
583
|
}
|
|
567
584
|
}), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
568
585
|
columns: hasFullSchema ? orderedColumns : [],
|
|
@@ -586,11 +603,11 @@ export const IssueLikeDataTableView = ({
|
|
|
586
603
|
content,
|
|
587
604
|
width
|
|
588
605
|
}, cellIndex) => {
|
|
589
|
-
|
|
606
|
+
const isLastCell = cellIndex === cells.length - 1;
|
|
607
|
+
let loadingRowStyle = getWidthCss({
|
|
608
|
+
shouldUseWidth,
|
|
590
609
|
width
|
|
591
|
-
}
|
|
592
|
-
maxWidth: width
|
|
593
|
-
};
|
|
610
|
+
});
|
|
594
611
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
595
612
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
596
613
|
loadingRowStyle = {
|
|
@@ -598,11 +615,10 @@ export const IssueLikeDataTableView = ({
|
|
|
598
615
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
599
616
|
};
|
|
600
617
|
}
|
|
601
|
-
return jsx(
|
|
618
|
+
return jsx(TableCell, {
|
|
602
619
|
key: cellKey,
|
|
603
620
|
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
604
|
-
colSpan:
|
|
605
|
-
css: truncatedCellStyles,
|
|
621
|
+
colSpan: isEditable && isLastCell ? 2 : undefined,
|
|
606
622
|
style: loadingRowStyle
|
|
607
623
|
}, content);
|
|
608
624
|
}))))));
|
|
@@ -7,24 +7,54 @@ export const Table = styled.table`
|
|
|
7
7
|
`;
|
|
8
8
|
const lineHeight = "var(--ds-font-lineHeight-300, 24px)";
|
|
9
9
|
const verticalPadding = "var(--ds-space-025, 2px)";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
13
|
+
* from editor table plugin.
|
|
14
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
15
|
+
* and force make browser use it first and editor plugin css second.
|
|
16
|
+
*/
|
|
17
|
+
export const withTablePluginPrefix = (tableSection, mainRule = '&') => `
|
|
18
|
+
.pm-table-wrapper > table ${tableSection} ${mainRule},
|
|
19
|
+
.ProseMirror .pm-table-wrapper > table ${tableSection} ${mainRule},
|
|
20
|
+
${mainRule}
|
|
21
|
+
`;
|
|
22
|
+
export const withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
|
|
23
|
+
export const withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
|
|
10
24
|
export const TableHeading = styled.th`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
${withTablePluginHeaderPrefix()} {
|
|
26
|
+
border: 0;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
/* This makes resizing work with out jumping due to padding + changes overall width for same default values. */
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
|
|
32
|
+
line-height: ${lineHeight};
|
|
33
|
+
padding: ${verticalPadding} ${"var(--ds-space-050, 4px)"};
|
|
34
|
+
border-right: 0.5px solid ${`var(--ds-border, ${N40})`};
|
|
35
|
+
border-bottom: 2px solid ${`var(--ds-border, ${N40})`};
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
lineHeight * 2 -> Max height of two lined header
|
|
39
|
+
verticalPadding * 2 -> padding for this component itself
|
|
40
|
+
verticalPadding * 2 -> padding inside span (--container)
|
|
41
|
+
2px -> Bottom border
|
|
42
|
+
Last two terms are needed because of border-box box sizing.
|
|
43
|
+
*/
|
|
44
|
+
height: calc(${lineHeight} * 2 + ${verticalPadding} * 4 + 2px);
|
|
45
|
+
vertical-align: bottom;
|
|
46
|
+
background-color: ${"var(--ds-elevation-surface-current, #FFF)"};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)')} {
|
|
20
50
|
border-right: 0;
|
|
21
51
|
}
|
|
22
52
|
|
|
23
|
-
&:first-child {
|
|
53
|
+
${withTablePluginHeaderPrefix('&:first-child')} {
|
|
24
54
|
padding-left: ${"var(--ds-space-050, 4px)"};
|
|
25
55
|
}
|
|
26
56
|
|
|
27
|
-
&:last-child {
|
|
57
|
+
${withTablePluginHeaderPrefix('&:last-child')} {
|
|
28
58
|
border-right: 0;
|
|
29
59
|
}
|
|
30
60
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const COLUMN_BASE_WIDTH = 8;
|
|
2
|
+
export const COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
3
|
+
/**
|
|
4
|
+
* Generate width related portion of css for table cell.
|
|
5
|
+
*
|
|
6
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
7
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
8
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
9
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
10
|
+
* @param width
|
|
11
|
+
*/
|
|
12
|
+
export const getWidthCss = ({
|
|
13
|
+
shouldUseWidth,
|
|
14
|
+
width
|
|
15
|
+
}) => shouldUseWidth ? {
|
|
16
|
+
width
|
|
17
|
+
} : {
|
|
18
|
+
maxWidth: width
|
|
19
|
+
};
|
|
@@ -251,7 +251,11 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
251
251
|
setTotalCount(_totalCount);
|
|
252
252
|
setNextCursor(nextPageCursor);
|
|
253
253
|
setResponseItems(function (currentResponseItems) {
|
|
254
|
-
|
|
254
|
+
// FIXME EDM-8977 (https://product-fabric.atlassian.net/browse/EDM-8977)
|
|
255
|
+
// once the onNextPage and reset loop issue has been thoroughly investigated
|
|
256
|
+
// in the above card, remove this isEqual check, ensure onNextPage isn't called twice
|
|
257
|
+
var hasIdenticalResponseItems = isEqual(currentResponseItems, items);
|
|
258
|
+
if (hasIdenticalResponseItems || shouldRequestFirstPage) {
|
|
255
259
|
return items;
|
|
256
260
|
}
|
|
257
261
|
return [].concat(_toConsumableArray(currentResponseItems), _toConsumableArray(items));
|
|
@@ -300,7 +304,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
300
304
|
return _context2.stop();
|
|
301
305
|
}
|
|
302
306
|
}, _callee2, null, [[7, 39]]);
|
|
303
|
-
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems
|
|
307
|
+
})), [captureError, parameters, fieldKeys, nextCursor, getDatasourceData, datasourceId, responseItems, applySchemaProperties, fireEvent, fullSchema]);
|
|
304
308
|
var reset = useCallback(function (options) {
|
|
305
309
|
setStatus('empty');
|
|
306
310
|
setResponseItems([]);
|
|
@@ -16,7 +16,7 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util
|
|
|
16
16
|
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
17
17
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
18
18
|
import { TableHeading } from './styled';
|
|
19
|
-
import { COLUMN_MIN_WIDTH } from './
|
|
19
|
+
import { COLUMN_MIN_WIDTH, getWidthCss } from './utils';
|
|
20
20
|
var verticallyAlignedStyles = css({
|
|
21
21
|
display: 'flex',
|
|
22
22
|
alignItems: 'center',
|
|
@@ -242,9 +242,6 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
242
242
|
|
|
243
243
|
// Set the width of our header being resized
|
|
244
244
|
var proposedWidth = initialWidth + relativeDistanceX;
|
|
245
|
-
if (initialWidth >= COLUMN_MIN_WIDTH && proposedWidth < COLUMN_MIN_WIDTH) {
|
|
246
|
-
proposedWidth = COLUMN_MIN_WIDTH;
|
|
247
|
-
}
|
|
248
245
|
|
|
249
246
|
// We update width css directly live
|
|
250
247
|
mainHeaderCell.style.setProperty('width', "".concat(proposedWidth, "px"));
|
|
@@ -253,24 +250,24 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
253
250
|
cancelUnhandled.stop();
|
|
254
251
|
setState(idleState);
|
|
255
252
|
if (onWidthChange) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
var cssWidth = +mainHeaderCell.style.getPropertyValue('width').slice(0, -2);
|
|
254
|
+
if (cssWidth < COLUMN_MIN_WIDTH) {
|
|
255
|
+
cssWidth = COLUMN_MIN_WIDTH;
|
|
256
|
+
}
|
|
257
|
+
onWidthChange(cssWidth);
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
260
|
});
|
|
262
261
|
}, [id, index, onWidthChange, state, tableId, width]);
|
|
263
262
|
return jsx(TableHeading, {
|
|
264
263
|
ref: mainHeaderCellRef,
|
|
265
|
-
className: "has-column-picker",
|
|
266
264
|
"data-testid": "".concat(id, "-column-heading"),
|
|
267
265
|
style: _objectSpread({
|
|
268
266
|
cursor: 'grab'
|
|
269
|
-
},
|
|
267
|
+
}, getWidthCss({
|
|
268
|
+
shouldUseWidth: !!onWidthChange,
|
|
270
269
|
width: width
|
|
271
|
-
}
|
|
272
|
-
maxWidth: width
|
|
273
|
-
})
|
|
270
|
+
}))
|
|
274
271
|
}, onWidthChange ? jsx("div", {
|
|
275
272
|
ref: columnResizeHandleRef,
|
|
276
273
|
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
6
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
7
|
-
var _templateObject;
|
|
7
|
+
var _templateObject, _templateObject2;
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
@@ -21,6 +21,7 @@ import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/r
|
|
|
21
21
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
22
22
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
23
23
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
24
|
+
import { Flex } from '@atlaskit/primitives';
|
|
24
25
|
import { N40 } from '@atlaskit/theme/colors';
|
|
25
26
|
import Tooltip from '@atlaskit/tooltip';
|
|
26
27
|
import { startUfoExperience, succeedUfoExperience } from '../../analytics/ufoExperiences';
|
|
@@ -30,8 +31,9 @@ import { DragColumnPreview } from './drag-column-preview';
|
|
|
30
31
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
31
32
|
import TableEmptyState from './empty-state';
|
|
32
33
|
import { fallbackRenderType, stringifyType } from './render-type';
|
|
33
|
-
import { Table, TableHeading } from './styled';
|
|
34
|
+
import { Table, TableHeading, withTablePluginBodyPrefix, withTablePluginHeaderPrefix } from './styled';
|
|
34
35
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
36
|
+
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
35
37
|
var tableSidePadding = "var(--ds-space-200, 16px)";
|
|
36
38
|
var tableHeadStyles = css({
|
|
37
39
|
background: "var(--ds-elevation-surface-current, #FFF)",
|
|
@@ -44,21 +46,8 @@ var truncateTextStyles = css({
|
|
|
44
46
|
textOverflow: 'ellipsis',
|
|
45
47
|
whiteSpace: 'nowrap'
|
|
46
48
|
});
|
|
47
|
-
var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 56px;\n
|
|
48
|
-
var
|
|
49
|
-
overflow: 'hidden',
|
|
50
|
-
textOverflow: 'ellipsis',
|
|
51
|
-
whiteSpace: 'nowrap',
|
|
52
|
-
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
53
|
-
borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(N40, ")")),
|
|
54
|
-
'&:first-child': {
|
|
55
|
-
paddingLeft: "var(--ds-space-100, 8px)"
|
|
56
|
-
},
|
|
57
|
-
'&:last-child': {
|
|
58
|
-
borderRight: 0,
|
|
59
|
-
paddingRight: "var(--ds-space-100, 8px)"
|
|
60
|
-
}
|
|
61
|
-
});
|
|
49
|
+
var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n box-sizing: content-box;\n border: 0;\n\n width: 56px;\n z-index: 10;\n position: sticky;\n right: calc(-1 * ", ");\n background-color: ", ";\n border-bottom: 2px solid ", "; /* It is required to have solid (not half-transparent) color because of this gradient business below */\n\n padding-right: ", ";\n\n background: linear-gradient(\n 90deg,\n rgba(255, 255, 255, 0) 0%,\n ", " 10%\n );\n vertical-align: middle; /* Keeps dropdown button in the middle */\n text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n }\n\n ", " {\n padding-right: ", ";\n }\n"])), withTablePluginHeaderPrefix(), tableSidePadding, "var(--ds-elevation-surface-current, #FFF)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-space-100, 4px)", "var(--ds-elevation-surface-current, #FFF)", withTablePluginHeaderPrefix('&:last-of-type'), tableSidePadding);
|
|
50
|
+
var TableCell = styled.td(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n /* First section here is to override things editor table plugin css defines */\n padding: ", " ", ";\n border: 0;\n min-width: auto;\n vertical-align: inherit;\n box-sizing: border-box;\n\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-right: 0.5px solid ", ";\n border-bottom: 0.5px solid ", ";\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n padding-right: ", ";\n }\n"])), withTablePluginBodyPrefix(), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), withTablePluginBodyPrefix('&:first-child'), "var(--ds-space-100, 8px)", withTablePluginBodyPrefix('&:last-child'), "var(--ds-space-100, 8px)");
|
|
62
51
|
var tableContainerStyles = css({
|
|
63
52
|
borderRadius: 'inherit',
|
|
64
53
|
borderBottomLeftRadius: 0,
|
|
@@ -188,16 +177,14 @@ export var getOrderedColumns = function getOrderedColumns(columns, visibleColumn
|
|
|
188
177
|
}).sort(sortColumns);
|
|
189
178
|
return [].concat(_toConsumableArray(visibleColumns), _toConsumableArray(alphabeticallySortedInvisibleColumns));
|
|
190
179
|
};
|
|
191
|
-
var
|
|
192
|
-
var DEFAULT_WIDTH = BASE_WIDTH * 22;
|
|
193
|
-
export var COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
|
|
180
|
+
var DEFAULT_WIDTH = COLUMN_BASE_WIDTH * 22;
|
|
194
181
|
var keyBasedWidthMap = {
|
|
195
|
-
priority:
|
|
196
|
-
status:
|
|
197
|
-
summary:
|
|
198
|
-
description:
|
|
199
|
-
type:
|
|
200
|
-
key:
|
|
182
|
+
priority: COLUMN_BASE_WIDTH * 5,
|
|
183
|
+
status: COLUMN_BASE_WIDTH * 18,
|
|
184
|
+
summary: COLUMN_BASE_WIDTH * 45,
|
|
185
|
+
description: COLUMN_BASE_WIDTH * 31,
|
|
186
|
+
type: COLUMN_BASE_WIDTH * 6,
|
|
187
|
+
key: COLUMN_BASE_WIDTH * 15
|
|
201
188
|
};
|
|
202
189
|
function getDefaultColumnWidth(key, type) {
|
|
203
190
|
var keyBasedWidth = keyBasedWidthMap[key];
|
|
@@ -206,9 +193,9 @@ function getDefaultColumnWidth(key, type) {
|
|
|
206
193
|
}
|
|
207
194
|
switch (type) {
|
|
208
195
|
case 'date':
|
|
209
|
-
return
|
|
196
|
+
return COLUMN_BASE_WIDTH * 16;
|
|
210
197
|
case 'icon':
|
|
211
|
-
return
|
|
198
|
+
return COLUMN_BASE_WIDTH * 7;
|
|
212
199
|
default:
|
|
213
200
|
return DEFAULT_WIDTH;
|
|
214
201
|
}
|
|
@@ -495,7 +482,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
495
482
|
}
|
|
496
483
|
}, _callee, null, [[3, 9]]);
|
|
497
484
|
})), [parentContainerRenderInstanceId, extensionKey, hasFullSchema, onLoadDatasourceDetails]);
|
|
498
|
-
var shouldUseWidth = onColumnResize || columnCustomSizes;
|
|
485
|
+
var shouldUseWidth = !!(onColumnResize || columnCustomSizes);
|
|
486
|
+
var isEditable = onVisibleColumnKeysChange && hasData;
|
|
499
487
|
return jsx("div", {
|
|
500
488
|
/* There is required contentEditable={true} in editor-card-plugin
|
|
501
489
|
* But this brakes how DND works. We set contentEditable={false} to allow DND to work
|
|
@@ -515,7 +503,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
515
503
|
} : {}
|
|
516
504
|
}, jsx("thead", {
|
|
517
505
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
518
|
-
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
506
|
+
css: [noDefaultBorderStyles, tableHeadStyles],
|
|
507
|
+
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
519
508
|
}, jsx("tr", {
|
|
520
509
|
ref: tableHeaderRowRef
|
|
521
510
|
}, headerColumns.map(function (_ref13, cellIndex) {
|
|
@@ -530,7 +519,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
530
519
|
level: "h200",
|
|
531
520
|
as: 'span'
|
|
532
521
|
}, content));
|
|
533
|
-
if (
|
|
522
|
+
if (isEditable) {
|
|
534
523
|
var _containerRef$current3;
|
|
535
524
|
var previewRows = tableRows.map(function (_ref14) {
|
|
536
525
|
var cells = _ref14.cells;
|
|
@@ -559,14 +548,12 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
559
548
|
} else {
|
|
560
549
|
return jsx(TableHeading, {
|
|
561
550
|
key: key,
|
|
562
|
-
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : '',
|
|
563
551
|
"data-testid": "".concat(key, "-column-heading"),
|
|
564
|
-
style:
|
|
552
|
+
style: getWidthCss({
|
|
553
|
+
shouldUseWidth: shouldUseWidth,
|
|
565
554
|
width: width
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
}, heading);
|
|
555
|
+
})
|
|
556
|
+
}, jsx(Flex, null, heading));
|
|
570
557
|
}
|
|
571
558
|
}), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
572
559
|
columns: hasFullSchema ? orderedColumns : [],
|
|
@@ -589,22 +576,21 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
589
576
|
var cellKey = _ref17.key,
|
|
590
577
|
content = _ref17.content,
|
|
591
578
|
width = _ref17.width;
|
|
592
|
-
var
|
|
579
|
+
var isLastCell = cellIndex === cells.length - 1;
|
|
580
|
+
var loadingRowStyle = getWidthCss({
|
|
581
|
+
shouldUseWidth: shouldUseWidth,
|
|
593
582
|
width: width
|
|
594
|
-
}
|
|
595
|
-
maxWidth: width
|
|
596
|
-
};
|
|
583
|
+
});
|
|
597
584
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
598
585
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
599
586
|
loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
|
|
600
587
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
601
588
|
});
|
|
602
589
|
}
|
|
603
|
-
return jsx(
|
|
590
|
+
return jsx(TableCell, {
|
|
604
591
|
key: cellKey,
|
|
605
592
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
606
|
-
colSpan:
|
|
607
|
-
css: truncatedCellStyles,
|
|
593
|
+
colSpan: isEditable && isLastCell ? 2 : undefined,
|
|
608
594
|
style: loadingRowStyle
|
|
609
595
|
}, content);
|
|
610
596
|
}));
|
|
@@ -7,4 +7,17 @@ export var FieldTextFontSize = '14px';
|
|
|
7
7
|
export var Table = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n"])));
|
|
8
8
|
var lineHeight = "var(--ds-font-lineHeight-300, 24px)";
|
|
9
9
|
var verticalPadding = "var(--ds-space-025, 2px)";
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
13
|
+
* from editor table plugin.
|
|
14
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
15
|
+
* and force make browser use it first and editor plugin css second.
|
|
16
|
+
*/
|
|
17
|
+
export var withTablePluginPrefix = function withTablePluginPrefix(tableSection) {
|
|
18
|
+
var mainRule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '&';
|
|
19
|
+
return "\n .pm-table-wrapper > table ".concat(tableSection, " ").concat(mainRule, ",\n .ProseMirror .pm-table-wrapper > table ").concat(tableSection, " ").concat(mainRule, ",\n ").concat(mainRule, "\n");
|
|
20
|
+
};
|
|
21
|
+
export var withTablePluginHeaderPrefix = withTablePluginPrefix.bind(null, 'thead');
|
|
22
|
+
export var withTablePluginBodyPrefix = withTablePluginPrefix.bind(null, 'tbody');
|
|
23
|
+
export var TableHeading = styled.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n border: 0;\n position: relative;\n\n /* This makes resizing work with out jumping due to padding + changes overall width for same default values. */\n box-sizing: border-box;\n\n line-height: ", ";\n padding: ", " ", ";\n border-right: 0.5px solid ", ";\n border-bottom: 2px solid ", ";\n\n /*\n lineHeight * 2 -> Max height of two lined header\n verticalPadding * 2 -> padding for this component itself\n verticalPadding * 2 -> padding inside span (--container)\n 2px -> Bottom border\n Last two terms are needed because of border-box box sizing.\n */\n height: calc(", " * 2 + ", " * 4 + 2px);\n vertical-align: bottom;\n background-color: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n ", " {\n padding-left: ", ";\n }\n\n ", " {\n border-right: 0;\n }\n\n & [data-testid='datasource-header-content--container'] {\n width: 100%;\n padding: ", " ", ";\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n white-space: normal;\n overflow: hidden;\n word-wrap: break-word;\n\n &:hover {\n background: ", ";\n border-radius: 3px;\n }\n }\n"])), withTablePluginHeaderPrefix(), lineHeight, verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-border, ".concat(N40, ")"), "var(--ds-border, ".concat(N40, ")"), lineHeight, verticalPadding, "var(--ds-elevation-surface-current, #FFF)", withTablePluginPrefix('', 'thead.has-column-picker &:nth-last-of-type(2)'), withTablePluginHeaderPrefix('&:first-child'), "var(--ds-space-050, 4px)", withTablePluginHeaderPrefix('&:last-child'), verticalPadding, "var(--ds-space-050, 4px)", "var(--ds-background-input-hovered, #F7F8F9)");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var COLUMN_BASE_WIDTH = 8;
|
|
2
|
+
export var COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 3;
|
|
3
|
+
/**
|
|
4
|
+
* Generate width related portion of css for table cell.
|
|
5
|
+
*
|
|
6
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
7
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
8
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
9
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
10
|
+
* @param width
|
|
11
|
+
*/
|
|
12
|
+
export var getWidthCss = function getWidthCss(_ref) {
|
|
13
|
+
var shouldUseWidth = _ref.shouldUseWidth,
|
|
14
|
+
width = _ref.width;
|
|
15
|
+
return shouldUseWidth ? {
|
|
16
|
+
width: width
|
|
17
|
+
} : {
|
|
18
|
+
maxWidth: width
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -22,6 +22,5 @@ export interface RowCellType {
|
|
|
22
22
|
content?: React.ReactNode | string;
|
|
23
23
|
}
|
|
24
24
|
export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
25
|
-
export declare const COLUMN_MIN_WIDTH: number;
|
|
26
25
|
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
|
|
27
26
|
export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
|
|
@@ -5,6 +5,15 @@ export declare const Table: import("@emotion/styled").StyledComponent<{
|
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
7
7
|
}, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
|
|
8
|
+
/**
|
|
9
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
10
|
+
* from editor table plugin.
|
|
11
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
12
|
+
* and force make browser use it first and editor plugin css second.
|
|
13
|
+
*/
|
|
14
|
+
export declare const withTablePluginPrefix: (tableSection: 'thead' | 'tbody' | '', mainRule?: string) => string;
|
|
15
|
+
export declare const withTablePluginHeaderPrefix: (mainRule?: string | undefined) => string;
|
|
16
|
+
export declare const withTablePluginBodyPrefix: (mainRule?: string | undefined) => string;
|
|
8
17
|
export declare const TableHeading: import("@emotion/styled").StyledComponent<{
|
|
9
18
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
19
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const COLUMN_BASE_WIDTH = 8;
|
|
3
|
+
export declare const COLUMN_MIN_WIDTH: number;
|
|
4
|
+
export type GetWidthCss = (arg: {
|
|
5
|
+
shouldUseWidth: boolean;
|
|
6
|
+
width: number;
|
|
7
|
+
}) => React.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* Generate width related portion of css for table cell.
|
|
10
|
+
*
|
|
11
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
12
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
13
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
14
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
15
|
+
* @param width
|
|
16
|
+
*/
|
|
17
|
+
export declare const getWidthCss: GetWidthCss;
|
|
@@ -22,6 +22,5 @@ export interface RowCellType {
|
|
|
22
22
|
content?: React.ReactNode | string;
|
|
23
23
|
}
|
|
24
24
|
export declare const getOrderedColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
25
|
-
export declare const COLUMN_MIN_WIDTH: number;
|
|
26
25
|
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, columnCustomSizes, onColumnResize, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
|
|
27
26
|
export declare const EmptyState: ({ isCompact, testId }: import("./empty-state").Props) => jsx.JSX.Element;
|
|
@@ -5,6 +5,15 @@ export declare const Table: import("@emotion/styled").StyledComponent<{
|
|
|
5
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
7
7
|
}, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
|
|
8
|
+
/**
|
|
9
|
+
* This is a hack used to override styles that are leaking to our table html element
|
|
10
|
+
* from editor table plugin.
|
|
11
|
+
* This css prefix can be used in front of our main css rule to make its weight bigger
|
|
12
|
+
* and force make browser use it first and editor plugin css second.
|
|
13
|
+
*/
|
|
14
|
+
export declare const withTablePluginPrefix: (tableSection: 'thead' | 'tbody' | '', mainRule?: string) => string;
|
|
15
|
+
export declare const withTablePluginHeaderPrefix: (mainRule?: string | undefined) => string;
|
|
16
|
+
export declare const withTablePluginBodyPrefix: (mainRule?: string | undefined) => string;
|
|
8
17
|
export declare const TableHeading: import("@emotion/styled").StyledComponent<{
|
|
9
18
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
19
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const COLUMN_BASE_WIDTH = 8;
|
|
3
|
+
export declare const COLUMN_MIN_WIDTH: number;
|
|
4
|
+
export type GetWidthCss = (arg: {
|
|
5
|
+
shouldUseWidth: boolean;
|
|
6
|
+
width: number;
|
|
7
|
+
}) => React.CSSProperties;
|
|
8
|
+
/**
|
|
9
|
+
* Generate width related portion of css for table cell.
|
|
10
|
+
*
|
|
11
|
+
* @param shouldUseWidth boolean argument defines if a given width is user defined / baked in value
|
|
12
|
+
* or rather default width that should be treated as a maximum width. When table inserted initially
|
|
13
|
+
* and no user custom width defined we set this value to `false`. As soon as user changes any of the
|
|
14
|
+
* column widths we treat all width as custom hardcoded widths.
|
|
15
|
+
* @param width
|
|
16
|
+
*/
|
|
17
|
+
export declare const getWidthCss: GetWidthCss;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.41",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
49
49
|
"@atlaskit/linking-common": "^5.3.0",
|
|
50
50
|
"@atlaskit/linking-types": "^8.5.0",
|
|
51
|
-
"@atlaskit/lozenge": "^11.
|
|
51
|
+
"@atlaskit/lozenge": "^11.6.0",
|
|
52
52
|
"@atlaskit/modal-dialog": "^12.10.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags": "^0.2.4",
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop": "^0.25.0",
|
|
55
55
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.0",
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-react-indicator": "^0.18.0",
|
|
58
|
-
"@atlaskit/primitives": "^1.
|
|
58
|
+
"@atlaskit/primitives": "^1.17.0",
|
|
59
59
|
"@atlaskit/select": "^17.0.3",
|
|
60
60
|
"@atlaskit/smart-card": "^26.44.0",
|
|
61
61
|
"@atlaskit/spinner": "^16.0.0",
|