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

Commit

Permalink
feat(chart): add chart
Browse files Browse the repository at this point in the history
plugins system, add first plugin:chart

BREAKING CHANGE: add new config : plugins, array
  • Loading branch information
Dushusir committed Jul 22, 2020
1 parent 4cd2ee4 commit 139bc6e
Show file tree
Hide file tree
Showing 9 changed files with 2,854 additions and 55 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
luckysheet.create({
container: 'luckysheet',
lang: 'zh',
plugins: ['chart'],
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable]
})

Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ export default {
beforeCreateDom: null,//表格创建之前的方法
fireMousedown: null, //单元格数据下钻
lang: 'en', //language
plugins: [], //plugins, e.g. ['chart']
}
19 changes: 19 additions & 0 deletions src/controllers/expendPlugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import chart from '../expendPlugins/chart/plugin'

const pluginsObj = {
'chart':chart
}
/**
* Register plugins
*/
function initPlugins(plugins){
if(plugins.length){
plugins.forEach(plugin => {
pluginsObj[plugin]();
});
}
}

export {
initPlugins
}
1 change: 1 addition & 0 deletions src/controllers/luckysheetConfigsetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const luckysheetConfigsetting = {
chartConfigChange: null,
beforeCreateDom: null,
fireMousedown: null,
plugins:[]
}

export default luckysheetConfigsetting;
5 changes: 5 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import luckysheetConfigsetting from './controllers/luckysheetConfigsetting';
import sheetmanage from './controllers/sheetmanage';
import luckysheetsizeauto from './controllers/resize';
import luckysheetHandler from './controllers/handler';
import {initPlugins} from './controllers/expendPlugins';

let luckysheet = {};

Expand Down Expand Up @@ -62,6 +63,10 @@ luckysheet.create = function (setting) {
luckysheetConfigsetting.beforeCreateDom = extendsetting.beforeCreateDom;

luckysheetConfigsetting.fireMousedown = extendsetting.fireMousedown;
luckysheetConfigsetting.plugins = extendsetting.plugins;

// Register plugins
initPlugins(extendsetting.plugins);

let devicePixelRatio = extendsetting.devicePixelRatio;
if(devicePixelRatio == null){
Expand Down
1 change: 1 addition & 0 deletions src/expendPlugins/chart/chartmix.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.chart-container[data-v-7aaa5f56]{background:#ec3204}
Loading

0 comments on commit 139bc6e

Please sign in to comment.