@atlaskit/editor-plugin-card 1.1.5 → 1.2.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#76893](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76893) [`8d781cb52f84`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d781cb52f84) - [ux] Add support for datasource column wrapping controls
8
+ - Updated dependencies
9
+
10
+ ## 1.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [#77720](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77720) [`5b0f2fbdda16`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5b0f2fbdda16) - [ux] Added link preferences button to datasources (feature-flagged)
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 1.1.5
4
21
 
5
22
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.DatasourceComponent = exports.Datasource = void 0;
8
8
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
12
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
@@ -57,19 +58,38 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
57
58
  });
58
59
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleColumnChange", function (columnKeys) {
59
60
  var _this$getColumnsInfo = _this.getColumnsInfo(),
60
- columnCustomSizes = _this$getColumnsInfo.columnCustomSizes;
61
- _this.updateTableProperties(columnKeys, columnCustomSizes || {});
61
+ _this$getColumnsInfo$ = _this$getColumnsInfo.wrappedColumnKeys,
62
+ wrappedColumnKeys = _this$getColumnsInfo$ === void 0 ? [] : _this$getColumnsInfo$,
63
+ _this$getColumnsInfo$2 = _this$getColumnsInfo.columnCustomSizes,
64
+ columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2;
65
+ _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
62
66
  });
63
67
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleColumnResize", function (key, width) {
64
68
  var _this$getColumnsInfo2 = _this.getColumnsInfo(),
65
- columnCustomSizes = _this$getColumnsInfo2.columnCustomSizes,
66
- visibleColumnKeys = _this$getColumnsInfo2.visibleColumnKeys;
67
- var newColumnCustomSizes = _objectSpread(_objectSpread({}, columnCustomSizes || {}), {}, (0, _defineProperty2.default)({}, key, width));
68
- // In case for some reason there are no visible keys stored in ADF, we can take them from columnSizes
69
- // columnKeys are needed to update ADF (since custom width only make sense for a visible column)
70
- // So this function effectively adds a visible column if it wasn't there
71
- var columnKeys = visibleColumnKeys && visibleColumnKeys.indexOf(key) > -1 ? visibleColumnKeys : Object.keys(newColumnCustomSizes);
72
- _this.updateTableProperties(columnKeys, newColumnCustomSizes);
69
+ _this$getColumnsInfo3 = _this$getColumnsInfo2.wrappedColumnKeys,
70
+ wrappedColumnKeys = _this$getColumnsInfo3 === void 0 ? [] : _this$getColumnsInfo3,
71
+ _this$getColumnsInfo4 = _this$getColumnsInfo2.columnCustomSizes,
72
+ columnCustomSizes = _this$getColumnsInfo4 === void 0 ? {} : _this$getColumnsInfo4,
73
+ _this$getColumnsInfo5 = _this$getColumnsInfo2.visibleColumnKeys,
74
+ visibleColumnKeys = _this$getColumnsInfo5 === void 0 ? [] : _this$getColumnsInfo5;
75
+ var newColumnCustomSizes = _objectSpread(_objectSpread({}, columnCustomSizes), {}, (0, _defineProperty2.default)({}, key, width));
76
+ _this.updateTableProperties(visibleColumnKeys, newColumnCustomSizes, wrappedColumnKeys);
77
+ });
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleWrappedColumnChange", function (key, shouldWrap) {
79
+ var _this$getColumnsInfo6 = _this.getColumnsInfo(),
80
+ _this$getColumnsInfo7 = _this$getColumnsInfo6.wrappedColumnKeys,
81
+ wrappedColumnKeys = _this$getColumnsInfo7 === void 0 ? [] : _this$getColumnsInfo7,
82
+ _this$getColumnsInfo8 = _this$getColumnsInfo6.columnCustomSizes,
83
+ columnCustomSizes = _this$getColumnsInfo8 === void 0 ? {} : _this$getColumnsInfo8,
84
+ _this$getColumnsInfo9 = _this$getColumnsInfo6.visibleColumnKeys,
85
+ visibleColumnKeys = _this$getColumnsInfo9 === void 0 ? [] : _this$getColumnsInfo9;
86
+ var wrappedColumnKeysSet = new Set(wrappedColumnKeys);
87
+ if (shouldWrap) {
88
+ wrappedColumnKeysSet.add(key);
89
+ } else {
90
+ wrappedColumnKeysSet.delete(key);
91
+ }
92
+ _this.updateTableProperties(visibleColumnKeys, columnCustomSizes, Array.from(wrappedColumnKeysSet));
73
93
  });
74
94
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onError", function (_ref) {
75
95
  var err = _ref.err;
@@ -81,7 +101,7 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
81
101
  }
