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

Commit

Permalink
feat(inline string): finished
Browse files Browse the repository at this point in the history
  • Loading branch information
tubiaoge committed Sep 21, 2020
2 parents 9ac9f08 + ad1ac61 commit 325b66c
Show file tree
Hide file tree
Showing 14 changed files with 288 additions and 104 deletions.
32 changes: 28 additions & 4 deletions src/controllers/controlHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ const controlHistory = {
}
formula.execFunctionGroup(null, null, null, null, ctr.data);//取之前的数据

jfrefreshgrid(ctr.data, ctr.range, ctr.config, ctr.cdformat, ctr.RowlChange, ctr.dataVerification);
let allParam = {
"cfg": ctr.config,
"RowlChange": ctr.RowlChange,
"cdformat": ctr.cdformat,
"dataVerification": ctr.dataVerification,
"dynamicArray": ctr.dynamicArray
}

jfrefreshgrid(ctr.data, ctr.range, allParam);
}
else if (ctr.type == "pasteCut") {
let s = {
Expand Down Expand Up @@ -320,7 +328,11 @@ const controlHistory = {
server.saveParam("all", ctr.sheetIndex, ctr.oldcolor, { "k": "color" });
}
else if (ctr.type == "mergeChange") {
jfrefreshgrid(ctr.data, ctr.range, ctr.config);
let allParam = {
"cfg": ctr.config,
}

jfrefreshgrid(ctr.data, ctr.range, allParam);
}
else if (ctr.type == "updateDataVerification"){
dataVerificationCtrl.ref(ctr.currentDataVerification, ctr.historyDataVerification, ctr.sheetIndex);
Expand Down Expand Up @@ -416,7 +428,15 @@ const controlHistory = {
if (ctr.type == "datachange") {
formula.execFunctionGroup();

jfrefreshgrid(ctr.curdata, ctr.range, ctr.curConfig, ctr.curCdformat, ctr.RowlChange, ctr.curDataVerification);
let allParam = {
"cfg": ctr.curConfig,
"RowlChange": ctr.RowlChange,
"cdformat": ctr.curCdformat,
"dataVerification": ctr.curDataVerification,
"dynamicArray": ctr.curDynamicArray
}

jfrefreshgrid(ctr.curdata, ctr.range, allParam);
}
else if (ctr.type == "pasteCut") {
jfrefreshgrid_pastcut(ctr.source, ctr.target, ctr.RowlChange);
Expand Down Expand Up @@ -611,7 +631,11 @@ const controlHistory = {
server.saveParam("all", ctr.sheetIndex, ctr.color, { "k": "color" });
}
else if (ctr.type == "mergeChange") {
jfrefreshgrid(ctr.curData, ctr.range, ctr.curConfig);
let allParam = {
"cfg": ctr.curConfig,
}

jfrefreshgrid(ctr.curData, ctr.range, allParam);
}
else if (ctr.type == "updateDataVerification"){
dataVerificationCtrl.ref(ctr.historyDataVerification, ctr.currentDataVerification, ctr.sheetIndex);
Expand Down
7 changes: 6 additions & 1 deletion src/controllers/dropCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,12 @@ const luckysheetDropCell = {
}

//刷新一次表格
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
let allParam = {
"cfg": cfg,
"cdformat": cdformat,
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);

selectHightlightShow();
},
Expand Down
17 changes: 10 additions & 7 deletions src/controllers/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,18 @@ function orderbydatafiler(str, stc, edr, edc, index, asc) {
}
}

let allParam = {};
if(Store.config["rowlen"] != null){
let cfg = $.extend(true, {}, Store.config);
cfg = rowlenByRange(d, str, edr, cfg);

jfrefreshgrid(d, [{ "row": [str, edr], "column": [stc, edc] }], cfg, null, true);
}
else{
jfrefreshgrid(d, [{ "row": [str, edr], "column": [stc, edc] }]);
allParam = {
"cfg": cfg,
"RowlChange": true
}
}

jfrefreshgrid(d, [{ "row": [str, edr], "column": [stc, edc] }], allParam);
}

//创建筛选按钮
Expand Down Expand Up @@ -1250,9 +1253,6 @@ function initialFilterHandler(){
$("#luckysheet-filter-menu .luckysheet-filter-selected-input").hide().find("input").val();
$("#luckysheet-filter-selected span").data("type", "0").data("type", null).text(locale_filter.conditionNone);

$('#luckysheet-filter-selected-sheet' + Store.currentSheetIndex + ', #luckysheet-filter-options-sheet' + Store.currentSheetIndex).remove();
$("#luckysheet-filter-menu, #luckysheet-filter-submenu").hide();

let redo = {};
redo["type"] = "datachangeAll_filter_clear";
redo["sheetIndex"] = Store.currentSheetIndex;
Expand Down Expand Up @@ -1287,6 +1287,9 @@ function initialFilterHandler(){
Store.jfundo = [];
Store.jfredo.push(redo);

$('#luckysheet-filter-selected-sheet' + Store.currentSheetIndex + ', #luckysheet-filter-options-sheet' + Store.currentSheetIndex).remove();
$("#luckysheet-filter-menu, #luckysheet-filter-submenu").hide();

//清除筛选发送给后台
Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].filter = null;
Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].filter_select = null;
Expand Down
8 changes: 7 additions & 1 deletion src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3511,7 +3511,13 @@ export default function luckysheetHandler() {
last["row_focus"] = rf;
last["column_focus"] = cf;

jfrefreshgrid(d, range, cfg, cdformat, RowlChange);
let allParam = {
"cfg": cfg,
"RowlChange": RowlChange,
"cdformat": cdformat
}

jfrefreshgrid(d, range, allParam);

selectHightlightShow();

Expand Down
13 changes: 8 additions & 5 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2998,12 +2998,15 @@ const menuButton = {
}
}

let allParam = {};
if(attr == "tb" || attr == "tr" || attr == "fs"){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true, null, false);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, undefined, undefined,undefined,undefined,false);
allParam = {
"cfg": cfg,
"RowlChange": true
}
}

jfrefreshgrid(d, Store.luckysheet_select_save, allParam, false);
},
updateFormat_mc: function(d, foucsStatus){
let cfg = $.extend(true, {}, Store.config);
Expand Down Expand Up @@ -3204,7 +3207,7 @@ const menuButton = {
}

Store.clearjfundo = false;
jfrefreshgrid(d, Store.luckysheet_select_save, cfg);
jfrefreshgrid(d, Store.luckysheet_select_save, {"cfg": cfg});
Store.clearjfundo = true;
},
borderfix: function(d, r, c){
Expand Down
11 changes: 7 additions & 4 deletions src/controllers/orderBy.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,19 @@ export function orderByInitial(){
}
}

