@fidurcode/dashboard-widgets-skeleton 1.0.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/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# DashboardWidgetsSkeleton
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, computed, Injectable, input, model, inject, Component, viewChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/material/button';
|
|
6
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
7
|
+
import * as i3 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i1 from '@angular/material/button-toggle';
|
|
10
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
11
|
+
import { wrapGrid } from 'animate-css-grid';
|
|
12
|
+
import * as i1$2 from '@angular/material/menu';
|
|
13
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
14
|
+
|
|
15
|
+
class WidgetService {
|
|
16
|
+
widgets = signal([], ...(ngDevMode ? [{ debugName: "widgets" }] : []));
|
|
17
|
+
addedWidgets = signal([], ...(ngDevMode ? [{ debugName: "addedWidgets" }] : []));
|
|
18
|
+
widgetsToAdd = computed(() => {
|
|
19
|
+
const addedIds = this.addedWidgets().map((widget) => widget.id);
|
|
20
|
+
return this.widgets().filter((w) => !addedIds.includes(w.id));
|
|
21
|
+
}, ...(ngDevMode ? [{ debugName: "widgetsToAdd" }] : []));
|
|
22
|
+
addWidget(widget) {
|
|
23
|
+
this.addedWidgets.set([...this.addedWidgets(), { ...widget }]);
|
|
24
|
+
}
|
|
25
|
+
updateWidget(id, widget) {
|
|
26
|
+
const index = this.addedWidgets().findIndex((w) => w.id === id);
|
|
27
|
+
if (index !== -1) {
|
|
28
|
+
const newWidgets = [...this.addedWidgets()];
|
|
29
|
+
newWidgets[index] = { ...newWidgets[index], ...widget };
|
|
30
|
+
this.addedWidgets.set(newWidgets);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
moveWidgetToLeft(id) {
|
|
34
|
+
const index = this.addedWidgets().findIndex((w) => w.id === id);
|
|
35
|
+
if (index == 0)
|
|
36
|
+
return;
|
|
37
|
+
const newWidgets = [...this.addedWidgets()];
|
|
38
|
+
[newWidgets[index], newWidgets[index - 1]] = [
|
|
39
|
+
{ ...newWidgets[index - 1] },
|
|
40
|
+
{ ...newWidgets[index] },
|
|
41
|
+
];
|
|
42
|
+
this.addedWidgets.set(newWidgets);
|
|
43
|
+
}
|
|
44
|
+
moveWidgetToRight(id) {
|
|
45
|
+
const index = this.addedWidgets().findIndex((w) => w.id === id);
|
|
46
|
+
if (index == this.addedWidgets().length - 1)
|
|
47
|
+
return;
|
|
48
|
+
const newWidgets = [...this.addedWidgets()];
|
|
49
|
+
[newWidgets[index], newWidgets[index + 1]] = [
|
|
50
|
+
{ ...newWidgets[index + 1] },
|
|
51
|
+
{ ...newWidgets[index] },
|
|
52
|
+
];
|
|
53
|
+
this.addedWidgets.set(newWidgets);
|
|
54
|
+
}
|
|
55
|
+
deleteWidget(id) {
|
|
56
|
+
this.addedWidgets.set(this.addedWidgets().filter((w) => w.id !== id));
|
|
57
|
+
}
|
|
58
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
59
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetService });
|
|
60
|
+
}
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetService, decorators: [{
|
|
62
|
+
type: Injectable
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
class WidgetOptionsComponent {
|
|
66
|
+
widget = input.required(...(ngDevMode ? [{ debugName: "widget" }] : []));
|
|
67
|
+
showOptions = model(false, ...(ngDevMode ? [{ debugName: "showOptions" }] : []));
|
|
68
|
+
store = inject(WidgetService);
|
|
69
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
70
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: WidgetOptionsComponent, isStandalone: false, selector: "app-widget-options", inputs: { widget: { classPropertyName: "widget", publicName: "widget", isSignal: true, isRequired: true, transformFunction: null }, showOptions: { classPropertyName: "showOptions", publicName: "showOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { showOptions: "showOptionsChange" }, ngImport: i0, template: "<button (click)=\"showOptions.set(false)\" class=\"close-button\" mat-icon-button>\n <mat-icon>close</mat-icon>\n</button>\n\n<div (click)=\"store.moveWidgetToRight(widget().id)\" class=\"move-forward-button\">\n <mat-icon>chevron_right</mat-icon>\n</div>\n\n<div (click)=\"store.moveWidgetToLeft(widget().id)\" class=\"move-backward-button\">\n <mat-icon>chevron_left</mat-icon>\n</div>\n\n<div (click)=\"store.deleteWidget(widget().id)\" class=\"remove-widget-button\">\n <mat-icon>delete</mat-icon>\n</div>\n\n<div>\n Width\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { columns: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().columns ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>\n\n<div>\n Height\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { rows: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().rows ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>", styles: [":host{position:absolute;z-index:2;background:inherit;color:inherit;top:0;left:0;border-radius:inherit;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;box-sizing:border-box;--mat-standard-button-toggle-height: 9px}:host>div{display:flex;gap:8px;align-items:center;margin-left:8px}.close-button{position:absolute;top:0;right:0}.move-forward-button{position:absolute;top:50%;transform:translateY(-50%);right:-5px}.move-backward-button{position:absolute;top:50%;transform:translateY(-50%);left:-5px}.remove-widget-button{position:absolute;top:0;left:0;padding:5px}\n"], dependencies: [{ kind: "directive", type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
71
|
+
}
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetOptionsComponent, decorators: [{
|
|
73
|
+
type: Component,
|
|
74
|
+
args: [{ selector: 'app-widget-options', standalone: false, template: "<button (click)=\"showOptions.set(false)\" class=\"close-button\" mat-icon-button>\n <mat-icon>close</mat-icon>\n</button>\n\n<div (click)=\"store.moveWidgetToRight(widget().id)\" class=\"move-forward-button\">\n <mat-icon>chevron_right</mat-icon>\n</div>\n\n<div (click)=\"store.moveWidgetToLeft(widget().id)\" class=\"move-backward-button\">\n <mat-icon>chevron_left</mat-icon>\n</div>\n\n<div (click)=\"store.deleteWidget(widget().id)\" class=\"remove-widget-button\">\n <mat-icon>delete</mat-icon>\n</div>\n\n<div>\n Width\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { columns: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().columns ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>\n\n<div>\n Height\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { rows: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().rows ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>", styles: [":host{position:absolute;z-index:2;background:inherit;color:inherit;top:0;left:0;border-radius:inherit;width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;box-sizing:border-box;--mat-standard-button-toggle-height: 9px}:host>div{display:flex;gap:8px;align-items:center;margin-left:8px}.close-button{position:absolute;top:0;right:0}.move-forward-button{position:absolute;top:50%;transform:translateY(-50%);right:-5px}.move-backward-button{position:absolute;top:50%;transform:translateY(-50%);left:-5px}.remove-widget-button{position:absolute;top:0;left:0;padding:5px}\n"] }]
|
|
75
|
+
}] });
|
|
76
|
+
|
|
77
|
+
class WidgetComponent {
|
|
78
|
+
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
79
|
+
showWidgetOptions = signal(false, ...(ngDevMode ? [{ debugName: "showWidgetOptions" }] : []));
|
|
80
|
+
get gridArea() {
|
|
81
|
+
const widget = this.data();
|
|
82
|
+
return `span ${widget.rows ?? 1} / span ${widget.columns ?? 1}`;
|
|
83
|
+
}
|
|
84
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: WidgetComponent, isStandalone: false, selector: "app-widget", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "style.grid-area": "gridArea" } }, ngImport: i0, template: "<div\n class=\"widget-container mat-elevation-z3\"\n>\n <h3 class=\"m-0\">{{ data().label }}</h3>\n <button (click)=\"showWidgetOptions.set(true)\" class=\"settings-button\" mat-icon-button>\n <mat-icon>settings</mat-icon>\n </button>\n\n <ng-container [ngComponentOutlet]=\"data().content\"/>\n\n @if (showWidgetOptions()) {\n <app-widget-options [(showOptions)]=\"showWidgetOptions\" [widget]=\"data()\"/>\n }\n</div>", styles: [":host{display:block;border-radius:16px}.widget-container{position:relative;height:100%;width:100%;padding:32px;box-sizing:border-box;border-radius:inherit;overflow:hidden;background-color:var(--mat-sys-background);cursor:pointer}.settings-button{position:absolute;top:20px;right:20px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: WidgetOptionsComponent, selector: "app-widget-options", inputs: ["widget", "showOptions"], outputs: ["showOptionsChange"] }] });
|
|
86
|
+
}
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: WidgetComponent, decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{ selector: 'app-widget', standalone: false, host: {
|
|
90
|
+
'[style.grid-area]': 'gridArea',
|
|
91
|
+
}, template: "<div\n class=\"widget-container mat-elevation-z3\"\n>\n <h3 class=\"m-0\">{{ data().label }}</h3>\n <button (click)=\"showWidgetOptions.set(true)\" class=\"settings-button\" mat-icon-button>\n <mat-icon>settings</mat-icon>\n </button>\n\n <ng-container [ngComponentOutlet]=\"data().content\"/>\n\n @if (showWidgetOptions()) {\n <app-widget-options [(showOptions)]=\"showWidgetOptions\" [widget]=\"data()\"/>\n }\n</div>", styles: [":host{display:block;border-radius:16px}.widget-container{position:relative;height:100%;width:100%;padding:32px;box-sizing:border-box;border-radius:inherit;overflow:hidden;background-color:var(--mat-sys-background);cursor:pointer}.settings-button{position:absolute;top:20px;right:20px}\n"] }]
|
|
92
|
+
}] });
|
|
93
|
+
|
|
94
|
+
class DashboardWidgetsComponent {
|
|
95
|
+
store = inject(WidgetService);
|
|
96
|
+
dashboard = viewChild.required('dashboard');
|
|
97
|
+
ngOnInit() {
|
|
98
|
+
wrapGrid(this.dashboard().nativeElement, { duration: 300 });
|
|
99
|
+
}
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DashboardWidgetsComponent, isStandalone: false, selector: "app-dashboard-widgets", providers: [WidgetService], viewQueries: [{ propertyName: "dashboard", first: true, predicate: ["dashboard"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"dashboard-widgets-header\">\n <h2>Dashboard</h2>\n <button [matMenuTriggerFor]=\"menu\" mat-raised-button>\n <mat-icon>add_circle</mat-icon>\n Add widget\n </button>\n <mat-menu #menu=\"matMenu\">\n @for (widget of store.widgetsToAdd(); track widget.id) {\n <button mat-menu-item (click)=\"store.addWidget(widget)\">{{ widget.label }}</button>\n } @empty {\n <button mat-menu-item>No widget to add</button>\n }\n </mat-menu>\n</div>\n<div #dashboard class=\"dashboard-widgets\">\n @for (w of store.addedWidgets(); track w.id) {\n <app-widget [data]=\"w\"/>\n }\n</div>", styles: [".dashboard-widgets-header{display:flex;justify-content:space-between;align-items:center}.dashboard-widgets{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));grid-auto-rows:150px;gap:16px}\n"], dependencies: [{ kind: "component", type: i1$2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i1$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i1$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: WidgetComponent, selector: "app-widget", inputs: ["data"] }] });
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsComponent, decorators: [{
|
|
104
|
+
type: Component,
|
|
105
|
+
args: [{ selector: 'app-dashboard-widgets', standalone: false, providers: [WidgetService], template: "<div class=\"dashboard-widgets-header\">\n <h2>Dashboard</h2>\n <button [matMenuTriggerFor]=\"menu\" mat-raised-button>\n <mat-icon>add_circle</mat-icon>\n Add widget\n </button>\n <mat-menu #menu=\"matMenu\">\n @for (widget of store.widgetsToAdd(); track widget.id) {\n <button mat-menu-item (click)=\"store.addWidget(widget)\">{{ widget.label }}</button>\n } @empty {\n <button mat-menu-item>No widget to add</button>\n }\n </mat-menu>\n</div>\n<div #dashboard class=\"dashboard-widgets\">\n @for (w of store.addedWidgets(); track w.id) {\n <app-widget [data]=\"w\"/>\n }\n</div>", styles: [".dashboard-widgets-header{display:flex;justify-content:space-between;align-items:center}.dashboard-widgets{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));grid-auto-rows:150px;gap:16px}\n"] }]
|
|
106
|
+
}] });
|
|
107
|
+
|
|
108
|
+
class DashboardWidgetsSkeletonModule {
|
|
109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsSkeletonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
110
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsSkeletonModule, declarations: [WidgetComponent,
|
|
111
|
+
WidgetOptionsComponent,
|
|
112
|
+
DashboardWidgetsComponent], imports: [CommonModule,
|
|
113
|
+
MatMenuModule,
|
|
114
|
+
MatButtonToggleModule,
|
|
115
|
+
MatButtonModule,
|
|
116
|
+
MatIconModule], exports: [WidgetComponent,
|
|
117
|
+
WidgetOptionsComponent,
|
|
118
|
+
DashboardWidgetsComponent,
|
|
119
|
+
MatMenuModule,
|
|
120
|
+
MatButtonToggleModule,
|
|
121
|
+
MatButtonModule,
|
|
122
|
+
MatIconModule] });
|
|
123
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsSkeletonModule, providers: [WidgetService], imports: [CommonModule,
|
|
124
|
+
MatMenuModule,
|
|
125
|
+
MatButtonToggleModule,
|
|
126
|
+
MatButtonModule,
|
|
127
|
+
MatIconModule, MatMenuModule,
|
|
128
|
+
MatButtonToggleModule,
|
|
129
|
+
MatButtonModule,
|
|
130
|
+
MatIconModule] });
|
|
131
|
+
}
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DashboardWidgetsSkeletonModule, decorators: [{
|
|
133
|
+
type: NgModule,
|
|
134
|
+
args: [{
|
|
135
|
+
declarations: [
|
|
136
|
+
WidgetComponent,
|
|
137
|
+
WidgetOptionsComponent,
|
|
138
|
+
DashboardWidgetsComponent,
|
|
139
|
+
],
|
|
140
|
+
imports: [
|
|
141
|
+
CommonModule,
|
|
142
|
+
MatMenuModule,
|
|
143
|
+
MatButtonToggleModule,
|
|
144
|
+
MatButtonModule,
|
|
145
|
+
MatIconModule,
|
|
146
|
+
],
|
|
147
|
+
exports: [
|
|
148
|
+
WidgetComponent,
|
|
149
|
+
WidgetOptionsComponent,
|
|
150
|
+
DashboardWidgetsComponent,
|
|
151
|
+
MatMenuModule,
|
|
152
|
+
MatButtonToggleModule,
|
|
153
|
+
MatButtonModule,
|
|
154
|
+
MatIconModule,
|
|
155
|
+
],
|
|
156
|
+
providers: [WidgetService]
|
|
157
|
+
}]
|
|
158
|
+
}] });
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* Public API Surface of dashboard-widgets-skeleton
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Generated bundle index. Do not edit.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
export { DashboardWidgetsComponent, DashboardWidgetsSkeletonModule, WidgetComponent, WidgetOptionsComponent, WidgetService };
|
|
169
|
+
//# sourceMappingURL=fidurcode-dashboard-widgets-skeleton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fidurcode-dashboard-widgets-skeleton.mjs","sources":["../../../projects/dashboard-widgets-skeleton/src/lib/services/widget.service.ts","../../../projects/dashboard-widgets-skeleton/src/lib/components/widget-options/widget-options.component.ts","../../../projects/dashboard-widgets-skeleton/src/lib/components/widget-options/widget-options.component.html","../../../projects/dashboard-widgets-skeleton/src/lib/components/widget/widget.component.ts","../../../projects/dashboard-widgets-skeleton/src/lib/components/widget/widget.component.html","../../../projects/dashboard-widgets-skeleton/src/lib/components/dashboard-widgets/dashboard-widgets.component.ts","../../../projects/dashboard-widgets-skeleton/src/lib/components/dashboard-widgets/dashboard-widgets.component.html","../../../projects/dashboard-widgets-skeleton/src/lib/dashboard-widgets-skeleton.module.ts","../../../projects/dashboard-widgets-skeleton/src/public-api.ts","../../../projects/dashboard-widgets-skeleton/src/fidurcode-dashboard-widgets-skeleton.ts"],"sourcesContent":["import {\n computed,\n Injectable,\n Signal,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { Widget } from '../components/widget/widget';\n\n@Injectable()\nexport class WidgetService {\n public widgets: WritableSignal<Widget[]> = signal<Widget[]>([\n\n ]);\n\n addedWidgets: WritableSignal<Widget[]> = signal<Widget[]>([\n\n ]);\n\n widgetsToAdd: Signal<Widget[]> = computed((): Widget[] => {\n const addedIds: number[] = this.addedWidgets().map(\n (widget: Widget): number => widget.id,\n );\n return this.widgets().filter((w): boolean => !addedIds.includes(w.id));\n });\n\n addWidget(widget: Widget): void {\n this.addedWidgets.set([...this.addedWidgets(), { ...widget }]);\n }\n\n updateWidget(id: number, widget: Partial<Widget>): void {\n const index = this.addedWidgets().findIndex((w) => w.id === id);\n if (index !== -1) {\n const newWidgets = [...this.addedWidgets()];\n newWidgets[index] = { ...newWidgets[index], ...widget };\n this.addedWidgets.set(newWidgets);\n }\n }\n\n moveWidgetToLeft(id: number): void {\n const index = this.addedWidgets().findIndex((w) => w.id === id);\n if (index == 0) return;\n const newWidgets = [...this.addedWidgets()];\n [newWidgets[index], newWidgets[index - 1]] = [\n { ...newWidgets[index - 1] },\n { ...newWidgets[index] },\n ];\n\n this.addedWidgets.set(newWidgets);\n }\n\n moveWidgetToRight(id: number): void {\n const index = this.addedWidgets().findIndex((w) => w.id === id);\n if (index == this.addedWidgets().length - 1) return;\n const newWidgets = [...this.addedWidgets()];\n [newWidgets[index], newWidgets[index + 1]] = [\n { ...newWidgets[index + 1] },\n { ...newWidgets[index] },\n ];\n\n this.addedWidgets.set(newWidgets);\n }\n\n deleteWidget(id: number): void {\n this.addedWidgets.set(this.addedWidgets().filter((w) => w.id !== id));\n }\n}\n","import {\n Component,\n inject,\n input,\n InputSignal,\n model,\n ModelSignal,\n} from '@angular/core';\nimport { Widget } from '../widget/widget';\nimport { WidgetService } from '../../services/widget.service';\n\n@Component({\n selector: 'app-widget-options',\n standalone: false,\n templateUrl: './widget-options.component.html',\n styleUrl: './widget-options.component.scss',\n})\nexport class WidgetOptionsComponent {\n widget: InputSignal<Widget> = input.required<Widget>();\n showOptions: ModelSignal<boolean> = model<boolean>(false);\n\n store = inject(WidgetService);\n}\n","<button (click)=\"showOptions.set(false)\" class=\"close-button\" mat-icon-button>\n <mat-icon>close</mat-icon>\n</button>\n\n<div (click)=\"store.moveWidgetToRight(widget().id)\" class=\"move-forward-button\">\n <mat-icon>chevron_right</mat-icon>\n</div>\n\n<div (click)=\"store.moveWidgetToLeft(widget().id)\" class=\"move-backward-button\">\n <mat-icon>chevron_left</mat-icon>\n</div>\n\n<div (click)=\"store.deleteWidget(widget().id)\" class=\"remove-widget-button\">\n <mat-icon>delete</mat-icon>\n</div>\n\n<div>\n Width\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { columns: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().columns ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>\n\n<div>\n Height\n <mat-button-toggle-group\n (change)=\"store.updateWidget(widget().id, { rows: +$event.value })\"\n [hideSingleSelectionIndicator]=\"true\"\n [value]=\"widget().rows ?? 1\">\n <mat-button-toggle [value]=\"1\">1</mat-button-toggle>\n <mat-button-toggle [value]=\"2\">2</mat-button-toggle>\n <mat-button-toggle [value]=\"3\">3</mat-button-toggle>\n <mat-button-toggle [value]=\"4\">4</mat-button-toggle>\n </mat-button-toggle-group>\n</div>","import {\n Component,\n input,\n InputSignal,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { Widget } from './widget';\n\n@Component({\n selector: 'app-widget',\n standalone: false,\n templateUrl: './widget.component.html',\n styleUrl: './widget.component.scss',\n host: {\n '[style.grid-area]': 'gridArea',\n },\n})\nexport class WidgetComponent {\n data: InputSignal<Widget> = input.required<Widget>();\n\n showWidgetOptions: WritableSignal<boolean> = signal<boolean>(false);\n\n get gridArea(): string {\n const widget: Widget = this.data();\n return `span ${widget.rows ?? 1} / span ${widget.columns ?? 1}`;\n }\n}\n","<div\n class=\"widget-container mat-elevation-z3\"\n>\n <h3 class=\"m-0\">{{ data().label }}</h3>\n <button (click)=\"showWidgetOptions.set(true)\" class=\"settings-button\" mat-icon-button>\n <mat-icon>settings</mat-icon>\n </button>\n\n <ng-container [ngComponentOutlet]=\"data().content\"/>\n\n @if (showWidgetOptions()) {\n <app-widget-options [(showOptions)]=\"showWidgetOptions\" [widget]=\"data()\"/>\n }\n</div>","import {\n Component,\n ElementRef,\n inject,\n OnInit,\n viewChild,\n} from '@angular/core';\nimport { WidgetService } from '../../services/widget.service';\nimport { wrapGrid } from 'animate-css-grid';\n\n@Component({\n selector: 'app-dashboard-widgets',\n standalone: false,\n templateUrl: './dashboard-widgets.component.html',\n styleUrl: './dashboard-widgets.component.scss',\n providers: [WidgetService],\n})\nexport class DashboardWidgetsComponent implements OnInit {\n store = inject(WidgetService);\n\n dashboard = viewChild.required<ElementRef>('dashboard');\n\n ngOnInit(): void {\n wrapGrid(this.dashboard().nativeElement, { duration: 300 });\n }\n}\n","<div class=\"dashboard-widgets-header\">\n <h2>Dashboard</h2>\n <button [matMenuTriggerFor]=\"menu\" mat-raised-button>\n <mat-icon>add_circle</mat-icon>\n Add widget\n </button>\n <mat-menu #menu=\"matMenu\">\n @for (widget of store.widgetsToAdd(); track widget.id) {\n <button mat-menu-item (click)=\"store.addWidget(widget)\">{{ widget.label }}</button>\n } @empty {\n <button mat-menu-item>No widget to add</button>\n }\n </mat-menu>\n</div>\n<div #dashboard class=\"dashboard-widgets\">\n @for (w of store.addedWidgets(); track w.id) {\n <app-widget [data]=\"w\"/>\n }\n</div>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { WidgetComponent } from './components/widget/widget.component';\nimport { WidgetOptionsComponent } from './components/widget-options/widget-options.component';\nimport { DashboardWidgetsComponent } from './components/dashboard-widgets/dashboard-widgets.component';\nimport { WidgetService } from './services/widget.service';\n\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\n\n@NgModule({\n declarations: [\n WidgetComponent,\n WidgetOptionsComponent,\n DashboardWidgetsComponent,\n ],\n imports: [\n CommonModule,\n MatMenuModule,\n MatButtonToggleModule,\n MatButtonModule,\n MatIconModule,\n ],\n exports: [\n WidgetComponent,\n WidgetOptionsComponent,\n DashboardWidgetsComponent,\n MatMenuModule,\n MatButtonToggleModule,\n MatButtonModule,\n MatIconModule,\n ],\n providers: [WidgetService]\n})\nexport class DashboardWidgetsSkeletonModule {}\n","/*\n * Public API Surface of dashboard-widgets-skeleton\n */\n\nexport * from './lib/components/widget/widget.component';\nexport * from './lib/components/widget-options/widget-options.component';\nexport * from './lib/components/dashboard-widgets/dashboard-widgets.component';\nexport * from './lib/services/widget.service';\nexport * from './lib/dashboard-widgets-skeleton.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i4.WidgetOptionsComponent","i4.WidgetComponent"],"mappings":";;;;;;;;;;;;;;MAUa,aAAa,CAAA;AACjB,IAAA,OAAO,GAA6B,MAAM,CAAW,EAE3D,mDAAC;AAEF,IAAA,YAAY,GAA6B,MAAM,CAAW,EAEzD,wDAAC;AAEF,IAAA,YAAY,GAAqB,QAAQ,CAAC,MAAe;AACvD,QAAA,MAAM,QAAQ,GAAa,IAAI,CAAC,YAAY,EAAE,CAAC,GAAG,CAChD,CAAC,MAAc,KAAa,MAAM,CAAC,EAAE,CACtC;QACD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,IAAA,CAAC,wDAAC;AAEF,IAAA,SAAS,CAAC,MAAc,EAAA;AACtB,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAChE;IAEA,YAAY,CAAC,EAAU,EAAE,MAAuB,EAAA;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE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sBAAsB;wBACtB,yBAAyB;wBACzB,aAAa;wBACb,qBAAqB;wBACrB,eAAe;wBACf,aAAa;AACd,qBAAA;oBACD,SAAS,EAAE,CAAC,aAAa;AAC1B,iBAAA;;;ACnCD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Type, InputSignal, WritableSignal, Signal, ModelSignal, OnInit, ElementRef } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
4
|
+
import * as i5 from '@angular/material/menu';
|
|
5
|
+
import * as i6 from '@angular/material/button-toggle';
|
|
6
|
+
import * as i7 from '@angular/material/button';
|
|
7
|
+
import * as i8 from '@angular/material/icon';
|
|
8
|
+
|
|
9
|
+
interface Widget {
|
|
10
|
+
id: number;
|
|
11
|
+
label: string;
|
|
12
|
+
content: Type<unknown>;
|
|
13
|
+
rows?: number;
|
|
14
|
+
columns?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class WidgetComponent {
|
|
18
|
+
data: InputSignal<Widget>;
|
|
19
|
+
showWidgetOptions: WritableSignal<boolean>;
|
|
20
|
+
get gridArea(): string;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WidgetComponent, "app-widget", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; }, {}, never, never, false, never>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class WidgetService {
|
|
26
|
+
widgets: WritableSignal<Widget[]>;
|
|
27
|
+
addedWidgets: WritableSignal<Widget[]>;
|
|
28
|
+
widgetsToAdd: Signal<Widget[]>;
|
|
29
|
+
addWidget(widget: Widget): void;
|
|
30
|
+
updateWidget(id: number, widget: Partial<Widget>): void;
|
|
31
|
+
moveWidgetToLeft(id: number): void;
|
|
32
|
+
moveWidgetToRight(id: number): void;
|
|
33
|
+
deleteWidget(id: number): void;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetService, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WidgetService>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class WidgetOptionsComponent {
|
|
39
|
+
widget: InputSignal<Widget>;
|
|
40
|
+
showOptions: ModelSignal<boolean>;
|
|
41
|
+
store: WidgetService;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WidgetOptionsComponent, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WidgetOptionsComponent, "app-widget-options", never, { "widget": { "alias": "widget"; "required": true; "isSignal": true; }; "showOptions": { "alias": "showOptions"; "required": false; "isSignal": true; }; }, { "showOptions": "showOptionsChange"; }, never, never, false, never>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare class DashboardWidgetsComponent implements OnInit {
|
|
47
|
+
store: WidgetService;
|
|
48
|
+
dashboard: i0.Signal<ElementRef<any>>;
|
|
49
|
+
ngOnInit(): void;
|
|
50
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DashboardWidgetsComponent, never>;
|
|
51
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DashboardWidgetsComponent, "app-dashboard-widgets", never, {}, {}, never, never, false, never>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare class DashboardWidgetsSkeletonModule {
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DashboardWidgetsSkeletonModule, never>;
|
|
56
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DashboardWidgetsSkeletonModule, [typeof WidgetComponent, typeof WidgetOptionsComponent, typeof DashboardWidgetsComponent], [typeof i4.CommonModule, typeof i5.MatMenuModule, typeof i6.MatButtonToggleModule, typeof i7.MatButtonModule, typeof i8.MatIconModule], [typeof WidgetComponent, typeof WidgetOptionsComponent, typeof DashboardWidgetsComponent, typeof i5.MatMenuModule, typeof i6.MatButtonToggleModule, typeof i7.MatButtonModule, typeof i8.MatIconModule]>;
|
|
57
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DashboardWidgetsSkeletonModule>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { DashboardWidgetsComponent, DashboardWidgetsSkeletonModule, WidgetComponent, WidgetOptionsComponent, WidgetService };
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../projects/dashboard-widgets-skeleton/src/lib/components/widget/widget.ts","../../projects/dashboard-widgets-skeleton/src/lib/components/widget/widget.component.ts","../../projects/dashboard-widgets-skeleton/src/lib/services/widget.service.ts","../../projects/dashboard-widgets-skeleton/src/lib/components/widget-options/widget-options.component.ts","../../projects/dashboard-widgets-skeleton/src/lib/components/dashboard-widgets/dashboard-widgets.component.ts","../../projects/dashboard-widgets-skeleton/src/lib/dashboard-widgets-skeleton.module.ts"],"sourcesContent":[null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;AAKE;;;AAGD;;ACCD;AAUE;AAEA;;;;AAMD;;AClBD;AAES;AAIP;AAIA;AAOA;AAIA;AASA;AAYA;AAYA;;;AAGD;;ACvDD;AAOE;AACA;AAEA;;;AACD;;ACZD;AAQE;AAEA;AAEA;;;AAGD;;ACbD;;;;AAwB8C;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fidurcode/dashboard-widgets-skeleton",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"private": false,
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@angular/animations": "20.1.2",
|
|
8
|
+
"@angular/cdk": "20.1.2",
|
|
9
|
+
"@angular/common": "20.1.2",
|
|
10
|
+
"@angular/compiler": "20.1.2",
|
|
11
|
+
"@angular/core": "20.1.2",
|
|
12
|
+
"@angular/forms": "20.1.2",
|
|
13
|
+
"@angular/material": "20.1.2",
|
|
14
|
+
"@angular/platform-browser": "20.1.2",
|
|
15
|
+
"@angular/router": "20.1.2",
|
|
16
|
+
"rxjs": "~7.8.0"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"tslib": "^2.3.0"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"module": "fesm2022/fidurcode-dashboard-widgets-skeleton.mjs",
|
|
23
|
+
"typings": "index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./package.json": {
|
|
26
|
+
"default": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./index.d.ts",
|
|
30
|
+
"default": "./fesm2022/fidurcode-dashboard-widgets-skeleton.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|