From 8f8d0cb8c5563a31afba3fe11b525e6bccd5eb56 Mon Sep 17 00:00:00 2001 From: wpxp123456 <2677556700@qq.com> Date: Mon, 26 Oct 2020 17:00:54 +0800 Subject: [PATCH] feat(date format): date format Chinese --- src/controllers/constant.js | 12 ++ src/controllers/moreFormat.js | 8 +- src/controllers/rowColumnOperation.js | 200 +++++++++++++++++++++++--- src/locale/zh.js | 8 +- 4 files changed, 198 insertions(+), 30 deletions(-) diff --git a/src/controllers/constant.js b/src/controllers/constant.js index 528b247a5..4c17884c8 100644 --- a/src/controllers/constant.js +++ b/src/controllers/constant.js @@ -320,6 +320,18 @@ function rightclickHTML(){ ${rightclick.column} +
+
+ ${rightclick.hideSelected} + ${rightclick.column} +
+
+
+
+ ${rightclick.showHide} + ${rightclick.column} +
+
${rightclick.column} diff --git a/src/controllers/moreFormat.js b/src/controllers/moreFormat.js index dd8bbe6e7..d8d71a36d 100644 --- a/src/controllers/moreFormat.js +++ b/src/controllers/moreFormat.js @@ -675,19 +675,19 @@ const luckysheetMoreFormat = { }, { "name": "下午01:30", - "value": 'AM/PM hh:mm' + "value": '上午/下午 hh:mm' }, { "name": "下午1:30", - "value": 'AM/PM h:mm' + "value": '上午/下午 h:mm' }, { "name": "下午1:30:30", - "value": 'AM/PM h:mm:ss' + "value": '上午/下午 h:mm:ss' }, { "name": "08-05 下午01:30", - "value": "MM-dd AM/PM hh:mm" + "value": "MM-dd 上午/下午 hh:mm" }, // { // "name": "1930年8月5日星期二", diff --git a/src/controllers/rowColumnOperation.js b/src/controllers/rowColumnOperation.js index 1c0be6d16..72939d8a4 100644 --- a/src/controllers/rowColumnOperation.js +++ b/src/controllers/rowColumnOperation.js @@ -1374,7 +1374,85 @@ export function rowColumnOperationInitial(){ luckysheetdeletetable('column', st_index, ed_index); }) - //隐藏、显示行 + //隐藏选中行列 + $("#luckysheet-hide-selected").click(function (event) { + if(Store.luckysheetRightHeadClickIs == 'row' && !checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatRows")){ + return; + } + + if(Store.luckysheetRightHeadClickIs == 'column' && !checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatColumns")){ + return; + } + + $("#luckysheet-rightclick-menu").hide(); + luckysheetContainerFocus(); + + let cfg = $.extend(true, {}, Store.config); + + if(Store.luckysheetRightHeadClickIs == 'row'){ + if(cfg["rowhidden"] == null){ + cfg["rowhidden"] = {}; + } + + for(let s = 0; s < Store.luckysheet_select_save.length; s++){ + let r1 = Store.luckysheet_select_save[s].row[0], + r2 = Store.luckysheet_select_save[s].row[1]; + + for(let r = r1; r <= r2; r++){ + cfg["rowhidden"][r] = 0; + } + } + + //保存撤销 + if(Store.clearjfundo){ + let redo = {}; + redo["type"] = "showHidRows"; + redo["sheetIndex"] = Store.currentSheetIndex; + redo["config"] = $.extend(true, {}, Store.config); + redo["curconfig"] = cfg; + + Store.jfundo = []; + Store.jfredo.push(redo); + } + + server.saveParam("cg", Store.currentSheetIndex, cfg["rowhidden"], { "k": "rowhidden" }); + } + else if(Store.luckysheetRightHeadClickIs == 'column'){ + if(cfg["colhidden"] == null){ + cfg["colhidden"] = {}; + } + + for(let s = 0; s < Store.luckysheet_select_save.length; s++){ + let c1 = Store.luckysheet_select_save[s].column[0], + c2 = Store.luckysheet_select_save[s].column[1]; + + for(let c = c1; c <= c2; c++){ + cfg["colhidden"][c] = 0; + } + } + + //保存撤销 + if(Store.clearjfundo){ + let redo = {}; + redo["type"] = "showHidCols"; + redo["sheetIndex"] = Store.currentSheetIndex; + redo["config"] = $.extend(true, {}, Store.config); + redo["curconfig"] = cfg; + + Store.jfundo = []; + Store.jfredo.push(redo); + } + + server.saveParam("cg", Store.currentSheetIndex, cfg["colhidden"], { "k": "colhidden" }); + } + + //config + Store.config = cfg; + Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].config = Store.config; + + //行高、列宽 刷新 + jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length); + }) $("#luckysheet-hidRows").click(function (event) { if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatRows")){ return; @@ -1418,31 +1496,31 @@ export function rowColumnOperationInitial(){ //行高、列宽 刷新 jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length); }) - $("#luckysheet-showHidRows").click(function (event) { - if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatRows")){ + $("#luckysheet-hidCols").click(function (event) { + if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatColumns")){ return; } $("#luckysheet-rightclick-menu").hide(); luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); - if(cfg["rowhidden"] == null){ - return; + if(cfg["colhidden"] == null){ + cfg["colhidden"] = {}; } for(let s = 0; s < Store.luckysheet_select_save.length; s++){ - let r1 = Store.luckysheet_select_save[s].row[0], - r2 = Store.luckysheet_select_save[s].row[1]; + let c1 = Store.luckysheet_select_save[s].column[0], + c2 = Store.luckysheet_select_save[s].column[1]; - for(let r = r1; r <= r2; r++){ - delete cfg["rowhidden"][r]; + for(let c = c1; c <= c2; c++){ + cfg["colhidden"][c] = 0; } } //保存撤销 if(Store.clearjfundo){ let redo = {}; - redo["type"] = "showHidRows"; + redo["type"] = "showHidCols"; redo["sheetIndex"] = Store.currentSheetIndex; redo["config"] = $.extend(true, {}, Store.config); redo["curconfig"] = cfg; @@ -1455,38 +1533,116 @@ export function rowColumnOperationInitial(){ Store.config = cfg; Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].config = Store.config; - server.saveParam("cg", Store.currentSheetIndex, cfg["rowhidden"], { "k": "rowhidden" }); + server.saveParam("cg", Store.currentSheetIndex, cfg["colhidden"], { "k": "colhidden" }); //行高、列宽 刷新 jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length); }) - //隐藏、显示列 - $("#luckysheet-hidCols").click(function (event) { - if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatColumns")){ + //显示选中行列 + $("#luckysheet-show-selected").click(function (event) { + if(Store.luckysheetRightHeadClickIs == 'row' && !checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatRows")){ return; } + + if(Store.luckysheetRightHeadClickIs == 'column' && !checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatColumns")){ + return; + } + $("#luckysheet-rightclick-menu").hide(); luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); - if(cfg["colhidden"] == null){ - cfg["colhidden"] = {}; + + if(Store.luckysheetRightHeadClickIs == 'row'){ + if(cfg["rowhidden"] == null){ + return; + } + + for(let s = 0; s < Store.luckysheet_select_save.length; s++){ + let r1 = Store.luckysheet_select_save[s].row[0], + r2 = Store.luckysheet_select_save[s].row[1]; + + for(let r = r1; r <= r2; r++){ + delete cfg["rowhidden"][r]; + } + } + + //保存撤销 + if(Store.clearjfundo){ + let redo = {}; + redo["type"] = "showHidRows"; + redo["sheetIndex"] = Store.currentSheetIndex; + redo["config"] = $.extend(true, {}, Store.config); + redo["curconfig"] = cfg; + + Store.jfundo = []; + Store.jfredo.push(redo); + } + + server.saveParam("cg", Store.currentSheetIndex, cfg["rowhidden"], { "k": "rowhidden" }); + } + else if(Store.luckysheetRightHeadClickIs == 'column'){ + if(cfg["colhidden"] == null){ + return; + } + + for(let s = 0; s < Store.luckysheet_select_save.length; s++){ + let c1 = Store.luckysheet_select_save[s].column[0], + c2 = Store.luckysheet_select_save[s].column[1]; + + for(let c = c1; c <= c2; c++){ + delete cfg["colhidden"][c]; + } + } + + //保存撤销 + if(Store.clearjfundo){ + let redo = {}; + redo["type"] = "showHidCols"; + redo["sheetIndex"] = Store.currentSheetIndex; + redo["config"] = $.extend(true, {}, Store.config); + redo["curconfig"] = cfg; + + Store.jfundo = []; + Store.jfredo.push(redo); + } + + server.saveParam("cg", Store.currentSheetIndex, cfg["colhidden"], { "k": "colhidden" }); + } + + //config + Store.config = cfg; + Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].config = Store.config; + + //行高、列宽 刷新 + jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length); + }) + $("#luckysheet-showHidRows").click(function (event) { + if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "formatRows")){ + return; + } + $("#luckysheet-rightclick-menu").hide(); + luckysheetContainerFocus(); + + let cfg = $.extend(true, {}, Store.config); + if(cfg["rowhidden"] == null){ + return; } for(let s = 0; s < Store.luckysheet_select_save.length; s++){ - let c1 = Store.luckysheet_select_save[s].column[0], - c2 = Store.luckysheet_select_save[s].column[1]; + let r1 = Store.luckysheet_select_save[s].row[0], + r2 = Store.luckysheet_select_save[s].row[1]; - for(let c = c1; c <= c2; c++){ - cfg["colhidden"][c] = 0; + for(let r = r1; r <= r2; r++){ + delete cfg["rowhidden"][r]; } } //保存撤销 if(Store.clearjfundo){ let redo = {}; - redo["type"] = "showHidCols"; + redo["type"] = "showHidRows"; redo["sheetIndex"] = Store.currentSheetIndex; redo["config"] = $.extend(true, {}, Store.config); redo["curconfig"] = cfg; @@ -1499,7 +1655,7 @@ export function rowColumnOperationInitial(){ Store.config = cfg; Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].config = Store.config; - server.saveParam("cg", Store.currentSheetIndex, cfg["colhidden"], { "k": "colhidden" }); + server.saveParam("cg", Store.currentSheetIndex, cfg["rowhidden"], { "k": "rowhidden" }); //行高、列宽 刷新 jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length); diff --git a/src/locale/zh.js b/src/locale/zh.js index a72673fd8..6818780a0 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -9390,19 +9390,19 @@ export default { }, { "name": "下午01:30", - "value": 'AM/PM hh:mm' + "value": '上午/下午 hh:mm' }, { "name": "下午1:30", - "value": 'AM/PM h:mm' + "value": '上午/下午 h:mm' }, { "name": "下午1:30:30", - "value": 'AM/PM h:mm:ss' + "value": '上午/下午 h:mm:ss' }, { "name": "08-05 下午01:30", - "value": "MM-dd AM/PM hh:mm" + "value": "MM-dd 上午/下午 hh:mm" }, // { // "name": "1930年8月5日星期二",