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

Add Vue 3 demo to examples #10245

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1c8e86f
HoT Vue3 demo
maciejbo-handsontable Feb 9, 2023
899fbeb
HoT Vue3 demo
maciejbo-handsontable Feb 9, 2023
8ce800a
Vue 3 demo improvements
maciejbo-handsontable Feb 13, 2023
a180ab0
use vue 3 app builder in vue 3 demo
maciejbo-handsontable Feb 15, 2023
253d107
improvements after CR
maciejbo-handsontable Feb 16, 2023
6bbaaca
improvements after CR
maciejbo-handsontable Feb 16, 2023
c143ccf
change single quote to double quote
maciejbo-handsontable Feb 16, 2023
676b205
unify Vue 3 demo progress bar with Vue 2
maciejbo-handsontable Feb 16, 2023
4ded335
Merge branch 'develop' into feature/issue-dev-1072
jansiegel Mar 10, 2023
ea450e5
- Correct the examples' install and build scripts to acknowledge the …
jansiegel Mar 10, 2023
98ea9bc
Correct the types import
jansiegel Mar 10, 2023
30f4d36
Bump the vue-tsc package.
jansiegel Mar 10, 2023
28603da
Bump the vue and vite dependencies.
jansiegel Mar 10, 2023
8d8cfef
Added missing subpackage
wszymanski Mar 16, 2023
4617d31
Minor change for purpose of running CI
wszymanski Mar 16, 2023
071d2fe
Change in GitHub workflow
wszymanski Mar 16, 2023
42f2045
Next changes related to distinguishing Vue3 from <Vue2
wszymanski Mar 16, 2023
edbae9a
Trying to add debugger
wszymanski Mar 16, 2023
a033161
Removed debugging entry for tmate within GitHub action and removed pa…
wszymanski Mar 20, 2023
47fd90d
Mocked npm script for a while
wszymanski Mar 20, 2023
6b27a65
Merge branch 'develop' into feature/issue-dev-1072
wszymanski Mar 20, 2023
cb7a29a
Copied smoke tests from Vue repo
wszymanski Mar 20, 2023
2227683
Merge branch 'feature/issue-dev-1072' of github.com:handsontable/hand…
wszymanski Mar 20, 2023
a9d9e2e
Minor change in test for purpose of preparing it for implementation i…
wszymanski Mar 20, 2023
afa320d
Added missing dependencies for testing
wszymanski Mar 20, 2023
f4bbebe
Reverted some unnecessary changes
wszymanski Mar 20, 2023
ee04e07
Change: Expose Vite to 8080 port for default WSL compatibility
May 23, 2023
15eda86
Merge branch 'develop' of github.com:handsontable/handsontable into f…
May 23, 2023
7c1d43c
Use CSS instead of SASS in DataGrid component
May 24, 2023
01a8f1b
Merge branch 'develop' into feature/issue-dev-1072
wszymanski May 26, 2023
c2deac9
Merge branch 'develop' into feature/issue-dev-1072
wszymanski Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/code-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ jobs:
if: |
matrix.version == 'next' &&
steps.path-check.outputs.n-a != 'true' &&
startsWith(matrix.framework, 'vue')
endsWith(matrix.framework, 'vue')
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # https://github.com/actions/download-artifact/releases/tag/v3.0.1
with:
name: vue-build
Expand All @@ -436,14 +436,14 @@ jobs:
if: |
matrix.version == 'next' &&
steps.path-check.outputs.n-a != 'true' &&
startsWith(matrix.framework, 'vue')
endsWith(matrix.framework, 'vue')

# Downloading the @handsontable/vue3 build
- name: Download the @handsontable/vue3 build artifact
if: |
matrix.version == 'next' &&
steps.path-check.outputs.n-a != 'true' &&
startsWith(matrix.framework, 'vue')
startsWith(matrix.framework, 'vue3')
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # https://github.com/actions/download-artifact/releases/tag/v3.0.1
with:
name: vue3-build
Expand All @@ -452,7 +452,7 @@ jobs:
if: |
matrix.version == 'next' &&
steps.path-check.outputs.n-a != 'true' &&
startsWith(matrix.framework, 'vue')
startsWith(matrix.framework, 'vue3')

