From b1dca24a0bd363f44681b009e4979f271e490574 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Tue, 12 Apr 2022 07:59:15 -0400 Subject: [PATCH] next.js demo refresh [ci skip] --- README.md | 63 ++++++++++++-------- demos/README.md | 5 +- demos/deno/README.md | 12 ++-- demos/deno/sheet2csv.ts | 6 +- demos/deno/x.ts | 4 +- demos/headless/phantomjs.js | 2 +- demos/react/Makefile | 3 - demos/react/README.md | 76 ++++++++++++++++++++++-- demos/react/nexthdr.js | 4 +- demos/react/pages/.gitignore | 1 - demos/react/pages/getServerSideProps.js | 32 ++++++++++ demos/react/pages/getStaticPaths.js | 38 ++++++++++++ demos/react/pages/getStaticProps.js | 32 ++++++++++ demos/react/pages/index.js | 43 +++++++------- demos/react/pages/sheets/[id].js | 51 ++++++++++++++++ demos/react/public/sheetjs.xlsx | Bin 0 -> 10328 bytes demos/react/react-native.js | 2 +- demos/server/drash.ts | 6 +- docbits/10_install.md | 49 +++++++++------ docbits/13_usage.md | 2 +- docbits/16_demos.md | 4 +- docbits/22_ingress.md | 6 +- docbits/32_egress.md | 2 +- misc/docs/README.md | 61 ++++++++++++------- 24 files changed, 383 insertions(+), 121 deletions(-) delete mode 100644 demos/react/pages/.gitignore create mode 100644 demos/react/pages/getServerSideProps.js create mode 100644 demos/react/pages/getStaticPaths.js create mode 100644 demos/react/pages/getStaticProps.js create mode 100644 demos/react/pages/sheets/[id].js create mode 100644 demos/react/public/sheetjs.xlsx diff --git a/README.md b/README.md index 02b3a75..504cebf 100644 --- a/README.md +++ b/README.md @@ -125,19 +125,19 @@ can be directly added to a page with a `script` tag: ``` -
- CDN Availability (click to show) - -| CDN | URL | -|-----------:|:-------------------------------------------| -| `unpkg` | | -| `jsDelivr` | | -| `CDNjs` | | - -For example, `unpkg` makes the latest version available at: +Each standalone release script is available at . The +latest version uses the `latest` tag: ```html - + + +``` + +A specific release can be referenced by version: + +```html + + ```
@@ -154,6 +154,13 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: - no support for XLSB / XLS / Lotus 1-2-3 / SpreadsheetML 2003 / Numbers - node stream utils removed +These scripts are also available on the CDN: + +```html + + +``` + @@ -193,23 +200,31 @@ set_cptable(cptable); **Deno** -`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: +`xlsx.mjs` can be imported in Deno: ```ts -// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" -import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; +// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` **NodeJS** -With [npm](https://www.npmjs.org/package/xlsx): +Modules are available on [the public npm registry](https://www.npmjs.org/package/xlsx): ```bash -$ npm install xlsx +$ pnpm install xlsx # using pnpm +$ yarn add xlsx # using yarn +$ npm install xlsx # using npm +``` + +Tarballs are also available on : + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz ``` By default, the module supports `require`: @@ -519,7 +534,7 @@ For use in the web browser, assuming the snippet is saved to `snippet.js`, script tags should be used to include the `axios` and `xlsx` standalone builds: ```html - + ``` @@ -548,8 +563,8 @@ The [`demos` directory](demos/) includes sample projects for: - [`angular and ionic`](demos/angular2/) - [`knockout`](demos/knockout/) - [`meteor`](demos/meteor/) -- [`react and react-native`](demos/react/) -- [`vue 2.x and weex`](demos/vue/) +- [`react, react-native, next`](demos/react/) +- [`vue 2.x, weex, nuxt`](demos/vue/) - [`XMLHttpRequest and fetch`](demos/xhr/) - [`nodejs server`](demos/server/) - [`databases and key/value stores`](demos/database/) @@ -1186,8 +1201,8 @@ Here are a few common scenarios (click on each subtitle to see the code): ```html - - + + @@ -1333,7 +1348,7 @@ var code = [ "function(){", page.open('https://sheetjs.com/demos/table', function() { /* Load the browser script from the UNPKG CDN */ - page.includeJs("https://unpkg.com/xlsx/dist/xlsx.full.min.js", function() { + page.includeJs("https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js", function() { /* The code will return an XLSB file encoded as binary string */ var bin = page.evaluateJavaScript(code); @@ -1992,7 +2007,7 @@ Combining with `fetch`, constructing a site from a workbook is straightforward:
- + + + +
+

SheetJS Next.JS {type} Demo

+This demo reads from /public/sheetjs.xlsx and generates HTML from the first sheet. +
+
+
+); } + +export async function getServerSideProps() { + const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")) + return { + props: { + type: "getStaticProps", + html: utils.sheet_to_html(wb.Sheets[wb.SheetNames[0]]), + }, + } +} \ No newline at end of file diff --git a/demos/react/pages/getStaticPaths.js b/demos/react/pages/getStaticPaths.js new file mode 100644 index 0000000..3852295 --- /dev/null +++ b/demos/react/pages/getStaticPaths.js @@ -0,0 +1,38 @@ +import Head from 'next/head'; +import Link from "next/link"; +import { readFile, utils } from 'xlsx'; +import { join } from 'path'; +import { cwd } from 'process'; + +export default function Index({snames, type}) { return ( +
+ + + SheetJS Next.JS {type} Demo + + + +
+

SheetJS Next.JS {type} Demo

+This demo reads from /public/sheetjs.xlsx. Each worksheet maps to a path:

+{snames.map((sname, idx) => (<> + {`Sheet index=${idx} name="${sname}"`} +
+
+))} + +
+
+); } + +export async function getStaticProps() { + const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")) + return { + props: { + type: "getStaticPaths", + snames: wb.SheetNames, + }, + } +} \ No newline at end of file diff --git a/demos/react/pages/getStaticProps.js b/demos/react/pages/getStaticProps.js new file mode 100644 index 0000000..ca2e304 --- /dev/null +++ b/demos/react/pages/getStaticProps.js @@ -0,0 +1,32 @@ +import Head from 'next/head'; +import { readFile, utils } from 'xlsx'; +import { join } from 'path'; +import { cwd } from 'process'; + +export default function Index({html, type}) { return ( +
+ + + SheetJS Next.JS {type} Demo + + + +
+

SheetJS Next.JS {type} Demo

+This demo reads from /public/sheetjs.xlsx and generates HTML from the first sheet. +
+
+
+); } + +export async function getStaticProps() { + const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")) + return { + props: { + type: "getStaticProps", + html: utils.sheet_to_html(wb.Sheets[wb.SheetNames[0]]), + }, + } +} \ No newline at end of file diff --git a/demos/react/pages/index.js b/demos/react/pages/index.js index ce781fd..c93bccd 100644 --- a/demos/react/pages/index.js +++ b/demos/react/pages/index.js @@ -1,23 +1,24 @@ -import Head from 'next/head' -import SheetJSApp from './sheetjs' -const Index = () => ( +import Head from 'next/head'; + +export default function Index() { return (
- - - SheetJS React Demo - - - - -
-

SheetJS React Demo

-
- Source Code Repo
- Issues? Something look weird? Click here and report an issue

-
- + + + SheetJS Next.JS Demo + + + +
+

SheetJS Next.JS Demos

+All demos read from /public/sheetjs.xlsx.
+
+- getStaticProps
+
+- getServerSideProps
+
+- getStaticPaths
+
-); -export default Index; \ No newline at end of file +); } \ No newline at end of file diff --git a/demos/react/pages/sheets/[id].js b/demos/react/pages/sheets/[id].js new file mode 100644 index 0000000..530b675 --- /dev/null +++ b/demos/react/pages/sheets/[id].js @@ -0,0 +1,51 @@ +import Head from 'next/head'; +import { readFile, utils } from 'xlsx'; +import { join } from 'path'; +import { cwd } from 'process'; + +export default function Index({html, type, name}) { return ( +
+ + + SheetJS Next.JS {type} Demo + + + +
+

SheetJS Next.JS {type} Demo

+This demo reads from /public/sheetjs.xlsx.
+
+{name} +
+
+
+); } + +let cache = []; + +export async function getStaticProps(ctx) { + if(!cache || !cache.length) { + const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")); + cache = wb.SheetNames.map((name) => ({ name, sheet: wb.Sheets[name] })); + } + const entry = cache[ctx.params.id]; + return { + props: { + type: "getStaticPaths", + name: entry.name, + id: ctx.params.id.toString(), + html: entry.sheet ? utils.sheet_to_html(entry.sheet) : "", + }, + } +} + +export async function getStaticPaths() { + const wb = readFile(join(cwd(), "public", "sheetjs.xlsx")); + cache = wb.SheetNames.map((name) => ({ name, sheet: wb.Sheets[name] })); + return { + paths: wb.SheetNames.map((name, idx) => ({ params: { id: idx.toString() } })), + fallback: false, + }; +} diff --git a/demos/react/public/sheetjs.xlsx b/demos/react/public/sheetjs.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..25496b9bf02e58b00d3610e257610798bf251d21 GIT binary patch literal 10328 zcmeHNWl&sM+HO3!ySqEVL$Kfk*AU#@3GR)11HoN_ySuvv4-g~-2$JB=*U9ee%rLW6 z`|JC&d%EhJ>bm!R>YjU_*N>ts6f_n97Vr!J0FVQ`tl#5UKmY*QFaQ81;2Go_F*{pl z6I*9JRd;(6r?)KcY^=$0p&{wA0g&MP|2O`N-@q7X-Li)bYv35pGbDaxTAVnNy-fFD z@(az_3*q_nW&PBk^xd;VHv*T)Y5Lr%Rj#_>>kd7IcspL*=QM9bg%7Q}Z`uYqstQz= zClD^Uy+`b{fJ)lbQMHOy&&dd5SXhCx^>Aaw%ZAuW5+2B$ z8zy|ooM?f%#}c3ki7NJ(a#%uS((HId%-TV0@3mNHwxOEa@t*lo{Ta_ZS^O|nrt+JO zcspWVwZi9`Rxuhu-Qq=J0;jFr4M)M+m~{cx6k=XU$OfT_=%g%T>ltaM_Y}mSiV|n| zk;Diff7dizEP|EaB3`D%nv{*(C(pZCLoAEkEd2cYPAV^|!OvOtI*;g*`KPE9FBI0} zshsqo*eZ}eH^&%Yyx7(m1?)eEl?ktf@>*CM6uC6VNSBlW0S4U+aPe(ij-;Q7e*BJ2 z@HY8)G;U^hyFo0?4M8=eQRQC_{KMAE;^h^3*^q$8Qg%CU4rLpC=&p0;a~CO+ zGVXM)?J*3cO~pB~!|Rk1vp>YE(I#0m2;eabh=4dRQv9_C z+4~8TX}$|dg?q>^L;2(mW>T<+oD9vDD!hiQ$5S(Uvf23FgeeabSDkw6{aN ztqF*~JyN9d%_V?FX>+QNJL!Vf?qz~li|{Z@4sIaTo%hSBqWg`a<33zi%M7(xY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+0;RQhv z`Ixh%TY33563ao}0-^)a;CPd~P0$14&9{pcp{P_V%=UQUcjd;x1OlILaR8l1wXlNo z&hU}}zBi`;4EG?fo{6|n892!DEqG0#?n}w{65l`y?$6&!8fHSWW{|L1gM1qofoi7a zoUDaqFmTeg<6)%-L4zw*=bp&>vsf}67%Ck2yq7Qxh)Jro{$|@>FK(Qi#NG{u$M7+p zZq^taGY<6J5|4Ha#o&zlKd4@HhMT0+y16TH!<058V>7CUn?Yn&D3cMDrClW(HOUbx zh>Nq%$ekcfbmGE|J%Z``kN5)uk{O)w{{6YB-@fB->))KBQk4BOz@LwG{3iHw%>`@A z9}amu75sCn`;UTy;3W0mH@=_ZJZ*UXjsy??3+IpR&!@sqTSLDK6CwQ)e%dH{3h=ag z_B#MSI1&G6^Yt&aw5KRfs}aAWu;Khd`Aco$DZkNx UEDV@w007d@ADFD%)Ib0IA7+oOumAu6 literal 0 HcmV?d00001 diff --git a/demos/react/react-native.js b/demos/react/react-native.js index c29eae6..2c11a98 100644 --- a/demos/react/react-native.js +++ b/demos/react/react-native.js @@ -1,5 +1,5 @@ /* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ -import XLSX from 'xlsx'; +import * as XLSX from 'xlsx'; import React, { Component } from 'react'; import { AppRegistry, diff --git a/demos/server/drash.ts b/demos/server/drash.ts index 3ff0e9e..5446b66 100644 --- a/demos/server/drash.ts +++ b/demos/server/drash.ts @@ -1,7 +1,7 @@ /*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ -// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" -import { read, utils, set_cptable } from 'https://unpkg.com/xlsx/xlsx.mjs'; -import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; +// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" +import { read, utils, set_cptable } from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; set_cptable(cptable); import * as Drash from "https://deno.land/x/drash@v2.5.4/mod.ts"; diff --git a/docbits/10_install.md b/docbits/10_install.md index 6ae7918..41d374d 100644 --- a/docbits/10_install.md +++ b/docbits/10_install.md @@ -11,19 +11,19 @@ can be directly added to a page with a `script` tag: ``` -
- CDN Availability (click to show) - -| CDN | URL | -|-----------:|:-------------------------------------------| -| `unpkg` | | -| `jsDelivr` | | -| `CDNjs` | | - -For example, `unpkg` makes the latest version available at: +Each standalone release script is available at . The +latest version uses the `latest` tag: ```html - + + +``` + +A specific release can be referenced by version: + +```html + + ```
@@ -40,6 +40,13 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: - no support for XLSB / XLS / Lotus 1-2-3 / SpreadsheetML 2003 / Numbers - node stream utils removed +These scripts are also available on the CDN: + +```html + + +``` + @@ -79,23 +86,31 @@ set_cptable(cptable); **Deno** -`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: +`xlsx.mjs` can be imported in Deno: ```ts -// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" -import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; +// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` **NodeJS** -With [npm](https://www.npmjs.org/package/xlsx): +Modules are available on [the public npm registry](https://www.npmjs.org/package/xlsx): ```bash -$ npm install xlsx +$ pnpm install xlsx # using pnpm +$ yarn add xlsx # using yarn +$ npm install xlsx # using npm +``` + +Tarballs are also available on : + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz ``` By default, the module supports `require`: diff --git a/docbits/13_usage.md b/docbits/13_usage.md index f6d866e..4e89c14 100644 --- a/docbits/13_usage.md +++ b/docbits/13_usage.md @@ -248,7 +248,7 @@ For use in the web browser, assuming the snippet is saved to `snippet.js`, script tags should be used to include the `axios` and `xlsx` standalone builds: ```html - + ``` diff --git a/docbits/16_demos.md b/docbits/16_demos.md index 44ecf89..43e7ba1 100644 --- a/docbits/16_demos.md +++ b/docbits/16_demos.md @@ -7,8 +7,8 @@ The [`demos` directory](demos/) includes sample projects for: - [`angular and ionic`](demos/angular2/) - [`knockout`](demos/knockout/) - [`meteor`](demos/meteor/) -- [`react and react-native`](demos/react/) -- [`vue 2.x and weex`](demos/vue/) +- [`react, react-native, next`](demos/react/) +- [`vue 2.x, weex, nuxt`](demos/vue/) - [`XMLHttpRequest and fetch`](demos/xhr/) - [`nodejs server`](demos/server/) - [`databases and key/value stores`](demos/database/) diff --git a/docbits/22_ingress.md b/docbits/22_ingress.md index f5edbf9..0b58a00 100644 --- a/docbits/22_ingress.md +++ b/docbits/22_ingress.md @@ -152,8 +152,8 @@ Here are a few common scenarios (click on each subtitle to see the code): ```html - - + +
@@ -299,7 +299,7 @@ var code = [ "function(){", page.open('https://sheetjs.com/demos/table', function() { /* Load the browser script from the UNPKG CDN */ - page.includeJs("https://unpkg.com/xlsx/dist/xlsx.full.min.js", function() { + page.includeJs("https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js", function() { /* The code will return an XLSB file encoded as binary string */ var bin = page.evaluateJavaScript(code); diff --git a/docbits/32_egress.md b/docbits/32_egress.md index 3189914..37ea3dc 100644 --- a/docbits/32_egress.md +++ b/docbits/32_egress.md @@ -169,7 +169,7 @@ Combining with `fetch`, constructing a site from a workbook is straightforward:
- + ``` - -| CDN | URL | -|-----------:|:-------------------------------------------| -| `unpkg` | | -| `jsDelivr` | | -| `CDNjs` | | - -For example, `unpkg` makes the latest version available at: +Each standalone release script is available at . The +latest version uses the `latest` tag: ```html - + + +``` + +A specific release can be referenced by version: + +```html + + ``` @@ -146,6 +148,13 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: - no support for XLSB / XLS / Lotus 1-2-3 / SpreadsheetML 2003 / Numbers - node stream utils removed +These scripts are also available on the CDN: + +```html + + +``` + With [bower](https://bower.io/search/?q=js-xlsx): @@ -184,23 +193,31 @@ set_cptable(cptable); **Deno** -`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: +`xlsx.mjs` can be imported in Deno: ```ts -// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" -import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; +// @deno-types="https://cdn.sheetjs.com/xlsx-latest/package/types/index.d.ts" +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-latest/package/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; +import * as cptable from 'https://cdn.sheetjs.com/xlsx-latest/package/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` **NodeJS** -With [npm](https://www.npmjs.org/package/xlsx): +Modules are available on [the public npm registry](https://www.npmjs.org/package/xlsx): ```bash -$ npm install xlsx +$ pnpm install xlsx # using pnpm +$ yarn add xlsx # using yarn +$ npm install xlsx # using npm +``` + +Tarballs are also available on : + +```bash +$ npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz ``` By default, the module supports `require`: @@ -505,7 +522,7 @@ For use in the web browser, assuming the snippet is saved to `snippet.js`, script tags should be used to include the `axios` and `xlsx` standalone builds: ```html - + ``` @@ -533,8 +550,8 @@ The [`demos` directory](demos/) includes sample projects for: - [`angular and ionic`](demos/angular2/) - [`knockout`](demos/knockout/) - [`meteor`](demos/meteor/) -- [`react and react-native`](demos/react/) -- [`vue 2.x and weex`](demos/vue/) +- [`react, react-native, next`](demos/react/) +- [`vue 2.x, weex, nuxt`](demos/vue/) - [`XMLHttpRequest and fetch`](demos/xhr/) - [`nodejs server`](demos/server/) - [`databases and key/value stores`](demos/database/) @@ -1124,8 +1141,8 @@ Here are a few common scenarios (click on each subtitle to see the code): ```html - - + +
@@ -1262,7 +1279,7 @@ var code = [ "function(){", page.open('https://sheetjs.com/demos/table', function() { /* Load the browser script from the UNPKG CDN */ - page.includeJs("https://unpkg.com/xlsx/dist/xlsx.full.min.js", function() { + page.includeJs("https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js", function() { /* The code will return an XLSB file encoded as binary string */ var bin = page.evaluateJavaScript(code); @@ -1867,7 +1884,7 @@ Combining with `fetch`, constructing a site from a workbook is straightforward:
- +