From fe26e5cdb7f71006b001ae528ff5cf5d7695b2fa Mon Sep 17 00:00:00 2001 From: zhangchen Date: Wed, 4 Nov 2020 23:38:35 +0800 Subject: [PATCH] rebuild: flatpickr and dayjs --- gulpfile.js | 7 +- package.json | 1 + src/controllers/cellDatePickerCtrl.js | 30 +- src/controllers/conditionformat.js | 631 ++- src/controllers/dropCell.js | 305 +- src/controllers/server.js | 13 +- src/function/functionImplementation.js | 3613 +++++++++-------- src/global/api.js | 530 +-- src/global/datecontroll.js | 9 +- src/global/func_methods.js | 83 +- src/plugins/css/daterangepicker.css | 421 -- src/plugins/js/moment-msdate.js | 97 - .../js/moment-timezone-with-data.min.js | 1 - src/plugins/js/moment.min.js | 7 - 14 files changed, 2609 insertions(+), 3139 deletions(-) delete mode 100644 src/plugins/css/daterangepicker.css delete mode 100644 src/plugins/js/moment-msdate.js delete mode 100644 src/plugins/js/moment-timezone-with-data.min.js delete mode 100644 src/plugins/js/moment.min.js diff --git a/gulpfile.js b/gulpfile.js index 2630845..f963ff7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -80,7 +80,7 @@ const paths = { //plugins src pluginsCss: ['src/plugins/css/*.css'], plugins: ['src/plugins/*.css'], - css:['src/css/*.css'], + css:['src/css/*.css','node_modules/flatpickr/dist/themes/light.css'], pluginsJs:[ 'node_modules/jquery/dist/jquery.min.js', //'src/plugins/js/jquery.min.js', @@ -88,12 +88,9 @@ const paths = { 'src/plugins/js/spectrum.min.js', 'src/plugins/js/jquery-ui.min.js', 'src/plugins/js/jquery.mousewheel.min.js', - 'src/plugins/js/moment.min.js', - 'src/plugins/js/moment-timezone-with-data.min.js', - 'src/plugins/js/moment-msdate.js', 'src/plugins/js/numeral.min.js', 'src/plugins/js/html2canvas.min.js', - //'src/plugins/js/pako.min.js', + 'src/plugins/js/pako.min.js', 'src/plugins/js/localforage.min.js', 'src/plugins/js/lodash.min.js', 'src/plugins/js/daterangepicker.js', diff --git a/package.json b/package.json index b057676..4409db5 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "dependencies": { "@babel/runtime": "^7.12.1", "dayjs": "^1.9.4", + "flatpickr": "^4.6.6", "jquery": "^3.5.1", "jspdf": "^2.1.1", "pako": "^1.0.11" diff --git a/src/controllers/cellDatePickerCtrl.js b/src/controllers/cellDatePickerCtrl.js index 4108933..f99f339 100644 --- a/src/controllers/cellDatePickerCtrl.js +++ b/src/controllers/cellDatePickerCtrl.js @@ -1,6 +1,9 @@ import menuButton from './menuButton'; import formula from '../global/formula'; import Store from '../store'; +import flatpickr from 'flatpickr' +import dayjs from "dayjs"; +import {Mandarin} from "flatpickr/dist/l10n/zh" const cellDatePickerCtrl = { cellFocus: function(r, c, value){ @@ -13,7 +16,7 @@ const cellDatePickerCtrl = { if(!!margeset){ row = margeset.row[1]; row_pre = margeset.row[0]; - + col = margeset.column[1]; col_pre = margeset.column[0]; } @@ -25,17 +28,24 @@ const cellDatePickerCtrl = { top: row_pre }) - $("#cellDatePickerBtn").daterangepicker({ - singleDatePicker: true, - startDate: moment(value), - endDate: moment(value) - }, function(start) { - $("#luckysheet-rich-text-editor").html(start.format('YYYY-MM-DD')); - formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]); - }) + flatpickr('#cellDatePickerBtn',{ + locale: Mandarin, + dateFormat: "YYYY-MM-DD", + parseDate: (datestr, format) => { + return dayjs(datestr).toDate(); + }, + formatDate: (date, format, locale) => { + return dayjs(date).format(format); + }, + onChange: function (selectedDates, dateStr, instance) { + console.log(selectedDates, dateStr) + $("#luckysheet-rich-text-editor").html(dateStr); + formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]); + } + }); $("#cellDatePickerBtn").click(); }, } -export default cellDatePickerCtrl; \ No newline at end of file +export default cellDatePickerCtrl; diff --git a/src/controllers/conditionformat.js b/src/controllers/conditionformat.js index f39db53..b40c1e1 100644 --- a/src/controllers/conditionformat.js +++ b/src/controllers/conditionformat.js @@ -13,6 +13,7 @@ import sheetmanage from './sheetmanage'; import locale from '../locale/locale'; import {checkProtectionFormatCells} from './protection'; import Store from '../store'; +import dayjs from 'dayjs' //条件格式 const conditionformat = { @@ -83,10 +84,10 @@ const conditionformat = { { "format": ["rgb(99, 190, 123)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"] }, //绿-白-红色阶 { "format": ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(99, 190, 123)"] }, //红-白-绿色阶 - + { "format": ["rgb(90, 138, 198)", "rgb(252, 252, 255)", "rgb(248, 105, 107)"] }, //蓝-白-红色阶 { "format": ["rgb(248, 105, 107)", "rgb(252, 252, 255)", "rgb(90, 138, 198)"] }, //红-白-蓝色阶 - + { "format": ["rgb(252, 252, 255)", "rgb(248, 105, 107)"] }, //白-红色阶 { "format": ["rgb(248, 105, 107)", "rgb(252, 252, 255)"] }, //红-白色阶 @@ -114,11 +115,11 @@ const conditionformat = { if(!checkProtectionFormatCells(Store.currentSheetIndex)){ return; } - + //保存之前的规则 let fileH = $.extend(true, [], Store.luckysheetfile); let historyRules = _this.getHistoryRules(fileH); - + //保存当前的规则 let fileClone = $.extend(true, [], _this.fileClone); for(let c = 0; c < fileClone.length; c++){ @@ -128,10 +129,10 @@ const conditionformat = { let fileC = $.extend(true, [], Store.luckysheetfile); let currentRules = _this.getCurrentRules(fileC); - + //刷新一次表格 _this.ref(historyRules, currentRules); - + //隐藏一些dom $("#luckysheet-modal-dialog-mask").hide(); $("#luckysheet-administerRule-dialog").hide(); @@ -171,28 +172,28 @@ const conditionformat = { let r1 = range[s].row[0], r2 = range[s].row[1]; let c1 = range[s].column[0], c2 = range[s].column[1]; - let row = Store.visibledatarow[r2], + let row = Store.visibledatarow[r2], row_pre = r1 - 1 == -1 ? 0 : Store.visibledatarow[r1 - 1]; - let col = Store.visibledatacolumn[c2], + let col = Store.visibledatacolumn[c2], col_pre = c1 - 1 == -1 ? 0 : Store.visibledatacolumn[c1 - 1]; - _this.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": [r1, r2], - "column": [c1, c2], - "row_focus": r1, - "column_focus": c1 + _this.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": [r1, r2], + "column": [c1, c2], + "row_focus": r1, + "column_focus": c1 }); } } - + selectionCopyShow(_this.selectRange); }); $(document).off("click.CFmultiRangeConfirm").on("click.CFmultiRangeConfirm", "#luckysheet-multiRange-dialog-confirm", function(){ @@ -204,7 +205,7 @@ const conditionformat = { let sheetIndex = $("#luckysheet-administerRule-dialog .chooseSheet option:selected").val(); _this.fileClone[getSheetIndex(sheetIndex)]["luckysheet_conditionformat_save"][dataItem].cellrange = _this.getRangeByTxt(v); - + $("#luckysheet-modal-dialog-mask").show(); $("#luckysheet-administerRule-dialog").show(); @@ -223,14 +224,14 @@ const conditionformat = { let range = []; selectionCopyShow(range); }); - + // 新建规则 $(document).off("click.CFnewConditionRule").on("click.CFnewConditionRule", "#newConditionRule", function(){ let sheetIndex = $("#luckysheet-administerRule-dialog .chooseSheet option:selected").val(); if(!checkProtectionFormatCells(sheetIndex)){ return; } - + if(Store.luckysheet_select_save.length == 0){ if(isEditMode()){ alert(conditionformat_Text.pleaseSelectRange); @@ -240,19 +241,19 @@ const conditionformat = { } return; } - + _this.newConditionRuleDialog(1); }); $(document).off("click.CFnewConditionRuleConfirm").on("click.CFnewConditionRuleConfirm", "#luckysheet-newConditionRule-dialog-confirm", function(){ - + if(!checkProtectionFormatCells(Store.currentSheetIndex)){ return; } - + let index = $("#luckysheet-newConditionRule-dialog .ruleTypeItem.on").index(); let type1 = $("#luckysheet-newConditionRule-dialog #type1 option:selected").val(); let type2 = $("#luckysheet-newConditionRule-dialog ." + type1 + "Box #type2 option:selected").val(); - + let format, rule; if(index == 0){ if(type1 == "dataBar"){ //数据条 @@ -266,8 +267,8 @@ const conditionformat = { } rule = { - "type": "dataBar", - "cellrange": $.extend(true, [], Store.luckysheet_select_save), + "type": "dataBar", + "cellrange": $.extend(true, [], Store.luckysheet_select_save), "format": format }; } @@ -284,8 +285,8 @@ const conditionformat = { } rule = { - "type": "colorGradation", - "cellrange": $.extend(true, [], Store.luckysheet_select_save), + "type": "colorGradation", + "cellrange": $.extend(true, [], Store.luckysheet_select_save), "format": format }; } @@ -295,14 +296,14 @@ const conditionformat = { let top = $(this).parents("#luckysheet-newConditionRule-dialog").find(".iconsBox .model").attr("data-top"); format = { - "len": len, + "len": len, "leftMin": leftMin, "top": top }; rule = { - "type": "icons", - "cellrange": $.extend(true, [], Store.luckysheet_select_save), + "type": "icons", + "cellrange": $.extend(true, [], Store.luckysheet_select_save), "format": format }; } @@ -330,7 +331,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v1 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr1[0].row, "column": rangeArr1[0].column }); conditionValue.push(v1); } @@ -360,7 +361,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v2 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr2[0].row, "column": rangeArr2[0].column }); conditionValue.push(v2); } @@ -395,7 +396,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr[0].row, "column": rangeArr[0].column }); conditionValue.push(v); } @@ -433,7 +434,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr[0].row, "column": rangeArr[0].column }); conditionValue.push(v); } @@ -462,7 +463,7 @@ const conditionformat = { _this.infoDialog(conditionformat_Text.pleaseSelectADate, ""); return; } - + conditionValue.push(v); } } @@ -492,7 +493,7 @@ const conditionformat = { _this.infoDialog(conditionformat_Text.pleaseEnterInteger, ""); return; } - + conditionValue.push(parseInt(v)); } else if(index == 3){ //平均值 @@ -516,44 +517,44 @@ const conditionformat = { textcolor = $("#luckysheet-newConditionRule-dialog #textcolorshow").spectrum("get").toHexString(); } else{ - textcolor = null; + textcolor = null; } - + let cellcolor; if($("#luckysheet-newConditionRule-dialog #checkCellColor").is(":checked")){ cellcolor = $("#luckysheet-newConditionRule-dialog #cellcolorshow").spectrum("get").toHexString(); } else{ - cellcolor = null; + cellcolor = null; } format = { - "textColor": textcolor, + "textColor": textcolor, "cellColor": cellcolor }; rule = { "type": "default", "cellrange": $.extend(true, [], Store.luckysheet_select_save), - "format": format, - "conditionName": conditionName, - "conditionRange": conditionRange, - "conditionValue": conditionValue + "format": format, + "conditionName": conditionName, + "conditionRange": conditionRange, + "conditionValue": conditionValue }; } $("#luckysheet-newConditionRule-dialog").hide(); - + //新建规则的入口 let source = $(this).attr("data-source"); - + if(source == 0){ $("#luckysheet-modal-dialog-mask").hide(); - + //保存之前的规则 let fileH = $.extend(true, [], Store.luckysheetfile); let historyRules = _this.getHistoryRules(fileH); - + //保存当前的规则 let ruleArr = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"] == undefined ? [] : Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]; ruleArr.push(rule); @@ -561,7 +562,7 @@ const conditionformat = { let fileC = $.extend(true, [], Store.luckysheetfile); let currentRules = _this.getCurrentRules(fileC); - + //刷新一次表格 _this.ref(historyRules, currentRules); @@ -575,7 +576,7 @@ const conditionformat = { let ruleArr = !!_this.fileClone[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"] ? _this.fileClone[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"] : []; ruleArr.push(rule); _this.fileClone[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"] = ruleArr; - + //新建规则隐藏,管理规则显示 _this.administerRuleDialog(); } @@ -589,25 +590,25 @@ const conditionformat = { if(source == 1){ $("#luckysheet-administerRule-dialog").show(); } - + //新建规则隐藏 $("#luckysheet-newConditionRule-dialog").hide(); - + //隐藏虚线框 $("#luckysheet-formula-functionrange-select").hide(); $("#luckysheet-row-count-show").hide(); - $("#luckysheet-column-count-show").hide(); + $("#luckysheet-column-count-show").hide(); }); - + // 编辑规则 $(document).off("click.CFeditorConditionRule").on("click.CFeditorConditionRule", "#editorConditionRule", function(){ let sheetIndex = $("#luckysheet-administerRule-dialog .chooseSheet option:selected").val(); - + if(!checkProtectionFormatCells(sheetIndex)){ return; } - + let itemIndex = $("#luckysheet-administerRule-dialog .ruleList .listBox .item.on").attr("data-item"); let rule = { @@ -624,7 +625,7 @@ const conditionformat = { let type2 = $("#luckysheet-editorConditionRule-dialog ." + type1 + "Box #type2 option:selected").val(); let cellrange = _this.editorRule["data"].cellrange; - + let format, rule; if(index == 0){ if(type1 == "dataBar"){ //数据条 @@ -638,8 +639,8 @@ const conditionformat = { } rule = { - "type": "dataBar", - "cellrange": cellrange, + "type": "dataBar", + "cellrange": cellrange, "format": format }; } @@ -656,8 +657,8 @@ const conditionformat = { } rule = { - "type": "colorGradation", - "cellrange": cellrange, + "type": "colorGradation", + "cellrange": cellrange, "format": format }; } @@ -667,14 +668,14 @@ const conditionformat = { let top = $(this).parents("#luckysheet-editorConditionRule-dialog").find(".iconsBox .model").attr("data-top"); format = { - "len": len, + "len": len, "leftMin": leftMin, "top": top }; rule = { - "type": "icons", - "cellrange": cellrange, + "type": "icons", + "cellrange": cellrange, "format": format }; } @@ -702,7 +703,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v1 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr1[0].row, "column": rangeArr1[0].column }); conditionValue.push(v1); } @@ -732,7 +733,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v2 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr2[0].row, "column": rangeArr2[0].column }); conditionValue.push(v2); } @@ -767,7 +768,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr[0].row, "column": rangeArr[0].column }); conditionValue.push(v); } @@ -805,7 +806,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr[0].row, "column": rangeArr[0].column }); conditionValue.push(v); } @@ -834,7 +835,7 @@ const conditionformat = { _this.infoDialog(conditionformat_Text.pleaseSelectADate, ""); return; } - + conditionValue.push(v); } } @@ -864,7 +865,7 @@ const conditionformat = { _this.infoDialog(conditionformat_Text.pleaseEnterInteger, ""); return; } - + conditionValue.push(v); } else if(index == 3){ //平均值 @@ -888,29 +889,29 @@ const conditionformat = { textcolor = $("#luckysheet-editorConditionRule-dialog #textcolorshow").spectrum("get").toHexString(); } else{ - textcolor = null; + textcolor = null; } - + let cellcolor; if($("#luckysheet-editorConditionRule-dialog #checkCellColor").is(":checked")){ cellcolor = $("#luckysheet-editorConditionRule-dialog #cellcolorshow").spectrum("get").toHexString(); } else{ - cellcolor = null; + cellcolor = null; } format = { - "textColor": textcolor, + "textColor": textcolor, "cellColor": cellcolor }; rule = { "type": "default", "cellrange": cellrange, - "format": format, - "conditionName": conditionName, - "conditionRange": conditionRange, - "conditionValue": conditionValue + "format": format, + "conditionName": conditionName, + "conditionRange": conditionRange, + "conditionValue": conditionValue }; } @@ -918,7 +919,7 @@ const conditionformat = { let sheetIndex = _this.editorRule["sheetIndex"]; let itemIndex = _this.editorRule["itemIndex"]; _this.fileClone[getSheetIndex(sheetIndex)]["luckysheet_conditionformat_save"][itemIndex] = rule; - + //编辑规则隐藏,管理规则显示 $("#luckysheet-editorConditionRule-dialog").hide(); _this.administerRuleDialog(); @@ -936,7 +937,7 @@ const conditionformat = { // 新建规则、编辑规则 类型切换 $(document).off("click.CFnewEditorRuleItem").on("click.CFnewEditorRuleItem", ".luckysheet-newEditorRule-dialog .ruleTypeItem", function(){ $(this).addClass("on").siblings().removeClass("on"); - + let index = $(this).index(); $(this).parents(".luckysheet-newEditorRule-dialog").find(".ruleExplainBox").html(_this.getRuleExplain(index)); @@ -956,7 +957,7 @@ const conditionformat = { $(document).off("change.CFnewEditorRuleType2").on("change.CFnewEditorRuleType2", ".luckysheet-newEditorRule-dialog #type2", function(){ let type1 = $(this).parents(".luckysheet-newEditorRule-dialog").find("#type1 option:selected").val(); - if(type1 == "colorGradation"){ + if(type1 == "colorGradation"){ let type2 = $(this).find("option:selected").val(); if(type2 == "threeColor"){ @@ -1001,34 +1002,34 @@ const conditionformat = { // 删除规则 $(document).off("click.CFdeleteConditionRule").on("click.CFdeleteConditionRule", "#deleteConditionRule", function(){ let sheetIndex = $("#luckysheet-administerRule-dialog .chooseSheet option:selected").val(); - + if(!checkProtectionFormatCells(sheetIndex)){ return; } - + let itemIndex = $("#luckysheet-administerRule-dialog .ruleList .listBox .item.on").attr("data-item"); _this.fileClone[getSheetIndex(sheetIndex)]["luckysheet_conditionformat_save"].splice(itemIndex, 1); _this.administerRuleDialog(); }); - + // 规则子菜单弹出层 点击确定修改样式 $(document).off("click.CFdefault").on("click.CFdefault", "#luckysheet-conditionformat-dialog-confirm", function(){ - + if(!checkProtectionFormatCells(Store.currentSheetIndex)){ return; } - + //条件名称 let conditionName = $("#luckysheet-conditionformat-dialog .box").attr("data-itemvalue"); - + //条件单元格 let conditionRange = []; - + //条件值 let conditionValue = []; if(conditionName == "greaterThan" || conditionName == "lessThan" || conditionName == "equal" || conditionName == "textContains"){ let v = $("#luckysheet-conditionformat-dialog #conditionVal").val().trim(); - + //条件值是否是选区 let rangeArr = _this.getRangeByTxt(v); if(rangeArr.length > 1){ @@ -1041,7 +1042,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr[0].row, "column": rangeArr[0].column }); conditionValue.push(v); } @@ -1076,7 +1077,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v1 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr1[0].row, "column": rangeArr1[0].column }); conditionValue.push(v1); } @@ -1106,7 +1107,7 @@ const conditionformat = { if(r1 == r2 && c1 == c2){ v2 = getcellvalue(r1, c1, Store.flowdata); - + conditionRange.push({ "row": rangeArr2[0].row, "column": rangeArr2[0].column }); conditionValue.push(v2); } @@ -1161,7 +1162,7 @@ const conditionformat = { textcolor = $("#textcolorshow").spectrum("get").toHexString(); } else{ - textcolor = null; + textcolor = null; } let cellcolor; @@ -1169,24 +1170,24 @@ const conditionformat = { cellcolor = $("#cellcolorshow").spectrum("get").toHexString(); } else{ - cellcolor = null; + cellcolor = null; } //保存之前的规则 let fileH = $.extend(true, [], Store.luckysheetfile); let historyRules = _this.getHistoryRules(fileH); - + //保存当前的规则 let rule = { "type": "default", "cellrange": $.extend(true, [], Store.luckysheet_select_save), "format": { - "textColor": textcolor, + "textColor": textcolor, "cellColor": cellcolor - }, - "conditionName": conditionName, - "conditionRange": conditionRange, - "conditionValue": conditionValue + }, + "conditionName": conditionName, + "conditionRange": conditionRange, + "conditionValue": conditionValue }; let ruleArr = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"] == undefined ? [] : Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["luckysheet_conditionformat_save"]; ruleArr.push(rule); @@ -1194,10 +1195,10 @@ const conditionformat = { let fileC = $.extend(true, [], Store.luckysheetfile); let currentRules = _this.getCurrentRules(fileC); - + //刷新一次表格 _this.ref(historyRules, currentRules); - + //隐藏一些dom $("#luckysheet-modal-dialog-mask").hide(); $("#luckysheet-conditionformat-dialog").hide(); @@ -1207,7 +1208,7 @@ const conditionformat = { server.saveParam("all", Store.currentSheetIndex, ruleArr, { "k": "luckysheet_conditionformat_save" }); } }); - + // 图标集弹出层 选择 $(document).off("click.CFicons").on("click.CFicons", "#luckysheet-CFicons-dialog .item", function(){ $("#luckysheet-modal-dialog-mask").hide(); @@ -1216,7 +1217,7 @@ const conditionformat = { if(Store.luckysheet_select_save.length > 0){ let cellrange = $.extend(true, [], Store.luckysheet_select_save); let format = { - "len": $(this).attr("data-len"), + "len": $(this).attr("data-len"), "leftMin": $(this).attr("data-leftMin"), "top": $(this).attr("data-top") } @@ -1224,7 +1225,7 @@ const conditionformat = { _this.updateItem("icons", cellrange, format); } }); - + // 选择单元格 $(document).on("click", ".range .fa-table", function(){ let id = $(this).parents(".luckysheet-modal-dialog").attr("id"); @@ -1236,12 +1237,12 @@ const conditionformat = { source = "0_1"; } else{ - source = "0_2"; + source = "0_2"; } } else if(id == "luckysheet-newConditionRule-dialog"){ if($(this).parents(".range").attr("id") == "conditionVal"){ - source = "1_1"; + source = "1_1"; } else{ source = "1_2"; @@ -1249,7 +1250,7 @@ const conditionformat = { } else if(id == "luckysheet-editorConditionRule-dialog"){ if($(this).parents(".range").attr("id") == "conditionVal"){ - source = "2_1"; + source = "2_1"; } else{ source = "2_2"; @@ -1267,7 +1268,7 @@ const conditionformat = { let source = $(this).attr("data-source"); let v = $(this).parents("#luckysheet-singleRange-dialog").find("input").val(); - + if(source == "0_1"){ $("#luckysheet-conditionformat-dialog").show(); $("#luckysheet-conditionformat-dialog #conditionVal").val(v); @@ -1314,11 +1315,11 @@ const conditionformat = { let range = []; selectionCopyShow(range); }); - + // 弹出层右上角关闭按钮 $(document).on("click", ".luckysheet-modal-dialog-title-close", function(){ let id = $(this).parents(".luckysheet-modal-dialog").attr("id"); - + //新建规则弹出层 if(id == "luckysheet-newConditionRule-dialog"){ let source = $("#" + id).find("#luckysheet-newConditionRule-dialog-close").attr("data-source"); @@ -1327,7 +1328,7 @@ const conditionformat = { $("#luckysheet-administerRule-dialog").show(); } } - + //编辑规则弹出层 if(id == "luckysheet-editorConditionRule-dialog"){ $("#luckysheet-administerRule-dialog").show(); @@ -1379,26 +1380,26 @@ const conditionformat = { const conditionformat_Text = locale().conditionformat; - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-singleRange-dialog", - "addclass": "luckysheet-singleRange-dialog", - "title": conditionformat_Text.selectCell, - "content": ``, + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-singleRange-dialog", + "addclass": "luckysheet-singleRange-dialog", + "title": conditionformat_Text.selectCell, + "content": ``, "botton": ` - `, - "style": "z-index:100003" + `, + "style": "z-index:100003" })); let $t = $("#luckysheet-singleRange-dialog") .find(".luckysheet-modal-dialog-content") .css("min-width", 300) - .end(), - myh = $t.outerHeight(), + .end(), + myh = $t.outerHeight(), myw = $t.outerWidth(); let winw = $(window).width(), winh = $(window).height(); let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-singleRange-dialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 + $("#luckysheet-singleRange-dialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 }).show(); }, multiRangeDialog: function(dataItem, value){ @@ -1409,26 +1410,26 @@ const conditionformat = { const conditionformat_Text = locale().conditionformat; - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-multiRange-dialog", - "addclass": "luckysheet-multiRange-dialog", - "title": conditionformat_Text.selectRange, - "content": ``, + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-multiRange-dialog", + "addclass": "luckysheet-multiRange-dialog", + "title": conditionformat_Text.selectRange, + "content": ``, "botton": ` - `, - "style": "z-index:100003" + `, + "style": "z-index:100003" })); let $t = $("#luckysheet-multiRange-dialog") .find(".luckysheet-modal-dialog-content") .css("min-width", 300) - .end(), - myh = $t.outerHeight(), + .end(), + myh = $t.outerHeight(), myw = $t.outerWidth(); let winw = $(window).width(), winh = $(window).height(); let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-multiRange-dialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 + $("#luckysheet-multiRange-dialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 }).show(); selectionCopyShow(_this.getRangeByTxt(value)); @@ -1440,7 +1441,7 @@ const conditionformat = { for(let s = 0; s < range.length; s++){ let r1 = range[s].row[0], r2 = range[s].row[1]; let c1 = range[s].column[0], c2 = range[s].column[1]; - + txt.push(getRangetxt(Store.currentSheetIndex, { "row": [r1, r2], "column": [c1, c2] }, Store.currentSheetIndex)); } @@ -1460,7 +1461,7 @@ const conditionformat = { } else{ range = []; - break; + break; } } } @@ -1520,31 +1521,31 @@ const conditionformat = { const conditionformat_Text = locale().conditionformat; - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-conditionformat-dialog", - "addclass": "luckysheet-conditionformat-dialog", - "title": title, - "content": content, + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-conditionformat-dialog", + "addclass": "luckysheet-conditionformat-dialog", + "title": title, + "content": content, "botton": ` - `, - "style": "z-index:100003" + `, + "style": "z-index:100003" })); let $t = $("#luckysheet-conditionformat-dialog") .find(".luckysheet-modal-dialog-content") .css("min-width", 300) - .end(), - myh = $t.outerHeight(), + .end(), + myh = $t.outerHeight(), myw = $t.outerWidth(); let winw = $(window).width(), winh = $(window).height(); let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-conditionformat-dialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 + $("#luckysheet-conditionformat-dialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 }).show(); - + _this.init(); _this.colorSelectInit(); - + if(title == locale().conditionformat.conditionformat_occurrenceDate){ _this.daterangeInit("luckysheet-conditionformat-dialog"); } @@ -1611,25 +1612,25 @@ const conditionformat = { `; - $("body").append(replaceHtml(modelHTML, { - "id": "luckysheet-CFicons-dialog", - "addclass": "luckysheet-CFicons-dialog", - "title": conditionformat_Text.icons, - "content": content, - "botton": ``, - "style": "z-index:100003" + $("body").append(replaceHtml(modelHTML, { + "id": "luckysheet-CFicons-dialog", + "addclass": "luckysheet-CFicons-dialog", + "title": conditionformat_Text.icons, + "content": content, + "botton": ``, + "style": "z-index:100003" })); let $t = $("#luckysheet-CFicons-dialog") .find(".luckysheet-modal-dialog-content") .css("min-width", 400) - .end(), - myh = $t.outerHeight(), + .end(), + myh = $t.outerHeight(), myw = $t.outerWidth(); let winw = $(window).width(), winh = $(window).height(); let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop(); - $("#luckysheet-CFicons-dialog").css({ - "left": (winw + scrollLeft - myw) / 2, - "top": (winh + scrollTop - myh) / 3 + $("#luckysheet-CFicons-dialog").css({ + "left": (winw + scrollLeft - myw) / 2, + "top": (winh + scrollTop - myh) / 3 }).show(); }, administerRuleDialog: function(){ @@ -1637,9 +1638,9 @@ const conditionformat = { $("#luckysheet-administerRule-dialog").remove(); const conditionformat_Text = locale().conditionformat; - + //工作表 - let opHtml = ''; + let opHtml = ''; for(let j = 0; j < Store.luckysheetfile.length; j++){ if(Store.luckysheetfile[j].status == "1"){ opHtml += `