@atlaskit/renderer 119.0.3 → 119.0.4

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,14 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 119.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#175396](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/175396)
8
+ [`a40f4f8831421`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a40f4f8831421) -
9
+ Fix numbered column width calculation
10
+ - Updated dependencies
11
+
3
12
  ## 119.0.3
4
13
 
5
14
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.Colgroup = void 0;
7
+ exports.colWidthSum = exports.Colgroup = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _styles = require("@atlaskit/editor-common/styles");
@@ -54,7 +54,7 @@ var calcScalePercent = function calcScalePercent(_ref) {
54
54
  var diffPercent = 1 - noNumColumnScalePercent;
55
55
  return diffPercent < maxScale ? isNumberColumnEnabled ? 1 - numColumnScalePercent : diffPercent : maxScale;
56
56
  };
57
- var colWidthSum = function colWidthSum(columnWidths) {
57
+ var colWidthSum = exports.colWidthSum = function colWidthSum(columnWidths) {
58
58
  return columnWidths.reduce(function (prev, curr) {
59
59
  return curr + prev;
60
60
  }, 0);
@@ -29,6 +29,7 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
29
29
  _ref$fixTableSSRResiz = _ref.fixTableSSRResizing,
30
30
  fixTableSSRResizing = _ref$fixTableSSRResiz === void 0 ? false : _ref$fixTableSSRResiz;
31
31
  var tableWidth = tableNode ? (0, _nodeWidth.getTableContainerWidth)(tableNode) : _editorSharedStyles.akEditorDefaultLayoutWidth;
32
+ var tableColumnWidths = columnWidths;
32
33
  if (rendererAppearance === 'comment' && allowTableResizing && tableNode && !((_tableNode$attrs = tableNode.attrs) !== null && _tableNode$attrs !== void 0 && _tableNode$attrs.width)) {
33
34
  tableWidth = 'inherit';
34
35
  }
@@ -40,6 +41,15 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
40
41
  tableWidth = renderWidth;
41
42
  }
42
43
  }
44
+
45
+ // for columns that are evenly distributed, do not return `colgroup` since existing table containerQuery
46
+ // scales up the columns width. This ensures columns always have 42px.
47
+ if (rendererAppearance === 'comment') {
48
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
49
+ if ((0, _platformFeatureFlags.fg)('platform-ssr-table-resize') && (0, _platformFeatureFlags.fg)('platform_table_number_column')) {
50
+ tableColumnWidths = columnWidths && (0, _colgroup.colWidthSum)(columnWidths) ? columnWidths : undefined;
51
+ }
52
+ }
43
53
  var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
44
54
  var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
