From e749f314f3a92f60b6308be47d10da70ffe953a6 Mon Sep 17 00:00:00 2001 From: Radu Suciu Date: Mon, 1 Jul 2024 12:58:44 -0700 Subject: [PATCH] docs(vue): vue filters example (#5644) * examples: vue filters * run through prettier * add missing components * fix typing issue * add docs link to new example --- docs/config.json | 4 + examples/vue/filters/.gitignore | 24 ++ examples/vue/filters/README.md | 6 + examples/vue/filters/env.d.ts | 1 + examples/vue/filters/index.html | 14 ++ examples/vue/filters/package.json | 23 ++ examples/vue/filters/public/favicon.ico | Bin 0 -> 4286 bytes examples/vue/filters/src/App.vue | 230 ++++++++++++++++++++ examples/vue/filters/src/DebouncedInput.vue | 38 ++++ examples/vue/filters/src/Filter.vue | 82 +++++++ examples/vue/filters/src/main.ts | 4 + examples/vue/filters/tsconfig.json | 24 ++ examples/vue/filters/vite.config.ts | 7 + pnpm-lock.yaml | 28 +++ 14 files changed, 485 insertions(+) create mode 100644 examples/vue/filters/.gitignore create mode 100644 examples/vue/filters/README.md create mode 100644 examples/vue/filters/env.d.ts create mode 100644 examples/vue/filters/index.html create mode 100644 examples/vue/filters/package.json create mode 100644 examples/vue/filters/public/favicon.ico create mode 100644 examples/vue/filters/src/App.vue create mode 100644 examples/vue/filters/src/DebouncedInput.vue create mode 100644 examples/vue/filters/src/Filter.vue create mode 100644 examples/vue/filters/src/main.ts create mode 100644 examples/vue/filters/tsconfig.json create mode 100644 examples/vue/filters/vite.config.ts diff --git a/docs/config.json b/docs/config.json index 6243d87d59..a68056d734 100644 --- a/docs/config.json +++ b/docs/config.json @@ -724,6 +724,10 @@ { "to": "framework/vue/examples/sub-components", "label": "Sub Components" + }, + { + "to": "framework/vue/examples/filters", + "label": "Column Filters" } ] } diff --git a/examples/vue/filters/.gitignore b/examples/vue/filters/.gitignore new file mode 100644 index 0000000000..a547bf36d8 --- /dev/null +++ b/examples/vue/filters/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/examples/vue/filters/README.md b/examples/vue/filters/README.md new file mode 100644 index 0000000000..3ac3f1a9b4 --- /dev/null +++ b/examples/vue/filters/README.md @@ -0,0 +1,6 @@ +# Example + +To run this example: + +- `npm install` or `yarn` +- `npm run dev` or `yarn dev` diff --git a/examples/vue/filters/env.d.ts b/examples/vue/filters/env.d.ts new file mode 100644 index 0000000000..11f02fe2a0 --- /dev/null +++ b/examples/vue/filters/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/vue/filters/index.html b/examples/vue/filters/index.html new file mode 100644 index 0000000000..e160e46247 --- /dev/null +++ b/examples/vue/filters/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite App + + + +
+ + + diff --git a/examples/vue/filters/package.json b/examples/vue/filters/package.json new file mode 100644 index 0000000000..d9da7af2fa --- /dev/null +++ b/examples/vue/filters/package.json @@ -0,0 +1,23 @@ +{ + "name": "tanstack-table-example-vue-filters", + "private": true, + "version": "0.0.0", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "test:types": "vue-tsc" + }, + "dependencies": { + "@faker-js/faker": "^8.4.1", + "vue": "^3.4.31", + "@tanstack/vue-table": "^8.19.2" + }, + "devDependencies": { + "@types/node": "^20.14.9", + "@vitejs/plugin-vue": "^5.0.5", + "typescript": "5.4.5", + "vite": "^5.3.2", + "vue-tsc": "^2.0.22" + } +} diff --git a/examples/vue/filters/public/favicon.ico b/examples/vue/filters/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 diff --git a/examples/vue/filters/src/App.vue b/examples/vue/filters/src/App.vue new file mode 100644 index 0000000000..967c384957 --- /dev/null +++ b/examples/vue/filters/src/App.vue @@ -0,0 +1,230 @@ + + + + diff --git a/examples/vue/filters/src/DebouncedInput.vue b/examples/vue/filters/src/DebouncedInput.vue new file mode 100644 index 0000000000..a15b6a86b7 --- /dev/null +++ b/examples/vue/filters/src/DebouncedInput.vue @@ -0,0 +1,38 @@ + + + diff --git a/examples/vue/filters/src/Filter.vue b/examples/vue/filters/src/Filter.vue new file mode 100644 index 0000000000..71bb83e48c --- /dev/null +++ b/examples/vue/filters/src/Filter.vue @@ -0,0 +1,82 @@ + + + diff --git a/examples/vue/filters/src/main.ts b/examples/vue/filters/src/main.ts new file mode 100644 index 0000000000..01433bca2a --- /dev/null +++ b/examples/vue/filters/src/main.ts @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/examples/vue/filters/tsconfig.json b/examples/vue/filters/tsconfig.json new file mode 100644 index 0000000000..0b8e08b465 --- /dev/null +++ b/examples/vue/filters/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] +} diff --git a/examples/vue/filters/vite.config.ts b/examples/vue/filters/vite.config.ts new file mode 100644 index 0000000000..05c17402a4 --- /dev/null +++ b/examples/vue/filters/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35c670abe4..b0a11a17ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2700,6 +2700,34 @@ importers: specifier: ^2.0.22 version: 2.0.22(typescript@5.4.5) + examples/vue/filters: + dependencies: + '@faker-js/faker': + specifier: ^8.4.1 + version: 8.4.1 + '@tanstack/vue-table': + specifier: ^8.19.2 + version: link:../../../packages/vue-table + vue: + specifier: ^3.4.31 + version: 3.4.31(typescript@5.4.5) + devDependencies: + '@types/node': + specifier: ^20.14.9 + version: 20.14.9 + '@vitejs/plugin-vue': + specifier: ^5.0.5 + version: 5.0.5(vite@5.3.2(@types/node@20.14.9)(less@4.2.0)(sass@1.77.6)(terser@5.31.1))(vue@3.4.31(typescript@5.4.5)) + typescript: + specifier: 5.4.5 + version: 5.4.5 + vite: + specifier: ^5.3.2 + version: 5.3.2(@types/node@20.14.9)(less@4.2.0)(sass@1.77.6)(terser@5.31.1) + vue-tsc: + specifier: ^2.0.22 + version: 2.0.22(typescript@5.4.5) + examples/vue/pagination: dependencies: '@faker-js/faker':