@atlaskit/renderer 109.30.0 → 109.30.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.
@@ -47,6 +47,11 @@ var calcScalePercent = exports.calcScalePercent = function calcScalePercent(_ref
47
47
  var diffPercent = 1 - renderWidth / tableWidth;
48
48
  return diffPercent < maxScale ? diffPercent : maxScale;
49
49
  };
50
+ var colWidthSum = function colWidthSum(columnWidths) {
51
+ return columnWidths.reduce(function (prev, curr) {
52
+ return curr + prev;
53
+ }, 0);
54
+ };
50
55
  var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
51
56
  var _props$tableNode;
52
57
  var columnWidths = props.columnWidths,
@@ -73,9 +78,17 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
73
78
  } else if (!tableResized) {
74
79
  return null;
75
80
  }
81
+ var sumOfColumns = colWidthSum(columnWidths);
82
+
83
+ // A bug was released that caused col resizing in editor to be off by 2px, so using 2 here
84
+ var isTableSmallerThanContainer = sumOfColumns < tableContainerWidth - 2;
85
+ var forceScaleForNumColumn = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized &&
86
+ // if table col widths are smaller than container, then ignore. Most likely was created before custom table widths, where
87
+ // col widths could be smaller than container width (width was enforced by breakout buttons)
88
+ !isTableSmallerThanContainer;
76
89
 
77
90
  // when table resized and number column is enabled, we need to scale down the table in render