45
55
  return /*#__PURE__*/_react.default.createElement("table", (0, _extends2.default)({}, (0, _platformFeatureFlags.fg)('platform_renderer_isPresentational') && {
@@ -55,7 +65,7 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
55
65
  marginTop: fixTableSSRResizing ? '0px' : ''
56
66
  }
57
67
  }), /*#__PURE__*/_react.default.createElement(_colgroup.Colgroup, {
58
- columnWidths: columnWidths,
68
+ columnWidths: tableColumnWidths,
59
69
  layout: layout,
60
70
  isNumberColumnEnabled: isNumberColumnEnabled,
61
71
  renderWidth: renderWidth,
@@ -62,7 +62,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
62
62
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
63
63
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "119.0.2";
65
+ var packageVersion = "119.0.3";
66
66
  var setAsQueryContainerStyles = (0, _react2.css)({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
@@ -44,7 +44,7 @@ const calcScalePercent = ({
44
44
  const diffPercent = 1 - noNumColumnScalePercent;
45
45
  return diffPercent < maxScale ? isNumberColumnEnabled ? 1 - numColumnScalePercent : diffPercent : maxScale;
46
46
  };
47
- const colWidthSum = columnWidths => columnWidths.reduce((prev, curr) => curr + prev, 0);
47
+ export const colWidthSum = columnWidths => columnWidths.reduce((prev, curr) => curr + prev, 0);
48
48
  const renderScaleDownColgroup = props => {
49
49
  var _props$tableNode;
50
50
  const {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { Colgroup } from './colgroup';
3
+ import { Colgroup, colWidthSum } from './colgroup';
4
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
5
  import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -22,6 +22,7 @@ export const Table = /*#__PURE__*/React.memo(({
22
22
  }) => {
23
23
  var _tableNode$attrs;
24
24
  let tableWidth = tableNode ? getTableContainerWidth(tableNode) : akEditorDefaultLayoutWidth;
25
+ let tableColumnWidths = columnWidths;
25
26
  if (rendererAppearance === 'comment' && allowTableResizing && tableNode && !((_tableNode$attrs = tableNode.attrs) !== null && _tableNode$attrs !== void 0 && _tableNode$attrs.width)) {
26
27
  tableWidth = 'inherit';
27
28
  }
@@ -33,6 +34,15 @@ export const Table = /*#__PURE__*/React.memo(({
33
34
  tableWidth = renderWidth;
34
35
  }
35
36
  }
37
+
38
+ // for columns that are evenly distributed, do not return `colgroup` since existing table containerQuery
39
+ // scales up the columns width. This ensures columns always have 42px.
40
+ if (rendererAppearance === 'comment') {
41
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
42
+ if (fg('platform-ssr-table-resize') && fg('platform_table_number_column')) {
43
+ tableColumnWidths = columnWidths && colWidthSum(columnWidths) ? columnWidths : undefined;
44
+ }
45
+ }
36
46
  const tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
37
47
  const tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
38
48
  return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
@@ -48,7 +58,7 @@ export const Table = /*#__PURE__*/React.memo(({
48
58
  marginTop: fixTableSSRResizing ? '0px' : ''
49
59
  }
50
60
  }), /*#__PURE__*/React.createElement(Colgroup, {
51
- columnWidths: columnWidths,
61
+ columnWidths: tableColumnWidths,
52
62
  layout: layout,
53
63
  isNumberColumnEnabled: isNumberColumnEnabled,
54
64
  renderWidth: renderWidth,
@@ -48,7 +48,7 @@ import { PortalContext } from './PortalContext';
48
48
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
49
49
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
50
50
  const packageName = "@atlaskit/renderer";
51
- const packageVersion = "119.0.2";
51
+ const packageVersion = "119.0.3";
52
52
  const setAsQueryContainerStyles = css({
53
53
  containerName: 'ak-renderer-wrapper',
54
54
  containerType: 'inline-size'
@@ -48,7 +48,7 @@ var calcScalePercent = function calcScalePercent(_ref) {
48
48
  var diffPercent = 1 - noNumColumnScalePercent;
49
49
  return diffPercent < maxScale ? isNumberColumnEnabled ? 1 - numColumnScalePercent : diffPercent : maxScale;
50
50
  };
51
- var colWidthSum = function colWidthSum(columnWidths) {
51
+ export var colWidthSum = function colWidthSum(columnWidths) {
52
52
  return columnWidths.reduce(function (prev, curr) {
53
53
  return curr + prev;
54
54
  }, 0);
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { Colgroup } from './colgroup';
3
+ import { Colgroup, colWidthSum } from './colgroup';
4
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
5
  import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -22,6 +22,7 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
22
22
  _ref$fixTableSSRResiz = _ref.fixTableSSRResizing,
23
23
  fixTableSSRResizing = _ref$fixTableSSRResiz === void 0 ? false : _ref$fixTableSSRResiz;
24
24
  var tableWidth = tableNode ? getTableContainerWidth(tableNode) : akEditorDefaultLayoutWidth;
25
+ var tableColumnWidths = columnWidths;
25
26
  if (rendererAppearance === 'comment' && allowTableResizing && tableNode && !((_tableNode$attrs = tableNode.attrs) !== null && _tableNode$attrs !== void 0 && _tableNode$attrs.width)) {
26
27
  tableWidth = 'inherit';
27
28
  }
@@ -33,6 +34,15 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
33
34
  tableWidth = renderWidth;
34
35
  }
35
36
  }
37
+
38
+ // for columns that are evenly distributed, do not return `colgroup` since existing table containerQuery
39
+ // scales up the columns width. This ensures columns always have 42px.
40
+ if (rendererAppearance === 'comment') {
41
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
42
+ if (fg('platform-ssr-table-resize') && fg('platform_table_number_column')) {
43
+ tableColumnWidths = columnWidths && colWidthSum(columnWidths) ? columnWidths : undefined;
44
+ }
45
+ }
36
46
  var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
37
47
  var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
38
48
  return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
@@ -48,7 +58,7 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
48
58
  marginTop: fixTableSSRResizing ? '0px' : ''
49
59
  }
50
60
  }), /*#__PURE__*/React.createElement(Colgroup, {
51
- columnWidths: columnWidths,
61
+ columnWidths: tableColumnWidths,
52
62
  layout: layout,
53
63
  isNumberColumnEnabled: isNumberColumnEnabled,
54
64
  renderWidth: renderWidth,
@@ -53,7 +53,7 @@ import { PortalContext } from './PortalContext';
53
53
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
54
54
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
55
55
  var packageName = "@atlaskit/renderer";
56
- var packageVersion = "119.0.2";
56
+ var packageVersion = "119.0.3";
57
57
  var setAsQueryContainerStyles = css({
58
58
  containerName: 'ak-renderer-wrapper',
59
59
  containerType: 'inline-size'
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { SharedTableProps } from './types';
3
+ export declare const colWidthSum: (columnWidths: number[]) => number;
3
4
  export declare const Colgroup: (props: SharedTableProps) => React.JSX.Element | null;
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { SharedTableProps } from './types';
3
+ export declare const colWidthSum: (columnWidths: number[]) => number;
3
4
  export declare const Colgroup: (props: SharedTableProps) => React.JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "119.0.3",
3
+ "version": "119.0.4",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-tables": "^2.9.0",
40
40
  "@atlaskit/emoji": "^69.3.0",
41
41
  "@atlaskit/feature-gate-js-client": "^5.3.0",
42
- "@atlaskit/icon": "^27.1.0",
42
+ "@atlaskit/icon": "^27.2.0",
43
43
  "@atlaskit/link": "^3.2.0",
44
44
  "@atlaskit/link-datasource": "^4.11.0",
45
45
  "@atlaskit/media-card": "^79.3.0",
@@ -51,12 +51,12 @@
51
51
  "@atlaskit/media-viewer": "^52.3.0",
52
52
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
53
  "@atlaskit/platform-feature-flags-react": "^0.2.0",
54
- "@atlaskit/react-ufo": "^3.13.0",
54
+ "@atlaskit/react-ufo": "^3.14.0",
55
55
  "@atlaskit/smart-card": "^38.14.0",
56
56
  "@atlaskit/status": "^3.0.0",
57
57
  "@atlaskit/task-decision": "^19.2.0",
58
58
  "@atlaskit/theme": "^18.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^8.1.0",
59
+ "@atlaskit/tmp-editor-statsig": "^8.2.0",
60
60
  "@atlaskit/tokens": "^5.4.0",
61
61
  "@atlaskit/tooltip": "^20.3.0",
62
62
  "@atlaskit/visually-hidden": "^3.0.0",
@@ -269,6 +269,9 @@
269
269
  "prompt_whiteboard_competitor_link_gate": {
270
270
  "type": "boolean"
271
271
  },
272
+ "platform_table_number_column": {
273
+ "type": "boolean"
274
+ },
272
275
  "issue_table_single_line_row_height_fast_follows": {
273
276
  "type": "boolean"
274
277
  }