Kaynağa Gözat

粘贴时只粘贴单元格信息

wangming 10 ay önce
ebeveyn
işleme
1e39567b1c
1 değiştirilmiş dosya ile 124 ekleme ve 123 silme
  1. 124 123
      src/controllers/selection.js

+ 124 - 123
src/controllers/selection.js

@@ -622,7 +622,6 @@ const selection = {
         }, 10);
     },
     pasteHandler: function (data, borderInfo) {
-
         if(!checkProtectionLockedRangeList(Store.luckysheet_select_save, Store.currentSheetIndex)){
             return;
         }
@@ -1447,60 +1446,60 @@ const selection = {
                     let x = [].concat(d[h]);
 
                     for (let c = mtc; c < maxcellCahe; c++) {
-                        if(borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
-                            let bd_obj = {
-                                "rangeType": "cell",
-                                "value": {
-                                    "row_index": h,
-                                    "col_index": c,
-                                    "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
-                                }
-                            }
-
-                            if(cfg["borderInfo"] == null){
-                                cfg["borderInfo"] = [];
-                            }
-
-                            cfg["borderInfo"].push(bd_obj);
-                        }
-                        else if(borderInfoCompute[h + "_" + c]){
-                            let bd_obj = {
-                                "rangeType": "cell",
-                                "value": {
-                                    "row_index": h,
-                                    "col_index": c,
-                                    "l": null,
-                                    "r": null,
-                                    "t": null,
-                                    "b": null
-                                }
-                            }
-
-                            if(cfg["borderInfo"] == null){
-                                cfg["borderInfo"] = [];
-                            }
-
-                            cfg["borderInfo"].push(bd_obj);
-                        }
+                        // if(borderInfoCompute[(c_r1 + h - mth) + "_" + (c_c1 + c - mtc)]){
+                        //     let bd_obj = {
+                        //         "rangeType": "cell",
+                        //         "value": {
+                        //             "row_index": h,
+                        //             "col_index": c,
+                        //             "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
+                        //         }
+                        //     }
+                        //
+                        //     if(cfg["borderInfo"] == null){
+                        //         cfg["borderInfo"] = [];
+                        //     }
+                        //
+                        //     cfg["borderInfo"].push(bd_obj);
+                        // }
+                        // else if(borderInfoCompute[h + "_" + c]){
+                        //     let bd_obj = {
+                        //         "rangeType": "cell",
+                        //         "value": {
+                        //             "row_index": h,
+                        //             "col_index": c,
+                        //             "l": null,
+                        //             "r": null,
+                        //             "t": null,
+                        //             "b": null
+                        //         }
+                        //     }
+                        //
+                        //     if(cfg["borderInfo"] == null){
+                        //         cfg["borderInfo"] = [];
+                        //     }
+                        //
+                        //     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];
-                            }
-                            delete x[c].mc;
-                        }
+                        // 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];
+                        //     }
+                        //     delete x[c].mc;
+                        // }
 
                         let value = null;
                         if (copyData[h - mth] != null && copyData[h - mth][c - mtc] != null) {
@@ -1545,19 +1544,19 @@ const selection = {
 
                         x[c] = $.extend(true, {}, value);
 
-                        if(value != null && copyHasMC && ("mc" in x[c])){
-                            if(x[c]["mc"].rs != null){
-                                x[c]["mc"].r = h;
-                                x[c]["mc"].c = c;
-
-                                cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
-
-                                offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
-                            }
-                            else{
-                                x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
-                            }
-                        }
+                        // if(value != null && copyHasMC && ("mc" in x[c])){
+                        //     if(x[c]["mc"].rs != null){
+                        //         x[c]["mc"].r = h;
+                        //         x[c]["mc"].c = c;
+                        //
+                        //         cfg["merge"][x[c]["mc"].r + "_" + x[c]["mc"].c] = x[c]["mc"];
+                        //
+                        //         offsetMC[value["mc"].r + "_" + value["mc"].c] = [x[c]["mc"].r, x[c]["mc"].c];
+                        //     }
+                        //     else{
+                        //         x[c] = { "mc": { r: offsetMC[value["mc"].r + "_" + value["mc"].c][0], c: offsetMC[value["mc"].r + "_" + value["mc"].c][1] } }
+                        //     }
+                        // }
                     }
 
                     d[h] = x;
@@ -1567,71 +1566,73 @@ const selection = {
 
         //复制范围 是否有 条件格式和数据验证
         let cdformat = null;
-        if(copyRange["copyRange"].length == 1){
-            let c_file = Store.luckysheetfile[getSheetIndex(copySheetIndex)];
-            let a_file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
-
-            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;
-
-                    let emptyRange = [];
-
-                    for(let th = 1; th <= timesH; th++){
-                        for(let tc = 1; tc <= timesC; tc++){
-                            mth = minh + (th - 1) * copyh;
-                            mtc = minc + (tc - 1) * copyc;
-                            maxrowCache = minh + th * copyh;
-                            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"
-                                );
-
-                                if(range.length > 0){
-                                    emptyRange = emptyRange.concat(range);
-                                }
-                            }
-                        }
-                    }
-
-                    if(emptyRange.length > 0){
-                        ruleArr_cf[i].cellrange = emptyRange;
-                        cdformat.push(ruleArr_cf[i]);
-                    }
-                }
-            }
-        }
+        // if(copyRange["copyRange"].length == 1){
+        //     let c_file = Store.luckysheetfile[getSheetIndex(copySheetIndex)];
+        //     let a_file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
+        //
+        //     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;
+        //
+        //             let emptyRange = [];
+        //
+        //             for(let th = 1; th <= timesH; th++){
+        //                 for(let tc = 1; tc <= timesC; tc++){
+        //                     mth = minh + (th - 1) * copyh;
+        //                     mtc = minc + (tc - 1) * copyc;
+        //                     maxrowCache = minh + th * copyh;
+        //                     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"
+        //                         );
+        //
+        //                         if(range.length > 0){
+        //                             emptyRange = emptyRange.concat(range);
+        //                         }
+        //                     }
+        //                 }
+        //             }
+        //
+        //             if(emptyRange.length > 0){
+        //                 ruleArr_cf[i].cellrange = emptyRange;
+        //                 cdformat.push(ruleArr_cf[i]);
+        //             }
+        //         }
+        //     }
+        // }
 
         last["row"] = [minh, maxh];
         last["column"] = [minc, maxc];
 
         if(copyRowlChange || addr > 0 || addc > 0){
-            cfg = rowlenByRange(d, minh, maxh, cfg);
+            // cfg = rowlenByRange(d, minh, maxh, cfg);
 
-            let allParam = {
-                "cfg": cfg,
-                "RowlChange": true,
-                "cdformat": cdformat,
-                "dataVerification": dataVerification
-            }
-            jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
+            // let allParam = {
+            //     "cfg": cfg,
+            //     "RowlChange": true,
+            //     "cdformat": cdformat,
+            //     "dataVerification": dataVerification
+            // }
+            // jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
+            jfrefreshgrid(d, Store.luckysheet_select_save);
         }
         else{
-            let allParam = {
-                "cfg": cfg,
-                "cdformat": cdformat,
-                "dataVerification": dataVerification
-            }
-            jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
+            // let allParam = {
+            //     "cfg": cfg,
+            //     "cdformat": cdformat,
+            //     "dataVerification": dataVerification
+            // }
+            // jfrefreshgrid(d, Store.luckysheet_select_save, allParam);
+            jfrefreshgrid(d, Store.luckysheet_select_save);
 
             selectHightlightShow();
         }