@neovici/cosmoz-omnitable 14.3.0 → 14.3.2
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/cosmoz-omnitable-styles.js +1 -1
- package/lib/compute-layout.js +24 -7
- package/package.json +1 -1
package/lib/compute-layout.js
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import { layout } from './layout';
|
|
2
2
|
|
|
3
|
-
const _toCss = (layout, config) =>
|
|
4
|
-
|
|
3
|
+
const _toCss = (layout, config) => {
|
|
4
|
+
const lastVisibleIndex = layout.findLastIndex(
|
|
5
|
+
(width) => width != null && width > 0,
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
return config
|
|
5
9
|
.map((item, index) => {
|
|
6
10
|
const width = layout[index];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// Hidden columns
|
|
12
|
+
if (width == null || width === 0) {
|
|
13
|
+
return `cosmoz-omnitable-resize-nub[name="${item.name}"], .cell[name="${item.name}"]{display:none}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Last visible column, show the cell but hide its resize nub
|
|
17
|
+
if (index === lastVisibleIndex) {
|
|
18
|
+
return `.cell[name="${item.name}"]{width: ${Math.floor(
|
|
19
|
+
width,
|
|
20
|
+
)}px;padding: 0 min(3px, ${width / 2}px)}
|
|
21
|
+
cosmoz-omnitable-resize-nub[name="${item.name}"]{display:none}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Other visible columns
|
|
25
|
+
return `.cell[name="${item.name}"]{width: ${Math.floor(
|
|
26
|
+
width,
|
|
27
|
+
)}px;padding: 0 min(3px, ${width / 2}px)}`;
|
|
12
28
|
})
|
|
13
29
|
.join('\n');
|
|
30
|
+
};
|
|
14
31
|
|
|
15
32
|
export const computeLayout = (_columnConfigs, canvasWidth, numColumns) => {
|
|
16
33
|
const columnConfigs = _columnConfigs.filter((c) => !c.hidden),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-omnitable",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.2",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|