@yuuvis/client-components 3.0.0-beta.21.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/README.md +3 -0
- package/autocomplete/README.md +3 -0
- package/common/README.md +3 -0
- package/datepicker/README.md +3 -0
- package/fesm2022/yuuvis-client-components-autocomplete.mjs +236 -0
- package/fesm2022/yuuvis-client-components-autocomplete.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-common.mjs +1724 -0
- package/fesm2022/yuuvis-client-components-common.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-datepicker.mjs +456 -0
- package/fesm2022/yuuvis-client-components-datepicker.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-list.mjs +666 -0
- package/fesm2022/yuuvis-client-components-list.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-master-details.mjs +136 -0
- package/fesm2022/yuuvis-client-components-master-details.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-overflow-hidden.mjs +109 -0
- package/fesm2022/yuuvis-client-components-overflow-hidden.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-overflow-menu.mjs +171 -0
- package/fesm2022/yuuvis-client-components-overflow-menu.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-popout.mjs +240 -0
- package/fesm2022/yuuvis-client-components-popout.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-split-view.mjs +317 -0
- package/fesm2022/yuuvis-client-components-split-view.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components-widget-grid.mjs +933 -0
- package/fesm2022/yuuvis-client-components-widget-grid.mjs.map +1 -0
- package/fesm2022/yuuvis-client-components.mjs +18 -0
- package/fesm2022/yuuvis-client-components.mjs.map +1 -0
- package/lib/assets/i18n/de.json +56 -0
- package/lib/assets/i18n/en.json +56 -0
- package/list/README.md +3 -0
- package/master-details/README.md +3 -0
- package/overflow-hidden/README.md +3 -0
- package/overflow-menu/README.md +3 -0
- package/package.json +67 -0
- package/popout/README.md +3 -0
- package/split-view/README.md +3 -0
- package/types/yuuvis-client-components-autocomplete.d.ts +89 -0
- package/types/yuuvis-client-components-common.d.ts +536 -0
- package/types/yuuvis-client-components-datepicker.d.ts +94 -0
- package/types/yuuvis-client-components-list.d.ts +380 -0
- package/types/yuuvis-client-components-master-details.d.ts +69 -0
- package/types/yuuvis-client-components-overflow-hidden.d.ts +72 -0
- package/types/yuuvis-client-components-overflow-menu.d.ts +89 -0
- package/types/yuuvis-client-components-popout.d.ts +106 -0
- package/types/yuuvis-client-components-split-view.d.ts +197 -0
- package/types/yuuvis-client-components-widget-grid.d.ts +299 -0
- package/types/yuuvis-client-components.d.ts +8 -0
- package/widget-grid/README.md +48 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy, ElementRef } from '@angular/core';
|
|
3
|
+
import * as i3 from '@yuuvis/material/panes';
|
|
4
|
+
export { FullscreenDirective } from '@yuuvis/material/panes';
|
|
5
|
+
|
|
6
|
+
declare enum PopoutTriggerPosition {
|
|
7
|
+
TOP_LEFT = "tl",
|
|
8
|
+
TOP_RIGHT = "tr",
|
|
9
|
+
BOTTOM_LEFT = "bl",
|
|
10
|
+
BOTTOM_RIGHT = "br",
|
|
11
|
+
NONE = "none"
|
|
12
|
+
}
|
|
13
|
+
interface PopoutTriggerConfig {
|
|
14
|
+
popoutIcon?: string;
|
|
15
|
+
popinIcon?: string;
|
|
16
|
+
popoutTooltip?: string;
|
|
17
|
+
popinTooltip?: string;
|
|
18
|
+
}
|
|
19
|
+
interface PopoutWindowConfig {
|
|
20
|
+
title?: string;
|
|
21
|
+
position?: {
|
|
22
|
+
blockStart?: number;
|
|
23
|
+
inlineStart?: number;
|
|
24
|
+
};
|
|
25
|
+
size?: {
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Component that enables the wrapped content to be 'popped out' as new window.
|
|
33
|
+
* It will place a button (icon) to trigger popout on top of the wrapped content. You
|
|
34
|
+
* can place this trigger element setting the 'triggerPosition' input.
|
|
35
|
+
*
|
|
36
|
+
* Providing a 'popoutWindowConfig' will also enable you to influence the appearance of
|
|
37
|
+
* the spawned window.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
declare class PopoutComponent implements OnDestroy {
|
|
41
|
+
#private;
|
|
42
|
+
beforeunloadHandler(): void;
|
|
43
|
+
innerWrapper: _angular_core.Signal<ElementRef<any>>;
|
|
44
|
+
popoutWrapper: _angular_core.Signal<ElementRef<any>>;
|
|
45
|
+
/**
|
|
46
|
+
* Where the popout trigger should be located on the component
|
|
47
|
+
*/
|
|
48
|
+
triggerPosition: _angular_core.InputSignal<PopoutTriggerPosition>;
|
|
49
|
+
/**
|
|
50
|
+
* Icon to be redered inside the trigger
|
|
51
|
+
*/
|
|
52
|
+
triggerIcon: _angular_core.InputSignal<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Tooltip text for the trigger button
|
|
55
|
+
*/
|
|
56
|
+
triggerTooltip: _angular_core.InputSignal<string | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* configuration of the popped out window
|
|
59
|
+
*/
|
|
60
|
+
popoutWindowConfig: _angular_core.InputSignal<PopoutWindowConfig | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Whether or not to disable the undock feature
|
|
63
|
+
*/
|
|
64
|
+
disabled: _angular_core.InputSignal<boolean | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Emitted when the child component is popped out
|
|
67
|
+
*/
|
|
68
|
+
popOut: _angular_core.OutputEmitterRef<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Emitted when the child component is popped in again
|
|
71
|
+
*/
|
|
72
|
+
popIn: _angular_core.OutputEmitterRef<boolean>;
|
|
73
|
+
poppedOut: _angular_core.Signal<boolean>;
|
|
74
|
+
get isPoppedOut(): boolean;
|
|
75
|
+
pop(e: MouseEvent): void;
|
|
76
|
+
private _popIn;
|
|
77
|
+
private _popOut;
|
|
78
|
+
private _createPopoutWindow;
|
|
79
|
+
private _getWindowPositioning;
|
|
80
|
+
private _close;
|
|
81
|
+
private _cloneStylesToPopoutWindow;
|
|
82
|
+
private _observeFutureStyleChanges;
|
|
83
|
+
ngOnDestroy(): void;
|
|
84
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PopoutComponent, never>;
|
|
85
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PopoutComponent, "yuv-popout", ["yuvPopout"], { "triggerPosition": { "alias": "triggerPosition"; "required": false; "isSignal": true; }; "triggerIcon": { "alias": "triggerIcon"; "required": false; "isSignal": true; }; "triggerTooltip": { "alias": "triggerTooltip"; "required": false; "isSignal": true; }; "popoutWindowConfig": { "alias": "popoutWindowConfig"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "popOut": "popOut"; "popIn": "popIn"; }, never, ["*"], true, never>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare class PopoutTriggerComponent {
|
|
89
|
+
private translate;
|
|
90
|
+
config: _angular_core.InputSignal<PopoutTriggerConfig | undefined>;
|
|
91
|
+
popout: _angular_core.InputSignal<PopoutComponent | undefined>;
|
|
92
|
+
icon: _angular_core.Signal<string>;
|
|
93
|
+
tooltip: _angular_core.Signal<any>;
|
|
94
|
+
trigger(e: MouseEvent): void;
|
|
95
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PopoutTriggerComponent, never>;
|
|
96
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PopoutTriggerComponent, "yuv-popout-trigger", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "popout": { "alias": "popout"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare class YuvPopoutModule {
|
|
100
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<YuvPopoutModule, never>;
|
|
101
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<YuvPopoutModule, never, [typeof PopoutComponent, typeof PopoutTriggerComponent, typeof i3.FullscreenDirective], [typeof PopoutComponent, typeof PopoutTriggerComponent, typeof i3.FullscreenDirective]>;
|
|
102
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<YuvPopoutModule>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { PopoutComponent, PopoutTriggerComponent, PopoutTriggerPosition, YuvPopoutModule };
|
|
106
|
+
export type { PopoutTriggerConfig, PopoutWindowConfig };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef, AfterViewInit } from '@angular/core';
|
|
3
|
+
import * as angular_split from 'angular-split';
|
|
4
|
+
import { SplitAreaSize, SplitGutterInteractionEvent, SplitComponent, SplitDirection } from 'angular-split';
|
|
5
|
+
|
|
6
|
+
interface SplitViewLayoutSettings {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
areas: Array<SplitAreaLayoutSettings>;
|
|
9
|
+
}
|
|
10
|
+
interface SplitAreaLayoutSettings {
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
lockSize?: boolean;
|
|
13
|
+
size?: SplitAreaSize;
|
|
14
|
+
}
|
|
15
|
+
type SplitViewOutputData = SplitGutterInteractionEvent;
|
|
16
|
+
|
|
17
|
+
declare class SplitAreaDirective {
|
|
18
|
+
template: TemplateRef<any>;
|
|
19
|
+
size: _angular_core.InputSignal<SplitAreaSize | undefined>;
|
|
20
|
+
minSize: _angular_core.InputSignal<number | undefined>;
|
|
21
|
+
maxSize: _angular_core.InputSignal<number | undefined>;
|
|
22
|
+
panelClass: _angular_core.InputSignal<string | undefined>;
|
|
23
|
+
visible: _angular_core.InputSignal<boolean>;
|
|
24
|
+
lockSize: _angular_core.InputSignal<boolean>;
|
|
25
|
+
areaProperties: _angular_core.WritableSignal<{
|
|
26
|
+
size: SplitAreaSize | undefined;
|
|
27
|
+
visible: boolean;
|
|
28
|
+
lockSize: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
updateSettings(s: SplitAreaLayoutSettings): void;
|
|
31
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SplitAreaDirective, never>;
|
|
32
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SplitAreaDirective, "[yuvSplitArea]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "minSize": { "alias": "minSize"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "lockSize": { "alias": "lockSize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Component for creating a split view with resizable areas.
|
|
37
|
+
*
|
|
38
|
+
* Each area is defined using the `yuvSplitArea` directive on an `ng-template`.
|
|
39
|
+
* Areas can be resized by dragging the gutter between them.
|
|
40
|
+
*
|
|
41
|
+
* ### Basic usage
|
|
42
|
+
* ```html
|
|
43
|
+
* <yuv-split-view>
|
|
44
|
+
* <ng-template yuvSplitArea [size]="20">Aside</ng-template>
|
|
45
|
+
* <ng-template yuvSplitArea [size]="80">Main</ng-template>
|
|
46
|
+
* </yuv-split-view>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ### Collapsible areas
|
|
50
|
+
* Areas can be shown, hidden, or toggled programmatically. Use a template
|
|
51
|
+
* reference variable to call the visibility methods from the template:
|
|
52
|
+
*
|
|
53
|
+
* ```html
|
|
54
|
+
* <yuv-split-view #sv>
|
|
55
|
+
* <ng-template yuvSplitArea [size]="25">
|
|
56
|
+
* <button (click)="sv.hideArea(0)">Collapse</button>
|
|
57
|
+
* Left pane
|
|
58
|
+
* </ng-template>
|
|
59
|
+
* <ng-template yuvSplitArea [size]="75">
|
|
60
|
+
* <button (click)="sv.showArea(0)">Expand left</button>
|
|
61
|
+
* Main pane
|
|
62
|
+
* </ng-template>
|
|
63
|
+
* </yuv-split-view>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ### Persisting layout state
|
|
67
|
+
* Set `layoutSettingsID` to persist area sizes and visibility to
|
|
68
|
+
* localStorage. The saved state is automatically restored on init.
|
|
69
|
+
*
|
|
70
|
+
* ```html
|
|
71
|
+
* <yuv-split-view [layoutSettingsID]="'my-layout'">
|
|
72
|
+
* ...
|
|
73
|
+
* </yuv-split-view>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare class SplitViewComponent implements AfterViewInit {
|
|
77
|
+
#private;
|
|
78
|
+
splitAreas: _angular_core.Signal<readonly SplitAreaDirective[]>;
|
|
79
|
+
asSplitComponent: _angular_core.Signal<SplitComponent>;
|
|
80
|
+
splitAreaSizes: SplitAreaSize[];
|
|
81
|
+
/**
|
|
82
|
+
* The split views direction. Could be 'horizontal' or 'vertical'. Defaults to 'horizontal'.
|
|
83
|
+
*/
|
|
84
|
+
direction: _angular_core.InputSignal<SplitDirection>;
|
|
85
|
+
isVertical: _angular_core.Signal<boolean>;
|
|
86
|
+
isHorizontal: _angular_core.Signal<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Size of the gutter in Pixel (defaults to 16).
|
|
89
|
+
*/
|
|
90
|
+
gutterSize: _angular_core.InputSignal<number>;
|
|
91
|
+
/**
|
|
92
|
+
* If true, the gutter can only be moved in steps of 1%.
|
|
93
|
+
*/
|
|
94
|
+
restrictMove: _angular_core.InputSignal<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Disable the dragging feature (remove cursor/image on gutters).
|
|
97
|
+
*/
|
|
98
|
+
disabledInput: _angular_core.InputSignal<boolean>;
|
|
99
|
+
disabled: _angular_core.WritableSignal<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Layout settings are the state of the split view that could be persisted.
|
|
102
|
+
* Setting a `layoutSettingsID` will save the current state (split area sizes etc.)
|
|
103
|
+
* to the local storage. If the component is created, it will load those settings and
|
|
104
|
+
* re-apply them.
|
|
105
|
+
*/
|
|
106
|
+
layoutSettingsID: _angular_core.InputSignal<string | undefined>;
|
|
107
|
+
/**
|
|
108
|
+
* Emitted when the state (split area sizes etc.) of the split view changed.
|
|
109
|
+
*/
|
|
110
|
+
layoutSettingsChange: _angular_core.OutputEmitterRef<SplitViewLayoutSettings>;
|
|
111
|
+
/**
|
|
112
|
+
* Emitted when dragging the split gutter starts
|
|
113
|
+
*/
|
|
114
|
+
dragStart: _angular_core.OutputEmitterRef<angular_split.SplitGutterInteractionEvent>;
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when dragging the split gutter ends
|
|
117
|
+
*/
|
|
118
|
+
dragEnd: _angular_core.OutputEmitterRef<angular_split.SplitGutterInteractionEvent>;
|
|
119
|
+
/**
|
|
120
|
+
* Emitted when the split gutter is clicked.
|
|
121
|
+
*/
|
|
122
|
+
gutterClick: _angular_core.OutputEmitterRef<angular_split.SplitGutterInteractionEvent>;
|
|
123
|
+
/**
|
|
124
|
+
* Emitted when the split gutter is double clicked (you may also want to
|
|
125
|
+
* set a different click duration indicating a double click). This could be
|
|
126
|
+
* set using the `gutterDblClickDuration` to a value in milliseconds (default is 400ms)
|
|
127
|
+
*/
|
|
128
|
+
gutterDblClick: _angular_core.OutputEmitterRef<angular_split.SplitGutterInteractionEvent>;
|
|
129
|
+
dragging: _angular_core.WritableSignal<boolean>;
|
|
130
|
+
onDragStart(e: SplitViewOutputData): void;
|
|
131
|
+
onDragEnd(e: SplitViewOutputData): void;
|
|
132
|
+
/**
|
|
133
|
+
* Show a previously hidden split area, restoring it to its last known size.
|
|
134
|
+
*
|
|
135
|
+
* ```html
|
|
136
|
+
* <button (click)="sv.showArea(0)">Show left pane</button>
|
|
137
|
+
* ```
|
|
138
|
+
* @param index Zero-based index of the split area to show
|
|
139
|
+
*/
|
|
140
|
+
showArea(index: number): void;
|
|
141
|
+
/**
|
|
142
|
+
* Hide a split area by collapsing it to zero width/height. The adjacent
|
|
143
|
+
* areas will expand to fill the freed space.
|
|
144
|
+
*
|
|
145
|
+
* ```html
|
|
146
|
+
* <button (click)="sv.hideArea(0)">Hide left pane</button>
|
|
147
|
+
* ```
|
|
148
|
+
* @param index Zero-based index of the split area to hide
|
|
149
|
+
*/
|
|
150
|
+
hideArea(index: number): void;
|
|
151
|
+
/**
|
|
152
|
+
* Toggle the visibility of a split area. If the area is currently visible
|
|
153
|
+
* it will be collapsed; if it is hidden it will be restored.
|
|
154
|
+
*
|
|
155
|
+
* ```html
|
|
156
|
+
* <button (click)="sv.toggleArea(0)">Toggle left pane</button>
|
|
157
|
+
* ```
|
|
158
|
+
* @param index Zero-based index of the split area to toggle
|
|
159
|
+
*/
|
|
160
|
+
toggleArea(index: number): void;
|
|
161
|
+
/**
|
|
162
|
+
* Returns whether a split area is currently visible. Useful for
|
|
163
|
+
* conditionally rendering expand/collapse buttons in the template.
|
|
164
|
+
*
|
|
165
|
+
* ```html
|
|
166
|
+
* @if (!sv.isAreaVisible(0)) {
|
|
167
|
+
* <button (click)="sv.showArea(0)">Expand left</button>
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
* @param index Zero-based index of the split area to check
|
|
171
|
+
* @returns `true` if the area is visible, `false` if hidden
|
|
172
|
+
*/
|
|
173
|
+
isAreaVisible(index: number): boolean;
|
|
174
|
+
/** @deprecated Use `showArea()` / `hideArea()` instead */
|
|
175
|
+
splitAreaSetVisibility(index: number, visible: boolean): void;
|
|
176
|
+
/** @deprecated Use `toggleArea()` instead */
|
|
177
|
+
splitAreaToggleVisibility(index: number): void;
|
|
178
|
+
/**
|
|
179
|
+
* Programmatically apply layout settings (area sizes, visibility, disabled state).
|
|
180
|
+
* This is called automatically on init when `layoutSettingsID` is set, but can
|
|
181
|
+
* also be used to restore a specific layout configuration at any time.
|
|
182
|
+
* @param settings The layout settings to apply
|
|
183
|
+
*/
|
|
184
|
+
applyLayoutSettings(settings: SplitViewLayoutSettings): void;
|
|
185
|
+
ngAfterViewInit(): void;
|
|
186
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SplitViewComponent, never>;
|
|
187
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SplitViewComponent, "yuv-split-view", never, { "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "gutterSize": { "alias": "gutterSize"; "required": false; "isSignal": true; }; "restrictMove": { "alias": "restrictMove"; "required": false; "isSignal": true; }; "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "layoutSettingsID": { "alias": "layoutSettingsID"; "required": false; "isSignal": true; }; }, { "layoutSettingsChange": "layoutSettingsChange"; "dragStart": "dragStart"; "dragEnd": "dragEnd"; "gutterClick": "gutterClick"; "gutterDblClick": "gutterDblClick"; }, ["splitAreas"], never, true, never>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare class YuvSplitViewModule {
|
|
191
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<YuvSplitViewModule, never>;
|
|
192
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<YuvSplitViewModule, never, [typeof SplitAreaDirective, typeof SplitViewComponent], [typeof SplitAreaDirective, typeof SplitViewComponent]>;
|
|
193
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<YuvSplitViewModule>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { SplitAreaDirective, SplitViewComponent, YuvSplitViewModule };
|
|
197
|
+
export type { SplitAreaLayoutSettings, SplitViewLayoutSettings, SplitViewOutputData };
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Type, InputSignal, OutputEmitterRef, TemplateRef } from '@angular/core';
|
|
3
|
+
import { GridType, GridsterItemConfig, Gridster, GridsterConfig } from 'angular-gridster2';
|
|
4
|
+
import * as _angular_forms from '@angular/forms';
|
|
5
|
+
import { FormControlStatus, FormControl } from '@angular/forms';
|
|
6
|
+
import { AttributesMap } from 'ng-dynamic-component';
|
|
7
|
+
import { MatDialogRef } from '@angular/material/dialog';
|
|
8
|
+
import { TranslateService } from '@yuuvis/client-core';
|
|
9
|
+
import { Observable } from 'rxjs';
|
|
10
|
+
|
|
11
|
+
interface GridWidget<T> {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
setupComponent?: Type<IWidgetComponent<T>>;
|
|
15
|
+
widgetComponent: Type<IWidgetComponent<T>>;
|
|
16
|
+
}
|
|
17
|
+
interface WidgetGridItemConfig extends GridsterItemConfig {
|
|
18
|
+
id: string;
|
|
19
|
+
widgetName: string;
|
|
20
|
+
widgetConfig: any;
|
|
21
|
+
}
|
|
22
|
+
interface WidgetGridItem extends WidgetGridItemConfig {
|
|
23
|
+
widget: Type<any>;
|
|
24
|
+
widgetConfigMap: AttributesMap;
|
|
25
|
+
}
|
|
26
|
+
interface IWidgetComponent<T> {
|
|
27
|
+
widgetConfig: InputSignal<T>;
|
|
28
|
+
}
|
|
29
|
+
interface IWidgetSetupComponent<T> extends IWidgetComponent<T> {
|
|
30
|
+
widgetConfigChange: OutputEmitterRef<T>;
|
|
31
|
+
widgetConfigStateChange: OutputEmitterRef<FormControlStatus>;
|
|
32
|
+
}
|
|
33
|
+
interface WidgetPickerData {
|
|
34
|
+
widgetId: string | undefined;
|
|
35
|
+
widgetName: string;
|
|
36
|
+
widgetConfigMap?: AttributesMap;
|
|
37
|
+
}
|
|
38
|
+
interface AddItemSize {
|
|
39
|
+
rows: number;
|
|
40
|
+
cols: number;
|
|
41
|
+
}
|
|
42
|
+
interface GridItemEvent {
|
|
43
|
+
action: string;
|
|
44
|
+
data: any;
|
|
45
|
+
}
|
|
46
|
+
interface WidgetGridConfig {
|
|
47
|
+
rows?: number;
|
|
48
|
+
columns?: number;
|
|
49
|
+
gap?: number;
|
|
50
|
+
newItemWidth?: number;
|
|
51
|
+
newItemHeight?: number;
|
|
52
|
+
gridType?: GridType;
|
|
53
|
+
}
|
|
54
|
+
interface WidgetPickerOptions {
|
|
55
|
+
pickerData?: WidgetPickerData;
|
|
56
|
+
buckets?: string[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare class YuvWidgetGridComponent {
|
|
60
|
+
#private;
|
|
61
|
+
gridster: _angular_core.Signal<Gridster | undefined>;
|
|
62
|
+
widgetPicker: _angular_core.Signal<TemplateRef<any>>;
|
|
63
|
+
options: GridsterConfig;
|
|
64
|
+
gridConfig: _angular_core.InputSignal<Partial<WidgetGridConfig> | undefined>;
|
|
65
|
+
_editMode: _angular_core.WritableSignal<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Whether or not to enable edit mode. In edit mode controls
|
|
68
|
+
* for editing existing tiles and creating new ones are shown.
|
|
69
|
+
* This mode also enables positioning and resizing of the tiles.
|
|
70
|
+
*/
|
|
71
|
+
editMode: _angular_core.InputSignal<boolean>;
|
|
72
|
+
gridItemConfig: _angular_core.InputSignal<WidgetGridItemConfig[] | undefined>;
|
|
73
|
+
/**
|
|
74
|
+
* Collection of buckets to load available widgets from. Wildcards are also posssible:
|
|
75
|
+
* `[buckets]="['app.default', '*.public.*', 'app.no?.widgets']"`
|
|
76
|
+
*
|
|
77
|
+
* `*` represents any character 0-n times
|
|
78
|
+
* `?` represents exactly one character
|
|
79
|
+
*/
|
|
80
|
+
buckets: _angular_core.InputSignal<string[] | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* Emitted when the grid has been changed
|
|
83
|
+
*/
|
|
84
|
+
gridChange: _angular_core.OutputEmitterRef<WidgetGridItemConfig[]>;
|
|
85
|
+
gridItemEvent: _angular_core.OutputEmitterRef<GridItemEvent>;
|
|
86
|
+
/**
|
|
87
|
+
* Emitted when the widget picker is opened or closed in edit mode
|
|
88
|
+
*/
|
|
89
|
+
widgetPickerOpen: _angular_core.OutputEmitterRef<boolean>;
|
|
90
|
+
widgetGrid: Array<WidgetGridItem>;
|
|
91
|
+
widgetPickerData: WidgetPickerData | undefined;
|
|
92
|
+
constructor();
|
|
93
|
+
openWidgetPicker(item?: WidgetGridItem): void;
|
|
94
|
+
/**
|
|
95
|
+
* Removes a widget from the grid
|
|
96
|
+
* @param item The widget to be removed
|
|
97
|
+
*/
|
|
98
|
+
removeItem(item: WidgetGridItem): void;
|
|
99
|
+
/**
|
|
100
|
+
* Add a new widget to the grid by opening the widget picker
|
|
101
|
+
*/
|
|
102
|
+
addItem(): void;
|
|
103
|
+
private emitChange;
|
|
104
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<YuvWidgetGridComponent, never>;
|
|
105
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<YuvWidgetGridComponent, "yuv-widget-grid", never, { "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; "editMode": { "alias": "editMode"; "required": false; "isSignal": true; }; "gridItemConfig": { "alias": "gridItemConfig"; "required": false; "isSignal": true; }; "buckets": { "alias": "buckets"; "required": false; "isSignal": true; }; }, { "gridChange": "gridChange"; "gridItemEvent": "gridItemEvent"; "widgetPickerOpen": "widgetPickerOpen"; }, never, [".empty"], true, never>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface WidgetGridWorkspace {
|
|
109
|
+
id: string;
|
|
110
|
+
label: string;
|
|
111
|
+
grid: WidgetGridItemConfig[];
|
|
112
|
+
translateLabel?: boolean;
|
|
113
|
+
preventDelete?: boolean;
|
|
114
|
+
preventEdit?: boolean;
|
|
115
|
+
preventRename?: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface WidgetGridWorkspaceConfig {
|
|
118
|
+
currentWorkspace?: string;
|
|
119
|
+
workspaces: WidgetGridWorkspace[];
|
|
120
|
+
}
|
|
121
|
+
interface WidgetGridWorkspaceOptions {
|
|
122
|
+
gridConfig?: Partial<WidgetGridConfig>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Component for managing multiple widget grids in so called workspaces.
|
|
127
|
+
* Each workspace can have its own configuration and widgets. The user can
|
|
128
|
+
* switch between workspaces to use or edit the widgets in the current workspace.
|
|
129
|
+
*/
|
|
130
|
+
declare class YuvWidgetGridWorkspacesComponent {
|
|
131
|
+
#private;
|
|
132
|
+
readonly translate: TranslateService;
|
|
133
|
+
workspaceDialogRef?: MatDialogRef<any, any>;
|
|
134
|
+
workspaceForm: _angular_forms.FormGroup<{
|
|
135
|
+
id: FormControl<string | null>;
|
|
136
|
+
label: FormControl<string | null>;
|
|
137
|
+
}>;
|
|
138
|
+
get workspaceLabelControl(): FormControl;
|
|
139
|
+
options: _angular_core.InputSignal<WidgetGridWorkspaceOptions>;
|
|
140
|
+
_workspaceOptions: _angular_core.Signal<WidgetGridWorkspaceOptions>;
|
|
141
|
+
workspaceConfig: _angular_core.InputSignal<WidgetGridWorkspaceConfig | undefined>;
|
|
142
|
+
_workspaceConfig: _angular_core.WritableSignal<WidgetGridWorkspaceConfig | undefined>;
|
|
143
|
+
/**
|
|
144
|
+
* Collection of buckets to load available widgets from. Wildcards are also posssible:
|
|
145
|
+
* `[buckets]="['app.default', '*.public.*', 'app.no?.widgets']"`
|
|
146
|
+
*
|
|
147
|
+
* `*` represents any character 0-n times
|
|
148
|
+
* `?` represents exactly one character
|
|
149
|
+
*/
|
|
150
|
+
buckets: _angular_core.InputSignal<string[] | undefined>;
|
|
151
|
+
configChange: _angular_core.OutputEmitterRef<WidgetGridWorkspaceConfig | undefined>;
|
|
152
|
+
gridItemEvent: _angular_core.OutputEmitterRef<GridItemEvent>;
|
|
153
|
+
editModeChange: _angular_core.OutputEmitterRef<boolean>;
|
|
154
|
+
editMode: _angular_core.WritableSignal<boolean>;
|
|
155
|
+
workspace: _angular_core.WritableSignal<WidgetGridWorkspace | undefined>;
|
|
156
|
+
workspaceLabel: _angular_core.WritableSignal<string>;
|
|
157
|
+
gridItemConfig: _angular_core.WritableSignal<WidgetGridItemConfig[] | undefined>;
|
|
158
|
+
getLabel(workspace: WidgetGridWorkspace): string;
|
|
159
|
+
setWorkspace(id: string, silent?: boolean): void;
|
|
160
|
+
openWorkspaceDialog(create: boolean, tplRef: TemplateRef<any>): void;
|
|
161
|
+
saveWorkspace(): void;
|
|
162
|
+
onGridEvent(e: GridItemEvent): void;
|
|
163
|
+
onGridChange(grid: Array<WidgetGridItemConfig>): void;
|
|
164
|
+
persistWorkspaceConfig(): void;
|
|
165
|
+
revertWorkspaceConfig(): void;
|
|
166
|
+
deleteCurrentWorkspace(): void;
|
|
167
|
+
emitConfigChange(): void;
|
|
168
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<YuvWidgetGridWorkspacesComponent, never>;
|
|
169
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<YuvWidgetGridWorkspacesComponent, "yuv-widget-grid-workspaces", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "workspaceConfig": { "alias": "workspaceConfig"; "required": false; "isSignal": true; }; "buckets": { "alias": "buckets"; "required": false; "isSignal": true; }; }, { "configChange": "configChange"; "gridItemEvent": "gridItemEvent"; "editModeChange": "editModeChange"; }, never, never, true, never>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare class YuvWidgetGridModule {
|
|
173
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<YuvWidgetGridModule, never>;
|
|
174
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<YuvWidgetGridModule, never, [typeof YuvWidgetGridComponent, typeof YuvWidgetGridWorkspacesComponent], [typeof YuvWidgetGridComponent, typeof YuvWidgetGridWorkspacesComponent]>;
|
|
175
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<YuvWidgetGridModule>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* This service provides the list of widgets that could be added
|
|
180
|
+
* to a widget grid. You could use it to register your own
|
|
181
|
+
* widgets.
|
|
182
|
+
*/
|
|
183
|
+
declare class WidgetGridRegistry {
|
|
184
|
+
#private;
|
|
185
|
+
readonly translate: TranslateService;
|
|
186
|
+
/**
|
|
187
|
+
* List of pre-registered widgets provided out-of-the-box
|
|
188
|
+
* by the widget grid module
|
|
189
|
+
*/
|
|
190
|
+
private registeredWidgets;
|
|
191
|
+
/**
|
|
192
|
+
* Buckets are collection of widget references.
|
|
193
|
+
* You can put any widget registered gloabally into a bucket. Later on you can grab
|
|
194
|
+
* widgets from a certain bucket. This enables apps to structure their widgets when e.g.
|
|
195
|
+
* using multiple widget grids with their own set of available widgets.
|
|
196
|
+
*/
|
|
197
|
+
private widgetBuckets;
|
|
198
|
+
/**
|
|
199
|
+
* Get the noop component. This component will be rendered in
|
|
200
|
+
* the grid tile if not matching widget could be found in the
|
|
201
|
+
* list of registered widgets. It will show some kind of 'not
|
|
202
|
+
* found' message and provide the controls to remove that none
|
|
203
|
+
* existing component from the widget grid.
|
|
204
|
+
* @returns NoopComponent
|
|
205
|
+
*/
|
|
206
|
+
getNoopWidget(): GridWidget<any>;
|
|
207
|
+
/**
|
|
208
|
+
* Setup components are the administrative part of a widget. They
|
|
209
|
+
* are used to set up a widget. Not all the widgets will have a setup
|
|
210
|
+
* component.
|
|
211
|
+
* @param widgetName The widgets name
|
|
212
|
+
* @returns The setup component of a widget. Throws error if there
|
|
213
|
+
* is not widget registered with the given name
|
|
214
|
+
*/
|
|
215
|
+
getWidgetSetupComponent(widgetName: string): Type<any> | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* Get the component for a widget. This is the component that will
|
|
218
|
+
* be rendered in a grid tile.
|
|
219
|
+
* @param widgetName The widgets name
|
|
220
|
+
* @returns The widget component or noop component if there is
|
|
221
|
+
* no component registered with the given name
|
|
222
|
+
*/
|
|
223
|
+
getWidgetComponent(widgetName: string): Type<any>;
|
|
224
|
+
/**
|
|
225
|
+
* Adds a new widget to the list of registered widgets. That way
|
|
226
|
+
* you can create custom widgets that are then available to be
|
|
227
|
+
* added to a users widget grid.
|
|
228
|
+
* @param widget The widget to be registered
|
|
229
|
+
* @param bucket List of buckets to register to. If a bucket does
|
|
230
|
+
* not exist it'll be created.
|
|
231
|
+
*/
|
|
232
|
+
registerGridWidget(widget: GridWidget<any>, buckets?: string[]): void;
|
|
233
|
+
/**
|
|
234
|
+
* Register a collection of widgets
|
|
235
|
+
* @param widgets The widgets to be registered
|
|
236
|
+
* @param bucket List of buckets to register to. If a bucket does
|
|
237
|
+
* not exist it'll be created.
|
|
238
|
+
*/
|
|
239
|
+
registerGridWidgets(widgets: GridWidget<any>[], buckets?: string[]): void;
|
|
240
|
+
private _addToBucket;
|
|
241
|
+
removeRegisteredWidget(id: string): void;
|
|
242
|
+
clearRegisteredWidget(): void;
|
|
243
|
+
/**
|
|
244
|
+
* Get registered widgets. This list could be narrowed down by a list
|
|
245
|
+
* of buckets. Buckets are lists of registered widgets registered for
|
|
246
|
+
* a certain key (the buckets name).
|
|
247
|
+
* @param buckets name of buckets to restrict the widgets to
|
|
248
|
+
* @returns Array of grid widgets
|
|
249
|
+
*/
|
|
250
|
+
getRegisteredWidgets(buckets?: string[]): Array<GridWidget<any>>;
|
|
251
|
+
private _wildcardMatch;
|
|
252
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetGridRegistry, never>;
|
|
253
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WidgetGridRegistry>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Service managing a widget grid. Also includes a set of labels that will be
|
|
258
|
+
* used by the grid and its widgets. Default labels are provided out of the
|
|
259
|
+
* box. But if you want to use custom ones or add i18n you could overwrite
|
|
260
|
+
* them. The grid as well as the widgets will use those labels or fall back
|
|
261
|
+
* to their default ones. If you are developing own widgets you should
|
|
262
|
+
* consider using those labels as well.
|
|
263
|
+
*/
|
|
264
|
+
declare class WidgetGridService {
|
|
265
|
+
private widgetGridRegistry;
|
|
266
|
+
private widgetGrid;
|
|
267
|
+
private widgetGridSource;
|
|
268
|
+
widgetGrid$: Observable<WidgetGridItem[]>;
|
|
269
|
+
private widgetGridUpdateSource;
|
|
270
|
+
/**
|
|
271
|
+
* Emitted when the widget grid has been updated
|
|
272
|
+
*/
|
|
273
|
+
widgetGridUpdate$: Observable<string>;
|
|
274
|
+
addItemSize: {
|
|
275
|
+
rows: number;
|
|
276
|
+
cols: number;
|
|
277
|
+
};
|
|
278
|
+
constructor(widgetGridRegistry: WidgetGridRegistry);
|
|
279
|
+
setWidgetGrid(gridItemConfig: Array<WidgetGridItemConfig> | undefined): void;
|
|
280
|
+
/**
|
|
281
|
+
* Update config of an existing widget
|
|
282
|
+
* @param widgetId ID of the widget to be updated
|
|
283
|
+
* @param setupWidgetConfig The updated configuration for that widget
|
|
284
|
+
*/
|
|
285
|
+
updateWidget(widgetId: string, setupWidgetConfig: any): void;
|
|
286
|
+
replaceWidget(widgetId: string, widgetName: string, setupWidgetConfig?: any): void;
|
|
287
|
+
/**
|
|
288
|
+
* Add a new grid item to the widget grid.
|
|
289
|
+
* @param widgetName The name of the grid item to be added
|
|
290
|
+
* @param setupWidgetConfig
|
|
291
|
+
*/
|
|
292
|
+
addWidget(widgetName: string, setupWidgetConfig?: any): void;
|
|
293
|
+
removeWidget(gridItemId: string): void;
|
|
294
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetGridService, never>;
|
|
295
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WidgetGridService>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export { WidgetGridRegistry, WidgetGridService, YuvWidgetGridComponent, YuvWidgetGridModule, YuvWidgetGridWorkspacesComponent };
|
|
299
|
+
export type { AddItemSize, GridItemEvent, GridWidget, IWidgetComponent, IWidgetSetupComponent, WidgetGridConfig, WidgetGridItem, WidgetGridItemConfig, WidgetGridWorkspace, WidgetGridWorkspaceConfig, WidgetGridWorkspaceOptions, WidgetPickerData, WidgetPickerOptions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare class ClientComponentsComponent {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ClientComponentsComponent, never>;
|
|
5
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ClientComponentsComponent, "ym-client-components", never, {}, {}, never, never, true, never>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { ClientComponentsComponent };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @yuuvis/client-components/widget-grid
|
|
2
|
+
|
|
3
|
+
Module providing a configurable grid of widgets. Widgets are components that implement `IWidgetComponent`. Widgets may also come with a setup component that could be used to configure the widget.
|
|
4
|
+
|
|
5
|
+
## Create a widget
|
|
6
|
+
Widgets are just Angular components that implement the `IWidgetComponent` interface.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { Component } from '@angular/core';
|
|
10
|
+
import { IWidgetComponent } from '@yuuvis/client-components/widget-grid';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'yuvtest-hello-widget',
|
|
14
|
+
template: '<h1>Hello Widget</h1>',
|
|
15
|
+
styleUrl: './hello-widget.component.scss'
|
|
16
|
+
})
|
|
17
|
+
export class HelloWidgetComponent implements IWidgetComponent<any> {
|
|
18
|
+
// Setter for the widget configuration.
|
|
19
|
+
widgetConfig;
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
In order to use that widget in your grid you have to register it:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
export class TestWidgetGridComponent {
|
|
27
|
+
#widgetGridRegistry = inject(WidgetGridRegistry);
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
const widget: GridWidget<any> = {
|
|
31
|
+
name: 'hello-widget',
|
|
32
|
+
label: 'Hello Widget',
|
|
33
|
+
widgetComponent: HelloWidgetComponent
|
|
34
|
+
}
|
|
35
|
+
this.#widgetGridRegistry.registerGridWidget(widget);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
Now the widget will be available in the picker dialog and users can add it to their grid. Notice: The label will be used as a key to fetch a translated label first. If that fails the label will be used as is.
|
|
40
|
+
|
|
41
|
+
## Adding a setup component
|
|
42
|
+
GridWidgets can also provide a setup component to configure the widget. For example let's add a setup for our HelloWidget to add a name to say hello to:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Setting up a grid
|