@atlaskit/link-datasource 3.13.17 → 3.13.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/hooks/useLoadOptions.js +20 -9
- package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/cjs/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +7 -1
- package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/cjs/ui/issue-like-table/edit-type/user/index.js +7 -1
- package/dist/cjs/ui/issue-like-table/index.js +6 -2
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +31 -2
- package/dist/cjs/ui/issue-like-table/table-cell-content/messages.js +14 -0
- package/dist/cjs/ui/issue-like-table/utils.js +21 -1
- package/dist/es2019/hooks/useLoadOptions.js +15 -4
- package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/es2019/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +5 -1
- package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/es2019/ui/issue-like-table/edit-type/user/index.js +5 -1
- package/dist/es2019/ui/issue-like-table/index.js +7 -3
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +33 -3
- package/dist/es2019/ui/issue-like-table/table-cell-content/messages.js +8 -0
- package/dist/es2019/ui/issue-like-table/utils.js +18 -1
- package/dist/esm/hooks/useLoadOptions.js +21 -10
- package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +4 -1
- package/dist/esm/ui/issue-like-table/edit-type/index.js +9 -4
- package/dist/esm/ui/issue-like-table/edit-type/status/index.js +7 -1
- package/dist/esm/ui/issue-like-table/edit-type/text/index.js +3 -1
- package/dist/esm/ui/issue-like-table/edit-type/user/index.js +7 -1
- package/dist/esm/ui/issue-like-table/index.js +7 -3
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +5 -0
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +32 -3
- package/dist/esm/ui/issue-like-table/table-cell-content/messages.js +8 -0
- package/dist/esm/ui/issue-like-table/utils.js +19 -0
- package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
- package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
- package/dist/types/ui/issue-like-table/utils.d.ts +20 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
- package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +20 -0
- package/package.json +3 -3
|
@@ -8,7 +8,8 @@ const TextEditType = props => {
|
|
|
8
8
|
var _currentValue$values$, _currentValue$values;
|
|
9
9
|
const experienceId = useDatasourceExperienceId();
|
|
10
10
|
const {
|
|
11
|
-
currentValue
|
|
11
|
+
currentValue,
|
|
12
|
+
labelId
|
|
12
13
|
} = props;
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
if (experienceId) {
|
|
@@ -28,6 +29,7 @@ const TextEditType = props => {
|
|
|
28
29
|
padding: `${"var(--ds-space-100, 8px)"} calc(${"var(--ds-space-100, 8px)"} - 1px)`
|
|
29
30
|
},
|
|
30
31
|
value: (_currentValue$values$ = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0]) !== null && _currentValue$values$ !== void 0 ? _currentValue$values$ : '',
|
|
32
|
+
"aria-labelledby": labelId,
|
|
31
33
|
onChange: e => props.setEditValues({
|
|
32
34
|
type: 'string',
|
|
33
35
|
values: [e.currentTarget.value]
|
|
@@ -13,10 +13,12 @@ import { SEARCH_DEBOUNCE_MS } from '../../../common/modal/popup-select/constants
|
|
|
13
13
|
import { USER_TYPE_TEST_ID } from '../../render-type/user';
|
|
14
14
|
import { userTypeMessages } from '../../render-type/user/messages';
|
|
15
15
|
import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
|
|
16
|
+
import { getCleanedSelectProps } from '../../utils';
|
|
16
17
|
const UserEditType = props => {
|
|
17
18
|
var _currentValue$values;
|
|
18
19
|
const {
|
|
19
20
|
currentValue,
|
|
21
|
+
labelId,
|
|
20
22
|
executeFetch
|
|
21
23
|
} = props;
|
|
22
24
|
const [fetchInputs, setFetchInputs] = useState({
|
|
@@ -59,7 +61,7 @@ const UserEditType = props => {
|
|
|
59
61
|
}, [experienceId, isLoading, hasFailed]);
|
|
60
62
|
return /*#__PURE__*/React.createElement(Layering, {
|
|
61
63
|
isDisabled: false
|
|
62
|
-
}, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
|
|
63
65
|
autoFocus: true,
|
|
64
66
|
defaultMenuIsOpen: true,
|
|
65
67
|
blurInputOnSelect: true,
|
|
@@ -70,7 +72,9 @@ const UserEditType = props => {
|
|
|
70
72
|
menuPlacement: "auto",
|
|
71
73
|
onInputChange: handleUserInputDebounced,
|
|
72
74
|
value: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
75
|
+
labelId: labelId,
|
|
73
76
|
getOptionValue: option => option.atlassianUserId,
|
|
77
|
+
getOptionLabel: option => option.displayName || '',
|
|
74
78
|
formatOptionLabel: option => {
|
|
75
79
|
var _option$displayName;
|
|
76
80
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -36,7 +36,7 @@ import { InlineEditableTableCell, Table, TableCell, TableHeading, withTablePlugi
|
|
|
36
36
|
import { ReadOnlyCell, TableCellContent } from './table-cell-content';
|
|
37
37
|
import { TruncateTextTag } from './truncate-text-tag';
|
|
38
38
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
39
|
-
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
39
|
+
import { COLUMN_BASE_WIDTH, getFieldLabelById, getWidthCss } from './utils';
|
|
40
40
|
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
41
41
|
const tableHeadStyles = css({
|
|
42
42
|
background: "var(--ds-elevation-surface-current, #FFF)",
|
|
@@ -474,7 +474,8 @@ export const IssueLikeDataTableView = ({
|
|
|
474
474
|
key: id,
|
|
475
475
|
cells: visibleSortedColumns.map(({
|
|
476
476
|
key,
|
|
477
|
-
type
|
|
477
|
+
type,
|
|
478
|
+
title
|
|
478
479
|
}, cellIndex) => {
|
|
479
480
|
return {
|
|
480
481
|
key,
|
|
@@ -484,11 +485,13 @@ export const IssueLikeDataTableView = ({
|
|
|
484
485
|
id: id,
|
|
485
486
|
columnKey: key,
|
|
486
487
|
columnType: type,
|
|
488
|
+
columnTitle: title,
|
|
487
489
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
488
490
|
renderItem: renderItem
|
|
489
491
|
}) : jsx(ReadOnlyCell, {
|
|
490
492
|
id: id,
|
|
491
493
|
columnKey: key,
|
|
494
|
+
columnTitle: title,
|
|
492
495
|
columnType: type,
|
|
493
496
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
494
497
|
renderItem: renderItem
|
|
@@ -618,7 +621,8 @@ export const IssueLikeDataTableView = ({
|
|
|
618
621
|
position: "bottom-start",
|
|
619
622
|
testId: 'datasource-header-content'
|
|
620
623
|
}, jsx("span", {
|
|
621
|
-
css: headerStyles
|
|
624
|
+
css: headerStyles,
|
|
625
|
+
id: getFieldLabelById(key)
|
|
622
626
|
}, content));
|
|
623
627
|
const isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
|
|
624
628
|
if (isHeadingOutsideButton) {
|
|
@@ -73,6 +73,7 @@ const InlineEditableCell = ({
|
|
|
73
73
|
ari,
|
|
74
74
|
values,
|
|
75
75
|
columnKey,
|
|
76
|
+
columnTitle,
|
|
76
77
|
renderItem,
|
|
77
78
|
integrationKey,
|
|
78
79
|
wrappedColumnKeys
|
|
@@ -114,6 +115,7 @@ const InlineEditableCell = ({
|
|
|
114
115
|
executeFetch: executeFetch,
|
|
115
116
|
readView: readView,
|
|
116
117
|
columnKey: columnKey,
|
|
118
|
+
columnTitle: columnTitle,
|
|
117
119
|
datasourceTypeWithValues: values
|
|
118
120
|
});
|
|
119
121
|
};
|
|
@@ -134,6 +136,7 @@ const toDatasourceTypeWithValues = ({
|
|
|
134
136
|
export const TableCellContent = ({
|
|
135
137
|
id,
|
|
136
138
|
columnKey,
|
|
139
|
+
columnTitle,
|
|
137
140
|
columnType,
|
|
138
141
|
renderItem,
|
|
139
142
|
wrappedColumnKeys
|
|
@@ -152,6 +155,7 @@ export const TableCellContent = ({
|
|
|
152
155
|
return /*#__PURE__*/React.createElement(InlineEditableCell, {
|
|
153
156
|
ari: ari,
|
|
154
157
|
columnKey: columnKey,
|
|
158
|
+
columnTitle: columnTitle,
|
|
155
159
|
renderItem: renderItem,
|
|
156
160
|
integrationKey: integrationKey,
|
|
157
161
|
values: toDatasourceTypeWithValues({
|
|
@@ -171,6 +175,7 @@ export const TableCellContent = ({
|
|
|
171
175
|
}, /*#__PURE__*/React.createElement(ReadOnlyCell, {
|
|
172
176
|
id: id,
|
|
173
177
|
columnKey: columnKey,
|
|
178
|
+
columnTitle: columnTitle,
|
|
174
179
|
columnType: columnType,
|
|
175
180
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
176
181
|
renderItem: renderItem
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
3
4
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
4
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
6
|
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
@@ -10,6 +11,8 @@ import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
|
10
11
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
11
12
|
import { editType } from '../edit-type';
|
|
12
13
|
import { EmptyAvatar } from '../shared-components/avatar';
|
|
14
|
+
import { getFieldLabelById } from '../utils';
|
|
15
|
+
import { tableCellMessages } from './messages';
|
|
13
16
|
export const InlineEditUFOExperience = 'inline-edit-rendered';
|
|
14
17
|
const editContainerStyles = xcss({
|
|
15
18
|
marginBlockStart: 'space.negative.100'
|
|
@@ -28,6 +31,21 @@ const getBackendUpdateValue = typedNewValue => {
|
|
|
28
31
|
}
|
|
29
32
|
throw new Error(`Datasource 2 way sync Backend update value not implemented for type ${typedNewValue.type}`);
|
|
30
33
|
};
|
|
34
|
+
const getCurrentFieldLabel = typedNewValue => {
|
|
35
|
+
var _typedNewValue$values4, _typedNewValue$values5, _typedNewValue$values6;
|
|
36
|
+
switch (typedNewValue.type) {
|
|
37
|
+
case 'string':
|
|
38
|
+
return typedNewValue.values[0] || '';
|
|
39
|
+
case 'status':
|
|
40
|
+
return ((_typedNewValue$values4 = typedNewValue.values[0]) === null || _typedNewValue$values4 === void 0 ? void 0 : _typedNewValue$values4.text) || '';
|
|
41
|
+
case 'user':
|
|
42
|
+
return ((_typedNewValue$values5 = typedNewValue.values[0]) === null || _typedNewValue$values5 === void 0 ? void 0 : _typedNewValue$values5.displayName) || '';
|
|
43
|
+
case 'icon':
|
|
44
|
+
return ((_typedNewValue$values6 = typedNewValue.values[0]) === null || _typedNewValue$values6 === void 0 ? void 0 : _typedNewValue$values6.text) || '';
|
|
45
|
+
default:
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
};
|
|
31
49
|
const mapUpdatedItem = (existingItem, columnKey, newValue) => {
|
|
32
50
|
switch (newValue.type) {
|
|
33
51
|
case 'string':
|
|
@@ -74,6 +92,7 @@ export const InlineEdit = ({
|
|
|
74
92
|
executeFetch,
|
|
75
93
|
readView,
|
|
76
94
|
columnKey,
|
|
95
|
+
columnTitle,
|
|
77
96
|
datasourceTypeWithValues
|
|
78
97
|
}) => {
|
|
79
98
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -143,13 +162,23 @@ export const InlineEdit = ({
|
|
|
143
162
|
});
|
|
144
163
|
}
|
|
145
164
|
}, [columnKey, entityType, fireEvent, integrationKey]);
|
|
165
|
+
const {
|
|
166
|
+
formatMessage
|
|
167
|
+
} = useIntl();
|
|
168
|
+
const editButtonLabel = useMemo(() => {
|
|
169
|
+
return formatMessage(tableCellMessages.editButtonLabel, {
|
|
170
|
+
fieldName: columnTitle,
|
|
171
|
+
fieldValue: getCurrentFieldLabel(editValues)
|
|
172
|
+
});
|
|
173
|
+
}, [columnTitle, formatMessage, editValues]);
|
|
146
174
|
return /*#__PURE__*/React.createElement(Box, {
|
|
147
175
|
xcss: editContainerStyles
|
|
148
176
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
149
177
|
defaultValue: datasourceTypeWithValues,
|
|
150
178
|
currentValue: editValues,
|
|
151
179
|
setEditValues,
|
|
152
|
-
executeFetch
|
|
180
|
+
executeFetch,
|
|
181
|
+
labelId: getFieldLabelById(columnKey)
|
|
153
182
|
}), {
|
|
154
183
|
hideActionButtons: true,
|
|
155
184
|
readView: editableRenderType({
|
|
@@ -160,7 +189,8 @@ export const InlineEdit = ({
|
|
|
160
189
|
isEditing: isEditing,
|
|
161
190
|
onEdit: onEdit,
|
|
162
191
|
onCancel: onCancelEdit,
|
|
163
|
-
onConfirm: () => onCommitUpdate(editValues)
|
|
192
|
+
onConfirm: () => onCommitUpdate(editValues),
|
|
193
|
+
editButtonLabel: editButtonLabel
|
|
164
194
|
})));
|
|
165
195
|
};
|
|
166
196
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const tableCellMessages = defineMessages({
|
|
3
|
+
editButtonLabel: {
|
|
4
|
+
id: 'linkDataSource.issue-line-table.edit-button-label.non-final',
|
|
5
|
+
description: 'Label of inline editable field, used mostly for screen readers. This label is used to describe the field that is editable and can be changed. e.g John Doe, Assignee field',
|
|
6
|
+
defaultMessage: '{fieldValue}, {fieldName} field'
|
|
7
|
+
}
|
|
8
|
+
});
|
|
@@ -53,4 +53,21 @@ export const getColumnAction = (oldVisibleColumnKeys, newVisibleColumnKeys) => {
|
|
|
53
53
|
} else {
|
|
54
54
|
return DatasourceAction.COLUMN_REORDERED;
|
|
55
55
|
}
|
|
56
|
-
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Remove deprecated `aria-labelledby` prop from select component props.
|
|
60
|
+
*/
|
|
61
|
+
export const getCleanedSelectProps = props => {
|
|
62
|
+
// Component Field auto adds `aria-labelledby` prop, which is deprecated and should not be used - https://hello.jira.atlassian.cloud/browse/ENGHEALTH-14529
|
|
63
|
+
const {
|
|
64
|
+
'aria-labelledby': removedLabelByProps,
|
|
65
|
+
...selectProps
|
|
66
|
+
} = props;
|
|
67
|
+
return selectProps;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Create id for table header to be used as aria-labelledby on form fields.
|
|
72
|
+
*/
|
|
73
|
+
export const getFieldLabelById = fieldId => `datasource-header-title-${fieldId}`;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
-
import { useEffect,
|
|
8
|
+
import { useEffect, useReducer } from 'react';
|
|
6
9
|
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
7
10
|
import { useDatasourceTableFlag } from './useDatasourceTableFlag';
|
|
8
11
|
var loadOptions = /*#__PURE__*/function () {
|
|
@@ -46,30 +49,38 @@ var loadOptions = /*#__PURE__*/function () {
|
|
|
46
49
|
return _ref.apply(this, arguments);
|
|
47
50
|
};
|
|
48
51
|
}();
|
|
52
|
+
var reducer = function reducer(state, payload) {
|
|
53
|
+
return _objectSpread(_objectSpread({}, state), payload);
|
|
54
|
+
};
|
|
49
55
|
export var useLoadOptions = function useLoadOptions(_ref2) {
|
|
50
56
|
var fetchInputs = _ref2.fetchInputs,
|
|
51
57
|
executeFetch = _ref2.executeFetch,
|
|
52
58
|
emptyOption = _ref2.emptyOption;
|
|
53
|
-
var
|
|
59
|
+
var _useReducer = useReducer(reducer, {
|
|
54
60
|
isLoading: true,
|
|
55
61
|
options: [],
|
|
56
62
|
hasFailed: false
|
|
57
63
|
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
options =
|
|
61
|
-
isLoading =
|
|
62
|
-
hasFailed =
|
|
63
|
-
|
|
64
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
65
|
+
_useReducer2$ = _useReducer2[0],
|
|
66
|
+
options = _useReducer2$.options,
|
|
67
|
+
isLoading = _useReducer2$.isLoading,
|
|
68
|
+
hasFailed = _useReducer2$.hasFailed,
|
|
69
|
+
dispatch = _useReducer2[1];
|
|
64
70
|
var _useDatasourceTableFl = useDatasourceTableFlag({
|
|
65
71
|
isFetchAction: true
|
|
66
72
|
}),
|
|
67
73
|
showErrorFlag = _useDatasourceTableFl.showErrorFlag;
|
|
68
74
|
useEffect(function () {
|
|
69
75
|
var isMounted = true;
|
|
76
|
+
// Set the loading state before sending the request
|
|
77
|
+
dispatch({
|
|
78
|
+
isLoading: true
|
|
79
|
+
});
|
|
80
|
+
// Query the options
|
|
70
81
|
loadOptions(fetchInputs, executeFetch).then(function (options) {
|
|
71
82
|
if (isMounted) {
|
|
72
|
-
|
|
83
|
+
dispatch({
|
|
73
84
|
isLoading: false,
|
|
74
85
|
options: emptyOption ? [emptyOption].concat(_toConsumableArray(options)) : options,
|
|
75
86
|
hasFailed: false
|
|
@@ -77,7 +88,7 @@ export var useLoadOptions = function useLoadOptions(_ref2) {
|
|
|
77
88
|
}
|
|
78
89
|
}).catch(function (err) {
|
|
79
90
|
showErrorFlag();
|
|
80
|
-
|
|
91
|
+
dispatch({
|
|
81
92
|
isLoading: false,
|
|
82
93
|
options: [],
|
|
83
94
|
hasFailed: true
|
|
@@ -8,12 +8,14 @@ import { useDatasourceExperienceId } from '../../../../contexts/datasource-exper
|
|
|
8
8
|
import { useLoadOptions } from '../../../../hooks/useLoadOptions';
|
|
9
9
|
import { SharedIconComponent } from '../../shared-components/icon';
|
|
10
10
|
import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
|
|
11
|
+
import { getCleanedSelectProps } from '../../utils';
|
|
11
12
|
/**
|
|
12
13
|
* Should be gated by FF rollout of platform-datasources-enable-two-way-sync-priority
|
|
13
14
|
*/
|
|
14
15
|
var IconEditType = function IconEditType(props) {
|
|
15
16
|
var _currentValue$values;
|
|
16
17
|
var currentValue = props.currentValue,
|
|
18
|
+
labelId = props.labelId,
|
|
17
19
|
executeFetch = props.executeFetch;
|
|
18
20
|
var _useLoadOptions = useLoadOptions({
|
|
19
21
|
executeFetch: executeFetch
|
|
@@ -38,7 +40,7 @@ var IconEditType = function IconEditType(props) {
|
|
|
38
40
|
}, [experienceId, isLoading, hasFailed]);
|
|
39
41
|
return /*#__PURE__*/React.createElement(Layering, {
|
|
40
42
|
isDisabled: false
|
|
41
|
-
}, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
|
|
42
44
|
autoFocus: true,
|
|
43
45
|
blurInputOnSelect: true,
|
|
44
46
|
defaultMenuIsOpen: true,
|
|
@@ -48,6 +50,7 @@ var IconEditType = function IconEditType(props) {
|
|
|
48
50
|
filterOption: filterOption,
|
|
49
51
|
testId: "inline-edit-priority",
|
|
50
52
|
value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
53
|
+
labelId: labelId,
|
|
51
54
|
getOptionValue: function getOptionValue(option) {
|
|
52
55
|
return option.text || '';
|
|
53
56
|
},
|
|
@@ -16,6 +16,7 @@ export var editType = function editType(_ref) {
|
|
|
16
16
|
var _toValueType, _value$atlassianUserI;
|
|
17
17
|
var defaultValue = _ref.defaultValue,
|
|
18
18
|
currentValue = _ref.currentValue,
|
|
19
|
+
labelId = _ref.labelId,
|
|
19
20
|
setEditValues = _ref.setEditValues,
|
|
20
21
|
executeFetch = _ref.executeFetch;
|
|
21
22
|
switch (defaultValue.type) {
|
|
@@ -27,7 +28,8 @@ export var editType = function editType(_ref) {
|
|
|
27
28
|
return /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
|
|
28
29
|
currentValue: currentValue,
|
|
29
30
|
setEditValues: setEditValues,
|
|
30
|
-
id: ACTIVE_INLINE_EDIT_ID
|
|
31
|
+
id: ACTIVE_INLINE_EDIT_ID,
|
|
32
|
+
labelId: labelId
|
|
31
33
|
}));
|
|
32
34
|
}
|
|
33
35
|
};
|
|
@@ -41,7 +43,8 @@ export var editType = function editType(_ref) {
|
|
|
41
43
|
currentValue: currentValue,
|
|
42
44
|
setEditValues: setEditValues,
|
|
43
45
|
id: ACTIVE_INLINE_EDIT_ID,
|
|
44
|
-
executeFetch: executeFetch
|
|
46
|
+
executeFetch: executeFetch,
|
|
47
|
+
labelId: labelId
|
|
45
48
|
}));
|
|
46
49
|
}
|
|
47
50
|
};
|
|
@@ -54,7 +57,8 @@ export var editType = function editType(_ref) {
|
|
|
54
57
|
currentValue: currentValue,
|
|
55
58
|
setEditValues: setEditValues,
|
|
56
59
|
id: ACTIVE_INLINE_EDIT_ID,
|
|
57
|
-
executeFetch: executeFetch
|
|
60
|
+
executeFetch: executeFetch,
|
|
61
|
+
labelId: labelId
|
|
58
62
|
}));
|
|
59
63
|
}
|
|
60
64
|
};
|
|
@@ -68,7 +72,8 @@ export var editType = function editType(_ref) {
|
|
|
68
72
|
currentValue: currentValue,
|
|
69
73
|
setEditValues: setEditValues,
|
|
70
74
|
id: ACTIVE_INLINE_EDIT_ID,
|
|
71
|
-
executeFetch: executeFetch
|
|
75
|
+
executeFetch: executeFetch,
|
|
76
|
+
labelId: labelId
|
|
72
77
|
}));
|
|
73
78
|
}
|
|
74
79
|
};
|
|
@@ -8,9 +8,11 @@ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/u
|
|
|
8
8
|
import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
|
|
9
9
|
import { useLoadOptions } from '../../../../hooks/useLoadOptions';
|
|
10
10
|
import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
|
|
11
|
+
import { getCleanedSelectProps } from '../../utils';
|
|
11
12
|
var StatusEditType = function StatusEditType(props) {
|
|
12
13
|
var _currentValue$values;
|
|
13
14
|
var currentValue = props.currentValue,
|
|
15
|
+
labelId = props.labelId,
|
|
14
16
|
executeFetch = props.executeFetch;
|
|
15
17
|
var _useLoadOptions = useLoadOptions({
|
|
16
18
|
executeFetch: executeFetch
|
|
@@ -35,7 +37,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
35
37
|
}, [experienceId, isLoading, hasFailed]);
|
|
36
38
|
return /*#__PURE__*/React.createElement(Layering, {
|
|
37
39
|
isDisabled: false
|
|
38
|
-
}, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
|
|
39
41
|
autoFocus: true,
|
|
40
42
|
options: options,
|
|
41
43
|
defaultMenuIsOpen: true,
|
|
@@ -48,6 +50,7 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
48
50
|
return option.text;
|
|
49
51
|
},
|
|
50
52
|
value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
53
|
+
labelId: labelId,
|
|
51
54
|
formatOptionLabel: function formatOptionLabel(option) {
|
|
52
55
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
53
56
|
content: option.text
|
|
@@ -55,6 +58,9 @@ var StatusEditType = function StatusEditType(props) {
|
|
|
55
58
|
testId: "inline-edit-status-option-".concat(option.text)
|
|
56
59
|
}, option.style), option.text));
|
|
57
60
|
},
|
|
61
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
62
|
+
return option.text;
|
|
63
|
+
},
|
|
58
64
|
onChange: function onChange(e) {
|
|
59
65
|
return props.setEditValues({
|
|
60
66
|
type: 'status',
|
|
@@ -7,7 +7,8 @@ import { useDatasourceExperienceId } from '../../../../contexts/datasource-exper
|
|
|
7
7
|
var TextEditType = function TextEditType(props) {
|
|
8
8
|
var _currentValue$values$, _currentValue$values;
|
|
9
9
|
var experienceId = useDatasourceExperienceId();
|
|
10
|
-
var currentValue = props.currentValue
|
|
10
|
+
var currentValue = props.currentValue,
|
|
11
|
+
labelId = props.labelId;
|
|
11
12
|
useEffect(function () {
|
|
12
13
|
if (experienceId) {
|
|
13
14
|
succeedUfoExperience({
|
|
@@ -26,6 +27,7 @@ var TextEditType = function TextEditType(props) {
|
|
|
26
27
|
padding: "var(--ds-space-100, 8px)".concat(" calc(", "var(--ds-space-100, 8px)", " - 1px)")
|
|
27
28
|
},
|
|
28
29
|
value: (_currentValue$values$ = currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0]) !== null && _currentValue$values$ !== void 0 ? _currentValue$values$ : '',
|
|
30
|
+
"aria-labelledby": labelId,
|
|
29
31
|
onChange: function onChange(e) {
|
|
30
32
|
return props.setEditValues({
|
|
31
33
|
type: 'string',
|
|
@@ -14,9 +14,11 @@ import { SEARCH_DEBOUNCE_MS } from '../../../common/modal/popup-select/constants
|
|
|
14
14
|
import { USER_TYPE_TEST_ID } from '../../render-type/user';
|
|
15
15
|
import { userTypeMessages } from '../../render-type/user/messages';
|
|
16
16
|
import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
|
|
17
|
+
import { getCleanedSelectProps } from '../../utils';
|
|
17
18
|
var UserEditType = function UserEditType(props) {
|
|
18
19
|
var _currentValue$values;
|
|
19
20
|
var currentValue = props.currentValue,
|
|
21
|
+
labelId = props.labelId,
|
|
20
22
|
executeFetch = props.executeFetch;
|
|
21
23
|
var _useState = useState({
|
|
22
24
|
query: ''
|
|
@@ -65,7 +67,7 @@ var UserEditType = function UserEditType(props) {
|
|
|
65
67
|
}, [experienceId, isLoading, hasFailed]);
|
|
66
68
|
return /*#__PURE__*/React.createElement(Layering, {
|
|
67
69
|
isDisabled: false
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
|
|
69
71
|
autoFocus: true,
|
|
70
72
|
defaultMenuIsOpen: true,
|
|
71
73
|
blurInputOnSelect: true,
|
|
@@ -76,9 +78,13 @@ var UserEditType = function UserEditType(props) {
|
|
|
76
78
|
menuPlacement: "auto",
|
|
77
79
|
onInputChange: handleUserInputDebounced,
|
|
78
80
|
value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
|
|
81
|
+
labelId: labelId,
|
|
79
82
|
getOptionValue: function getOptionValue(option) {
|
|
80
83
|
return option.atlassianUserId;
|
|
81
84
|
},
|
|
85
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
86
|
+
return option.displayName || '';
|
|
87
|
+
},
|
|
82
88
|
formatOptionLabel: function formatOptionLabel(option) {
|
|
83
89
|
var _option$displayName;
|
|
84
90
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -43,7 +43,7 @@ import { InlineEditableTableCell, Table, TableCell, TableHeading, withTablePlugi
|
|
|
43
43
|
import { ReadOnlyCell, TableCellContent } from './table-cell-content';
|
|
44
44
|
import { TruncateTextTag } from './truncate-text-tag';
|
|
45
45
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
46
|
-
import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
|
|
46
|
+
import { COLUMN_BASE_WIDTH, getFieldLabelById, getWidthCss } from './utils';
|
|
47
47
|
var tableSidePadding = "var(--ds-space-200, 16px)";
|
|
48
48
|
var tableHeadStyles = css({
|
|
49
49
|
background: "var(--ds-elevation-surface-current, #FFF)",
|
|
@@ -473,7 +473,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
473
473
|
key: id,
|
|
474
474
|
cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
|
|
475
475
|
var key = _ref12.key,
|
|
476
|
-
type = _ref12.type
|
|
476
|
+
type = _ref12.type,
|
|
477
|
+
title = _ref12.title;
|
|
477
478
|
return {
|
|
478
479
|
key: key,
|
|
479
480
|
columnKey: key,
|
|
@@ -482,11 +483,13 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
482
483
|
id: id,
|
|
483
484
|
columnKey: key,
|
|
484
485
|
columnType: type,
|
|
486
|
+
columnTitle: title,
|
|
485
487
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
486
488
|
renderItem: renderItem
|
|
487
489
|
}) : jsx(ReadOnlyCell, {
|
|
488
490
|
id: id,
|
|
489
491
|
columnKey: key,
|
|
492
|
+
columnTitle: title,
|
|
490
493
|
columnType: type,
|
|
491
494
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
492
495
|
renderItem: renderItem
|
|
@@ -642,7 +645,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
|
|
|
642
645
|
position: "bottom-start",
|
|
643
646
|
testId: 'datasource-header-content'
|
|
644
647
|
}, jsx("span", {
|
|
645
|
-
css: headerStyles
|
|
648
|
+
css: headerStyles,
|
|
649
|
+
id: getFieldLabelById(key)
|
|
646
650
|
}, content));
|
|
647
651
|
var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
|
|
648
652
|
if (isHeadingOutsideButton) {
|
|
@@ -75,6 +75,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
75
75
|
var ari = _ref3.ari,
|
|
76
76
|
values = _ref3.values,
|
|
77
77
|
columnKey = _ref3.columnKey,
|
|
78
|
+
columnTitle = _ref3.columnTitle,
|
|
78
79
|
renderItem = _ref3.renderItem,
|
|
79
80
|
integrationKey = _ref3.integrationKey,
|
|
80
81
|
wrappedColumnKeys = _ref3.wrappedColumnKeys;
|
|
@@ -114,6 +115,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
114
115
|
executeFetch: executeFetch,
|
|
115
116
|
readView: readView,
|
|
116
117
|
columnKey: columnKey,
|
|
118
|
+
columnTitle: columnTitle,
|
|
117
119
|
datasourceTypeWithValues: values
|
|
118
120
|
});
|
|
119
121
|
};
|
|
@@ -133,6 +135,7 @@ var toDatasourceTypeWithValues = function toDatasourceTypeWithValues(_ref4) {
|
|
|
133
135
|
export var TableCellContent = function TableCellContent(_ref5) {
|
|
134
136
|
var id = _ref5.id,
|
|
135
137
|
columnKey = _ref5.columnKey,
|
|
138
|
+
columnTitle = _ref5.columnTitle,
|
|
136
139
|
columnType = _ref5.columnType,
|
|
137
140
|
renderItem = _ref5.renderItem,
|
|
138
141
|
wrappedColumnKeys = _ref5.wrappedColumnKeys;
|
|
@@ -148,6 +151,7 @@ export var TableCellContent = function TableCellContent(_ref5) {
|
|
|
148
151
|
return /*#__PURE__*/React.createElement(InlineEditableCell, {
|
|
149
152
|
ari: ari,
|
|
150
153
|
columnKey: columnKey,
|
|
154
|
+
columnTitle: columnTitle,
|
|
151
155
|
renderItem: renderItem,
|
|
152
156
|
integrationKey: integrationKey,
|
|
153
157
|
values: toDatasourceTypeWithValues({
|
|
@@ -167,6 +171,7 @@ export var TableCellContent = function TableCellContent(_ref5) {
|
|
|
167
171
|
}, /*#__PURE__*/React.createElement(ReadOnlyCell, {
|
|
168
172
|
id: id,
|
|
169
173
|
columnKey: columnKey,
|
|
174
|
+
columnTitle: columnTitle,
|
|
170
175
|
columnType: columnType,
|
|
171
176
|
wrappedColumnKeys: wrappedColumnKeys,
|
|
172
177
|
renderItem: renderItem
|
|
@@ -4,7 +4,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
7
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
8
9
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
9
10
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
10
11
|
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
@@ -15,6 +16,8 @@ import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
|
15
16
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
16
17
|
import { editType } from '../edit-type';
|
|
17
18
|
import { EmptyAvatar } from '../shared-components/avatar';
|
|
19
|
+
import { getFieldLabelById } from '../utils';
|
|
20
|
+
import { tableCellMessages } from './messages';
|
|
18
21
|
export var InlineEditUFOExperience = 'inline-edit-rendered';
|
|
19
22
|
var editContainerStyles = xcss({
|
|
20
23
|
marginBlockStart: 'space.negative.100'
|
|
@@ -33,6 +36,21 @@ var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
|
|
|
33
36
|
}
|
|
34
37
|
throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
|
|
35
38
|
};
|
|
39
|
+
var getCurrentFieldLabel = function getCurrentFieldLabel(typedNewValue) {
|
|
40
|
+
var _typedNewValue$values4, _typedNewValue$values5, _typedNewValue$values6;
|
|
41
|
+
switch (typedNewValue.type) {
|
|
42
|
+
case 'string':
|
|
43
|
+
return typedNewValue.values[0] || '';
|
|
44
|
+
case 'status':
|
|
45
|
+
return ((_typedNewValue$values4 = typedNewValue.values[0]) === null || _typedNewValue$values4 === void 0 ? void 0 : _typedNewValue$values4.text) || '';
|
|
46
|
+
case 'user':
|
|
47
|
+
return ((_typedNewValue$values5 = typedNewValue.values[0]) === null || _typedNewValue$values5 === void 0 ? void 0 : _typedNewValue$values5.displayName) || '';
|
|
48
|
+
case 'icon':
|
|
49
|
+
return ((_typedNewValue$values6 = typedNewValue.values[0]) === null || _typedNewValue$values6 === void 0 ? void 0 : _typedNewValue$values6.text) || '';
|
|
50
|
+
default:
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
};
|
|
36
54
|
var mapUpdatedItem = function mapUpdatedItem(existingItem, columnKey, newValue) {
|
|
37
55
|
switch (newValue.type) {
|
|
38
56
|
case 'string':
|
|
@@ -73,6 +91,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
73
91
|
executeFetch = _ref.executeFetch,
|
|
74
92
|
readView = _ref.readView,
|
|
75
93
|
columnKey = _ref.columnKey,
|
|
94
|
+
columnTitle = _ref.columnTitle,
|
|
76
95
|
datasourceTypeWithValues = _ref.datasourceTypeWithValues;
|
|
77
96
|
var _useState = useState(false),
|
|
78
97
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -143,13 +162,22 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
143
162
|
});
|
|
144
163
|
}
|
|
145
164
|
}, [columnKey, entityType, fireEvent, integrationKey]);
|
|
165
|
+
var _useIntl = useIntl(),
|
|
166
|
+
formatMessage = _useIntl.formatMessage;
|
|
167
|
+
var editButtonLabel = useMemo(function () {
|
|
168
|
+
return formatMessage(tableCellMessages.editButtonLabel, {
|
|
169
|
+
fieldName: columnTitle,
|
|
170
|
+
fieldValue: getCurrentFieldLabel(editValues)
|
|
171
|
+
});
|
|
172
|
+
}, [columnTitle, formatMessage, editValues]);
|
|
146
173
|
return /*#__PURE__*/React.createElement(Box, {
|
|
147
174
|
xcss: editContainerStyles
|
|
148
175
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
|
|
149
176
|
defaultValue: datasourceTypeWithValues,
|
|
150
177
|
currentValue: editValues,
|
|
151
178
|
setEditValues: setEditValues,
|
|
152
|
-
executeFetch: executeFetch
|
|
179
|
+
executeFetch: executeFetch,
|
|
180
|
+
labelId: getFieldLabelById(columnKey)
|
|
153
181
|
}), {
|
|
154
182
|
hideActionButtons: true,
|
|
155
183
|
readView: editableRenderType({
|
|
@@ -162,7 +190,8 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
162
190
|
onCancel: onCancelEdit,
|
|
163
191
|
onConfirm: function onConfirm() {
|
|
164
192
|
return onCommitUpdate(editValues);
|
|
165
|
-
}
|
|
193
|
+
},
|
|
194
|
+
editButtonLabel: editButtonLabel
|
|
166
195
|
})));
|
|
167
196
|
};
|
|
168
197
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export var tableCellMessages = defineMessages({
|
|
3
|
+
editButtonLabel: {
|
|
4
|
+
id: 'linkDataSource.issue-line-table.edit-button-label.non-final',
|
|
5
|
+
description: 'Label of inline editable field, used mostly for screen readers. This label is used to describe the field that is editable and can be changed. e.g John Doe, Assignee field',
|
|
6
|
+
defaultMessage: '{fieldValue}, {fieldName} field'
|
|
7
|
+
}
|
|
8
|
+
});
|