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

Commit

Permalink
feat(print feature): develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Dec 9, 2020
1 parent 9b693cc commit a0921b6
Show file tree
Hide file tree
Showing 9 changed files with 1,816 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/controllers/expendPlugins.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { chart } from '../expendPlugins/chart/plugin'
import { print } from '../expendPlugins/print/plugin'

const pluginsObj = {
'chart':chart
'chart':chart,
'print':print
}

const isDemo = true
Expand Down
15 changes: 14 additions & 1 deletion src/controllers/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import luckysheetConfigsetting from './luckysheetConfigsetting';
import {zoomChange} from './zoom';
import sheetmanage from './sheetmanage';
import server from './server';
import {rowLocationByIndex, colLocationByIndex,mouseposition,rowLocation,colLocation} from '../global/location';
import Store from '../store';

let ExcelPlaceholder = {
Expand Down Expand Up @@ -39,7 +40,7 @@ export function viewChange(curType, preType){
}

let defaultZoom = 1, type="zoomScaleNormal";

printLineAndNumberDelete(currentSheet);
if(curType=="viewNormal"){
type = "viewNormalZoomScale";
}
Expand All @@ -49,8 +50,11 @@ export function viewChange(curType, preType){
else if(curType=="viewPage"){
type = "viewPageZoomScale";
defaultZoom = 0.6;
printLineAndNumberCreate(currentSheet);
}



let curZoom = currentSheet.config.sheetViewZoom[type];
if(curZoom==null){
curZoom = defaultZoom;
Expand All @@ -76,6 +80,15 @@ export function viewChange(curType, preType){
zoomChange(curZoom);
}


function printLineAndNumberDelete(sheet){

}

function printLineAndNumberCreate(sheet){

}

function switchViewBtn($t){
let $viewList = $t.parent(), preType=$viewList.find("luckysheet-print-viewBtn-active").attr("type");
if($t.attr("type") == preType){
Expand Down
4 changes: 2 additions & 2 deletions src/expendPlugins/chart/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const dependScripts = [
'https://unpkg.com/[email protected]',
'https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js',
'https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js',
'expendPlugins/chart/chartmix.umd.min.js'
'expendPlugins/chart/chartmix.umd.min.js',
// 'http://26.26.26.1:8000/chartmix.umd.js'
]

const dependLinks = [
'https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/theme-chalk/index.css',
'expendPlugins/chart/chartmix.css'
'expendPlugins/chart/chartmix.css',
// 'http://26.26.26.1:8000/chartmix.css'
]

Expand Down
26 changes: 26 additions & 0 deletions src/expendPlugins/print/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { seriesLoadScripts, loadLinks, $$ } from '../../utils/util'


// Dynamically load dependent scripts and styles
const dependScripts = [
// 'expendPlugins/chart/chartmix.umd.min.js',
'http://localhost:8080/luckysheetPluginPrint.umd.js',
]

const dependLinks = [
// 'expendPlugins/chart/chartmix.css',
'http://localhost:8080/luckysheetPluginPrint.css',
]

// Initialize the chart component
function print(data, isDemo) {
loadLinks(dependLinks);

seriesLoadScripts(dependScripts, null, function () {

});
}



export { print }
37 changes: 37 additions & 0 deletions src/function/functionImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27546,6 +27546,43 @@ const functionImplementation = {
return [formula.error.v, err];
}
},
"EVALUATE": function() {
//必要参数个数错误检测
if (arguments.length < this.m[0] || arguments.length > this.m[1]) {
return formula.error.na;
}

//参数类型错误检测
for (var i = 0; i < arguments.length; i++) {
var p = formula.errorParamCheck(this.p, arguments[i], i);

if (!p[0]) {
return formula.error.v;
}
}

try {
//公式文本
var strtext = func_methods.getFirstValue(arguments[0]).toString();
if(valueIsError(strtext)){
return strtext;
}

//if (!window.luckysheet_function.ISIDCARD.f(UUserCard)) {
// return formula.error.v;
//}
//匹配简单公式,只能包含 空格 数字-+*/.()
var formulastr = /[ \d\+\*\-\/\(\)\.]+/;
var strtext2=strtext.match(formulastr)[0];
return eval(strtext2);
}
catch (e) {
var err = e;
//计算错误检测
err = formula.errorInfo(err);
return [formula.error.v, err];
}
},
};

export default functionImplementation;
1,686 changes: 1,685 additions & 1 deletion src/index.html

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -8811,7 +8811,23 @@ export default {
"repeat": "n",
"type": "rangenumber"
}]
}],
},
{
"n": "EVALUATE",
"t": "3",
"d": "Evaluate a formula or expression expressed in words and return the result",
"a": "Evaluate according to literal formula or expression.",
"m": [1, 1],
"p": [{
"name": "expression",
"example": '"5*6"',
"detail": "Formula or expression only supports numbers+-/*.()",
"require": "m",
"repeat": "n",
"type": "rangeall"
}]
},
],
toolbar: {
undo: 'Undo',
redo: 'Redo',
Expand Down
18 changes: 17 additions & 1 deletion src/locale/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -8811,7 +8811,23 @@ export default {
"repeat": "n",
"type": "rangenumber"
}]
}],
},
{
"n": "EVALUATE",
"t": "3",
"d": "Evaluate a formula or expression expressed in words and return the result",
"a": "Evaluate according to literal formula or expression.",
"m": [1, 1],
"p": [{
"name": "expression",
"example": '"5*6"',
"detail": "Formula or expression only supports numbers+-/*.()",
"require": "m",
"repeat": "n",
"type": "rangeall"
}]
},
],
toolbar: {
undo: 'Deshacer',
redo: 'Rehacer',
Expand Down
15 changes: 15 additions & 0 deletions src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -9037,6 +9037,21 @@ export default {
'type': 'rangenumber'
}]
},
{
"n": "EVALUATE",
"t": "3",
"d": "对以文字表示的一个公式或者表达式求值,并返回结果",
"a": "根据文字公式或者表达式求值。",
"m": [1, 1],
"p": [{
"name": "公式",
"example": '"5*6"',
"detail": "公式或表达式仅支持数字+-/*.()",
"require": "m",
"repeat": "n",
"type": "rangeall"
}]
},
],
toolbar: {
undo: '撤销',
Expand Down

0 comments on commit a0921b6

Please sign in to comment.