82
102
  (0, _createClass2.default)(DatasourceComponent, [{
83
103
  key: "updateTableProperties",
84
- value: function updateTableProperties(columnKeys, columnCustomSizes) {
104
+ value: function updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
85
105
  var _this$props$view = this.props.view,
86
106
  state = _this$props$view.state,
87
107
  dispatch = _this$props$view.dispatch;
@@ -89,14 +109,25 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
89
109
  if (pos === undefined) {
90
110
  return;
91
111
  }
112
+
113
+ // In case for some reason there are no visible keys stored in ADF, we take them
114
+ // from incoming sets of attributes like column sizes and wrapped column keys
115
+ // columnKeys are needed to update ADF (
116
+ // since attributes (like custom width and wrapped state) only make sense for a visible column )
117
+ // So this part effectively adds a visible column if it wasn't there but attributes were given.
118
+ var columnKeys = columnKeysArg.length > 0 ? columnKeysArg : Array.from(new Set([].concat((0, _toConsumableArray2.default)(Object.keys(columnCustomSizes)), (0, _toConsumableArray2.default)(wrappedColumnKeys))));
92
119
  var views = [{
93
120
  type: 'table',
94
121
  properties: {
95
122
  columns: columnKeys.map(function (key) {
96
- return _objectSpread({
123
+ var width = columnCustomSizes[key];
124
+ var isWrapped = wrappedColumnKeys.includes(key);
125
+ return _objectSpread(_objectSpread({
97
126
  key: key
98
- }, columnCustomSizes[key] ? {
99
- width: columnCustomSizes[key]
127
+ }, width ? {
128
+ width: width
129
+ } : {}), isWrapped ? {
130
+ isWrapped: isWrapped
100
131
  } : {});
101
132
  })
102
133
  }
@@ -133,9 +164,15 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
133
164
  });
134
165
  columnCustomSizes = Object.fromEntries(keyWidthPairs);
135
166
  }
167
+ var wrappedColumnKeys = columnsProp === null || columnsProp === void 0 ? void 0 : columnsProp.filter(function (c) {
168
+ return c.isWrapped;
169
+ }).map(function (c) {
170
+ return c.key;
171
+ });
136
172
  return {
137
173
  visibleColumnKeys: visibleColumnKeys,
138
- columnCustomSizes: columnCustomSizes
174
+ columnCustomSizes: columnCustomSizes,
175
+ wrappedColumnKeys: wrappedColumnKeys
139
176
  };
140
177
  }
141
178
  }, {
@@ -146,9 +183,10 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
146
183
  var attrs = this.props.node.attrs;
147
184
  var tableView = this.getTableView();
148
185
  if (tableView) {
149
- var _this$getColumnsInfo3 = this.getColumnsInfo(),
150
- visibleColumnKeys = _this$getColumnsInfo3.visibleColumnKeys,
151
- columnCustomSizes = _this$getColumnsInfo3.columnCustomSizes;
186
+ var _this$getColumnsInfo10 = this.getColumnsInfo(),
187
+ visibleColumnKeys = _this$getColumnsInfo10.visibleColumnKeys,
188
+ columnCustomSizes = _this$getColumnsInfo10.columnCustomSizes,
189
+ wrappedColumnKeys = _this$getColumnsInfo10.wrappedColumnKeys;
152
190
 
153
191
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready
154
192
  if (cardContext && cardContext.value) {
@@ -163,7 +201,9 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
163
201
  onVisibleColumnKeysChange: this.handleColumnChange,
164
202
  url: attrs === null || attrs === void 0 ? void 0 : attrs.url,
165
203
  onColumnResize: this.handleColumnResize,
166
- columnCustomSizes: columnCustomSizes
204
+ columnCustomSizes: columnCustomSizes,
205
+ onWrappedColumnChange: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-word_wrap') ? this.handleWrappedColumnChange : undefined,
206
+ wrappedColumnKeys: wrappedColumnKeys
167
207
  })));
168
208
  }
169
209
  }
@@ -447,24 +447,19 @@ var updateCardViaDatasource = exports.updateCardViaDatasource = function updateC
447
447
  if (newAdf.type === 'blockCard') {
448
448
  var _node$attrs, _newAdf$attrs;
449
449
  if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource && (_newAdf$attrs = newAdf.attrs) !== null && _newAdf$attrs !== void 0 && _newAdf$attrs.datasource) {
450
- var _ref3, _ref6, _newViews$properties, _oldViews$properties, _newAdf$attrs2, _node$attrs2;
451
- // datasource to datasource
452
- var _ref = (_ref3 = newAdf.attrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
450
+ var _ref3, _ref6, _oldViews$properties, _newViews$properties;
451
+ var newAttrs = newAdf.attrs;
452
+ var oldAttrs = node.attrs;
453
+ var _ref = (_ref3 = newAttrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
453
454
  _ref2 = (0, _slicedToArray2.default)(_ref, 1),
454
455
  newViews = _ref2[0];
455
- var _ref4 = (_ref6 = node.attrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
456
+ var _ref4 = (_ref6 = oldAttrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
456
457
  _ref5 = (0, _slicedToArray2.default)(_ref4, 1),
457
458
  oldViews = _ref5[0];
458
- var newColumnKeys = newViews === null || newViews === void 0 || (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(function (column) {
459
- return column.key;
460
- });
461
- var oldColumnKeys = oldViews === null || oldViews === void 0 || (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(function (column) {
462
- return column.key;
463
- });
464
- var isColumnChange = !(0, _isEqual.default)(oldColumnKeys, newColumnKeys);
465
- var isUrlChange = ((_newAdf$attrs2 = newAdf.attrs) === null || _newAdf$attrs2 === void 0 ? void 0 : _newAdf$attrs2.url) !== ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.url);
459
+ var isColumnChange = !(0, _isEqual.default)(oldViews === null || oldViews === void 0 || (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns, newViews === null || newViews === void 0 || (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns);
460
+ var isUrlChange = newAttrs.url !== oldAttrs.url;
466
461
  if (isColumnChange || isUrlChange) {
467
- tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
462
+ tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, oldAttrs), newAdf.attrs));
468
463
  }
469
464
  } else if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.enable-datasource-appearance-toolbar') && node.type.isText) {
470
465
  // url to datasource
@@ -438,7 +438,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
438
438
  type: 'separator'
439
439
  });
440
440
  }
441
- toolbarItems.push({
441
+ toolbarItems.push.apply(toolbarItems, [{
442
442
  type: 'copy-button',
443
443
  items: [{
444
444
  state: state,
@@ -447,7 +447,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
447
447
  }, {
448
448
  type: 'separator'
449
449
  }]
450
- }, {
450
+ }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.getBooleanFF)('platform.editor-add-link-preferences-button-to-datasources_xt1sh') ? getSettingsButtonGroup(intl, editorAnalyticsApi) : []), [{
451
451
  id: 'editor.link.delete',
452
452
  focusEditoronEnter: true,
453
453
  type: 'button',
@@ -459,7 +459,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
459
459
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
460
460
  title: intl.formatMessage(_messages.default.remove),
461
461
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
462
- });
462
+ }]));
463
463
  return toolbarItems;
