Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat(date format): date format Chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
wpxp123456 committed Oct 26, 2020
1 parent a9e93dd commit 8f8d0cb
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 30 deletions.
12 changes: 12 additions & 0 deletions src/controllers/constant.js

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

8 changes: 4 additions & 4 deletions src/controllers/moreFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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日星期二",
Expand Down
200 changes: 178 additions & 22 deletions src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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日星期二",
Expand Down

0 comments on commit 8f8d0cb

Please sign in to comment.