@atlaskit/link-datasource 1.11.0 → 1.12.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 +20 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/services/mocks.js +134 -0
- package/dist/cjs/services/useBasicFilterAGG.js +119 -0
- package/dist/cjs/services/utils.js +8 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +2 -2
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +109 -5
- package/dist/cjs/ui/issue-like-table/index.js +109 -95
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/fieldValuesEmptyResponse.js +20 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/fieldValuesExpectedResponseForAssignees.js +155 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForProjects.js +82 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForStatuses.js +87 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForTypes.js +97 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlEmptyResponse.js +18 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlStandardResponse.js +111 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/types.js +15 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +0 -1
- package/dist/cjs/ui/jira-issues-modal/basic-filters/utils/transformers.js +97 -0
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/buildJQL.js +23 -3
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +16 -5
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/services/mocks.js +128 -0
- package/dist/es2019/services/useBasicFilterAGG.js +72 -0
- package/dist/es2019/services/utils.js +113 -0
- package/dist/es2019/ui/assets-modal/modal/index.js +2 -2
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +113 -5
- package/dist/es2019/ui/issue-like-table/index.js +82 -72
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/fieldValuesEmptyResponse.js +14 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/fieldValuesExpectedResponseForAssignees.js +149 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForProjects.js +76 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForStatuses.js +81 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForTypes.js +91 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlEmptyResponse.js +12 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlStandardResponse.js +105 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/types.js +9 -0
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +0 -1
- package/dist/es2019/ui/jira-issues-modal/basic-filters/utils/transformers.js +91 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/buildJQL.js +17 -4
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +15 -4
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/services/mocks.js +128 -0
- package/dist/esm/services/useBasicFilterAGG.js +112 -0
- package/dist/esm/services/utils.js +2 -0
- package/dist/esm/ui/assets-modal/modal/index.js +2 -2
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +5 -1
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +109 -5
- package/dist/esm/ui/issue-like-table/index.js +108 -94
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/fieldValuesEmptyResponse.js +14 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/fieldValuesExpectedResponseForAssignees.js +149 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForProjects.js +76 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForStatuses.js +81 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForTypes.js +91 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlEmptyResponse.js +12 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlStandardResponse.js +105 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/types.js +9 -0
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.js +0 -1
- package/dist/esm/ui/jira-issues-modal/basic-filters/utils/transformers.js +89 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/buildJQL.js +23 -4
- package/dist/esm/ui/jira-issues-modal/modal/index.js +17 -6
- package/dist/types/services/mocks.d.ts +3 -0
- package/dist/types/services/useBasicFilterAGG.d.ts +5 -0
- package/dist/types/services/utils.d.ts +2 -0
- package/dist/types/ui/datasource-table-view/types.d.ts +4 -0
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +3 -2
- package/dist/types/ui/issue-like-table/index.d.ts +5 -3
- package/dist/types/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +1 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/fieldValuesEmptyResponse.d.ts +3 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/fieldValuesExpectedResponseForAssignees.d.ts +17 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForProjects.d.ts +8 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForStatuses.d.ts +8 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForTypes.d.ts +8 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlEmptyResponse.d.ts +3 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlStandardResponse.d.ts +29 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/types.d.ts +93 -0
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +1 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +1 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +1 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +1 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +8 -0
- package/dist/types/ui/jira-issues-modal/jira-search-container/buildJQL.d.ts +4 -0
- package/dist/types/ui/jira-issues-modal/types.d.ts +4 -0
- package/dist/types-ts4.5/services/mocks.d.ts +3 -0
- package/dist/types-ts4.5/services/useBasicFilterAGG.d.ts +5 -0
- package/dist/types-ts4.5/services/utils.d.ts +2 -0
- package/dist/types-ts4.5/ui/datasource-table-view/types.d.ts +4 -0
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +3 -2
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +5 -3
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/hooks/useFieldValues.d.ts +1 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/fieldValuesEmptyResponse.d.ts +3 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/fieldValuesExpectedResponseForAssignees.d.ts +17 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForProjects.d.ts +8 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForStatuses.d.ts +8 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/fieldValuesStandardResponseForTypes.d.ts +8 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlEmptyResponse.d.ts +3 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/mocks/hydrateJqlStandardResponse.d.ts +29 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/types.d.ts +93 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/control.d.ts +1 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/formatOptionLabel.d.ts +1 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/trigger.d.ts +1 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/utils/transformers.d.ts +8 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/buildJQL.d.ts +4 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/types.d.ts +4 -0
- package/examples-helpers/buildIssueLikeTable.tsx +15 -1
- package/examples-helpers/buildJiraIssuesTable.tsx +15 -1
- package/package.json +5 -5
- package/report.api.md +11 -0
- package/tmp/api-report-tmp.d.ts +11 -0
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +0 -5
- package/dist/es2019/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +0 -1
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.js +0 -1
- package/dist/types/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +0 -23
- package/dist/types-ts4.5/ui/jira-issues-modal/basic-filters/ui/async-popup-select/types.d.ts +0 -23
|
@@ -235,7 +235,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
235
235
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
236
236
|
while (1) switch (_context.prev = _context.next) {
|
|
237
237
|
case 0:
|
|
238
|
-
if (schemaId !== searchSchemaId || aql !== searchAql) {
|
|
238
|
+
if (schemaId !== searchSchemaId || aql !== searchAql || status === 'rejected') {
|
|
239
239
|
searchCount.current++;
|
|
240
240
|
if (schemaId !== searchSchemaId) {
|
|
241
241
|
userInteractionActions.current.add(DatasourceAction.SCHEMA_UPDATED);
|
|
@@ -259,7 +259,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
259
259
|
return function (_x, _x2) {
|
|
260
260
|
return _ref.apply(this, arguments);
|
|
261
261
|
};
|
|
262
|
-
}(), [aql, reset, schemaId]);
|
|
262
|
+
}(), [aql, reset, schemaId, status]);
|
|
263
263
|
var renderModalTitleContent = useCallback(function () {
|
|
264
264
|
if (workspaceError) {
|
|
265
265
|
return undefined;
|
|
@@ -21,7 +21,9 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
21
21
|
parameters = _ref.parameters,
|
|
22
22
|
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
23
23
|
onVisibleColumnKeysChange = _ref.onVisibleColumnKeysChange,
|
|
24
|
-
url = _ref.url
|
|
24
|
+
url = _ref.url,
|
|
25
|
+
columnCustomSizes = _ref.columnCustomSizes,
|
|
26
|
+
onColumnResize = _ref.onColumnResize;
|
|
25
27
|
var _useDatasourceTableSt = useDatasourceTableState({
|
|
26
28
|
datasourceId: datasourceId,
|
|
27
29
|
parameters: parameters,
|
|
@@ -129,6 +131,8 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
129
131
|
columns: columns,
|
|
130
132
|
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
131
133
|
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
134
|
+
columnCustomSizes: columnCustomSizes,
|
|
135
|
+
onColumnResize: onColumnResize,
|
|
132
136
|
scrollableContainerHeight: ScrollableContainerHeight,
|
|
133
137
|
parentContainerRenderInstanceId: tableRenderInstanceId,
|
|
134
138
|
extensionKey: extensionKey
|
|
@@ -7,10 +7,13 @@ import invariant from 'tiny-invariant';
|
|
|
7
7
|
import { attachClosestEdge, extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
|
|
8
8
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-indicator/box-without-terminal';
|
|
9
9
|
import { draggable, dropTargetForElements, monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
10
|
+
import { cancelUnhandled } from '@atlaskit/pragmatic-drag-and-drop/addon/cancel-unhandled';
|
|
10
11
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
12
|
+
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/disable-native-drag-preview';
|
|
11
13
|
import { offsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/offset-from-pointer';
|
|
12
14
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
13
15
|
import { TableHeading } from './styled';
|
|
16
|
+
import { COLUMN_MIN_WIDTH } from './index';
|
|
14
17
|
var tableHeadingStatusStyles = {
|
|
15
18
|
idle: css({
|
|
16
19
|
':hover': {
|
|
@@ -36,6 +39,40 @@ var dropTargetStyles = css({
|
|
|
36
39
|
var noPointerEventsStyles = css({
|
|
37
40
|
pointerEvents: 'none'
|
|
38
41
|
});
|
|
42
|
+
var resizerStyles = css({
|
|
43
|
+
'--local-hitbox-width': "var(--ds-space-300, 24px)",
|
|
44
|
+
width: 'var(--local-hitbox-width)',
|
|
45
|
+
cursor: 'col-resize',
|
|
46
|
+
flexGrow: '0',
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
zIndex: 1,
|
|
49
|
+
// we want this to sit on top of adjacent column headers
|
|
50
|
+
right: 'calc(-1 * calc(var(--local-hitbox-width) / 2))',
|
|
51
|
+
top: 0,
|
|
52
|
+
'::before': {
|
|
53
|
+
opacity: 0,
|
|
54
|
+
'--local-line-width': "var(--ds-border-width, 2px)",
|
|
55
|
+
content: '""',
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
background: "var(--ds-border-brand, #0052CC)",
|
|
58
|
+
width: 'var(--local-line-width)',
|
|
59
|
+
inset: 0,
|
|
60
|
+
left: "calc(50% - calc(var(--local-line-width) / 2))",
|
|
61
|
+
transition: 'opacity 0.2s ease'
|
|
62
|
+
},
|
|
63
|
+
':hover::before': {
|
|
64
|
+
opacity: 1
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
var resizingStyles = css({
|
|
68
|
+
// turning off the resizing cursor as sometimes it can cause the cursor to flicker
|
|
69
|
+
// while resizing. The browser controls the cursor while dragging, but the browser
|
|
70
|
+
// can sometimes bug out.
|
|
71
|
+
cursor: 'unset',
|
|
72
|
+
'::before': {
|
|
73
|
+
opacity: 1
|
|
74
|
+
}
|
|
75
|
+
});
|
|
39
76
|
var idleState = {
|
|
40
77
|
type: 'idle'
|
|
41
78
|
};
|
|
@@ -49,8 +86,10 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
49
86
|
tableId = _ref.tableId,
|
|
50
87
|
dndPreviewHeight = _ref.dndPreviewHeight,
|
|
51
88
|
dragPreview = _ref.dragPreview,
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
width = _ref.width,
|
|
90
|
+
onWidthChange = _ref.onWidthChange;
|
|
91
|
+
var mainHeaderCellRef = useRef(null);
|
|
92
|
+
var columnResizeHandleRef = useRef(null);
|
|
54
93
|
var _useState = useState(idleState),
|
|
55
94
|
_useState2 = _slicedToArray(_useState, 2),
|
|
56
95
|
state = _useState2[0],
|
|
@@ -65,7 +104,7 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
65
104
|
setClosestEdge = _useState6[1];
|
|
66
105
|
var dropTargetRef = useRef(null);
|
|
67
106
|
useEffect(function () {
|
|
68
|
-
var cell =
|
|
107
|
+
var cell = mainHeaderCellRef.current;
|
|
69
108
|
invariant(cell);
|
|
70
109
|
return combine(draggable({
|
|
71
110
|
element: cell,
|
|
@@ -168,15 +207,80 @@ export var DraggableTableHeading = function DraggableTableHeading(_ref) {
|
|
|
168
207
|
}
|
|
169
208
|
});
|
|
170
209
|
}, [tableId]);
|
|
210
|
+
|
|
211
|
+
// Handling column resizing
|
|
212
|
+
useEffect(function () {
|
|
213
|
+
var resizeHandle = columnResizeHandleRef.current;
|
|
214
|
+
invariant(resizeHandle);
|
|
215
|
+
var mainHeaderCell = mainHeaderCellRef.current;
|
|
216
|
+
invariant(mainHeaderCell);
|
|
217
|
+
return draggable({
|
|
218
|
+
element: resizeHandle,
|
|
219
|
+
getInitialData: function getInitialData() {
|
|
220
|
+
// metadata related to currently dragging item (can be read by drop events etc)
|
|
221
|
+
return {
|
|
222
|
+
type: 'column-resize',
|
|
223
|
+
id: id,
|
|
224
|
+
index: index,
|
|
225
|
+
tableId: tableId
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
// Is called when dragging started
|
|
229
|
+
onGenerateDragPreview: function onGenerateDragPreview(_ref6) {
|
|
230
|
+
var nativeSetDragImage = _ref6.nativeSetDragImage;
|
|
231
|
+
// We don't show any preview, since column separator (handle) is moving with the cursor
|
|
232
|
+
disableNativeDragPreview({
|
|
233
|
+
nativeSetDragImage: nativeSetDragImage
|
|
234
|
+
});
|
|
235
|
+
// Block drag operations outside `@atlaskit/pragmatic-drag-and-drop`
|
|
236
|
+
cancelUnhandled.start();
|
|
237
|
+
setState({
|
|
238
|
+
type: 'resizing',
|
|
239
|
+
initialWidth: width
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
onDrag: function onDrag(_ref7) {
|
|
243
|
+
var location = _ref7.location;
|
|
244
|
+
var relativeDistanceX = location.current.input.clientX - location.initial.input.clientX;
|
|
245
|
+
invariant(state.type === 'resizing');
|
|
246
|
+
var initialWidth = state.initialWidth;
|
|
247
|
+
|
|
248
|
+
// Set the width of our header being resized
|
|
249
|
+
var proposedWidth = initialWidth + relativeDistanceX;
|
|
250
|
+
if (initialWidth >= COLUMN_MIN_WIDTH && proposedWidth < COLUMN_MIN_WIDTH) {
|
|
251
|
+
proposedWidth = COLUMN_MIN_WIDTH;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// We update width css directly live
|
|
255
|
+
mainHeaderCell.style.setProperty('width', "".concat(proposedWidth, "px"));
|
|
256
|
+
},
|
|
257
|
+
onDrop: function onDrop() {
|
|
258
|
+
cancelUnhandled.stop();
|
|
259
|
+
setState(idleState);
|
|
260
|
+
if (onWidthChange) {
|
|
261
|
+
// We use element's css value as a source of truth (compare to another Ref)
|
|
262
|
+
var currentWidthPx = mainHeaderCell.style.getPropertyValue('width');
|
|
263
|
+
onWidthChange(+currentWidthPx.slice(0, -2));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}, [id, index, onWidthChange, state, tableId, width]);
|
|
171
268
|
return jsx(TableHeading, {
|
|
172
|
-
ref:
|
|
269
|
+
ref: mainHeaderCellRef,
|
|
173
270
|
css: [tableHeadingStatusStyles[state.type]],
|
|
174
271
|
"data-testid": "".concat(id, "-column-heading"),
|
|
175
272
|
style: {
|
|
176
|
-
|
|
273
|
+
width: width,
|
|
177
274
|
cursor: 'grab'
|
|
178
275
|
}
|
|
179
276
|
}, jsx("div", {
|
|
277
|
+
ref: columnResizeHandleRef,
|
|
278
|
+
css: [resizerStyles, state.type === 'resizing' && resizingStyles],
|
|
279
|
+
style: {
|
|
280
|
+
height: "".concat(dndPreviewHeight, "px")
|
|
281
|
+
},
|
|
282
|
+
"data-testid": "column-resize-handle"
|
|
283
|
+
}), jsx("div", {
|
|
180
284
|
ref: dropTargetRef,
|
|
181
285
|
css: [dropTargetStyles, isDraggingAnyColumn ? null : noPointerEventsStyles],
|
|
182
286
|
style: {
|
|
@@ -37,7 +37,7 @@ var tableHeadStyles = css({
|
|
|
37
37
|
top: 0,
|
|
38
38
|
zIndex: stickyTableHeadersIndex
|
|
39
39
|
});
|
|
40
|
-
var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width:
|
|
40
|
+
var ColumnPickerHeader = styled.th(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 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 text-align: right; /* In case when TH itself is bigger we want to keep picker at the right side */\n"])), tableSidePadding, "var(--ds-surface, #FFF)", "var(--ds-background-accent-gray-subtler, ".concat(N40, ")"), "var(--ds-surface, #FFF)", tableSidePadding);
|
|
41
41
|
var truncatedCellStyles = css({
|
|
42
42
|
overflow: 'hidden',
|
|
43
43
|
textOverflow: 'ellipsis',
|
|
@@ -50,6 +50,7 @@ var scrollableContainerStyles = css({
|
|
|
50
50
|
borderRadius: "var(--ds-border-radius-100, 3px)"
|
|
51
51
|
});
|
|
52
52
|
var tableStyles = css({
|
|
53
|
+
tableLayout: 'fixed',
|
|
53
54
|
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
54
55
|
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
55
56
|
borderCollapse: 'separate',
|
|
@@ -66,7 +67,7 @@ function extractIndex(data) {
|
|
|
66
67
|
invariant(typeof index === 'number');
|
|
67
68
|
return index;
|
|
68
69
|
}
|
|
69
|
-
export var
|
|
70
|
+
export var getOrderedColumns = function getOrderedColumns(columns, visibleColumnKeys) {
|
|
70
71
|
var visibleColumns = columns.filter(function (column) {
|
|
71
72
|
return visibleColumnKeys.includes(column.key);
|
|
72
73
|
}).sort(function (a, b) {
|
|
@@ -80,25 +81,28 @@ export var orderColumns = function orderColumns(columns, visibleColumnKeys) {
|
|
|
80
81
|
return [].concat(_toConsumableArray(visibleColumns), _toConsumableArray(invisibleColumns));
|
|
81
82
|
};
|
|
82
83
|
var BASE_WIDTH = 8;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
var DEFAULT_WIDTH = BASE_WIDTH * 22;
|
|
85
|
+
export var COLUMN_MIN_WIDTH = BASE_WIDTH * 3;
|
|
86
|
+
var keyBasedWidthMap = {
|
|
87
|
+
priority: BASE_WIDTH * 4,
|
|
88
|
+
status: BASE_WIDTH * 18,
|
|
89
|
+
summary: BASE_WIDTH * 45,
|
|
90
|
+
description: BASE_WIDTH * 31.25,
|
|
91
|
+
type: BASE_WIDTH * 4,
|
|
92
|
+
key: BASE_WIDTH * 13
|
|
93
|
+
};
|
|
94
|
+
function getDefaultColumnWidth(key, type) {
|
|
95
|
+
var keyBasedWidth = keyBasedWidthMap[key];
|
|
96
|
+
if (keyBasedWidth) {
|
|
97
|
+
return keyBasedWidth;
|
|
94
98
|
}
|
|
95
99
|
switch (type) {
|
|
96
100
|
case 'date':
|
|
97
101
|
return BASE_WIDTH * 14;
|
|
98
|
-
case '
|
|
99
|
-
return BASE_WIDTH *
|
|
102
|
+
case 'icon':
|
|
103
|
+
return BASE_WIDTH * 4;
|
|
100
104
|
default:
|
|
101
|
-
return
|
|
105
|
+
return DEFAULT_WIDTH;
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
@@ -111,6 +115,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
111
115
|
renderItem = _ref$renderItem === void 0 ? fallbackRenderType : _ref$renderItem,
|
|
112
116
|
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
113
117
|
onVisibleColumnKeysChange = _ref.onVisibleColumnKeysChange,
|
|
118
|
+
columnCustomSizes = _ref.columnCustomSizes,
|
|
119
|
+
onColumnResize = _ref.onColumnResize,
|
|
114
120
|
status = _ref.status,
|
|
115
121
|
hasNextPage = _ref.hasNextPage,
|
|
116
122
|
scrollableContainerHeight = _ref.scrollableContainerHeight,
|
|
@@ -119,6 +125,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
119
125
|
var tableId = useMemo(function () {
|
|
120
126
|
return Symbol('unique-id');
|
|
121
127
|
}, []);
|
|
128
|
+
var tableHeaderRowRef = useRef(null);
|
|
122
129
|
var _useState = useState(null),
|
|
123
130
|
_useState2 = _slicedToArray(_useState, 2),
|
|
124
131
|
lastRowElement = _useState2[0],
|
|
@@ -130,14 +137,14 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
130
137
|
var isBottomOfTableVisibleRaw = useIsOnScreen(lastRowElement);
|
|
131
138
|
var containerRef = useRef(null);
|
|
132
139
|
var _useState5 = useState(function () {
|
|
133
|
-
return
|
|
140
|
+
return getOrderedColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys));
|
|
134
141
|
}),
|
|
135
142
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
136
143
|
orderedColumns = _useState6[0],
|
|
137
144
|
setOrderedColumns = _useState6[1];
|
|
138
145
|
useEffect(function () {
|
|
139
146
|
if (!hasFullSchema) {
|
|
140
|
-
setOrderedColumns(
|
|
147
|
+
setOrderedColumns(getOrderedColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys)));
|
|
141
148
|
}
|
|
142
149
|
}, [columns, visibleColumnKeys, hasFullSchema]);
|
|
143
150
|
useEffect(function () {
|
|
@@ -161,37 +168,37 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
161
168
|
// or some other combination.
|
|
162
169
|
|
|
163
170
|
var identityColumnKey = 'id';
|
|
164
|
-
var
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
height: 14,
|
|
173
|
-
testId: "issues-table-row-loading"
|
|
174
|
-
});
|
|
175
|
-
return {
|
|
176
|
-
key: key,
|
|
177
|
-
content: content
|
|
178
|
-
};
|
|
179
|
-
})
|
|
180
|
-
};
|
|
181
|
-
}, [visibleSortedColumns]);
|
|
182
|
-
var headColumns = useMemo(function () {
|
|
183
|
-
return visibleSortedColumns.map(function (_ref4) {
|
|
184
|
-
var key = _ref4.key,
|
|
185
|
-
title = _ref4.title,
|
|
186
|
-
type = _ref4.type;
|
|
171
|
+
var getColumnWidth = useCallback(function (key, type) {
|
|
172
|
+
return (columnCustomSizes === null || columnCustomSizes === void 0 ? void 0 : columnCustomSizes[key]) || getDefaultColumnWidth(key, type);
|
|
173
|
+
}, [columnCustomSizes]);
|
|
174
|
+
var headerColumns = useMemo(function () {
|
|
175
|
+
return visibleSortedColumns.map(function (_ref3) {
|
|
176
|
+
var key = _ref3.key,
|
|
177
|
+
title = _ref3.title,
|
|
178
|
+
type = _ref3.type;
|
|
187
179
|
return {
|
|
188
180
|
key: key,
|
|
189
181
|
content: title,
|
|
190
182
|
shouldTruncate: true,
|
|
191
|
-
|
|
183
|
+
width: getColumnWidth(key, type)
|
|
192
184
|
};
|
|
193
185
|
});
|
|
194
|
-
}, [visibleSortedColumns]);
|
|
186
|
+
}, [getColumnWidth, visibleSortedColumns]);
|
|
187
|
+
var loadingRow = useMemo(function () {
|
|
188
|
+
return {
|
|
189
|
+
key: 'loading',
|
|
190
|
+
cells: headerColumns.map(function (column) {
|
|
191
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
192
|
+
content: jsx(Skeleton, {
|
|
193
|
+
borderRadius: 8,
|
|
194
|
+
width: "100%",
|
|
195
|
+
height: 14,
|
|
196
|
+
testId: "issues-table-row-loading"
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
})
|
|
200
|
+
};
|
|
201
|
+
}, [headerColumns]);
|
|
195
202
|
useEffect(function () {
|
|
196
203
|
if (isBottomOfTableVisibleRaw && hasNextPage && status === 'resolved') {
|
|
197
204
|
void onNextPage({
|
|
@@ -210,33 +217,39 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
210
217
|
return;
|
|
211
218
|
}
|
|
212
219
|
return combine(monitorForElements({
|
|
213
|
-
onDragStart: function onDragStart(
|
|
214
|
-
var
|
|
215
|
-
|
|
220
|
+
onDragStart: function onDragStart(_ref4) {
|
|
221
|
+
var location = _ref4.location,
|
|
222
|
+
source = _ref4.source;
|
|
216
223
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
if (source.data.type === 'table-header') {
|
|
225
|
+
var _containerRef$current;
|
|
226
|
+
autoScroller.start({
|
|
227
|
+
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
228
|
+
clientY:
|
|
229
|
+
// The goal is to have clientY the same and in the middle of the scrollable area
|
|
230
|
+
// Since clientY is taken from to of the viewport we need to plus that in order to get
|
|
231
|
+
// middle of the scrollable area in reference to the viewport
|
|
232
|
+
(initialAutoScrollerClientY.current || 0) + (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetHeight) || 0) / 2
|
|
233
|
+
}),
|
|
234
|
+
behavior: 'container-only'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
227
237
|
},
|
|
228
|
-
onDrag: function onDrag(
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
onDrag: function onDrag(_ref5) {
|
|
239
|
+
var location = _ref5.location,
|
|
240
|
+
source = _ref5.source;
|
|
241
|
+
if (source.data.type === 'table-header') {
|
|
242
|
+
var _containerRef$current2;
|
|
243
|
+
autoScroller.updateInput({
|
|
244
|
+
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
245
|
+
clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
}
|
|
236
249
|
},
|
|
237
|
-
onDrop: function onDrop(
|
|
238
|
-
var source =
|
|
239
|
-
location =
|
|
250
|
+
onDrop: function onDrop(_ref6) {
|
|
251
|
+
var source = _ref6.source,
|
|
252
|
+
location = _ref6.location;
|
|
240
253
|
autoScroller.stop();
|
|
241
254
|
if (location.current.dropTargets.length === 0) {
|
|
242
255
|
return;
|
|
@@ -261,7 +274,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
261
274
|
|
|
262
275
|
// We sort columns (whole objects) according to their key order presented in newColumnKeyOrder
|
|
263
276
|
setOrderedColumns(function (columns) {
|
|
264
|
-
return
|
|
277
|
+
return getOrderedColumns(_toConsumableArray(columns), _toConsumableArray(newColumnKeyOrder));
|
|
265
278
|
});
|
|
266
279
|
}
|
|
267
280
|
}
|
|
@@ -271,10 +284,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
271
284
|
return items.map(function (newRowData, rowIndex) {
|
|
272
285
|
return {
|
|
273
286
|
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
274
|
-
cells: visibleSortedColumns.map(function (
|
|
287
|
+
cells: visibleSortedColumns.map(function (_ref7) {
|
|
275
288
|
var _newRowData$key;
|
|
276
|
-
var key =
|
|
277
|
-
type =
|
|
289
|
+
var key = _ref7.key,
|
|
290
|
+
type = _ref7.type;
|
|
278
291
|
var value = ((_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data) || newRowData[key];
|
|
279
292
|
var values = Array.isArray(value) ? value : [value];
|
|
280
293
|
var content = values.map(function (value) {
|
|
@@ -286,7 +299,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
286
299
|
return {
|
|
287
300
|
key: key,
|
|
288
301
|
content: content.length === 1 ? content[0] : content,
|
|
289
|
-
|
|
302
|
+
width: getColumnWidth(key, type)
|
|
290
303
|
};
|
|
291
304
|
}),
|
|
292
305
|
ref: rowIndex === items.length - 1 ? function (el) {
|
|
@@ -294,7 +307,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
294
307
|
} : undefined
|
|
295
308
|
};
|
|
296
309
|
});
|
|
297
|
-
}, [
|
|
310
|
+
}, [items, visibleSortedColumns, getColumnWidth, renderItem]);
|
|
298
311
|
var rows = useMemo(function () {
|
|
299
312
|
if (status !== 'loading') {
|
|
300
313
|
return tableRows;
|
|
@@ -364,10 +377,12 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
364
377
|
}, jsx("thead", {
|
|
365
378
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
366
379
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
367
|
-
}, jsx("tr",
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
380
|
+
}, jsx("tr", {
|
|
381
|
+
ref: tableHeaderRowRef
|
|
382
|
+
}, headerColumns.map(function (_ref9, cellIndex) {
|
|
383
|
+
var key = _ref9.key,
|
|
384
|
+
content = _ref9.content,
|
|
385
|
+
width = _ref9.width;
|
|
371
386
|
var heading = jsx(Tooltip, {
|
|
372
387
|
content: content,
|
|
373
388
|
tag: "span",
|
|
@@ -378,10 +393,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
378
393
|
}, content));
|
|
379
394
|
if (onVisibleColumnKeysChange && hasData) {
|
|
380
395
|
var _containerRef$current3;
|
|
381
|
-
var previewRows = tableRows.map(function (
|
|
382
|
-
var cells =
|
|
383
|
-
var cell = cells.find(function (
|
|
384
|
-
var cellKey =
|
|
396
|
+
var previewRows = tableRows.map(function (_ref10) {
|
|
397
|
+
var cells = _ref10.cells;
|
|
398
|
+
var cell = cells.find(function (_ref11) {
|
|
399
|
+
var cellKey = _ref11.key;
|
|
385
400
|
return cellKey === key;
|
|
386
401
|
});
|
|
387
402
|
if (cell) {
|
|
@@ -397,7 +412,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
397
412
|
key: key,
|
|
398
413
|
id: key,
|
|
399
414
|
index: cellIndex,
|
|
400
|
-
|
|
415
|
+
width: width,
|
|
416
|
+
onWidthChange: onColumnResize === null || onColumnResize === void 0 ? void 0 : onColumnResize.bind(null, key),
|
|
401
417
|
dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
|
|
402
418
|
dragPreview: dragPreview
|
|
403
419
|
}, heading);
|
|
@@ -406,9 +422,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
406
422
|
key: key,
|
|
407
423
|
"data-testid": "".concat(key, "-column-heading"),
|
|
408
424
|
style: {
|
|
409
|
-
|
|
410
|
-
minWidth: maxWidth,
|
|
411
|
-
maxWidth: maxWidth
|
|
425
|
+
width: width
|
|
412
426
|
}
|
|
413
427
|
}, heading);
|
|
414
428
|
}
|
|
@@ -421,20 +435,20 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
|
421
435
|
})))), jsx("tbody", {
|
|
422
436
|
css: noDefaultBorderStyles,
|
|
423
437
|
"data-testid": testId && "".concat(testId, "--body")
|
|
424
|
-
}, rows.map(function (
|
|
425
|
-
var key =
|
|
426
|
-
cells =
|
|
427
|
-
ref =
|
|
438
|
+
}, rows.map(function (_ref12) {
|
|
439
|
+
var key = _ref12.key,
|
|
440
|
+
cells = _ref12.cells,
|
|
441
|
+
ref = _ref12.ref;
|
|
428
442
|
return jsx("tr", {
|
|
429
443
|
key: key,
|
|
430
444
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
431
445
|
ref: ref
|
|
432
|
-
}, cells.map(function (
|
|
433
|
-
var cellKey =
|
|
434
|
-
content =
|
|
435
|
-
|
|
446
|
+
}, cells.map(function (_ref13, cellIndex) {
|
|
447
|
+
var cellKey = _ref13.key,
|
|
448
|
+
content = _ref13.content,
|
|
449
|
+
width = _ref13.width;
|
|
436
450
|
var loadingRowStyle = {
|
|
437
|
-
|
|
451
|
+
width: width
|
|
438
452
|
};
|
|
439
453
|
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
440
454
|
if (key !== null && key !== void 0 && key.includes('loading')) {
|