@atlaskit/link-datasource 2.9.8 → 2.10.1
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 +26 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +3 -2
- package/dist/cjs/ui/issue-like-table/edit-type/index.js +44 -0
- package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +18 -0
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +13 -4
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +47 -0
- package/dist/es2019/hooks/useDatasourceTableState.js +3 -2
- package/dist/es2019/ui/issue-like-table/edit-type/index.js +32 -0
- package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +9 -0
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +13 -4
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +28 -0
- package/dist/esm/hooks/useDatasourceTableState.js +3 -2
- package/dist/esm/ui/issue-like-table/edit-type/index.js +37 -0
- package/dist/esm/ui/issue-like-table/edit-type/text/index.js +11 -0
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +13 -4
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +37 -0
- package/dist/types/ui/issue-like-table/edit-type/index.d.ts +6 -0
- package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +6 -0
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +8 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +8 -0
- package/examples-helpers/buildIssueLikeTable.tsx +7 -2
- package/examples-helpers/buildJiraIssuesTable.tsx +3 -0
- package/package.json +16 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#128613](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128613)
|
|
8
|
+
[`43d20bcbd9423`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/43d20bcbd9423) -
|
|
9
|
+
[ux] Add text edit component behind FF
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.10.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#128347](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128347)
|
|
17
|
+
[`e33566cebd5d1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e33566cebd5d1) -
|
|
18
|
+
[ED-24175] bump @atlaskit/adf-schema to 40.8.1 and @atlassian/adf-schema-json to 1.22.0 to
|
|
19
|
+
promotecodeblocks & media in quotes, and nested expands in expands to full schema, and allow
|
|
20
|
+
quotes in panels and decisions in lists in stage0 schema, and a validator spec change
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#128149](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128149)
|
|
25
|
+
[`a57b769f35fdc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a57b769f35fdc) -
|
|
26
|
+
Add entityType to discoverActions request
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 2.9.8
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -320,11 +320,12 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
320
320
|
var _item$ari;
|
|
321
321
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [].concat((0, _toConsumableArray2.default)(acc), [item.ari.data]) : acc;
|
|
322
322
|
}, []);
|
|
323
|
-
if (aris.length) {
|
|
323
|
+
if (aris.length && _destinationObjectTypes.length) {
|
|
324
324
|
discoverActions({
|
|
325
325
|
aris: aris,
|
|
326
326
|
integrationKey: integrationKey,
|
|
327
|
-
fieldKeys: fieldKeys
|
|
327
|
+
fieldKeys: fieldKeys,
|
|
328
|
+
entityType: _destinationObjectTypes[0]
|
|
328
329
|
});
|
|
329
330
|
}
|
|
330
331
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isEditTypeSupported = exports.editType = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _text = _interopRequireDefault(require("./text"));
|
|
12
|
+
var _excluded = ["value"];
|
|
13
|
+
var editType = exports.editType = function editType(item) {
|
|
14
|
+
var _item$values$, _item$values;
|
|
15
|
+
switch (item.type) {
|
|
16
|
+
case 'string':
|
|
17
|
+
var stringValue = (_item$values$ = (_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values[0]) !== null && _item$values$ !== void 0 ? _item$values$ : '';
|
|
18
|
+
return {
|
|
19
|
+
defaultValue: stringValue,
|
|
20
|
+
editView: function editView(_ref) {
|
|
21
|
+
var value = _ref.value,
|
|
22
|
+
fieldProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_text.default, (0, _extends2.default)({}, fieldProps, {
|
|
24
|
+
value: value
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
default:
|
|
29
|
+
return {
|
|
30
|
+
defaultValue: '',
|
|
31
|
+
editView: function editView() {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var isEditTypeSupported = exports.isEditTypeSupported = function isEditTypeSupported(type) {
|
|
38
|
+
switch (type) {
|
|
39
|
+
case 'string':
|
|
40
|
+
return true;
|
|
41
|
+
default:
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
11
|
+
var TextEditType = function TextEditType(props) {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement(_textfield.default, (0, _extends2.default)({}, props, {
|
|
13
|
+
autoFocus: true,
|
|
14
|
+
isCompact: true,
|
|
15
|
+
testId: "inline-edit-text"
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
var _default = exports.default = TextEditType;
|
|
@@ -11,8 +11,10 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
11
11
|
var _primitives = require("@atlaskit/primitives");
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
13
|
var _state = require("../../../state");
|
|
14
|
+
var _editType = require("../edit-type");
|
|
14
15
|
var _renderType = require("../render-type");
|
|
15
16
|
var _truncateTextTag = require("../truncate-text-tag");
|
|
17
|
+
var _inlineEdit = require("./inline-edit");
|
|
16
18
|
var truncateTextStyles = (0, _primitives.xcss)({
|
|
17
19
|
textOverflow: 'ellipsis',
|
|
18
20
|
overflow: 'hidden',
|
|
@@ -87,6 +89,9 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
87
89
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
// Check if field is editable
|
|
93
|
+
var isEditable = (0, _editType.isEditTypeSupported)(columnType);
|
|
94
|
+
|
|
90
95
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
91
96
|
var value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
92
97
|
var values = Array.isArray(value) ? value : [value];
|
|
@@ -94,16 +99,20 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
94
99
|
type: columnType,
|
|
95
100
|
values: values
|
|
96
101
|
};
|
|
97
|
-
|
|
102
|
+
var readView = /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
|
|
98
103
|
columnKey: columnKey,
|
|
99
104
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
100
105
|
wrappedColumnKeys: wrappedColumnKeys
|
|
101
106
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
102
|
-
testId:
|
|
103
|
-
paddingInline: 'space.100',
|
|
104
|
-
paddingBlock:
|
|
107
|
+
testId: "inline-edit-read-view",
|
|
108
|
+
paddingInline: isEditable ? 'space.075' : 'space.100',
|
|
109
|
+
paddingBlock: "space.050",
|
|
105
110
|
xcss: truncateTextStyles
|
|
106
111
|
}, renderItem(datasourceTypeWithValues)));
|
|
112
|
+
return isEditable ? /*#__PURE__*/_react.default.createElement(_inlineEdit.InlineEdit, {
|
|
113
|
+
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
114
|
+
readView: readView
|
|
115
|
+
}) : readView;
|
|
107
116
|
};
|
|
108
117
|
var TableCellContent = exports.TableCellContent = function TableCellContent(_ref4) {
|
|
109
118
|
var columnKey = _ref4.columnKey,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.InlineEdit = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
|
|
13
|
+
var _primitives = require("@atlaskit/primitives");
|
|
14
|
+
var _editType = require("../edit-type");
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
var containerStyles = (0, _primitives.xcss)({
|
|
18
|
+
marginBlockStart: 'space.negative.100'
|
|
19
|
+
});
|
|
20
|
+
var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
21
|
+
var datasourceTypeWithValues = _ref.datasourceTypeWithValues,
|
|
22
|
+
_readView = _ref.readView;
|
|
23
|
+
var _useState = (0, _react.useState)(false),
|
|
24
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
+
isEditing = _useState2[0],
|
|
26
|
+
setIsEditing = _useState2[1];
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
28
|
+
xcss: containerStyles
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)(datasourceTypeWithValues), {
|
|
30
|
+
hideActionButtons: true,
|
|
31
|
+
readView: function readView() {
|
|
32
|
+
return _readView;
|
|
33
|
+
},
|
|
34
|
+
readViewFitContainerWidth: true,
|
|
35
|
+
isEditing: isEditing,
|
|
36
|
+
onEdit: function onEdit() {
|
|
37
|
+
return setIsEditing(true);
|
|
38
|
+
},
|
|
39
|
+
onCancel: function onCancel() {
|
|
40
|
+
return setIsEditing(false);
|
|
41
|
+
},
|
|
42
|
+
onConfirm: function onConfirm(value) {
|
|
43
|
+
setIsEditing(false);
|
|
44
|
+
// Save value back to the store
|
|
45
|
+
}
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
@@ -203,11 +203,12 @@ export const useDatasourceTableState = ({
|
|
|
203
203
|
var _item$ari;
|
|
204
204
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [...acc, item.ari.data] : acc;
|
|
205
205
|
}, []);
|
|
206
|
-
if (aris.length) {
|
|
206
|
+
if (aris.length && destinationObjectTypes.length) {
|
|
207
207
|
discoverActions({
|
|
208
208
|
aris,
|
|
209
209
|
integrationKey,
|
|
210
|
-
fieldKeys
|
|
210
|
+
fieldKeys,
|
|
211
|
+
entityType: destinationObjectTypes[0]
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
214
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import TextEditType from './text';
|
|
4
|
+
export const editType = item => {
|
|
5
|
+
var _item$values$, _item$values;
|
|
6
|
+
switch (item.type) {
|
|
7
|
+
case 'string':
|
|
8
|
+
const stringValue = (_item$values$ = (_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values[0]) !== null && _item$values$ !== void 0 ? _item$values$ : '';
|
|
9
|
+
return {
|
|
10
|
+
defaultValue: stringValue,
|
|
11
|
+
editView: ({
|
|
12
|
+
value,
|
|
13
|
+
...fieldProps
|
|
14
|
+
}) => /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
|
|
15
|
+
value: value
|
|
16
|
+
}))
|
|
17
|
+
};
|
|
18
|
+
default:
|
|
19
|
+
return {
|
|
20
|
+
defaultValue: '',
|
|
21
|
+
editView: () => /*#__PURE__*/React.createElement(React.Fragment, null)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const isEditTypeSupported = type => {
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 'string':
|
|
28
|
+
return true;
|
|
29
|
+
default:
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Textfield from '@atlaskit/textfield';
|
|
4
|
+
const TextEditType = props => /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
5
|
+
autoFocus: true,
|
|
6
|
+
isCompact: true,
|
|
7
|
+
testId: "inline-edit-text"
|
|
8
|
+
}));
|
|
9
|
+
export default TextEditType;
|
|
@@ -4,8 +4,10 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
4
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { useDatasourceItem } from '../../../state';
|
|
7
|
+
import { isEditTypeSupported } from '../edit-type';
|
|
7
8
|
import { stringifyType } from '../render-type';
|
|
8
9
|
import { TruncateTextTag } from '../truncate-text-tag';
|
|
10
|
+
import { InlineEdit } from './inline-edit';
|
|
9
11
|
const truncateTextStyles = xcss({
|
|
10
12
|
textOverflow: 'ellipsis',
|
|
11
13
|
overflow: 'hidden',
|
|
@@ -79,6 +81,9 @@ const InlineEditableCell = ({
|
|
|
79
81
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
80
82
|
}
|
|
81
83
|
|
|
84
|
+
// Check if field is editable
|
|
85
|
+
const isEditable = isEditTypeSupported(columnType);
|
|
86
|
+
|
|
82
87
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
83
88
|
const value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
84
89
|
const values = Array.isArray(value) ? value : [value];
|
|
@@ -86,16 +91,20 @@ const InlineEditableCell = ({
|
|
|
86
91
|
type: columnType,
|
|
87
92
|
values
|
|
88
93
|
};
|
|
89
|
-
|
|
94
|
+
const readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
|
|
90
95
|
columnKey: columnKey,
|
|
91
96
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
92
97
|
wrappedColumnKeys: wrappedColumnKeys
|
|
93
98
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
94
|
-
testId:
|
|
95
|
-
paddingInline: 'space.100',
|
|
96
|
-
paddingBlock:
|
|
99
|
+
testId: "inline-edit-read-view",
|
|
100
|
+
paddingInline: isEditable ? 'space.075' : 'space.100',
|
|
101
|
+
paddingBlock: "space.050",
|
|
97
102
|
xcss: truncateTextStyles
|
|
98
103
|
}, renderItem(datasourceTypeWithValues)));
|
|
104
|
+
return isEditable ? /*#__PURE__*/React.createElement(InlineEdit, {
|
|
105
|
+
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
106
|
+
readView: readView
|
|
107
|
+
}) : readView;
|
|
99
108
|
};
|
|
100
109
|
export const TableCellContent = ({
|
|
101
110
|
columnKey,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
4
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { editType } from '../edit-type';
|
|
6
|
+
const containerStyles = xcss({
|
|
7
|
+
marginBlockStart: 'space.negative.100'
|
|
8
|
+
});
|
|
9
|
+
export const InlineEdit = ({
|
|
10
|
+
datasourceTypeWithValues,
|
|
11
|
+
readView
|
|
12
|
+
}) => {
|
|
13
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
14
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
15
|
+
xcss: containerStyles
|
|
16
|
+
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
17
|
+
hideActionButtons: true,
|
|
18
|
+
readView: () => readView,
|
|
19
|
+
readViewFitContainerWidth: true,
|
|
20
|
+
isEditing: isEditing,
|
|
21
|
+
onEdit: () => setIsEditing(true),
|
|
22
|
+
onCancel: () => setIsEditing(false),
|
|
23
|
+
onConfirm: value => {
|
|
24
|
+
setIsEditing(false);
|
|
25
|
+
// Save value back to the store
|
|
26
|
+
}
|
|
27
|
+
})));
|
|
28
|
+
};
|
|
@@ -313,11 +313,12 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
313
313
|
var _item$ari;
|
|
314
314
|
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [].concat(_toConsumableArray(acc), [item.ari.data]) : acc;
|
|
315
315
|
}, []);
|
|
316
|
-
if (aris.length) {
|
|
316
|
+
if (aris.length && _destinationObjectTypes.length) {
|
|
317
317
|
discoverActions({
|
|
318
318
|
aris: aris,
|
|
319
319
|
integrationKey: integrationKey,
|
|
320
|
-
fieldKeys: fieldKeys
|
|
320
|
+
fieldKeys: fieldKeys,
|
|
321
|
+
entityType: _destinationObjectTypes[0]
|
|
321
322
|
});
|
|
322
323
|
}
|
|
323
324
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["value"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import TextEditType from './text';
|
|
6
|
+
export var editType = function editType(item) {
|
|
7
|
+
var _item$values$, _item$values;
|
|
8
|
+
switch (item.type) {
|
|
9
|
+
case 'string':
|
|
10
|
+
var stringValue = (_item$values$ = (_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values[0]) !== null && _item$values$ !== void 0 ? _item$values$ : '';
|
|
11
|
+
return {
|
|
12
|
+
defaultValue: stringValue,
|
|
13
|
+
editView: function editView(_ref) {
|
|
14
|
+
var value = _ref.value,
|
|
15
|
+
fieldProps = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
|
|
17
|
+
value: value
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
default:
|
|
22
|
+
return {
|
|
23
|
+
defaultValue: '',
|
|
24
|
+
editView: function editView() {
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export var isEditTypeSupported = function isEditTypeSupported(type) {
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'string':
|
|
33
|
+
return true;
|
|
34
|
+
default:
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Textfield from '@atlaskit/textfield';
|
|
4
|
+
var TextEditType = function TextEditType(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(Textfield, _extends({}, props, {
|
|
6
|
+
autoFocus: true,
|
|
7
|
+
isCompact: true,
|
|
8
|
+
testId: "inline-edit-text"
|
|
9
|
+
}));
|
|
10
|
+
};
|
|
11
|
+
export default TextEditType;
|
|
@@ -4,8 +4,10 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
4
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { useDatasourceItem } from '../../../state';
|
|
7
|
+
import { isEditTypeSupported } from '../edit-type';
|
|
7
8
|
import { stringifyType } from '../render-type';
|
|
8
9
|
import { TruncateTextTag } from '../truncate-text-tag';
|
|
10
|
+
import { InlineEdit } from './inline-edit';
|
|
9
11
|
var truncateTextStyles = xcss({
|
|
10
12
|
textOverflow: 'ellipsis',
|
|
11
13
|
overflow: 'hidden',
|
|
@@ -80,6 +82,9 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
80
82
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
81
83
|
}
|
|
82
84
|
|
|
85
|
+
// Check if field is editable
|
|
86
|
+
var isEditable = isEditTypeSupported(columnType);
|
|
87
|
+
|
|
83
88
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
84
89
|
var value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
85
90
|
var values = Array.isArray(value) ? value : [value];
|
|
@@ -87,16 +92,20 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
87
92
|
type: columnType,
|
|
88
93
|
values: values
|
|
89
94
|
};
|
|
90
|
-
|
|
95
|
+
var readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
|
|
91
96
|
columnKey: columnKey,
|
|
92
97
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
93
98
|
wrappedColumnKeys: wrappedColumnKeys
|
|
94
99
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
95
|
-
testId:
|
|
96
|
-
paddingInline: 'space.100',
|
|
97
|
-
paddingBlock:
|
|
100
|
+
testId: "inline-edit-read-view",
|
|
101
|
+
paddingInline: isEditable ? 'space.075' : 'space.100',
|
|
102
|
+
paddingBlock: "space.050",
|
|
98
103
|
xcss: truncateTextStyles
|
|
99
104
|
}, renderItem(datasourceTypeWithValues)));
|
|
105
|
+
return isEditable ? /*#__PURE__*/React.createElement(InlineEdit, {
|
|
106
|
+
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
107
|
+
readView: readView
|
|
108
|
+
}) : readView;
|
|
100
109
|
};
|
|
101
110
|
export var TableCellContent = function TableCellContent(_ref4) {
|
|
102
111
|
var columnKey = _ref4.columnKey,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
5
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
6
|
+
import { editType } from '../edit-type';
|
|
7
|
+
var containerStyles = xcss({
|
|
8
|
+
marginBlockStart: 'space.negative.100'
|
|
9
|
+
});
|
|
10
|
+
export var InlineEdit = function InlineEdit(_ref) {
|
|
11
|
+
var datasourceTypeWithValues = _ref.datasourceTypeWithValues,
|
|
12
|
+
_readView = _ref.readView;
|
|
13
|
+
var _useState = useState(false),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
isEditing = _useState2[0],
|
|
16
|
+
setIsEditing = _useState2[1];
|
|
17
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
xcss: containerStyles
|
|
19
|
+
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
20
|
+
hideActionButtons: true,
|
|
21
|
+
readView: function readView() {
|
|
22
|
+
return _readView;
|
|
23
|
+
},
|
|
24
|
+
readViewFitContainerWidth: true,
|
|
25
|
+
isEditing: isEditing,
|
|
26
|
+
onEdit: function onEdit() {
|
|
27
|
+
return setIsEditing(true);
|
|
28
|
+
},
|
|
29
|
+
onCancel: function onCancel() {
|
|
30
|
+
return setIsEditing(false);
|
|
31
|
+
},
|
|
32
|
+
onConfirm: function onConfirm(value) {
|
|
33
|
+
setIsEditing(false);
|
|
34
|
+
// Save value back to the store
|
|
35
|
+
}
|
|
36
|
+
})));
|
|
37
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type InlineEdit from '@atlaskit/inline-edit';
|
|
3
|
+
import type { DatasourceType } from '@atlaskit/linking-types';
|
|
4
|
+
import { type DatasourceTypeWithOnlyValues } from '../types';
|
|
5
|
+
export declare const editType: (item: DatasourceTypeWithOnlyValues) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
|
|
6
|
+
export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
3
|
+
interface InlineEditProps {
|
|
4
|
+
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
5
|
+
readView: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const InlineEdit: ({ datasourceTypeWithValues, readView }: InlineEditProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type InlineEdit from '@atlaskit/inline-edit';
|
|
3
|
+
import type { DatasourceType } from '@atlaskit/linking-types';
|
|
4
|
+
import { type DatasourceTypeWithOnlyValues } from '../types';
|
|
5
|
+
export declare const editType: (item: DatasourceTypeWithOnlyValues) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
|
|
6
|
+
export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
3
|
+
interface InlineEditProps {
|
|
4
|
+
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
5
|
+
readView: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const InlineEdit: ({ datasourceTypeWithValues, readView }: InlineEditProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -70,7 +70,13 @@ const ExampleBody = ({ isReadonly, canResizeColumns = true, canControlWrapping =
|
|
|
70
70
|
onColumnResize,
|
|
71
71
|
wrappedColumnKeys,
|
|
72
72
|
onWrappedColumnChange,
|
|
73
|
-
} = useCommonTableProps(
|
|
73
|
+
} = useCommonTableProps({
|
|
74
|
+
defaultColumnCustomSizes: {
|
|
75
|
+
summary: 180,
|
|
76
|
+
link: 350,
|
|
77
|
+
labels: 100,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
74
80
|
|
|
75
81
|
useEffect(() => {
|
|
76
82
|
if (visibleColumnKeys.length === 0 && defaultVisibleColumnKeys.length > 0) {
|
|
@@ -108,7 +114,6 @@ export const ExampleIssueLikeTable = ({
|
|
|
108
114
|
isReadonly,
|
|
109
115
|
canResizeColumns,
|
|
110
116
|
canControlWrapping,
|
|
111
|
-
skipIntl,
|
|
112
117
|
}: Props) => {
|
|
113
118
|
return (
|
|
114
119
|
<DatasourceExperienceIdProvider>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,40 +35,41 @@
|
|
|
35
35
|
"analytics:codegen": "yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource --output ./src/analytics/generated"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@atlaskit/adf-schema": "^40.
|
|
38
|
+
"@atlaskit/adf-schema": "^40.8.1",
|
|
39
39
|
"@atlaskit/analytics-next": "^10.0.0",
|
|
40
|
-
"@atlaskit/avatar": "^21.
|
|
41
|
-
"@atlaskit/avatar-group": "^9.
|
|
40
|
+
"@atlaskit/avatar": "^21.13.0",
|
|
41
|
+
"@atlaskit/avatar-group": "^9.10.0",
|
|
42
42
|
"@atlaskit/badge": "^16.3.0",
|
|
43
43
|
"@atlaskit/button": "^19.1.0",
|
|
44
44
|
"@atlaskit/datetime-picker": "^13.8.0",
|
|
45
|
-
"@atlaskit/dropdown-menu": "^12.
|
|
45
|
+
"@atlaskit/dropdown-menu": "^12.16.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
47
47
|
"@atlaskit/empty-state": "^7.10.0",
|
|
48
48
|
"@atlaskit/form": "^10.4.0",
|
|
49
49
|
"@atlaskit/heading": "^2.4.0",
|
|
50
|
-
"@atlaskit/icon": "^22.
|
|
50
|
+
"@atlaskit/icon": "^22.11.0",
|
|
51
51
|
"@atlaskit/icon-object": "^6.4.0",
|
|
52
52
|
"@atlaskit/image": "^1.3.0",
|
|
53
|
+
"@atlaskit/inline-edit": "^13.5.0",
|
|
53
54
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
54
55
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
55
|
-
"@atlaskit/jql-editor": "^4.
|
|
56
|
+
"@atlaskit/jql-editor": "^4.5.0",
|
|
56
57
|
"@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
|
|
57
|
-
"@atlaskit/link-client-extension": "^
|
|
58
|
+
"@atlaskit/link-client-extension": "^2.0.0",
|
|
58
59
|
"@atlaskit/linking-common": "^5.9.0",
|
|
59
|
-
"@atlaskit/linking-types": "^
|
|
60
|
+
"@atlaskit/linking-types": "^9.0.0",
|
|
60
61
|
"@atlaskit/logo": "^14.1.0",
|
|
61
62
|
"@atlaskit/lozenge": "^11.9.0",
|
|
62
63
|
"@atlaskit/modal-dialog": "^12.14.0",
|
|
63
64
|
"@atlaskit/outbound-auth-flow-client": "^3.4.5",
|
|
64
65
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
65
|
-
"@atlaskit/popup": "^1.
|
|
66
|
-
"@atlaskit/pragmatic-drag-and-drop": "^1.
|
|
66
|
+
"@atlaskit/popup": "^1.21.0",
|
|
67
|
+
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
67
68
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
68
69
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
|
|
69
70
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
70
|
-
"@atlaskit/primitives": "^
|
|
71
|
-
"@atlaskit/select": "^17.
|
|
71
|
+
"@atlaskit/primitives": "^12.0.0",
|
|
72
|
+
"@atlaskit/select": "^17.12.0",
|
|
72
73
|
"@atlaskit/smart-card": "^27.13.0",
|
|
73
74
|
"@atlaskit/smart-user-picker": "6.10.1",
|
|
74
75
|
"@atlaskit/spinner": "^16.2.0",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"@atlaskit/textfield": "6.4.3",
|
|
77
78
|
"@atlaskit/theme": "^12.11.0",
|
|
78
79
|
"@atlaskit/tokens": "^1.57.0",
|
|
79
|
-
"@atlaskit/tooltip": "^18.
|
|
80
|
+
"@atlaskit/tooltip": "^18.6.0",
|
|
80
81
|
"@atlaskit/ufo": "^0.2.4",
|
|
81
82
|
"@atlaskit/width-detector": "^4.2.0",
|
|
82
83
|
"@babel/runtime": "^7.0.0",
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
"@af/integration-testing": "*",
|
|
99
100
|
"@af/visual-regression": "*",
|
|
100
101
|
"@atlaskit/link-provider": "^1.14.0",
|
|
101
|
-
"@atlaskit/link-test-helpers": "^7.
|
|
102
|
+
"@atlaskit/link-test-helpers": "^7.3.0",
|
|
102
103
|
"@atlaskit/ssr": "*",
|
|
103
104
|
"@atlaskit/visual-regression": "*",
|
|
104
105
|
"@atlassian/feature-flags-test-utils": "^0.2.0",
|