@atlaskit/renderer 130.2.4 → 130.2.5
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 +9 -0
- package/dist/cjs/react/nodes/table/colgroup.js +30 -4
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/table/colgroup.js +28 -4
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/table/colgroup.js +30 -4
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 130.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c896b4d6c83a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c896b4d6c83a3) -
|
|
8
|
+
Fix table column widths being scaled to viewport on first client render in synced blocks by keying
|
|
9
|
+
off renderWidthProp alone instead of contextWidth
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 130.2.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -139,9 +139,13 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
|
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// SSR / first render before
|
|
143
|
-
// columns are stable — the CSS container query (100cqw) handles actual
|
|
144
|
-
|
|
142
|
+
// SSR / first client render before WidthObserver measures. Output % of original ADF
|
|
143
|
+
// proportions so columns are stable — the CSS container query (100cqw) handles actual
|
|
144
|
+
// scaling width. We key off renderWidthProp alone because WidthProvider initialises with
|
|
145
|
+
// document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
|
|
146
|
+
// WidthObserver has measured the real container, which would skip this branch and produce
|
|
147
|
+
// column widths scaled to the full viewport.
|
|
148
|
+
if (renderWidthProp <= 0) {
|
|
145
149
|
var fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + _editorSharedStyles.akEditorTableNumberColumnWidth : rawTotalWidth;
|
|
146
150
|
return columnWidths.map(function (colWidth) {
|
|
147
151
|
return {
|
|
@@ -154,7 +158,29 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
|
|
|
154
158
|
// getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
|
|
155
159
|
var effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
|
|
156
160
|
var availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
|
|
157
|
-
|
|
161
|
+
|
|
162
|
+
// Only scale down if the table is actually wider than the available space.
|
|
163
|
+
// If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
|
|
164
|
+
// that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
|
|
165
|
+
if (availableWidth >= rawTotalWidth) {
|
|
166
|
+
return columnWidths.map(function (colWidth) {
|
|
167
|
+
return {
|
|
168
|
+
width: "".concat(Math.max(colWidth - _styles.tableCellBorderWidth, _styles.tableCellMinWidth), "px")
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
|
|
174
|
+
//
|
|
175
|
+
// Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
|
|
176
|
+
// excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
|
|
177
|
+
// equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
|
|
178
|
+
// and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
|
|
179
|
+
// (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
|
|
180
|
+
// columns are scaled by at most MAX_SCALING_PERCENT (30%).
|
|
181
|
+
var diffPercent = 1 - availableWidth / rawTotalWidth;
|
|
182
|
+
var clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
|
|
183
|
+
return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
|
|
158
184
|
};
|
|
159
185
|
var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
160
186
|
var _props$tableNode;
|
|
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
71
71
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
72
72
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
73
73
|
var packageName = "@atlaskit/renderer";
|
|
74
|
-
var packageVersion = "
|
|
74
|
+
var packageVersion = "0.0.0-development";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -113,9 +113,13 @@ const renderSyncBlockColgroup = ({
|
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
// SSR / first render before
|
|
117
|
-
// columns are stable — the CSS container query (100cqw) handles actual
|
|
118
|
-
|
|
116
|
+
// SSR / first client render before WidthObserver measures. Output % of original ADF
|
|
117
|
+
// proportions so columns are stable — the CSS container query (100cqw) handles actual
|
|
118
|
+
// scaling width. We key off renderWidthProp alone because WidthProvider initialises with
|
|
119
|
+
// document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
|
|
120
|
+
// WidthObserver has measured the real container, which would skip this branch and produce
|
|
121
|
+
// column widths scaled to the full viewport.
|
|
122
|
+
if (renderWidthProp <= 0) {
|
|
119
123
|
const fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + akEditorTableNumberColumnWidth : rawTotalWidth;
|
|
120
124
|
return columnWidths.map(colWidth => ({
|
|
121
125
|
width: `${colWidth / fullTableWidth * 100}%`
|
|
@@ -126,7 +130,27 @@ const renderSyncBlockColgroup = ({
|
|
|
126
130
|
// getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
|
|
127
131
|
const effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
|
|
128
132
|
const availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
|
|
129
|
-
|
|
133
|
+
|
|
134
|
+
// Only scale down if the table is actually wider than the available space.
|
|
135
|
+
// If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
|
|
136
|
+
// that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
|
|
137
|
+
if (availableWidth >= rawTotalWidth) {
|
|
138
|
+
return columnWidths.map(colWidth => ({
|
|
139
|
+
width: `${Math.max(colWidth - tableCellBorderWidth, tableCellMinWidth)}px`
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
|
|
144
|
+
//
|
|
145
|
+
// Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
|
|
146
|
+
// excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
|
|
147
|
+
// equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
|
|
148
|
+
// and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
|
|
149
|
+
// (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
|
|
150
|
+
// columns are scaled by at most MAX_SCALING_PERCENT (30%).
|
|
151
|
+
const diffPercent = 1 - availableWidth / rawTotalWidth;
|
|
152
|
+
const clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
|
|
153
|
+
return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
|
|
130
154
|
};
|
|
131
155
|
const renderScaleDownColgroup = props => {
|
|
132
156
|
var _props$tableNode;
|
|
@@ -57,7 +57,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
57
57
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
58
58
|
const RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
59
59
|
const packageName = "@atlaskit/renderer";
|
|
60
|
-
const packageVersion = "
|
|
60
|
+
const packageVersion = "0.0.0-development";
|
|
61
61
|
const setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size'
|
|
@@ -131,9 +131,13 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
|
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
// SSR / first render before
|
|
135
|
-
// columns are stable — the CSS container query (100cqw) handles actual
|
|
136
|
-
|
|
134
|
+
// SSR / first client render before WidthObserver measures. Output % of original ADF
|
|
135
|
+
// proportions so columns are stable — the CSS container query (100cqw) handles actual
|
|
136
|
+
// scaling width. We key off renderWidthProp alone because WidthProvider initialises with
|
|
137
|
+
// document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
|
|
138
|
+
// WidthObserver has measured the real container, which would skip this branch and produce
|
|
139
|
+
// column widths scaled to the full viewport.
|
|
140
|
+
if (renderWidthProp <= 0) {
|
|
137
141
|
var fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + akEditorTableNumberColumnWidth : rawTotalWidth;
|
|
138
142
|
return columnWidths.map(function (colWidth) {
|
|
139
143
|
return {
|
|
@@ -146,7 +150,29 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
|
|
|
146
150
|
// getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
|
|
147
151
|
var effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
|
|
148
152
|
var availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
|
|
149
|
-
|
|
153
|
+
|
|
154
|
+
// Only scale down if the table is actually wider than the available space.
|
|
155
|
+
// If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
|
|
156
|
+
// that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
|
|
157
|
+
if (availableWidth >= rawTotalWidth) {
|
|
158
|
+
return columnWidths.map(function (colWidth) {
|
|
159
|
+
return {
|
|
160
|
+
width: "".concat(Math.max(colWidth - tableCellBorderWidth, tableCellMinWidth), "px")
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
|
|
166
|
+
//
|
|
167
|
+
// Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
|
|
168
|
+
// excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
|
|
169
|
+
// equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
|
|
170
|
+
// and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
|
|
171
|
+
// (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
|
|
172
|
+
// columns are scaled by at most MAX_SCALING_PERCENT (30%).
|
|
173
|
+
var diffPercent = 1 - availableWidth / rawTotalWidth;
|
|
174
|
+
var clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
|
|
175
|
+
return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
|
|
150
176
|
};
|
|
151
177
|
var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
|
|
152
178
|
var _props$tableNode;
|
|
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
62
62
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
63
63
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "
|
|
65
|
+
var packageVersion = "0.0.0-development";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "130.2.
|
|
3
|
+
"version": "130.2.5",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"uuid": "^3.1.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@atlaskit/editor-common": "^114.
|
|
82
|
+
"@atlaskit/editor-common": "^114.6.0",
|
|
83
83
|
"@atlaskit/link-provider": "^4.3.0",
|
|
84
84
|
"@atlaskit/media-core": "^37.0.0",
|
|
85
85
|
"react": "^18.2.0",
|