@aquera/ngx-smart-table 0.0.9-alpha → 0.0.10-alpha
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/esm2020/lib/renderer/components/st-workbook/st-workbook.component.mjs +9 -3
- package/fesm2015/aquera-ngx-smart-table.mjs +8 -2
- package/fesm2015/aquera-ngx-smart-table.mjs.map +1 -1
- package/fesm2020/aquera-ngx-smart-table.mjs +8 -2
- package/fesm2020/aquera-ngx-smart-table.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -9840,14 +9840,20 @@ class StWorkbookComponent {
|
|
|
9840
9840
|
initializeComponent(isFirstInit = true) {
|
|
9841
9841
|
if (!this.config)
|
|
9842
9842
|
return;
|
|
9843
|
+
const previousSheetCount = this.sheets.length;
|
|
9843
9844
|
this.sheets = [...this.config.sheets];
|
|
9845
|
+
const newSheetCount = this.sheets.length;
|
|
9844
9846
|
// Only reset activeSheetIndex on first init, preserve it on config updates
|
|
9845
9847
|
if (isFirstInit) {
|
|
9846
9848
|
this.activeSheetIndex = this.config.initialActiveSheetIndex || 0;
|
|
9847
9849
|
}
|
|
9848
9850
|
else {
|
|
9849
|
-
//
|
|
9850
|
-
if (
|
|
9851
|
+
// Check if a new sheet was added - switch to the new sheet
|
|
9852
|
+
if (newSheetCount > previousSheetCount) {
|
|
9853
|
+
this.activeSheetIndex = newSheetCount - 1; // Switch to the newly added sheet
|
|
9854
|
+
}
|
|
9855
|
+
// Ensure activeSheetIndex is still valid after config change (e.g., sheet deleted)
|
|
9856
|
+
else if (this.activeSheetIndex >= this.sheets.length) {
|
|
9851
9857
|
this.activeSheetIndex = Math.max(0, this.sheets.length - 1);
|
|
9852
9858
|
}
|
|
9853
9859
|
}
|