let allParam = {};
if(Store.config["rowlen"] != null){
let cfg = $.extend(true, {}, Store.config);
cfg = rowlenByRange(d, str, r2, cfg);

jfrefreshgrid(d, [{ "row": [str, r2], "column": [c1, c2] }], cfg, null, true);
}
else{
jfrefreshgrid(d, [{ "row": [str, r2], "column": [c1, c2] }]);
allParam = {
"cfg": cfg,
"RowlChange": true
}
}

jfrefreshgrid(d, [{ "row": [str, r2], "column": [c1, c2] }], allParam);

$("#luckysheet-sort-dialog").hide();
$("#luckysheet-modal-dialog-mask").hide();
});
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/pivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ const pivotTable = {
jfrefreshgridall(data[0].length, data.length, data, null, Store.luckysheet_select_save, "datachangeAll", undefined, undefined,isRefreshCanvas);
}
else {
jfrefreshgrid(data, Store.luckysheet_select_save, undefined, undefined, undefined, undefined, undefined,isRefreshCanvas);
jfrefreshgrid(data, Store.luckysheet_select_save, {}, null, isRefreshCanvas);
selectHightlightShow();
}

Expand Down
51 changes: 44 additions & 7 deletions src/controllers/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,19 @@ const selection = {

Store.luckysheet_select_save = [{ "row": [minh, maxh], "column": [minc, maxc] }];


if(addr > 0 || addc > 0 || RowlChange){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true);
let allParam = {
"cfg": cfg,
"RowlChange": true
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg);
let allParam = {
"cfg": cfg
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
selectHightlightShow();
}
}
Expand Down Expand Up @@ -790,7 +798,10 @@ const selection = {
last["column"] = [curC, curC + clen - 1];

if (addr > 0 || addc > 0) {
jfrefreshgrid(d, Store.luckysheet_select_save, null, null, true);
let allParam = {
"RowlChange": true
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
}
else {
jfrefreshgrid(d, Store.luckysheet_select_save);
Expand Down Expand Up @@ -1521,10 +1532,23 @@ const selection = {

if(copyRowlChange || addr > 0 || addc > 0){
cfg = rowlenByRange(d, minh, maxh, cfg);
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true, dataVerification);

let allParam = {
"cfg": cfg,
"RowlChange": true,
"cdformat": cdformat,
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
let allParam = {
"cfg": cfg,
"cdformat": cdformat,
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);

selectHightlightShow();
}
},
Expand Down Expand Up @@ -1752,10 +1776,23 @@ const selection = {

if(copyRowlChange){
cfg = rowlenByRange(d, minh, maxh, cfg);
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true, dataVerification);

let allParam = {
"cfg": cfg,
"RowlChange": true,
"cdformat": cdformat,
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
let allParam = {
"cfg": cfg,
"cdformat": cdformat,
"dataVerification": dataVerification
}
jfrefreshgrid(d, Store.luckysheet_select_save, allParam);

selectHightlightShow();
}
},
Expand Down
18 changes: 9 additions & 9 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1428,18 +1428,18 @@ const sheetmanage = {
let index = this.getSheetIndex(sheetIndex);
let file = Store.luckysheetfile[index];

if($('#luckysheet-filter-selected-sheet' + sheetIndex).length > 0 || file.filter_select == null || JSON.stringify(file.filter_select) == "{}"){
if(file.config != null && file.config.rowhidden != null){
file.config.rowhidden = {};
Store.config = file.config;
// if($('#luckysheet-filter-selected-sheet' + sheetIndex).length > 0 || file.filter_select == null || JSON.stringify(file.filter_select) == "{}"){
// if(file.config != null && file.config.rowhidden != null){
// file.config.rowhidden = {};
// Store.config = file.config;

jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length,false);
}
// jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length,false);
// }

return;
}
// return;
// }

if(getObjType(file.filter_select) != "object"){
if(getObjType(file.filter_select) == "string"){
file.filter_select = JSON.parse(file.filter_select);
}

Expand Down
35 changes: 21 additions & 14 deletions src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ export function cancelRangeMerge(options = {}) {

// 当前sheet页合并时刷新
if (order === curSheetOrder) {
jfrefreshgrid(data, range, cfg)
jfrefreshgrid(data, range, {"cfg": cfg})
}
}

Expand Down Expand Up @@ -1903,19 +1903,22 @@ export function setRangeSort(type, options = {}) {
fileData[r][c] = data[r - r1][c - c1];
}
}

let allParam = {};
if(cfg["rowlen"] != null){
let config = $.extend(true, {}, cfg);
config = rowlenByRange(fileData, r1, r2, config);

if (order == Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [r1, r2], "column": [c1, c2] }], config, null, true);
}
} else{
if (order == Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [r1, r2], "column": [c1, c2] }]);

