Updates
This commit is contained in:
parent
48b5f8a2b2
commit
cd4eaf805f
|
|
@ -0,0 +1,2 @@
|
||||||
|
"use strict";const s=require("./main.js"),r={onCellClick:(e,t)=>{console.log("Cell click",e,t)},onSelectionChange:e=>{console.log("Changed selection: ",e)},onCellChange(e){console.log("Cell changed: ",e)},onCopy:(e,t,i)=>{console.log("Copy event: ",e,t,i)}},o=new s.default("#spreadsheet",r);function c(){const e=o.serializeData();localStorage.setItem("sheet",JSON.stringify(e))}function a(){const e=localStorage.getItem("sheet");if(!e)return;const t=JSON.parse(e);o.loadData(t)}const n=document.querySelector("#save_button"),l=document.querySelector("#load_button");if(!n||!l)throw new Error("LOST");n.addEventListener("click",c);l.addEventListener("click",a);
|
||||||
|
//# sourceMappingURL=demo.js.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"demo.js","sources":["../src/index.ts"],"sourcesContent":["import Spreadsheet from \"./main\";\nconst options = {\n onCellClick: (event, cell) => {\n console.log(\"Cell click\", event, cell);\n },\n onSelectionChange: (selection) => {\n console.log(\"Changed selection: \", selection);\n },\n onCellChange(cell) {\n console.log(\"Cell changed: \", cell);\n },\n onCopy: (range, data, dataAsString) => {\n console.log(\"Copy event: \", range, data, dataAsString);\n }\n};\nconst sheet = new Spreadsheet(\"#spreadsheet\", options);\nfunction saveDataToLS() {\n const serializableData = sheet.serializeData();\n localStorage.setItem(\"sheet\", JSON.stringify(serializableData));\n}\nfunction loadDataFromLS() {\n const data = localStorage.getItem(\"sheet\");\n if (!data)\n return;\n const json = JSON.parse(data);\n sheet.loadData(json);\n}\nconst saveButton = document.querySelector(\"#save_button\");\nconst loadButton = document.querySelector(\"#load_button\");\nif (!saveButton || !loadButton)\n throw new Error(\"LOST\");\nsaveButton.addEventListener(\"click\", saveDataToLS);\nloadButton.addEventListener(\"click\", loadDataFromLS);\n"],"names":["options","event","cell","selection","range","data","dataAsString","sheet","Spreadsheet","saveDataToLS","serializableData","loadDataFromLS","json","saveButton","loadButton"],"mappings":"0CACMA,EAAU,CACZ,YAAa,CAACC,EAAOC,IAAS,CAClB,QAAA,IAAI,aAAcD,EAAOC,CAAI,CACzC,EACA,kBAAoBC,GAAc,CACtB,QAAA,IAAI,sBAAuBA,CAAS,CAChD,EACA,aAAaD,EAAM,CACP,QAAA,IAAI,iBAAkBA,CAAI,CACtC,EACA,OAAQ,CAACE,EAAOC,EAAMC,IAAiB,CACnC,QAAQ,IAAI,eAAgBF,EAAOC,EAAMC,CAAY,CACzD,CACJ,EACMC,EAAQ,IAAIC,EAAAA,QAAY,eAAgBR,CAAO,EACrD,SAASS,GAAe,CACd,MAAAC,EAAmBH,EAAM,gBAC/B,aAAa,QAAQ,QAAS,KAAK,UAAUG,CAAgB,CAAC,CAClE,CACA,SAASC,GAAiB,CAChB,MAAAN,EAAO,aAAa,QAAQ,OAAO,EACzC,GAAI,CAACA,EACD,OACE,MAAAO,EAAO,KAAK,MAAMP,CAAI,EAC5BE,EAAM,SAASK,CAAI,CACvB,CACA,MAAMC,EAAa,SAAS,cAAc,cAAc,EAClDC,EAAa,SAAS,cAAc,cAAc,EACxD,GAAI,CAACD,GAAc,CAACC,EACV,MAAA,IAAI,MAAM,MAAM,EAC1BD,EAAW,iBAAiB,QAASJ,CAAY,EACjDK,EAAW,iBAAiB,QAASH,CAAc"}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/modern_spreadsheet/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Spreadsheet example</title>
|
||||||
|
<script type="module" crossorigin src="/modern_spreadsheet/demo.js"></script>
|
||||||
|
<link rel="modulepreload" crossorigin href="/modern_spreadsheet/main.js">
|
||||||
|
</head>
|
||||||
|
<body style="padding: 2rem;">
|
||||||
|
<div id="spreadsheet"></div>
|
||||||
|
<button id="save_button">Save sheet</button>
|
||||||
|
<button id="load_button">Load sheet</button>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,14 @@
|
||||||
{
|
{
|
||||||
|
"index.html": {
|
||||||
|
"file": "demo.js",
|
||||||
|
"imports": [
|
||||||
|
"src/main.ts"
|
||||||
|
],
|
||||||
|
"isEntry": true,
|
||||||
|
"src": "index.html"
|
||||||
|
},
|
||||||
"src/main.ts": {
|
"src/main.ts": {
|
||||||
"file": "main.cjs",
|
"file": "main.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "src/main.ts"
|
"src": "src/main.ts"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue