@vaadin/dashboard 24.6.0-alpha8 → 24.6.0-beta1
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 +2 -0
- package/package.json +8 -8
- package/src/vaadin-dashboard-button.js +4 -0
- package/src/vaadin-dashboard-helpers.js +4 -0
- package/src/vaadin-dashboard-item-mixin.js +16 -2
- package/src/vaadin-dashboard-layout.js +8 -0
- package/src/vaadin-dashboard-section.js +4 -0
- package/src/vaadin-dashboard-styles.js +45 -32
- package/src/vaadin-dashboard-widget.js +7 -3
- package/src/vaadin-dashboard.js +21 -0
- package/src/widget-reorder-controller.js +45 -6
- package/theme/lumo/vaadin-dashboard-layout-styles.js +1 -1
- package/theme/lumo/vaadin-dashboard-widget-styles.js +51 -38
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A responsive, grid-based dashboard layout component
|
|
4
4
|
|
|
5
|
+
> ⚠️ This component is experimental and the API may change. In order to use it, enable the feature flag by setting `window.Vaadin.featureFlags.dashboardComponent = true`.
|
|
6
|
+
|
|
5
7
|
> ℹ️ A commercial Vaadin [subscription](https://vaadin.com/pricing) is required to use Dashboard in your project.
|
|
6
8
|
|
|
7
9
|
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/dashboard)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dashboard",
|
|
3
|
-
"version": "24.6.0-
|
|
3
|
+
"version": "24.6.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/button": "24.6.0-
|
|
41
|
-
"@vaadin/component-base": "24.6.0-
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "24.6.0-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "24.6.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "24.6.0-
|
|
40
|
+
"@vaadin/button": "24.6.0-beta1",
|
|
41
|
+
"@vaadin/component-base": "24.6.0-beta1",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "24.6.0-beta1",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "24.6.0-beta1",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "24.6.0-beta1",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/chai-plugins": "24.6.0-
|
|
48
|
+
"@vaadin/chai-plugins": "24.6.0-beta1",
|
|
49
49
|
"@vaadin/testing-helpers": "^1.0.0"
|
|
50
50
|
},
|
|
51
51
|
"cvdlName": "vaadin-dashboard",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "ab28efb0dcf2cd1ef72100e2e8f32232fa49aacc"
|
|
57
57
|
}
|
|
@@ -198,7 +198,17 @@ export const DashboardItemMixin = (superClass) =>
|
|
|
198
198
|
|
|
199
199
|
/** @private */
|
|
200
200
|
__renderResizeControls() {
|
|
201
|
-
const
|
|
201
|
+
const style = getComputedStyle(this);
|
|
202
|
+
const hasMinRowHeight = style.getPropertyValue('--_vaadin-dashboard-row-min-height') !== 'auto';
|
|
203
|
+
|
|
204
|
+
const effectiveColCount = style.getPropertyValue('--_vaadin-dashboard-col-count');
|
|
205
|
+
const maxColCount = style.getPropertyValue('--_vaadin-dashboard-col-max-count');
|
|
206
|
+
const colCount = Math.min(effectiveColCount, maxColCount);
|
|
207
|
+
const colspan = style.getPropertyValue('--vaadin-dashboard-item-colspan') || 1;
|
|
208
|
+
const rowspan = style.getPropertyValue('--vaadin-dashboard-item-rowspan') || 1;
|
|
209
|
+
const canShrinkWidth = colspan > 1;
|
|
210
|
+
const canShrinkHeight = rowspan > 1;
|
|
211
|
+
const canGrowWidth = colspan < colCount;
|
|
202
212
|
|
|
203
213
|
return html`<div
|
|
204
214
|
id="resize-controls"
|
|
@@ -221,6 +231,7 @@ export const DashboardItemMixin = (superClass) =>
|
|
|
221
231
|
aria-label="${this.__i18n.resizeShrinkWidth}"
|
|
222
232
|
title="${this.__i18n.resizeShrinkWidth}"
|
|
223
233
|
@click="${() => fireResize(this, -1, 0)}"
|
|
234
|
+
.hidden="${!canShrinkWidth}"
|
|
224
235
|
id="resize-shrink-width"
|
|
225
236
|
part="resize-shrink-width-button"
|
|
226
237
|
>
|
|
@@ -231,6 +242,7 @@ export const DashboardItemMixin = (superClass) =>
|
|
|
231
242
|
aria-label="${this.__i18n.resizeGrowWidth}"
|
|
232
243
|
title="${this.__i18n.resizeGrowWidth}"
|
|
233
244
|
@click="${() => fireResize(this, 1, 0)}"
|
|
245
|
+
.hidden="${!canGrowWidth}"
|
|
234
246
|
id="resize-grow-width"
|
|
235
247
|
part="resize-grow-width-button"
|
|
236
248
|
>
|
|
@@ -243,7 +255,7 @@ export const DashboardItemMixin = (superClass) =>
|
|
|
243
255
|
@click="${() => fireResize(this, 0, -1)}"
|
|
244
256
|
id="resize-shrink-height"
|
|
245
257
|
part="resize-shrink-height-button"
|
|
246
|
-
.hidden="${!hasMinRowHeight}"
|
|
258
|
+
.hidden="${!hasMinRowHeight || !canShrinkHeight}"
|
|
247
259
|
>
|
|
248
260
|
<div class="icon"></div>
|
|
249
261
|
</vaadin-dashboard-button>
|
|
@@ -316,6 +328,8 @@ export const DashboardItemMixin = (superClass) =>
|
|
|
316
328
|
__focusApply() {
|
|
317
329
|
if (this.__moveMode) {
|
|
318
330
|
this.$['move-apply'].focus();
|
|
331
|
+
} else if (this.__resizeMode) {
|
|
332
|
+
this.$['resize-apply'].focus();
|
|
319
333
|
}
|
|
320
334
|
}
|
|
321
335
|
|
|
@@ -59,6 +59,14 @@ class DashboardLayout extends DashboardLayoutMixin(ElementMixin(ThemableMixin(Po
|
|
|
59
59
|
return 'vaadin-dashboard-layout';
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
static get experimental() {
|
|
63
|
+
return 'dashboardComponent';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static get cvdlName() {
|
|
67
|
+
return 'vaadin-dashboard';
|
|
68
|
+
}
|
|
69
|
+
|
|
62
70
|
/** @protected */
|
|
63
71
|
render() {
|
|
64
72
|
return html`<div id="grid"><slot></slot></div>`;
|
|
@@ -19,19 +19,14 @@ export const hasWidgetWrappers = css`
|
|
|
19
19
|
export const dashboardWidgetAndSectionStyles = css`
|
|
20
20
|
:host {
|
|
21
21
|
box-sizing: border-box;
|
|
22
|
-
/* Calculates the offset by which mode buttons that by default overflow the widget edges
|
|
23
|
-
should be shifted inwards based on a custom --vaadin-dashboard-spacing value */
|
|
24
|
-
--_mode-button-spacing-offset: calc(
|
|
25
|
-
max(0px, var(--_vaadin-dashboard-default-spacing) - var(--_vaadin-dashboard-spacing))
|
|
26
|
-
);
|
|
27
22
|
}
|
|
28
23
|
|
|
29
24
|
:host([dragging]) * {
|
|
30
25
|
visibility: hidden;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
:host(:not([editable]))
|
|
34
|
-
:host(:not([editable]))
|
|
28
|
+
:host(:not([editable])) [part~='move-button'],
|
|
29
|
+
:host(:not([editable])) [part~='remove-button'],
|
|
35
30
|
:host(:not([editable])) #focus-button,
|
|
36
31
|
:host(:not([editable])) #focus-button-wrapper,
|
|
37
32
|
:host(:not([editable])) .mode-controls {
|
|
@@ -75,67 +70,85 @@ export const dashboardWidgetAndSectionStyles = css`
|
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
/* Move-mode buttons */
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
[part~='move-backward-button'],
|
|
74
|
+
[part~='move-forward-button'],
|
|
75
|
+
[part~='move-apply-button'] {
|
|
81
76
|
position: absolute;
|
|
82
77
|
top: 50%;
|
|
83
78
|
}
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
[part~='move-backward-button'] {
|
|
86
81
|
inset-inline-start: 0;
|
|
87
82
|
transform: translateY(-50%);
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
[part~='move-forward-button'] {
|
|
91
86
|
inset-inline-end: 0;
|
|
92
87
|
transform: translateY(-50%);
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
|
|
90
|
+
[part~='move-apply-button'] {
|
|
96
91
|
left: 50%;
|
|
97
92
|
transform: translate(-50%, -50%);
|
|
98
93
|
}
|
|
99
94
|
|
|
100
|
-
:host([first-child])
|
|
101
|
-
:host([last-child])
|
|
95
|
+
:host([first-child]) [part~='move-backward-button'],
|
|
96
|
+
:host([last-child]) [part~='move-forward-button'] {
|
|
102
97
|
display: none;
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
/* Resize-mode buttons */
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
[part~='resize-shrink-width-button'],
|
|
102
|
+
[part~='resize-shrink-height-button'],
|
|
103
|
+
[part~='resize-grow-width-button'],
|
|
104
|
+
[part~='resize-grow-height-button'],
|
|
105
|
+
[part~='resize-apply-button'] {
|
|
111
106
|
position: absolute;
|
|
112
107
|
}
|
|
113
108
|
|
|
114
|
-
|
|
115
|
-
inset-inline-end:
|
|
109
|
+
[part~='resize-shrink-width-button'] {
|
|
110
|
+
inset-inline-end: 0;
|
|
116
111
|
top: 50%;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host(:not([dir='rtl'])) [part~='resize-shrink-width-button'] {
|
|
115
|
+
transform: translateY(-50%) translateX(-100%);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([dir='rtl']) [part~='resize-shrink-width-button'] {
|
|
119
|
+
transform: translateY(-50%) translateX(100%);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.mode-controls:has([part~='resize-grow-width-button'][hidden]) [part~='resize-shrink-width-button'] {
|
|
117
123
|
transform: translateY(-50%);
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
|
|
121
|
-
inset-inline-start:
|
|
126
|
+
[part~='resize-grow-width-button'] {
|
|
127
|
+
inset-inline-start: 100%;
|
|
122
128
|
top: 50%;
|
|
123
|
-
transform: translateY(-50%);
|
|
124
129
|
}
|
|
125
130
|
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
:host(:not([dir='rtl'])) [part~='resize-grow-width-button'] {
|
|
132
|
+
transform: translateY(-50%) translateX(-100%);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host([dir='rtl']) [part~='resize-grow-width-button'] {
|
|
136
|
+
transform: translateY(-50%) translateX(100%);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[part~='resize-shrink-height-button'] {
|
|
140
|
+
bottom: 0;
|
|
128
141
|
left: 50%;
|
|
129
|
-
transform: translateX(-50%);
|
|
142
|
+
transform: translateX(-50%) translateY(-100%);
|
|
130
143
|
}
|
|
131
144
|
|
|
132
|
-
|
|
133
|
-
top:
|
|
145
|
+
[part~='resize-grow-height-button'] {
|
|
146
|
+
top: 100%;
|
|
134
147
|
left: 50%;
|
|
135
|
-
transform: translateX(-50%);
|
|
148
|
+
transform: translateX(-50%) translateY(-100%);
|
|
136
149
|
}
|
|
137
150
|
|
|
138
|
-
|
|
151
|
+
[part~='resize-apply-button'] {
|
|
139
152
|
left: 50%;
|
|
140
153
|
top: 50%;
|
|
141
154
|
|
|
@@ -99,6 +99,10 @@ class DashboardWidget extends DashboardItemMixin(ElementMixin(ThemableMixin(Poly
|
|
|
99
99
|
return 'vaadin-dashboard-widget';
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
static get experimental() {
|
|
103
|
+
return 'dashboardComponent';
|
|
104
|
+
}
|
|
105
|
+
|
|
102
106
|
static get styles() {
|
|
103
107
|
return [
|
|
104
108
|
css`
|
|
@@ -114,16 +118,16 @@ class DashboardWidget extends DashboardItemMixin(ElementMixin(ThemableMixin(Poly
|
|
|
114
118
|
display: none !important;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
:host(:not([editable]))
|
|
121
|
+
:host(:not([editable])) [part~='resize-button'] {
|
|
118
122
|
display: none;
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
[part~='content'] {
|
|
122
126
|
flex: 1;
|
|
123
127
|
overflow: hidden;
|
|
124
128
|
}
|
|
125
129
|
|
|
126
|
-
|
|
130
|
+
[part~='resize-button'] {
|
|
127
131
|
position: absolute;
|
|
128
132
|
bottom: 0;
|
|
129
133
|
inset-inline-end: 0;
|
package/src/vaadin-dashboard.js
CHANGED
|
@@ -106,6 +106,10 @@ class Dashboard extends DashboardLayoutMixin(ElementMixin(ThemableMixin(PolylitM
|
|
|
106
106
|
return 'vaadin-dashboard';
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
static get experimental() {
|
|
110
|
+
return 'dashboardComponent';
|
|
111
|
+
}
|
|
112
|
+
|
|
109
113
|
static get cvdlName() {
|
|
110
114
|
return 'vaadin-dashboard';
|
|
111
115
|
}
|
|
@@ -457,6 +461,23 @@ class Dashboard extends DashboardLayoutMixin(ElementMixin(ThemableMixin(PolylitM
|
|
|
457
461
|
this.__dispatchCustomEvent('dashboard-item-resize-mode-changed', getElementItem(e.target), e.detail.value);
|
|
458
462
|
}
|
|
459
463
|
|
|
464
|
+
/**
|
|
465
|
+
* @private
|
|
466
|
+
*/
|
|
467
|
+
__updateColumnCount() {
|
|
468
|
+
const previousColumnCount = this.$.grid.style.getPropertyValue('--_vaadin-dashboard-col-count');
|
|
469
|
+
super.__updateColumnCount();
|
|
470
|
+
|
|
471
|
+
// Request update for all the widgets if the column count has changed on resize
|
|
472
|
+
if (previousColumnCount !== this.$.grid.style.getPropertyValue('--_vaadin-dashboard-col-count')) {
|
|
473
|
+
this.querySelectorAll(WRAPPER_LOCAL_NAME).forEach((wrapper) => {
|
|
474
|
+
if (wrapper.firstElementChild && 'requestUpdate' in wrapper.firstElementChild) {
|
|
475
|
+
wrapper.firstElementChild.requestUpdate();
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
460
481
|
/**
|
|
461
482
|
* Fired when an item selected state changed
|
|
462
483
|
*
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { getElementItem, getItemsArrayOfItem, itemsEqual, WRAPPER_LOCAL_NAME } from './vaadin-dashboard-helpers.js';
|
|
12
12
|
|
|
13
13
|
const REORDER_EVENT_TIMEOUT = 200;
|
|
14
|
+
const REORDER_MOVE_THRESHOLD = 10;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* A controller to widget reordering inside a dashboard.
|
|
@@ -64,6 +65,29 @@ export class WidgetReorderController {
|
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
// The location against which we measure the drag distance
|
|
69
|
+
this.__startX ||= e.clientX;
|
|
70
|
+
this.__startY ||= e.clientY;
|
|
71
|
+
|
|
72
|
+
// Delta values for the current drag event
|
|
73
|
+
const currentDx = e.clientX - (this.__previousX || e.clientX);
|
|
74
|
+
const currentDy = e.clientY - (this.__previousY || e.clientY);
|
|
75
|
+
this.__previousX = e.clientX;
|
|
76
|
+
this.__previousY = e.clientY;
|
|
77
|
+
|
|
78
|
+
if (currentDx && this.__dx && Math.sign(currentDx) !== Math.sign(this.__dx)) {
|
|
79
|
+
// If the direction of the drag changes, reset the start position
|
|
80
|
+
this.__startX = e.clientX;
|
|
81
|
+
}
|
|
82
|
+
if (currentDy && this.__dy && Math.sign(currentDy) !== Math.sign(this.__dy)) {
|
|
83
|
+
// If the direction of the drag changes, reset the start position
|
|
84
|
+
this.__startY = e.clientY;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The delta values for the drag event against the start position
|
|
88
|
+
this.__dx = e.clientX - this.__startX;
|
|
89
|
+
this.__dy = e.clientY - this.__startY;
|
|
90
|
+
|
|
67
91
|
e.preventDefault();
|
|
68
92
|
e.dataTransfer.dropEffect = 'move';
|
|
69
93
|
|
|
@@ -88,7 +112,15 @@ export class WidgetReorderController {
|
|
|
88
112
|
}
|
|
89
113
|
|
|
90
114
|
// Check if the dragged element is dragged enough over the target element
|
|
91
|
-
if (
|
|
115
|
+
if (
|
|
116
|
+
!this.__reordering &&
|
|
117
|
+
this.__isDraggedOver(draggedElement, targetElement, {
|
|
118
|
+
x: e.clientX,
|
|
119
|
+
y: e.clientY,
|
|
120
|
+
dx: this.__dx,
|
|
121
|
+
dy: this.__dy,
|
|
122
|
+
})
|
|
123
|
+
) {
|
|
92
124
|
// Prevent reordering multiple times in quick succession
|
|
93
125
|
this.__reordering = true;
|
|
94
126
|
setTimeout(() => {
|
|
@@ -109,6 +141,13 @@ export class WidgetReorderController {
|
|
|
109
141
|
return;
|
|
110
142
|
}
|
|
111
143
|
|
|
144
|
+
this.__previousX = null;
|
|
145
|
+
this.__previousY = null;
|
|
146
|
+
this.__startX = null;
|
|
147
|
+
this.__startY = null;
|
|
148
|
+
this.__dx = null;
|
|
149
|
+
this.__dy = null;
|
|
150
|
+
|
|
112
151
|
// If the originally dragged element is restored to the DOM (as a direct child of the host),
|
|
113
152
|
// to make sure "dragend" event gets dispatched, remove it to avoid duplicates
|
|
114
153
|
if (this.__draggedElement.parentElement === this.host) {
|
|
@@ -169,21 +208,21 @@ export class WidgetReorderController {
|
|
|
169
208
|
* of the drag event.
|
|
170
209
|
* @private
|
|
171
210
|
*/
|
|
172
|
-
__isDraggedOver(draggedElement, targetElement, x, y) {
|
|
211
|
+
__isDraggedOver(draggedElement, targetElement, { x, y, dx, dy }) {
|
|
173
212
|
const draggedPos = draggedElement.getBoundingClientRect();
|
|
174
213
|
const targetPos = targetElement.getBoundingClientRect();
|
|
175
214
|
if (draggedPos.top >= targetPos.bottom) {
|
|
176
215
|
// target is on a row above the dragged widget
|
|
177
|
-
return y < targetPos.
|
|
216
|
+
return y < targetPos.bottom && dy < -REORDER_MOVE_THRESHOLD;
|
|
178
217
|
} else if (draggedPos.bottom <= targetPos.top) {
|
|
179
218
|
// target is on a row below the dragged widget
|
|
180
|
-
return y > targetPos.top
|
|
219
|
+
return y > targetPos.top && dy > REORDER_MOVE_THRESHOLD;
|
|
181
220
|
} else if (draggedPos.left >= targetPos.right) {
|
|
182
221
|
// target is on a column to the left of the dragged widget
|
|
183
|
-
return x < targetPos.
|
|
222
|
+
return x < targetPos.right && dx < -REORDER_MOVE_THRESHOLD;
|
|
184
223
|
} else if (draggedPos.right <= targetPos.left) {
|
|
185
224
|
// target is on a column to the right of the dragged widget
|
|
186
|
-
return x > targetPos.left
|
|
225
|
+
return x > targetPos.left && dx > REORDER_MOVE_THRESHOLD;
|
|
187
226
|
}
|
|
188
227
|
}
|
|
189
228
|
|
|
@@ -2,7 +2,7 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
|
|
|
2
2
|
|
|
3
3
|
export const dashboardLayoutStyles = css`
|
|
4
4
|
#grid {
|
|
5
|
-
--_vaadin-dashboard-default-spacing: var(--lumo-space-
|
|
5
|
+
--_vaadin-dashboard-default-spacing: var(--lumo-space-l);
|
|
6
6
|
}
|
|
7
7
|
`;
|
|
8
8
|
|
|
@@ -79,13 +79,13 @@ const dashboardWidgetAndSection = css`
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/* Drag handle styling */
|
|
82
|
-
|
|
82
|
+
[part~='move-button'] {
|
|
83
83
|
cursor: move;
|
|
84
|
-
--icon: var(--lumo-icons-
|
|
84
|
+
--icon: var(--lumo-icons-drag-handle);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/* Remove button styling */
|
|
88
|
-
|
|
88
|
+
[part~='remove-button'] {
|
|
89
89
|
cursor: pointer;
|
|
90
90
|
--icon: var(--lumo-icons-cross);
|
|
91
91
|
}
|
|
@@ -101,7 +101,7 @@ const dashboardWidgetAndSection = css`
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/* Content styling */
|
|
104
|
-
|
|
104
|
+
[part~='content'] {
|
|
105
105
|
min-height: var(--lumo-size-m);
|
|
106
106
|
padding: var(--lumo-space-s);
|
|
107
107
|
}
|
|
@@ -113,30 +113,30 @@ const dashboardWidgetAndSection = css`
|
|
|
113
113
|
|
|
114
114
|
/* Move mode styling */
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
[part~='move-backward-button'] {
|
|
117
117
|
inset-inline-start: calc(0px - var(--_focus-ring-spacing-offset));
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
[part~='move-forward-button'] {
|
|
121
121
|
inset-inline-end: calc(0px - var(--_focus-ring-spacing-offset));
|
|
122
122
|
transform: translateY(-50%);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
:host(:not([dir='rtl']))
|
|
126
|
-
:host([dir='rtl'])
|
|
125
|
+
:host(:not([dir='rtl'])) [part~='move-backward-button'],
|
|
126
|
+
:host([dir='rtl']) [part~='move-forward-button'] {
|
|
127
127
|
border-top-left-radius: 0;
|
|
128
128
|
border-bottom-left-radius: 0;
|
|
129
129
|
--icon: var(--lumo-icons-angle-left);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
:host(:not([dir='rtl']))
|
|
133
|
-
:host([dir='rtl'])
|
|
132
|
+
:host(:not([dir='rtl'])) [part~='move-forward-button'],
|
|
133
|
+
:host([dir='rtl']) [part~='move-backward-button'] {
|
|
134
134
|
border-top-right-radius: 0;
|
|
135
135
|
border-bottom-right-radius: 0;
|
|
136
136
|
--icon: var(--lumo-icons-angle-right);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
[part~='move-apply-button'] {
|
|
140
140
|
--icon: var(--lumo-icons-checkmark);
|
|
141
141
|
font-size: var(--lumo-icon-size-m);
|
|
142
142
|
}
|
|
@@ -157,8 +157,8 @@ const dashboardWidget = css`
|
|
|
157
157
|
opacity: 1;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
:host([resize-mode])
|
|
161
|
-
:host([move-mode])
|
|
160
|
+
:host([resize-mode]) [part~='content'] ::slotted(*),
|
|
161
|
+
:host([move-mode]) [part~='content'] ::slotted(*) {
|
|
162
162
|
opacity: 0.3;
|
|
163
163
|
filter: blur(10px);
|
|
164
164
|
}
|
|
@@ -169,69 +169,82 @@ const dashboardWidget = css`
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
/* Resize handle styling */
|
|
172
|
-
|
|
172
|
+
[part~='resize-button'] {
|
|
173
173
|
position: absolute;
|
|
174
174
|
bottom: var(--lumo-space-s);
|
|
175
175
|
inset-inline-end: var(--lumo-space-s);
|
|
176
176
|
cursor: se-resize;
|
|
177
|
-
--icon: var(--lumo-icons-
|
|
177
|
+
--icon: var(--lumo-icons-resize-handle);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
:host([dir='rtl'])
|
|
180
|
+
:host([dir='rtl']) [part~='resize-button'] {
|
|
181
181
|
cursor: sw-resize;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
transform:
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
:host([dir='rtl']) #resize-handle .icon::before {
|
|
189
|
-
transform: rotate(45deg);
|
|
184
|
+
:host([dir='rtl']) [part~='resize-button'] .icon::before {
|
|
185
|
+
transform: scaleX(-1);
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
/* Resize mode styling */
|
|
193
|
-
|
|
189
|
+
[part~='resize-apply-button'] {
|
|
194
190
|
--icon: var(--lumo-icons-checkmark);
|
|
195
191
|
font-size: var(--lumo-icon-size-m);
|
|
196
192
|
}
|
|
197
193
|
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
[part~='resize-grow-width-button'],
|
|
195
|
+
[part~='resize-shrink-width-button'] {
|
|
200
196
|
padding-right: 0;
|
|
201
197
|
padding-left: 0;
|
|
202
198
|
min-width: var(--lumo-size-s);
|
|
203
199
|
}
|
|
204
200
|
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
[part~='resize-grow-height-button'],
|
|
202
|
+
[part~='resize-shrink-height-button'] {
|
|
207
203
|
height: var(--lumo-size-s);
|
|
208
204
|
margin: 0;
|
|
209
205
|
}
|
|
210
206
|
|
|
211
|
-
:host(:not([dir='rtl']))
|
|
212
|
-
:host([dir='rtl'])
|
|
207
|
+
:host(:not([dir='rtl'])) [part~='resize-grow-width-button'],
|
|
208
|
+
:host(:not([dir='rtl'])) [part~='resize-shrink-width-button'] {
|
|
213
209
|
border-top-right-radius: 0;
|
|
214
210
|
border-bottom-right-radius: 0;
|
|
215
|
-
--icon: var(--lumo-icons-angle-left);
|
|
216
211
|
}
|
|
217
212
|
|
|
218
|
-
:host(
|
|
219
|
-
:host([dir='rtl'])
|
|
213
|
+
:host([dir='rtl']) [part~='resize-grow-width-button'],
|
|
214
|
+
:host([dir='rtl']) [part~='resize-shrink-width-button'] {
|
|
220
215
|
border-top-left-radius: 0;
|
|
221
216
|
border-bottom-left-radius: 0;
|
|
222
|
-
--icon: var(--lumo-icons-angle-right);
|
|
223
217
|
}
|
|
224
218
|
|
|
225
|
-
|
|
226
|
-
border-top-right-radius: 0;
|
|
219
|
+
:host(:not([dir='rtl'])) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
|
|
227
220
|
border-top-left-radius: 0;
|
|
228
|
-
|
|
221
|
+
border-bottom-left-radius: 0;
|
|
229
222
|
}
|
|
230
223
|
|
|
231
|
-
|
|
224
|
+
:host([dir='rtl']) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
|
|
225
|
+
border-top-right-radius: 0;
|
|
232
226
|
border-bottom-right-radius: 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
[part~='resize-grow-height-button'],
|
|
230
|
+
[part~='resize-grow-width-button'] {
|
|
231
|
+
--icon: var(--lumo-icons-plus);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
[part~='resize-shrink-height-button'],
|
|
235
|
+
[part~='resize-shrink-width-button'] {
|
|
236
|
+
--icon: var(--lumo-icons-minus);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
[part~='resize-grow-height-button'],
|
|
240
|
+
[part~='resize-shrink-height-button'] {
|
|
233
241
|
border-bottom-left-radius: 0;
|
|
234
|
-
|
|
242
|
+
border-bottom-right-radius: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
[part~='resize-shrink-height-button']:not([hidden]) + [part~='resize-grow-height-button'] {
|
|
246
|
+
border-top-left-radius: 0;
|
|
247
|
+
border-top-right-radius: 0;
|
|
235
248
|
}
|
|
236
249
|
`;
|
|
237
250
|
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dashboard",
|
|
4
|
-
"version": "24.6.0-
|
|
4
|
+
"version": "24.6.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
"name": "vaadin-dashboard",
|
|
139
|
-
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-
|
|
139
|
+
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-beta1/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-beta1/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-spacing` | spacing between child elements and space around its outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected`| Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
140
140
|
"attributes": [
|
|
141
141
|
{
|
|
142
142
|
"name": "dense-layout",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dashboard",
|
|
4
|
-
"version": "24.6.0-
|
|
4
|
+
"version": "24.6.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"name": "vaadin-dashboard",
|
|
61
|
-
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-
|
|
61
|
+
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-beta1/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/24.6.0-beta1/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-spacing` | spacing between child elements and space around its outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected`| Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
62
62
|
"extension": true,
|
|
63
63
|
"attributes": [
|
|
64
64
|
{
|