@spectric/ui 0.0.19 → 0.0.20
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/package.json
CHANGED
|
@@ -66,7 +66,7 @@ export class TableVirtualBodyElement<T> extends DisposableElement implements Bod
|
|
|
66
66
|
let buffer = 10 // Have a buffer of rows to prevent column jitter
|
|
67
67
|
let headerHeight = this.table.querySelector("spectric-table-header")!.clientHeight
|
|
68
68
|
let viewport = this.table.querySelector(".table-wrapper")!
|
|
69
|
-
let startIndex = Math.max(this.startIndex
|
|
69
|
+
let startIndex = Math.max(this.startIndex, 0)
|
|
70
70
|
const rowsThatFit = Math.ceil((viewport.clientHeight - headerHeight) / this.rowHeight);
|
|
71
71
|
const endIndex = Math.min(startIndex + rowsThatFit + buffer, totalRows);
|
|
72
72
|
const visibleRows = endIndex - startIndex
|
|
@@ -77,7 +77,7 @@ export class TableVirtualBodyElement<T> extends DisposableElement implements Bod
|
|
|
77
77
|
}
|
|
78
78
|
let visibleHeight = (visibleRows * this.rowHeight)
|
|
79
79
|
let afterHeight = totalHeight - beforeHeight - visibleHeight
|
|
80
|
-
let spacerElementBefore =
|
|
80
|
+
let spacerElementBefore = startIndex != 0 ? html`
|
|
81
81
|
<tr style="height:${beforeHeight}px" class="virtual-scroll-spacer">
|
|
82
82
|
<td colspan="${this.columns.length}"></td></tr>` : null
|
|
83
83
|
|
|
@@ -52,7 +52,7 @@ const meta = {
|
|
|
52
52
|
size: "xsmall",
|
|
53
53
|
totalItems: data.length,
|
|
54
54
|
},
|
|
55
|
-
columns: columns,
|
|
55
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
56
56
|
select: TableSelectOptions.none
|
|
57
57
|
},
|
|
58
58
|
} satisfies Meta<Props<typeof tabledata[0]>>;
|
|
@@ -68,26 +68,30 @@ export const Basic: Story = {
|
|
|
68
68
|
pageSize: 3,
|
|
69
69
|
size: "xsmall",
|
|
70
70
|
totalItems: data.length,
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
76
77
|
export const NoPagination: Story = {
|
|
77
78
|
args: {
|
|
78
|
-
pagination: undefined
|
|
79
|
+
pagination: undefined,
|
|
80
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
79
81
|
},
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
export const MiltiSelect: Story = {
|
|
83
85
|
args: {
|
|
84
|
-
select: "multi"
|
|
86
|
+
select: "multi",
|
|
87
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
85
88
|
},
|
|
86
89
|
};
|
|
87
90
|
|
|
88
91
|
export const SingleSelect: Story = {
|
|
89
92
|
args: {
|
|
90
|
-
select: "single"
|
|
93
|
+
select: "single",
|
|
94
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
91
95
|
},
|
|
92
96
|
};
|
|
93
97
|
|
|
@@ -98,6 +102,7 @@ export const SingleSelect: Story = {
|
|
|
98
102
|
export const MultiColumnSort: Story = {
|
|
99
103
|
args: {
|
|
100
104
|
sort: "multi",
|
|
105
|
+
columns: JSON.parse(JSON.stringify(columns)),
|
|
101
106
|
pagination: { pageSize: 20, page: 1 }
|
|
102
107
|
},
|
|
103
108
|
};
|