@sci-grid/angular 1.0.1
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/LICENSE +21 -0
- package/dist/angular/src/index.d.ts +15 -0
- package/dist/angular/src/index.test.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +41 -0
- package/package.json +25 -0
- package/src/index.test.ts +8 -0
- package/src/index.ts +41 -0
- package/tsconfig.json +13 -0
- package/vite.config.ts +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SciGrid Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ElementRef, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { GridConfig, IDataGridProvider } from '../../core/src/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* SciGrid Angular Adapter
|
|
5
|
+
* Enterprise-ready grid component for Angular applications.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SciGridAngular implements OnInit, OnChanges, OnDestroy {
|
|
8
|
+
gridContainer: ElementRef;
|
|
9
|
+
provider: IDataGridProvider;
|
|
10
|
+
config: Partial<GridConfig>;
|
|
11
|
+
private grid;
|
|
12
|
+
ngOnInit(): void;
|
|
13
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
14
|
+
ngOnDestroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@angular/core"),c=require("@sci-grid/core");var l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,n=(o,i,d,t)=>{for(var r=t>1?void 0:t?u(i,d):i,g=o.length-1,s;g>=0;g--)(s=o[g])&&(r=(t?s(i,d,r):s(r))||r);return t&&r&&l(i,d,r),r};exports.SciGridAngular=class{constructor(){this.config={},this.grid=null}ngOnInit(){this.grid=new c.SciGrid(this.gridContainer.nativeElement,this.provider,this.config)}ngOnChanges(i){this.grid&&(i.provider&&this.grid.updateProvider(this.provider),i.config&&this.grid.updateConfig(this.config))}ngOnDestroy(){var i;(i=this.grid)==null||i.destroy(),this.grid=null}};n([e.ViewChild("gridContainer",{static:!0})],exports.SciGridAngular.prototype,"gridContainer",2);n([e.Input()],exports.SciGridAngular.prototype,"provider",2);n([e.Input()],exports.SciGridAngular.prototype,"config",2);exports.SciGridAngular=n([e.Component({selector:"sci-grid",template:'<div #gridContainer style="width: 100%; height: 100%; min-height: 400px;"></div>',standalone:!0})],exports.SciGridAngular);
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ViewChild as h, Input as p, Component as f } from "@angular/core";
|
|
2
|
+
import { SciGrid as l } from "@sci-grid/core";
|
|
3
|
+
var a = Object.defineProperty, c = Object.getOwnPropertyDescriptor, o = (i, e, s, n) => {
|
|
4
|
+
for (var r = n > 1 ? void 0 : n ? c(e, s) : e, d = i.length - 1, g; d >= 0; d--)
|
|
5
|
+
(g = i[d]) && (r = (n ? g(e, s, r) : g(r)) || r);
|
|
6
|
+
return n && r && a(e, s, r), r;
|
|
7
|
+
};
|
|
8
|
+
let t = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.config = {}, this.grid = null;
|
|
11
|
+
}
|
|
12
|
+
ngOnInit() {
|
|
13
|
+
this.grid = new l(this.gridContainer.nativeElement, this.provider, this.config);
|
|
14
|
+
}
|
|
15
|
+
ngOnChanges(i) {
|
|
16
|
+
this.grid && (i.provider && this.grid.updateProvider(this.provider), i.config && this.grid.updateConfig(this.config));
|
|
17
|
+
}
|
|
18
|
+
ngOnDestroy() {
|
|
19
|
+
var i;
|
|
20
|
+
(i = this.grid) == null || i.destroy(), this.grid = null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
o([
|
|
24
|
+
h("gridContainer", { static: !0 })
|
|
25
|
+
], t.prototype, "gridContainer", 2);
|
|
26
|
+
o([
|
|
27
|
+
p()
|
|
28
|
+
], t.prototype, "provider", 2);
|
|
29
|
+
o([
|
|
30
|
+
p()
|
|
31
|
+
], t.prototype, "config", 2);
|
|
32
|
+
t = o([
|
|
33
|
+
f({
|
|
34
|
+
selector: "sci-grid",
|
|
35
|
+
template: '<div #gridContainer style="width: 100%; height: 100%; min-height: 400px;"></div>',
|
|
36
|
+
standalone: !0
|
|
37
|
+
})
|
|
38
|
+
], t);
|
|
39
|
+
export {
|
|
40
|
+
t as SciGridAngular
|
|
41
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sci-grid/angular",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@angular/core": ">=16.0.0",
|
|
10
|
+
"@angular/common": ">=16.0.0",
|
|
11
|
+
"@sci-grid/core": "1.0.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@angular/core": "^18.0.0",
|
|
15
|
+
"@angular/common": "^18.0.0",
|
|
16
|
+
"rxjs": "^7.8.0",
|
|
17
|
+
"zone.js": "^0.14.0",
|
|
18
|
+
"typescript": "^5.5.0",
|
|
19
|
+
"vite": "^5.0.0",
|
|
20
|
+
"vite-plugin-dts": "^4.0.0"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "vite build"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, ElementRef, Input, type OnChanges, type OnDestroy, type OnInit, type SimpleChanges, ViewChild } from '@angular/core';
|
|
2
|
+
import { SciGrid } from '@sci-grid/core';
|
|
3
|
+
import type { GridConfig, IDataGridProvider } from '@sci-grid/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SciGrid Angular Adapter
|
|
7
|
+
* Enterprise-ready grid component for Angular applications.
|
|
8
|
+
*/
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'sci-grid',
|
|
11
|
+
template: `<div #gridContainer style="width: 100%; height: 100%; min-height: 400px;"></div>`,
|
|
12
|
+
standalone: true
|
|
13
|
+
})
|
|
14
|
+
export class SciGridAngular implements OnInit, OnChanges, OnDestroy {
|
|
15
|
+
@ViewChild('gridContainer', { static: true }) gridContainer!: ElementRef;
|
|
16
|
+
|
|
17
|
+
@Input() provider!: IDataGridProvider;
|
|
18
|
+
@Input() config: Partial<GridConfig> = {};
|
|
19
|
+
|
|
20
|
+
private grid: SciGrid | null = null;
|
|
21
|
+
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
this.grid = new SciGrid(this.gridContainer.nativeElement, this.provider, this.config);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
27
|
+
if (!this.grid) return;
|
|
28
|
+
|
|
29
|
+
if (changes['provider']) {
|
|
30
|
+
this.grid.updateProvider(this.provider);
|
|
31
|
+
}
|
|
32
|
+
if (changes['config']) {
|
|
33
|
+
this.grid.updateConfig(this.config);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ngOnDestroy() {
|
|
38
|
+
this.grid?.destroy();
|
|
39
|
+
this.grid = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"useDefineForClassFields": false,
|
|
8
|
+
"noEmit": false,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"]
|
|
13
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import dts from 'vite-plugin-dts';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [dts()],
|
|
7
|
+
build: {
|
|
8
|
+
lib: {
|
|
9
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
10
|
+
name: 'SciGridAngular',
|
|
11
|
+
fileName: 'index',
|
|
12
|
+
formats: ['es', 'cjs']
|
|
13
|
+
},
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
external: ['@angular/core', '@angular/common', '@sci-grid/core', 'rxjs', 'zone.js'],
|
|
16
|
+
output: {
|
|
17
|
+
globals: {
|
|
18
|
+
'@angular/core': 'ng.core',
|
|
19
|
+
'@angular/common': 'ng.common',
|
|
20
|
+
'@sci-grid/core': 'SciGrid'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
esbuild: {
|
|
26
|
+
// Angular needs experimentalDecorators and does not support useDefineForClassFields
|
|
27
|
+
// esbuild does not support emitDecoratorMetadata which is required for some Angular DI,
|
|
28
|
+
// but for simple components it might be fine, or we rely on tsc for types.
|
|
29
|
+
// However, for the runtime build, we need decorators to be preserved or transformed.
|
|
30
|
+
// Since we are outputting a library, we should probably output code that uses standard JS decorators or downlevel them.
|
|
31
|
+
// Vite uses esbuild.
|
|
32
|
+
}
|
|
33
|
+
});
|