From c5f9d0055d882a7e2bfc87e0a97525db4929a138 Mon Sep 17 00:00:00 2001 From: wbfsa Date: Sat, 10 Oct 2020 00:46:01 +0800 Subject: [PATCH] refactor(print developing): defined config --- src/controllers/constant.js | 10 +++++-- src/controllers/print.js | 12 +++++++- src/css/luckysheet-core.css | 2 +- src/css/luckysheet-print.css | 53 ++++++++++++++++++++++++++++++++++++ src/index.html | 21 +++++++------- src/locale/en.js | 5 ++++ src/locale/zh.js | 6 ++++ 7 files changed, 95 insertions(+), 14 deletions(-) create mode 100644 src/css/luckysheet-print.css diff --git a/src/controllers/constant.js b/src/controllers/constant.js index a8fc92c..77dac77 100644 --- a/src/controllers/constant.js +++ b/src/controllers/constant.js @@ -5,6 +5,7 @@ import Store from '../store'; const gridHTML = function(){ const _locale = locale(); const locale_info = _locale.info; + const locale_print = _locale.print; return `
@@ -214,7 +215,7 @@ const gridHTML = function(){
-
+
@@ -227,7 +228,12 @@ const gridHTML = function(){
100%
-
+
+
+
+
+
+
diff --git a/src/controllers/print.js b/src/controllers/print.js index d861440..e07d72e 100644 --- a/src/controllers/print.js +++ b/src/controllers/print.js @@ -1,6 +1,16 @@ import { jsPDF } from "jspdf"; - +let ExcelPlaceholder = { + "[tabName]":"&A", + "[CurrentDate]":"&D", + "[fileName]":"&F", + "[background]":"&G", + "[Shadow]":"&H", + "[TotalPages]":"&N", + "[pageNumber]":"&P", + "[CurrentTime]":"&T", + "[filePath]":"&Z", +} // Get the pixel value per millimeter function getOneMmsPx (){ diff --git a/src/css/luckysheet-core.css b/src/css/luckysheet-core.css index eb7d219..468d90a 100644 --- a/src/css/luckysheet-core.css +++ b/src/css/luckysheet-core.css @@ -972,7 +972,7 @@ .luckysheet-sta-c .luckysheet-sta-content { position: absolute; left: 0px; - right: 220px; + right: 358px; height: 22px; line-height: 22px; text-align: right; diff --git a/src/css/luckysheet-print.css b/src/css/luckysheet-print.css new file mode 100644 index 0000000..3ec9b40 --- /dev/null +++ b/src/css/luckysheet-print.css @@ -0,0 +1,53 @@ +.luckysheet-print-viewList{ + position: absolute; + width:126px; + right: 222px; + height: 22px; + line-height: 22px; + text-align: center; + white-space: nowrap; + overflow: hidden; + display: flex; + align-items: center; + user-select: none; +} + +.luckysheet-print-viewBtn { + position: absolute; + left: 0px; + width: 42px; + height:22px; + align-items: center; + justify-content: center; + cursor: pointer; +} + +.luckysheet-print-viewBtn .iconfont{ + font-size: 22px; +} + +.luckysheet-print-viewBtn:hover{ + background: #E1E4E8; +} + +.luckysheet-print-viewBtn-active{ + background: #dcdcdc; + cursor: default; +} + +.luckysheet-print-viewBtn-active:hover{ + background: #dcdcdc; +} + +.luckysheet-print-viewNormal{ + left: 0px; +} + +.luckysheet-print-viewLayout{ + left: 42px; +} + +.luckysheet-print-viewPage{ + left: 84px; +} + diff --git a/src/index.html b/src/index.html index 4e4bc51..8f1ea47 100644 --- a/src/index.html +++ b/src/index.html @@ -80,6 +80,7 @@ // "un":"1",//underline // "bl":"1",//blod // "it":"0",//italic + // "ss":0,//0 none 1sup 2sub // v:"交给警\r\n察叔叔\r\n" // }, // ] @@ -143,21 +144,21 @@ }, headerFooter:{ firstFooter:{ - left:[ + left:[//&L { - "ff":"Arial", //font family - "fc":"#fff000",//font color - "fs":12,//font size + "ff":"Arial", //font family &"-,Regular" or &"font name,font type" + "fc":"#fff000",//font color &K + "fs":12,//font size &font-size "cl":0,//strike - "un":0,//underline - "bl":0,//blod - "it":0,//italic - "ss":0,//0 none 1sup 2sub + "un":0,//underline &E double, &U single + "bl":0,//blod &B + "it":0,//italic &I + "ss":0,//0 none 1sup &X, 2sub &Y v:"我在马路\r\n边捡到\r\n\r\n一分钱" } ], - center:[], - right:[], + center:[],//&C + right:[],//&R }, //First Page Footer firstHeader:null, //First Page Header oddFooter:"&C第 &P 页&R&G", //Odd Page Footer diff --git a/src/locale/en.js b/src/locale/en.js index 91e8b7c..6fef624 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -1155,6 +1155,11 @@ export default { selectionIsNullAlert:"Selection is required!", sheetDataIsNullAlert:"error, Data is none!", + }, + print:{ + normalBtn:"Normal", + layoutBtn:"Page Layout", + pageBtn:"Page break preview", } }; \ No newline at end of file diff --git a/src/locale/zh.js b/src/locale/zh.js index ee99e04..3d1ca22 100644 --- a/src/locale/zh.js +++ b/src/locale/zh.js @@ -1170,5 +1170,11 @@ export default { tipsAll:"全部选中", selectionIsNullAlert:"请选择一个范围!", sheetDataIsNullAlert:"数据为空无法设置!", + }, + print:{ + normalBtn:"常规视图", + layoutBtn:"页面布局", + pageBtn:"分页预览", } + };