@nordicsemiconductor/pc-nrfconnect-shared 109.0.0 → 110.0.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
@@ -7,6 +7,12 @@ This project does _not_ adhere to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
8
8
  every new version is a new major version.
9
9
 
10
+ ## 110 - 2023-09-22
11
+
12
+ ### Fixed
13
+
14
+ - `MasonryLayout` dropdown component forced cards on different row to shift.
15
+
10
16
  ## 109 - 2023-09-21
11
17
 
12
18
  ### Changed
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" ?>
2
2
  <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
3
- <coverage lines-valid="3207" lines-covered="1788" line-rate="0.5575" branches-valid="1532" branches-covered="448" branch-rate="0.2924" timestamp="1695307913420" complexity="0" version="0.1">
3
+ <coverage lines-valid="3207" lines-covered="1788" line-rate="0.5575" branches-valid="1532" branches-covered="448" branch-rate="0.2924" timestamp="1695373602458" complexity="0" version="0.1">
4
4
  <sources>
5
5
  <source>/home/vsts/work/1/s</source>
6
6
  </sources>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "109.0.0",
3
+ "version": "110.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -102,7 +102,8 @@ export default ({
102
102
 
103
103
  const generateMetaData = (col: number) => {
104
104
  let child = masonryLayoutRef.current?.firstElementChild;
105
- const heightMatrix: number[][] = [];
105
+ const offsetHeightMatrix: number[][] = [];
106
+ const scrollHeightMatrix: number[][] = [];
106
107
  const zeroHeightChildren: boolean[] = [];
107
108
 
108
109
  let i = 0;
@@ -111,11 +112,14 @@ export default ({
111
112
  if (!child.hasAttribute('data-filler')) {
112
113
  const rowIndex = Math.floor(i / col);
113
114
 
114
- if (heightMatrix[rowIndex] === undefined) {
115
- heightMatrix[rowIndex] = [];
115
+ if (offsetHeightMatrix[rowIndex] === undefined) {
116
+ offsetHeightMatrix[rowIndex] = [];
117
+ scrollHeightMatrix[rowIndex] = [];
116
118
  }
117
119
 
118
- const row = heightMatrix[rowIndex];
120
+ const offsetHeightRow = offsetHeightMatrix[rowIndex];
121
+ const scrollHeightRow = scrollHeightMatrix[rowIndex];
122
+ let scrollHeightRowDiff = 0;
119
123
  const columnIndex = i % col;
120
124
 
121
125
  i += 1;
@@ -123,19 +127,34 @@ export default ({
123
127
  child.offsetHeight <=
124
128
  Number.parseInt(styles.margin, 10)
125
129
  ) {
126
- row[columnIndex] = 0;
130
+ offsetHeightRow[columnIndex] = 0;
127
131
  zeroHeightChildren.push(true);
128
132
  } else {
129
- row[columnIndex] = child.scrollHeight + 9; // 8 border bottom + 1px to round as value might be decimal
133
+ offsetHeightRow[columnIndex] =
134
+ child.offsetHeight + 1; // 1px to round as value might be decimal
135
+ scrollHeightRowDiff =
136
+ child.scrollHeight +
137
+ 9 -
138
+ offsetHeightRow[columnIndex]; // 8 border bottom + 1px to round as value might be decimal
130
139
  zeroHeightChildren.push(false);
131
140
  }
141
+
142
+ scrollHeightRow[columnIndex] =
143
+ offsetHeightMatrix.reduce(
144
+ (p, c) => p + c[columnIndex],
145
+ 0
146
+ ) + scrollHeightRowDiff;
132
147
  }
133
148
 
134
149
  child = child.nextElementSibling;
135
150
  }
136
151
  }
137
152
 
138
- return { heightMatrix, hiddenChildren: zeroHeightChildren };
153
+ return {
154
+ offsetHeightMatrix,
155
+ scrollHeightMatrix,
156
+ hiddenChildren: zeroHeightChildren,
157
+ };
139
158
  };
140
159
 
141
160
  const calcData = (col: number) => {
@@ -143,7 +162,7 @@ export default ({
143
162
  const heights: number[] = Array(col).fill(0);
144
163
  const newOrder: number[] = [];
145
164
 
146
- metaData.heightMatrix.forEach(row => {
165
+ metaData.offsetHeightMatrix.forEach(row => {
147
166
  row.forEach(itemHeight => {
148
167
  const smallest =
149
168
  heights.findIndex(h => h === Math.min(...heights)) ?? 0;
@@ -153,7 +172,10 @@ export default ({
153
172
  });
154
173
 
155
174
  return {
156
- maxHeight: Math.max(...heights, 0),
175
+ maxHeight: Math.max(
176
+ ...heights,
177
+ ...metaData.scrollHeightMatrix.flat()
178
+ ),
157
179
  order: newOrder,
158
180
  columnHeights: heights,
159
181
  columns: Math.min(
@@ -1 +1 @@
1
- {"version":3,"file":"MasonryLayout.d.ts","sourceRoot":"","sources":["../../../../src/MasonryLayout/MasonryLayout.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAM9E,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAiED;;;;;;GAMG;6DAKA,kBAAkB,uBAAuB,CAAC;AAJ7C,wBA2IE"}
1
+ {"version":3,"file":"MasonryLayout.d.ts","sourceRoot":"","sources":["../../../../src/MasonryLayout/MasonryLayout.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,iBAAiB,EAA+B,MAAM,OAAO,CAAC;AAM9E,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAiED;;;;;;GAMG;6DAKA,kBAAkB,uBAAuB,CAAC;AAJ7C,wBAiKE"}