allParam = {
"cfg": config,
"RowlChange": true
}
}

if (file.index == Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [r1, r2], "column": [c1, c2] }], allParam);
}

if (success && typeof success === 'function') {
success();
}
Expand Down Expand Up @@ -2001,19 +2004,23 @@ export function setRangeSortMulti(hasTitle, sort, options = {}) {
fileData[r][c] = data[r - str][c - c1];
}
}


let allParam = {};
if(cfg["rowlen"] != null){
let config = $.extend(true, {}, cfg);
config = rowlenByRange(fileData, str, r2, config);

if (order === Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [str, r2], "column": [c1, c2] }], config, null, true);
}
} else{
if (order === Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [str, r2], "column": [c1, c2] }]);
allParam = {
"cfg": config,
"RowlChange": true
}
}

if (file.index === Store.currentSheetIndex) {
jfrefreshgrid(fileData, [{ "row": [str, r2], "column": [c1, c2] }], allParam);
}

if (success && typeof success === 'function') {
success();
}
Expand Down
2 changes: 1 addition & 1 deletion src/global/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const editor = {
clen = ed_c - st_c + 1;

if (rlen > 5000) {
jfrefreshgrid(d, st_r, ed_r, st_c, ed_c);
jfrefreshgrid(d, [{ "row": [st_r, ed_r], "column": [st_c, ed_c] }]);
}
else {
jfrefreshrange(d, { "row": [st_r, ed_r], "column": [st_c, ed_c] });
Expand Down
Loading

0 comments on commit 325b66c

Please sign in to comment.