464
464
  };
465
465
  var shouldRenderToolbarPulse = exports.shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled) {
@@ -17,6 +17,9 @@ var _doc = require("../../pm-plugins/doc");
17
17
  var _useFetchDatasourceInfo = require("../useFetchDatasourceInfo");
18
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); }
19
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
23
  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
24
  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; }
22
25
  var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
@@ -92,9 +95,34 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
92
95
  var _ref3 = views,
93
96
  _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
94
97
  tableView = _ref4[0];
95
- var visibleColumnKeys = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
96
- return column.key;
97
- });
98
+ var visibleColumnKeys = [];
99
+ var wrappedColumnKeys = [];
100
+ var columnCustomSizes;
101
+ var columns = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns;
102
+ if (columns) {
103
+ columnCustomSizes = {};
104
+ var _iterator = _createForOfIteratorHelper(columns),
105
+ _step;
106
+ try {
107
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
108
+ var _step$value = _step.value,
109
+ _key = _step$value.key,
110
+ width = _step$value.width,
111
+ isWrapped = _step$value.isWrapped;
112
+ visibleColumnKeys.push(_key);
113
+ if (width) {
114
+ columnCustomSizes[_key] = width;
115
+ }
116
+ if (isWrapped) {
117
+ wrappedColumnKeys.push(_key);
118
+ }
119
+ }
120
+ } catch (err) {
121
+ _iterator.e(err);
122
+ } finally {
123
+ _iterator.f();
124
+ }
125
+ }
98
126
  return /*#__PURE__*/_react.default.createElement("div", {
99
127
  "data-testid": "jira-config-modal"
100
128
  }, /*#__PURE__*/_react.default.createElement(_linkDatasource.JiraIssuesConfigModal, {
@@ -104,6 +132,8 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
104
132
  visibleColumnKeys: visibleColumnKeys,
105
133
  parameters: parameters,
106
134
  url: (_existingNode5 = existingNode) === null || _existingNode5 === void 0 ? void 0 : _existingNode5.attrs.url,
135
+ columnCustomSizes: columnCustomSizes,
136
+ wrappedColumnKeys: wrappedColumnKeys,
107
137
  onCancel: onClose,
108
138
  onInsert: onInsert
109
139
  }));
@@ -32,24 +32,36 @@ export class DatasourceComponent extends React.PureComponent {
32
32
  });
33
33
  _defineProperty(this, "handleColumnChange", columnKeys => {
34
34
  const {
35
- columnCustomSizes
35
+ wrappedColumnKeys = [],
36
+ columnCustomSizes = {}
36
37
  } = this.getColumnsInfo();
37
- this.updateTableProperties(columnKeys, columnCustomSizes || {});
38
+ this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
38
39
  });
39
40
  _defineProperty(this, "handleColumnResize", (key, width) => {
40
41
  const {
41
- columnCustomSizes,
42
- visibleColumnKeys
42
+ wrappedColumnKeys = [],
43
+ columnCustomSizes = {},
44
+ visibleColumnKeys = []
43
45
  } = this.getColumnsInfo();
44
46
  const newColumnCustomSizes = {
45
- ...(columnCustomSizes || {}),
47
+ ...columnCustomSizes,
46
48
  [key]: width
47
49
  };
48
- // In case for some reason there are no visible keys stored in ADF, we can take them from columnSizes
49
- // columnKeys are needed to update ADF (since custom width only make sense for a visible column)
50
- // So this function effectively adds a visible column if it wasn't there
51
- const columnKeys = visibleColumnKeys && visibleColumnKeys.indexOf(key) > -1 ? visibleColumnKeys : Object.keys(newColumnCustomSizes);
52
- this.updateTableProperties(columnKeys, newColumnCustomSizes);
50
+ this.updateTableProperties(visibleColumnKeys, newColumnCustomSizes, wrappedColumnKeys);
51
+ });
52
+ _defineProperty(this, "handleWrappedColumnChange", (key, shouldWrap) => {
53
+ const {
54
+ wrappedColumnKeys = [],
55
+ columnCustomSizes = {},
56
+ visibleColumnKeys = []
57
+ } = this.getColumnsInfo();
58
+ const wrappedColumnKeysSet = new Set(wrappedColumnKeys);
59
+ if (shouldWrap) {
60
+ wrappedColumnKeysSet.add(key);
61
+ } else {
62
+ wrappedColumnKeysSet.delete(key);
63
+ }
64
+ this.updateTableProperties(visibleColumnKeys, columnCustomSizes, Array.from(wrappedColumnKeysSet));
53
65
  });
