liurunze 5 years ago
parent
commit
78df135a3a
  1. 8
      src/controllers/conditionformat.js
  2. 16
      src/controllers/filter.js
  3. 92
      src/controllers/handler.js
  4. 4
      src/controllers/menuButton.js
  5. 6
      src/controllers/selection.js
  6. 23
      src/core.js
  7. 16
      src/function/functionImplementation.js

8
src/controllers/conditionformat.js

@ -2064,6 +2064,9 @@ const conditionformat = {
$("#luckysheet-editorConditionRule-dialog #isPercent").attr("checked", "checked");
}
}
$("#luckysheet-editorConditionRule-dialog #textcolorshow").spectrum("set", ruleFormat.textColor);
$("#luckysheet-editorConditionRule-dialog #cellcolorshow").spectrum("set", ruleFormat.cellColor);
}
},
infoDialog: function(title, content){
@ -3333,8 +3336,9 @@ const conditionformat = {
dSmall = genarate(conditionValue0)[2];
}
else{
dBig = genarate(conditionValue0.toString().split("-")[1])[2];
dSmall = genarate(conditionValue0.toString().split("-")[0])[2];
let str = conditionValue0.toString().split("-");
dBig = genarate(str[1].trim())[2];
dSmall = genarate(str[0].trim())[2];
}
//循环应用范围计算
for(let r = cellrange[s].row[0]; r <= cellrange[s].row[1]; r++){

16
src/controllers/filter.js

@ -193,14 +193,14 @@ function createFilterOptions(luckysheet_filter_save, filterObj) {
$("#luckysheet-filter-selected-sheet" + Store.currentSheetIndex).remove();
$("#luckysheet-filter-options-sheet" + Store.currentSheetIndex).remove();
if(Store.luckysheet_filter_save == null || JSON.stringify(Store.luckysheet_filter_save) == "{}"){
if(luckysheet_filter_save == null || JSON.stringify(luckysheet_filter_save) == "{}"){
return;
}
let r1 = Store.luckysheet_filter_save.row[0],
r2 = Store.luckysheet_filter_save.row[1];
let c1 = Store.luckysheet_filter_save.column[0],
c2 = Store.luckysheet_filter_save.column[1];
let r1 = luckysheet_filter_save.row[0],
r2 = luckysheet_filter_save.row[1];
let c1 = luckysheet_filter_save.column[0],
c2 = luckysheet_filter_save.column[1];
let row = Store.visibledatarow[r2],
row_pre = r1 - 1 == -1 ? 0 : Store.visibledatarow[r1 - 1];
@ -254,13 +254,13 @@ function createFilterOptions(luckysheet_filter_save, filterObj) {
$("#luckysheet-rightclick-menu").hide();
$("#luckysheet-filter-menu, #luckysheet-filter-submenu").hide();
if ($("#luckysheet-cell-main").scrollTop() > Store.luckysheet_filter_save["top_move"]) {
$("#luckysheet-scrollbar-y").scrollTop(Store.luckysheet_filter_save["top_move"]);
if ($("#luckysheet-cell-main").scrollTop() > luckysheet_filter_save["top_move"]) {
$("#luckysheet-scrollbar-y").scrollTop(luckysheet_filter_save["top_move"]);
}
let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
file.filter_select = Store.luckysheet_filter_save;
file.filter_select = luckysheet_filter_save;
}
export {

92
src/controllers/handler.js

@ -2508,31 +2508,87 @@ export default function luckysheetHandler() {
let anchor = $(window.getSelection().anchorNode);
let anchorOffset = window.getSelection().anchorOffset;
let dir_n = dir, step = 1;
if(dir == 'up'){
dir_n = 'down';
step = -1;
}
if(dir == 'left'){
dir_n = 'right';
step = -1;
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", -1, "rangeOfSelect");
event.preventDefault();
}
}
else if(dir == 'down'){
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell(dir_n, step, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
event.preventDefault();
}
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell(dir_n, step, "rangeOfSelect");
else if(dir == 'left'){
if(anchor.parent().is("span") && anchor.parent().prev().length == 0 && anchorOffset == 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchorOffset == 1){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchorOffset == 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", -1, "rangeOfSelect");
event.preventDefault();
}
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell(dir_n, step, "rangeOfSelect");
else if(dir == 'right'){
if(anchor.parent().is("span") && anchor.parent().next().length == 0 && anchorOffset > 0){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.is("#luckysheet-rich-text-editor") && anchor.context.childElementCount == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
else if(anchor.parent().is("#luckysheet-rich-text-editor") && anchor.context.length == anchorOffset){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
luckysheetMoveHighlightCell("right", 1, "rangeOfSelect");
event.preventDefault();
}
}
}
event.preventDefault();
}
}

4
src/controllers/menuButton.js

@ -3540,7 +3540,7 @@ const menuButton = {
}
}
if(["0", "1", "2"].indexOf(foucsStatus) == -1){
if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){
foucsStatus = "1";
}
}
@ -3555,7 +3555,7 @@ const menuButton = {
}
}
if(["0", "1", "2"].indexOf(foucsStatus) == -1){
if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){
foucsStatus = "2";
}
}

6
src/controllers/selection.js

@ -590,7 +590,7 @@ const selection = {
}
}
if (getObjType(data) == "object") {
if (typeof data == "object") {
if (data.length == 0) { return; };
let cfg = $.extend(true, {}, Store.config);
@ -1679,7 +1679,7 @@ const selection = {
},
matchcopy: function (data1, data2) {
let data1cache = [], data2cache = [], data1len, data2len;
if (getObjType(data1) == "object") {
if (typeof data1 == "object") {
data1cache = data1;
}
else {
@ -1691,7 +1691,7 @@ const selection = {
data1len = data1cache.length;
if (getObjType(data2) == "object") {
if (typeof data2 == "object") {
data2cache = data2;
}
else {

23
src/core.js

@ -8,9 +8,17 @@ import sheetmanage from './controllers/sheetmanage';
import luckysheetsizeauto from './controllers/resize';
import luckysheetHandler from './controllers/handler';
import {initPlugins} from './controllers/expendPlugins';
import {
getluckysheetfile,
getluckysheet_select_save,
getconfig,
getvisibledatarow,
getvisibledatacolumn
} from './methods/get';
let luckysheet = {};
//创建luckysheet表格
luckysheet.create = function (setting) {
let extendsetting = common_extend(defaultSetting, setting);
@ -101,6 +109,21 @@ luckysheet.create = function (setting) {
}
}
//获取所有表格数据
luckysheet.getluckysheetfile = getluckysheetfile;
//获取当前表格 选区
luckysheet.getluckysheet_select_save = getluckysheet_select_save;
//获取当前表格 config配置
luckysheet.getconfig = getconfig;
//获取当前表格 行高数据
luckysheet.getvisibledatarow = getvisibledatarow;
//获取当前表格 列宽数据
luckysheet.getvisibledatacolumn = getvisibledatacolumn;
export {
luckysheet
}

16
src/function/functionImplementation.js

@ -10301,11 +10301,9 @@ const functionImplementation = {
//计算
if(A1){
var reg = /^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g;
if(reg.test(ref_text)){
var row = parseInt(ref_text.replace(/[^0-9]/g, "")) - 1;
var col = ABCatNum(ref_text.replace(/[^A-Za-z]/g, ""));
if(formula.iscelldata(ref_text)){
let cellrange = formula.getcellrange(ref_text);
let row = cellrange.row[0], col = cellrange.column[0];
if(row < 0 || row >= Store.flowdata.length || col < 0 || col >= Store.flowdata[0].length){
return formula.error.r;
@ -10322,11 +10320,9 @@ const functionImplementation = {
}
}
else{
var reg = /^[R][0-9]+[C][0-9]+$/g;
if(reg.test(ref_text)){
var row = parseInt(ref_text.split("R")[1].split("C")[0]);
var col = parseInt(ref_text.split("R")[1].split("C")[1]);
if(formula.iscelldata(ref_text)){
let cellrange = formula.getcellrange(ref_text);
let row = cellrange.row[0], col = cellrange.column[0];
if(row < 0 || row >= Store.flowdata.length || col < 0 || col >= Store.flowdata[0].length){
return formula.error.r;

Loading…
Cancel
Save