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

Commit

Permalink
Browse files Browse the repository at this point in the history
Dushusir committed Oct 16, 2020
2 parents 464a4ab + 1337178 commit 9b0fcfd
Showing 9 changed files with 85 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/controllers/dataVerificationCtrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { replaceHtml } from '../utils/util';
import formula from '../global/formula';
import { isRealNum } from '../global/validate';
import { isRealNum, isRealNull } from '../global/validate';
import { isdatetime, diff } from '../global/datecontroll';
import { luckysheetrefreshgrid } from '../global/refresh';
import tooltip from '../global/tooltip';
@@ -1020,7 +1020,7 @@ const dataVerificationCtrl = {
//数据验证未通过
let cellValue = getcellvalue(r, c, null);

if(cellValue == null || cellValue == ""){
if(isRealNull(cellValue)){
return;
}

9 changes: 6 additions & 3 deletions src/controllers/formulaBar.js
Original file line number Diff line number Diff line change
@@ -59,13 +59,16 @@ export function formulaBarInitial(){
formula.updatecell(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1]);
Store.luckysheet_select_save = [{ "row": [Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[0]], "column": [Store.luckysheetCellUpdate[1], Store.luckysheetCellUpdate[1]], "row_focus": Store.luckysheetCellUpdate[0], "column_focus": Store.luckysheetCellUpdate[1] }];
luckysheetMoveHighlightCell("down", 1, "rangeOfSelect");
$("#luckysheet-functionbox-cell").blur();
//$("#luckysheet-functionbox-cell").blur();
$("#luckysheet-rich-text-editor").focus();
}
event.preventDefault();
}
else if (kcode == keycode.ESC && parseInt($inputbox.css("top")) > 0) {
formula.dontupdate();
luckysheetMoveHighlightCell("down", 0, "rangeOfSelect");
//$("#luckysheet-functionbox-cell").blur();
$("#luckysheet-rich-text-editor").focus();
event.preventDefault();
}
else if (kcode == keycode.F4 && parseInt($inputbox.css("top")) > 0) {
@@ -224,11 +227,11 @@ export function formulaBarInitial(){
event.stopPropagation();
});