54
66
  _defineProperty(this, "onError", ({
55
67
  err
@@ -59,7 +71,7 @@ export class DatasourceComponent extends React.PureComponent {
59
71
  }
60
72
  });
61
73
  }
62
- updateTableProperties(columnKeys, columnCustomSizes) {
74
+ updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
63
75
  const {
64
76
  state,
65
77
  dispatch
@@ -68,15 +80,29 @@ export class DatasourceComponent extends React.PureComponent {
68
80
  if (pos === undefined) {
69
81
  return;
70
82
  }
83
+
84
+ // In case for some reason there are no visible keys stored in ADF, we take them
85
+ // from incoming sets of attributes like column sizes and wrapped column keys
86
+ // columnKeys are needed to update ADF (
87
+ // since attributes (like custom width and wrapped state) only make sense for a visible column )
88
+ // So this part effectively adds a visible column if it wasn't there but attributes were given.
89
+ const columnKeys = columnKeysArg.length > 0 ? columnKeysArg : Array.from(new Set([...Object.keys(columnCustomSizes), ...wrappedColumnKeys]));
71
90
  const views = [{
72
91
  type: 'table',
73
92
  properties: {
74
- columns: columnKeys.map(key => ({
75
- key,
76
- ...(columnCustomSizes[key] ? {
77
- width: columnCustomSizes[key]
78
- } : {})
79
- }))
93
+ columns: columnKeys.map(key => {
94
+ const width = columnCustomSizes[key];
95
+ const isWrapped = wrappedColumnKeys.includes(key);
96
+ return {
97
+ key,
98
+ ...(width ? {
99
+ width
100
+ } : {}),
101
+ ...(isWrapped ? {
102
+ isWrapped
103
+ } : {})
104
+ };
105
+ })
80
106
  }
81
107
  }];
82
108
  const attrs = this.props.node.attrs;
@@ -106,9 +132,11 @@ export class DatasourceComponent extends React.PureComponent {
106
132
  const keyWidthPairs = columnsWithWidth.map(c => [c.key, c.width]);
107
133
  columnCustomSizes = Object.fromEntries(keyWidthPairs);
108
134
  }
135
+ const wrappedColumnKeys = columnsProp === null || columnsProp === void 0 ? void 0 : columnsProp.filter(c => c.isWrapped).map(c => c.key);
109
136
  return {
110
137
  visibleColumnKeys,
111
- columnCustomSizes
138
+ columnCustomSizes,
139
+ wrappedColumnKeys
112
140
  };
113
141
  }
114
142
  render() {
@@ -119,7 +147,8 @@ export class DatasourceComponent extends React.PureComponent {
119
147
  if (tableView) {
120
148
  const {
121
149
  visibleColumnKeys,
122
- columnCustomSizes
150
+ columnCustomSizes,
151
+ wrappedColumnKeys
123
152
  } = this.getColumnsInfo();
124
153
 
125
154
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready
@@ -135,7 +164,9 @@ export class DatasourceComponent extends React.PureComponent {
135
164
  onVisibleColumnKeysChange: this.handleColumnChange,
136
165
  url: attrs === null || attrs === void 0 ? void 0 : attrs.url,
137
166
  onColumnResize: this.handleColumnResize,
138
- columnCustomSizes: columnCustomSizes
167
+ columnCustomSizes: columnCustomSizes,
168
+ onWrappedColumnChange: getBooleanFF('platform.linking-platform.datasource-word_wrap') ? this.handleWrappedColumnChange : undefined,
169
+ wrappedColumnKeys: wrappedColumnKeys
139
170
  })));
140
171
  }
141
172
  }
