@atlaskit/link-datasource 0.31.2 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/analytics/constants.js +8 -0
- package/dist/cjs/analytics/generated/analytics.types.js +5 -0
- package/dist/cjs/analytics/generated/create-event-payload.js +46 -0
- package/dist/cjs/analytics/generated/use-analytics-events.js +32 -0
- package/dist/cjs/analytics/index.js +18 -0
- package/dist/cjs/ui/common/error-state/access-required.js +12 -3
- package/dist/cjs/ui/common/error-state/loading-error.js +20 -11
- package/dist/cjs/ui/common/error-state/modal-loading-error.js +21 -12
- package/dist/cjs/ui/common/error-state/no-results.js +48 -41
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
- package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/cjs/ui/issue-like-table/index.js +102 -71
- package/dist/cjs/ui/issue-like-table/styled.js +2 -1
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +8 -0
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +43 -15
- package/dist/cjs/ui/table-footer/index.js +10 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/constants.js +1 -0
- package/dist/es2019/analytics/generated/analytics.types.js +1 -0
- package/dist/es2019/analytics/generated/create-event-payload.js +28 -0
- package/dist/es2019/analytics/generated/use-analytics-events.js +24 -0
- package/dist/es2019/analytics/index.js +3 -0
- package/dist/es2019/ui/common/error-state/access-required.js +10 -0
- package/dist/es2019/ui/common/error-state/loading-error.js +10 -0
- package/dist/es2019/ui/common/error-state/modal-loading-error.js +10 -0
- package/dist/es2019/ui/common/error-state/no-results.js +8 -0
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
- package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
- package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/es2019/ui/issue-like-table/index.js +86 -43
- package/dist/es2019/ui/issue-like-table/styled.js +18 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +9 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +43 -13
- package/dist/es2019/ui/table-footer/index.js +11 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/constants.js +1 -0
- package/dist/esm/analytics/generated/analytics.types.js +1 -0
- package/dist/esm/analytics/generated/create-event-payload.js +38 -0
- package/dist/esm/analytics/generated/use-analytics-events.js +23 -0
- package/dist/esm/analytics/index.js +5 -0
- package/dist/esm/ui/common/error-state/access-required.js +9 -0
- package/dist/esm/ui/common/error-state/loading-error.js +9 -0
- package/dist/esm/ui/common/error-state/modal-loading-error.js +9 -0
- package/dist/esm/ui/common/error-state/no-results.js +7 -0
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/esm/ui/issue-like-table/index.js +102 -71
- package/dist/esm/ui/issue-like-table/styled.js +2 -1
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +8 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +43 -14
- package/dist/esm/ui/table-footer/index.js +10 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/constants.d.ts +1 -0
- package/dist/types/analytics/generated/analytics.types.d.ts +49 -0
- package/dist/types/analytics/generated/create-event-payload.d.ts +27 -0
- package/dist/types/analytics/generated/use-analytics-events.d.ts +3 -0
- package/dist/types/analytics/index.d.ts +4 -0
- package/dist/types/ui/common/error-state/access-required.d.ts +0 -1
- package/dist/types/ui/common/error-state/loading-error.d.ts +0 -1
- package/dist/types/ui/common/error-state/modal-loading-error.d.ts +0 -1
- package/dist/types/ui/common/error-state/no-results.d.ts +0 -1
- package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types/ui/jira-issues-modal/modal/index.d.ts +3 -1
- package/dist/types-ts4.5/analytics/constants.d.ts +1 -0
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +49 -0
- package/dist/types-ts4.5/analytics/generated/create-event-payload.d.ts +31 -0
- package/dist/types-ts4.5/analytics/generated/use-analytics-events.d.ts +7 -0
- package/dist/types-ts4.5/analytics/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/loading-error.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/modal-loading-error.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/no-results.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +3 -1
- package/package.json +7 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DragColumnPreview = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
12
|
+
var _styled2 = require("./styled");
|
|
13
|
+
var _templateObject, _templateObject2;
|
|
14
|
+
/** @jsx jsx */
|
|
15
|
+
var maxWidth = '200px';
|
|
16
|
+
var firstLastChildOverride = "\n &:first-of-type, &:last-of-type {\n padding-left: ".concat("var(--ds-space-100, 8px)", ";\n padding-right: ", "var(--ds-space-100, 8px)", ";\n }\n");
|
|
17
|
+
var TablePreviewHeading = (0, _styled.default)(_styled2.TableHeading)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n background: ", ";\n color: ", ";\n max-width: ", ";\n ", "\n"])), "var(--ds-background-disabled, #091E4224)", "var(--ds-text-disabled, #091E424F)", maxWidth, firstLastChildOverride);
|
|
18
|
+
var TablePreviewCell = _styled.default.td(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: ", ";\n padding: ", " ", ";\n ", "\n"])), maxWidth, "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", firstLastChildOverride);
|
|
19
|
+
var tableStyles = (0, _react2.css)({
|
|
20
|
+
background: "var(--ds-surface, #FFF)",
|
|
21
|
+
borderCollapse: 'separate',
|
|
22
|
+
borderSpacing: 0,
|
|
23
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
24
|
+
maxWidth: maxWidth
|
|
25
|
+
});
|
|
26
|
+
var DragColumnPreview = function DragColumnPreview(_ref) {
|
|
27
|
+
var title = _ref.title,
|
|
28
|
+
rows = _ref.rows;
|
|
29
|
+
return (0, _react2.jsx)("table", {
|
|
30
|
+
css: tableStyles
|
|
31
|
+
}, (0, _react2.jsx)("thead", null, (0, _react2.jsx)("tr", null, (0, _react2.jsx)(TablePreviewHeading, null, title))), (0, _react2.jsx)("tbody", null, rows.map(function (data, i) {
|
|
32
|
+
return (0, _react2.jsx)("tr", {
|
|
33
|
+
key: i
|
|
34
|
+
}, (0, _react2.jsx)(TablePreviewCell, null, data));
|
|
35
|
+
}), (0, _react2.jsx)("tr", null, (0, _react2.jsx)(TablePreviewCell, null, "..."))));
|
|
36
|
+
};
|
|
37
|
+
exports.DragColumnPreview = DragColumnPreview;
|
|
@@ -8,18 +8,18 @@ exports.DraggableTableHeading = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
12
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
12
13
|
var _dragHandler = _interopRequireDefault(require("@atlaskit/icon/glyph/drag-handler"));
|
|
13
14
|
var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
|
|
14
15
|
var _boxWithoutTerminal = require("@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal");
|
|
15
16
|
var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
|
|
16
17
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/util/combine");
|
|
18
|
+
var _offsetFromPointer = require("@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer");
|
|
19
|
+
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview");
|
|
17
20
|
var _styled = require("./styled");
|
|
18
21
|
/** @jsx jsx */
|
|
19
22
|
|
|
20
|
-
var tableHeadingStyles = (0, _react2.css)({
|
|
21
|
-
cursor: 'grab'
|
|
22
|
-
});
|
|
23
23
|
var tableHeadingStatusStyles = {
|
|
24
24
|
idle: (0, _react2.css)({
|
|
25
25
|
':hover': {
|
|
@@ -39,7 +39,14 @@ var verticallyAlignedStyles = (0, _react2.css)({
|
|
|
39
39
|
var dragHandleStyles = (0, _react2.css)({
|
|
40
40
|
position: 'relative',
|
|
41
41
|
display: 'flex',
|
|
42
|
-
alignItems: 'center'
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
overflow: 'hidden',
|
|
44
|
+
width: 0,
|
|
45
|
+
transition: 'width 0.5s'
|
|
46
|
+
});
|
|
47
|
+
var dragHandleSpacerStyles = (0, _react2.css)({
|
|
48
|
+
width: 24,
|
|
49
|
+
transition: 'width 0.5s'
|
|
43
50
|
});
|
|
44
51
|
var dropTargetStyles = (0, _react2.css)({
|
|
45
52
|
position: 'absolute',
|
|
@@ -50,20 +57,25 @@ var dropTargetStyles = (0, _react2.css)({
|
|
|
50
57
|
var noPointerEventsStyles = (0, _react2.css)({
|
|
51
58
|
pointerEvents: 'none'
|
|
52
59
|
});
|
|
60
|
+
var idleState = {
|
|
61
|
+
type: 'idle'
|
|
62
|
+
};
|
|
63
|
+
var draggingState = {
|
|
64
|
+
type: 'dragging'
|
|
65
|
+
};
|
|
53
66
|
var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
54
67
|
var children = _ref.children,
|
|
55
68
|
id = _ref.id,
|
|
56
69
|
index = _ref.index,
|
|
57
70
|
tableId = _ref.tableId,
|
|
58
71
|
dndPreviewHeight = _ref.dndPreviewHeight,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onDragPreviewEnd = _ref.onDragPreviewEnd;
|
|
72
|
+
dragPreview = _ref.dragPreview,
|
|
73
|
+
maxWidth = _ref.maxWidth;
|
|
62
74
|
var ref = (0, _react.useRef)(null);
|
|
63
|
-
var _useState = (0, _react.useState)(
|
|
75
|
+
var _useState = (0, _react.useState)(idleState),
|
|
64
76
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
state = _useState2[0],
|
|
78
|
+
setState = _useState2[1];
|
|
67
79
|
var _useState3 = (0, _react.useState)(false),
|
|
68
80
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
69
81
|
isDraggingAnyColumn = _useState4[0],
|
|
@@ -86,19 +98,38 @@ var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
86
98
|
tableId: tableId
|
|
87
99
|
};
|
|
88
100
|
},
|
|
89
|
-
onGenerateDragPreview: function onGenerateDragPreview() {
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref2) {
|
|
102
|
+
var nativeSetDragImage = _ref2.nativeSetDragImage;
|
|
103
|
+
(0, _setCustomNativeDragPreview.setCustomNativeDragPreview)({
|
|
104
|
+
getOffset: (0, _offsetFromPointer.offsetFromPointer)({
|
|
105
|
+
x: '18px',
|
|
106
|
+
y: '18px'
|
|
107
|
+
}),
|
|
108
|
+
render: function render(_ref3) {
|
|
109
|
+
var container = _ref3.container;
|
|
110
|
+
// Cause a `react` re-render to create your portal synchronously
|
|
111
|
+
setState({
|
|
112
|
+
type: 'preview',
|
|
113
|
+
container: container
|
|
114
|
+
});
|
|
115
|
+
// In our cleanup function: cause a `react` re-render to create remove your portal
|
|
116
|
+
// Note: you can also remove the portal in `onDragStart`,
|
|
117
|
+
// which is when the cleanup function is called
|
|
118
|
+
return function () {
|
|
119
|
+
return setState(draggingState);
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
nativeSetDragImage: nativeSetDragImage
|
|
123
|
+
});
|
|
92
124
|
},
|
|
93
125
|
onDragStart: function onDragStart() {
|
|
94
|
-
|
|
95
|
-
onDragPreviewEnd();
|
|
126
|
+
setState(draggingState);
|
|
96
127
|
},
|
|
97
128
|
onDrop: function onDrop() {
|
|
98
|
-
|
|
129
|
+
setState(idleState);
|
|
99
130
|
}
|
|
100
131
|
}));
|
|
101
|
-
}, [id, index,
|
|
132
|
+
}, [id, index, tableId]);
|
|
102
133
|
|
|
103
134
|
// Here we handle drop target, that in our case is absolutely positioned div that covers full width and height
|
|
104
135
|
// of this column (has height of whole table). It sits on top of everything, but has `pointerEvents: 'none'` by default
|
|
@@ -110,9 +141,9 @@ var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
110
141
|
getIsSticky: function getIsSticky() {
|
|
111
142
|
return true;
|
|
112
143
|
},
|
|
113
|
-
getData: function getData(
|
|
114
|
-
var input =
|
|
115
|
-
element =
|
|
144
|
+
getData: function getData(_ref4) {
|
|
145
|
+
var input = _ref4.input,
|
|
146
|
+
element = _ref4.element;
|
|
116
147
|
var data = {
|
|
117
148
|
id: id,
|
|
118
149
|
index: index
|
|
@@ -143,8 +174,8 @@ var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
143
174
|
// During dragging anywhere we want to remove `pointerEvents: 'none'` from all the drop targets
|
|
144
175
|
(0, _react.useEffect)(function () {
|
|
145
176
|
return (0, _element.monitorForElements)({
|
|
146
|
-
canMonitor: function canMonitor(
|
|
147
|
-
var source =
|
|
177
|
+
canMonitor: function canMonitor(_ref5) {
|
|
178
|
+
var source = _ref5.source;
|
|
148
179
|
return source.data.type === 'table-header' && source.data.tableId === tableId;
|
|
149
180
|
},
|
|
150
181
|
onDragStart: function onDragStart() {
|
|
@@ -160,7 +191,7 @@ var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
160
191
|
}, [tableId]);
|
|
161
192
|
return (0, _react2.jsx)(_styled.TableHeading, {
|
|
162
193
|
ref: ref,
|
|
163
|
-
css: [
|
|
194
|
+
css: [tableHeadingStatusStyles[state.type]],
|
|
164
195
|
"data-testid": "".concat(id, "-column-heading"),
|
|
165
196
|
style: {
|
|
166
197
|
maxWidth: maxWidth
|
|
@@ -177,10 +208,14 @@ var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
177
208
|
})), (0, _react2.jsx)("div", {
|
|
178
209
|
css: verticallyAlignedStyles
|
|
179
210
|
}, (0, _react2.jsx)("div", {
|
|
180
|
-
css: dragHandleStyles
|
|
211
|
+
css: dragHandleStyles,
|
|
212
|
+
className: "issue-like-table-drag-handle"
|
|
181
213
|
}, (0, _react2.jsx)(_dragHandler.default, {
|
|
182
214
|
label: "".concat(id, "-drag-icon"),
|
|
183
215
|
size: "medium"
|
|
184
|
-
})), children)
|
|
216
|
+
})), children, (0, _react2.jsx)("div", {
|
|
217
|
+
css: dragHandleSpacerStyles,
|
|
218
|
+
className: "issue-like-table-drag-handle-spacer"
|
|
219
|
+
})), state.type === 'preview' ? /*#__PURE__*/_reactDom.default.createPortal(dragPreview, state.container) : null);
|
|
185
220
|
};
|
|
186
221
|
exports.DraggableTableHeading = DraggableTableHeading;
|
|
@@ -13,6 +13,9 @@ var _priority = _interopRequireDefault(require("./priority"));
|
|
|
13
13
|
var _type = _interopRequireDefault(require("./type"));
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
|
|
16
|
+
var tableBodyStyles = (0, _react.css)({
|
|
17
|
+
borderBottom: 0
|
|
18
|
+
});
|
|
16
19
|
var baseColumns = [{
|
|
17
20
|
key: 'type',
|
|
18
21
|
width: 50
|
|
@@ -126,7 +129,9 @@ var _default = function _default(_ref3) {
|
|
|
126
129
|
height: 13,
|
|
127
130
|
borderRadius: 8
|
|
128
131
|
}));
|
|
129
|
-
}))), (0, _react.jsx)("tbody",
|
|
132
|
+
}))), (0, _react.jsx)("tbody", {
|
|
133
|
+
css: tableBodyStyles
|
|
134
|
+
}, rows.map(function (row) {
|
|
130
135
|
return (0, _react.jsx)("tr", {
|
|
131
136
|
key: row.id
|
|
132
137
|
}, columnsToRender.map(function (column) {
|
|
@@ -15,13 +15,16 @@ var _react = require("react");
|
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
16
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
17
17
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
18
|
+
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
18
19
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
19
20
|
var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
|
|
20
21
|
var _reorderWithEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge");
|
|
21
22
|
var _pragmaticDragAndDropReactBeautifulDndAutoscroll = require("@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll");
|
|
22
23
|
var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
|
|
23
24
|
var _combine = require("@atlaskit/pragmatic-drag-and-drop/util/combine");
|
|
25
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
24
26
|
var _columnPicker = require("./column-picker");
|
|
27
|
+
var _dragColumnPreview = require("./drag-column-preview");
|
|
25
28
|
var _draggableTableHeading = require("./draggable-table-heading");
|
|
26
29
|
var _emptyState = _interopRequireDefault(require("./empty-state"));
|
|
27
30
|
var _renderType = require("./render-type");
|
|
@@ -31,21 +34,35 @@ var _templateObject;
|
|
|
31
34
|
/** @jsx jsx */
|
|
32
35
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
var tableSidePadding = "var(--ds-space-200, 16px)";
|
|
34
38
|
var tableHeadStyles = (0, _react2.css)({
|
|
35
39
|
background: "var(--ds-surface, #FFF)",
|
|
36
|
-
|
|
40
|
+
position: 'sticky',
|
|
41
|
+
top: 0,
|
|
42
|
+
zIndex: 10
|
|
37
43
|
});
|
|
38
|
-
var ColumnPickerHeader = _styled.default.
|
|
44
|
+
var ColumnPickerHeader = _styled.default.th(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 40px;\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 bellow */\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 &:last-of-type {\n padding-right: ", ";\n }\n"])), tableSidePadding, "var(--ds-surface, #FFF)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"), "var(--ds-surface, #FFF)", tableSidePadding);
|
|
39
45
|
var truncatedCellStyles = (0, _react2.css)({
|
|
40
46
|
overflow: 'hidden',
|
|
41
47
|
textOverflow: 'ellipsis',
|
|
42
48
|
whiteSpace: 'nowrap'
|
|
43
49
|
});
|
|
44
|
-
var
|
|
45
|
-
|
|
50
|
+
var scrollableContainerStyles = (0, _react2.css)({
|
|
51
|
+
overflow: 'auto',
|
|
52
|
+
padding: "0 ".concat(tableSidePadding, " 0 ").concat(tableSidePadding),
|
|
53
|
+
boxSizing: 'border-box'
|
|
46
54
|
});
|
|
47
|
-
var
|
|
48
|
-
|
|
55
|
+
var tableStyles = (0, _react2.css)({
|
|
56
|
+
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
57
|
+
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
58
|
+
borderCollapse: 'separate',
|
|
59
|
+
borderSpacing: 0
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// By default tbody and thead have border-bottom: 2px ...
|
|
63
|
+
// This removes it, because for header we handle it via `th` styling and footer supply bottom border
|
|
64
|
+
var noDefaultBorderStyles = (0, _react2.css)({
|
|
65
|
+
borderBottom: 0
|
|
49
66
|
});
|
|
50
67
|
function extractIndex(data) {
|
|
51
68
|
var index = data.index;
|
|
@@ -73,7 +90,6 @@ var BASE_WIDTH = 8;
|
|
|
73
90
|
function getColumnWidth(key, type) {
|
|
74
91
|
var keyBasedWidth = {
|
|
75
92
|
assignee: BASE_WIDTH * 22,
|
|
76
|
-
key: BASE_WIDTH * 10,
|
|
77
93
|
labels: BASE_WIDTH * 22,
|
|
78
94
|
priority: BASE_WIDTH * 8,
|
|
79
95
|
status: BASE_WIDTH * 18,
|
|
@@ -103,7 +119,8 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
103
119
|
visibleColumnKeys = _ref2.visibleColumnKeys,
|
|
104
120
|
onVisibleColumnKeysChange = _ref2.onVisibleColumnKeysChange,
|
|
105
121
|
status = _ref2.status,
|
|
106
|
-
hasNextPage = _ref2.hasNextPage
|
|
122
|
+
hasNextPage = _ref2.hasNextPage,
|
|
123
|
+
scrollableContainerHeight = _ref2.scrollableContainerHeight;
|
|
107
124
|
var tableId = (0, _react.useMemo)(function () {
|
|
108
125
|
return Symbol('unique-id');
|
|
109
126
|
}, []);
|
|
@@ -113,20 +130,16 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
113
130
|
setLastRowElement = _useState2[1];
|
|
114
131
|
var _useState3 = (0, _react.useState)(false),
|
|
115
132
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var _useState5 = (0, _react.useState)(false),
|
|
119
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
120
|
-
hasFullSchema = _useState6[0],
|
|
121
|
-
setHasFullSchema = _useState6[1];
|
|
133
|
+
hasFullSchema = _useState4[0],
|
|
134
|
+
setHasFullSchema = _useState4[1];
|
|
122
135
|
var isBottomOfTableVisibleRaw = (0, _useIsOnScreen.useIsOnScreen)(lastRowElement);
|
|
123
136
|
var containerRef = (0, _react.useRef)(null);
|
|
124
|
-
var
|
|
137
|
+
var _useState5 = (0, _react.useState)(function () {
|
|
125
138
|
return orderColumns((0, _toConsumableArray2.default)(columns), (0, _toConsumableArray2.default)(visibleColumnKeys));
|
|
126
139
|
}),
|
|
127
|
-
|
|
128
|
-
orderedColumns =
|
|
129
|
-
setOrderedColumns =
|
|
140
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
141
|
+
orderedColumns = _useState6[0],
|
|
142
|
+
setOrderedColumns = _useState6[1];
|
|
130
143
|
(0, _react.useEffect)(function () {
|
|
131
144
|
setOrderedColumns(orderColumns((0, _toConsumableArray2.default)(columns), (0, _toConsumableArray2.default)(visibleColumnKeys)));
|
|
132
145
|
}, [columns, visibleColumnKeys]);
|
|
@@ -161,17 +174,19 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
161
174
|
})
|
|
162
175
|
};
|
|
163
176
|
}, [visibleSortedColumns]);
|
|
164
|
-
var headColumns =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
var headColumns = (0, _react.useMemo)(function () {
|
|
178
|
+
return visibleSortedColumns.map(function (_ref5) {
|
|
179
|
+
var key = _ref5.key,
|
|
180
|
+
title = _ref5.title,
|
|
181
|
+
type = _ref5.type;
|
|
182
|
+
return {
|
|
183
|
+
key: key,
|
|
184
|
+
content: title,
|
|
185
|
+
shouldTruncate: true,
|
|
186
|
+
maxWidth: getColumnWidth(key, type)
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
}, [visibleSortedColumns]);
|
|
175
190
|
(0, _react.useEffect)(function () {
|
|
176
191
|
if (isBottomOfTableVisibleRaw && hasNextPage && status === 'resolved') {
|
|
177
192
|
void onNextPage({
|
|
@@ -179,41 +194,43 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
179
194
|
});
|
|
180
195
|
}
|
|
181
196
|
}, [isBottomOfTableVisibleRaw, status, hasNextPage, onNextPage]);
|
|
182
|
-
var
|
|
183
|
-
if (items.length > 0 && containerRef.current) {
|
|
184
|
-
var containerEl = containerRef.current;
|
|
185
|
-
(0, _tinyInvariant.default)(containerEl);
|
|
186
|
-
dndPreviewHeight = containerEl.offsetHeight;
|
|
187
|
-
}
|
|
197
|
+
var hasData = items.length > 0;
|
|
188
198
|
|
|
189
199
|
// This variable contains initial Y mouse coordinate, so we can restrict
|
|
190
200
|
// autoScroller in X axis only
|
|
191
201
|
var initialAutoScrollerClientY = (0, _react.useRef)();
|
|
192
202
|
(0, _react.useEffect)(function () {
|
|
193
|
-
if (!onVisibleColumnKeysChange) {
|
|
203
|
+
if (!onVisibleColumnKeysChange || !hasData) {
|
|
194
204
|
return;
|
|
195
205
|
}
|
|
196
206
|
return (0, _combine.combine)((0, _element.monitorForElements)({
|
|
197
207
|
onDragStart: function onDragStart(_ref6) {
|
|
208
|
+
var _containerRef$current;
|
|
198
209
|
var location = _ref6.location;
|
|
199
210
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
200
211
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.start({
|
|
201
|
-
input: location.current.input,
|
|
212
|
+
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
213
|
+
clientY:
|
|
214
|
+
// The goal is to have clientY the same and in the middle of the scrollable area
|
|
215
|
+
// Since clientY is taken from to of the viewport we need to plus that in order to get
|
|
216
|
+
// middle of the scrollable area in reference to the viewport
|
|
217
|
+
(initialAutoScrollerClientY.current || 0) + (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetHeight) || 0) / 2
|
|
218
|
+
}),
|
|
202
219
|
behavior: 'container-only'
|
|
203
220
|
});
|
|
204
221
|
},
|
|
205
222
|
onDrag: function onDrag(_ref7) {
|
|
223
|
+
var _containerRef$current2;
|
|
206
224
|
var location = _ref7.location;
|
|
207
225
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.updateInput({
|
|
208
226
|
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
209
|
-
clientY: initialAutoScrollerClientY.current || 0
|
|
227
|
+
clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
|
|
210
228
|
})
|
|
211
229
|
});
|
|
212
230
|
},
|
|
213
231
|
onDrop: function onDrop(_ref8) {
|
|
214
232
|
var source = _ref8.source,
|
|
215
233
|
location = _ref8.location;
|
|
216
|
-
initialAutoScrollerClientY.current = null;
|
|
217
234
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.stop();
|
|
218
235
|
if (location.current.dropTargets.length === 0) {
|
|
219
236
|
return;
|
|
@@ -243,7 +260,7 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
243
260
|
}
|
|
244
261
|
}
|
|
245
262
|
}));
|
|
246
|
-
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId]);
|
|
263
|
+
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
|
|
247
264
|
var tableRows = (0, _react.useMemo)(function () {
|
|
248
265
|
return items.map(function (newRowData, rowIndex) {
|
|
249
266
|
return {
|
|
@@ -272,13 +289,9 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
272
289
|
};
|
|
273
290
|
});
|
|
274
291
|
}, [identityColumnKey, renderItem, items, visibleSortedColumns]);
|
|
275
|
-
var rows =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}, [setIsDragPreview]);
|
|
279
|
-
var setIsDragPreviewOff = (0, _react.useCallback)(function () {
|
|
280
|
-
return setIsDragPreview(false);
|
|
281
|
-
}, [setIsDragPreview]);
|
|
292
|
+
var rows = (0, _react.useMemo)(function () {
|
|
293
|
+
return [].concat((0, _toConsumableArray2.default)(tableRows), (0, _toConsumableArray2.default)(status === 'loading' ? [loadingRow] : []));
|
|
294
|
+
}, [loadingRow, status, tableRows]);
|
|
282
295
|
var onSelectedColumnKeysChange = (0, _react.useCallback)(function (newSelectedColumnKeys) {
|
|
283
296
|
onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 ? void 0 : onVisibleColumnKeysChange(newSelectedColumnKeys);
|
|
284
297
|
}, [onVisibleColumnKeysChange]);
|
|
@@ -311,33 +324,49 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
311
324
|
})), [hasFullSchema, onLoadDatasourceDetails]);
|
|
312
325
|
return (0, _react2.jsx)("div", {
|
|
313
326
|
ref: containerRef,
|
|
314
|
-
css:
|
|
327
|
+
css: scrollableContainerHeight ? scrollableContainerStyles : null,
|
|
328
|
+
style: scrollableContainerHeight ? {
|
|
329
|
+
maxHeight: "".concat(scrollableContainerHeight, "px")
|
|
330
|
+
} : undefined
|
|
315
331
|
}, (0, _react2.jsx)(_styled2.Table, {
|
|
316
|
-
css:
|
|
332
|
+
css: tableStyles,
|
|
317
333
|
"data-testid": testId
|
|
318
334
|
}, (0, _react2.jsx)("thead", {
|
|
319
335
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
320
|
-
css: tableHeadStyles
|
|
336
|
+
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
321
337
|
}, (0, _react2.jsx)("tr", null, headColumns.map(function (_ref11, cellIndex) {
|
|
322
338
|
var key = _ref11.key,
|
|
323
339
|
content = _ref11.content,
|
|
324
340
|
maxWidth = _ref11.maxWidth;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
341
|
+
if (onVisibleColumnKeysChange && hasData) {
|
|
342
|
+
var _containerRef$current3;
|
|
343
|
+
var previewRows = tableRows.map(function (_ref12) {
|
|
344
|
+
var cells = _ref12.cells;
|
|
345
|
+
var cell = cells.find(function (_ref13) {
|
|
346
|
+
var cellKey = _ref13.key;
|
|
347
|
+
return cellKey === key;
|
|
348
|
+
});
|
|
349
|
+
if (cell) {
|
|
350
|
+
return cell.content;
|
|
351
|
+
}
|
|
352
|
+
}).slice(0, 5);
|
|
353
|
+
var dragPreview = (0, _react2.jsx)(_dragColumnPreview.DragColumnPreview, {
|
|
354
|
+
title: (0, _react2.jsx)(_heading.default, {
|
|
355
|
+
level: "h400"
|
|
356
|
+
}, content),
|
|
357
|
+
rows: previewRows
|
|
358
|
+
});
|
|
331
359
|
return (0, _react2.jsx)(_draggableTableHeading.DraggableTableHeading, {
|
|
332
360
|
tableId: tableId,
|
|
333
361
|
key: key,
|
|
334
362
|
id: key,
|
|
335
363
|
index: cellIndex,
|
|
336
364
|
maxWidth: maxWidth,
|
|
337
|
-
dndPreviewHeight:
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
365
|
+
dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
|
|
366
|
+
dragPreview: dragPreview
|
|
367
|
+
}, (0, _react2.jsx)(_heading.default, {
|
|
368
|
+
level: "h400"
|
|
369
|
+
}, content));
|
|
341
370
|
} else {
|
|
342
371
|
return (0, _react2.jsx)(_styled2.TableHeading, {
|
|
343
372
|
key: key,
|
|
@@ -345,28 +374,30 @@ var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
345
374
|
style: {
|
|
346
375
|
maxWidth: maxWidth
|
|
347
376
|
}
|
|
348
|
-
}, (0, _react2.jsx)(
|
|
377
|
+
}, (0, _react2.jsx)(_heading.default, {
|
|
378
|
+
level: "h400"
|
|
379
|
+
}, content));
|
|
349
380
|
}
|
|
350
|
-
}), onVisibleColumnKeysChange && (0, _react2.jsx)(ColumnPickerHeader, null, (0, _react2.jsx)(_columnPicker.ColumnPicker, {
|
|
381
|
+
}), onVisibleColumnKeysChange && hasData && (0, _react2.jsx)(ColumnPickerHeader, null, (0, _react2.jsx)(_columnPicker.ColumnPicker, {
|
|
351
382
|
columns: hasFullSchema ? orderedColumns : [],
|
|
352
383
|
selectedColumnKeys: hasFullSchema ? visibleColumnKeys : [],
|
|
353
|
-
isDatasourceLoading: status === 'loading',
|
|
354
384
|
onSelectedColumnKeysChange: onSelectedColumnKeysChange,
|
|
355
385
|
onOpen: handlePickerOpen
|
|
356
386
|
})))), (0, _react2.jsx)("tbody", {
|
|
387
|
+
css: noDefaultBorderStyles,
|
|
357
388
|
"data-testid": testId && "".concat(testId, "--body")
|
|
358
|
-
}, rows.map(function (
|
|
359
|
-
var key =
|
|
360
|
-
cells =
|
|
361
|
-
ref =
|
|
389
|
+
}, rows.map(function (_ref14) {
|
|
390
|
+
var key = _ref14.key,
|
|
391
|
+
cells = _ref14.cells,
|
|
392
|
+
ref = _ref14.ref;
|
|
362
393
|
return (0, _react2.jsx)("tr", {
|
|
363
394
|
key: key,
|
|
364
395
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
365
396
|
ref: ref
|
|
366
|
-
}, cells.map(function (
|
|
367
|
-
var cellKey =
|
|
368
|
-
content =
|
|
369
|
-
maxWidth =
|
|
397
|
+
}, cells.map(function (_ref15, cellIndex) {
|
|
398
|
+
var cellKey = _ref15.key,
|
|
399
|
+
content = _ref15.content,
|
|
400
|
+
maxWidth = _ref15.maxWidth;
|
|
370
401
|
return (0, _react2.jsx)("td", {
|
|
371
402
|
key: cellKey,
|
|
372
403
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TableHeading = exports.Table = exports.EmptyStateTableHeading = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
10
11
|
var _templateObject, _templateObject2, _templateObject3;
|
|
11
12
|
var Table = _styled.default.table(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n"])));
|
|
12
13
|
exports.Table = Table;
|
|
13
|
-
var TableHeading = _styled.default.th(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)");
|
|
14
|
+
var TableHeading = _styled.default.th(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n cursor: grab;\n position: relative;\n padding-block: ", ";\n line-height: ", ";\n border-bottom: 2px solid ", ";\n .ProseMirror & h5,\n & h5 {\n margin-top: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 24px; /* Is needed to keep overall height consistent with or without drag handle icon present */\n }\n\n &:hover .issue-like-table-drag-handle {\n width: 24px;\n }\n &:hover .issue-like-table-drag-handle-spacer {\n width: 0px;\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-font-lineHeight-300, 24px)", "var(--ds-background-accent-gray-subtler, ".concat(_colors.N40, ")"));
|
|
14
15
|
exports.TableHeading = TableHeading;
|
|
15
16
|
var EmptyStateTableHeading = (0, _styled.default)(TableHeading)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n &:first-child {\n padding-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)");
|
|
16
17
|
exports.EmptyStateTableHeading = EmptyStateTableHeading;
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntlNext = require("react-intl-next");
|
|
13
|
+
var _analytics = require("../../../analytics");
|
|
13
14
|
var _basicSearchInput = require("../basic-search-input");
|
|
14
15
|
var _jqlEditor = require("../jql-editor");
|
|
15
16
|
var _modeSwitcher = require("../mode-switcher");
|
|
@@ -57,6 +58,8 @@ var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
57
58
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
58
59
|
orderDirection = _useState10[0],
|
|
59
60
|
setOrderDirection = _useState10[1];
|
|
61
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
62
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
60
63
|
var onSearchModeChange = function onSearchModeChange(searchMode) {
|
|
61
64
|
setCurrentSearchMode(searchMode);
|
|
62
65
|
};
|
|
@@ -90,6 +93,11 @@ var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
90
93
|
onSearch({
|
|
91
94
|
jql: jql
|
|
92
95
|
});
|
|
96
|
+
if (currentSearchMode === basicModeValue) {
|
|
97
|
+
fireEvent('ui.form.submitted.basicSearch', {});
|
|
98
|
+
} else if (currentSearchMode === jqlModeValue) {
|
|
99
|
+
fireEvent('ui.jqlEditor.searched', {});
|
|
100
|
+
}
|
|
93
101
|
};
|
|
94
102
|
return (0, _react2.jsx)("div", {
|
|
95
103
|
css: inputContainerStyles
|