@atlaskit/link-datasource 2.9.2 → 2.9.4
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 +18 -0
- package/dist/cjs/analytics/generated/use-analytics-events.js +1 -1
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +14 -2
- package/dist/cjs/ui/issue-like-table/index.js +87 -70
- package/dist/cjs/ui/issue-like-table/styled.js +22 -3
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +98 -23
- package/dist/es2019/analytics/generated/use-analytics-events.js +1 -1
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +16 -1
- package/dist/es2019/ui/issue-like-table/index.js +27 -11
- package/dist/es2019/ui/issue-like-table/styled.js +28 -0
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +96 -18
- package/dist/esm/analytics/generated/use-analytics-events.js +1 -1
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +14 -2
- package/dist/esm/ui/issue-like-table/index.js +88 -71
- package/dist/esm/ui/issue-like-table/styled.js +21 -2
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +98 -23
- package/dist/types/analytics/generated/analytics.types.d.ts +13 -8
- package/dist/types/ui/issue-like-table/styled.d.ts +4 -0
- package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +3 -2
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +13 -8
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +4 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +3 -2
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.9.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126601](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126601)
|
|
8
|
+
[`d9862e969b400`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d9862e969b400) -
|
|
9
|
+
[ux] Adds new InlineEditableCell and InlineEditableTableCell for IssueLikeTable behind feature
|
|
10
|
+
gate platform-datasources-enable-two-way-sync
|
|
11
|
+
|
|
12
|
+
## 2.9.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#121590](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/121590)
|
|
17
|
+
[`4dbf48b5397de`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4dbf48b5397de) -
|
|
18
|
+
Track datasource table word-wrap action
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.9.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -14,7 +14,7 @@ var _createEventPayload = _interopRequireDefault(require("./create-event-payload
|
|
|
14
14
|
*
|
|
15
15
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
16
16
|
*
|
|
17
|
-
* @codegen <<SignedSource::
|
|
17
|
+
* @codegen <<SignedSource::21ae373abad7c370a8682ddcd3a7ed21>>
|
|
18
18
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
19
19
|
*/
|
|
20
20
|
|
|
@@ -28,6 +28,7 @@ var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/eleme
|
|
|
28
28
|
var _pointerOutsideOfPreview = require("@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview");
|
|
29
29
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
30
30
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
31
|
+
var _analytics = require("../../analytics");
|
|
31
32
|
var _customIcons = require("./custom-icons");
|
|
32
33
|
var _messages = require("./messages");
|
|
33
34
|
var _styled2 = require("./styled");
|
|
@@ -119,6 +120,8 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
119
120
|
onWidthChange = _ref.onWidthChange,
|
|
120
121
|
isWrapped = _ref.isWrapped,
|
|
121
122
|
onIsWrappedChange = _ref.onIsWrappedChange;
|
|
123
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
124
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
122
125
|
var mainHeaderCellRef = (0, _react.useRef)(null);
|
|
123
126
|
var columnResizeHandleRef = (0, _react.useRef)(null);
|
|
124
127
|
var _useState = (0, _react.useState)(idleState),
|
|
@@ -341,8 +344,17 @@ var DraggableTableHeading = exports.DraggableTableHeading = function DraggableTa
|
|
|
341
344
|
return setIsDropdownOpen(isOpen);
|
|
342
345
|
}, []);
|
|
343
346
|
var toggleWrap = (0, _react.useCallback)(function () {
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
if (!onIsWrappedChange) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
var nextIsWrap = !(isWrapped || false);
|
|
351
|
+
if (nextIsWrap) {
|
|
352
|
+
fireEvent('ui.button.clicked.wrap', {});
|
|
353
|
+
} else {
|
|
354
|
+
fireEvent('ui.button.clicked.unwrap', {});
|
|
355
|
+
}
|
|
356
|
+
onIsWrappedChange(nextIsWrap);
|
|
357
|
+
}, [fireEvent, isWrapped, onIsWrappedChange]);
|
|
346
358
|
return (0, _react2.jsx)(_styled2.TableHeading, {
|
|
347
359
|
ref: mainHeaderCellRef,
|
|
348
360
|
"data-testid": "".concat(id, "-column-heading"),
|
|
@@ -460,69 +460,72 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
460
460
|
}));
|
|
461
461
|
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
|
|
462
462
|
var tableRows = (0, _react.useMemo)(function () {
|
|
463
|
-
return (
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
id: id,
|
|
463
|
+
return (
|
|
464
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
465
|
+
(0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state') ? itemIds.map(function (id, rowIndex) {
|
|
466
|
+
return {
|
|
467
|
+
key: id,
|
|
468
|
+
cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
|
|
469
|
+
var key = _ref12.key,
|
|
470
|
+
type = _ref12.type;
|
|
471
|
+
return {
|
|
472
|
+
key: key,
|
|
474
473
|
columnKey: key,
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
values:
|
|
499
|
-
|
|
500
|
-
var stringifiedContent = values.map(function (value) {
|
|
501
|
-
return (0, _renderType.stringifyType)({
|
|
474
|
+
content: (0, _react2.jsx)(_tableCellContent.TableCellContent, {
|
|
475
|
+
id: id,
|
|
476
|
+
columnKey: key,
|
|
477
|
+
columnType: type,
|
|
478
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
479
|
+
renderItem: renderItem
|
|
480
|
+
}),
|
|
481
|
+
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
482
|
+
};
|
|
483
|
+
}),
|
|
484
|
+
ref: rowIndex === items.length - 1 ? function (el) {
|
|
485
|
+
return setLastRowElement(el);
|
|
486
|
+
} : undefined
|
|
487
|
+
};
|
|
488
|
+
}) : items.map(function (newRowData, rowIndex) {
|
|
489
|
+
return {
|
|
490
|
+
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
491
|
+
cells: visibleSortedColumns.map(function (_ref13, cellIndex) {
|
|
492
|
+
var _newRowData$key;
|
|
493
|
+
var key = _ref13.key,
|
|
494
|
+
type = _ref13.type;
|
|
495
|
+
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
496
|
+
var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
|
|
497
|
+
var values = Array.isArray(value) ? value : [value];
|
|
498
|
+
var renderedValues = renderItem({
|
|
502
499
|
type: type,
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
500
|
+
values: values
|
|
501
|
+
});
|
|
502
|
+
var stringifiedContent = values.map(function (value) {
|
|
503
|
+
return (0, _renderType.stringifyType)({
|
|
504
|
+
type: type,
|
|
505
|
+
value: value
|
|
506
|
+
}, intl.formatMessage, intl.formatDate);
|
|
507
|
+
}).filter(function (value) {
|
|
508
|
+
return value !== '';
|
|
509
|
+
}).join(', ');
|
|
510
|
+
var contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? (0, _react2.jsx)(_tooltip.default
|
|
511
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
512
|
+
, {
|
|
513
|
+
tag: _truncateTextTag.TruncateTextTag,
|
|
514
|
+
content: stringifiedContent,
|
|
515
|
+
testId: "issues-table-cell-tooltip"
|
|
516
|
+
}, renderedValues) : renderedValues;
|
|
517
|
+
return {
|
|
518
|
+
key: key,
|
|
519
|
+
content: contentComponent,
|
|
520
|
+
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
521
|
+
};
|
|
522
|
+
}),
|
|
523
|
+
ref: rowIndex === items.length - 1 ? function (el) {
|
|
524
|
+
return setLastRowElement(el);
|
|
525
|
+
} : undefined
|
|
526
|
+
};
|
|
527
|
+
})
|
|
528
|
+
);
|
|
526
529
|
}, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth, intl.formatMessage, intl.formatDate]);
|
|
527
530
|
var rows = (0, _react.useMemo)(function () {
|
|
528
531
|
if (status !== 'loading') {
|
|
@@ -703,15 +706,29 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
703
706
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
704
707
|
});
|
|
705
708
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
709
|
+
|
|
710
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
711
|
+
if ((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync')) {
|
|
712
|
+
return (0, _react2.jsx)(_styled2.InlineEditableTableCell, {
|
|
713
|
+
key: cellKey,
|
|
714
|
+
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
715
|
+
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
716
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
717
|
+
,
|
|
718
|
+
style: loadingRowStyle,
|
|
719
|
+
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
720
|
+
}, content);
|
|
721
|
+
} else {
|
|
722
|
+
return (0, _react2.jsx)(_styled2.TableCell, {
|
|
723
|
+
key: cellKey,
|
|
724
|
+
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
725
|
+
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
726
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
727
|
+
,
|
|
728
|
+
style: loadingRowStyle,
|
|
729
|
+
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
730
|
+
}, content);
|
|
731
|
+
}
|
|
715
732
|
}));
|
|
716
733
|
}))));
|
|
717
734
|
};
|
|
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.fieldTextFontSize = exports.TableHeading = exports.TableCell = exports.Table = exports.ScrollableContainerHeight = void 0;
|
|
7
|
+
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.fieldTextFontSize = exports.TableHeading = exports.TableCell = exports.Table = exports.ScrollableContainerHeight = exports.InlineEditableTableCell = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
11
|
var _typography = require("@atlaskit/theme/typography");
|
|
12
|
-
var _styled$th, _styled$td; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
|
+
var _styled$th, _styled$td, _styled$td2; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
var ScrollableContainerHeight = exports.ScrollableContainerHeight = 590;
|
|
14
14
|
var fieldTextFontSize = exports.fieldTextFontSize = "var(--ds-font-body, ".concat(_typography.fontFallback.body.medium, ")");
|
|
15
15
|
|
|
@@ -93,4 +93,23 @@ var TableCell = exports.TableCell = _styled.default.td((_styled$td = {}, (0, _de
|
|
|
93
93
|
paddingRight: "var(--ds-space-100, 8px)"
|
|
94
94
|
}), (0, _defineProperty2.default)(_styled$td, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
|
|
95
95
|
whiteSpace: 'unset'
|
|
96
|
-
}), _styled$td));
|
|
96
|
+
}), _styled$td));
|
|
97
|
+
|
|
98
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- To migrate as part of go/ui-styling-standard
|
|
99
|
+
var InlineEditableTableCell = exports.InlineEditableTableCell = _styled.default.td((_styled$td2 = {}, (0, _defineProperty2.default)(_styled$td2, "".concat(withTablePluginBodyPrefix()), {
|
|
100
|
+
/* First section here is to override things editor table plugin css defines */
|
|
101
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
102
|
+
font: fieldTextFontSize,
|
|
103
|
+
padding: "var(--ds-space-0, 0)".concat(" ", "var(--ds-space-0, 0)"),
|
|
104
|
+
border: 0,
|
|
105
|
+
minWidth: 'auto',
|
|
106
|
+
verticalAlign: 'inherit',
|
|
107
|
+
boxSizing: 'border-box',
|
|
108
|
+
borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
109
|
+
borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
|
|
110
|
+
overflow: 'hidden'
|
|
111
|
+
}), (0, _defineProperty2.default)(_styled$td2, "".concat(withTablePluginBodyPrefix('&:last-child')), {
|
|
112
|
+
borderRight: 0
|
|
113
|
+
}), (0, _defineProperty2.default)(_styled$td2, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
|
|
114
|
+
whiteSpace: 'unset'
|
|
115
|
+
}), _styled$td2));
|
|
@@ -7,35 +7,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TableCellContent = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
10
12
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
11
13
|
var _state = require("../../../state");
|
|
12
14
|
var _renderType = require("../render-type");
|
|
13
15
|
var _truncateTextTag = require("../truncate-text-tag");
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
+
var truncateTextStyles = (0, _primitives.xcss)({
|
|
17
|
+
textOverflow: 'ellipsis',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
width: '100%'
|
|
20
|
+
});
|
|
21
|
+
var TooltipWrapper = function TooltipWrapper(_ref) {
|
|
16
22
|
var columnKey = _ref.columnKey,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
wrappedColumnKeys = _ref.wrappedColumnKeys
|
|
23
|
+
_ref$datasourceTypeWi = _ref.datasourceTypeWithValues,
|
|
24
|
+
type = _ref$datasourceTypeWi.type,
|
|
25
|
+
values = _ref$datasourceTypeWi.values,
|
|
26
|
+
wrappedColumnKeys = _ref.wrappedColumnKeys,
|
|
27
|
+
children = _ref.children;
|
|
21
28
|
var intl = (0, _reactIntlNext.useIntl)();
|
|
22
|
-
var rowData = (0, _state.useDatasourceItem)({
|
|
23
|
-
id: id
|
|
24
|
-
});
|
|
25
|
-
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
26
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
30
|
-
var value = (_rowData$columnKey = rowData[columnKey]) === null || _rowData$columnKey === void 0 ? void 0 : _rowData$columnKey.data;
|
|
31
|
-
var values = Array.isArray(value) ? value : [value];
|
|
32
|
-
var renderedValues = renderItem({
|
|
33
|
-
type: columnType,
|
|
34
|
-
values: values
|
|
35
|
-
});
|
|
36
29
|
var stringifiedContent = values.map(function (value) {
|
|
37
30
|
return (0, _renderType.stringifyType)({
|
|
38
|
-
type:
|
|
31
|
+
type: type,
|
|
39
32
|
value: value
|
|
40
33
|
}, intl.formatMessage, intl.formatDate);
|
|
41
34
|
}).filter(function (value) {
|
|
@@ -48,7 +41,89 @@ var TableCellContent = exports.TableCellContent = function TableCellContent(_ref
|
|
|
48
41
|
tag: _truncateTextTag.TruncateTextTag,
|
|
49
42
|
content: stringifiedContent,
|
|
50
43
|
testId: "issues-table-cell-tooltip"
|
|
51
|
-
},
|
|
44
|
+
}, children);
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
47
|
+
};
|
|
48
|
+
var ReadOnlyCell = function ReadOnlyCell(_ref2) {
|
|
49
|
+
var _rowData$columnKey;
|
|
50
|
+
var id = _ref2.id,
|
|
51
|
+
columnType = _ref2.columnType,
|
|
52
|
+
_ref2$wrappedColumnKe = _ref2.wrappedColumnKeys,
|
|
53
|
+
wrappedColumnKeys = _ref2$wrappedColumnKe === void 0 ? [] : _ref2$wrappedColumnKe,
|
|
54
|
+
renderItem = _ref2.renderItem,
|
|
55
|
+
columnKey = _ref2.columnKey;
|
|
56
|
+
var rowData = (0, _state.useDatasourceItem)({
|
|
57
|
+
id: id
|
|
58
|
+
});
|
|
59
|
+
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
64
|
+
var value = (_rowData$columnKey = rowData[columnKey]) === null || _rowData$columnKey === void 0 ? void 0 : _rowData$columnKey.data;
|
|
65
|
+
var values = Array.isArray(value) ? value : [value];
|
|
66
|
+
var datasourceTypeWithValues = {
|
|
67
|
+
type: columnType,
|
|
68
|
+
values: values
|
|
69
|
+
};
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
|
|
71
|
+
columnKey: columnKey,
|
|
72
|
+
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
73
|
+
wrappedColumnKeys: wrappedColumnKeys
|
|
74
|
+
}, renderItem(datasourceTypeWithValues));
|
|
75
|
+
};
|
|
76
|
+
var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
77
|
+
var _rowData$columnKey2;
|
|
78
|
+
var id = _ref3.id,
|
|
79
|
+
columnKey = _ref3.columnKey,
|
|
80
|
+
columnType = _ref3.columnType,
|
|
81
|
+
renderItem = _ref3.renderItem,
|
|
82
|
+
wrappedColumnKeys = _ref3.wrappedColumnKeys;
|
|
83
|
+
var rowData = (0, _state.useDatasourceItem)({
|
|
84
|
+
id: id
|
|
85
|
+
});
|
|
86
|
+
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
52
88
|
}
|
|
53
|
-
|
|
89
|
+
|
|
90
|
+
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
91
|
+
var value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
92
|
+
var values = Array.isArray(value) ? value : [value];
|
|
93
|
+
var datasourceTypeWithValues = {
|
|
94
|
+
type: columnType,
|
|
95
|
+
values: values
|
|
96
|
+
};
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
|
|
98
|
+
columnKey: columnKey,
|
|
99
|
+
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
100
|
+
wrappedColumnKeys: wrappedColumnKeys
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
102
|
+
testId: 'inline-edit-read-view',
|
|
103
|
+
paddingInline: 'space.100',
|
|
104
|
+
paddingBlock: 'space.050',
|
|
105
|
+
xcss: truncateTextStyles
|
|
106
|
+
}, renderItem(datasourceTypeWithValues)));
|
|
107
|
+
};
|
|
108
|
+
var TableCellContent = exports.TableCellContent = function TableCellContent(_ref4) {
|
|
109
|
+
var columnKey = _ref4.columnKey,
|
|
110
|
+
columnType = _ref4.columnType,
|
|
111
|
+
id = _ref4.id,
|
|
112
|
+
renderItem = _ref4.renderItem,
|
|
113
|
+
wrappedColumnKeys = _ref4.wrappedColumnKeys;
|
|
114
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
115
|
+
var renderedContent = (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync') ? /*#__PURE__*/_react.default.createElement(InlineEditableCell, {
|
|
116
|
+
id: id,
|
|
117
|
+
columnKey: columnKey,
|
|
118
|
+
columnType: columnType,
|
|
119
|
+
renderItem: renderItem,
|
|
120
|
+
wrappedColumnKeys: wrappedColumnKeys
|
|
121
|
+
}) : /*#__PURE__*/_react.default.createElement(ReadOnlyCell, {
|
|
122
|
+
id: id,
|
|
123
|
+
columnKey: columnKey,
|
|
124
|
+
columnType: columnType,
|
|
125
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
126
|
+
renderItem: renderItem
|
|
127
|
+
});
|
|
128
|
+
return renderedContent;
|
|
54
129
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::21ae373abad7c370a8682ddcd3a7ed21>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
8
|
*/
|
|
9
9
|
import { useCallback } from 'react';
|
|
@@ -24,6 +24,7 @@ import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/elem
|
|
|
24
24
|
import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
|
|
25
25
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
26
26
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
27
|
+
import { useDatasourceAnalyticsEvents } from '../../analytics';
|
|
27
28
|
import { GlyphPlaceholder, UnwrapTextIcon, WrapTextIcon } from './custom-icons';
|
|
28
29
|
import { issueLikeTableMessages } from './messages';
|
|
29
30
|
import { TableHeading } from './styled';
|
|
@@ -105,6 +106,9 @@ export const DraggableTableHeading = ({
|
|
|
105
106
|
isWrapped,
|
|
106
107
|
onIsWrappedChange
|
|
107
108
|
}) => {
|
|
109
|
+
const {
|
|
110
|
+
fireEvent
|
|
111
|
+
} = useDatasourceAnalyticsEvents();
|
|
108
112
|
const mainHeaderCellRef = useRef(null);
|
|
109
113
|
const columnResizeHandleRef = useRef(null);
|
|
110
114
|
const [state, setState] = useState(idleState);
|
|
@@ -311,7 +315,18 @@ export const DraggableTableHeading = ({
|
|
|
311
315
|
const onDropdownOpenChange = useCallback(({
|
|
312
316
|
isOpen
|
|
313
317
|
}) => setIsDropdownOpen(isOpen), []);
|
|
314
|
-
const toggleWrap = useCallback(() =>
|
|
318
|
+
const toggleWrap = useCallback(() => {
|
|
319
|
+
if (!onIsWrappedChange) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const nextIsWrap = !(isWrapped || false);
|
|
323
|
+
if (nextIsWrap) {
|
|
324
|
+
fireEvent('ui.button.clicked.wrap', {});
|
|
325
|
+
} else {
|
|
326
|
+
fireEvent('ui.button.clicked.unwrap', {});
|
|
327
|
+
}
|
|
328
|
+
onIsWrappedChange(nextIsWrap);
|
|
329
|
+
}, [fireEvent, isWrapped, onIsWrappedChange]);
|
|
315
330
|
return jsx(TableHeading, {
|
|
316
331
|
ref: mainHeaderCellRef,
|
|
317
332
|
"data-testid": `${id}-column-heading`,
|
|
@@ -30,7 +30,7 @@ import { DragColumnPreview } from './drag-column-preview';
|
|
|
30
30
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
31
31
|
import TableEmptyState from './empty-state';
|
|
32
32
|
import { renderType, stringifyType } from './render-type';
|
|
33
|
-
import { Table, TableCell, TableHeading, withTablePluginHeaderPrefix } from './styled';
|
|
33
|
+
import { InlineEditableTableCell, Table, TableCell, TableHeading, withTablePluginHeaderPrefix } from './styled';
|
|
34
34
|
import { TableCellContent } from './table-cell-content';
|
|
35
35
|
import { TruncateTextTag } from './truncate-text-tag';
|
|
36
36
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
@@ -457,7 +457,9 @@ export const IssueLikeDataTableView = ({
|
|
|
457
457
|
}
|
|
458
458
|
}));
|
|
459
459
|
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
|
|
460
|
-
const tableRows = useMemo(() =>
|
|
460
|
+
const tableRows = useMemo(() =>
|
|
461
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
462
|
+
fg('enable_datasource_react_sweet_state') ? itemIds.map((id, rowIndex) => {
|
|
461
463
|
return {
|
|
462
464
|
key: id,
|
|
463
465
|
cells: visibleSortedColumns.map(({
|
|
@@ -678,15 +680,29 @@ export const IssueLikeDataTableView = ({
|
|
|
678
680
|
paddingBlock: "var(--ds-space-100, 8px)"
|
|
679
681
|
};
|
|
680
682
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
683
|
+
|
|
684
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
685
|
+
if (fg('platform-datasources-enable-two-way-sync')) {
|
|
686
|
+
return jsx(InlineEditableTableCell, {
|
|
687
|
+
key: cellKey,
|
|
688
|
+
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
689
|
+
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
690
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
691
|
+
,
|
|
692
|
+
style: loadingRowStyle,
|
|
693
|
+
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
694
|
+
}, content);
|
|
695
|
+
} else {
|
|
696
|
+
return jsx(TableCell, {
|
|
697
|
+
key: cellKey,
|
|
698
|
+
"data-testid": testId && `${testId}--cell-${cellIndex}`,
|
|
699
|
+
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
700
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
701
|
+
,
|
|
702
|
+
style: loadingRowStyle,
|
|
703
|
+
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
704
|
+
}, content);
|
|
705
|
+
}
|
|
690
706
|
}))))));
|
|
691
707
|
};
|
|
692
708
|
export const EmptyState = TableEmptyState;
|
|
@@ -108,4 +108,32 @@ export const TableCell = styled.td({
|
|
|
108
108
|
["& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span"]: {
|
|
109
109
|
whiteSpace: 'unset'
|
|
110
110
|
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- To migrate as part of go/ui-styling-standard
|
|
114
|
+
export const InlineEditableTableCell = styled.td({
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
|
+
[`${withTablePluginBodyPrefix()}`]: {
|
|
117
|
+
/* First section here is to override things editor table plugin css defines */
|
|
118
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
119
|
+
font: fieldTextFontSize,
|
|
120
|
+
padding: `${"var(--ds-space-0, 0)"} ${"var(--ds-space-0, 0)"}`,
|
|
121
|
+
border: 0,
|
|
122
|
+
minWidth: 'auto',
|
|
123
|
+
verticalAlign: 'inherit',
|
|
124
|
+
boxSizing: 'border-box',
|
|
125
|
+
borderRight: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
126
|
+
borderBottom: `0.5px solid ${`var(--ds-border, ${N40})`}`,
|
|
127
|
+
overflow: 'hidden'
|
|
128
|
+
},
|
|
129
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
130
|
+
[`${withTablePluginBodyPrefix('&:last-child')}`]: {
|
|
131
|
+
borderRight: 0
|
|
132
|
+
},
|
|
133
|
+
// Inline smart links are pretty opinionated about word-wrapping.
|
|
134
|
+
// We want it to be controlled by user, so we make it overflow and truncate by default.
|
|
135
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
136
|
+
["& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span"]: {
|
|
137
|
+
whiteSpace: 'unset'
|
|
138
|
+
}
|
|
111
139
|
});
|