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

Commit

Permalink
fix(bug fix): pivotTable blank title disapear, merge cell is recogniz…
Browse files Browse the repository at this point in the history
…ed as range
  • Loading branch information
DR-Univer committed Aug 1, 2020
1 parent 37080fa commit 47fe25c
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/controllers/constant.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import luckysheetsizeauto from './resize';
import {
luckysheetMoveHighlightCell,
} from './sheetMove';
import { selectHightlightShow, selectIsOverlap, selectionCopyShow, luckysheet_count_show } from './select';
import { selectHightlightShow, selectIsOverlap, selectionCopyShow, luckysheet_count_show,selectHelpboxFill } from './select';
import selection from './selection';
import controlHistory from './controlHistory';
import splitColumn from './splitColumn';
Expand Down Expand Up @@ -442,7 +442,7 @@ export default function luckysheetHandler() {
"column_focus": col_index
};
}

formula.rangeSetValue({ "row": rowseleted, "column": columnseleted });

formula.rangestart = true;
Expand Down Expand Up @@ -857,7 +857,7 @@ export default function luckysheetHandler() {
hideAllNeedRangeShow();
}

$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]));
// selectHelpboxFill();

//数据透视表
pivotTable.pivotclick(row_index, col_index, Store.currentSheetIndex);
Expand Down Expand Up @@ -1416,7 +1416,7 @@ export default function luckysheetHandler() {
selectHightlightShow();
luckysheetFreezen.scrollFreezen();

$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]));
// selectHelpboxFill();

