gridjs-spreadsheet 26.6.2 → 26.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular.d.ts +67 -0
- package/angular.js +174 -0
- package/example/README.md +242 -41
- package/example/angular-gridjs/.nvmrc +1 -0
- package/example/angular-gridjs/angular.json +66 -0
- package/example/angular-gridjs/package.json +31 -0
- package/example/angular-gridjs/proxy.conf.json +12 -0
- package/example/angular-gridjs/src/app/api.ts +7 -0
- package/example/angular-gridjs/src/app/app.component.html +57 -0
- package/example/angular-gridjs/src/app/app.component.ts +153 -0
- package/example/angular-gridjs/src/app/routing.ts +52 -0
- package/example/angular-gridjs/src/favicon.ico +0 -0
- package/example/angular-gridjs/src/index.html +12 -0
- package/example/angular-gridjs/src/main.ts +7 -0
- package/example/angular-gridjs/src/styles.css +37 -0
- package/example/angular-gridjs/tsconfig.app.json +9 -0
- package/example/angular-gridjs/tsconfig.json +29 -0
- package/example/pom.xml +3 -3
- package/example/react-gridjs/index.html +12 -0
- package/example/react-gridjs/package.json +20 -0
- package/example/react-gridjs/src/App.jsx +188 -0
- package/example/react-gridjs/src/api.js +7 -0
- package/example/react-gridjs/src/main.jsx +9 -0
- package/example/react-gridjs/src/routing.js +51 -0
- package/example/react-gridjs/src/styles.css +37 -0
- package/example/react-gridjs/vite.config.js +16 -0
- package/example/src/main/java/com/aspose/gridjs/demo/controller/DataController.java +80 -2
- package/example/src/main/java/com/aspose/gridjs/demo/controller/GridJs2Controller.java +12 -0
- package/example/vanilla-gridjs/npm/index.html +29 -0
- package/example/vanilla-gridjs/npm/main.js +8 -0
- package/example/vanilla-gridjs/npm/package.json +16 -0
- package/example/vanilla-gridjs/npm/vite.config.js +11 -0
- package/example/vanilla-gridjs/script/index.html +32 -0
- package/example/vanilla-gridjs/script/main.js +9 -0
- package/example/vanilla-gridjs/script/package.json +12 -0
- package/example/vanilla-gridjs/script/vite.config.js +11 -0
- package/example/vanilla-gridjs/shared/demo-app.js +205 -0
- package/example/vanilla-gridjs/shared/styles.css +36 -0
- package/example/vue-gridjs/index.html +12 -0
- package/example/vue-gridjs/package.json +19 -0
- package/example/vue-gridjs/src/App.vue +199 -0
- package/example/vue-gridjs/src/api.js +7 -0
- package/example/vue-gridjs/src/main.js +9 -0
- package/example/vue-gridjs/src/routing.js +51 -0
- package/example/vue-gridjs/src/styles.css +37 -0
- package/example/vue-gridjs/vite.config.js +21 -0
- package/index.d.ts +58 -1
- package/index.js +1 -1
- package/package.json +143 -50
- package/react.d.ts +27 -0
- package/react.js +111 -0
- package/readme.md +183 -384
- package/shared.d.ts +66 -0
- package/shared.js +204 -0
- package/vue.d.ts +20 -0
- package/vue.js +125 -0
- package/xspreadsheet.css +7 -0
- package/xspreadsheet.js +3 -3
- package/example/.mvn/wrapper/maven-wrapper.properties +0 -18
- package/example/src/test/java/com/aspose/gridjs/demo/GridjsdemoApplicationTests.java +0 -1441
package/angular.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AfterViewInit,
|
|
3
|
+
ElementRef,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
NgZone,
|
|
6
|
+
OnChanges,
|
|
7
|
+
OnDestroy,
|
|
8
|
+
SimpleChanges,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import type * as i0 from '@angular/core';
|
|
11
|
+
import type Spreadsheet from 'gridjs-spreadsheet';
|
|
12
|
+
import type { GridJsAdapter } from './shared';
|
|
13
|
+
|
|
14
|
+
export declare class GridJsSpreadsheetComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|
15
|
+
apiBase: string;
|
|
16
|
+
data: Record<string, any> | null;
|
|
17
|
+
loader: (() => Promise<Record<string, any>> | Record<string, any>) | null;
|
|
18
|
+
mode: 'edit' | 'read';
|
|
19
|
+
locale: string;
|
|
20
|
+
token: string;
|
|
21
|
+
height: string;
|
|
22
|
+
showToolbar: boolean;
|
|
23
|
+
showContextmenu: boolean;
|
|
24
|
+
ready: EventEmitter<{ instance: Spreadsheet; adapter: GridJsAdapter }>;
|
|
25
|
+
change: EventEmitter<any[]>;
|
|
26
|
+
error: EventEmitter<any>;
|
|
27
|
+
cellSelected: EventEmitter<any[]>;
|
|
28
|
+
cellEdited: EventEmitter<any[]>;
|
|
29
|
+
sheetSelected: EventEmitter<any[]>;
|
|
30
|
+
sheetLoaded: EventEmitter<any[]>;
|
|
31
|
+
constructor(zone: NgZone, platformId: object, elementRef: ElementRef<HTMLElement>);
|
|
32
|
+
ngAfterViewInit(): void;
|
|
33
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
34
|
+
ngOnDestroy(): void;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GridJsSpreadsheetComponent, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
37
|
+
GridJsSpreadsheetComponent,
|
|
38
|
+
'gridjs-spreadsheet',
|
|
39
|
+
never,
|
|
40
|
+
{
|
|
41
|
+
apiBase: { alias: 'apiBase'; required: false };
|
|
42
|
+
data: { alias: 'data'; required: false };
|
|
43
|
+
loader: { alias: 'loader'; required: false };
|
|
44
|
+
mode: { alias: 'mode'; required: false };
|
|
45
|
+
locale: { alias: 'locale'; required: false };
|
|
46
|
+
token: { alias: 'token'; required: false };
|
|
47
|
+
height: { alias: 'height'; required: false };
|
|
48
|
+
showToolbar: { alias: 'showToolbar'; required: false };
|
|
49
|
+
showContextmenu: { alias: 'showContextmenu'; required: false };
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
ready: 'ready';
|
|
53
|
+
change: 'change';
|
|
54
|
+
error: 'error';
|
|
55
|
+
cellSelected: 'cellSelected';
|
|
56
|
+
cellEdited: 'cellEdited';
|
|
57
|
+
sheetSelected: 'sheetSelected';
|
|
58
|
+
sheetLoaded: 'sheetLoaded';
|
|
59
|
+
},
|
|
60
|
+
never,
|
|
61
|
+
never,
|
|
62
|
+
true,
|
|
63
|
+
never
|
|
64
|
+
>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default GridJsSpreadsheetComponent;
|
package/angular.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ElementRef,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
NgZone,
|
|
6
|
+
PLATFORM_ID,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import * as i0 from '@angular/core';
|
|
9
|
+
import { createGridJsAdapter } from './shared.js';
|
|
10
|
+
|
|
11
|
+
function clonePlain(value) {
|
|
12
|
+
if (typeof structuredClone === 'function') {
|
|
13
|
+
return structuredClone(value);
|
|
14
|
+
}
|
|
15
|
+
return JSON.parse(JSON.stringify(value));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function importGridJs() {
|
|
19
|
+
return import('gridjs-spreadsheet');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class GridJsSpreadsheetComponent {
|
|
23
|
+
apiBase = '';
|
|
24
|
+
data = null;
|
|
25
|
+
loader = null;
|
|
26
|
+
mode = 'edit';
|
|
27
|
+
locale = 'en';
|
|
28
|
+
token = '';
|
|
29
|
+
height = 'calc(100vh - 96px)';
|
|
30
|
+
showToolbar = true;
|
|
31
|
+
showContextmenu = true;
|
|
32
|
+
|
|
33
|
+
ready = new EventEmitter();
|
|
34
|
+
change = new EventEmitter();
|
|
35
|
+
error = new EventEmitter();
|
|
36
|
+
cellSelected = new EventEmitter();
|
|
37
|
+
cellEdited = new EventEmitter();
|
|
38
|
+
sheetSelected = new EventEmitter();
|
|
39
|
+
sheetLoaded = new EventEmitter();
|
|
40
|
+
|
|
41
|
+
adapter = null;
|
|
42
|
+
viewReady = false;
|
|
43
|
+
lastMountKey = '';
|
|
44
|
+
|
|
45
|
+
constructor(zone, platformId, elementRef) {
|
|
46
|
+
this.zone = zone;
|
|
47
|
+
this.isBrowser = isPlatformBrowser(platformId);
|
|
48
|
+
this.hostElement = elementRef.nativeElement;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ngAfterViewInit() {
|
|
52
|
+
this.viewReady = true;
|
|
53
|
+
void this.mountIfNeeded();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
ngOnChanges(changes) {
|
|
57
|
+
if (changes.token && !changes.token.firstChange && this.adapter && this.token) {
|
|
58
|
+
this.adapter.refreshToken(this.token);
|
|
59
|
+
}
|
|
60
|
+
if (this.viewReady) {
|
|
61
|
+
void this.mountIfNeeded();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
ngOnDestroy() {
|
|
66
|
+
this.adapter?.destroy();
|
|
67
|
+
this.adapter = null;
|
|
68
|
+
if (this.hostElement) {
|
|
69
|
+
this.hostElement.innerHTML = '';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async mountIfNeeded() {
|
|
74
|
+
if (!this.isBrowser || !this.hostElement || (!this.data && !this.loader)) return;
|
|
75
|
+
|
|
76
|
+
const mountKey = [
|
|
77
|
+
this.data?.uniqueid || this.data?.filename || 'loader',
|
|
78
|
+
this.apiBase,
|
|
79
|
+
this.mode,
|
|
80
|
+
this.locale,
|
|
81
|
+
String(this.showToolbar),
|
|
82
|
+
String(this.showContextmenu),
|
|
83
|
+
].join('|');
|
|
84
|
+
|
|
85
|
+
if (mountKey === this.lastMountKey && this.adapter) return;
|
|
86
|
+
this.lastMountKey = mountKey;
|
|
87
|
+
|
|
88
|
+
this.adapter?.destroy();
|
|
89
|
+
this.hostElement.innerHTML = '';
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const plainData = this.data ? clonePlain(this.data) : undefined;
|
|
93
|
+
this.adapter = await this.zone.runOutsideAngular(() => createGridJsAdapter({
|
|
94
|
+
container: this.hostElement,
|
|
95
|
+
apiBase: this.apiBase,
|
|
96
|
+
data: plainData,
|
|
97
|
+
loader: this.loader,
|
|
98
|
+
mode: this.mode,
|
|
99
|
+
locale: this.locale,
|
|
100
|
+
token: this.token,
|
|
101
|
+
showToolbar: this.showToolbar,
|
|
102
|
+
showContextmenu: this.showContextmenu,
|
|
103
|
+
callbacks: {
|
|
104
|
+
ready: (instance, activeAdapter) => this.zone.run(() => this.ready.emit({ instance, adapter: activeAdapter })),
|
|
105
|
+
change: (...args) => this.zone.run(() => this.change.emit(args)),
|
|
106
|
+
error: payload => this.zone.run(() => this.error.emit(payload)),
|
|
107
|
+
cellSelected: (...args) => this.zone.run(() => this.cellSelected.emit(args)),
|
|
108
|
+
cellEdited: (...args) => this.zone.run(() => this.cellEdited.emit(args)),
|
|
109
|
+
sheetSelected: (...args) => this.zone.run(() => this.sheetSelected.emit(args)),
|
|
110
|
+
sheetLoaded: (...args) => this.zone.run(() => this.sheetLoaded.emit(args)),
|
|
111
|
+
},
|
|
112
|
+
dependencies: {
|
|
113
|
+
importJSZip: () => import('jszip'),
|
|
114
|
+
importGridJs,
|
|
115
|
+
},
|
|
116
|
+
}));
|
|
117
|
+
} catch (error) {
|
|
118
|
+
this.error.emit({ type: 'mountError', error });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Partial compilation format (ɵɵngDeclareFactory / ɵɵngDeclareComponent).
|
|
124
|
+
// Angular's linker re-compiles these declarations at the consuming application's
|
|
125
|
+
// build time, so they remain compatible across Angular major versions.
|
|
126
|
+
// Do NOT use ɵɵdefineComponent here — that is a private, fully-linked runtime
|
|
127
|
+
// format that is not guaranteed to be stable across Angular releases.
|
|
128
|
+
GridJsSpreadsheetComponent.ɵfac = /* @__PURE__ */ i0.ɵɵngDeclareFactory({
|
|
129
|
+
minVersion: '12.0.0',
|
|
130
|
+
version: '16.0.0',
|
|
131
|
+
ngImport: i0,
|
|
132
|
+
type: GridJsSpreadsheetComponent,
|
|
133
|
+
deps: [
|
|
134
|
+
{ token: NgZone },
|
|
135
|
+
{ token: PLATFORM_ID },
|
|
136
|
+
{ token: ElementRef },
|
|
137
|
+
],
|
|
138
|
+
target: i0.ɵɵFactoryTarget.Component,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
GridJsSpreadsheetComponent.ɵcmp = /* @__PURE__ */ i0.ɵɵngDeclareComponent({
|
|
142
|
+
minVersion: '14.0.0',
|
|
143
|
+
version: '16.0.0',
|
|
144
|
+
type: GridJsSpreadsheetComponent,
|
|
145
|
+
isStandalone: true,
|
|
146
|
+
selector: 'gridjs-spreadsheet',
|
|
147
|
+
inputs: {
|
|
148
|
+
apiBase: 'apiBase',
|
|
149
|
+
data: 'data',
|
|
150
|
+
loader: 'loader',
|
|
151
|
+
mode: 'mode',
|
|
152
|
+
locale: 'locale',
|
|
153
|
+
token: 'token',
|
|
154
|
+
height: 'height',
|
|
155
|
+
showToolbar: 'showToolbar',
|
|
156
|
+
showContextmenu: 'showContextmenu',
|
|
157
|
+
},
|
|
158
|
+
outputs: {
|
|
159
|
+
ready: 'ready',
|
|
160
|
+
change: 'change',
|
|
161
|
+
error: 'error',
|
|
162
|
+
cellSelected: 'cellSelected',
|
|
163
|
+
cellEdited: 'cellEdited',
|
|
164
|
+
sheetSelected: 'sheetSelected',
|
|
165
|
+
sheetLoaded: 'sheetLoaded',
|
|
166
|
+
},
|
|
167
|
+
usesOnChanges: true,
|
|
168
|
+
ngImport: i0,
|
|
169
|
+
template: '',
|
|
170
|
+
styles: [':host{display:block;width:100%;background:#fff;}'],
|
|
171
|
+
changeDetection: i0.ChangeDetectionStrategy.Default,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export default GridJsSpreadsheetComponent;
|
package/example/README.md
CHANGED
|
@@ -1,71 +1,272 @@
|
|
|
1
|
-
|
|
1
|
+
# Aspose.Cells GridJs Java framework examples
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This directory contains one Spring Boot backend shared by five independent frontend demos:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
| Demo | Directory | Development URL |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| React | `react-gridjs` | `http://127.0.0.1:5173` |
|
|
8
|
+
| Vue 3 | `vue-gridjs` | `http://127.0.0.1:5174` |
|
|
9
|
+
| Angular | `angular-gridjs` | `http://127.0.0.1:4200` |
|
|
10
|
+
| Vanilla HTML with npm | `vanilla-gridjs/npm` | `http://127.0.0.1:5175` |
|
|
11
|
+
| Vanilla HTML with CDN scripts | `vanilla-gridjs/script` | `http://127.0.0.1:5176` |
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
The frontend files are served by Vite or Angular CLI during development. They are not copied into the Java application. Each development server proxies GridJS API requests to the Java backend on port 8080.
|
|
9
14
|
|
|
10
|
-
##
|
|
15
|
+
## Requirements
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
- Java 8 or newer
|
|
18
|
+
- Node.js 18 or newer
|
|
19
|
+
- npm
|
|
20
|
+
- Angular demo: Node.js 18, 20, or 22
|
|
21
|
+
|
|
22
|
+
## Configure the Java backend
|
|
23
|
+
|
|
24
|
+
Edit `src/main/resources/application.properties` when the default local paths do not match your environment:
|
|
13
25
|
|
|
14
|
-
## How to Run the Examples
|
|
15
|
-
###1.edit the properties in src\main\resources\application.properties to meet your local environment
|
|
16
26
|
```properties
|
|
17
|
-
|
|
18
|
-
testconfig.
|
|
27
|
+
testconfig.ListDir=/path/to/workbooks
|
|
28
|
+
testconfig.CachePath=/path/to/grid_cache
|
|
29
|
+
testconfig.UploadPath=/path/to/upload
|
|
30
|
+
testconfig.AsposeLicensePath=/path/to/license
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The repository example already contains local `wb`, `grid_cache`, and `upload` directories for development.
|
|
34
|
+
|
|
35
|
+
## 1. Start the Java backend
|
|
36
|
+
|
|
37
|
+
Open the first terminal in this `example` directory.
|
|
38
|
+
|
|
39
|
+
macOS or Linux:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
./mvnw spring-boot:run -Dmaven.test.skip=true
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Windows:
|
|
46
|
+
|
|
47
|
+
```bat
|
|
48
|
+
mvnw.cmd spring-boot:run -Dmaven.test.skip=true
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Wait until Spring Boot is listening on:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
http://127.0.0.1:8080
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Backend health endpoint:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
http://127.0.0.1:8080/gridjsdemo/api/health
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The legacy server-rendered Java page remains available at:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
http://127.0.0.1:8080/gridjsdemo/list
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 2. Start a frontend
|
|
70
|
+
|
|
71
|
+
Open a second terminal. Install dependencies inside the selected frontend folder, then run its npm development command.
|
|
19
72
|
|
|
20
|
-
|
|
21
|
-
testconfig.CachePath=/app/grid_cache
|
|
73
|
+
### React
|
|
22
74
|
|
|
23
|
-
|
|
24
|
-
|
|
75
|
+
```bash
|
|
76
|
+
cd react-gridjs
|
|
77
|
+
npm install
|
|
78
|
+
npm run dev
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Open `http://127.0.0.1:5173`.
|
|
82
|
+
|
|
83
|
+
The application imports:
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import { GridJsSpreadsheet } from 'gridjs-spreadsheet/react';
|
|
87
|
+
import 'gridjs-spreadsheet/xspreadsheet.css';
|
|
88
|
+
```
|
|
25
89
|
|
|
26
|
-
|
|
27
|
-
|
|
90
|
+
### Vue 3
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
cd vue-gridjs
|
|
94
|
+
npm install
|
|
95
|
+
npm run dev
|
|
28
96
|
```
|
|
29
|
-
###2.run src\main\java\com\aspose\gridjs\demo\GridjsdemoApplication.java
|
|
30
97
|
|
|
31
|
-
|
|
98
|
+
Open `http://127.0.0.1:5174`.
|
|
99
|
+
|
|
100
|
+
The application imports:
|
|
32
101
|
|
|
33
|
-
|
|
102
|
+
```js
|
|
103
|
+
import { GridJsSpreadsheet } from 'gridjs-spreadsheet/vue';
|
|
104
|
+
import 'gridjs-spreadsheet/xspreadsheet.css';
|
|
105
|
+
```
|
|
34
106
|
|
|
35
|
-
|
|
107
|
+
### Angular
|
|
36
108
|
|
|
37
|
-
|
|
109
|
+
Use Node.js 18, 20, or 22:
|
|
38
110
|
|
|
39
111
|
```bash
|
|
40
|
-
|
|
112
|
+
cd angular-gridjs
|
|
113
|
+
npm install
|
|
114
|
+
npm run dev
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Open `http://127.0.0.1:4200`.
|
|
118
|
+
|
|
119
|
+
The application imports:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { GridJsSpreadsheetComponent } from 'gridjs-spreadsheet/angular';
|
|
41
123
|
```
|
|
42
124
|
|
|
43
|
-
|
|
44
|
-
|
|
125
|
+
### Vanilla HTML with npm
|
|
126
|
+
|
|
45
127
|
```bash
|
|
46
|
-
|
|
128
|
+
cd vanilla-gridjs/npm
|
|
129
|
+
npm install
|
|
130
|
+
npm run dev
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Open `http://127.0.0.1:5175`.
|
|
134
|
+
|
|
135
|
+
The application imports the GridJS runtime and stylesheet from npm:
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
import Spreadsheet from 'gridjs-spreadsheet';
|
|
139
|
+
import JSZip from 'jszip';
|
|
140
|
+
import 'gridjs-spreadsheet/xspreadsheet.css';
|
|
141
|
+
|
|
142
|
+
window.JSZip = JSZip;
|
|
47
143
|
```
|
|
48
|
-
|
|
49
|
-
3. open browser and enter the url: http://localhost:8080/gridjsdemo/list
|
|
50
144
|
|
|
51
|
-
|
|
52
|
-
|
|
145
|
+
### Vanilla HTML with CDN script tags
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
cd vanilla-gridjs/script
|
|
149
|
+
npm install
|
|
150
|
+
npm run dev
|
|
151
|
+
```
|
|
53
152
|
|
|
54
|
-
|
|
153
|
+
Open `http://127.0.0.1:5176`.
|
|
55
154
|
|
|
56
|
-
|
|
155
|
+
This project loads GridJS and JSZip directly from CDN script tags. npm installs only the Vite development server.
|
|
57
156
|
|
|
58
|
-
|
|
157
|
+
## Why the frontend can access Java
|
|
59
158
|
|
|
60
|
-
|
|
159
|
+
The frontend applications call relative URLs such as:
|
|
61
160
|
|
|
62
|
-
|
|
161
|
+
```text
|
|
162
|
+
/gridjsdemo/api/files
|
|
163
|
+
/gridjsdemo/api/upload
|
|
164
|
+
/GridJs2/DetailStreamJsonWithUid
|
|
165
|
+
/GridJs2/UpdateCell
|
|
166
|
+
/GridJs2/Download
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Vite and Angular CLI proxy the `/gridjsdemo` and `/GridJs2` prefixes to `http://127.0.0.1:8080`:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
Browser :5173/:5174/:4200/:5175/:5176
|
|
173
|
+
-> frontend development proxy
|
|
174
|
+
-> Java Spring Boot :8080
|
|
175
|
+
-> Aspose.Cells GridJs service
|
|
176
|
+
-> JSON response
|
|
177
|
+
-> frontend GridJS component
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The browser sees a same-origin request to its frontend server, so separate CORS configuration is not required for local development.
|
|
181
|
+
|
|
182
|
+
## Open a workbook directly
|
|
183
|
+
|
|
184
|
+
After the backend and frontend are running, a workbook can be opened through query parameters:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
http://127.0.0.1:5174/?file=chart.xlsx&demo=permanent&uid=vue-uid-chart-xlsx
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Supported demo modes:
|
|
191
|
+
|
|
192
|
+
- `permanent`: uses a UID-backed GridJS cache.
|
|
193
|
+
- `highlight`: loads the workbook without the persistent UID route.
|
|
194
|
+
|
|
195
|
+
## Upload file names
|
|
196
|
+
|
|
197
|
+
Uploaded files use two names:
|
|
198
|
+
|
|
199
|
+
- `file`: the original name shown in GridJS and used for downloads.
|
|
200
|
+
- `storedFile`: the unique internal filename used by the Java upload directory.
|
|
201
|
+
|
|
202
|
+
The URL retains both values so a refreshed page can reopen the internal file while continuing to display the original filename.
|
|
203
|
+
|
|
204
|
+
## Run multiple demos together
|
|
205
|
+
|
|
206
|
+
Start Java once, then run `npm run dev` in multiple frontend directories. Their ports are different, and their GridJS UIDs use different framework prefixes, so the demos do not conflict.
|
|
207
|
+
|
|
208
|
+
Stopping one frontend does not stop Java or the other frontend demos. Press `Ctrl+C` in each terminal to stop the corresponding process.
|
|
209
|
+
|
|
210
|
+
## Production builds
|
|
211
|
+
|
|
212
|
+
Each frontend can be built independently:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npm run build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The output is written to that project's `dist` directory. This example intentionally demonstrates separate frontend development servers; it does not copy the frontend output into Spring Boot.
|
|
219
|
+
|
|
220
|
+
## npm package version
|
|
221
|
+
|
|
222
|
+
Each npm-based frontend declares:
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
"gridjs-spreadsheet": "latest"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Running `npm install` resolves the npm registry's current latest release. The framework exports used by these demos require `gridjs-spreadsheet` 26.7.0 or newer.
|
|
229
|
+
|
|
230
|
+
Package lock files are intentionally not published with the example. Users may generate their own lock files when installing dependencies.
|
|
231
|
+
|
|
232
|
+
## Troubleshooting
|
|
233
|
+
|
|
234
|
+
### Frontend reports `ECONNREFUSED` or proxy errors
|
|
235
|
+
|
|
236
|
+
Confirm that Java is running on port 8080 and open the health URL:
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
http://127.0.0.1:8080/gridjsdemo/api/health
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### A frontend port is already occupied
|
|
243
|
+
|
|
244
|
+
Stop the existing process using that port. All frontend commands use strict ports to avoid silently opening a different URL.
|
|
245
|
+
|
|
246
|
+
### Angular rejects the current Node.js version
|
|
247
|
+
|
|
248
|
+
Use Node.js 18, 20, or 22. Node.js 23 and newer are outside the supported range of the included Angular 18 project.
|
|
249
|
+
|
|
250
|
+
### Framework import path cannot be resolved
|
|
251
|
+
|
|
252
|
+
Run `npm install` again and verify that the installed `gridjs-spreadsheet` version is 26.7.0 or newer.
|
|
253
|
+
|
|
254
|
+
### Trial warning appears in the workbook
|
|
255
|
+
|
|
256
|
+
Configure `testconfig.AsposeLicensePath` with a valid Aspose.Cells license, or continue using the example in evaluation mode.
|
|
257
|
+
|
|
258
|
+
## Docker
|
|
259
|
+
|
|
260
|
+
The Docker configuration runs the Java backend and legacy server-rendered page. The five framework demos remain separate npm development projects.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
docker build -t gridjs-demo-java .
|
|
264
|
+
docker run -d -p 8080:8080 gridjs-demo-java
|
|
265
|
+
```
|
|
63
266
|
|
|
64
267
|
## Resources
|
|
65
268
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
+ **Forum:** [Aspose.Cells for Java Forum](http://www.aspose.com/community/forums/aspose.cells-product-family/19/showforum.aspx)
|
|
71
|
-
+ **Blog:** [Aspose.Cells for Java Blog](https://blog.aspose.com/category/aspose-products/aspose-cells-product-family/)
|
|
269
|
+
- [Aspose.Cells for Java](https://products.aspose.com/cells/java/)
|
|
270
|
+
- [Aspose.Cells GridJs documentation](https://docs.aspose.com/cells/java/aspose-cells-gridjs/)
|
|
271
|
+
- [GridJs Java API reference](https://reference.aspose.com/cells/java/com.aspose.gridjs/)
|
|
272
|
+
- [Aspose.Cells support forum](https://forum.aspose.com/c/cells)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"gridjs-angular-demo": {
|
|
7
|
+
"projectType": "application",
|
|
8
|
+
"schematics": {},
|
|
9
|
+
"root": "",
|
|
10
|
+
"sourceRoot": "src",
|
|
11
|
+
"prefix": "app",
|
|
12
|
+
"architect": {
|
|
13
|
+
"build": {
|
|
14
|
+
"builder": "@angular-devkit/build-angular:application",
|
|
15
|
+
"options": {
|
|
16
|
+
"outputPath": "dist/gridjs-angular-demo",
|
|
17
|
+
"index": "src/index.html",
|
|
18
|
+
"browser": "src/main.ts",
|
|
19
|
+
"polyfills": ["zone.js"],
|
|
20
|
+
"tsConfig": "tsconfig.app.json",
|
|
21
|
+
"assets": ["src/favicon.ico"],
|
|
22
|
+
"allowedCommonJsDependencies": ["gridjs-spreadsheet", "jszip"],
|
|
23
|
+
"styles": [
|
|
24
|
+
"node_modules/gridjs-spreadsheet/xspreadsheet.css",
|
|
25
|
+
"src/styles.css"
|
|
26
|
+
],
|
|
27
|
+
"scripts": []
|
|
28
|
+
},
|
|
29
|
+
"configurations": {
|
|
30
|
+
"production": {
|
|
31
|
+
"budgets": [
|
|
32
|
+
{
|
|
33
|
+
"type": "initial",
|
|
34
|
+
"maximumWarning": "5mb",
|
|
35
|
+
"maximumError": "8mb"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"outputHashing": "all"
|
|
39
|
+
},
|
|
40
|
+
"development": {
|
|
41
|
+
"optimization": false,
|
|
42
|
+
"extractLicenses": false,
|
|
43
|
+
"sourceMap": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"defaultConfiguration": "production"
|
|
47
|
+
},
|
|
48
|
+
"serve": {
|
|
49
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
50
|
+
"configurations": {
|
|
51
|
+
"production": {
|
|
52
|
+
"buildTarget": "gridjs-angular-demo:build:production"
|
|
53
|
+
},
|
|
54
|
+
"development": {
|
|
55
|
+
"buildTarget": "gridjs-angular-demo:build:development"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"defaultConfiguration": "development"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"cli": {
|
|
64
|
+
"analytics": false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gridjs-angular-java-demo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "cross-env NG_BUILD_MAX_WORKERS=1 ng serve --host 127.0.0.1 --port 4200 --proxy-config proxy.conf.json",
|
|
7
|
+
"build": "cross-env NG_BUILD_MAX_WORKERS=1 ng build"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@angular/animations": "18.2.14",
|
|
11
|
+
"@angular/common": "18.2.14",
|
|
12
|
+
"@angular/compiler": "18.2.14",
|
|
13
|
+
"@angular/core": "18.2.14",
|
|
14
|
+
"@angular/platform-browser": "18.2.14",
|
|
15
|
+
"gridjs-spreadsheet": "latest",
|
|
16
|
+
"jszip": "^3.10.1",
|
|
17
|
+
"rxjs": "~7.8.1",
|
|
18
|
+
"tslib": "^2.6.2",
|
|
19
|
+
"zone.js": "~0.14.10"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@angular-devkit/build-angular": "18.2.21",
|
|
23
|
+
"@angular/cli": "18.2.21",
|
|
24
|
+
"@angular/compiler-cli": "18.2.14",
|
|
25
|
+
"cross-env": "^7.0.3",
|
|
26
|
+
"typescript": "~5.5.4"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18 <23"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Small fetch() wrapper that turns non-2xx responses into thrown Errors,
|
|
2
|
+
// so callers can just `await fetchJson(url)` and catch failures in one place.
|
|
3
|
+
export async function fetchJson<T>(url: string, options?: RequestInit): Promise<T> {
|
|
4
|
+
const response = await fetch(url, options);
|
|
5
|
+
if (!response.ok) throw new Error(response.status + ' ' + response.statusText);
|
|
6
|
+
return response.json() as Promise<T>;
|
|
7
|
+
}
|