@jspreadsheet/contextmenu_rowsadvancedactions
Advanced tools
Comparing version 1.2.1 to 2.0.0
41
index.js
/** | ||
* Plugin advanced actions for rows in context menu for jExcel Pro / jSpreadSheet | ||
* Plugin advanced actions for rows in context menu for jSpreadSheet Pro | ||
* | ||
* @version 1.2.1 | ||
* @version 2.0.0 | ||
* @author Guillaume Bonnaire <contact@gbonnaire.fr> | ||
@@ -12,5 +12,9 @@ * @website https://repo.gbonnaire.fr | ||
* ReleaseNote : | ||
* 2.0 : Migration v8 | ||
* 1.2 : Add Integration top menu | ||
* 1.1 : Add compatibility NPM | ||
*/ | ||
if(! jSuites && typeof(require) === 'function') { | ||
var jSuites = require('jsuites'); | ||
} | ||
@@ -21,6 +25,4 @@ ;(function (global, factory) { | ||
global.jss_contextmenu_rowAdvancedActions = factory(); | ||
// Compatibility Old version | ||
global.jexcel_contextmenu_rowAdvancedActions = global.jss_contextmenu_rowAdvancedActions; | ||
}(this, (function () { | ||
return (function(instance, options) { | ||
return (function(spreadsheet, options, spreadsheetConfig) { | ||
// Plugin object | ||
@@ -37,5 +39,5 @@ var plugin = {}; | ||
icon_duplicate:'content_copy', | ||
text_moveup: 'Move up row(s) selected', | ||
text_movedown: 'Move down row(s) selected', | ||
text_duplicate: 'Duplicate row(s) selected' | ||
text_moveup: jSuites.translate('Move up row(s) selected'), | ||
text_movedown: jSuites.translate('Move down row(s) selected'), | ||
text_duplicate: jSuites.translate('Duplicate row(s) selected') | ||
} | ||
@@ -51,9 +53,2 @@ | ||
} | ||
if(property.substring(0,5)==="text_") { | ||
var propertyText = "contextmenurowsadvancedactions_" + property.substring(5,property.length); | ||
if(instance.options.text[propertyText]) { | ||
plugin.options[property] = instance.options.text[propertyText]; | ||
} | ||
} | ||
} | ||
@@ -66,2 +61,3 @@ | ||
plugin.contextMenu = function(obj, x, y, e, items) { | ||
var instance = getCurrentWorksheet(); | ||
if(x==null && obj.getSelectedRows().length) { | ||
@@ -177,2 +173,3 @@ | ||
if(name == "Edit") { | ||
var instance = getCurrentWorksheet(); | ||
var obj = instance; | ||
@@ -267,2 +264,16 @@ if(instance.selectedCell!=null) { | ||
} | ||
/** | ||
* get current worksheet | ||
* @returns {object} | ||
*/ | ||
function getCurrentWorksheet() { | ||
if(jspreadsheet.current) { | ||
return jspreadsheet.current; | ||
} | ||
if(spreadsheet.getWorksheetActive() != null) { | ||
return spreadsheet.worksheets[spreadsheet.getWorksheetActive()]; | ||
} | ||
return spreadsheet.worksheets[0]; | ||
} | ||
@@ -269,0 +280,0 @@ return plugin; |
@@ -28,4 +28,7 @@ { | ||
], | ||
"dependencies": { | ||
"jspreadsheet-pro": "^8.0.0" | ||
}, | ||
"main": "index.js", | ||
"version": "1.2.1" | ||
"version": "2.0.0" | ||
} |
@@ -19,3 +19,3 @@ ## jSpreadsheet Plugin : Contextmenu rows advanced actions | ||
- [jSpreadsheet Pro v7](https://www.jspreadsheet.com/v7) | ||
- [jSpreadsheet Pro v8](https://www.jspreadsheet.com/v8) | ||
@@ -68,3 +68,3 @@ - With default options of plugin, you should use [Material Design icons](https://material.io/resources/icons/). | ||
### For translation | ||
you can defined on translation global to replace var <code>text_XXXX</code> by <code>contextmenurowsadvancedactions_</code> | ||
you can use jSuites dictionary for translate this plugin | ||
<table> | ||
@@ -97,6 +97,6 @@ <thead> | ||
```HTML | ||
<script src="https://jspreadsheet.com/v7/jspreadsheet.js"></script> | ||
<script src="https://jspreadsheet.com/v7/jsuites.js"></script> | ||
<link rel="stylesheet" href="https://jspreadsheet.com/v7/jsuites.css" type="text/css" /> | ||
<link rel="stylesheet" href="https://jspreadsheet.com/v7/jspreadsheet.css" type="text/css" /> | ||
<script src="https://jspreadsheet.com/v8/jspreadsheet.js"></script> | ||
<script src="https://jsuites.net/v4/jsuites.js"></script> | ||
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" /> | ||
<link rel="stylesheet" href="https://jspreadsheet.com/v8/jspreadsheet.css" type="text/css" /> | ||
<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet"> | ||
@@ -126,3 +126,3 @@ | ||
```HTML | ||
<script src="https://cdn.jsdelivr.net/gh/GBonnaire/jspreadsheet-plugins-and-editors@latest/plugins/dist/contextmenu_rowsAdvancedActions.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/GBonnaire/jspreadsheet-plugins-and-editors@latest/plugins/JSSV8/adist/contextmenu_rowsAdvancedActions.min.js"></script> | ||
``` | ||
@@ -129,0 +129,0 @@ |
33848
235
1
+ Addedjspreadsheet-pro@^8.0.0