@atlaskit/link-datasource 2.10.1 → 2.10.3
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 +15 -0
- package/dist/cjs/state/actions/index.js +2 -2
- package/dist/cjs/state/index.js +29 -11
- package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +13 -5
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +50 -5
- package/dist/es2019/state/actions/index.js +2 -2
- package/dist/es2019/state/index.js +26 -4
- package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +15 -5
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +52 -5
- package/dist/esm/state/actions/index.js +2 -2
- package/dist/esm/state/index.js +29 -11
- package/dist/esm/ui/issue-like-table/table-cell-content/index.js +13 -5
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +51 -6
- package/dist/types/state/actions/index.d.ts +4 -2
- package/dist/types/state/index.d.ts +10 -5
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +3 -1
- package/dist/types-ts4.5/state/actions/index.d.ts +4 -2
- package/dist/types-ts4.5/state/index.d.ts +10 -5
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +3 -1
- package/package.json +31 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 2.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#129411](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/129411)
|
|
8
|
+
[`63af9b6ab2314`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/63af9b6ab2314) -
|
|
9
|
+
[ux] Add text edit component behind FF
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.10.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.10.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -163,7 +163,7 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
|
|
|
163
163
|
if (!schema) {
|
|
164
164
|
throw new Error('No action schema found.');
|
|
165
165
|
}
|
|
166
|
-
executeAction({
|
|
166
|
+
return executeAction({
|
|
167
167
|
integrationKey: integrationKey,
|
|
168
168
|
actionKey: schema.actionKey,
|
|
169
169
|
parameters: {
|
|
@@ -175,7 +175,7 @@ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecut
|
|
|
175
175
|
});
|
|
176
176
|
}, [executeAction, integrationKey, schema, fieldKey, ari]);
|
|
177
177
|
if (!schema) {
|
|
178
|
-
return
|
|
178
|
+
return {};
|
|
179
179
|
}
|
|
180
180
|
return {
|
|
181
181
|
execute: execute
|
package/dist/cjs/state/index.js
CHANGED
|
@@ -20,19 +20,38 @@ var getInitialState = function getInitialState() {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
var actions = exports.actions = {
|
|
23
|
-
|
|
23
|
+
onUpdateItem: function onUpdateItem(id, data) {
|
|
24
24
|
return function (_ref) {
|
|
25
25
|
var setState = _ref.setState,
|
|
26
26
|
getState = _ref.getState;
|
|
27
27
|
var oldItems = _objectSpread({}, getState().items);
|
|
28
|
-
var
|
|
28
|
+
var oldItem = oldItems[id];
|
|
29
|
+
if (!oldItem) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setState({
|
|
33
|
+
items: _objectSpread(_objectSpread({}, oldItems), {}, (0, _defineProperty2.default)({}, id, _objectSpread(_objectSpread({}, oldItem), {}, {
|
|
34
|
+
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
35
|
+
ari: oldItem.data.ari
|
|
36
|
+
})
|
|
37
|
+
})))
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
onAddItems: function onAddItems(items, integrationKey) {
|
|
42
|
+
return function (_ref2) {
|
|
43
|
+
var setState = _ref2.setState,
|
|
44
|
+
getState = _ref2.getState;
|
|
45
|
+
var oldItems = _objectSpread({}, getState().items);
|
|
46
|
+
var _items$reduce = items.reduce(function (_ref3, item) {
|
|
29
47
|
var _item$ari, _oldItems$id;
|
|
30
|
-
var
|
|
31
|
-
ids =
|
|
32
|
-
itemMap =
|
|
48
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
49
|
+
ids = _ref4[0],
|
|
50
|
+
itemMap = _ref4[1];
|
|
33
51
|
var ari = typeof ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? item['ari'].data : undefined;
|
|
34
52
|
var id = ari !== null && ari !== void 0 ? ari : (0, _uuid.v4)();
|
|
35
53
|
return [[].concat((0, _toConsumableArray2.default)(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, (0, _defineProperty2.default)({}, id, {
|
|
54
|
+
ari: ari,
|
|
36
55
|
integrationKey: integrationKey,
|
|
37
56
|
data: _objectSpread(_objectSpread({}, (_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data), item)
|
|
38
57
|
}))];
|
|
@@ -53,16 +72,15 @@ var Store = exports.Store = (0, _reactSweetState.createStore)({
|
|
|
53
72
|
actions: actions
|
|
54
73
|
});
|
|
55
74
|
var useDatasourceItem = exports.useDatasourceItem = (0, _reactSweetState.createStateHook)(Store, {
|
|
56
|
-
selector: function selector(state,
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
return (_state$items$id = state.items[id]) === null || _state$items$id === void 0 ? void 0 : _state$items$id.data;
|
|
75
|
+
selector: function selector(state, _ref5) {
|
|
76
|
+
var id = _ref5.id;
|
|
77
|
+
return state.items[id];
|
|
60
78
|
}
|
|
61
79
|
});
|
|
62
80
|
var useDatasourceActions = exports.useDatasourceActions = (0, _reactSweetState.createActionsHook)(Store);
|
|
63
81
|
var Container = (0, _reactSweetState.createContainer)(Store);
|
|
64
|
-
var StoreContainer = exports.StoreContainer = function StoreContainer(
|
|
65
|
-
var children =
|
|
82
|
+
var StoreContainer = exports.StoreContainer = function StoreContainer(_ref6) {
|
|
83
|
+
var children = _ref6.children;
|
|
66
84
|
if ((0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state')) {
|
|
67
85
|
return /*#__PURE__*/_react.default.createElement(Container, {
|
|
68
86
|
scope: "datasource"
|
|
@@ -48,16 +48,16 @@ var TooltipWrapper = function TooltipWrapper(_ref) {
|
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
49
49
|
};
|
|
50
50
|
var ReadOnlyCell = function ReadOnlyCell(_ref2) {
|
|
51
|
-
var _rowData$columnKey;
|
|
51
|
+
var _useDatasourceItem, _rowData$columnKey;
|
|
52
52
|
var id = _ref2.id,
|
|
53
53
|
columnType = _ref2.columnType,
|
|
54
54
|
_ref2$wrappedColumnKe = _ref2.wrappedColumnKeys,
|
|
55
55
|
wrappedColumnKeys = _ref2$wrappedColumnKe === void 0 ? [] : _ref2$wrappedColumnKe,
|
|
56
56
|
renderItem = _ref2.renderItem,
|
|
57
57
|
columnKey = _ref2.columnKey;
|
|
58
|
-
var rowData = (0, _state.useDatasourceItem)({
|
|
58
|
+
var rowData = (_useDatasourceItem = (0, _state.useDatasourceItem)({
|
|
59
59
|
id: id
|
|
60
|
-
});
|
|
60
|
+
})) === null || _useDatasourceItem === void 0 ? void 0 : _useDatasourceItem.data;
|
|
61
61
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
62
62
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
63
63
|
}
|
|
@@ -82,15 +82,21 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
82
82
|
columnType = _ref3.columnType,
|
|
83
83
|
renderItem = _ref3.renderItem,
|
|
84
84
|
wrappedColumnKeys = _ref3.wrappedColumnKeys;
|
|
85
|
-
var
|
|
85
|
+
var item = (0, _state.useDatasourceItem)({
|
|
86
86
|
id: id
|
|
87
87
|
});
|
|
88
|
+
if (!item) {
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
90
|
+
}
|
|
91
|
+
var rowData = item.data,
|
|
92
|
+
integrationKey = item.integrationKey,
|
|
93
|
+
ari = item.ari;
|
|
88
94
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
89
95
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
// Check if field is editable
|
|
93
|
-
var isEditable = (0, _editType.isEditTypeSupported)(columnType);
|
|
99
|
+
var isEditable = !!ari && !!integrationKey && (0, _editType.isEditTypeSupported)(columnType);
|
|
94
100
|
|
|
95
101
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
96
102
|
var value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
@@ -110,6 +116,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
110
116
|
xcss: truncateTextStyles
|
|
111
117
|
}, renderItem(datasourceTypeWithValues)));
|
|
112
118
|
return isEditable ? /*#__PURE__*/_react.default.createElement(_inlineEdit.InlineEdit, {
|
|
119
|
+
ari: ari,
|
|
120
|
+
columnKey: columnKey,
|
|
113
121
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
114
122
|
readView: readView
|
|
115
123
|
}) : readView;
|
|
@@ -8,22 +8,70 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.InlineEdit = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
|
|
13
14
|
var _primitives = require("@atlaskit/primitives");
|
|
15
|
+
var _state = require("../../../state");
|
|
16
|
+
var _actions = require("../../../state/actions");
|
|
14
17
|
var _editType = require("../edit-type");
|
|
15
18
|
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
19
|
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
17
22
|
var containerStyles = (0, _primitives.xcss)({
|
|
18
23
|
marginBlockStart: 'space.negative.100'
|
|
19
24
|
});
|
|
25
|
+
var mapUpdatedItem = function mapUpdatedItem(type, existingItem, columnKey, newValue) {
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 'string':
|
|
28
|
+
return _objectSpread(_objectSpread({}, existingItem), {}, (0, _defineProperty2.default)({}, columnKey, {
|
|
29
|
+
data: newValue
|
|
30
|
+
}));
|
|
31
|
+
default:
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
20
35
|
var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
21
|
-
var
|
|
36
|
+
var _item$integrationKey;
|
|
37
|
+
var ari = _ref.ari,
|
|
38
|
+
columnKey = _ref.columnKey,
|
|
39
|
+
datasourceTypeWithValues = _ref.datasourceTypeWithValues,
|
|
22
40
|
_readView = _ref.readView;
|
|
23
41
|
var _useState = (0, _react.useState)(false),
|
|
24
42
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
43
|
isEditing = _useState2[0],
|
|
26
44
|
setIsEditing = _useState2[1];
|
|
45
|
+
var item = (0, _state.useDatasourceItem)({
|
|
46
|
+
id: ari
|
|
47
|
+
});
|
|
48
|
+
var _useDatasourceActions = (0, _state.useDatasourceActions)(),
|
|
49
|
+
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
50
|
+
var _useExecuteAtomicActi = (0, _actions.useExecuteAtomicAction)({
|
|
51
|
+
ari: ari,
|
|
52
|
+
fieldKey: columnKey,
|
|
53
|
+
integrationKey: (_item$integrationKey = item === null || item === void 0 ? void 0 : item.integrationKey) !== null && _item$integrationKey !== void 0 ? _item$integrationKey : ''
|
|
54
|
+
}),
|
|
55
|
+
execute = _useExecuteAtomicActi.execute;
|
|
56
|
+
var onCommitUpdate = (0, _react.useCallback)(function (value) {
|
|
57
|
+
if (!execute || !item) {
|
|
58
|
+
setIsEditing(false);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
var existingData = item.data;
|
|
62
|
+
var newItem = mapUpdatedItem(datasourceTypeWithValues.type, item.data, columnKey, value);
|
|
63
|
+
if (!newItem) {
|
|
64
|
+
setIsEditing(false);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
onUpdateItem(ari, newItem);
|
|
68
|
+
execute(value).catch(function (error) {
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.error(error);
|
|
71
|
+
onUpdateItem(ari, existingData);
|
|
72
|
+
});
|
|
73
|
+
setIsEditing(false);
|
|
74
|
+
}, [ari, execute, datasourceTypeWithValues, item, columnKey, onUpdateItem]);
|
|
27
75
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
28
76
|
xcss: containerStyles
|
|
29
77
|
}, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)(datasourceTypeWithValues), {
|
|
@@ -39,9 +87,6 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
39
87
|
onCancel: function onCancel() {
|
|
40
88
|
return setIsEditing(false);
|
|
41
89
|
},
|
|
42
|
-
onConfirm:
|
|
43
|
-
setIsEditing(false);
|
|
44
|
-
// Save value back to the store
|
|
45
|
-
}
|
|
90
|
+
onConfirm: onCommitUpdate
|
|
46
91
|
})));
|
|
47
92
|
};
|
|
@@ -144,7 +144,7 @@ export const useExecuteAtomicAction = ({
|
|
|
144
144
|
if (!schema) {
|
|
145
145
|
throw new Error('No action schema found.');
|
|
146
146
|
}
|
|
147
|
-
executeAction({
|
|
147
|
+
return executeAction({
|
|
148
148
|
integrationKey,
|
|
149
149
|
actionKey: schema.actionKey,
|
|
150
150
|
parameters: {
|
|
@@ -158,7 +158,7 @@ export const useExecuteAtomicAction = ({
|
|
|
158
158
|
});
|
|
159
159
|
}, [executeAction, integrationKey, schema, fieldKey, ari]);
|
|
160
160
|
if (!schema) {
|
|
161
|
-
return
|
|
161
|
+
return {};
|
|
162
162
|
}
|
|
163
163
|
return {
|
|
164
164
|
execute
|
|
@@ -6,6 +6,30 @@ const getInitialState = () => ({
|
|
|
6
6
|
items: {}
|
|
7
7
|
});
|
|
8
8
|
export const actions = {
|
|
9
|
+
onUpdateItem: (id, data) => ({
|
|
10
|
+
setState,
|
|
11
|
+
getState
|
|
12
|
+
}) => {
|
|
13
|
+
const oldItems = {
|
|
14
|
+
...getState().items
|
|
15
|
+
};
|
|
16
|
+
const oldItem = oldItems[id];
|
|
17
|
+
if (!oldItem) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
setState({
|
|
21
|
+
items: {
|
|
22
|
+
...oldItems,
|
|
23
|
+
[id]: {
|
|
24
|
+
...oldItem,
|
|
25
|
+
data: {
|
|
26
|
+
...data,
|
|
27
|
+
ari: oldItem.data.ari
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
9
33
|
onAddItems: (items, integrationKey) => ({
|
|
10
34
|
setState,
|
|
11
35
|
getState
|
|
@@ -20,6 +44,7 @@ export const actions = {
|
|
|
20
44
|
return [[...ids, id], {
|
|
21
45
|
...itemMap,
|
|
22
46
|
[id]: {
|
|
47
|
+
ari,
|
|
23
48
|
integrationKey,
|
|
24
49
|
data: {
|
|
25
50
|
...((_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data),
|
|
@@ -42,10 +67,7 @@ export const Store = createStore({
|
|
|
42
67
|
export const useDatasourceItem = createStateHook(Store, {
|
|
43
68
|
selector: (state, {
|
|
44
69
|
id
|
|
45
|
-
}) =>
|
|
46
|
-
var _state$items$id;
|
|
47
|
-
return (_state$items$id = state.items[id]) === null || _state$items$id === void 0 ? void 0 : _state$items$id.data;
|
|
48
|
-
}
|
|
70
|
+
}) => state.items[id]
|
|
49
71
|
});
|
|
50
72
|
export const useDatasourceActions = createActionsHook(Store);
|
|
51
73
|
const Container = createContainer(Store);
|
|
@@ -45,10 +45,10 @@ const ReadOnlyCell = ({
|
|
|
45
45
|
renderItem,
|
|
46
46
|
columnKey
|
|
47
47
|
}) => {
|
|
48
|
-
var _rowData$columnKey;
|
|
49
|
-
const rowData = useDatasourceItem({
|
|
48
|
+
var _useDatasourceItem, _rowData$columnKey;
|
|
49
|
+
const rowData = (_useDatasourceItem = useDatasourceItem({
|
|
50
50
|
id
|
|
51
|
-
});
|
|
51
|
+
})) === null || _useDatasourceItem === void 0 ? void 0 : _useDatasourceItem.data;
|
|
52
52
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
53
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
54
54
|
}
|
|
@@ -74,15 +74,23 @@ const InlineEditableCell = ({
|
|
|
74
74
|
wrappedColumnKeys
|
|
75
75
|
}) => {
|
|
76
76
|
var _rowData$columnKey2;
|
|
77
|
-
const
|
|
77
|
+
const item = useDatasourceItem({
|
|
78
78
|
id
|
|
79
79
|
});
|
|
80
|
+
if (!item) {
|
|
81
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
82
|
+
}
|
|
83
|
+
const {
|
|
84
|
+
data: rowData,
|
|
85
|
+
integrationKey,
|
|
86
|
+
ari
|
|
87
|
+
} = item;
|
|
80
88
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
81
89
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
// Check if field is editable
|
|
85
|
-
const isEditable = isEditTypeSupported(columnType);
|
|
93
|
+
const isEditable = !!ari && !!integrationKey && isEditTypeSupported(columnType);
|
|
86
94
|
|
|
87
95
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
88
96
|
const value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
@@ -102,6 +110,8 @@ const InlineEditableCell = ({
|
|
|
102
110
|
xcss: truncateTextStyles
|
|
103
111
|
}, renderItem(datasourceTypeWithValues)));
|
|
104
112
|
return isEditable ? /*#__PURE__*/React.createElement(InlineEdit, {
|
|
113
|
+
ari: ari,
|
|
114
|
+
columnKey: columnKey,
|
|
105
115
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
106
116
|
readView: readView
|
|
107
117
|
}) : readView;
|
|
@@ -1,16 +1,66 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
4
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
6
|
+
import { useExecuteAtomicAction } from '../../../state/actions';
|
|
5
7
|
import { editType } from '../edit-type';
|
|
6
8
|
const containerStyles = xcss({
|
|
7
9
|
marginBlockStart: 'space.negative.100'
|
|
8
10
|
});
|
|
11
|
+
const mapUpdatedItem = (type, existingItem, columnKey, newValue) => {
|
|
12
|
+
switch (type) {
|
|
13
|
+
case 'string':
|
|
14
|
+
return {
|
|
15
|
+
...existingItem,
|
|
16
|
+
[columnKey]: {
|
|
17
|
+
data: newValue
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
default:
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
9
24
|
export const InlineEdit = ({
|
|
25
|
+
ari,
|
|
26
|
+
columnKey,
|
|
10
27
|
datasourceTypeWithValues,
|
|
11
28
|
readView
|
|
12
29
|
}) => {
|
|
30
|
+
var _item$integrationKey;
|
|
13
31
|
const [isEditing, setIsEditing] = useState(false);
|
|
32
|
+
const item = useDatasourceItem({
|
|
33
|
+
id: ari
|
|
34
|
+
});
|
|
35
|
+
const {
|
|
36
|
+
onUpdateItem
|
|
37
|
+
} = useDatasourceActions();
|
|
38
|
+
const {
|
|
39
|
+
execute
|
|
40
|
+
} = useExecuteAtomicAction({
|
|
41
|
+
ari,
|
|
42
|
+
fieldKey: columnKey,
|
|
43
|
+
integrationKey: (_item$integrationKey = item === null || item === void 0 ? void 0 : item.integrationKey) !== null && _item$integrationKey !== void 0 ? _item$integrationKey : ''
|
|
44
|
+
});
|
|
45
|
+
const onCommitUpdate = useCallback(value => {
|
|
46
|
+
if (!execute || !item) {
|
|
47
|
+
setIsEditing(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const existingData = item.data;
|
|
51
|
+
const newItem = mapUpdatedItem(datasourceTypeWithValues.type, item.data, columnKey, value);
|
|
52
|
+
if (!newItem) {
|
|
53
|
+
setIsEditing(false);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onUpdateItem(ari, newItem);
|
|
57
|
+
execute(value).catch(error => {
|
|
58
|
+
// eslint-disable-next-line no-console
|
|
59
|
+
console.error(error);
|
|
60
|
+
onUpdateItem(ari, existingData);
|
|
61
|
+
});
|
|
62
|
+
setIsEditing(false);
|
|
63
|
+
}, [ari, execute, datasourceTypeWithValues, item, columnKey, onUpdateItem]);
|
|
14
64
|
return /*#__PURE__*/React.createElement(Box, {
|
|
15
65
|
xcss: containerStyles
|
|
16
66
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -20,9 +70,6 @@ export const InlineEdit = ({
|
|
|
20
70
|
isEditing: isEditing,
|
|
21
71
|
onEdit: () => setIsEditing(true),
|
|
22
72
|
onCancel: () => setIsEditing(false),
|
|
23
|
-
onConfirm:
|
|
24
|
-
setIsEditing(false);
|
|
25
|
-
// Save value back to the store
|
|
26
|
-
}
|
|
73
|
+
onConfirm: onCommitUpdate
|
|
27
74
|
})));
|
|
28
75
|
};
|
|
@@ -157,7 +157,7 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref4) {
|
|
|
157
157
|
if (!schema) {
|
|
158
158
|
throw new Error('No action schema found.');
|
|
159
159
|
}
|
|
160
|
-
executeAction({
|
|
160
|
+
return executeAction({
|
|
161
161
|
integrationKey: integrationKey,
|
|
162
162
|
actionKey: schema.actionKey,
|
|
163
163
|
parameters: {
|
|
@@ -169,7 +169,7 @@ export var useExecuteAtomicAction = function useExecuteAtomicAction(_ref4) {
|
|
|
169
169
|
});
|
|
170
170
|
}, [executeAction, integrationKey, schema, fieldKey, ari]);
|
|
171
171
|
if (!schema) {
|
|
172
|
-
return
|
|
172
|
+
return {};
|
|
173
173
|
}
|
|
174
174
|
return {
|
|
175
175
|
execute: execute
|
package/dist/esm/state/index.js
CHANGED
|
@@ -13,19 +13,38 @@ var getInitialState = function getInitialState() {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
export var actions = {
|
|
16
|
-
|
|
16
|
+
onUpdateItem: function onUpdateItem(id, data) {
|
|
17
17
|
return function (_ref) {
|
|
18
18
|
var setState = _ref.setState,
|
|
19
19
|
getState = _ref.getState;
|
|
20
20
|
var oldItems = _objectSpread({}, getState().items);
|
|
21
|
-
var
|
|
21
|
+
var oldItem = oldItems[id];
|
|
22
|
+
if (!oldItem) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
setState({
|
|
26
|
+
items: _objectSpread(_objectSpread({}, oldItems), {}, _defineProperty({}, id, _objectSpread(_objectSpread({}, oldItem), {}, {
|
|
27
|
+
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
28
|
+
ari: oldItem.data.ari
|
|
29
|
+
})
|
|
30
|
+
})))
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
onAddItems: function onAddItems(items, integrationKey) {
|
|
35
|
+
return function (_ref2) {
|
|
36
|
+
var setState = _ref2.setState,
|
|
37
|
+
getState = _ref2.getState;
|
|
38
|
+
var oldItems = _objectSpread({}, getState().items);
|
|
39
|
+
var _items$reduce = items.reduce(function (_ref3, item) {
|
|
22
40
|
var _item$ari, _oldItems$id;
|
|
23
|
-
var
|
|
24
|
-
ids =
|
|
25
|
-
itemMap =
|
|
41
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
42
|
+
ids = _ref4[0],
|
|
43
|
+
itemMap = _ref4[1];
|
|
26
44
|
var ari = typeof ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? item['ari'].data : undefined;
|
|
27
45
|
var id = ari !== null && ari !== void 0 ? ari : uuidv4();
|
|
28
46
|
return [[].concat(_toConsumableArray(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, _defineProperty({}, id, {
|
|
47
|
+
ari: ari,
|
|
29
48
|
integrationKey: integrationKey,
|
|
30
49
|
data: _objectSpread(_objectSpread({}, (_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data), item)
|
|
31
50
|
}))];
|
|
@@ -46,16 +65,15 @@ export var Store = createStore({
|
|
|
46
65
|
actions: actions
|
|
47
66
|
});
|
|
48
67
|
export var useDatasourceItem = createStateHook(Store, {
|
|
49
|
-
selector: function selector(state,
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
return (_state$items$id = state.items[id]) === null || _state$items$id === void 0 ? void 0 : _state$items$id.data;
|
|
68
|
+
selector: function selector(state, _ref5) {
|
|
69
|
+
var id = _ref5.id;
|
|
70
|
+
return state.items[id];
|
|
53
71
|
}
|
|
54
72
|
});
|
|
55
73
|
export var useDatasourceActions = createActionsHook(Store);
|
|
56
74
|
var Container = createContainer(Store);
|
|
57
|
-
export var StoreContainer = function StoreContainer(
|
|
58
|
-
var children =
|
|
75
|
+
export var StoreContainer = function StoreContainer(_ref6) {
|
|
76
|
+
var children = _ref6.children;
|
|
59
77
|
if (fg('enable_datasource_react_sweet_state')) {
|
|
60
78
|
return /*#__PURE__*/React.createElement(Container, {
|
|
61
79
|
scope: "datasource"
|
|
@@ -41,16 +41,16 @@ var TooltipWrapper = function TooltipWrapper(_ref) {
|
|
|
41
41
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
42
42
|
};
|
|
43
43
|
var ReadOnlyCell = function ReadOnlyCell(_ref2) {
|
|
44
|
-
var _rowData$columnKey;
|
|
44
|
+
var _useDatasourceItem, _rowData$columnKey;
|
|
45
45
|
var id = _ref2.id,
|
|
46
46
|
columnType = _ref2.columnType,
|
|
47
47
|
_ref2$wrappedColumnKe = _ref2.wrappedColumnKeys,
|
|
48
48
|
wrappedColumnKeys = _ref2$wrappedColumnKe === void 0 ? [] : _ref2$wrappedColumnKe,
|
|
49
49
|
renderItem = _ref2.renderItem,
|
|
50
50
|
columnKey = _ref2.columnKey;
|
|
51
|
-
var rowData = useDatasourceItem({
|
|
51
|
+
var rowData = (_useDatasourceItem = useDatasourceItem({
|
|
52
52
|
id: id
|
|
53
|
-
});
|
|
53
|
+
})) === null || _useDatasourceItem === void 0 ? void 0 : _useDatasourceItem.data;
|
|
54
54
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
55
55
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
56
56
|
}
|
|
@@ -75,15 +75,21 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
75
75
|
columnType = _ref3.columnType,
|
|
76
76
|
renderItem = _ref3.renderItem,
|
|
77
77
|
wrappedColumnKeys = _ref3.wrappedColumnKeys;
|
|
78
|
-
var
|
|
78
|
+
var item = useDatasourceItem({
|
|
79
79
|
id: id
|
|
80
80
|
});
|
|
81
|
+
if (!item) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
83
|
+
}
|
|
84
|
+
var rowData = item.data,
|
|
85
|
+
integrationKey = item.integrationKey,
|
|
86
|
+
ari = item.ari;
|
|
81
87
|
if (!rowData || !columnKey || !rowData[columnKey]) {
|
|
82
88
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
// Check if field is editable
|
|
86
|
-
var isEditable = isEditTypeSupported(columnType);
|
|
92
|
+
var isEditable = !!ari && !!integrationKey && isEditTypeSupported(columnType);
|
|
87
93
|
|
|
88
94
|
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
89
95
|
var value = (_rowData$columnKey2 = rowData[columnKey]) === null || _rowData$columnKey2 === void 0 ? void 0 : _rowData$columnKey2.data;
|
|
@@ -103,6 +109,8 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
|
|
|
103
109
|
xcss: truncateTextStyles
|
|
104
110
|
}, renderItem(datasourceTypeWithValues)));
|
|
105
111
|
return isEditable ? /*#__PURE__*/React.createElement(InlineEdit, {
|
|
112
|
+
ari: ari,
|
|
113
|
+
columnKey: columnKey,
|
|
106
114
|
datasourceTypeWithValues: datasourceTypeWithValues,
|
|
107
115
|
readView: readView
|
|
108
116
|
}) : readView;
|
|
@@ -1,19 +1,67 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
4
7
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
5
8
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
|
+
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
10
|
+
import { useExecuteAtomicAction } from '../../../state/actions';
|
|
6
11
|
import { editType } from '../edit-type';
|
|
7
12
|
var containerStyles = xcss({
|
|
8
13
|
marginBlockStart: 'space.negative.100'
|
|
9
14
|
});
|
|
15
|
+
var mapUpdatedItem = function mapUpdatedItem(type, existingItem, columnKey, newValue) {
|
|
16
|
+
switch (type) {
|
|
17
|
+
case 'string':
|
|
18
|
+
return _objectSpread(_objectSpread({}, existingItem), {}, _defineProperty({}, columnKey, {
|
|
19
|
+
data: newValue
|
|
20
|
+
}));
|
|
21
|
+
default:
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
10
25
|
export var InlineEdit = function InlineEdit(_ref) {
|
|
11
|
-
var
|
|
26
|
+
var _item$integrationKey;
|
|
27
|
+
var ari = _ref.ari,
|
|
28
|
+
columnKey = _ref.columnKey,
|
|
29
|
+
datasourceTypeWithValues = _ref.datasourceTypeWithValues,
|
|
12
30
|
_readView = _ref.readView;
|
|
13
31
|
var _useState = useState(false),
|
|
14
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
33
|
isEditing = _useState2[0],
|
|
16
34
|
setIsEditing = _useState2[1];
|
|
35
|
+
var item = useDatasourceItem({
|
|
36
|
+
id: ari
|
|
37
|
+
});
|
|
38
|
+
var _useDatasourceActions = useDatasourceActions(),
|
|
39
|
+
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
40
|
+
var _useExecuteAtomicActi = useExecuteAtomicAction({
|
|
41
|
+
ari: ari,
|
|
42
|
+
fieldKey: columnKey,
|
|
43
|
+
integrationKey: (_item$integrationKey = item === null || item === void 0 ? void 0 : item.integrationKey) !== null && _item$integrationKey !== void 0 ? _item$integrationKey : ''
|
|
44
|
+
}),
|
|
45
|
+
execute = _useExecuteAtomicActi.execute;
|
|
46
|
+
var onCommitUpdate = useCallback(function (value) {
|
|
47
|
+
if (!execute || !item) {
|
|
48
|
+
setIsEditing(false);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
var existingData = item.data;
|
|
52
|
+
var newItem = mapUpdatedItem(datasourceTypeWithValues.type, item.data, columnKey, value);
|
|
53
|
+
if (!newItem) {
|
|
54
|
+
setIsEditing(false);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
onUpdateItem(ari, newItem);
|
|
58
|
+
execute(value).catch(function (error) {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
console.error(error);
|
|
61
|
+
onUpdateItem(ari, existingData);
|
|
62
|
+
});
|
|
63
|
+
setIsEditing(false);
|
|
64
|
+
}, [ari, execute, datasourceTypeWithValues, item, columnKey, onUpdateItem]);
|
|
17
65
|
return /*#__PURE__*/React.createElement(Box, {
|
|
18
66
|
xcss: containerStyles
|
|
19
67
|
}, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType(datasourceTypeWithValues), {
|
|
@@ -29,9 +77,6 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
29
77
|
onCancel: function onCancel() {
|
|
30
78
|
return setIsEditing(false);
|
|
31
79
|
},
|
|
32
|
-
onConfirm:
|
|
33
|
-
setIsEditing(false);
|
|
34
|
-
// Save value back to the store
|
|
35
|
-
}
|
|
80
|
+
onConfirm: onCommitUpdate
|
|
36
81
|
})));
|
|
37
82
|
};
|
|
@@ -82,6 +82,8 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
|
|
|
82
82
|
fieldKey: string;
|
|
83
83
|
integrationKey: string;
|
|
84
84
|
}) => {
|
|
85
|
-
execute
|
|
86
|
-
} |
|
|
85
|
+
execute?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse>;
|
|
88
|
+
};
|
|
87
89
|
export {};
|
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
import { type Action } from 'react-sweet-state';
|
|
3
3
|
import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
|
+
interface DatasourceItem {
|
|
6
|
+
ari: string | undefined;
|
|
7
|
+
integrationKey: string | undefined;
|
|
8
|
+
data: DatasourceDataResponseItem;
|
|
9
|
+
}
|
|
5
10
|
export interface State {
|
|
6
|
-
items: Record<UniqueIdentifier,
|
|
7
|
-
integrationKey: string | undefined;
|
|
8
|
-
data: DatasourceDataResponseItem;
|
|
9
|
-
}>;
|
|
11
|
+
items: Record<UniqueIdentifier, DatasourceItem>;
|
|
10
12
|
}
|
|
11
13
|
export declare const actions: {
|
|
14
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
12
15
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
13
16
|
};
|
|
14
17
|
export declare const Store: import("react-sweet-state").Store<State, {
|
|
18
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
15
19
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
16
20
|
}>;
|
|
17
|
-
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<
|
|
21
|
+
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<DatasourceItem | undefined, {
|
|
18
22
|
id: string;
|
|
19
23
|
}>;
|
|
20
24
|
export declare const useDatasourceActions: import("react-sweet-state").HookActionsFunction<import("react-sweet-state").BoundActions<State, {
|
|
25
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
21
26
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
22
27
|
}>>;
|
|
23
28
|
export declare const StoreContainer: ({ children }: {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
3
3
|
interface InlineEditProps {
|
|
4
|
+
ari: string;
|
|
5
|
+
columnKey: string;
|
|
4
6
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
5
7
|
readView: React.ReactNode;
|
|
6
8
|
}
|
|
7
|
-
export declare const InlineEdit: ({ datasourceTypeWithValues, readView }: InlineEditProps) => JSX.Element;
|
|
9
|
+
export declare const InlineEdit: ({ ari, columnKey, datasourceTypeWithValues, readView, }: InlineEditProps) => JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -82,6 +82,8 @@ export declare const useExecuteAtomicAction: ({ ari, fieldKey, integrationKey, }
|
|
|
82
82
|
fieldKey: string;
|
|
83
83
|
integrationKey: string;
|
|
84
84
|
}) => {
|
|
85
|
-
execute
|
|
86
|
-
} |
|
|
85
|
+
execute?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
execute: (value: string | number) => Promise<import("@atlaskit/linking-types").AtomicActionExecuteResponse>;
|
|
88
|
+
};
|
|
87
89
|
export {};
|
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
import { type Action } from 'react-sweet-state';
|
|
3
3
|
import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
|
+
interface DatasourceItem {
|
|
6
|
+
ari: string | undefined;
|
|
7
|
+
integrationKey: string | undefined;
|
|
8
|
+
data: DatasourceDataResponseItem;
|
|
9
|
+
}
|
|
5
10
|
export interface State {
|
|
6
|
-
items: Record<UniqueIdentifier,
|
|
7
|
-
integrationKey: string | undefined;
|
|
8
|
-
data: DatasourceDataResponseItem;
|
|
9
|
-
}>;
|
|
11
|
+
items: Record<UniqueIdentifier, DatasourceItem>;
|
|
10
12
|
}
|
|
11
13
|
export declare const actions: {
|
|
14
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
12
15
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
13
16
|
};
|
|
14
17
|
export declare const Store: import("react-sweet-state").Store<State, {
|
|
18
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
15
19
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
16
20
|
}>;
|
|
17
|
-
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<
|
|
21
|
+
export declare const useDatasourceItem: import("react-sweet-state").HookStateFunction<DatasourceItem | undefined, {
|
|
18
22
|
id: string;
|
|
19
23
|
}>;
|
|
20
24
|
export declare const useDatasourceActions: import("react-sweet-state").HookActionsFunction<import("react-sweet-state").BoundActions<State, {
|
|
25
|
+
onUpdateItem: (id: string, data: DatasourceDataResponseItem) => Action<State, void, void>;
|
|
21
26
|
onAddItems: (items: DatasourceDataResponseItem[], integrationKey: string | undefined) => Action<State, void, string[]>;
|
|
22
27
|
}>>;
|
|
23
28
|
export declare const StoreContainer: ({ children }: {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DatasourceTypeWithOnlyValues } from '../types';
|
|
3
3
|
interface InlineEditProps {
|
|
4
|
+
ari: string;
|
|
5
|
+
columnKey: string;
|
|
4
6
|
datasourceTypeWithValues: DatasourceTypeWithOnlyValues;
|
|
5
7
|
readView: React.ReactNode;
|
|
6
8
|
}
|
|
7
|
-
export declare const InlineEdit: ({ datasourceTypeWithValues, readView }: InlineEditProps) => JSX.Element;
|
|
9
|
+
export declare const InlineEdit: ({ ari, columnKey, datasourceTypeWithValues, readView, }: InlineEditProps) => JSX.Element;
|
|
8
10
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,50 +36,50 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/adf-schema": "^40.8.1",
|
|
39
|
-
"@atlaskit/analytics-next": "^10.
|
|
40
|
-
"@atlaskit/avatar": "^21.
|
|
41
|
-
"@atlaskit/avatar-group": "^9.
|
|
42
|
-
"@atlaskit/badge": "^16.
|
|
43
|
-
"@atlaskit/button": "^19.
|
|
44
|
-
"@atlaskit/datetime-picker": "^13.
|
|
45
|
-
"@atlaskit/dropdown-menu": "^12.
|
|
39
|
+
"@atlaskit/analytics-next": "^10.1.0",
|
|
40
|
+
"@atlaskit/avatar": "^21.14.0",
|
|
41
|
+
"@atlaskit/avatar-group": "^9.11.0",
|
|
42
|
+
"@atlaskit/badge": "^16.4.0",
|
|
43
|
+
"@atlaskit/button": "^19.2.0",
|
|
44
|
+
"@atlaskit/datetime-picker": "^13.10.0",
|
|
45
|
+
"@atlaskit/dropdown-menu": "^12.17.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
47
|
-
"@atlaskit/empty-state": "^7.
|
|
48
|
-
"@atlaskit/form": "^10.
|
|
47
|
+
"@atlaskit/empty-state": "^7.11.0",
|
|
48
|
+
"@atlaskit/form": "^10.5.0",
|
|
49
49
|
"@atlaskit/heading": "^2.4.0",
|
|
50
|
-
"@atlaskit/icon": "^22.
|
|
51
|
-
"@atlaskit/icon-object": "^6.
|
|
50
|
+
"@atlaskit/icon": "^22.12.0",
|
|
51
|
+
"@atlaskit/icon-object": "^6.5.0",
|
|
52
52
|
"@atlaskit/image": "^1.3.0",
|
|
53
|
-
"@atlaskit/inline-edit": "^13.
|
|
53
|
+
"@atlaskit/inline-edit": "^13.6.0",
|
|
54
54
|
"@atlaskit/intl-messages-provider": "^1.0.0",
|
|
55
55
|
"@atlaskit/jql-ast": "^3.3.0",
|
|
56
56
|
"@atlaskit/jql-editor": "^4.5.0",
|
|
57
57
|
"@atlaskit/jql-editor-autocomplete-rest": "^2.0.0",
|
|
58
|
-
"@atlaskit/link-client-extension": "^2.
|
|
59
|
-
"@atlaskit/linking-common": "^5.
|
|
58
|
+
"@atlaskit/link-client-extension": "^2.1.0",
|
|
59
|
+
"@atlaskit/linking-common": "^5.11.0",
|
|
60
60
|
"@atlaskit/linking-types": "^9.0.0",
|
|
61
|
-
"@atlaskit/logo": "^14.
|
|
62
|
-
"@atlaskit/lozenge": "^11.
|
|
63
|
-
"@atlaskit/modal-dialog": "^12.
|
|
61
|
+
"@atlaskit/logo": "^14.2.0",
|
|
62
|
+
"@atlaskit/lozenge": "^11.10.0",
|
|
63
|
+
"@atlaskit/modal-dialog": "^12.15.0",
|
|
64
64
|
"@atlaskit/outbound-auth-flow-client": "^3.4.5",
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
66
|
-
"@atlaskit/popup": "^1.
|
|
66
|
+
"@atlaskit/popup": "^1.22.0",
|
|
67
67
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
68
68
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
69
69
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
|
|
70
70
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
71
71
|
"@atlaskit/primitives": "^12.0.0",
|
|
72
|
-
"@atlaskit/select": "^17.
|
|
73
|
-
"@atlaskit/smart-card": "^27.
|
|
74
|
-
"@atlaskit/smart-user-picker": "6.10.
|
|
75
|
-
"@atlaskit/spinner": "^16.
|
|
76
|
-
"@atlaskit/tag": "^12.
|
|
77
|
-
"@atlaskit/textfield": "6.
|
|
78
|
-
"@atlaskit/theme": "^
|
|
79
|
-
"@atlaskit/tokens": "^1.
|
|
80
|
-
"@atlaskit/tooltip": "^18.
|
|
81
|
-
"@atlaskit/ufo": "^0.
|
|
82
|
-
"@atlaskit/width-detector": "^4.
|
|
72
|
+
"@atlaskit/select": "^17.13.0",
|
|
73
|
+
"@atlaskit/smart-card": "^27.15.0",
|
|
74
|
+
"@atlaskit/smart-user-picker": "6.10.2",
|
|
75
|
+
"@atlaskit/spinner": "^16.3.0",
|
|
76
|
+
"@atlaskit/tag": "^12.5.0",
|
|
77
|
+
"@atlaskit/textfield": "6.5.1",
|
|
78
|
+
"@atlaskit/theme": "^13.0.0",
|
|
79
|
+
"@atlaskit/tokens": "^1.58.0",
|
|
80
|
+
"@atlaskit/tooltip": "^18.7.0",
|
|
81
|
+
"@atlaskit/ufo": "^0.3.0",
|
|
82
|
+
"@atlaskit/width-detector": "^4.3.0",
|
|
83
83
|
"@babel/runtime": "^7.0.0",
|
|
84
84
|
"@emotion/react": "^11.7.1",
|
|
85
85
|
"@emotion/styled": "^11.0.0",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@af/integration-testing": "*",
|
|
100
100
|
"@af/visual-regression": "*",
|
|
101
101
|
"@atlaskit/link-provider": "^1.14.0",
|
|
102
|
-
"@atlaskit/link-test-helpers": "^7.
|
|
102
|
+
"@atlaskit/link-test-helpers": "^7.4.0",
|
|
103
103
|
"@atlaskit/ssr": "*",
|
|
104
104
|
"@atlaskit/visual-regression": "*",
|
|
105
105
|
"@atlassian/feature-flags-test-utils": "^0.2.0",
|