diff --git a/src/actions/menu_items_actions.ts b/src/actions/menu_items_actions.ts
index 3023adfcca..38dcfb6178 100644
--- a/src/actions/menu_items_actions.ts
+++ b/src/actions/menu_items_actions.ts
@@ -389,6 +389,32 @@ export const HIDE_ROWS_NAME = (env: SpreadsheetChildEnv) => {
}
};
+export const RESIZE_COLUMNS_NAME = (env: SpreadsheetChildEnv) => {
+ const cols = [...env.model.getters.getActiveCols()].sort((a, b) => a - b);
+ const first = cols[0];
+ const last = cols[cols.length - 1];
+ if (cols.length === 1) {
+ return _t("Resize column %s", numberToLetters(first));
+ } else if (last - first + 1 === cols.length) {
+ return _t("Resize columns %s - %s", numberToLetters(first), numberToLetters(last));
+ } else {
+ return _t("Resize columns");
+ }
+};
+
+export const RESIZE_ROWS_NAME = (env: SpreadsheetChildEnv) => {
+ const rows = [...env.model.getters.getActiveRows()].sort((a, b) => a - b);
+ const first = rows[0];
+ const last = rows[rows.length - 1];
+ if (rows.length === 1) {
+ return _t("Resize row %s", first + 1);
+ } else if (last - first + 1 === rows.length) {
+ return _t("Resize rows %s - %s", first + 1, last + 1);
+ } else {
+ return _t("Resize rows");
+ }
+};
+
//------------------------------------------------------------------------------
// Charts
//------------------------------------------------------------------------------
diff --git a/src/actions/view_actions.ts b/src/actions/view_actions.ts
index a48725a6ad..d6c7ca0988 100644
--- a/src/actions/view_actions.ts
+++ b/src/actions/view_actions.ts
@@ -112,6 +112,22 @@ export const unhideAllRows: ActionSpec = {
icon: "o-spreadsheet-Icon.UNHIDE_ROW",
};
+export const resizeCols: ActionSpec = {
+ name: ACTIONS.RESIZE_COLUMNS_NAME,
+ execute: (env) => env.openSidePanel("HeaderResizePanel", { dimension: "COL" }),
+ isVisible: (env) => env.model.getters.getActiveCols().size > 0,
+ isEnabled: (env) => !env.model.getters.isCurrentSheetLocked(),
+ icon: "o-spreadsheet-Icon.RESIZE_HORIZONTAL",
+};
+
+export const resizeRows: ActionSpec = {
+ name: ACTIONS.RESIZE_ROWS_NAME,
+ execute: (env) => env.openSidePanel("HeaderResizePanel", { dimension: "ROW" }),
+ isVisible: (env) => env.model.getters.getActiveRows().size > 0,
+ isEnabled: (env) => !env.model.getters.isCurrentSheetLocked(),
+ icon: "o-spreadsheet-Icon.RESIZE_VERTICAL",
+};
+
export const unFreezePane: ActionSpec = {
name: _t("Unfreeze"),
isVisible: (env) => {
diff --git a/src/components/icons/icons.xml b/src/components/icons/icons.xml
index 5298a1f9a0..95bdbc203a 100644
--- a/src/components/icons/icons.xml
+++ b/src/components/icons/icons.xml
@@ -220,6 +220,16 @@
/>
+
+
+
+
+
+
+
+
+
+