@atlaskit/editor-core 185.3.1 → 185.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/plugins/card/nodeviews/datasource.js +139 -0
- package/dist/cjs/plugins/card/pm-plugins/main.js +4 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/nodeviews/datasource.js +100 -0
- package/dist/es2019/plugins/card/pm-plugins/main.js +4 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/nodeviews/datasource.js +131 -0
- package/dist/esm/plugins/card/pm-plugins/main.js +4 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/card/nodeviews/datasource.d.ts +27 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/datasource.d.ts +27 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DatasourceComponent = exports.Datasource = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
var _react2 = require("@emotion/react");
|
|
18
|
+
var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
|
|
19
|
+
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
24
|
+
var containerStyles = (0, _react2.css)({
|
|
25
|
+
height: '500px',
|
|
26
|
+
overflow: 'auto'
|
|
27
|
+
});
|
|
28
|
+
var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
29
|
+
(0, _inherits2.default)(DatasourceComponent, _React$PureComponent);
|
|
30
|
+
var _super = _createSuper(DatasourceComponent);
|
|
31
|
+
function DatasourceComponent(props) {
|
|
32
|
+
var _this;
|
|
33
|
+
(0, _classCallCheck2.default)(this, DatasourceComponent);
|
|
34
|
+
_this = _super.call(this, props);
|
|
35
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getPosSafely", function () {
|
|
36
|
+
var getPos = _this.props.getPos;
|
|
37
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return getPos();
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Can blow up in rare cases, when node has been removed.
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getDatasource", function () {
|
|
47
|
+
return _this.props.node.attrs.datasource;
|
|
48
|
+
});
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getTableView", function (datasource) {
|
|
50
|
+
var views = (datasource || _this.getDatasource()).views;
|
|
51
|
+
return views.find(function (view) {
|
|
52
|
+
return view.type === 'table';
|
|
53
|
+
}) || undefined;
|
|
54
|
+
});
|
|
55
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleColumnChange", function (columnKeys) {
|
|
56
|
+
var _this$props$view = _this.props.view,
|
|
57
|
+
state = _this$props$view.state,
|
|
58
|
+
dispatch = _this$props$view.dispatch;
|
|
59
|
+
var pos = _this.getPosSafely();
|
|
60
|
+
if (pos === undefined) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
var attrs = _this.props.node.attrs;
|
|
64
|
+
var views = [{
|
|
65
|
+
type: 'table',
|
|
66
|
+
properties: {
|
|
67
|
+
columns: columnKeys.map(function (key) {
|
|
68
|
+
return {
|
|
69
|
+
key: key
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}];
|
|
74
|
+
var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
75
|
+
datasource: _objectSpread(_objectSpread({}, attrs.datasource), {}, {
|
|
76
|
+
views: views
|
|
77
|
+
})
|
|
78
|
+
}));
|
|
79
|
+
tr.setMeta('scrollIntoView', false);
|
|
80
|
+
dispatch(tr);
|
|
81
|
+
});
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
(0, _createClass2.default)(DatasourceComponent, [{
|
|
85
|
+
key: "render",
|
|
86
|
+
value: function render() {
|
|
87
|
+
var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
88
|
+
var datasource = this.getDatasource();
|
|
89
|
+
var tableView = this.getTableView();
|
|
90
|
+
if (tableView) {
|
|
91
|
+
var _tableView$properties;
|
|
92
|
+
var visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (_ref) {
|
|
93
|
+
var key = _ref.key;
|
|
94
|
+
return key;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// [WS-2307]: we only render card wrapped into a Provider when the value is ready
|
|
98
|
+
if (cardContext && cardContext.value) {
|
|
99
|
+
return (0, _react2.jsx)(cardContext.Provider, {
|
|
100
|
+
value: cardContext.value
|
|
101
|
+
}, (0, _react2.jsx)(_linkDatasource.DatasourceTableView, {
|
|
102
|
+
datasourceId: datasource.id,
|
|
103
|
+
parameters: datasource.parameters,
|
|
104
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
105
|
+
onVisibleColumnKeysChange: this.handleColumnChange
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
return DatasourceComponent;
|
|
113
|
+
}(_react.default.PureComponent);
|
|
114
|
+
exports.DatasourceComponent = DatasourceComponent;
|
|
115
|
+
(0, _defineProperty2.default)(DatasourceComponent, "contextTypes", {
|
|
116
|
+
contextAdapter: _propTypes.default.object
|
|
117
|
+
});
|
|
118
|
+
var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
119
|
+
(0, _inherits2.default)(Datasource, _ReactNodeView);
|
|
120
|
+
var _super2 = _createSuper(Datasource);
|
|
121
|
+
function Datasource() {
|
|
122
|
+
(0, _classCallCheck2.default)(this, Datasource);
|
|
123
|
+
return _super2.apply(this, arguments);
|
|
124
|
+
}
|
|
125
|
+
(0, _createClass2.default)(Datasource, [{
|
|
126
|
+
key: "render",
|
|
127
|
+
value: function render() {
|
|
128
|
+
return (0, _react2.jsx)("div", {
|
|
129
|
+
css: containerStyles
|
|
130
|
+
}, (0, _react2.jsx)(DatasourceComponent, {
|
|
131
|
+
node: this.node,
|
|
132
|
+
view: this.view,
|
|
133
|
+
getPos: this.getPos
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
}]);
|
|
137
|
+
return Datasource;
|
|
138
|
+
}(_reactNodeView.default);
|
|
139
|
+
exports.Datasource = Datasource;
|
|
@@ -23,6 +23,7 @@ var _reducers = _interopRequireDefault(require("./reducers"));
|
|
|
23
23
|
var _resolve = require("./util/resolve");
|
|
24
24
|
var _state = require("./util/state");
|
|
25
25
|
var _analytics = require("./analytics");
|
|
26
|
+
var _datasource = require("../nodeviews/datasource");
|
|
26
27
|
var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
27
28
|
return function (pmPluginFactoryParams) {
|
|
28
29
|
var lpAnalyticsEventsNext = pmPluginFactoryParams.featureFlags.lpAnalyticsEventsNext;
|
|
@@ -129,6 +130,9 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
129
130
|
showServerActions: showServerActions
|
|
130
131
|
};
|
|
131
132
|
var hasIntlContext = true;
|
|
133
|
+
if (node.attrs.datasource) {
|
|
134
|
+
return new _datasource.Datasource(node, view, getPos, portalProviderAPI, eventDispatcher, undefined, undefined, true, undefined, hasIntlContext).init();
|
|
135
|
+
}
|
|
132
136
|
return new _blockCard.BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
133
137
|
},
|
|
134
138
|
embedCard: function embedCard(node, view, getPos) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.
|
|
9
|
+
var version = "185.4.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
|
+
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
8
|
+
const containerStyles = css({
|
|
9
|
+
height: '500px',
|
|
10
|
+
overflow: 'auto'
|
|
11
|
+
});
|
|
12
|
+
export class DatasourceComponent extends React.PureComponent {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
_defineProperty(this, "getPosSafely", () => {
|
|
16
|
+
const {
|
|
17
|
+
getPos
|
|
18
|
+
} = this.props;
|
|
19
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
return getPos();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
// Can blow up in rare cases, when node has been removed.
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
_defineProperty(this, "getDatasource", () => this.props.node.attrs.datasource);
|
|
29
|
+
_defineProperty(this, "getTableView", datasource => {
|
|
30
|
+
const views = (datasource || this.getDatasource()).views;
|
|
31
|
+
return views.find(view => view.type === 'table') || undefined;
|
|
32
|
+
});
|
|
33
|
+
_defineProperty(this, "handleColumnChange", columnKeys => {
|
|
34
|
+
const {
|
|
35
|
+
state,
|
|
36
|
+
dispatch
|
|
37
|
+
} = this.props.view;
|
|
38
|
+
const pos = this.getPosSafely();
|
|
39
|
+
if (pos === undefined) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const attrs = this.props.node.attrs;
|
|
43
|
+
const views = [{
|
|
44
|
+
type: 'table',
|
|
45
|
+
properties: {
|
|
46
|
+
columns: columnKeys.map(key => ({
|
|
47
|
+
key
|
|
48
|
+
}))
|
|
49
|
+
}
|
|
50
|
+
}];
|
|
51
|
+
const tr = state.tr.setNodeMarkup(pos, undefined, {
|
|
52
|
+
...attrs,
|
|
53
|
+
datasource: {
|
|
54
|
+
...attrs.datasource,
|
|
55
|
+
views
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
tr.setMeta('scrollIntoView', false);
|
|
59
|
+
dispatch(tr);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
const cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
64
|
+
const datasource = this.getDatasource();
|
|
65
|
+
const tableView = this.getTableView();
|
|
66
|
+
if (tableView) {
|
|
67
|
+
var _tableView$properties;
|
|
68
|
+
const visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(({
|
|
69
|
+
key
|
|
70
|
+
}) => key);
|
|
71
|
+
|
|
72
|
+
// [WS-2307]: we only render card wrapped into a Provider when the value is ready
|
|
73
|
+
if (cardContext && cardContext.value) {
|
|
74
|
+
return jsx(cardContext.Provider, {
|
|
75
|
+
value: cardContext.value
|
|
76
|
+
}, jsx(DatasourceTableView, {
|
|
77
|
+
datasourceId: datasource.id,
|
|
78
|
+
parameters: datasource.parameters,
|
|
79
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
80
|
+
onVisibleColumnKeysChange: this.handleColumnChange
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
_defineProperty(DatasourceComponent, "contextTypes", {
|
|
88
|
+
contextAdapter: PropTypes.object
|
|
89
|
+
});
|
|
90
|
+
export class Datasource extends ReactNodeView {
|
|
91
|
+
render() {
|
|
92
|
+
return jsx("div", {
|
|
93
|
+
css: containerStyles
|
|
94
|
+
}, jsx(DatasourceComponent, {
|
|
95
|
+
node: this.node,
|
|
96
|
+
view: this.view,
|
|
97
|
+
getPos: this.getPos
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -9,6 +9,7 @@ import reducer from './reducers';
|
|
|
9
9
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
10
10
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
11
11
|
import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
|
|
12
|
+
import { Datasource } from '../nodeviews/datasource';
|
|
12
13
|
export { pluginKey } from './plugin-key';
|
|
13
14
|
export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryParams => {
|
|
14
15
|
const {
|
|
@@ -119,6 +120,9 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
119
120
|
showServerActions
|
|
120
121
|
};
|
|
121
122
|
const hasIntlContext = true;
|
|
123
|
+
if (node.attrs.datasource) {
|
|
124
|
+
return new Datasource(node, view, getPos, portalProviderAPI, eventDispatcher, undefined, undefined, true, undefined, hasIntlContext).init();
|
|
125
|
+
}
|
|
122
126
|
return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
123
127
|
},
|
|
124
128
|
embedCard: (node, view, getPos) => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import { css, jsx } from '@emotion/react';
|
|
16
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
17
|
+
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
18
|
+
var containerStyles = css({
|
|
19
|
+
height: '500px',
|
|
20
|
+
overflow: 'auto'
|
|
21
|
+
});
|
|
22
|
+
export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
23
|
+
_inherits(DatasourceComponent, _React$PureComponent);
|
|
24
|
+
var _super = _createSuper(DatasourceComponent);
|
|
25
|
+
function DatasourceComponent(props) {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, DatasourceComponent);
|
|
28
|
+
_this = _super.call(this, props);
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "getPosSafely", function () {
|
|
30
|
+
var getPos = _this.props.getPos;
|
|
31
|
+
if (!getPos || typeof getPos === 'boolean') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return getPos();
|
|
36
|
+
} catch (e) {
|
|
37
|
+
// Can blow up in rare cases, when node has been removed.
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "getDatasource", function () {
|
|
41
|
+
return _this.props.node.attrs.datasource;
|
|
42
|
+
});
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "getTableView", function (datasource) {
|
|
44
|
+
var views = (datasource || _this.getDatasource()).views;
|
|
45
|
+
return views.find(function (view) {
|
|
46
|
+
return view.type === 'table';
|
|
47
|
+
}) || undefined;
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "handleColumnChange", function (columnKeys) {
|
|
50
|
+
var _this$props$view = _this.props.view,
|
|
51
|
+
state = _this$props$view.state,
|
|
52
|
+
dispatch = _this$props$view.dispatch;
|
|
53
|
+
var pos = _this.getPosSafely();
|
|
54
|
+
if (pos === undefined) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
var attrs = _this.props.node.attrs;
|
|
58
|
+
var views = [{
|
|
59
|
+
type: 'table',
|
|
60
|
+
properties: {
|
|
61
|
+
columns: columnKeys.map(function (key) {
|
|
62
|
+
return {
|
|
63
|
+
key: key
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}];
|
|
68
|
+
var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
69
|
+
datasource: _objectSpread(_objectSpread({}, attrs.datasource), {}, {
|
|
70
|
+
views: views
|
|
71
|
+
})
|
|
72
|
+
}));
|
|
73
|
+
tr.setMeta('scrollIntoView', false);
|
|
74
|
+
dispatch(tr);
|
|
75
|
+
});
|
|
76
|
+
return _this;
|
|
77
|
+
}
|
|
78
|
+
_createClass(DatasourceComponent, [{
|
|
79
|
+
key: "render",
|
|
80
|
+
value: function render() {
|
|
81
|
+
var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
82
|
+
var datasource = this.getDatasource();
|
|
83
|
+
var tableView = this.getTableView();
|
|
84
|
+
if (tableView) {
|
|
85
|
+
var _tableView$properties;
|
|
86
|
+
var visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (_ref) {
|
|
87
|
+
var key = _ref.key;
|
|
88
|
+
return key;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// [WS-2307]: we only render card wrapped into a Provider when the value is ready
|
|
92
|
+
if (cardContext && cardContext.value) {
|
|
93
|
+
return jsx(cardContext.Provider, {
|
|
94
|
+
value: cardContext.value
|
|
95
|
+
}, jsx(DatasourceTableView, {
|
|
96
|
+
datasourceId: datasource.id,
|
|
97
|
+
parameters: datasource.parameters,
|
|
98
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
99
|
+
onVisibleColumnKeysChange: this.handleColumnChange
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}]);
|
|
106
|
+
return DatasourceComponent;
|
|
107
|
+
}(React.PureComponent);
|
|
108
|
+
_defineProperty(DatasourceComponent, "contextTypes", {
|
|
109
|
+
contextAdapter: PropTypes.object
|
|
110
|
+
});
|
|
111
|
+
export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
112
|
+
_inherits(Datasource, _ReactNodeView);
|
|
113
|
+
var _super2 = _createSuper(Datasource);
|
|
114
|
+
function Datasource() {
|
|
115
|
+
_classCallCheck(this, Datasource);
|
|
116
|
+
return _super2.apply(this, arguments);
|
|
117
|
+
}
|
|
118
|
+
_createClass(Datasource, [{
|
|
119
|
+
key: "render",
|
|
120
|
+
value: function render() {
|
|
121
|
+
return jsx("div", {
|
|
122
|
+
css: containerStyles
|
|
123
|
+
}, jsx(DatasourceComponent, {
|
|
124
|
+
node: this.node,
|
|
125
|
+
view: this.view,
|
|
126
|
+
getPos: this.getPos
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
}]);
|
|
130
|
+
return Datasource;
|
|
131
|
+
}(ReactNodeView);
|
|
@@ -10,6 +10,7 @@ import reducer from './reducers';
|
|
|
10
10
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
11
11
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
12
12
|
import { createAnalyticsQueue, eventsFromTransaction } from './analytics';
|
|
13
|
+
import { Datasource } from '../nodeviews/datasource';
|
|
13
14
|
export { pluginKey } from './plugin-key';
|
|
14
15
|
export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
15
16
|
return function (pmPluginFactoryParams) {
|
|
@@ -117,6 +118,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
117
118
|
showServerActions: showServerActions
|
|
118
119
|
};
|
|
119
120
|
var hasIntlContext = true;
|
|
121
|
+
if (node.attrs.datasource) {
|
|
122
|
+
return new Datasource(node, view, getPos, portalProviderAPI, eventDispatcher, undefined, undefined, true, undefined, hasIntlContext).init();
|
|
123
|
+
}
|
|
120
124
|
return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined, true, undefined, hasIntlContext).init();
|
|
121
125
|
},
|
|
122
126
|
embedCard: function embedCard(node, view, getPos) {
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import ReactNodeView, { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
|
+
interface DatasourceComponentProps extends ReactComponentProps {
|
|
9
|
+
node: PMNode;
|
|
10
|
+
view: EditorView;
|
|
11
|
+
getPos: getPosHandler;
|
|
12
|
+
}
|
|
13
|
+
export declare class DatasourceComponent extends React.PureComponent<DatasourceComponentProps> {
|
|
14
|
+
static contextTypes: {
|
|
15
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
16
|
+
};
|
|
17
|
+
constructor(props: DatasourceComponentProps);
|
|
18
|
+
private getPosSafely;
|
|
19
|
+
private getDatasource;
|
|
20
|
+
private getTableView;
|
|
21
|
+
handleColumnChange: (columnKeys: string[]) => void;
|
|
22
|
+
render(): jsx.JSX.Element | null;
|
|
23
|
+
}
|
|
24
|
+
export declare class Datasource extends ReactNodeView<DatasourceComponentProps> {
|
|
25
|
+
render(): jsx.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import ReactNodeView, { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
|
+
interface DatasourceComponentProps extends ReactComponentProps {
|
|
9
|
+
node: PMNode;
|
|
10
|
+
view: EditorView;
|
|
11
|
+
getPos: getPosHandler;
|
|
12
|
+
}
|
|
13
|
+
export declare class DatasourceComponent extends React.PureComponent<DatasourceComponentProps> {
|
|
14
|
+
static contextTypes: {
|
|
15
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
16
|
+
};
|
|
17
|
+
constructor(props: DatasourceComponentProps);
|
|
18
|
+
private getPosSafely;
|
|
19
|
+
private getDatasource;
|
|
20
|
+
private getTableView;
|
|
21
|
+
handleColumnChange: (columnKeys: string[]) => void;
|
|
22
|
+
render(): jsx.JSX.Element | null;
|
|
23
|
+
}
|
|
24
|
+
export declare class Datasource extends ReactNodeView<DatasourceComponentProps> {
|
|
25
|
+
render(): jsx.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "185.
|
|
3
|
+
"version": "185.4.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
37
|
-
"@atlaskit/adf-schema": "^25.
|
|
37
|
+
"@atlaskit/adf-schema": "^25.10.0",
|
|
38
38
|
"@atlaskit/adf-utils": "^18.4.0",
|
|
39
39
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
40
40
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/code": "^14.6.0",
|
|
50
50
|
"@atlaskit/date": "^0.10.0",
|
|
51
51
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
52
|
-
"@atlaskit/editor-common": "^74.
|
|
52
|
+
"@atlaskit/editor-common": "^74.10.0",
|
|
53
53
|
"@atlaskit/editor-json-transformer": "^8.9.0",
|
|
54
54
|
"@atlaskit/editor-markdown-transformer": "^5.2.0",
|
|
55
55
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"@atlaskit/icon": "^21.12.0",
|
|
71
71
|
"@atlaskit/icon-object": "^6.3.0",
|
|
72
72
|
"@atlaskit/link-analytics": "^8.0.0",
|
|
73
|
+
"@atlaskit/link-datasource": "^0.24.0",
|
|
73
74
|
"@atlaskit/link-picker": "^1.25.0",
|
|
74
75
|
"@atlaskit/locale": "^2.5.0",
|
|
75
76
|
"@atlaskit/logo": "^13.14.0",
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"@atlaskit/media-ui": "^23.1.0",
|
|
82
83
|
"@atlaskit/media-viewer": "^48.0.0",
|
|
83
84
|
"@atlaskit/mention": "^22.1.0",
|
|
84
|
-
"@atlaskit/menu": "^1.
|
|
85
|
+
"@atlaskit/menu": "^1.8.0",
|
|
85
86
|
"@atlaskit/modal-dialog": "^12.6.0",
|
|
86
87
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
87
88
|
"@atlaskit/prosemirror-collab": "^0.2.0",
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
"@atlaskit/collab-provider": "9.3.0",
|
|
155
156
|
"@atlaskit/docs": "*",
|
|
156
157
|
"@atlaskit/drawer": "^7.5.0",
|
|
157
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
158
|
+
"@atlaskit/dropdown-menu": "^11.10.0",
|
|
158
159
|
"@atlaskit/editor-card-provider": "^3.0.0",
|
|
159
160
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
160
161
|
"@atlaskit/editor-plugin-table": "^1.6.0",
|
|
@@ -167,10 +168,10 @@
|
|
|
167
168
|
"@atlaskit/media-core": "^34.1.0",
|
|
168
169
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
169
170
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
170
|
-
"@atlaskit/menu": "^1.
|
|
171
|
+
"@atlaskit/menu": "^1.8.0",
|
|
171
172
|
"@atlaskit/page-layout": "^1.7.0",
|
|
172
173
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
173
|
-
"@atlaskit/renderer": "^108.
|
|
174
|
+
"@atlaskit/renderer": "^108.3.0",
|
|
174
175
|
"@atlaskit/section-message": "^6.4.0",
|
|
175
176
|
"@atlaskit/share": "*",
|
|
176
177
|
"@atlaskit/smart-user-picker": "^6.1.0",
|