78
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
91
+ if (forceScaleForNumColumn) {
79
92
  var scalePercentage = +((tableContainerWidth - _editorSharedStyles.akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
80
93
  var targetMaxWidth = tableContainerWidth - _editorSharedStyles.akEditorTableNumberColumnWidth;
81
94
  var totalWidthAfterScale = 0;
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
56
56
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
57
57
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
58
58
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "109.30.0";
59
+ var packageVersion = "109.30.1";
60
60
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
61
61
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
62
62
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -36,6 +36,7 @@ export const calcScalePercent = ({
36
36
  const diffPercent = 1 - renderWidth / tableWidth;
37
37
  return diffPercent < maxScale ? diffPercent : maxScale;
38
38
  };
39
+ const colWidthSum = columnWidths => columnWidths.reduce((prev, curr) => curr + prev, 0);
39
40
  const renderScaleDownColgroup = props => {
40
41
  var _props$tableNode;
41
42
  let {
@@ -64,9 +65,17 @@ const renderScaleDownColgroup = props => {
64
65
  } else if (!tableResized) {
65
66
  return null;
66
67
  }
68
+ const sumOfColumns = colWidthSum(columnWidths);
69
+
70
+ // A bug was released that caused col resizing in editor to be off by 2px, so using 2 here
71
+ const isTableSmallerThanContainer = sumOfColumns < tableContainerWidth - 2;
72
+ const forceScaleForNumColumn = getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized &&
73
+ // if table col widths are smaller than container, then ignore. Most likely was created before custom table widths, where
74
+ // col widths could be smaller than container width (width was enforced by breakout buttons)
75
+ !isTableSmallerThanContainer;
67
76
 
68
77
  // when table resized and number column is enabled, we need to scale down the table in render
69
- if (getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
78
+ if (forceScaleForNumColumn) {
70
79
  const scalePercentage = +((tableContainerWidth - akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
71
80
  const targetMaxWidth = tableContainerWidth - akEditorTableNumberColumnWidth;
72
81
  let totalWidthAfterScale = 0;
@@ -37,7 +37,7 @@ import { nodeToReact } from '../../react/nodes';
37
37
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
38
38
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
39
39
  const packageName = "@atlaskit/renderer";
40
- const packageVersion = "109.30.0";
40
+ const packageVersion = "109.30.1";
41
41
  export const defaultNodeComponents = nodeToReact;
42
42
  export class Renderer extends PureComponent {
43
43
  constructor(props) {
@@ -40,6 +40,11 @@ export var calcScalePercent = function calcScalePercent(_ref) {
40
40
  var diffPercent = 1 - renderWidth / tableWidth;
41
41
  return diffPercent < maxScale ? diffPercent : maxScale;
42
42
  };
43
+ var colWidthSum = function colWidthSum(columnWidths) {
44
+ return columnWidths.reduce(function (prev, curr) {
45
+ return curr + prev;
46
+ }, 0);
47
+ };
43
48
  var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
44
49
  var _props$tableNode;
45
50
  var columnWidths = props.columnWidths,
@@ -66,9 +71,17 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
66
71
  } else if (!tableResized) {
67
72
  return null;
68
73
  }
74
+ var sumOfColumns = colWidthSum(columnWidths);
75
+
76
+ // A bug was released that caused col resizing in editor to be off by 2px, so using 2 here
77
+ var isTableSmallerThanContainer = sumOfColumns < tableContainerWidth - 2;
78
+ var forceScaleForNumColumn = getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized &&
79
+ // if table col widths are smaller than container, then ignore. Most likely was created before custom table widths, where
80
+ // col widths could be smaller than container width (width was enforced by breakout buttons)
81
+ !isTableSmallerThanContainer;
69
82
 
70
83
  // when table resized and number column is enabled, we need to scale down the table in render
71
- if (getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
84
+ if (forceScaleForNumColumn) {
72
85
  var scalePercentage = +((tableContainerWidth - akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
73
86
  var targetMaxWidth = tableContainerWidth - akEditorTableNumberColumnWidth;
74
87
  var totalWidthAfterScale = 0;
@@ -47,7 +47,7 @@ import { nodeToReact } from '../../react/nodes';
47
47
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
48
48
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
49
49
  var packageName = "@atlaskit/renderer";
50
- var packageVersion = "109.30.0";
50
+ var packageVersion = "109.30.1";
51
51
  export var defaultNodeComponents = nodeToReact;
52
52
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
53
53
  _inherits(Renderer, _PureComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.30.0",
3
+ "version": "109.30.1",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,14 +40,14 @@
40
40
  "@atlaskit/icon": "^22.3.0",
41
41
  "@atlaskit/link-datasource": "^2.3.0",
42
42
  "@atlaskit/media-card": "^77.11.0",
43
- "@atlaskit/media-client": "^27.1.0",
43
+ "@atlaskit/media-client": "^27.2.0",
44
44
  "@atlaskit/media-client-react": "^2.0.0",
45
45
  "@atlaskit/media-common": "^11.2.0",
46
46
  "@atlaskit/media-filmstrip": "^47.0.0",
47
47
  "@atlaskit/media-ui": "^25.10.0",
48
- "@atlaskit/media-viewer": "^48.5.0",
48
+ "@atlaskit/media-viewer": "^48.6.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
50
- "@atlaskit/smart-card": "^27.2.0",
50
+ "@atlaskit/smart-card": "^27.4.0",
51
51
  "@atlaskit/status": "^1.4.0",
52
52
  "@atlaskit/task-decision": "^17.10.0",
53
53
  "@atlaskit/theme": "^12.8.0",
@@ -84,7 +84,6 @@
84
84
  "@atlaskit/util-data-test": "^17.9.0",
85
85
  "@atlaskit/visual-regression": "*",
86
86
  "@atlaskit/webdriver-runner": "*",
87
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
88
87
  "@atlassian/feature-flags-test-utils": "*",
89
88
  "@testing-library/react": "^12.1.5",
90
89
  "@testing-library/react-hooks": "^8.0.1",
@@ -106,7 +105,6 @@
106
105
  "typescript": "~5.4.2",
107
106
  "worker-plugin": "^4.0.2"
108
107
  },
109
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
110
108
  "techstack": {
111
109
  "@repo/internal": {
112
110
  "design-tokens": [