Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customize toolbar position #454

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
yarn.lock

dist
.nyc_output/*
5 changes: 5 additions & 0 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ module.exports = {
entry: {
xspreadsheet: './src/index.js',
},
output: {
library: 'Spreadsheet',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: [
{
Expand Down
131 changes: 0 additions & 131 deletions dist/ece3e4fa05d4292823fdef970eaf1233.svg

This file was deleted.

177 changes: 93 additions & 84 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,96 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>x-spreadsheet</title>

<link href="xspreadsheet.css" rel="stylesheet"></head>
<body onload="load()">
<div style="position: fixed; right: 0; top: .3em;">
<iframe src="https://ghbtns.com/github-btn.html?user=myliang&repo=x-spreadsheet&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
</div>
<div id="x-spreadsheet-demo"></div>
<script>
function load(){
const rows10 = { len: 1000 };
for (let i = 0; i < 1000; i += 1) {
rows10[i] = {
cells: {
0: { text: 'A-' + i },
1: { text: 'B-' + i },
2: { text: 'C-' + i },
3: { text: 'D-' + i },
4: { text: 'E-' + i },
5: { text: 'F-' + i },
}
};
}
const rows = {
len: 80,
1: {
cells: {
0: { text: 'testingtesttestetst' },
2: { text: 'testing' },
},
},
2: {
cells: {
0: { text: 'render', style: 0 },
1: { text: 'Hello' },
2: { text: 'haha', merge: [1, 1] },
}
},
8: {
cells: {
8: { text: 'border test', style: 0 },
}
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>x-spreadsheet</title>
<link href="xspreadsheet.css" rel="stylesheet"></head>
<body onload="load()">
<div style="position: fixed; right: 0; top: 0.3em">
<iframe
src="https://ghbtns.com/github-btn.html?user=myliang&repo=x-spreadsheet&type=star&count=true&size=large"
frameborder="0"
scrolling="0"
width="160px"
height="30px"
></iframe>
</div>
<div id="x-spreadsheet-demo"></div>
<script>
function load() {
const rows10 = { len: 1000 };
for (let i = 0; i < 1000; i += 1) {
rows10[i] = {
cells: {
0: { text: "A-" + i },
1: { text: "B-" + i },
2: { text: "C-" + i },
3: { text: "D-" + i },
4: { text: "E-" + i },
5: { text: "F-" + i },
},
};
}
};
// x_spreadsheet.locale('zh-cn');
var xs = x_spreadsheet('#x-spreadsheet-demo', {showToolbar: true, showGrid: true})
.loadData([{
freeze: 'B3',
styles: [
{
bgcolor: '#f4f5f8',
textwrap: true,
color: '#900b09',
border: {
top: ['thin', '#0366d6'],
bottom: ['thin', '#0366d6'],
right: ['thin', '#0366d6'],
left: ['thin', '#0366d6'],
const rows = {
len: 80,
1: {
cells: {
0: { text: "testingtesttestetst" },
2: { text: "testing" },
},
},
2: {
cells: {
0: { text: "render", style: 0 },
1: { text: "Hello" },
2: { text: "haha", merge: [1, 1] },
},
},
8: {
cells: {
8: { text: "border test", style: 0 },
},
},
};
// x_spreadsheet.locale('zh-cn');
const root = document.getElementById("x-spreadsheet-demo");
var xs = new Spreadsheet(root, { showToolbar: true, showGrid: true });
root.prepend(xs.sheet.toolbar.el.el);

xs.loadData([
{
freeze: "B3",
styles: [
{
bgcolor: "#f4f5f8",
textwrap: true,
color: "#900b09",
border: {
top: ["thin", "#0366d6"],
bottom: ["thin", "#0366d6"],
right: ["thin", "#0366d6"],
left: ["thin", "#0366d6"],
},
},
],
merges: ["C3:D4"],
cols: {
len: 10,
2: { width: 200 },
},
],
merges: [
'C3:D4',
],
cols: {
len: 10,
2: { width: 200 },
rows,
},
rows,
}, { name: 'sheet-test', rows: rows10 }]).change((cdata) => {
{ name: "sheet-test", rows: rows10 },
]).change((cdata) => {
// console.log(cdata);
console.log('>>>', xs.getData());
console.log(">>>", xs.getData());
});

xs.on('cell-selected', (cell, ri, ci) => {
console.log('cell:', cell, ', ri:', ri, ', ci:', ci);
}).on('cell-edited', (text, ri, ci) => {
console.log('text:', text, ', ri: ', ri, ', ci:', ci);
xs.on("cell-selected", (cell, ri, ci) => {
console.log("cell:", cell, ", ri:", ri, ", ci:", ci);
}).on("cell-edited", (text, ri, ci) => {
console.log("text:", text, ", ri: ", ri, ", ci:", ci);
});

setTimeout(() => {
// xs.loadData([{ rows }]);
xs.cellText(14, 3, 'cell-text').reRender();
console.log('cell(8, 8):', xs.cell(8, 8));
console.log('cellStyle(8, 8):', xs.cellStyle(8, 8));
}, 5000);
}
</script>
<!--script type="text/javascript" src="https://unpkg.com/[email protected]/dist/locale/zh-cn.js"></script-->
<script type="text/javascript" src="xspreadsheet.js"></script></body>
setTimeout(() => {
// xs.loadData([{ rows }]);
xs.cellText(14, 3, "cell-text").reRender();
console.log("cell(8, 8):", xs.cell(8, 8));
console.log("cellStyle(8, 8):", xs.cellStyle(8, 8));
}, 5000);
}
</script>
<!--script type="text/javascript" src="https://unpkg.com/[email protected]/dist/locale/zh-cn.js"></script-->
<script type="text/javascript" src="xspreadsheet.js"></script></body>
</html>
1 change: 0 additions & 1 deletion dist/locale/de.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/locale/en.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/locale/nl.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/locale/zh-cn.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/xspreadsheet.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xspreadsheet.js.map

Large diffs are not rendered by default.

Loading