@@ -428,17 +428,16 @@ export const updateCardViaDatasource = args => {
428
428
  if (newAdf.type === 'blockCard') {
429
429
  var _node$attrs, _newAdf$attrs;
430
430
  if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource && (_newAdf$attrs = newAdf.attrs) !== null && _newAdf$attrs !== void 0 && _newAdf$attrs.datasource) {
431
- var _ref, _ref2, _newViews$properties, _oldViews$properties, _newAdf$attrs2, _node$attrs2;
432
- // datasource to datasource
433
- const [newViews] = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
434
- const [oldViews] = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
435
- const newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(column => column.key);
436
- const oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(column => column.key);
437
- const isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
438
- const isUrlChange = ((_newAdf$attrs2 = newAdf.attrs) === null || _newAdf$attrs2 === void 0 ? void 0 : _newAdf$attrs2.url) !== ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.url);
431
+ var _ref, _ref2, _oldViews$properties, _newViews$properties;
432
+ const newAttrs = newAdf.attrs;
433
+ const oldAttrs = node.attrs;
434
+ const [newViews] = (_ref = newAttrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
435
+ const [oldViews] = (_ref2 = oldAttrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
436
+ const isColumnChange = !isEqual(oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns, newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns);
437
+ const isUrlChange = newAttrs.url !== oldAttrs.url;
439
438
  if (isColumnChange || isUrlChange) {
440
439
  tr.setNodeMarkup(from, schemaNodes.blockCard, {
441
- ...node.attrs,
440
+ ...oldAttrs,
442
441
  ...newAdf.attrs
443
442
  });
444
443
  }
@@ -440,7 +440,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
440
440
  }, {
441
441
  type: 'separator'
442
442
  }]
443
- }, {
443
+ }, ...(getBooleanFF('platform.editor-add-link-preferences-button-to-datasources_xt1sh') ? getSettingsButtonGroup(intl, editorAnalyticsApi) : []), {
444
444
  id: 'editor.link.delete',
445
445
  focusEditoronEnter: true,
446
446
  type: 'button',
@@ -79,7 +79,26 @@ export const DatasourceModal = ({
79
79
  views = []
80
80
  } = ((_existingNode4 = existingNode) === null || _existingNode4 === void 0 ? void 0 : (_existingNode4$attrs = _existingNode4.attrs) === null || _existingNode4$attrs === void 0 ? void 0 : _existingNode4$attrs.datasource) || {};
81
81
  const [tableView] = views;
82
- const visibleColumnKeys = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(column => column.key);
82
+ const visibleColumnKeys = [];
83
+ const wrappedColumnKeys = [];
84
+ let columnCustomSizes;
85
+ const columns = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns;
86
+ if (columns) {
87
+ columnCustomSizes = {};
88
+ for (const {
89
+ key,
90
+ width,
91
+ isWrapped
92
+ } of columns) {
93
+ visibleColumnKeys.push(key);
94
+ if (width) {
95
+ columnCustomSizes[key] = width;
96
+ }
97
+ if (isWrapped) {
98
+ wrappedColumnKeys.push(key);
99
+ }
100
+ }
101
+ }
83
102
  return /*#__PURE__*/React.createElement("div", {
84
103
  "data-testid": "jira-config-modal"
85
104
  }, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
@@ -89,6 +108,8 @@ export const DatasourceModal = ({
89
108
  visibleColumnKeys: visibleColumnKeys,
90
109
  parameters: parameters,
91
110
  url: (_existingNode5 = existingNode) === null || _existingNode5 === void 0 ? void 0 : _existingNode5.attrs.url,
111
+ columnCustomSizes: columnCustomSizes,
112
+ wrappedColumnKeys: wrappedColumnKeys,
92
113
  onCancel: onClose,
93
114
  onInsert: onInsert
94
115
  }));
@@ -1,4 +1,5 @@
1
1
  import _get from "@babel/runtime/helpers/get";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -51,19 +52,38 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
51
52
  });
52
53
  _defineProperty(_assertThisInitialized(_this), "handleColumnChange", function (columnKeys) {
53
54
  var _this$getColumnsInfo = _this.getColumnsInfo(),
54
- columnCustomSizes = _this$getColumnsInfo.columnCustomSizes;
55
- _this.updateTableProperties(columnKeys, columnCustomSizes || {});
55
+ _this$getColumnsInfo$ = _this$getColumnsInfo.wrappedColumnKeys,
56
+ wrappedColumnKeys = _this$getColumnsInfo$ === void 0 ? [] : _this$getColumnsInfo$,
57
+ _this$getColumnsInfo$2 = _this$getColumnsInfo.columnCustomSizes,
58
+ columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2;
59
+ _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
56
60
  });
57
61
  _defineProperty(_assertThisInitialized(_this), "handleColumnResize", function (key, width) {
58
62
  var _this$getColumnsInfo2 = _this.getColumnsInfo(),
59
- columnCustomSizes = _this$getColumnsInfo2.columnCustomSizes,
60
- visibleColumnKeys = _this$getColumnsInfo2.visibleColumnKeys;
61
- var newColumnCustomSizes = _objectSpread(_objectSpread({}, columnCustomSizes || {}), {}, _defineProperty({}, key, width));
62
- // In case for some reason there are no visible keys stored in ADF, we can take them from columnSizes
63
- // columnKeys are needed to update ADF (since custom width only make sense for a visible column)
64
- // So this function effectively adds a visible column if it wasn't there
65
- var columnKeys = visibleColumnKeys && visibleColumnKeys.indexOf(key) > -1 ? visibleColumnKeys : Object.keys(newColumnCustomSizes);
66
- _this.updateTableProperties(columnKeys, newColumnCustomSizes);
63
+ _this$getColumnsInfo3 = _this$getColumnsInfo2.wrappedColumnKeys,
64
+ wrappedColumnKeys = _this$getColumnsInfo3 === void 0 ? [] : _this$getColumnsInfo3,
65
+ _this$getColumnsInfo4 = _this$getColumnsInfo2.columnCustomSizes,
66
+ columnCustomSizes = _this$getColumnsInfo4 === void 0 ? {} : _this$getColumnsInfo4,
67
+ _this$getColumnsInfo5 = _this$getColumnsInfo2.visibleColumnKeys,
68
+ visibleColumnKeys = _this$getColumnsInfo5 === void 0 ? [] : _this$getColumnsInfo5;
69
+ var newColumnCustomSizes = _objectSpread(_objectSpread({}, columnCustomSizes), {}, _defineProperty({}, key, width));
70
+ _this.updateTableProperties(visibleColumnKeys, newColumnCustomSizes, wrappedColumnKeys);
71
+ });
72
+ _defineProperty(_assertThisInitialized(_this), "handleWrappedColumnChange", function (key, shouldWrap) {
73
+ var _this$getColumnsInfo6 = _this.getColumnsInfo(),
74
+ _this$getColumnsInfo7 = _this$getColumnsInfo6.wrappedColumnKeys,
75
+ wrappedColumnKeys = _this$getColumnsInfo7 === void 0 ? [] : _this$getColumnsInfo7,
76
+ _this$getColumnsInfo8 = _this$getColumnsInfo6.columnCustomSizes,
77
+ columnCustomSizes = _this$getColumnsInfo8 === void 0 ? {} : _this$getColumnsInfo8,
78
+ _this$getColumnsInfo9 = _this$getColumnsInfo6.visibleColumnKeys,
79
+ visibleColumnKeys = _this$getColumnsInfo9 === void 0 ? [] : _this$getColumnsInfo9;
80
+ var wrappedColumnKeysSet = new Set(wrappedColumnKeys);
81
+ if (shouldWrap) {
82
+ wrappedColumnKeysSet.add(key);
83
+ } else {
84
+ wrappedColumnKeysSet.delete(key);
85
+ }
86
+ _this.updateTableProperties(visibleColumnKeys, columnCustomSizes, Array.from(wrappedColumnKeysSet));
67
87
  });
