liuyang 5 years ago
parent
commit
2d6a03f4f6
  1. 6
      src/controllers/constant.js
  2. 93
      src/controllers/controlHistory.js
  3. 1390
      src/controllers/dataVerificationCtrl.js
  4. 23
      src/controllers/dropCell.js
  5. 251
      src/controllers/handler.js
  6. 2
      src/controllers/pivotTable.js
  7. 3
      src/controllers/select.js
  8. 245
      src/controllers/selection.js
  9. 4
      src/controllers/sheetmanage.js
  10. 11
      src/controllers/updateCell.js
  11. 174
      src/css/luckysheet-core.css
  12. 102
      src/global/draw.js
  13. 169
      src/global/extend.js
  14. 4
      src/global/formula.js
  15. 63
      src/global/refresh.js
  16. 1
      src/locale/en.js
  17. 1
      src/locale/zh.js

6
src/controllers/constant.js

@ -181,6 +181,9 @@ const gridHTML = function(){
</div>
<div class="img-list"></div>
</div>
<div id="luckysheet-dataVerification-dropdown-btn"></div>
<div id="luckysheet-dataVerification-dropdown-List" class="luckysheet-mousedown-cancel"></div>
<div id="luckysheet-dataVerification-showHintBox" class="luckysheet-mousedown-cancel"></div>
<div class="luckysheet-cell-copy"></div>
<div class="luckysheet-grdblkflowpush"></div> \${flow}
</div>
@ -1267,6 +1270,9 @@ function menuToolBar (){
<div class="luckysheetfulltoolbar" id="luckysheet-insertImg-btn-title">
${toolbar.insertImage}
<input id="luckysheet-imgUpload" type="file" accept="image/*" style="display:none;">
</div>
<div class="luckysheetfulltoolbar" id="luckysheet-dataVerification-btn-title">
${toolbar.dataVerification}
</div>`;
}

93
src/controllers/controlHistory.js

@ -4,6 +4,7 @@ import pivotTable from './pivotTable';
import conditionformat from './conditionformat';
import luckysheetPostil from './postil';
import imageCtrl from './imageCtrl';
import dataVerificationCtrl from './dataVerificationCtrl';
import {zoomRefreshView,zoomNumberDomBind} from './zoom';
import { createFilter, createFilterOptions, labelFilterOptionState } from './filter';
import formula from '../global/formula';
@ -58,7 +59,7 @@ const controlHistory = {
}
formula.execFunctionGroup(null, null, null, null, ctr.data);//取之前的数据
jfrefreshgrid(ctr.data, ctr.range, ctr.config, ctr.cdformat, ctr.RowlChange);
jfrefreshgrid(ctr.data, ctr.range, ctr.config, ctr.cdformat, ctr.RowlChange, ctr.dataVerification);
}
else if (ctr.type == "pasteCut") {
let s = {
@ -69,6 +70,8 @@ const controlHistory = {
"curConfig": ctr.source["config"],
"cdformat": ctr.source["curCdformat"],
"curCdformat": ctr.source["cdformat"],
"dataVerification": ctr.source["curDataVerification"],
"curDataVerification": ctr.source["dataVerification"],
"range": ctr.source["range"]
}
let t = {
@ -79,6 +82,8 @@ const controlHistory = {
"curConfig": ctr.target["config"],
"cdformat": ctr.target["curCdformat"],
"curCdformat": ctr.target["cdformat"],
"dataVerification": ctr.target["curDataVerification"],
"curDataVerification": ctr.target["dataVerification"],
"range": ctr.target["range"]
}
jfrefreshgrid_pastcut(s, t, ctr.RowlChange);
@ -139,17 +144,47 @@ const controlHistory = {
ctrlValue.index = ctrlValue.index + 1;
}
jfrefreshgrid_adRC(ctr.data, ctr.config, "delRC", ctrlValue, ctr.calc, ctr.filterObj, ctr.cf, ctr.af, ctr.freezen);
jfrefreshgrid_adRC(
ctr.data,
ctr.config,
"delRC",
ctrlValue,
ctr.calc,
ctr.filterObj,
ctr.cf,
ctr.af,
ctr.freezen,
ctr.dataVerification
);
}
else if (ctr.type == "delRC") { //删除行列撤销操作
let ctrlValue = $.extend(true, {}, ctr.ctrlValue);
ctrlValue.restore = true;
ctrlValue.direction = "lefttop";
jfrefreshgrid_adRC(ctr.data, ctr.config, "addRC", ctrlValue, ctr.calc, ctr.filterObj, ctr.cf, ctr.af, ctr.freezen);
jfrefreshgrid_adRC(
ctr.data,
ctr.config,
"addRC",
ctrlValue,
ctr.calc,
ctr.filterObj,
ctr.cf,
ctr.af,
ctr.freezen,
ctr.dataVerification
);
}
else if (ctr.type == "deleteCell") { //删除单元格撤销操作
jfrefreshgrid_deleteCell(ctr.data, ctr.config, ctr.ctrl, ctr.calc, ctr.filterObj, ctr.cf);
jfrefreshgrid_deleteCell(
ctr.data,
ctr.config,
ctr.ctrl,
ctr.calc,
ctr.filterObj,
ctr.cf,
ctr.dataVerification
);
}
else if (ctr.type == "showHidRows") { // 隐藏、显示行 撤销操作
//config
@ -287,6 +322,12 @@ const controlHistory = {
else if (ctr.type == "mergeChange") {
jfrefreshgrid(ctr.data, ctr.range, ctr.config);
}
else if (ctr.type == "updateDataVerification"){
dataVerificationCtrl.ref(ctr.currentDataVerification, ctr.historyDataVerification, ctr.sheetIndex);
}
else if (ctr.type == "updateDataVerificationOfCheckbox"){
dataVerificationCtrl.refOfCheckbox(ctr.currentDataVerification, ctr.historyDataVerification, ctr.sheetIndex, ctr.data, ctr.range);
}
else if (ctr.type == "updateCF"){
let historyRules = ctr["data"]["historyRules"];
@ -375,7 +416,7 @@ const controlHistory = {
if (ctr.type == "datachange") {
formula.execFunctionGroup();
jfrefreshgrid(ctr.curdata, ctr.range, ctr.curConfig, ctr.curCdformat, ctr.RowlChange);
jfrefreshgrid(ctr.curdata, ctr.range, ctr.curConfig, ctr.curCdformat, ctr.RowlChange, ctr.curDataVerification);
}
else if (ctr.type == "pasteCut") {
jfrefreshgrid_pastcut(ctr.source, ctr.target, ctr.RowlChange);
@ -415,13 +456,43 @@ const controlHistory = {
jfrefreshgridall(ctr.curdata[0].length, ctr.curdata.length, ctr.curdata, ctr.curconfig, ctr.currange, ctr.ctrlType, ctr.ctrlValue);
}
else if (ctr.type == "addRC") { //增加行列重做操作
jfrefreshgrid_adRC(ctr.curData, ctr.curConfig, "addRC", ctr.ctrlValue, ctr.curCalc, ctr.curFilterObj, ctr.curCf, ctr.curAf, ctr.curFreezen);
jfrefreshgrid_adRC(
ctr.curData,
ctr.curConfig,
"addRC",
ctr.ctrlValue,
ctr.curCalc,
ctr.curFilterObj,
ctr.curCf,
ctr.curAf,
ctr.curFreezen,
ctr.curDataVerification
);
}
else if (ctr.type == "delRC") { //删除行列重做操作
jfrefreshgrid_adRC(ctr.curData, ctr.curConfig, "delRC", ctr.ctrlValue, ctr.curCalc, ctr.curFilterObj, ctr.curCf, ctr.curAf, ctr.curFreezen);
jfrefreshgrid_adRC(
ctr.curData,
ctr.curConfig,
"delRC",
ctr.ctrlValue,
ctr.curCalc,
ctr.curFilterObj,
ctr.curCf,
ctr.curAf,
ctr.curFreezen,
ctr.curDataVerification
);
}
else if (ctr.type == "deleteCell") { //删除单元格重做操作
jfrefreshgrid_deleteCell(ctr.curData, ctr.curConfig, ctr.ctrl, ctr.curCalc, ctr.curFilterObj, ctr.curCf);
jfrefreshgrid_deleteCell(
ctr.curData,
ctr.curConfig,
ctr.ctrl,
ctr.curCalc,
ctr.curFilterObj,
ctr.curCf,
ctr.curDataVerification
);
}
else if (ctr.type == "showHidRows") { // 隐藏、显示行 重做操作
//config
@ -542,6 +613,12 @@ const controlHistory = {
else if (ctr.type == "mergeChange") {
jfrefreshgrid(ctr.curData, ctr.range, ctr.curConfig);
}
else if (ctr.type == "updateDataVerification"){
dataVerificationCtrl.ref(ctr.historyDataVerification, ctr.currentDataVerification, ctr.sheetIndex);
}
else if (ctr.type == "updateDataVerificationOfCheckbox"){
dataVerificationCtrl.refOfCheckbox(ctr.historyDataVerification, ctr.currentDataVerification, ctr.sheetIndex, ctr.curData, ctr.range);
}
else if (ctr.type == "updateCF"){
let currentRules = ctr["data"]["currentRules"];

1390
src/controllers/dataVerificationCtrl.js

File diff suppressed because it is too large

23
src/controllers/dropCell.js

@ -450,6 +450,7 @@ const luckysheetDropCell = {
let cfg = $.extend(true, {}, Store.config);
let borderInfoCompute = getBorderInfoCompute();
let dataVerification = $.extend(true, {}, file["dataVerification"]);
let direction = _this.direction;
let type = _this.applyType;
@ -563,6 +564,11 @@ const luckysheetDropCell = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证
if(dataVerification[bd_r + "_" + bd_c]){
dataVerification[j + "_" + i] = dataVerification[bd_r + "_" + bd_c];
}
}
}
if(direction == "up"){
@ -647,6 +653,11 @@ const luckysheetDropCell = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证
if(dataVerification[bd_r + "_" + bd_c]){
dataVerification[j + "_" + i] = dataVerification[bd_r + "_" + bd_c];
}
}
}
}
@ -741,6 +752,11 @@ const luckysheetDropCell = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证
if(dataVerification[bd_r + "_" + bd_c]){
dataVerification[i + "_" + j] = dataVerification[bd_r + "_" + bd_c];
}
}
}
if(direction == "left"){
@ -825,6 +841,11 @@ const luckysheetDropCell = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证
if(dataVerification[bd_r + "_" + bd_c]){
dataVerification[i + "_" + j] = dataVerification[bd_r + "_" + bd_c];
}
}
}
}
@ -852,7 +873,7 @@ const luckysheetDropCell = {
}
//刷新一次表格
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat);
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
selectHightlightShow();
},

251
src/controllers/handler.js

@ -5,6 +5,7 @@ import pivotTable from './pivotTable';
import luckysheetDropCell from './dropCell';
import luckysheetPostil from './postil';
import imageCtrl from './imageCtrl';
import dataVerificationCtrl from './dataVerificationCtrl';
import menuButton from './menuButton';
import conditionformat from './conditionformat';
import alternateformat from './alternateformat';
@ -233,6 +234,10 @@ export default function luckysheetHandler() {
//表格mousedown
$("#luckysheet-cell-main, #luckysheetTableContent").mousedown(function (event) {
if($(event.target).hasClass('luckysheet-mousedown-cancel')){
return;
}
$("#luckysheet-cell-selected").find(".luckysheet-cs-fillhandle")
.css("cursor","default")
.end()
@ -289,6 +294,9 @@ export default function luckysheetHandler() {
col_index_ed = margeset.column[3];
}
//数据验证 单元格聚焦
dataVerificationCtrl.cellFocus(row_index, col_index, true);
//若点击单元格部分不在视图内
if (col_pre < $("#luckysheet-cell-main").scrollLeft()) {
$("#luckysheet-scrollbar-x").scrollLeft(col_pre);
@ -300,6 +308,8 @@ export default function luckysheetHandler() {
//mousedown是右键
if (event.which == "3") {
$("#luckysheet-dataVerification-showHintBox").hide();
let isright = false;
for (let s = 0; s < Store.luckysheet_select_save.length; s++) {
@ -669,6 +679,134 @@ export default function luckysheetHandler() {
return;
}
//数据验证 单元格范围选择
if($("#luckysheet-dataVerificationRange-dialog").is(":visible")){
dataVerificationCtrl.selectStatus = true;
Store.luckysheet_select_status = false;
if (event.shiftKey) {
let last = dataVerificationCtrl.selectRange[dataVerificationCtrl.selectRange.length - 1];
let top = 0, height = 0, rowseleted = [];
if (last.top > row_pre) {
top = row_pre;
height = last.top + last.height - row_pre;
if (last.row[1] > last.row_focus) {
last.row[1] = last.row_focus;
}
rowseleted = [row_index, last.row[1]];
}
else if (last.top == row_pre) {
top = row_pre;
height = last.top + last.height - row_pre;
rowseleted = [row_index, last.row[0]];
}
else {
top = last.top;
height = row - last.top - 1;
if (last.row[0] < last.row_focus) {
last.row[0] = last.row_focus;
}
rowseleted = [last.row[0], row_index];
}
let left = 0, width = 0, columnseleted = [];
if (last.left > col_pre) {
left = col_pre;
width = last.left + last.width - col_pre;
if (last.column[1] > last.column_focus) {
last.column[1] = last.column_focus;
}
columnseleted = [col_index, last.column[1]];
}
else if (last.left == col_pre) {
left = col_pre;
width = last.left + last.width - col_pre;
columnseleted = [col_index, last.column[0]];
}
else {
left = last.left;
width = col - last.left - 1;
if (last.column[0] < last.column_focus) {
last.column[0] = last.column_focus;
}
columnseleted = [last.column[0], col_index];
}
let changeparam = menuButton.mergeMoveMain(columnseleted, rowseleted, last, top, height, left, width);
if (changeparam != null) {
columnseleted = changeparam[0];
rowseleted = changeparam[1];
top = changeparam[2];
height = changeparam[3];
left = changeparam[4];
width = changeparam[5];
}
last["row"] = rowseleted;
last["column"] = columnseleted;
last["left_move"] = left;
last["width_move"] = width;
last["top_move"] = top;
last["height_move"] = height;
dataVerificationCtrl.selectRange[dataVerificationCtrl.selectRange.length - 1] = last;
}
else if (event.ctrlKey) {
dataVerificationCtrl.selectRange.push({
"left": col_pre,
"width": col - col_pre - 1,
"top": row_pre,
"height": row - row_pre - 1,
"left_move": col_pre,
"width_move": col - col_pre - 1,
"top_move": row_pre,
"height_move": row - row_pre - 1,
"row": [row_index, row_index_ed],
"column": [col_index, col_index_ed],
"row_focus": row_index,
"column_focus": col_index
});
}
else {
dataVerificationCtrl.selectRange = [];
dataVerificationCtrl.selectRange.push({
"left": col_pre,
"width": col - col_pre - 1,
"top": row_pre,
"height": row - row_pre - 1,
"left_move": col_pre,
"width_move": col - col_pre - 1,
"top_move": row_pre,
"height_move": row - row_pre - 1,
"row": [row_index, row_index_ed],
"column": [col_index, col_index_ed],
"row_focus": row_index,
"column_focus": col_index
});
}
selectionCopyShow(dataVerificationCtrl.selectRange);
let range = dataVerificationCtrl.getTxtByRange(dataVerificationCtrl.selectRange);
$("#luckysheet-dataVerificationRange-dialog input").val(range);
return;
}
else{
dataVerificationCtrl.selectStatus = false;
dataVerificationCtrl.selectRange = [];
}
//if公式生成器
if (ifFormulaGenerator.singleRangeFocus) {
$("#luckysheet-ifFormulaGenerator-dialog .singRange").click();
@ -1023,6 +1161,10 @@ export default function luckysheetHandler() {
showrightclickmenu($("#luckysheet-rightclick-menu"), x, y);
}
}).dblclick(function (event) {
if($(event.target).hasClass('luckysheet-mousedown-cancel')){
return;
}
//禁止前台编辑(只可 框选单元格、滚动查看表格)
if (!Store.allowEdit) {
return;
@ -1569,6 +1711,101 @@ export default function luckysheetHandler() {
let range = conditionformat.getTxtByRange(conditionformat.selectRange);
$("#luckysheet-multiRange-dialog input").val(range);
}
else if (dataVerificationCtrl.selectStatus) {
let mouse = mouseposition(event.pageX, event.pageY);
let x = mouse[0] + $("#luckysheet-cell-main").scrollLeft();
let y = mouse[1] + $("#luckysheet-cell-main").scrollTop();
let row_location = rowLocation(y),
row = row_location[1],
row_pre = row_location[0],
row_index = row_location[2];
let col_location = colLocation(x),
col = col_location[1],
col_pre = col_location[0],
col_index = col_location[2];
let last = dataVerificationCtrl.selectRange[dataVerificationCtrl.selectRange.length - 1];
let top = 0, height = 0, rowseleted = [];
if (last.top > row_pre) {
top = row_pre;
height = last.top + last.height - row_pre;
if (last.row[1] > last.row_focus) {
last.row[1] = last.row_focus;
}
rowseleted = [row_index, last.row[1]];
}
else if (last.top == row_pre) {
top = row_pre;
height = last.top + last.height - row_pre;
rowseleted = [row_index, last.row[0]];
}
else {
top = last.top;
height = row - last.top - 1;
if (last.row[0] < last.row_focus) {
last.row[0] = last.row_focus;
}
rowseleted = [last.row[0], row_index];
}
let left = 0, width = 0, columnseleted = [];
if (last.left > col_pre) {
left = col_pre;
width = last.left + last.width - col_pre;
if (last.column[1] > last.column_focus) {
last.column[1] = last.column_focus;
}
columnseleted = [col_index, last.column[1]];
}
else if (last.left == col_pre) {
left = col_pre;
width = last.left + last.width - col_pre;
columnseleted = [col_index, last.column[0]];
}
else {
left = last.left;
width = col - last.left - 1;
if (last.column[0] < last.column_focus) {
last.column[0] = last.column_focus;
}
columnseleted = [last.column[0], col_index];
}
let changeparam = menuButton.mergeMoveMain(columnseleted, rowseleted, last, top, height, left, width);
if (changeparam != null) {
columnseleted = changeparam[0];
rowseleted = changeparam[1];
top = changeparam[2];
height = changeparam[3];
left = changeparam[4];
width = changeparam[5];
}
last["row"] = rowseleted;
last["column"] = columnseleted;
last["left_move"] = left;
last["width_move"] = width;
last["top_move"] = top;
last["height_move"] = height;
dataVerificationCtrl.selectRange[dataVerificationCtrl.selectRange.length - 1] = last;
selectionCopyShow(dataVerificationCtrl.selectRange);
let range = dataVerificationCtrl.getTxtByRange(dataVerificationCtrl.selectRange);
$("#luckysheet-dataVerificationRange-dialog input").val(range);
}
else if (formula.rangestart) {
formula.rangedrag(event);
}
@ -4055,6 +4292,16 @@ export default function luckysheetHandler() {
}
});
//菜单栏 数据验证按钮
$("#luckysheet-dataVerification-btn-title").click(function () {
if (Store.luckysheet_select_save == null || Store.luckysheet_select_save.length == 0) {
return;
}
dataVerificationCtrl.createDialog();
dataVerificationCtrl.init();
})
//冻结行列
$("#luckysheet-freezen-btn-horizontal").click(function () {
if ($.trim($(this).text()) == locale().freezen.freezenCancel) {
@ -4396,8 +4643,6 @@ export default function luckysheetHandler() {
clipboardData = e.originalEvent.clipboardData;
}
let txtdata = clipboardData.getData("text/html");
//如果标示是qksheet复制的内容,判断剪贴板内容是否是当前页面复制的内容
@ -4479,7 +4724,6 @@ export default function luckysheetHandler() {
}
}
const locale_fontjson = locale().fontjson;
if (txtdata.indexOf("luckysheet_copy_action_table") > - 1 && Store.luckysheet_copy_save["copyRange"] != null && Store.luckysheet_copy_save["copyRange"].length > 0 && isEqual) {
@ -4719,7 +4963,6 @@ export default function luckysheetHandler() {
else if(clipboardData.files.length == 1 && clipboardData.files[0].type.indexOf('image') > -1){
let render = new FileReader();
render.readAsDataURL(clipboardData.files[0]);
render.onload = function(event){
let src = event.target.result;
imageCtrl.inserImg(src);

2
src/controllers/pivotTable.js

@ -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,isRefreshCanvas);
jfrefreshgrid(data, Store.luckysheet_select_save, undefined, undefined, undefined, undefined, undefined,isRefreshCanvas);
selectHightlightShow();
}

3
src/controllers/select.js

@ -3,6 +3,7 @@ import formula from '../global/formula';
import { dynamicArrayHightShow } from '../global/dynamicArray';
import { rowLocationByIndex, colLocationByIndex } from '../global/location';
import browser from '../global/browser';
import dataVerificationCtrl from './dataVerificationCtrl';
import { getSheetIndex, getRangetxt } from '../methods/get';
import Store from '../store';
import locale from '../locale/locale';
@ -163,6 +164,8 @@ function selectHightlightShow() {
);
//左上角选择区域框
formula.fucntionboxshow(rf, cf);
//focus单元格数据验证
dataVerificationCtrl.cellFocus(rf, cf);
}
}

245
src/controllers/selection.js

@ -799,9 +799,10 @@ const selection = {
}
},
pasteHandlerOfCutPaste: function(copyRange){
if(Store.allowEdit===false){
if(Store.allowEdit === false){
return;
}
let cfg = $.extend(true, {}, Store.config);
if(cfg["merge"] == null){
cfg["merge"] = {};
@ -810,9 +811,14 @@ const selection = {
//复制范围
let copyHasMC = copyRange["HasMC"];
let copyRowlChange = copyRange["RowlChange"];
let copySheetIndex = copyRange["dataSheetIndex"];
let copyData = $.extend(true, [], getdatabyselection({"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, copySheetIndex));
let c_r1 = copyRange["copyRange"][0].row[0],
c_r2 = copyRange["copyRange"][0].row[1],
c_c1 = copyRange["copyRange"][0].column[0],
c_c2 = copyRange["copyRange"][0].column[1];
let copyData = $.extend(true, [], getdatabyselection({"row": [c_r1, c_r2], "column": [c_c1, c_c2]}, copySheetIndex));
let copyh = copyData.length, copyc = copyData[0].length;
@ -847,11 +853,13 @@ const selection = {
}
let borderInfoCompute = getBorderInfoCompute(copySheetIndex);
let c_dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(copySheetIndex)]["dataVerification"]);
let dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]);
//剪切粘贴在当前表操作,删除剪切范围内数据和合并单元格
//剪切粘贴在当前表操作,删除剪切范围内数据、合并单元格和数据验证
if(Store.currentSheetIndex == copySheetIndex){
for(let i = copyRange["copyRange"][0].row[0]; i <= copyRange["copyRange"][0].row[1]; i++){
for(let j = copyRange["copyRange"][0].column[0]; j <= copyRange["copyRange"][0].column[1]; j++){
for(let i = c_r1; i <= c_r2; i++){
for(let j = c_c1; j <= c_c2; j++){
let cell = d[i][j];
if(getObjType(cell) == "object" && ("mc" in cell)){
@ -862,6 +870,8 @@ const selection = {
}
d[i][j] = null;
delete dataVerification[i + "_" + j];
}
}
@ -877,7 +887,12 @@ const selection = {
let bd_emptyRange = [];
for(let j = 0; j < bd_range.length; j++){
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(bd_range[j], {"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, {"row": [minh, maxh], "column": [minc, maxc]}, "restPart"));
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(
bd_range[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
));
}
cfg["borderInfo"][i].range = bd_emptyRange;
@ -888,7 +903,7 @@ const selection = {
let bd_r = cfg["borderInfo"][i].value.row_index;
let bd_c = cfg["borderInfo"][i].value.col_index;
if(!(bd_r >= copyRange["copyRange"][0].row[0] && bd_r <= copyRange["copyRange"][0].row[1] && bd_c >= copyRange["copyRange"][0].column[0] && bd_c <= copyRange["copyRange"][0].column[1])){
if(!(bd_r >= c_r1 && bd_r <= c_r2 && bd_c >= c_c1 && bd_c <= c_c2)){
source_borderInfo.push(cfg["borderInfo"][i]);
}
}
@ -903,16 +918,16 @@ const selection = {
let x = [].concat(d[h]);
for (let c = minc; c <= maxc; c++) {
if(borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - minh) + "_" + (copyRange["copyRange"][0].column[0] + c - minc)]){
if(borderInfoCompute[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)]){
let bd_obj = {
"rangeType": "cell",
"value": {
"row_index": h,
"col_index": c,
"l": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - minh) + "_" + (copyRange["copyRange"][0].column[0] + c - minc)].l,
"r": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - minh) + "_" + (copyRange["copyRange"][0].column[0] + c - minc)].r,
"t": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - minh) + "_" + (copyRange["copyRange"][0].column[0] + c - minc)].t,
"b": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - minh) + "_" + (copyRange["copyRange"][0].column[0] + c - minc)].b
"l": borderInfoCompute[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)].l,
"r": borderInfoCompute[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)].r,
"t": borderInfoCompute[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)].t,
"b": borderInfoCompute[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)].b
}
}
@ -942,6 +957,11 @@ const selection = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证 剪切
if(c_dataVerification[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)]){
dataVerification[h + "_" + c] = c_dataVerification[(c_r1 + h - minh) + "_" + (c_c1 + c - minc)];
}
if(getObjType(x[c]) == "object" && ("mc" in x[c])){
if("rs" in x[c].mc){
delete cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c];
@ -983,7 +1003,7 @@ const selection = {
cfg = rowlenByRange(d, minh, maxh, cfg);
}
else{
cfg = rowlenByRange(d, copyRange["copyRange"][0].row[0], copyRange["copyRange"][0].row[1], cfg);
cfg = rowlenByRange(d, c_r1, c_r2, cfg);
cfg = rowlenByRange(d, minh, maxh, cfg);
}
}
@ -1000,13 +1020,8 @@ const selection = {
sourceCurConfig["merge"] = {};
}
let source_r1 = copyRange["copyRange"][0].row[0],
source_r2 = copyRange["copyRange"][0].row[1];
let source_c1 = copyRange["copyRange"][0].column[0],
source_c2 = copyRange["copyRange"][0].column[1];
for(let source_r = source_r1; source_r <= source_r2; source_r++){
for(let source_c = source_c1; source_c <= source_c2; source_c++){
for(let source_r = c_r1; source_r <= c_r2; source_r++){
for(let source_c = c_c1; source_c <= c_c2; source_c++){
let cell = sourceCurData[source_r][source_c];
if(getObjType(cell) == "object" && ("mc" in cell)){
@ -1020,7 +1035,7 @@ const selection = {
}
if(copyRowlChange){
sourceCurConfig = rowlenByRange(sourceCurData, source_r1, source_r2, sourceCurConfig);
sourceCurConfig = rowlenByRange(sourceCurData, c_r1, c_r2, sourceCurConfig);
}
//边框
@ -1035,7 +1050,12 @@ const selection = {
let bd_emptyRange = [];
for(let j = 0; j < bd_range.length; j++){
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(bd_range[j], {"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, {"row": [minh, maxh], "column": [minc, maxc]}, "restPart"));
bd_emptyRange = bd_emptyRange.concat(conditionformat.CFSplitRange(
bd_range[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
));
}
sourceCurConfig["borderInfo"][i].range = bd_emptyRange;
@ -1046,7 +1066,7 @@ const selection = {
let bd_r = sourceCurConfig["borderInfo"][i].value.row_index;
let bd_c = sourceCurConfig["borderInfo"][i].value.col_index;
if(!(bd_r >= copyRange["copyRange"][0].row[0] && bd_r <= copyRange["copyRange"][0].row[1] && bd_c >= copyRange["copyRange"][0].column[0] && bd_c <= copyRange["copyRange"][0].column[1])){
if(!(bd_r >= c_r1 && bd_r <= c_r2 && bd_c >= c_c1 && bd_c <= c_c2)){
source_borderInfo.push(sourceCurConfig["borderInfo"][i]);
}
}
@ -1066,10 +1086,22 @@ const selection = {
let emptyRange2 = [];
for(let j = 0; j < source_curCdformat_cellrange.length; j++){
let range = conditionformat.CFSplitRange(source_curCdformat_cellrange[j], {"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, {"row": [minh, maxh], "column": [minc, maxc]}, "restPart");
let range = conditionformat.CFSplitRange(
source_curCdformat_cellrange[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"restPart"
);
emptyRange = emptyRange.concat(range);
let range2 = conditionformat.CFSplitRange(source_curCdformat_cellrange[j], {"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, {"row": [minh, maxh], "column": [minc, maxc]}, "operatePart");
let range2 = conditionformat.CFSplitRange(
source_curCdformat_cellrange[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"operatePart"
);
if(range2.length > 0){
emptyRange2 = emptyRange2.concat(range2);
}
@ -1091,6 +1123,13 @@ const selection = {
target_curCdformat = target_curCdformat.concat(ruleArr);
}
//数据验证
for(let i = c_r1; i <= c_r2; i++){
for(let j = c_c1; j <= c_c2; j++){
delete c_dataVerification[i + "_" + j];
}
}
source = {
"sheetIndex": copySheetIndex,
"data": sourceData,
@ -1099,9 +1138,11 @@ const selection = {
"curConfig": sourceCurConfig,
"cdformat": source_cdformat,
"curCdformat": source_curCdformat,
"dataVerification": $.extend(true, {}, Store.luckysheetfile[getSheetIndex(copySheetIndex)]["dataVerification"]),
"curDataVerification": c_dataVerification,
"range": {
"row": copyRange["copyRange"][0].row,
"column": copyRange["copyRange"][0].column
"row": [c_r1, c_r2],
"column": [c_c1, c_c2]
}
}
target = {
@ -1112,6 +1153,8 @@ const selection = {
"curConfig": cfg,
"cdformat": target_cdformat,
"curCdformat": target_curCdformat,
"dataVerification": $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]),
"curDataVerification": dataVerification,
"range": {
"row": [minh, maxh],
"column": [minc, maxc]
@ -1128,7 +1171,13 @@ const selection = {
let emptyRange = [];
for(let j = 0; j < cellrange.length; j++){
let range = conditionformat.CFSplitRange(cellrange[j], {"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, {"row": [minh, maxh], "column": [minc, maxc]}, "allPart");
let range = conditionformat.CFSplitRange(
cellrange[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"allPart"
);
emptyRange = emptyRange.concat(range);
}
@ -1145,9 +1194,11 @@ const selection = {
"curConfig": cfg,
"cdformat": cdformat,
"curCdformat": curCdformat,
"dataVerification": $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]),
"curDataVerification": dataVerification,
"range": {
"row": copyRange["copyRange"][0].row,
"column": copyRange["copyRange"][0].column
"row": [c_r1, c_r2],
"column": [c_c1, c_c2]
}
}
target = {
@ -1158,6 +1209,8 @@ const selection = {
"curConfig": cfg,
"cdformat": cdformat,
"curCdformat": curCdformat,
"dataVerification": $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]),
"curDataVerification": dataVerification,
"range": {
"row": [minh, maxh],
"column": [minc, maxc]
@ -1183,11 +1236,16 @@ const selection = {
let copyRowlChange = copyRange["RowlChange"];
let copySheetIndex = copyRange["dataSheetIndex"];
let c_r1 = copyRange["copyRange"][0].row[0],
c_r2 = copyRange["copyRange"][0].row[1],
c_c1 = copyRange["copyRange"][0].column[0],
c_c2 = copyRange["copyRange"][0].column[1];
let arr = [], isSameRow = false;
for(let i = 0; i < copyRange["copyRange"].length; i++){
let arrData = getdatabyselection({"row": copyRange["copyRange"][i].row, "column": copyRange["copyRange"][i].column}, copySheetIndex);
if(copyRange["copyRange"].length > 1){
if(copyRange["copyRange"][0].row[0] == copyRange["copyRange"][1].row[0] && copyRange["copyRange"][0].row[1] == copyRange["copyRange"][1].row[1]){
if(c_r1 == copyRange["copyRange"][1].row[0] && c_r2 == copyRange["copyRange"][1].row[1]){
arrData = arrData[0].map(function(col, a){
return arrData.map(function(row){
return row[a];
@ -1198,7 +1256,7 @@ const selection = {
isSameRow = true;
}
else if(copyRange["copyRange"][0].column[0] == copyRange["copyRange"][1].column[0] && copyRange["copyRange"][0].column[1] == copyRange["copyRange"][1].column[1]){
else if(c_c1 == copyRange["copyRange"][1].column[0] && c_c2 == copyRange["copyRange"][1].column[1]){
arr = arr.concat(arrData);
}
}
@ -1274,6 +1332,8 @@ const selection = {
}
let borderInfoCompute = getBorderInfoCompute(copySheetIndex);
let c_dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(copySheetIndex)].dataVerification);
let dataVerification = null;
let mth = 0, mtc = 0, maxcellCahe = 0, maxrowCache = 0;
for(let th = 1; th <= timesH; th++){
@ -1284,24 +1344,24 @@ const selection = {
maxcellCahe = minc + tc * copyc;
//行列位移值 用于单元格有函数
let offsetRow = mth - copyRange["copyRange"][0].row[0];
let offsetCol = mtc - copyRange["copyRange"][0].column[0];
let offsetRow = mth - c_r1;
let offsetCol = mtc - c_c1;
let offsetMC = {};
for (let h = mth; h < maxrowCache; h++) {
let x = [].concat(d[h]);
for (let c = mtc; c < maxcellCahe; c++) {
if(borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)]){
if(borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
let bd_obj = {
"rangeType": "cell",
"value": {
"row_index": h,
"col_index": c,
"l": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].l,
"r": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].r,
"t": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].t,
"b": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].b
"l": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].l,
"r": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].r,
"t": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].t,
"b": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].b
}
}
@ -1331,6 +1391,15 @@ const selection = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证 复制
if(c_dataVerification[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
if(dataVerification == null){
dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].dataVerification)
}
dataVerification[h + "_" + c] = c_dataVerification[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)];
}
if(getObjType(x[c]) == "object" && "mc" in x[c]){
if("rs" in x[c].mc){
delete cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c];
@ -1401,21 +1470,17 @@ const selection = {
}
}
//复制范围 是否有 条件格式
let ruleArr_cf = [], cdformat = [];
//复制范围 是否有 条件格式和数据验证
let cdformat = null;
if(copyRange["copyRange"].length == 1){
let c_file = Store.luckysheetfile[getSheetIndex(copySheetIndex)];
let a_file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
let c_r1 = copyRange["copyRange"][0].row[0],
c_r2 = copyRange["copyRange"][0].row[1],
c_c1 = copyRange["copyRange"][0].column[0],
c_c2 = copyRange["copyRange"][0].column[1];
ruleArr_cf = $.extend(true, [], c_file["luckysheet_conditionformat_save"]);
cdformat = $.extend(true, [], a_file["luckysheet_conditionformat_save"]);
let ruleArr_cf = $.extend(true, [], c_file["luckysheet_conditionformat_save"]);
if(ruleArr_cf != null && ruleArr_cf.length > 0){
cdformat = $.extend(true, [], a_file["luckysheet_conditionformat_save"]);
for(let i = 0; i < ruleArr_cf.length; i++){
let cf_range = ruleArr_cf[i].cellrange;
@ -1429,7 +1494,13 @@ const selection = {
maxcellCahe = minc + tc * copyc;
for(let j = 0; j < cf_range.length; j++){
let range = conditionformat.CFSplitRange(cf_range[j], {"row": [c_r1, c_r2], "column": [c_c1, c_c2]}, {"row": [mth, maxrowCache - 1], "column": [mtc, maxcellCahe - 1]}, "operatePart");
let range = conditionformat.CFSplitRange(
cf_range[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [mth, maxrowCache - 1], "column": [mtc, maxcellCahe - 1]},
"operatePart"
);
if(range.length > 0){
emptyRange = emptyRange.concat(range);
}
@ -1450,22 +1521,10 @@ const selection = {
if(copyRowlChange || addr > 0 || addc > 0){
cfg = rowlenByRange(d, minh, maxh, cfg);
if(copyRange["copyRange"].length == 1 && ruleArr_cf != null && ruleArr_cf.length > 0){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true);
}
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true, dataVerification);
}
else{
if(copyRange["copyRange"].length == 1 && ruleArr_cf != null && ruleArr_cf.length > 0){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg);
}
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
selectHightlightShow();
}
},
@ -1478,9 +1537,14 @@ const selection = {
//复制范围
let copyHasMC = copyRange["HasMC"];
let copyRowlChange = copyRange["RowlChange"];
let copySheetIndex = copyRange["dataSheetIndex"];
let copyData = $.extend(true, [], getdatabyselection({"row": copyRange["copyRange"][0].row, "column": copyRange["copyRange"][0].column}, copySheetIndex));
let c_r1 = copyRange["copyRange"][0].row[0],
c_r2 = copyRange["copyRange"][0].row[1],
c_c1 = copyRange["copyRange"][0].column[0],
c_c2 = copyRange["copyRange"][0].column[1];
let copyData = $.extend(true, [], getdatabyselection({"row": [c_r1, c_r2], "column": [c_c1, c_c2]}, copySheetIndex));
//应用范围
let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
@ -1518,6 +1582,8 @@ const selection = {
let rowMaxLength = d.length;
let borderInfoCompute = getBorderInfoCompute(copySheetIndex);
let c_dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(copySheetIndex)].dataVerification);
let dataVerification = null;
let mth = 0, mtc = 0, maxcellCahe = 0, maxrowCache = 0;
for (let th = 1; th <= timesH; th++) {
@ -1540,16 +1606,16 @@ const selection = {
let x = [].concat(d[h]);
for (let c = mtc; c < maxcellCahe; c++) {
if(borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)]){
if(borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
let bd_obj = {
"rangeType": "cell",
"value": {
"row_index": h,
"col_index": c,
"l": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].l,
"r": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].r,
"t": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].t,
"b": borderInfoCompute[(copyRange["copyRange"][0].row[0] + h - mth) + "_" + (copyRange["copyRange"][0].column[0] + c - mtc)].b
"l": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].l,
"r": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].r,
"t": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].t,
"b": borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)].b
}
}
@ -1579,6 +1645,15 @@ const selection = {
cfg["borderInfo"].push(bd_obj);
}
//数据验证 复制
if(c_dataVerification[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
if(dataVerification == null){
dataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)].dataVerification)
}
dataVerification[h + "_" + c] = c_dataVerification[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)];
}
if(getObjType(x[c]) == "object" && ("mc" in x[c])){
if("rs" in x[c].mc){
delete cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c];
@ -1642,16 +1717,24 @@ const selection = {
}
//复制范围 是否有 条件格式
let cdformat = null;
let ruleArr = $.extend(true, [], Store.luckysheetfile[getSheetIndex(copySheetIndex)]["luckysheet_conditionformat_save"]);
let cdformat = $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]);
if(ruleArr != null && ruleArr.length > 0){
cdformat = $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]);
for(let i = 0; i < ruleArr.length; i++){
let cdformat_cellrange = ruleArr[i].cellrange;
let emptyRange = [];
for(let j = 0; j < cdformat_cellrange.length; j++){
let range = conditionformat.CFSplitRange(cdformat_cellrange[j], {"row": copyRange["copyRange"][0]["row"], "column": copyRange["copyRange"][0]["column"]}, {"row": [minh, maxh], "column": [minc, maxc]}, "operatePart");
let range = conditionformat.CFSplitRange(
cdformat_cellrange[j],
{"row": [c_r1, c_r2], "column": [c_c1, c_c2]},
{"row": [minh, maxh], "column": [minc, maxc]},
"operatePart"
);
if(range.length > 0){
emptyRange = emptyRange.concat(range);
}
@ -1669,22 +1752,10 @@ const selection = {
if(copyRowlChange){
cfg = rowlenByRange(d, minh, maxh, cfg);
if(ruleArr != null && ruleArr.length > 0){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true);
}
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, true, dataVerification);
}
else{
if(ruleArr != null && ruleArr.length > 0){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save, cfg);
}
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, cdformat, null, dataVerification);
selectHightlightShow();
}
},

4
src/controllers/sheetmanage.js

@ -18,6 +18,7 @@ import pivotTable from './pivotTable';
import luckysheetsizeauto from './resize';
import luckysheetPostil from './postil';
import imageCtrl from './imageCtrl';
import dataVerificationCtrl from './dataVerificationCtrl';
import luckysheetFreezen from './freezen';
import { createFilterOptions, labelFilterOptionState } from './filter';
import { selectHightlightShow, selectionCopyShow } from './select';
@ -871,6 +872,9 @@ const sheetmanage = {
imageCtrl.images = file.images;
imageCtrl.allImagesShow();
//数据验证
dataVerificationCtrl.dataVerification = file.dataVerification;
this.sheetParamRestore(file, Store.flowdata);
if(file["freezen"] == null){

11
src/controllers/updateCell.js

@ -3,6 +3,7 @@ import luckysheetFreezen from './freezen';
import menuButton from './menuButton';
import conditionformat from './conditionformat';
import alternateformat from './alternateformat';
import dataVerificationCtrl from './dataVerificationCtrl';
import { chatatABC } from '../utils/util';
import { isEditMode } from '../global/validate';
import { getcellvalue } from '../global/getdata';
@ -17,6 +18,16 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
return;
}
if(dataVerificationCtrl.dataVerification != null && dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1] != null){
let dataVerificationItem = dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1];
if(dataVerificationItem.type == 'dropdown'){
dataVerificationCtrl.dropdownListShow();
}
else if(dataVerificationItem.type == 'checkbox'){
return;
}
}
let size = getColumnAndRowSize(row_index1, col_index1, d);
let row = size.row, row_pre = size.row_pre, col = size.col, col_pre = size.col_pre, row_index = size.row_index, col_index = size.col_index;

174
src/css/luckysheet-core.css

@ -7013,4 +7013,176 @@ fieldset[disabled] .btn-danger.focus {
margin-left: 5px;
margin-bottom: -5px;
cursor: pointer;
}
}
/* 数据验证 */
#luckysheet-dataVerification-dialog{
user-select: none;
}
#luckysheet-dataVerification-dialog .box{
font-size: 12px;
}
#luckysheet-dataVerification-dialog .box select{
width: 100%;
height: 30px;
border-color: #d4d4d4;
outline-style: none;
}
#luckysheet-dataVerification-dialog .box input::-webkit-input-placeholder {
color: #d4d4d4;
}
#luckysheet-dataVerification-dialog .box input:-moz-placeholder {
color: #d4d4d4;
}
#luckysheet-dataVerification-dialog .box input::-moz-placeholder {
color: #d4d4d4;
}
#luckysheet-dataVerification-dialog .box input:-ms-input-placeholder {
color: #d4d4d4;
}
#luckysheet-dataVerification-dialog .box-item{
padding: 10px;
border-bottom: 1px solid #E1E4E8;
}
#luckysheet-dataVerification-dialog .box-item .box-item-title{
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
}
#luckysheet-dataVerification-dialog .box-item .range{
width: 100%;
height: 30px;
border: 1px solid #d4d4d4;
}
#luckysheet-dataVerification-dialog .box-item .range input{
width: calc(100% - 30px);
height: 30px;
padding: 0 10px;
float: left;
border: none;
outline-style: none;
box-sizing: border-box;
}
#luckysheet-dataVerification-dialog .box-item .range i.fa-table{
float: right;
margin-top: 9px;
margin-right: 5px;
cursor: pointer;
color: #6598F3;
}
#luckysheet-dataVerification-dialog .box-item .show-box{
margin-top: 10px;
}
#luckysheet-dataVerification-dialog .box-item .check-box{
height: 30px;
line-height: 30px;
margin-bottom: 10px;
}
#luckysheet-dataVerification-dialog .box-item .check-box:last-child{
margin-bottom: 0;
}
#luckysheet-dataVerification-dialog .box-item .check-box input{
height: 30px;
padding: 0 10px;
border: 1px solid #d4d4d4;
box-sizing: border-box;
}
#luckysheet-dataVerification-dialog .box-item .check{
line-height: 30px;
}
#luckysheet-dataVerification-dialog .box-item .check input{
vertical-align: text-top;
}
#luckysheet-dataVerification-dialog .box-item .input{
height: 30px;
line-height: 30px;
margin-top: 10px;
}
#luckysheet-dataVerification-dialog .box-item .input input{
height: 30px;
padding: 4px 10px 4px 10px;
border: 1px solid #d4d4d4;
box-sizing: border-box;
}
#luckysheet-dataVerification-dialog .box-item .input1 input{
width: 150px;
}
#luckysheet-dataVerification-dialog .box-item .input2 input{
width: 100%;
}
#luckysheet-dataVerification-dialog .box-item .input span{
display: inline-block;
width: 30px;
text-align: center;
}
#luckysheet-dataVerification-dialog .data-verification-hint-text{
width: 100%;
height: 30px;
border: 1px solid #d4d4d4;
margin-top: 10px;
}
#luckysheet-dataVerification-dialog .data-verification-hint-text input{
display: block;
width: 100%;
height: 100%;
padding: 0 10px;
border: none;
outline-style: none;
box-sizing: border-box;
}
#luckysheet-dataVerification-dialog .show-box .show-box-item{
display: none;
}
#luckysheet-dataVerificationRange-dialog input{
height: 30px;
padding: 0 10px;
border: 1px solid #d4d4d4;
outline-style: none;
}
#luckysheet-dataVerification-dropdown-btn{
display: none;
width: 20px;
height: 20px;
background-color: #fff;
position: absolute;
z-index: 10;
overflow: hidden;
}
#luckysheet-dataVerification-dropdown-btn::after{
content: '';
width: 10px;
height: 10px;
background: url(arrow-down.png) center no-repeat;
position: absolute;
left: 50%;
top: 50%;
margin-left: -5px;
margin-top: -5px;
}
#luckysheet-dataVerification-dropdown-List{
display: none;
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
position: absolute;
z-index: 1000;
box-sizing: border-box;
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item{
padding: 5px 10px;
box-sizing: border-box;
cursor: pointer;
}
#luckysheet-dataVerification-dropdown-List .dropdown-List-item:hover{
background-color: #E1E1E1;
}
#luckysheet-dataVerification-showHintBox{
display: none;
padding: 10px;
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
position: absolute;
z-index: 1000;
user-select: none;
cursor: default;
}

102
src/global/draw.js

@ -3,6 +3,7 @@ import conditionformat from '../controllers/conditionformat';
import alternateformat from '../controllers/alternateformat';
import luckysheetSparkline from '../controllers/sparkline';
import menuButton from '../controllers/menuButton';
import dataVerificationCtrl from '../controllers/dataVerificationCtrl';
import { luckysheetdefaultstyle, luckysheet_CFiconsImg,luckysheetdefaultFont } from '../controllers/constant';
import { luckysheet_searcharray } from '../controllers/sheetSearch';
import { dynamicArrayCompute } from './dynamicArray';
@ -1179,7 +1180,6 @@ let nullCellRender = function(r, c, start_r, start_c, end_r, end_c,luckysheetTab
let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckysheetTableContent,af_compute, cf_compute,offsetLeft,offsetTop,dynamicArray_compute,cellOverflowMap, dataset_col_st, dataset_col_ed,scrollHeight,scrollWidth,bodrder05,isMerge){
let cell = Store.flowdata[r][c];
let cellWidth = end_c - start_c - 2;
let cellHeight = end_r - start_r - 2;
@ -1218,8 +1218,32 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
(start_r + offsetTop + borderfix[1]),
(end_c - start_c + borderfix[2]-(!!isMerge?1:0)),
(end_r - start_r + borderfix[3])
];
luckysheetTableContent.fillRect(cellsize[0], cellsize[1], cellsize[2], cellsize[3]);
];
luckysheetTableContent.fillRect(cellsize[0], cellsize[1], cellsize[2], cellsize[3]);
let dataVerification = dataVerificationCtrl.dataVerification;
if(dataVerification != null && dataVerification[r + '_' + c] != null && !dataVerificationCtrl.validateCellData(value, dataVerification[r + '_' + c])){
//单元格左上角红色小三角标示
let dv_w = 5 * Store.zoomRatio, dv_h = 5 * Store.zoomRatio; //红色小三角宽高
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
(start_c + offsetLeft),
(start_r + offsetTop)
);
luckysheetTableContent.lineTo(
(start_c + offsetLeft + dv_w),
(start_r + offsetTop)
);
luckysheetTableContent.lineTo(
(start_c + offsetLeft),
(start_r + offsetTop + dv_h)
);
luckysheetTableContent.fillStyle = "#FC6666";
luckysheetTableContent.fill();
luckysheetTableContent.closePath();
}
//若单元格有批注(单元格右上角红色小三角标示)
if(cell.ps != null){
@ -1265,7 +1289,6 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
luckysheetTableContent.closePath();
}
//溢出单元格
let cellOverflow_bd_r_render = true; //溢出单元格右边框是否需要绘制
let cellOverflow_colInObj = cellOverflow_colIn(cellOverflowMap, r, c, dataset_col_st, dataset_col_ed);
@ -1287,6 +1310,77 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
cellOverflow_bd_r_render = false;
}
}
//数据验证 复选框
else if(dataVerification != null && dataVerification[r + '_' + c] != null && dataVerification[r + '_' + c].type == 'checkbox'){
let pos_x = start_c + offsetLeft;
let pos_y = start_r + offsetTop + 1;
luckysheetTableContent.save();
luckysheetTableContent.beginPath();
luckysheetTableContent.rect(pos_x, pos_y, cellWidth, cellHeight);
luckysheetTableContent.clip();
luckysheetTableContent.scale(Store.zoomRatio,Store.zoomRatio);
textMetrics += 14;
let horizonAlignPos = (pos_x + space_width) ; //默认为1,左对齐
if(horizonAlign == "0"){ //居中对齐
horizonAlignPos = (pos_x + cellWidth / 2) - (textMetrics / 2);
}
else if(horizonAlign == "2"){ //右对齐
horizonAlignPos = (pos_x + cellWidth - space_width) - textMetrics;
}
let verticalCellHeight = cellHeight > oneLineTextHeight ? cellHeight : oneLineTextHeight;
let verticalAlignPos_text = (pos_y + verticalCellHeight - space_height) ; //文本垂直方向基准线
luckysheetTableContent.textBaseline = "bottom";
let verticalAlignPos_checkbox = verticalAlignPos_text - 13;
if(verticalAlign == "0"){ //居中对齐
verticalAlignPos_text = (pos_y + verticalCellHeight / 2);
luckysheetTableContent.textBaseline = "middle";
verticalAlignPos_checkbox = verticalAlignPos_text - 6;
}
else if(verticalAlign == "1"){ //上对齐
verticalAlignPos_text = (pos_y + space_height);
luckysheetTableContent.textBaseline = "top";
verticalAlignPos_checkbox = verticalAlignPos_text + 1;
}
horizonAlignPos = horizonAlignPos / Store.zoomRatio;
verticalAlignPos_text = verticalAlignPos_text / Store.zoomRatio;
verticalAlignPos_checkbox = verticalAlignPos_checkbox / Store.zoomRatio;
//复选框
luckysheetTableContent.lineWidth = 1;
luckysheetTableContent.strokeStyle = "#000";
luckysheetTableContent.strokeRect(horizonAlignPos, verticalAlignPos_checkbox, 10, 10);
if(dataVerification[r + '_' + c].checked){
luckysheetTableContent.beginPath();
luckysheetTableContent.lineTo(
horizonAlignPos + 1,
verticalAlignPos_checkbox + 6
);
luckysheetTableContent.lineTo(
horizonAlignPos + 4,
verticalAlignPos_checkbox + 9
);
luckysheetTableContent.lineTo(
horizonAlignPos + 9,
verticalAlignPos_checkbox + 2
);
luckysheetTableContent.stroke();
luckysheetTableContent.closePath();
}
//文本
luckysheetTableContent.fillStyle = menuButton.checkstatus(Store.flowdata, r, c , "fc");
luckysheetTableContent.fillText(value == null ? "" : value, horizonAlignPos + 14, verticalAlignPos_text);
luckysheetTableContent.restore();
}
else{
//若单元格有条件格式数据条
if(checksCF != null && checksCF["dataBar"] != null){

169
src/global/extend.js

@ -14,7 +14,7 @@ import Store from '../store';
function luckysheetextendtable(type, index, value, direction, order) {
let curOrder = order || getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[curOrder];
let d = file.data;
let d = $.extend(true, [], file.data);
value = Math.floor(value);
let cfg = $.extend(true, {}, file.config);
@ -457,6 +457,50 @@ function luckysheetextendtable(type, index, value, direction, order) {
newFreezen.freezenverticaldata = luckysheetFreezen.freezenverticaldata;
}
//数据验证配置变动
let dataVerification = file.dataVerification;
let newDataVerification = {};
if(dataVerification != null){
for(let key in dataVerification){
let r = Number(key.split('_')[0]),
c = Number(key.split('_')[1]);
let item = dataVerification[key];
if(type == "row"){
if(index < r){
newDataVerification[(r + value) + "_" + c] = item;
}
else if(index == r){
if(direction == "lefttop"){
newDataVerification[(r + value) + "_" + c] = item;
}
else{
newDataVerification[r + "_" + c] = item;
}
}
else{
newDataVerification[r + "_" + c] = item;
}
}
else if(type == "column"){
if(index < c){
newDataVerification[r + "_" + (c + value)] = item;
}
else if(index == c){
if(direction == "lefttop"){
newDataVerification[r + "_" + (c + value)] = item;
}
else{
newDataVerification[r + "_" + c] = item;
}
}
else{
newDataVerification[r + "_" + c] = item;
}
}
}
}
let type1;
if (type == "row") {
type1 = "r";
@ -713,7 +757,7 @@ function luckysheetextendtable(type, index, value, direction, order) {
}
// 修改当前sheet页时刷新
if (curOrder == Store.currentSheetIndex) {
if (file.index == Store.currentSheetIndex) {
jfrefreshgrid_adRC(
d,
cfg,
@ -723,9 +767,20 @@ function luckysheetextendtable(type, index, value, direction, order) {
newFilterObj,
newCFarr,
newAFarr,
newFreezen
newFreezen,
newDataVerification
);
}
else{
file.data = d;
file.config = cfg;
file.calcChain = newCalcChain;
file.filter = newFilterObj.filter;
file.filter_select = newFilterObj.filter_select;
file.luckysheet_conditionformat_save = newCFarr;
file.luckysheet_alternateformat_save = newAFarr;
file.dataVerification = newDataVerification;
}
let range = null;
if(type == "row"){
@ -746,7 +801,7 @@ function luckysheetextendtable(type, index, value, direction, order) {
}
file.luckysheet_select_save = range;
if (curOrder == Store.currentSheetIndex) {
if (file.index == Store.currentSheetIndex) {
Store.luckysheet_select_save = range;
selectHightlightShow();
}
@ -816,7 +871,7 @@ function luckysheetextendData(rowlen, newData) {
function luckysheetdeletetable(type, st, ed, order) {
let curOrder = order || getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[curOrder];
let d = file.data;
let d = $.extend(true, [], file.data);
let slen = ed - st + 1;
let cfg = $.extend(true, {}, file.config);
@ -1280,6 +1335,34 @@ function luckysheetdeletetable(type, st, ed, order) {
newFreezen.freezenverticaldata = luckysheetFreezen.freezenverticaldata;
}
//数据验证配置变动
let dataVerification = file.dataVerification;
let newDataVerification = {};
if(dataVerification != null){
for(let key in dataVerification){
let r = Number(key.split('_')[0]),
c = Number(key.split('_')[1]);
let item = dataVerification[key];
if(type == "row"){
if(r < st){
newDataVerification[r + "_" + c] = item;
}
else if(r > ed){
newDataVerification[(r - slen) + "_" + c] = item;
}
}
else if(type == "column"){
if(c < st){
newDataVerification[r + "_" + c] = item;
}
else if(c > ed){
newDataVerification[r + "_" + (c - slen)] = item;
}
}
}
}
//主逻辑
let type1;
if (type == "row") {
@ -1471,7 +1554,7 @@ function luckysheetdeletetable(type, st, ed, order) {
}
// 修改当前sheet页时刷新
if (curOrder == Store.currentSheetIndex) {
if (file.index == Store.currentSheetIndex) {
jfrefreshgrid_adRC(
d,
cfg,
@ -1481,17 +1564,29 @@ function luckysheetdeletetable(type, st, ed, order) {
newFilterObj,
newCFarr,
newAFarr,
newFreezen
newFreezen,
newDataVerification
);
}
else{
file.data = d;
file.config = cfg;
file.calcChain = newCalcChain;
file.filter = newFilterObj.filter;
file.filter_select = newFilterObj.filter_select;
file.luckysheet_conditionformat_save = newCFarr;
file.luckysheet_alternateformat_save = newAFarr;
file.dataVerification = newDataVerification;
}
}
//删除单元格
function luckysheetDeleteCell(type, str, edr, stc, edc, order) {
let d = editor.deepCopyFlowData(Store.flowdata);
let curOrder = order || getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[curOrder];
let d = $.extend(true, [], file.data);
let rlen = edr - str + 1;
let clen = edc - stc + 1;
let cfg = $.extend(true, {}, Store.config);
@ -1835,6 +1930,36 @@ function luckysheetDeleteCell(type, str, edr, stc, edc, order) {
}
}
//数据验证配置变动
let dataVerification = file.dataVerification;
let newDataVerification = {};
if(dataVerification != null){
for(let key in dataVerification){
let r = Number(key.split('_')[0]),
c = Number(key.split('_')[1]);
let item = dataVerification[key];
if(r < str || r > edr || c < stc || c > edc){
if(type == "moveLeft"){
if(c > edc && r >= str && r <= edr){
newDataVerification[r + "_" + (c - clen)] = item;
}
else{
newDataVerification[r + "_" + c] = item;
}
}
else if(type == "moveUp"){
if(r > edr && c >= stc && c <= edc){
newDataVerification[(r - rlen) + "_" + c] = item;
}
else{
newDataVerification[r + "_" + c] = item;
}
}
}
}
}
//边框配置变动
if(cfg["borderInfo"] && cfg["borderInfo"].length > 0){
let borderInfo = [];
@ -1948,14 +2073,26 @@ function luckysheetDeleteCell(type, str, edr, stc, edc, order) {
}
}
jfrefreshgrid_deleteCell(
d,
cfg,
{ type: type, 'str': str, 'edr': edr, 'stc': stc, 'edc': edc },
newCalcChain,
newFilterObj,
newCFarr
);
if(file.index == Store.currentSheetIndex){
jfrefreshgrid_deleteCell(
d,
cfg,
{ type: type, 'str': str, 'edr': edr, 'stc': stc, 'edc': edc },
newCalcChain,
newFilterObj,
newCFarr,
newDataVerification
);
}
else{
file.data = d;
file.config = cfg;
file.calcChain = newCalcChain;
file.filter = newFilterObj.filter;
file.filter_select = newFilterObj.filter_select;
file.luckysheet_conditionformat_save = newCFarr;
file.dataVerification = newDataVerification;
}
}
export {

4
src/global/formula.js

@ -1422,10 +1422,10 @@ const luckysheetformula = {
}
if(RowlChange){
jfrefreshgrid(d, [{ "row": [r, r], "column": [c, c] }], cfg, null, RowlChange, isRunExecFunction);
jfrefreshgrid(d, [{ "row": [r, r], "column": [c, c] }], cfg, null, RowlChange, null, isRunExecFunction);
}
else {
jfrefreshgrid(d, [{ "row": [r, r], "column": [c, c] }], undefined, undefined, undefined, isRunExecFunction);
jfrefreshgrid(d, [{ "row": [r, r], "column": [c, c] }], undefined, undefined, undefined, undefined, isRunExecFunction);
}
// Store.luckysheetCellUpdate.length = 0; //clear array

63
src/global/refresh.js

@ -13,12 +13,13 @@ import luckysheetFreezen from '../controllers/freezen';
import server from '../controllers/server';
import sheetmanage from '../controllers/sheetmanage';
import luckysheetPostil from '../controllers/postil';
import dataVerificationCtrl from '../controllers/dataVerificationCtrl';
import { selectHightlightShow, selectionCopyShow } from '../controllers/select';
import { createFilterOptions } from '../controllers/filter';
import { getSheetIndex } from '../methods/get';
import Store from '../store';
function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction=true, isRefreshCanvas=true) {
function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, dataVerification, isRunExecFunction=true, isRefreshCanvas=true) {
if(data == null){
data = Store.flowdata;
}
@ -58,6 +59,14 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction
else{
curCdformat = cdformat;
}
let curDataVerification;
if(dataVerification == null){
curDataVerification = $.extend(true, {}, Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"])
}
else{
curDataVerification = dataVerification;
}
Store.jfredo.push({
"type": "datachange",
@ -69,7 +78,9 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction
"curConfig": curConfig,
"cdformat": $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]),
"curCdformat": curCdformat,
"RowlChange": RowlChange
"RowlChange": RowlChange,
"dataVerification": $.extend(true, [], Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"]),
"curDataVerification": curDataVerification
});
}
@ -97,6 +108,13 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction
server.saveParam("all", Store.currentSheetIndex, cdformat, { "k": "luckysheet_conditionformat_save" });
}
//数据验证
if(dataVerification != null){
dataVerificationCtrl.dataVerification = dataVerification;
Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["dataVerification"] = dataVerification;
server.saveParam("all", Store.currentSheetIndex, dataVerification, { "k": "dataVerification" });
}
//更新数据的范围
for(let s = 0; s < range.length; s++){
let r1 = range[s].row[0];
@ -127,7 +145,6 @@ function jfrefreshgrid(data, range, cfg, cdformat, RowlChange, isRunExecFunction
luckysheetrefreshgrid();
}, 1);
}
window.luckysheet_getcelldata_cache = null;
}
@ -331,7 +348,7 @@ function jfrefreshrange(data, range, cdformat) {
}
//删除、增加行列 刷新表格
function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf, af, freezen){
function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf, af, freezen, dataVerification){
let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
//merge改变对应的单元格值改变
@ -397,7 +414,9 @@ function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf,
"af": $.extend(true, [], file.luckysheet_alternateformat_save),
"curAf": af,
"freezen": { "freezenhorizontaldata": luckysheetFreezen.freezenhorizontaldata, "freezenverticaldata": luckysheetFreezen.freezenverticaldata },
"curFreezen": freezen
"curFreezen": freezen,
"dataVerification": $.extend(true, {}, file.dataVerification),
"curDataVerification": dataVerification
});
}
@ -516,12 +535,17 @@ function jfrefreshgrid_adRC(data, cfg, ctrlType, ctrlValue, calc, filterObj, cf,
luckysheetFreezen.freezenverticaldata = null;
}
//数据验证
dataVerificationCtrl.dataVerification = dataVerification;
file.dataVerification = dataVerification;
server.saveParam("all", Store.currentSheetIndex, file.dataVerification, { "k": "dataVerification" });
//行高、列宽刷新
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
}
//删除单元格 刷新表格
function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf){
function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf, dataVerification){
let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
//merge改变对应的单元格值改变
@ -598,6 +622,8 @@ function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf){
"curFilterObj": filterObj,
"cf": $.extend(true, [], file.luckysheet_conditionformat_save),
"curCf": cf,
"dataVerification": $.extend(true, {}, file.dataVerification),
"curDataVerification": dataVerification
});
}
@ -671,6 +697,11 @@ function jfrefreshgrid_deleteCell(data, cfg, ctrl, calc, filterObj, cf){
file.luckysheet_conditionformat_save = cf;
server.saveParam("all", Store.currentSheetIndex, file.luckysheet_conditionformat_save, { "k": "luckysheet_conditionformat_save" });
//数据验证
dataVerificationCtrl.dataVerification = dataVerification;
file.dataVerification = dataVerification;
server.saveParam("all", Store.currentSheetIndex, file.dataVerification, { "k": "dataVerification" });
setTimeout(function () {
luckysheetrefreshgrid();
}, 1);
@ -795,6 +826,16 @@ function jfrefreshgrid_pastcut(source, target, RowlChange){
Store.luckysheetfile[getSheetIndex(source["sheetIndex"])].luckysheet_conditionformat_save = source["curCdformat"];
Store.luckysheetfile[getSheetIndex(target["sheetIndex"])].luckysheet_conditionformat_save = target["curCdformat"];
//数据验证
if(Store.currentSheetIndex == source["sheetIndex"]){
dataVerificationCtrl.dataVerification = source["curDataVerification"];
}
else if(Store.currentSheetIndex == target["sheetIndex"]){
dataVerificationCtrl.dataVerification = target["curDataVerification"]
}
Store.luckysheetfile[getSheetIndex(source["sheetIndex"])].dataVerification = source["curDataVerification"];
Store.luckysheetfile[getSheetIndex(target["sheetIndex"])].dataVerification = target["curDataVerification"];
setTimeout(function () {
luckysheetrefreshgrid();
}, 1);
@ -811,6 +852,16 @@ function jfrefreshgrid_pastcut(source, target, RowlChange){
server.historyParam(source["curData"], source["sheetIndex"], {"row": source["range"]["row"], "column": source["range"]["column"]});
//目的表
server.historyParam(target["curData"], target["sheetIndex"], {"row": target["range"]["row"], "column": target["range"]["column"]});
//来源表
server.saveParam("all", source["sheetIndex"], source["curCdformat"], { "k": "luckysheet_conditionformat_save" });
//目的表
server.saveParam("all", target["sheetIndex"], target["curCdformat"], { "k": "luckysheet_conditionformat_save" });
//来源表
server.saveParam("all", source["sheetIndex"], source["curDataVerification"], { "k": "dataVerification" });
//目的表
server.saveParam("all", target["sheetIndex"], target["curDataVerification"], { "k": "dataVerification" });
}
//行高、列宽改变 刷新表格

1
src/locale/en.js

@ -46,6 +46,7 @@ export default {
screenshot: 'Screenshot',
splitColumn: 'Split text',
insertImage: 'Insert image',
dataVerification: 'Data verification',
clearText:"Clear color",
noColorSelectedText:"No color is selected",

1
src/locale/zh.js

@ -46,6 +46,7 @@ export default {
screenshot: '截图',
splitColumn: '分列',
insertImage: '插入图片',
dataVerification: '数据验证',
clearText:"清除颜色选择",
noColorSelectedText:"没有颜色被选择",

Loading…
Cancel
Save