# Setup symlinks for the needed packages
- run: |
Expand Down
28 changes: 28 additions & 0 deletions examples/next/docs/vue3/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
40 changes: 40 additions & 0 deletions examples/next/docs/vue3/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# HoT Vue3 demo

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:

1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```
1 change: 1 addition & 0 deletions examples/next/docs/vue3/demo/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions examples/next/docs/vue3/demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
65 changes: 65 additions & 0 deletions examples/next/docs/vue3/demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "hot-vue3-demo",
"version": "0.0.0",
"private": true,
"homepage": "https://handsontable.com/.",
"repository": {
"type": "git",
"url": "https://github.com/handsontable/handsontable.git"
},
"bugs": {
"url": "https://github.com/handsontable/handsontable/issues"
},
"author": "Handsoncode <hello@handsontable.com>",
"scripts": {
"build": "run-p type-check build-only",
"build-only": "vite build",
"dev": "vite",
"preview": "vite preview --port 8080 --host",
"start": "vite --port 8080 --host",
"test": "node spec/support/jasmine.config.js",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@handsontable/vue3": "latest",
"handsontable": "latest",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@types/node": "^18.11.12",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vue/tsconfig": "^0.1.3",
"jasmine": "^4.6.0",
"jasmine-console-reporter": "^3.1.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^19.7.5",
"typescript": "~4.7.4",
"vite": "^4.1.4",
"vue-tsc": "^1.3.0"
},
"license": "SEE LICENSE IN LICENSE.txt",
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript"
],
"rules": {},
"parserOptions": {
"parser": "@typescript-eslint/parser"
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Binary file added examples/next/docs/vue3/demo/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions examples/next/docs/vue3/demo/spec/Smoke.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable */
const puppeteer = require('puppeteer');

describe('Smoke check', () => {
let browser = null;
let page = null;
const BASE_URL = process.env.TEST_URL || 'http://localhost:8080';

beforeEach(async () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
// browser = await puppeteer.launch({ headless: false, slowMo: 250, devtools: true });
browser = await puppeteer.launch();
page = await browser.newPage();
await page.goto(BASE_URL);
}, 90000);

afterEach(async () => {
await browser.close();
});

it('should render Handsontable', async () => {
const hotCell = await page.$('.handsontable td');

await expect(hotCell).toBeTruthy();
});

it('should use progressBarRenderer', async () => {
const progressBarRendererCell = await page.$('.handsontable tbody tr td:nth-child(7) .progressBar');
const progressBarRendererCellContent = await progressBarRendererCell.evaluate(el => el.getAttribute('style'));

await expect(progressBarRendererCellContent).toBe('width: 20px');
});

it('should use startRenderer', async () => {
const startRendererCell = await page.$('.handsontable tbody tr td:nth-child(8)');
const startRendererCellContent = await startRendererCell.evaluate(el => el.textContent);

await expect(startRendererCellContent).toBe('★★');
});
});
52 changes: 52 additions & 0 deletions examples/next/docs/vue3/demo/spec/support/jasmine.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// setup Jasmine
const path = require('path');
const { createServer } = require('http-server');
const Jasmine = require('jasmine');

const jasmine = new Jasmine();

jasmine.loadConfig({
spec_dir: 'spec',
spec_files: ['**/*[sS]pec.js'],
helpers: ['helpers/**/*.js'],
random: true,
stopSpecOnExpectationFailure: false
});
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;

// setup terminal reporter
const JasmineReporter = require('jasmine-console-reporter');
const reporter = new JasmineReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
listStyle: 'indent',
timeUnit: 'ms',
timeThreshold: { ok: 500, warn: 1000, ouch: 3000 },
activity: false,
emoji: true,
beep: true
});

// initialize and execute
jasmine.env.clearReporters();
jasmine.addReporter(reporter);
jasmine.execute();

let server;

beforeAll(() => {
if (!process.env.TEST_URL) {
server = createServer({
root: path.resolve(`${__dirname}`, '../../dist'),
showDir: true,
autoIndex: true,
});

server.listen('8080');
}
});

afterAll(() => {
server?.close();
});
17 changes: 17 additions & 0 deletions examples/next/docs/vue3/demo/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div>
<DataGrid />
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import DataGrid from "./components/DataGrid.vue";

export default defineComponent({
name: "HoT vue 3 demo",
components: {
DataGrid
}
});
</script>