//交替颜色选择范围
if ($("#luckysheet-alternateformat-rangeDialog").is(":visible")) {
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ const menuButton = {
let colormenu = replaceHtml(_this.color, { "id": subcolormenuid, "coloritem": "", "colorself": "", "sub": "luckysheet-menuButton-sub",resetColor:locale_toolbar.resetColor });

$("body").append(menu + colormenu + submenu);
$menuButton = $("#" + menuButtonId).width(160);
$menuButton = $("#" + menuButtonId).width(170);
_this.focus($menuButton, "border-all");

$("#" + submenuid + " canvas").each(function(i){
Expand Down Expand Up @@ -1196,7 +1196,7 @@ const menuButton = {
let menu = replaceHtml(_this.menu, { "id": "merge-menu", "item": itemset, "subclass": "", "sub": "" });

$("body").append(menu);
$menuButton = $("#"+menuButtonId).width(100);
$menuButton = $("#"+menuButtonId).width(110);
_this.focus($menuButton);

$menuButton.find(".luckysheet-cols-menuitem").click(function(){
Expand Down Expand Up @@ -1391,7 +1391,7 @@ const menuButton = {

$("body").append(menu);
$menuButton = $("#" + menuButtonId).width(120);
_this.focus($menuButton);
_this.focus($menuButton, "clip");

$menuButton.find(".luckysheet-cols-menuitem").click(function(){
$menuButton.hide();
Expand Down Expand Up @@ -1493,7 +1493,7 @@ const menuButton = {
let menu = replaceHtml(_this.menu, { "id": "freezen-menu", "item": itemset, "subclass": "", "sub": "" });

$("body").append(menu);
$menuButton = $("#" + menuButtonId).width(160);
$menuButton = $("#" + menuButtonId).width(170);

$menuButton.find(".luckysheet-cols-menuitem").click(function(){
$menuButton.hide();
Expand Down
12 changes: 7 additions & 5 deletions src/controllers/pivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,15 @@ const pivotTable = {
return;
}

if (this.isPivotRange(row_index, col_index)) {
$("#luckysheet-modal-dialog-slider-pivot").show();
let slider = $("#luckysheet-modal-dialog-slider-pivot");
let isRangeClick = this.isPivotRange(row_index, col_index);
if (isRangeClick && slider.is(":hidden")) {
slider.show();
luckysheetsizeauto();
$("#luckysheet-sta-content").css("padding-right", 260);
}
else {
$("#luckysheet-modal-dialog-slider-pivot").hide();
else if(!isRangeClick && slider.is(":visible")) {
slider.hide();
luckysheetsizeauto();
$("#luckysheet-sta-content").css("padding-right", 10);
}
Expand Down Expand Up @@ -3009,7 +3011,7 @@ const pivotTable = {
}
}

if (values.length == 1 && column.length > 0) {
if (values.length == 1 && column.length > 0 && row.length > 0 ) {
retdata[0][0] = values[0].fullname;
retdata.splice(column.length, 1);
}
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import pivotTable from './pivotTable';
import luckysheetPostil from './postil';
import menuButton from './menuButton';
import server from './server';
import { selectHightlightShow, luckysheet_count_show } from './select';
import { selectHightlightShow, luckysheet_count_show,selectHelpboxFill } from './select';
import {
getObjType,
showrightclickmenu,
Expand Down Expand Up @@ -333,7 +333,7 @@ export function rowColumnOperationInitial(){
}
}

$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]));
selectHelpboxFill();

setTimeout(function () {
clearTimeout(Store.countfuncTimeout);
Expand Down Expand Up @@ -700,7 +700,7 @@ export function rowColumnOperationInitial(){
}
}

$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]));
selectHelpboxFill();

setTimeout(function () {
clearTimeout(Store.countfuncTimeout);
Expand Down
18 changes: 17 additions & 1 deletion src/controllers/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function selectHightlightShow() {
selectTitlesShow(Store.luckysheet_select_save);

//左上角范围显示
$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1]));
selectHelpboxFill();

//动态数组显示
if(Store.luckysheet_select_save.length == 1 && Store.luckysheet_select_save[0].row[0] == Store.luckysheet_select_save[0].row[1] && Store.luckysheet_select_save[0].column[0] == Store.luckysheet_select_save[0].column[1]){
Expand Down Expand Up @@ -394,10 +394,26 @@ function luckysheet_count_show(left, top, width, height, rowseleted, columnselet
}
}

function selectHelpboxFill(){
let range = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
let rf = range["row_focus"], cf = range["column_focus"];
if(Store.config["merge"] != null && (rf + "_" + cf) in Store.config["merge"]){
$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, {
column:[cf, cf],
row:[rf, rf],
}));
}
else{
$("#luckysheet-helpbox-cell").text(getRangetxt(Store.currentSheetIndex, range));
}

}

export {
seletedHighlistByindex,
selectHightlightShow,
selectIsOverlap,
selectionCopyShow,
luckysheet_count_show,
selectHelpboxFill
}
18 changes: 13 additions & 5 deletions src/global/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getBorderInfoCompute } from './border';
import { getSheetIndex } from '../methods/get';
import { getObjType, chatatABC, luckysheetfontformat } from '../utils/util';
import Store from '../store';
import locale from '../locale/locale';

function luckysheetDrawgrid(scrollWidth, scrollHeight, drawWidth, drawHeight, offsetLeft, offsetTop) {
if($("#luckysheetTableContent").length == 0){
Expand Down Expand Up @@ -673,7 +674,7 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
);
luckysheetTableContent.lineTo(
Store.devicePixelRatio * (end_c - 2 + 0.5 + offsetLeft),
Store.devicePixelRatio * (end_r - 2 + offsetTop)
Store.devicePixelRatio * (end_r - 2 + 0.5 + offsetTop)
);
luckysheetTableContent.lineWidth = Store.devicePixelRatio;
luckysheetTableContent.strokeStyle = "#000000";
Expand All @@ -688,7 +689,7 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
Store.devicePixelRatio * (end_r - 2 + 0.5 + offsetTop)
);
luckysheetTableContent.lineTo(
Store.devicePixelRatio * (end_c - 2 + offsetLeft),
Store.devicePixelRatio * (end_c - 2 + 0.5 + offsetLeft),
Store.devicePixelRatio * (end_r - 2 + 0.5 + offsetTop)
);
luckysheetTableContent.lineWidth = Store.devicePixelRatio;
Expand All @@ -698,11 +699,16 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
}

if (r == 6 && c == 3) {
luckysheetTableContent.save();
luckysheetTableContent.font="bold 30px Arial";
luckysheetTableContent.fillStyle = "#626675";
luckysheetTableContent.textAlign="center";
luckysheetTableContent.fillText(
"Pivot Table",
Store.devicePixelRatio * (start_c + 4 + offsetLeft),
locale().pivotTable.title,
Store.devicePixelRatio * (start_c + (end_c - start_c) / 2 + 4 + offsetLeft),
Store.devicePixelRatio *(start_r + (end_r - start_r) / 2 - 1 + offsetTop)
);
luckysheetTableContent.restore();
}
}
else if (!!Store.luckysheetcurrentisPivotTable) {
Expand All @@ -714,7 +720,7 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
);
luckysheetTableContent.lineTo(
Store.devicePixelRatio*(end_c - 2 + 0.5 + offsetLeft),
Store.devicePixelRatio*(end_r - 2 + offsetTop)
Store.devicePixelRatio*(end_r - 2 + 0.5 + offsetTop)
);
luckysheetTableContent.lineWidth = Store.devicePixelRatio;
luckysheetTableContent.strokeStyle = "#000000";
Expand All @@ -738,6 +744,8 @@ function luckysheetDrawMain(scrollWidth, scrollHeight, drawWidth, drawHeight, of
}
}
}



//边框单独渲染
if(Store.config["borderInfo"] != null && Store.config["borderInfo"].length > 0){
Expand Down
12 changes: 11 additions & 1 deletion src/global/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,17 @@ const luckysheetformula = {
rangeSetValue: function(selected, obj) {
let _this = this;

let range = getRangetxt(Store.currentSheetIndex, selected, _this.rangetosheet);
let range="", rf = selected["row"][0], cf = selected["column"][0];
if(Store.config["merge"] != null && (rf + "_" + cf) in Store.config["merge"]){
range = getRangetxt(Store.currentSheetIndex, {
column:[cf, cf],
row:[rf, rf],
}, _this.rangetosheet);
}
else{
range = getRangetxt(Store.currentSheetIndex, selected, _this.rangetosheet);
}

let $editor;

if (_this.rangestart || _this.rangedrag_column_start || _this.rangedrag_row_start) {
Expand Down
6 changes: 3 additions & 3 deletions src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,12 @@ export default {
setAs: 'Set as',
setAsByArea: 'For the selected area, set to',
applyRange: 'Apply range',
selectRange: 'Click to select application range',
selectRange: 'Select application range',
selectRange_percent: 'Percentage of selected range',
selectRange_average: 'Average value of selected range',
selectRange_value: 'Value in the selected range',
pleaseSelectRange: 'Please select application range',
selectDataRange: 'Click to select data range',
selectDataRange: 'Select data range',
selectCell: 'select cell',
pleaseSelectCell: 'Please select cell',
pleaseSelectADate: 'Please select a date',
Expand Down Expand Up @@ -937,7 +937,7 @@ export default {
pivotTable:{
title:"PivotTable",
closePannel:"Close",
editRange:"Select data range",
editRange:"Range",
tipPivotFieldSelected:"Select the fields",
tipClearSelectedField:"Clear all fields",
btnClearSelectedField:"Clear",
Expand Down

0 comments on commit 47fe25c

Please sign in to comment.