68
88
  _defineProperty(_assertThisInitialized(_this), "onError", function (_ref) {
69
89
  var err = _ref.err;
@@ -75,7 +95,7 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
75
95
  }
76
96
  _createClass(DatasourceComponent, [{
77
97
  key: "updateTableProperties",
78
- value: function updateTableProperties(columnKeys, columnCustomSizes) {
98
+ value: function updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
79
99
  var _this$props$view = this.props.view,
80
100
  state = _this$props$view.state,
81
101
  dispatch = _this$props$view.dispatch;
@@ -83,14 +103,25 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
83
103
  if (pos === undefined) {
84
104
  return;
85
105
  }
106
+
107
+ // In case for some reason there are no visible keys stored in ADF, we take them
108
+ // from incoming sets of attributes like column sizes and wrapped column keys
109
+ // columnKeys are needed to update ADF (
110
+ // since attributes (like custom width and wrapped state) only make sense for a visible column )
111
+ // So this part effectively adds a visible column if it wasn't there but attributes were given.
112
+ var columnKeys = columnKeysArg.length > 0 ? columnKeysArg : Array.from(new Set([].concat(_toConsumableArray(Object.keys(columnCustomSizes)), _toConsumableArray(wrappedColumnKeys))));
86
113
  var views = [{
87
114
  type: 'table',
88
115
  properties: {
89
116
  columns: columnKeys.map(function (key) {
90
- return _objectSpread({
117
+ var width = columnCustomSizes[key];
118
+ var isWrapped = wrappedColumnKeys.includes(key);
119
+ return _objectSpread(_objectSpread({
91
120
  key: key
92
- }, columnCustomSizes[key] ? {
93
- width: columnCustomSizes[key]
121
+ }, width ? {
122
+ width: width
123
+ } : {}), isWrapped ? {
124
+ isWrapped: isWrapped
94
125
  } : {});
95
126
  })
96
127
  }
@@ -127,9 +158,15 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
127
158
  });
128
159
  columnCustomSizes = Object.fromEntries(keyWidthPairs);
129
160
  }
161
+ var wrappedColumnKeys = columnsProp === null || columnsProp === void 0 ? void 0 : columnsProp.filter(function (c) {
162
+ return c.isWrapped;
163
+ }).map(function (c) {
164
+ return c.key;
165
+ });
130
166
  return {
131
167
  visibleColumnKeys: visibleColumnKeys,
132
- columnCustomSizes: columnCustomSizes
168
+ columnCustomSizes: columnCustomSizes,
169
+ wrappedColumnKeys: wrappedColumnKeys
133
170
  };
134
171
  }
135
172
  }, {
@@ -140,9 +177,10 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
140
177
  var attrs = this.props.node.attrs;
141
178
  var tableView = this.getTableView();
142
179
  if (tableView) {
143
- var _this$getColumnsInfo3 = this.getColumnsInfo(),
144
- visibleColumnKeys = _this$getColumnsInfo3.visibleColumnKeys,
145
- columnCustomSizes = _this$getColumnsInfo3.columnCustomSizes;
180
+ var _this$getColumnsInfo10 = this.getColumnsInfo(),
181
+ visibleColumnKeys = _this$getColumnsInfo10.visibleColumnKeys,
182
+ columnCustomSizes = _this$getColumnsInfo10.columnCustomSizes,
183
+ wrappedColumnKeys = _this$getColumnsInfo10.wrappedColumnKeys;
146
184
 
147
185
  // [WS-2307]: we only render card wrapped into a Provider when the value is ready
148
186
  if (cardContext && cardContext.value) {
@@ -157,7 +195,9 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
157
195
  onVisibleColumnKeysChange: this.handleColumnChange,
158
196
  url: attrs === null || attrs === void 0 ? void 0 : attrs.url,
159
197
  onColumnResize: this.handleColumnResize,
160
- columnCustomSizes: columnCustomSizes
198
+ columnCustomSizes: columnCustomSizes,
199
+ onWrappedColumnChange: getBooleanFF('platform.linking-platform.datasource-word_wrap') ? this.handleWrappedColumnChange : undefined,
200
+ wrappedColumnKeys: wrappedColumnKeys
161
201
  })));
162
202
  }
163
203
  }
@@ -440,24 +440,19 @@ export var updateCardViaDatasource = function updateCardViaDatasource(args) {
440
440
  if (newAdf.type === 'blockCard') {
441
441
  var _node$attrs, _newAdf$attrs;
442
442
  if ((_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource && (_newAdf$attrs = newAdf.attrs) !== null && _newAdf$attrs !== void 0 && _newAdf$attrs.datasource) {
443
- var _ref3, _ref6, _newViews$properties, _oldViews$properties, _newAdf$attrs2, _node$attrs2;
444
- // datasource to datasource
445
- var _ref = (_ref3 = newAdf.attrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
443
+ var _ref3, _ref6, _oldViews$properties, _newViews$properties;
444
+ var newAttrs = newAdf.attrs;
445
+ var oldAttrs = node.attrs;
446
+ var _ref = (_ref3 = newAttrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
446
447
  _ref2 = _slicedToArray(_ref, 1),
447
448
  newViews = _ref2[0];
448
- var _ref4 = (_ref6 = node.attrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
449
+ var _ref4 = (_ref6 = oldAttrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
449
450
  _ref5 = _slicedToArray(_ref4, 1),
450
451
  oldViews = _ref5[0];
451
- var newColumnKeys = newViews === null || newViews === void 0 || (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(function (column) {
452
- return column.key;
453
- });
454
- var oldColumnKeys = oldViews === null || oldViews === void 0 || (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(function (column) {
455
- return column.key;
456
- });
457
- var isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
458
- var isUrlChange = ((_newAdf$attrs2 = newAdf.attrs) === null || _newAdf$attrs2 === void 0 ? void 0 : _newAdf$attrs2.url) !== ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.url);
452
+ var isColumnChange = !isEqual(oldViews === null || oldViews === void 0 || (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns, newViews === null || newViews === void 0 || (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns);
453
+ var isUrlChange = newAttrs.url !== oldAttrs.url;
459
454
  if (isColumnChange || isUrlChange) {
460
- tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
455
+ tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, oldAttrs), newAdf.attrs));
461
456
  }
462
457
  } else if (getBooleanFF('platform.linking-platform.enable-datasource-appearance-toolbar') && node.type.isText) {
463
458
  // url to datasource
@@ -428,7 +428,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
428
428
  type: 'separator'
429
429
  });
430
430
  }
431
- toolbarItems.push({
431
+ toolbarItems.push.apply(toolbarItems, [{
432
432
  type: 'copy-button',
433
433
  items: [{
434
434
  state: state,
@@ -437,7 +437,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
437
437
  }, {
438
438
  type: 'separator'
439
439
  }]
440
- }, {
440
+ }].concat(_toConsumableArray(getBooleanFF('platform.editor-add-link-preferences-button-to-datasources_xt1sh') ? getSettingsButtonGroup(intl, editorAnalyticsApi) : []), [{
441
441
  id: 'editor.link.delete',
442
442
  focusEditoronEnter: true,
443
443
  type: 'button',
@@ -449,7 +449,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
449
449
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
450
450
  title: intl.formatMessage(commonMessages.remove),
451
451
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
452
- });
452
+ }]));
453
453
  return toolbarItems;
454
454
  };
455
455
  export var shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled) {
@@ -1,5 +1,8 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
3
6
  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; }
4
7
  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; }
5
8
  import React, { useCallback } from 'react';
@@ -82,9 +85,34 @@ export var DatasourceModal = function DatasourceModal(_ref) {
82
85
  var _ref3 = views,
83
86
  _ref4 = _slicedToArray(_ref3, 1),
84
87
  tableView = _ref4[0];
85
- var visibleColumnKeys = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
86
- return column.key;
87
- });
88
+ var visibleColumnKeys = [];
89
+ var wrappedColumnKeys = [];
90
+ var columnCustomSizes;
91
+ var columns = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns;
92
+ if (columns) {
93
+ columnCustomSizes = {};
94
+ var _iterator = _createForOfIteratorHelper(columns),
95
+ _step;
96
+ try {
97
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
98
+ var _step$value = _step.value,
99
+ _key = _step$value.key,
100
+ width = _step$value.width,
101
+ isWrapped = _step$value.isWrapped;
102
+ visibleColumnKeys.push(_key);
103
+ if (width) {
104
+ columnCustomSizes[_key] = width;
105
+ }
106
+ if (isWrapped) {
107
+ wrappedColumnKeys.push(_key);
108
+ }
109
+ }
110
+ } catch (err) {
111
+ _iterator.e(err);
112
+ } finally {
113
+ _iterator.f();
114
+ }
115
+ }
88
116
  return /*#__PURE__*/React.createElement("div", {
89
117
  "data-testid": "jira-config-modal"
90
118
  }, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
@@ -94,6 +122,8 @@ export var DatasourceModal = function DatasourceModal(_ref) {
94
122
  visibleColumnKeys: visibleColumnKeys,
95
123
  parameters: parameters,
96
124
  url: (_existingNode5 = existingNode) === null || _existingNode5 === void 0 ? void 0 : _existingNode5.attrs.url,
125
+ columnCustomSizes: columnCustomSizes,
126
+ wrappedColumnKeys: wrappedColumnKeys,
97
127
  onCancel: onClose,
98
128
  onInsert: onInsert
99
129
  }));
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import type { DatasourceModalType } from '@atlaskit/editor-common/types';
3
3
  import type { APIError } from '@atlaskit/smart-card';
