sparc-shared-ui 0.0.1 → 0.0.3
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/README.md +20 -16
- package/fesm2022/sparc-shared-ui.mjs +132 -0
- package/fesm2022/sparc-shared-ui.mjs.map +1 -0
- package/package.json +22 -57
- package/types/sparc-shared-ui.d.ts +35 -0
- package/.editorconfig +0 -17
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/mcp.json +0 -9
- package/.vscode/tasks.json +0 -42
- package/angular.json +0 -36
- package/azure-pipelines.yml +0 -25
- package/projects/shared-ui/README.md +0 -63
- package/projects/shared-ui/ng-package.json +0 -7
- package/projects/shared-ui/package.json +0 -12
- package/projects/shared-ui/src/lib/index.ts +0 -1
- package/projects/shared-ui/src/lib/shared-ui.spec.ts +0 -23
- package/projects/shared-ui/src/lib/shared-ui.ts +0 -15
- package/projects/shared-ui/src/lib/tabs/index.ts +0 -2
- package/projects/shared-ui/src/lib/tabs/tab-panel/tab-panel.component.html +0 -0
- package/projects/shared-ui/src/lib/tabs/tab-panel/tab-panel.component.scss +0 -4
- package/projects/shared-ui/src/lib/tabs/tab-panel/tab-panel.component.ts +0 -30
- package/projects/shared-ui/src/lib/tabs/tab-view/tab-view.component.html +0 -23
- package/projects/shared-ui/src/lib/tabs/tab-view/tab-view.component.scss +0 -16
- package/projects/shared-ui/src/lib/tabs/tab-view/tab-view.component.ts +0 -85
- package/projects/shared-ui/src/public-api.ts +0 -6
- package/projects/shared-ui/tsconfig.lib.json +0 -17
- package/projects/shared-ui/tsconfig.lib.prod.json +0 -11
- package/projects/shared-ui/tsconfig.spec.json +0 -15
- package/tsconfig.json +0 -38
package/README.md
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SharedUi
|
|
2
2
|
|
|
3
|
-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.
|
|
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.
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.0.
|
|
14
4
|
|
|
15
5
|
## Code scaffolding
|
|
16
6
|
|
|
@@ -28,17 +18,31 @@ ng generate --help
|
|
|
28
18
|
|
|
29
19
|
## Building
|
|
30
20
|
|
|
31
|
-
To build the
|
|
21
|
+
To build the library, run:
|
|
32
22
|
|
|
33
23
|
```bash
|
|
34
|
-
ng build
|
|
24
|
+
ng build shared-ui
|
|
35
25
|
```
|
|
36
26
|
|
|
37
|
-
This will compile your project and
|
|
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
|
+
```
|
|
38
42
|
|
|
39
43
|
## Running unit tests
|
|
40
44
|
|
|
41
|
-
To execute unit tests with the [
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
42
46
|
|
|
43
47
|
```bash
|
|
44
48
|
ng test
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { TemplateRef, ContentChild, Input, Component, EventEmitter, Output, ContentChildren } from '@angular/core';
|
|
3
|
+
import * as i1$1 from 'primeng/tabs';
|
|
4
|
+
import { TabsModule } from 'primeng/tabs';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class TabPanelComponent {
|
|
9
|
+
id;
|
|
10
|
+
header = '';
|
|
11
|
+
closable = false;
|
|
12
|
+
data;
|
|
13
|
+
content;
|
|
14
|
+
renderKey = 0;
|
|
15
|
+
ngOnChanges() {
|
|
16
|
+
this.renderKey++;
|
|
17
|
+
}
|
|
18
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TabPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
19
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", type: TabPanelComponent, isStandalone: true, selector: "app-tab-panel", inputs: { id: "id", header: "header", closable: "closable", data: "data" }, queries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
20
|
+
<ng-container *ngIf="renderKey">
|
|
21
|
+
<ng-container
|
|
22
|
+
*ngTemplateOutlet="content; context: { data: data }">
|
|
23
|
+
</ng-container>
|
|
24
|
+
</ng-container>
|
|
25
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TabPanelComponent, decorators: [{
|
|
28
|
+
type: Component,
|
|
29
|
+
args: [{
|
|
30
|
+
selector: 'app-tab-panel',
|
|
31
|
+
standalone: true,
|
|
32
|
+
imports: [CommonModule],
|
|
33
|
+
template: `
|
|
34
|
+
<ng-container *ngIf="renderKey">
|
|
35
|
+
<ng-container
|
|
36
|
+
*ngTemplateOutlet="content; context: { data: data }">
|
|
37
|
+
</ng-container>
|
|
38
|
+
</ng-container>
|
|
39
|
+
`
|
|
40
|
+
}]
|
|
41
|
+
}], propDecorators: { id: [{
|
|
42
|
+
type: Input,
|
|
43
|
+
args: [{ required: true }]
|
|
44
|
+
}], header: [{
|
|
45
|
+
type: Input
|
|
46
|
+
}], closable: [{
|
|
47
|
+
type: Input
|
|
48
|
+
}], data: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}], content: [{
|
|
51
|
+
type: ContentChild,
|
|
52
|
+
args: [TemplateRef]
|
|
53
|
+
}] } });
|
|
54
|
+
|
|
55
|
+
class TabViewComponent {
|
|
56
|
+
panelList;
|
|
57
|
+
panels = [];
|
|
58
|
+
activeIndex = 0;
|
|
59
|
+
scrollable = false;
|
|
60
|
+
activeIndexChange = new EventEmitter();
|
|
61
|
+
onChange = new EventEmitter();
|
|
62
|
+
onClose = new EventEmitter();
|
|
63
|
+
activeValue;
|
|
64
|
+
ngAfterContentInit() {
|
|
65
|
+
this.syncPanels();
|
|
66
|
+
this.panelList.changes.subscribe(() => {
|
|
67
|
+
this.syncPanels();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
ngOnChanges(changes) {
|
|
71
|
+
if (changes['activeIndex']) {
|
|
72
|
+
this.updateActiveValue();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
syncPanels() {
|
|
76
|
+
this.panels = this.panelList.toArray();
|
|
77
|
+
this.updateActiveValue();
|
|
78
|
+
}
|
|
79
|
+
updateActiveValue() {
|
|
80
|
+
this.activeValue = this.panels[this.activeIndex]?.id ?? null;
|
|
81
|
+
}
|
|
82
|
+
onValueChange(value) {
|
|
83
|
+
const index = this.panels.findIndex(p => p.id === value);
|
|
84
|
+
if (index === -1)
|
|
85
|
+
return;
|
|
86
|
+
this.activeIndex = index;
|
|
87
|
+
this.activeIndexChange.emit(index);
|
|
88
|
+
this.onChange.emit({ index });
|
|
89
|
+
this.activeValue = value;
|
|
90
|
+
}
|
|
91
|
+
closeTab(panel, event) {
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
const index = this.panels.findIndex(p => p.id === panel.id);
|
|
94
|
+
if (index === -1)
|
|
95
|
+
return;
|
|
96
|
+
// Child does NOT mutate data
|
|
97
|
+
this.onClose.emit({
|
|
98
|
+
index,
|
|
99
|
+
panel
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TabViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
103
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: TabViewComponent, isStandalone: true, selector: "app-tab-view", inputs: { activeIndex: "activeIndex", scrollable: "scrollable" }, outputs: { activeIndexChange: "activeIndexChange", onChange: "onChange", onClose: "onClose" }, queries: [{ propertyName: "panelList", predicate: TabPanelComponent }], usesOnChanges: true, ngImport: i0, template: "<p-tabs [value]=\"activeValue\" (valueChange)=\"onValueChange($event)\" class=\"dashboard-Tab-View\">\r\n\r\n <p-tablist>\r\n @for (panel of panels; track panel.id) {\r\n <p-tab [value]=\"panel.id\">\r\n {{ panel.header }}\r\n @if (panel.closable) {\r\n <i class=\"pi pi-times\" (click)=\"closeTab(panel, $event)\"></i>\r\n }\r\n </p-tab>\r\n }\r\n </p-tablist>\r\n\r\n <p-tabpanels>\r\n @for (panel of panels; track panel.id) {\r\n <p-tabpanel [value]=\"panel.id\">\r\n <ng-container *ngTemplateOutlet=\"panel.content; context: { data: panel.data }\">\r\n </ng-container>\r\n </p-tabpanel>\r\n }\r\n </p-tabpanels>\r\n\r\n</p-tabs>", dependencies: [{ kind: "ngmodule", type: TabsModule }, { kind: "component", type: i1$1.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i1$1.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i1$1.TabPanel, selector: "p-tabpanel", inputs: ["lazy", "value"], outputs: ["valueChange"] }, { kind: "component", type: i1$1.TabList, selector: "p-tablist" }, { kind: "component", type: i1$1.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
104
|
+
}
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TabViewComponent, decorators: [{
|
|
106
|
+
type: Component,
|
|
107
|
+
args: [{ selector: 'app-tab-view', standalone: true, imports: [TabsModule, CommonModule], template: "<p-tabs [value]=\"activeValue\" (valueChange)=\"onValueChange($event)\" class=\"dashboard-Tab-View\">\r\n\r\n <p-tablist>\r\n @for (panel of panels; track panel.id) {\r\n <p-tab [value]=\"panel.id\">\r\n {{ panel.header }}\r\n @if (panel.closable) {\r\n <i class=\"pi pi-times\" (click)=\"closeTab(panel, $event)\"></i>\r\n }\r\n </p-tab>\r\n }\r\n </p-tablist>\r\n\r\n <p-tabpanels>\r\n @for (panel of panels; track panel.id) {\r\n <p-tabpanel [value]=\"panel.id\">\r\n <ng-container *ngTemplateOutlet=\"panel.content; context: { data: panel.data }\">\r\n </ng-container>\r\n </p-tabpanel>\r\n }\r\n </p-tabpanels>\r\n\r\n</p-tabs>" }]
|
|
108
|
+
}], propDecorators: { panelList: [{
|
|
109
|
+
type: ContentChildren,
|
|
110
|
+
args: [TabPanelComponent]
|
|
111
|
+
}], activeIndex: [{
|
|
112
|
+
type: Input
|
|
113
|
+
}], scrollable: [{
|
|
114
|
+
type: Input
|
|
115
|
+
}], activeIndexChange: [{
|
|
116
|
+
type: Output
|
|
117
|
+
}], onChange: [{
|
|
118
|
+
type: Output
|
|
119
|
+
}], onClose: [{
|
|
120
|
+
type: Output
|
|
121
|
+
}] } });
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* Public API Surface of shared-ui
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Generated bundle index. Do not edit.
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
export { TabPanelComponent, TabViewComponent };
|
|
132
|
+
//# sourceMappingURL=sparc-shared-ui.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparc-shared-ui.mjs","sources":["../../../projects/shared-ui/src/lib/tabs/tab-panel/tab-panel.component.ts","../../../projects/shared-ui/src/lib/tabs/tab-view/tab-view.component.ts","../../../projects/shared-ui/src/lib/tabs/tab-view/tab-view.component.html","../../../projects/shared-ui/src/public-api.ts","../../../projects/shared-ui/src/sparc-shared-ui.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport { Component, ContentChild, Input, TemplateRef } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-tab-panel',\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `\r\n <ng-container *ngIf=\"renderKey\">\r\n <ng-container\r\n *ngTemplateOutlet=\"content; context: { data: data }\">\r\n </ng-container>\r\n </ng-container>\r\n `\r\n})\r\nexport class TabPanelComponent {\r\n @Input({ required: true }) id!: number | string;\r\n @Input() header = '';\r\n @Input() closable = false;\r\n @Input() data: any;\r\n\r\n @ContentChild(TemplateRef) content!: TemplateRef<any>;\r\n\r\n renderKey = 0;\r\n\r\n ngOnChanges() {\r\n this.renderKey++;\r\n }\r\n}\r\n\r\n","import {\r\n AfterContentInit,\r\n Component,\r\n ContentChildren,\r\n EventEmitter,\r\n Input,\r\n OnChanges,\r\n Output,\r\n QueryList,\r\n SimpleChanges\r\n} from '@angular/core';\r\nimport { TabsModule } from 'primeng/tabs';\r\nimport { TabPanelComponent } from '../tab-panel/tab-panel.component';\r\nimport { CommonModule } from '@angular/common';\r\n\r\n@Component({\r\n selector: 'app-tab-view',\r\n standalone: true,\r\n imports: [TabsModule, CommonModule],\r\n templateUrl: './tab-view.component.html',\r\n})\r\nexport class TabViewComponent implements AfterContentInit, OnChanges {\r\n\r\n @ContentChildren(TabPanelComponent)\r\n panelList!: QueryList<TabPanelComponent>;\r\n\r\n panels: TabPanelComponent[] = [];\r\n\r\n @Input() activeIndex = 0;\r\n @Input() scrollable = false;\r\n\r\n @Output() activeIndexChange = new EventEmitter<number>();\r\n @Output() onChange = new EventEmitter<any>();\r\n @Output() onClose = new EventEmitter<any>();\r\n\r\n activeValue: any;\r\n\r\n ngAfterContentInit() {\r\n this.syncPanels();\r\n\r\n this.panelList.changes.subscribe(() => {\r\n this.syncPanels();\r\n });\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (changes['activeIndex']) {\r\n this.updateActiveValue();\r\n }\r\n }\r\n\r\n private syncPanels() {\r\n this.panels = this.panelList.toArray();\r\n this.updateActiveValue();\r\n }\r\n\r\n private updateActiveValue() {\r\n this.activeValue = this.panels[this.activeIndex]?.id ?? null;\r\n }\r\n\r\n onValueChange(value: any) {\r\n const index = this.panels.findIndex(p => p.id === value);\r\n if (index === -1) return;\r\n\r\n this.activeIndex = index;\r\n this.activeIndexChange.emit(index);\r\n this.onChange.emit({ index });\r\n this.activeValue = value;\r\n }\r\n\r\n closeTab(panel: TabPanelComponent, event: Event) {\r\n event.stopPropagation();\r\n\r\n const index = this.panels.findIndex(p => p.id === panel.id);\r\n if (index === -1) return;\r\n\r\n // Child does NOT mutate data\r\n this.onClose.emit({\r\n index,\r\n panel\r\n });\r\n }\r\n\r\n\r\n}\r\n","<p-tabs [value]=\"activeValue\" (valueChange)=\"onValueChange($event)\" class=\"dashboard-Tab-View\">\r\n\r\n <p-tablist>\r\n @for (panel of panels; track panel.id) {\r\n <p-tab [value]=\"panel.id\">\r\n {{ panel.header }}\r\n @if (panel.closable) {\r\n <i class=\"pi pi-times\" (click)=\"closeTab(panel, $event)\"></i>\r\n }\r\n </p-tab>\r\n }\r\n </p-tablist>\r\n\r\n <p-tabpanels>\r\n @for (panel of panels; track panel.id) {\r\n <p-tabpanel [value]=\"panel.id\">\r\n <ng-container *ngTemplateOutlet=\"panel.content; context: { data: panel.data }\">\r\n </ng-container>\r\n </p-tabpanel>\r\n }\r\n </p-tabpanels>\r\n\r\n</p-tabs>","/*\r\n * Public API Surface of shared-ui\r\n */\r\n\r\nexport * from './lib';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,58 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sparc-shared-ui",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "sparc-shared-ui",
|
|
3
|
+
"version": "0.0.3",
|
|
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
|
+
"module": "fesm2022/sparc-shared-ui.mjs",
|
|
13
|
+
"typings": "types/sparc-shared-ui.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/sparc-shared-ui.d.ts",
|
|
20
|
+
"default": "./fesm2022/sparc-shared-ui.mjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
58
23
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { TemplateRef, AfterContentInit, OnChanges, QueryList, EventEmitter, SimpleChanges } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class TabPanelComponent {
|
|
5
|
+
id: number | string;
|
|
6
|
+
header: string;
|
|
7
|
+
closable: boolean;
|
|
8
|
+
data: any;
|
|
9
|
+
content: TemplateRef<any>;
|
|
10
|
+
renderKey: number;
|
|
11
|
+
ngOnChanges(): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TabPanelComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TabPanelComponent, "app-tab-panel", never, { "id": { "alias": "id"; "required": true; }; "header": { "alias": "header"; "required": false; }; "closable": { "alias": "closable"; "required": false; }; "data": { "alias": "data"; "required": false; }; }, {}, ["content"], never, true, never>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class TabViewComponent implements AfterContentInit, OnChanges {
|
|
17
|
+
panelList: QueryList<TabPanelComponent>;
|
|
18
|
+
panels: TabPanelComponent[];
|
|
19
|
+
activeIndex: number;
|
|
20
|
+
scrollable: boolean;
|
|
21
|
+
activeIndexChange: EventEmitter<number>;
|
|
22
|
+
onChange: EventEmitter<any>;
|
|
23
|
+
onClose: EventEmitter<any>;
|
|
24
|
+
activeValue: any;
|
|
25
|
+
ngAfterContentInit(): void;
|
|
26
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
27
|
+
private syncPanels;
|
|
28
|
+
private updateActiveValue;
|
|
29
|
+
onValueChange(value: any): void;
|
|
30
|
+
closeTab(panel: TabPanelComponent, event: Event): void;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TabViewComponent, never>;
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TabViewComponent, "app-tab-view", never, { "activeIndex": { "alias": "activeIndex"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; }, { "activeIndexChange": "activeIndexChange"; "onChange": "onChange"; "onClose": "onClose"; }, ["panelList"], never, true, never>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { TabPanelComponent, TabViewComponent };
|
package/.editorconfig
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
package/.vscode/extensions.json
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
package/.vscode/mcp.json
DELETED
package/.vscode/tasks.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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/angular.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
package/azure-pipelines.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1,63 +0,0 @@
|
|
|
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.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './tabs';
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
});
|
|
File without changes
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,23 +0,0 @@
|
|
|
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>
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
}
|