$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-highlight", function (e) {
$("#luckysheet-formula-functionrange").on("mousedown", ".luckysheet-highlight", function (event) {
formula.rangeResize = $(this).data("type");//开始状态resize
formula.rangeResizeIndex = $(this).parent().attr("rangeindex");

let mouse = mouseposition(e.pageX, e.pageY),
let mouse = mouseposition(event.pageX, event.pageY),
scrollLeft = $("#luckysheet-cell-main").scrollLeft(),
scrollTop = $("#luckysheet-cell-main").scrollTop();
let x = mouse[0] + scrollLeft;
70 changes: 36 additions & 34 deletions src/controllers/imageCtrl.js
Original file line number Diff line number Diff line change
@@ -97,17 +97,19 @@ const imageCtrl = {
let src = imgItem.src;
let imgItemParam = _this.getImgItemParam(imgItem);

let width = imgItemParam.width;
let height = imgItemParam.height;
let left = imgItemParam.left;
let top = imgItemParam.top;
let width = imgItemParam.width*Store.zoomRatio;
let height = imgItemParam.height*Store.zoomRatio;
let left = imgItemParam.left*Store.zoomRatio;
let top = imgItemParam.top*Store.zoomRatio;
let position = imgItemParam.position;

let borderWidth = imgItem.border.width;

return `<div id="${id}" class="luckysheet-modal-dialog luckysheet-modal-dialog-image" style="width:${width}px;height:${height}px;padding:0;position:${position};left:${left}px;top:${top}px;z-index:200;">
<div class="luckysheet-modal-dialog-content" style="width:100%;height:100%;overflow:hidden;position:relative;">
<img src="${src}" style="position:absolute;width:${imgItem.default.width}px;height:${imgItem.default.height}px;left:${-imgItem.crop.offsetLeft}px;top:${-imgItem.crop.offsetTop}px;" />
<img src="${src}" style="position:absolute;width:${imgItem.default.width*Store.zoomRatio}px;height:${imgItem.default.height*Store.zoomRatio}px;left:${-imgItem.crop.offsetLeft*Store.zoomRatio}px;top:${-imgItem.crop.offsetTop*Store.zoomRatio}px;" />
</div>
<div class="luckysheet-modal-dialog-border" style="border:${imgItem.border.width}px ${imgItem.border.style} ${imgItem.border.color};border-radius:${imgItem.border.radius}px;position:absolute;left:${-imgItem.border.width}px;right:${-imgItem.border.width}px;top:${-imgItem.border.width}px;bottom:${-imgItem.border.width}px;"></div>
<div class="luckysheet-modal-dialog-border" style="border:${borderWidth}px ${imgItem.border.style} ${imgItem.border.color};border-radius:${imgItem.border.radius*Store.zoomRatio}px;position:absolute;left:${-borderWidth}px;right:${-borderWidth}px;top:${-borderWidth}px;bottom:${-borderWidth}px;"></div>
</div>`;
},
getSliderHtml: function() {
@@ -352,10 +354,10 @@ const imageCtrl = {
let item = _this.images[id];
let imgItemParam = _this.getImgItemParam(item);

let width = imgItemParam.width;
let height = imgItemParam.height;
let left = imgItemParam.left;
let top = imgItemParam.top;
let width = imgItemParam.width*Store.zoomRatio;
let height = imgItemParam.height*Store.zoomRatio;
let left = imgItemParam.left*Store.zoomRatio;
let top = imgItemParam.top*Store.zoomRatio;
let position = imgItemParam.position;

$("#luckysheet-modal-dialog-activeImage").show().css({
@@ -368,19 +370,19 @@ const imageCtrl = {

$("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
"background-image": "url(" + item.src + ")",
"background-size": item.default.width + "px " + item.default.height + "px",
"background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
"background-size": item.default.width*Store.zoomRatio + "px " + item.default.height*Store.zoomRatio + "px",
"background-position": -item.crop.offsetLeft*Store.zoomRatio + "px " + -item.crop.offsetTop*Store.zoomRatio + "px"
})

$("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({
"border-width": item.border.width,
"border-width": item.border.width*Store.zoomRatio,
"border-style": item.border.style,
"border-color": item.border.color,
"border-radius": item.border.radius,
"left": -item.border.width,
"right": -item.border.width,
"top": -item.border.width,
"bottom": -item.border.width,
"border-radius": item.border.radius*Store.zoomRatio,
"left": -item.border.width*Store.zoomRatio,
"right": -item.border.width*Store.zoomRatio,
"top": -item.border.width*Store.zoomRatio,
"bottom": -item.border.width*Store.zoomRatio,
})

_this.sliderHtmlShow();
@@ -589,10 +591,10 @@ const imageCtrl = {
let imgItem = _this.images[_this.currentImgId];
let imgItemParam = _this.getImgItemParam(imgItem);

let width = imgItemParam.width;
let height = imgItemParam.height;
let left = imgItemParam.left;
let top = imgItemParam.top;
let width = imgItemParam.width*Store.zoomRatio;
let height = imgItemParam.height*Store.zoomRatio;
let left = imgItemParam.left*Store.zoomRatio;
let top = imgItemParam.top*Store.zoomRatio;
let position = imgItemParam.position;

$("#" + _this.currentImgId).show().css({
@@ -603,20 +605,20 @@ const imageCtrl = {
"position": position
});
$("#" + _this.currentImgId + " img").css({
"width": imgItem.default.width,
"height": imgItem.default.height,
"left": -imgItem.crop.offsetLeft,
"top": -imgItem.crop.offsetTop
"width": imgItem.default.width*Store.zoomRatio,
"height": imgItem.default.height*Store.zoomRatio,
"left": -imgItem.crop.offsetLeft*Store.zoomRatio,
"top": -imgItem.crop.offsetTop*Store.zoomRatio
});
$("#" + _this.currentImgId + " .luckysheet-modal-dialog-border").css({
"border-width": imgItem.border.width,
"border-width": imgItem.border.width*Store.zoomRatio,
"border-style": imgItem.border.style,
"border-color": imgItem.border.color,
"border-radius": imgItem.border.radius,
"left": -imgItem.border.width,
"right": -imgItem.border.width,
"top": -imgItem.border.width,
"bottom": -imgItem.border.width,
"border-radius": imgItem.border.radius*Store.zoomRatio,
"left": -imgItem.border.width*Store.zoomRatio,
"right": -imgItem.border.width*Store.zoomRatio,
"top": -imgItem.border.width*Store.zoomRatio,
"bottom": -imgItem.border.width*Store.zoomRatio,
})

_this.currentImgId = null;
@@ -955,7 +957,7 @@ const imageCtrl = {
imgItem.default.top = imgItemParam.top + changeSize - imgItem.crop.offsetTop;
}
else{
if(imgItemParam.top + imgItemParam.height > row){
if(imgItemParam.top + imgItemParam.height >= row-2){
if(imgItemParam.top < row + changeSize){
let scaleY = (imgItemParam.height + changeSize) / imgItemParam.height;
imgItem.default.height = Math.round(imgItem.default.height * scaleY);
@@ -1012,7 +1014,7 @@ const imageCtrl = {
imgItem.default.left = imgItemParam.left + changeSize - imgItem.crop.offsetLeft;
}
else{
if(imgItemParam.left + imgItemParam.width > col){
if(imgItemParam.left + imgItemParam.width >= col-2){
if(imgItemParam.left < col + changeSize){
let scaleX = (imgItemParam.width + changeSize) / imgItemParam.width;
imgItem.default.width = Math.round(imgItem.default.width * scaleX);
5 changes: 3 additions & 2 deletions src/controllers/print.js
Original file line number Diff line number Diff line change
@@ -20,10 +20,11 @@ let ExcelPlaceholder = {
// Get the pixel value per millimeter
function getOneMmsPx (){
let div = document.createElement("div");
div.id = "mm";
div.style.width = "1mm";
document.querySelector("body").appendChild(div);
let mm1 = document.getElementById("mm").getBoundingClientRect();
let mm1 = div.getBoundingClientRect();
let w = mm1.width;
$(div).remove();
return mm1.width;
}

35 changes: 13 additions & 22 deletions src/controllers/select.js
Original file line number Diff line number Diff line change
@@ -80,19 +80,10 @@ function selectHightlightShow(isRestore=false) {
Store.luckysheet_select_save[i]["top"] = row_pre_f;
Store.luckysheet_select_save[i]["height"] = row_f - row_pre_f - 1;

if(isRestore){
Store.luckysheet_select_save[i]["left_move"] = col_pre_f;
Store.luckysheet_select_save[i]["width_move"] = col_f - col_pre_f - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre_f;
Store.luckysheet_select_save[i]["height_move"] = row_f - row_pre_f - 1;
}
else{

Store.luckysheet_select_save[i]["left_move"] = col_pre;
Store.luckysheet_select_save[i]["width_move"] = col - col_pre - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre;
Store.luckysheet_select_save[i]["height_move"] = row - row_pre - 1;
}
Store.luckysheet_select_save[i]["left_move"] = col_pre;
Store.luckysheet_select_save[i]["width_move"] = col - col_pre - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre;
Store.luckysheet_select_save[i]["height_move"] = row - row_pre - 1;

if(i == 0){
if(Store.luckysheet_select_save.length == 1){
@@ -201,16 +192,16 @@ function selectTitlesShow(rangeArr,isRestore=false) {
for(let i = 0; i < s.length; i++){
let r1 = s[i]["row"][0], r2 = s[i]["row"][1], c1 = s[i]["column"][0], c2 = s[i]["column"][1];

if(isRestore){
let margeset = menuButton.mergeborer(Store.flowdata, r1, c1);
if(!!margeset){
r1 = margeset.row[2];
r2 = margeset.row[3];
// if(isRestore){
// let margeset = menuButton.mergeborer(Store.flowdata, r1, c1);
// if(!!margeset){
// r1 = margeset.row[2];
// r2 = margeset.row[3];

c1 = margeset.column[2];
c2 = margeset.column[3];
}
}
// c1 = margeset.column[2];
// c2 = margeset.column[3];
// }
// }

//行、列标题栏
rowTitleMap = selectTitlesMap(rowTitleMap, r1, r2);
11 changes: 7 additions & 4 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
@@ -691,7 +691,7 @@ const sheetmanage = {
colwidth = c2 + 1;
}

Store.flowdata = data;
// Store.flowdata = data;

luckysheetcreatedom(colwidth, rowheight, data, menu, title);

@@ -721,7 +721,8 @@ const sheetmanage = {

let execF = function(){
_this.mergeCalculation(file["index"]);
editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.setSheetParam(false);
// editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.storeSheetParam();
_this.restoreselect();
_this.CacheNotLoadControll = [];
@@ -874,7 +875,7 @@ const sheetmanage = {

file["zoomRatio"] = Store.zoomRatio;
},
setSheetParam: function(isload) {
setSheetParam: function(isload=true) {
let index = this.getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[index];

@@ -896,7 +897,9 @@ const sheetmanage = {
luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata;
}

rhchInit(Store.flowdata.length, Store.flowdata[0].length);
if(isload){
rhchInit(Store.flowdata.length, Store.flowdata[0].length);
}

//批注
luckysheetPostil.buildAllPs(Store.flowdata);
7 changes: 7 additions & 0 deletions src/controllers/zoom.js
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import sheetmanage from './sheetmanage';
import {changeSheetContainerSize} from './resize';
import { jfrefreshgrid_rhcw } from '../global/refresh';
import server from './server';
import imageCtrl from './imageCtrl';



@@ -29,6 +30,12 @@ export function zoomChange(ratio){
Store.zoomRatio = ratio;

let currentSheet = sheetmanage.getSheetByIndex();

//图片
imageCtrl.images = currentSheet.images;
imageCtrl.allImagesShow();
imageCtrl.init();

if(currentSheet.config==null){
currentSheet.config = {};
}
11 changes: 9 additions & 2 deletions src/css/luckysheet-core.css
Original file line number Diff line number Diff line change
@@ -4346,7 +4346,6 @@ fieldset[disabled] .btn-danger.focus {
}

.luckysheet-modal-dialog-slider-list-title {
width: 100%;
height: 20px;
line-height: 25px;
padding: 0px 5px;
@@ -4480,7 +4479,6 @@ fieldset[disabled] .btn-danger.focus {
font-size: 13px;
height: 20px;
line-height: 20px;
width: 100%;
padding-left: 5px;
}

@@ -6755,7 +6753,12 @@ fieldset[disabled] .btn-danger.focus {
left: 0;
top: 0;
cursor: move;
image-rendering: -moz-crisp-edges; /* Firefox */
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /*Webkit (non-standard naming) */
image-rendering: crisp-edges;
}

#luckysheet-modal-dialog-cropping::before{
content: "";
outline: 1px solid #fff;
@@ -7048,6 +7051,10 @@ fieldset[disabled] .btn-danger.focus {
box-shadow:none;
background: none;
box-shadow:none;
image-rendering: -moz-crisp-edges; /* Firefox */
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /*Webkit (non-standard naming) */
image-rendering: crisp-edges;
}

.luckysheet-modal-dialog-image .luckysheet-modal-dialog-content, #luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content{
4 changes: 2 additions & 2 deletions src/global/createdom.js
Original file line number Diff line number Diff line change
@@ -114,8 +114,8 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
$("#luckysheet-cols-h-c").height((Store.columeHeaderHeight-1.5));
$("#luckysheet-left-top").css({width:Store.rowHeaderWidth-1.5, height:Store.columeHeaderHeight-1.5});

//批注
luckysheetPostil.buildAllPs(Store.flowdata);
// //批注
// luckysheetPostil.buildAllPs(Store.flowdata);

$("#luckysheet_info_detail_input").val(luckysheetConfigsetting.title);
}

0 comments on commit 9b0fcfd

Please sign in to comment.