4
4
  import type { DatasourceProps } from './nodeviews/datasource';
5
- export type DatasourceErrorBoundaryProps = {
5
+ export type DatasourceErrorBoundaryProps = React.PropsWithChildren<{
6
6
  url?: string;
7
7
  unsupportedComponent?: React.ComponentType;
8
8
  handleError?: () => void;
9
9
  view: DatasourceProps['view'];
10
10
  datasourceModalType?: DatasourceModalType;
11
11
  datasourceId?: string;
12
- };
12
+ }>;
13
13
  export declare class DatasourceErrorBoundary extends React.Component<DatasourceErrorBoundaryProps> {
14
14
  state: {
15
15
  isError: boolean;
@@ -32,6 +32,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
32
32
  private updateTableProperties;
33
33
  handleColumnChange: (columnKeys: string[]) => void;
34
34
  handleColumnResize: (key: string, width: number) => void;
35
+ handleWrappedColumnChange: (key: string, shouldWrap: boolean) => void;
35
36
  onError: ({ err }: {
36
37
  err?: Error | undefined;
37
38
  }) => void;
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import type { DatasourceModalType } from '@atlaskit/editor-common/types';
3
3
  import type { APIError } from '@atlaskit/smart-card';
4
4
  import type { DatasourceProps } from './nodeviews/datasource';
5
- export type DatasourceErrorBoundaryProps = {
5
+ export type DatasourceErrorBoundaryProps = React.PropsWithChildren<{
6
6
  url?: string;
7
7
  unsupportedComponent?: React.ComponentType;
8
8
  handleError?: () => void;
9
9
  view: DatasourceProps['view'];
10
10
  datasourceModalType?: DatasourceModalType;
11
11
  datasourceId?: string;
12
- };
12
+ }>;
13
13
  export declare class DatasourceErrorBoundary extends React.Component<DatasourceErrorBoundaryProps> {
14
14
  state: {
15
15
  isError: boolean;
@@ -32,6 +32,7 @@ export declare class DatasourceComponent extends React.PureComponent<DatasourceC
32
32
  private updateTableProperties;
33
33
  handleColumnChange: (columnKeys: string[]) => void;
34
34
  handleColumnResize: (key: string, width: number) => void;
35
+ handleWrappedColumnChange: (key: string, shouldWrap: boolean) => void;
35
36
  onError: ({ err }: {
36
37
  err?: Error | undefined;
37
38
  }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/adf-schema": "^35.6.0",
36
36
  "@atlaskit/analytics-next": "^9.2.0",
37
37
  "@atlaskit/custom-steps": "^0.0.15",
38
- "@atlaskit/editor-common": "^78.12.0",
38
+ "@atlaskit/editor-common": "^78.14.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^1.0.0",
41
41
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
@@ -49,12 +49,12 @@
49
49
  "@atlaskit/icon": "^22.1.0",
50
50
  "@atlaskit/link-analytics": "^8.3.0",
51
51
  "@atlaskit/link-client-extension": "^1.8.0",
52
- "@atlaskit/link-datasource": "^1.23.0",
53
- "@atlaskit/linking-common": "^5.4.0",
52
+ "@atlaskit/link-datasource": "^1.24.0",
53
+ "@atlaskit/linking-common": "^5.5.0",
54
54
  "@atlaskit/linking-types": "^8.7.0",
55
55
  "@atlaskit/platform-feature-flags": "^0.2.0",
56
56
  "@atlaskit/primitives": "^4.1.0",
57
- "@atlaskit/smart-card": "^26.49.0",
57
+ "@atlaskit/smart-card": "^26.50.0",
58
58
  "@atlaskit/theme": "^12.6.0",
59
59
  "@atlaskit/tokens": "^1.41.0",
60
60
  "@babel/runtime": "^7.0.0",
@@ -95,11 +95,9 @@
95
95
  "ui-components": [
96
96
  "lite-mode"
97
97
  ],
98
- "deprecation": [
99
- "no-deprecated-imports"
100
- ],
98
+ "deprecation": "no-deprecated-imports",
101
99
  "styling": [
102
- "static",
100
+ "emotion",
103
101
  "emotion"
104
102
  ]
105
103
  }
@@ -112,9 +110,15 @@
112
110
  "platform.editor.show-embed-card-frame-renderer": {
113
111
  "type": "boolean"
114
112
  },
113
+ "platform.linking-platform.datasource-word_wrap": {
114
+ "type": "boolean"
115
+ },
115
116
  "platform.linking-platform.enable-datasource-appearance-toolbar": {
116
117
  "type": "boolean"
117
118
  },
119
+ "platform.editor-add-link-preferences-button-to-datasources_xt1sh": {
120
+ "type": "boolean"
121
+ },
118
122
  "platform.editor.card.fix-embed-card-select-all": {
119
123
  "type": "boolean"
120
124
  }
@@ -124,4 +128,4 @@
124
128
  "checkDevDependencies": true
125
129
  }
126
130
  }
127
- }
131
+ }