@atlaskit/renderer 108.2.6 → 108.3.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 108.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`714f16e525a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/714f16e525a) - [ux] Added blockCard integration with datasource ADFs
8
+
3
9
  ## 108.2.6
4
10
 
5
11
  ### Patch Changes
@@ -1,21 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = BlockCard;
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = require("react");
10
+ var _react2 = require("@emotion/react");
11
11
  var _smartCard = require("@atlaskit/smart-card");
12
12
  var _ui = require("@atlaskit/editor-common/ui");
13
13
  var _utils = require("../../utils");
14
14
  var _fallback = require("./fallback");
15
15
  var _getCardClickHandler = require("../utils/getCardClickHandler");
16
16
  var _analyticsNext = require("@atlaskit/analytics-next");
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ var _linkDatasource = require("@atlaskit/link-datasource");
18
+ /** @jsx jsx */
19
+
20
+ // Temporary, until we add aspect ratio to the datasource table
21
+ var datasourceContainerStyle = (0, _react2.css)({
22
+ height: '500px',
23
+ overflow: 'auto'
24
+ });
19
25
  function BlockCard(props) {
20
26
  var url = props.url,
21
27
  data = props.data,
@@ -42,22 +48,48 @@ function BlockCard(props) {
42
48
  // Below is added for the future implementation of Linking Platform namespaced analytic context
43
49
  location: 'renderer'
44
50
  };
45
- var onError = function onError(_ref2) {
46
- var err = _ref2.err;
51
+ if (props.datasource) {
52
+ var views = props.datasource.views;
53
+ var tableView = views.find(function (view) {
54
+ return view.type === 'table';
55
+ });
56
+ if (tableView) {
57
+ var _tableView$properties;
58
+ var visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (_ref2) {
59
+ var key = _ref2.key;
60
+ return key;
61
+ });
62
+ return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
63
+ data: analyticsData
64
+ }, (0, _react2.jsx)("div", {
65
+ css: datasourceContainerStyle
66
+ }, (0, _react2.jsx)(_fallback.CardErrorBoundary, (0, _extends2.default)({
67
+ unsupportedComponent: _ui.UnsupportedBlock
68
+ }, cardProps), (0, _react2.jsx)(_linkDatasource.DatasourceTableView, {
69
+ datasourceId: props.datasource.id,
70
+ parameters: props.datasource.parameters,
71
+ visibleColumnKeys: visibleColumnKeys,
72
+ onVisibleColumnKeysChange: undefined
73
+ }))));
74
+ }
75
+ return null;
76
+ }
77
+ var onError = function onError(_ref3) {
78
+ var err = _ref3.err;
47
79
  if (err) {
48
80
  throw err;
49
81
  }
50
82
  };
51
- return /*#__PURE__*/_react.default.createElement(_analyticsNext.AnalyticsContext, {
83
+ return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
52
84
  data: analyticsData
53
- }, /*#__PURE__*/_react.default.createElement("div", {
85
+ }, (0, _react2.jsx)("div", {
54
86
  className: "blockCardView-content-wrap",
55
87
  "data-block-card": true,
56
88
  "data-card-data": data ? JSON.stringify(data) : undefined,
57
89
  "data-card-url": url
58
- }, /*#__PURE__*/_react.default.createElement(_fallback.CardErrorBoundary, (0, _extends2.default)({
90
+ }, (0, _react2.jsx)(_fallback.CardErrorBoundary, (0, _extends2.default)({
59
91
  unsupportedComponent: _ui.UnsupportedBlock
60
- }, cardProps), /*#__PURE__*/_react.default.createElement(_smartCard.Card, (0, _extends2.default)({
92
+ }, cardProps), (0, _react2.jsx)(_smartCard.Card, (0, _extends2.default)({
61
93
  appearance: "block",
62
94
  showActions: rendererAppearance !== 'mobile',
63
95
  platform: platform,
@@ -55,7 +55,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
55
55
  var DEGRADED_SEVERITY_THRESHOLD = 3000;
56
56
  exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
57
57
  var packageName = "@atlaskit/renderer";
58
- var packageVersion = "108.2.6";
58
+ var packageVersion = "108.3.0";
59
59
  var Renderer = /*#__PURE__*/function (_PureComponent) {
60
60
  (0, _inherits2.default)(Renderer, _PureComponent);
61
61
  var _super = _createSuper(Renderer);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "108.2.6",
3
+ "version": "108.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,11 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useMemo } from 'react';
2
+ /** @jsx jsx */
3
+ import { useMemo } from 'react';
4
+ import { css, jsx } from '@emotion/react';
3
5
  import { Card } from '@atlaskit/smart-card';
4
6
  import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
5
7
  import { getPlatform } from '../../utils';
6
8
  import { CardErrorBoundary } from './fallback';
7
9
  import { getCardClickHandler } from '../utils/getCardClickHandler';
8
10
  import { AnalyticsContext } from '@atlaskit/analytics-next';
11
+ import { DatasourceTableView } from '@atlaskit/link-datasource';
12
+ // Temporary, until we add aspect ratio to the datasource table
13
+ const datasourceContainerStyle = css({
14
+ height: '500px',
15
+ overflow: 'auto'
16
+ });
9
17
  export default function BlockCard(props) {
10
18
  const {
11
19
  url,
@@ -33,6 +41,29 @@ export default function BlockCard(props) {
33
41
  // Below is added for the future implementation of Linking Platform namespaced analytic context
34
42
  location: 'renderer'
35
43
  };
44
+ if (props.datasource) {
45
+ const views = props.datasource.views;
46
+ const tableView = views.find(view => view.type === 'table');
47
+ if (tableView) {
48
+ var _tableView$properties;
49
+ const visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(({
50
+ key
51
+ }) => key);
52
+ return jsx(AnalyticsContext, {
53
+ data: analyticsData
54
+ }, jsx("div", {
55
+ css: datasourceContainerStyle
56
+ }, jsx(CardErrorBoundary, _extends({
57
+ unsupportedComponent: UnsupportedBlock
58
+ }, cardProps), jsx(DatasourceTableView, {
59
+ datasourceId: props.datasource.id,
60
+ parameters: props.datasource.parameters,
61
+ visibleColumnKeys: visibleColumnKeys,
62
+ onVisibleColumnKeysChange: undefined
63
+ }))));
64
+ }
65
+ return null;
66
+ }
36
67
  const onError = ({
37
68
  err
38
69
  }) => {
@@ -40,16 +71,16 @@ export default function BlockCard(props) {
40
71
  throw err;
41
72
  }
42
73
  };
43
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
74
+ return jsx(AnalyticsContext, {
44
75
  data: analyticsData
45
- }, /*#__PURE__*/React.createElement("div", {
76
+ }, jsx("div", {
46
77
  className: "blockCardView-content-wrap",
47
78
  "data-block-card": true,
48
79
  "data-card-data": data ? JSON.stringify(data) : undefined,
49
80
  "data-card-url": url
50
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
81
+ }, jsx(CardErrorBoundary, _extends({
51
82
  unsupportedComponent: UnsupportedBlock
52
- }, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
83
+ }, cardProps), jsx(Card, _extends({
53
84
  appearance: "block",
54
85
  showActions: rendererAppearance !== 'mobile',
55
86
  platform: platform,
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
35
35
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
36
36
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
37
37
  const packageName = "@atlaskit/renderer";
38
- const packageVersion = "108.2.6";
38
+ const packageVersion = "108.3.0";
39
39
  export class Renderer extends PureComponent {
40
40
  constructor(props) {
41
41
  super(props);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "108.2.6",
3
+ "version": "108.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,11 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useMemo } from 'react';
2
+ /** @jsx jsx */
3
+ import { useMemo } from 'react';
4
+ import { css, jsx } from '@emotion/react';
3
5
  import { Card } from '@atlaskit/smart-card';
4
6
  import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
5
7
  import { getPlatform } from '../../utils';
6
8
  import { CardErrorBoundary } from './fallback';
7
9
  import { getCardClickHandler } from '../utils/getCardClickHandler';
8
10
  import { AnalyticsContext } from '@atlaskit/analytics-next';
11
+ import { DatasourceTableView } from '@atlaskit/link-datasource';
12
+ // Temporary, until we add aspect ratio to the datasource table
13
+ var datasourceContainerStyle = css({
14
+ height: '500px',
15
+ overflow: 'auto'
16
+ });
9
17
  export default function BlockCard(props) {
10
18
  var url = props.url,
11
19
  data = props.data,
@@ -32,22 +40,48 @@ export default function BlockCard(props) {
32
40
  // Below is added for the future implementation of Linking Platform namespaced analytic context
33
41
  location: 'renderer'
34
42
  };
35
- var onError = function onError(_ref2) {
36
- var err = _ref2.err;
43
+ if (props.datasource) {
44
+ var views = props.datasource.views;
45
+ var tableView = views.find(function (view) {
46
+ return view.type === 'table';
47
+ });
48
+ if (tableView) {
49
+ var _tableView$properties;
50
+ var visibleColumnKeys = (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (_ref2) {
51
+ var key = _ref2.key;
52
+ return key;
53
+ });
54
+ return jsx(AnalyticsContext, {
55
+ data: analyticsData
56
+ }, jsx("div", {
57
+ css: datasourceContainerStyle
58
+ }, jsx(CardErrorBoundary, _extends({
59
+ unsupportedComponent: UnsupportedBlock
60
+ }, cardProps), jsx(DatasourceTableView, {
61
+ datasourceId: props.datasource.id,
62
+ parameters: props.datasource.parameters,
63
+ visibleColumnKeys: visibleColumnKeys,
64
+ onVisibleColumnKeysChange: undefined
65
+ }))));
66
+ }
67
+ return null;
68
+ }
69
+ var onError = function onError(_ref3) {
70
+ var err = _ref3.err;
37
71
  if (err) {
38
72
  throw err;
39
73
  }
40
74
  };
41
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
75
+ return jsx(AnalyticsContext, {
42
76
  data: analyticsData
43
- }, /*#__PURE__*/React.createElement("div", {
77
+ }, jsx("div", {
44
78
  className: "blockCardView-content-wrap",
45
79
  "data-block-card": true,
46
80
  "data-card-data": data ? JSON.stringify(data) : undefined,
47
81
  "data-card-url": url
48
- }, /*#__PURE__*/React.createElement(CardErrorBoundary, _extends({
82
+ }, jsx(CardErrorBoundary, _extends({
49
83
  unsupportedComponent: UnsupportedBlock
50
- }, cardProps), /*#__PURE__*/React.createElement(Card, _extends({
84
+ }, cardProps), jsx(Card, _extends({
51
85
  appearance: "block",
52
86
  showActions: rendererAppearance !== 'mobile',
53
87
  platform: platform,
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
45
45
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
46
46
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
47
47
  var packageName = "@atlaskit/renderer";
48
- var packageVersion = "108.2.6";
48
+ var packageVersion = "108.3.0";
49
49
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
50
50
  _inherits(Renderer, _PureComponent);
51
51
  var _super = _createSuper(Renderer);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "108.2.6",
3
+ "version": "108.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,12 +1,14 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
3
3
  import { RendererAppearance } from '../../ui/Renderer/types';
4
4
  import { SmartLinksOptions } from '../../types/smartLinksOptions';
5
+ import type { DatasourceAttributeProperties } from '@atlaskit/adf-schema/schema';
5
6
  export default function BlockCard(props: {
6
7
  url?: string;
7
8
  data?: object;
8
9
  eventHandlers?: EventHandlers;
10
+ datasource?: DatasourceAttributeProperties;
9
11
  portal?: HTMLElement;
10
12
  rendererAppearance?: RendererAppearance;
11
13
  smartLinks?: SmartLinksOptions;
12
- }): JSX.Element;
14
+ }): jsx.JSX.Element | null;
@@ -49,6 +49,7 @@ declare const BlockCard: React.ComponentType<{
49
49
  url?: string | undefined;
50
50
  data?: object | undefined;
51
51
  eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers | undefined;
52
+ datasource?: import("@atlaskit/adf-schema/schema").DatasourceAttributeProperties | undefined;
52
53
  portal?: HTMLElement | undefined;
53
54
  rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
54
55
  smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions | undefined;
@@ -1,12 +1,14 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import type { EventHandlers } from '@atlaskit/editor-common/ui';
3
3
  import { RendererAppearance } from '../../ui/Renderer/types';
4
4
  import { SmartLinksOptions } from '../../types/smartLinksOptions';
5
+ import type { DatasourceAttributeProperties } from '@atlaskit/adf-schema/schema';
5
6
  export default function BlockCard(props: {
6
7
  url?: string;
7
8
  data?: object;
8
9
  eventHandlers?: EventHandlers;
10
+ datasource?: DatasourceAttributeProperties;
9
11
  portal?: HTMLElement;
10
12
  rendererAppearance?: RendererAppearance;
11
13
  smartLinks?: SmartLinksOptions;
12
- }): JSX.Element;
14
+ }): jsx.JSX.Element | null;
@@ -49,6 +49,7 @@ declare const BlockCard: React.ComponentType<{
49
49
  url?: string | undefined;
50
50
  data?: object | undefined;
51
51
  eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers | undefined;
52
+ datasource?: import("@atlaskit/adf-schema/schema").DatasourceAttributeProperties | undefined;
52
53
  portal?: HTMLElement | undefined;
53
54
  rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
54
55
  smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "108.2.6",
3
+ "version": "108.3.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -45,6 +45,7 @@
45
45
  "@atlaskit/editor-shared-styles": "^2.4.0",
46
46
  "@atlaskit/emoji": "^67.4.0",
47
47
  "@atlaskit/icon": "^21.12.0",
48
+ "@atlaskit/link-datasource": "^0.24.0",
48
49
  "@atlaskit/media-card": "^76.0.0",
49
50
  "@atlaskit/media-client": "^23.1.0",
50
51
  "@atlaskit/media-common": "^7.0.0",
@@ -80,7 +81,7 @@
80
81
  "@atlaskit/avatar": "^21.3.0",
81
82
  "@atlaskit/css-reset": "^6.5.0",
82
83
  "@atlaskit/docs": "*",
83
- "@atlaskit/editor-core": "^185.3.0",
84
+ "@atlaskit/editor-core": "^185.4.0",
84
85
  "@atlaskit/editor-test-helpers": "^18.7.0",
85
86
  "@atlaskit/inline-edit": "^12.3.3",
86
87
  "@atlaskit/link-provider": "^1.6.0",