Skip to content

Commit

Permalink
Update statusbar
Browse files Browse the repository at this point in the history
Fix #18
  • Loading branch information
GBonnaire committed Feb 8, 2023
1 parent b0bdb76 commit 5be12c2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
7 changes: 4 additions & 3 deletions plugins/JSSV8/dist/statusbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions plugins/JSSV8/src/statusbar/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Plugin statusbar for JSpreadsheet Pro
*
* @version 2.3.5
* @version 2.3.6
* @author Guillaume Bonnaire <contact@gbonnaire.fr>
* @website https://repo.gbonnaire.fr
* @summary Add status bar on bottom of JSpreadsheet
Expand Down Expand Up @@ -30,6 +30,7 @@
*
* @description Status bar is a plugin for add a status bar on bottom of the sheet like Excel. On this status bar you can add new row with button, and show information on selection (Range selected, Formulas, etc.)
* Release notes
* Version 2.3.6: Fix #18
* Version 2.3.5: Fix #17
* Version 2.3.4: Fix #16
* Version 2.3.3: Manage after change cell content
Expand Down Expand Up @@ -165,7 +166,9 @@
if (worksheet.options.allowInsertRow) {
// Detect if need insert or add the end
if((worksheet.getSelectedRows(true).length == 1 && worksheet.getSelectedColumns().length == worksheet.options.data[0].length) || plugin.options.closeInsertionOnly) {
worksheet.insertRow(parseInt(inputAddQuantity.value), getMaxPosition(worksheet.getSelectedRows(true)));
if(worksheet.selectedCell) {
worksheet.insertRow(parseInt(inputAddQuantity.value), getMaxPosition(worksheet.getSelectedRows(true)));
}
} else {
worksheet.goto(worksheet.options.data.length,getMinPosition(worksheet.getSelectedColumns()));
worksheet.insertRow(parseInt(inputAddQuantity.value));
Expand All @@ -182,7 +185,9 @@
if (worksheet.options.allowInsertRow) {
// Detect if need insert or add the end
if((worksheet.getSelectedRows(true).length == 1 && worksheet.getSelectedColumns().length == worksheet.options.data[0].length) || plugin.options.closeInsertionOnly) {
worksheet.insertRow(parseInt(inputAddQuantity.value), getMinPosition(worksheet.getSelectedRows(true)), true);
if(worksheet.selectedCell) {
worksheet.insertRow(parseInt(inputAddQuantity.value), getMinPosition(worksheet.getSelectedRows(true)), true);
}
} else {
worksheet.goto(0,getMinPosition(worksheet.getSelectedColumns()));
worksheet.insertRow(parseInt(inputAddQuantity.value), 0 , true);
Expand All @@ -199,7 +204,9 @@
if (worksheet.options.allowInsertColumn) {
// Detect if need insert or add the end
if((worksheet.getSelectedColumns().length == 1 && worksheet.getSelectedRows(true).length == worksheet.options.data.length) || plugin.options.closeInsertionOnly) {
worksheet.insertColumn(parseInt(inputAddQuantity.value), getMaxPosition(worksheet.getSelectedColumns()));
if(worksheet.selectedCell) {
worksheet.insertColumn(parseInt(inputAddQuantity.value), getMaxPosition(worksheet.getSelectedColumns()));
}
} else {
worksheet.goto(getMinPosition(worksheet.getSelectedRows(true)),worksheet.options.data[0].length);
worksheet.insertColumn(parseInt(inputAddQuantity.value));
Expand All @@ -216,7 +223,9 @@
if (worksheet.options.allowInsertColumn) {
// Detect if need insert or add the end
if((worksheet.getSelectedColumns().length == 1 && worksheet.getSelectedRows(true).length == worksheet.options.data.length) || plugin.options.closeInsertionOnly) {
worksheet.insertColumn(parseInt(inputAddQuantity.value), getMinPosition(worksheet.getSelectedColumns()), true);
if(worksheet.selectedCell) {
worksheet.insertColumn(parseInt(inputAddQuantity.value), getMinPosition(worksheet.getSelectedColumns()), true);
}
} else {
worksheet.goto(getMinPosition(worksheet.getSelectedRows(true)),0);
worksheet.insertColumn(parseInt(inputAddQuantity.value), 0, true);
Expand Down Expand Up @@ -406,6 +415,9 @@
return spreadsheet.worksheets[0];
}

/**
* get max position
*/
function getMaxPosition(values) {
if(typeof values == "object" && !Array.isArray(values)) {
values = Object.values(values);
Expand All @@ -423,6 +435,9 @@
}
}

/**
* get min position
*/
function getMinPosition(values) {
if(typeof values == "object" && !Array.isArray(values)) {
values = Object.values(values);
Expand Down
2 changes: 1 addition & 1 deletion plugins/JSSV8/src/statusbar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
"jspreadsheet": ">9.0.0"
},
"main": "index.js",
"version": "2.3.5"
"version": "2.3.6"
}
2 changes: 1 addition & 1 deletion plugins/JSSV8/src/statusbar/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Plugin CSS status bar for Jspreadsheet Pro
*
* @version 2.3.5
* @version 2.3.6
* @author Guillaume Bonnaire <contact@gbonnaire.fr>
* @website https://repo.gbonnaire.fr
*
Expand Down

0 comments on commit 5be12c2

Please sign in to comment.