sparc-shared-ui 0.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/.editorconfig ADDED
@@ -0,0 +1,17 @@
1
+ # Editor configuration, see https://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ indent_size = 2
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.ts]
12
+ quote_type = single
13
+ ij_typescript_use_double_quotes = false
14
+
15
+ [*.md]
16
+ max_line_length = off
17
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3
+ "recommendations": ["angular.ng-template"]
4
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3
+ "version": "0.2.0",
4
+ "configurations": [
5
+ {
6
+ "name": "ng serve",
7
+ "type": "chrome",
8
+ "request": "launch",
9
+ "preLaunchTask": "npm: start",
10
+ "url": "http://localhost:4200/"
11
+ },
12
+ {
13
+ "name": "ng test",
14
+ "type": "chrome",
15
+ "request": "launch",
16
+ "preLaunchTask": "npm: test",
17
+ "url": "http://localhost:9876/debug.html"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ // For more information, visit: https://angular.dev/ai/mcp
3
+ "servers": {
4
+ "angular-cli": {
5
+ "command": "npx",
6
+ "args": ["-y", "@angular/cli", "mcp"]
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
+ "version": "2.0.0",
4
+ "tasks": [
5
+ {
6
+ "type": "npm",
7
+ "script": "start",
8
+ "isBackground": true,
9
+ "problemMatcher": {
10
+ "owner": "typescript",
11
+ "pattern": "$tsc",
12
+ "background": {
13
+ "activeOnStart": true,
14
+ "beginsPattern": {
15
+ "regexp": "Changes detected"
16
+ },
17
+ "endsPattern": {
18
+ "regexp": "bundle generation (complete|failed)"
19
+ }
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "type": "npm",
25
+ "script": "test",
26
+ "isBackground": true,
27
+ "problemMatcher": {
28
+ "owner": "typescript",
29
+ "pattern": "$tsc",
30
+ "background": {
31
+ "activeOnStart": true,
32
+ "beginsPattern": {
33
+ "regexp": "Changes detected"
34
+ },
35
+ "endsPattern": {
36
+ "regexp": "bundle generation (complete|failed)"
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ]
42
+ }
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # SparcSharedUi
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.2.
4
+
5
+ ## Development server
6
+
7
+ To start a local development server, run:
8
+
9
+ ```bash
10
+ ng serve
11
+ ```
12
+
13
+ Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
14
+
15
+ ## Code scaffolding
16
+
17
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
18
+
19
+ ```bash
20
+ ng generate component component-name
21
+ ```
22
+
23
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
24
+
25
+ ```bash
26
+ ng generate --help
27
+ ```
28
+
29
+ ## Building
30
+
31
+ To build the project run:
32
+
33
+ ```bash
34
+ ng build
35
+ ```
36
+
37
+ This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
38
+
39
+ ## Running unit tests
40
+
41
+ To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
42
+
43
+ ```bash
44
+ ng test
45
+ ```
46
+
47
+ ## Running end-to-end tests
48
+
49
+ For end-to-end (e2e) testing, run:
50
+
51
+ ```bash
52
+ ng e2e
53
+ ```
54
+
55
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
56
+
57
+ ## Additional Resources
58
+
59
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
package/angular.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "cli": {
5
+ "packageManager": "npm"
6
+ },
7
+ "newProjectRoot": "projects",
8
+ "projects": {
9
+ "shared-ui": {
10
+ "projectType": "library",
11
+ "root": "projects/shared-ui",
12
+ "sourceRoot": "projects/shared-ui/src",
13
+ "prefix": "lib",
14
+ "architect": {
15
+ "build": {
16
+ "builder": "@angular/build:ng-packagr",
17
+ "configurations": {
18
+ "production": {
19
+ "tsConfig": "projects/shared-ui/tsconfig.lib.prod.json"
20
+ },
21
+ "development": {
22
+ "tsConfig": "projects/shared-ui/tsconfig.lib.json"
23
+ }
24
+ },
25
+ "defaultConfiguration": "production"
26
+ },
27
+ "test": {
28
+ "builder": "@angular/build:unit-test",
29
+ "options": {
30
+ "tsConfig": "projects/shared-ui/tsconfig.spec.json"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,25 @@
1
+ trigger:
2
+ - main
3
+
4
+ pool:
5
+ vmImage: ubuntu-latest
6
+
7
+ steps:
8
+ - checkout: self
9
+
10
+ - task: NodeTool@0
11
+ inputs:
12
+ versionSpec: '20.x'
13
+
14
+ - script: |
15
+ npm install
16
+ ng build shared-ui
17
+ displayName: 'Build Angular library'
18
+
19
+ - task: Npm@1
20
+ displayName: 'Publish to Azure Artifacts'
21
+ inputs:
22
+ command: publish
23
+ workingDir: dist/shared-ui
24
+ publishRegistry: useFeed
25
+ publishFeed: sparc-npm
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "sparc-shared-ui",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "scripts": {
11
+ "ng": "ng",
12
+ "start": "ng serve",
13
+ "build": "ng build",
14
+ "watch": "ng build --watch --configuration development",
15
+ "test": "ng test"
16
+ },
17
+ "prettier": {
18
+ "printWidth": 100,
19
+ "singleQuote": true,
20
+ "overrides": [
21
+ {
22
+ "files": "*.html",
23
+ "options": {
24
+ "parser": "angular"
25
+ }
26
+ }
27
+ ]
28
+ },
29
+
30
+ "packageManager": "npm@10.8.2",
31
+ "dependencies": {
32
+ "@angular/common": "^21.1.0",
33
+ "@angular/compiler": "^21.1.0",
34
+ "@angular/core": "^21.1.0",
35
+ "@angular/forms": "^21.1.0",
36
+ "@angular/platform-browser": "^21.1.0",
37
+ "@angular/router": "^21.1.0",
38
+ "rxjs": "~7.8.0",
39
+ "tslib": "^2.3.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@angular/core": "^21.1.0",
43
+ "@angular/common": "^21.1.0",
44
+ "primeng": "^20.4.0",
45
+ "primeicons": "^7.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@angular/build": "^21.1.3",
49
+ "@angular/cli": "^21.1.2",
50
+ "@angular/compiler-cli": "^21.1.0",
51
+ "jsdom": "^27.1.0",
52
+ "ng-packagr": "^21.1.0",
53
+ "primeicons": "^7.0.0",
54
+ "primeng": "^20.4.0",
55
+ "typescript": "~5.9.2",
56
+ "vitest": "^4.0.8"
57
+ }
58
+ }
@@ -0,0 +1,63 @@
1
+ # SharedUi
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build shared-ui
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/shared-ui
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/shared-ui",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "sparc-shared-ui",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^21.1.0",
6
+ "@angular/core": "^21.1.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false
12
+ }
@@ -0,0 +1 @@
1
+ export * from './tabs';
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { SharedUi } from './shared-ui';
4
+
5
+ describe('SharedUi', () => {
6
+ let component: SharedUi;
7
+ let fixture: ComponentFixture<SharedUi>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [SharedUi]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(SharedUi);
16
+ component = fixture.componentInstance;
17
+ await fixture.whenStable();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,15 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'lib-shared-ui',
5
+ imports: [],
6
+ template: `
7
+ <p>
8
+ shared-ui works!
9
+ </p>
10
+ `,
11
+ styles: ``,
12
+ })
13
+ export class SharedUi {
14
+
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from './tab-view/tab-view.component';
2
+ export * from './tab-panel/tab-panel.component';
@@ -0,0 +1,4 @@
1
+ :host {
2
+ display: block;
3
+ height: 100%;
4
+ }
@@ -0,0 +1,30 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, ContentChild, Input, TemplateRef } from '@angular/core';
3
+
4
+ @Component({
5
+ selector: 'app-tab-panel',
6
+ standalone: true,
7
+ imports: [CommonModule],
8
+ template: `
9
+ <ng-container *ngIf="renderKey">
10
+ <ng-container
11
+ *ngTemplateOutlet="content; context: { data: data }">
12
+ </ng-container>
13
+ </ng-container>
14
+ `
15
+ })
16
+ export class TabPanelComponent {
17
+ @Input({ required: true }) id!: number | string;
18
+ @Input() header = '';
19
+ @Input() closable = false;
20
+ @Input() data: any;
21
+
22
+ @ContentChild(TemplateRef) content!: TemplateRef<any>;
23
+
24
+ renderKey = 0;
25
+
26
+ ngOnChanges() {
27
+ this.renderKey++;
28
+ }
29
+ }
30
+
@@ -0,0 +1,23 @@
1
+ <p-tabs [value]="activeValue" (valueChange)="onValueChange($event)" class="dashboard-Tab-View">
2
+
3
+ <p-tablist>
4
+ @for (panel of panels; track panel.id) {
5
+ <p-tab [value]="panel.id">
6
+ {{ panel.header }}
7
+ @if (panel.closable) {
8
+ <i class="pi pi-times" (click)="closeTab(panel, $event)"></i>
9
+ }
10
+ </p-tab>
11
+ }
12
+ </p-tablist>
13
+
14
+ <p-tabpanels>
15
+ @for (panel of panels; track panel.id) {
16
+ <p-tabpanel [value]="panel.id">
17
+ <ng-container *ngTemplateOutlet="panel.content; context: { data: panel.data }">
18
+ </ng-container>
19
+ </p-tabpanel>
20
+ }
21
+ </p-tabpanels>
22
+
23
+ </p-tabs>
@@ -0,0 +1,16 @@
1
+ .tab-close {
2
+ margin-left: .5rem;
3
+ cursor: pointer;
4
+ font-size: .75rem;
5
+ }
6
+
7
+ .scrollable {
8
+ overflow-x: auto;
9
+ }
10
+
11
+ :host {
12
+ display: flex;
13
+ flex-direction: column;
14
+ height: 100%;
15
+ }
16
+
@@ -0,0 +1,85 @@
1
+ import {
2
+ AfterContentInit,
3
+ Component,
4
+ ContentChildren,
5
+ EventEmitter,
6
+ Input,
7
+ OnChanges,
8
+ Output,
9
+ QueryList,
10
+ SimpleChanges
11
+ } from '@angular/core';
12
+ import { TabsModule } from 'primeng/tabs';
13
+ import { TabPanelComponent } from '../tab-panel/tab-panel.component';
14
+ import { CommonModule } from '@angular/common';
15
+
16
+ @Component({
17
+ selector: 'app-tab-view',
18
+ standalone: true,
19
+ imports: [TabsModule, CommonModule],
20
+ templateUrl: './tab-view.component.html',
21
+ })
22
+ export class TabViewComponent implements AfterContentInit, OnChanges {
23
+
24
+ @ContentChildren(TabPanelComponent)
25
+ panelList!: QueryList<TabPanelComponent>;
26
+
27
+ panels: TabPanelComponent[] = [];
28
+
29
+ @Input() activeIndex = 0;
30
+ @Input() scrollable = false;
31
+
32
+ @Output() activeIndexChange = new EventEmitter<number>();
33
+ @Output() onChange = new EventEmitter<any>();
34
+ @Output() onClose = new EventEmitter<any>();
35
+
36
+ activeValue: any;
37
+
38
+ ngAfterContentInit() {
39
+ this.syncPanels();
40
+
41
+ this.panelList.changes.subscribe(() => {
42
+ this.syncPanels();
43
+ });
44
+ }
45
+
46
+ ngOnChanges(changes: SimpleChanges) {
47
+ if (changes['activeIndex']) {
48
+ this.updateActiveValue();
49
+ }
50
+ }
51
+
52
+ private syncPanels() {
53
+ this.panels = this.panelList.toArray();
54
+ this.updateActiveValue();
55
+ }
56
+
57
+ private updateActiveValue() {
58
+ this.activeValue = this.panels[this.activeIndex]?.id ?? null;
59
+ }
60
+
61
+ onValueChange(value: any) {
62
+ const index = this.panels.findIndex(p => p.id === value);
63
+ if (index === -1) return;
64
+
65
+ this.activeIndex = index;
66
+ this.activeIndexChange.emit(index);
67
+ this.onChange.emit({ index });
68
+ this.activeValue = value;
69
+ }
70
+
71
+ closeTab(panel: TabPanelComponent, event: Event) {
72
+ event.stopPropagation();
73
+
74
+ const index = this.panels.findIndex(p => p.id === panel.id);
75
+ if (index === -1) return;
76
+
77
+ // Child does NOT mutate data
78
+ this.onClose.emit({
79
+ index,
80
+ panel
81
+ });
82
+ }
83
+
84
+
85
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of shared-ui
3
+ */
4
+
5
+ export * from './lib';
6
+
@@ -0,0 +1,17 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "types": []
10
+ },
11
+ "include": [
12
+ "src/**/*.ts"
13
+ ],
14
+ "exclude": [
15
+ "**/*.spec.ts"
16
+ ]
17
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "vitest/globals"
9
+ ]
10
+ },
11
+ "include": [
12
+ "src/**/*.d.ts",
13
+ "src/**/*.spec.ts"
14
+ ]
15
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,38 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "compileOnSave": false,
5
+ "compilerOptions": {
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true,
13
+ "experimentalDecorators": true,
14
+ "paths": {
15
+ "shared-ui": [
16
+ "./dist/shared-ui"
17
+ ]
18
+ },
19
+ "importHelpers": true,
20
+ "target": "ES2022",
21
+ "module": "preserve"
22
+ },
23
+ "angularCompilerOptions": {
24
+ "enableI18nLegacyMessageIdFormat": false,
25
+ "strictInjectionParameters": true,
26
+ "strictInputAccessModifiers": true,
27
+ "strictTemplates": true
28
+ },
29
+ "files": [],
30
+ "references": [
31
+ {
32
+ "path": "./projects/shared-ui/tsconfig.lib.json"
33
+ },
34
+ {
35
+ "path": "./projects/shared-ui/tsconfig.spec.json"
36
+ }
37
+ ]
38
+ }