@vaadin/dashboard 25.2.0-alpha10 → 25.2.0-alpha11
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/custom-elements.json +20 -4
- package/package.json +10 -10
- package/src/styles/vaadin-dashboard-layout-base-styles.d.ts +2 -0
- package/src/styles/vaadin-dashboard-layout-base-styles.js +32 -3
- package/src/styles/vaadin-dashboard-section-base-styles.js +6 -0
- package/src/styles/vaadin-dashboard-widget-base-styles.js +4 -0
- package/src/vaadin-dashboard-button.js +0 -4
- package/src/vaadin-dashboard-item-mixin.js +0 -4
- package/src/vaadin-dashboard-layout-mixin.js +0 -4
- package/src/vaadin-dashboard-layout.d.ts +1 -0
- package/src/vaadin-dashboard-layout.js +1 -4
- package/src/vaadin-dashboard-section.js +0 -4
- package/src/vaadin-dashboard-widget.js +0 -4
- package/src/vaadin-dashboard.d.ts +2 -1
- package/src/vaadin-dashboard.js +11 -6
- package/web-types.json +3 -3
- package/web-types.lit.json +3 -3
package/custom-elements.json
CHANGED
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
"declarations": [
|
|
455
455
|
{
|
|
456
456
|
"kind": "class",
|
|
457
|
-
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
457
|
+
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-row-height` | fixed row height of the layout. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
458
458
|
"name": "DashboardLayout",
|
|
459
459
|
"members": [
|
|
460
460
|
{
|
|
@@ -704,7 +704,7 @@
|
|
|
704
704
|
"declarations": [
|
|
705
705
|
{
|
|
706
706
|
"kind": "class",
|
|
707
|
-
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](#/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\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-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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.",
|
|
707
|
+
"description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](#/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\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-row-height` | fixed row height of the dashboard. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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.",
|
|
708
708
|
"name": "Dashboard",
|
|
709
709
|
"members": [
|
|
710
710
|
{
|
|
@@ -893,11 +893,27 @@
|
|
|
893
893
|
{
|
|
894
894
|
"name": "I18nMixin",
|
|
895
895
|
"package": "@vaadin/component-base/src/i18n-mixin.js"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"name": "ElementMixin",
|
|
899
|
+
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"name": "ThemableMixin",
|
|
903
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
"name": "PolylitMixin",
|
|
907
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
"name": "LumoInjectionMixin",
|
|
911
|
+
"package": "@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js"
|
|
896
912
|
}
|
|
897
913
|
],
|
|
898
914
|
"superclass": {
|
|
899
|
-
"name": "
|
|
900
|
-
"
|
|
915
|
+
"name": "LitElement",
|
|
916
|
+
"package": "lit"
|
|
901
917
|
},
|
|
902
918
|
"tagName": "vaadin-dashboard",
|
|
903
919
|
"customElement": true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dashboard",
|
|
3
|
-
"version": "25.2.0-
|
|
3
|
+
"version": "25.2.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "25.2.0-
|
|
41
|
-
"@vaadin/button": "25.2.0-
|
|
42
|
-
"@vaadin/component-base": "25.2.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.2.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.2.0-alpha11",
|
|
41
|
+
"@vaadin/button": "25.2.0-alpha11",
|
|
42
|
+
"@vaadin/component-base": "25.2.0-alpha11",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.2.0-alpha11",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/aura": "25.2.0-
|
|
48
|
-
"@vaadin/chai-plugins": "25.2.0-
|
|
49
|
-
"@vaadin/test-runner-commands": "25.2.0-
|
|
47
|
+
"@vaadin/aura": "25.2.0-alpha11",
|
|
48
|
+
"@vaadin/chai-plugins": "25.2.0-alpha11",
|
|
49
|
+
"@vaadin/test-runner-commands": "25.2.0-alpha11",
|
|
50
50
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "25.2.0-
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "25.2.0-alpha11",
|
|
52
52
|
"sinon": "^21.0.2"
|
|
53
53
|
},
|
|
54
54
|
"cvdlName": "vaadin-dashboard",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "fdc37e932709f95491a027aeb2090911cb7528c6"
|
|
61
61
|
}
|
|
@@ -9,7 +9,30 @@
|
|
|
9
9
|
* license.
|
|
10
10
|
*/
|
|
11
11
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
|
-
import { css } from 'lit';
|
|
12
|
+
import { css, unsafeCSS } from 'lit';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Declarations that pin the host or slotted element to the fixed
|
|
16
|
+
* `--vaadin-dashboard-row-height` (scaled by `--vaadin-dashboard-widget-rowspan` and the
|
|
17
|
+
* inter-row `--_gap`). Imported by the widget host and the section's slotted rule
|
|
18
|
+
* because the calc must live on each capped element so `var(--vaadin-dashboard-widget-rowspan)`
|
|
19
|
+
* resolves against that element's own context.
|
|
20
|
+
*
|
|
21
|
+
* The cap is `!important` so an inline `min-height`/`max-height` on a widget can't widen
|
|
22
|
+
* the cell beyond the row height. When `--vaadin-dashboard-row-height` is unset the calc
|
|
23
|
+
* is invalid, the property becomes invalid at computed value time and falls back to its
|
|
24
|
+
* initial value (`auto` for `min-height`, `none` for `max-height`) — these initial values
|
|
25
|
+
* are still applied with `!important`, so an inline `min-height`/`max-height` on a widget
|
|
26
|
+
* is a no-op even when no fixed row height is configured. See the variable's docs.
|
|
27
|
+
*/
|
|
28
|
+
export const widgetFixedHeightDeclarations = unsafeCSS`
|
|
29
|
+
--_widget-fixed-height: calc(
|
|
30
|
+
var(--vaadin-dashboard-widget-rowspan, 1) * var(--vaadin-dashboard-row-height) +
|
|
31
|
+
(var(--vaadin-dashboard-widget-rowspan, 1) - 1) * var(--_gap)
|
|
32
|
+
);
|
|
33
|
+
min-height: var(--_widget-fixed-height) !important;
|
|
34
|
+
max-height: var(--_widget-fixed-height) !important;
|
|
35
|
+
`;
|
|
13
36
|
|
|
14
37
|
export const dashboardLayoutStyles = css`
|
|
15
38
|
:host {
|
|
@@ -56,8 +79,9 @@ export const dashboardLayoutStyles = css`
|
|
|
56
79
|
|
|
57
80
|
/* Default row min height */
|
|
58
81
|
--_default-row-min-height: 12em;
|
|
59
|
-
/* Effective row min height */
|
|
60
|
-
|
|
82
|
+
/* Effective row min height. A fixed row height takes precedence so the parent track also collapses to it. */
|
|
83
|
+
/* prettier-ignore */
|
|
84
|
+
--_row-min-height: var(--vaadin-dashboard-row-height, var(--vaadin-dashboard-row-min-height, var(--_default-row-min-height)));
|
|
61
85
|
/* Effective row height */
|
|
62
86
|
--_row-height: minmax(var(--_row-min-height, auto), auto);
|
|
63
87
|
|
|
@@ -83,4 +107,9 @@ export const dashboardLayoutStyles = css`
|
|
|
83
107
|
--_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
|
|
84
108
|
grid-row: var(--_item-row);
|
|
85
109
|
}
|
|
110
|
+
|
|
111
|
+
/* Pin slotted children to the fixed row height when one is set. Sections are excluded so they can grow to wrap multiple sub-rows. */
|
|
112
|
+
::slotted(:not(vaadin-dashboard-section)) {
|
|
113
|
+
${widgetFixedHeightDeclarations};
|
|
114
|
+
}
|
|
86
115
|
`;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
12
|
import { css } from 'lit';
|
|
13
|
+
import { widgetFixedHeightDeclarations } from './vaadin-dashboard-layout-base-styles.js';
|
|
13
14
|
import { dashboardWidgetAndSectionStyles } from './vaadin-dashboard-widget-section-base-styles.js';
|
|
14
15
|
|
|
15
16
|
const sectionStyles = css`
|
|
@@ -42,6 +43,11 @@ const sectionStyles = css`
|
|
|
42
43
|
grid-row: var(--_item-row);
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/* Mirror the layout's cap so non-widget children inside a section also stay pinned to the fixed row height. Sections nested inside a section are excluded so they can still grow. */
|
|
47
|
+
::slotted(:not(vaadin-dashboard-section)) {
|
|
48
|
+
${widgetFixedHeightDeclarations};
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
header {
|
|
46
52
|
grid-column: var(--_section-column);
|
|
47
53
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
12
12
|
import { css } from 'lit';
|
|
13
|
+
import { widgetFixedHeightDeclarations } from './vaadin-dashboard-layout-base-styles.js';
|
|
13
14
|
import { dashboardWidgetAndSectionStyles } from './vaadin-dashboard-widget-section-base-styles.js';
|
|
14
15
|
|
|
15
16
|
const widgetStyles = css`
|
|
@@ -23,6 +24,9 @@ const widgetStyles = css`
|
|
|
23
24
|
border-radius: var(--_widget-border-radius);
|
|
24
25
|
box-shadow: var(--_widget-shadow);
|
|
25
26
|
border: var(--_widget-border-width) solid var(--_widget-border-color);
|
|
27
|
+
|
|
28
|
+
/* Pin to the fixed row height when one is set. The widget host's own definition is needed so widgets nested inside sections in vaadin-dashboard-layout (where the layout-level cap doesn't reach) still get capped. */
|
|
29
|
+
${widgetFixedHeightDeclarations};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
:host([hidden]) {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -23,9 +22,6 @@ import { dashboardButtonStyles } from './styles/vaadin-dashboard-button-base-sty
|
|
|
23
22
|
*
|
|
24
23
|
* @customElement vaadin-dashboard-button
|
|
25
24
|
* @extends HTMLElement
|
|
26
|
-
* @mixes ButtonMixin
|
|
27
|
-
* @mixes ElementMixin
|
|
28
|
-
* @mixes ThemableMixin
|
|
29
25
|
* @protected
|
|
30
26
|
*/
|
|
31
27
|
class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -40,9 +39,6 @@ export function getDefaultI18n() {
|
|
|
40
39
|
|
|
41
40
|
/**
|
|
42
41
|
* Shared functionality between widgets and sections
|
|
43
|
-
*
|
|
44
|
-
* @polymerMixin
|
|
45
|
-
* @mixes ResizeMixin
|
|
46
42
|
*/
|
|
47
43
|
export const DashboardItemMixin = (superClass) =>
|
|
48
44
|
class DashboardItemMixinClass extends ResizeMixin(superClass) {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -12,9 +11,6 @@ import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* A mixin to enable the dashboard layout functionality
|
|
15
|
-
*
|
|
16
|
-
* @polymerMixin
|
|
17
|
-
* @mixes ResizeMixin
|
|
18
14
|
*/
|
|
19
15
|
export const DashboardLayoutMixin = (superClass) =>
|
|
20
16
|
class DashboardLayoutMixinClass extends ResizeMixin(superClass) {
|
|
@@ -34,6 +34,7 @@ import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
|
|
|
34
34
|
* `--vaadin-dashboard-col-min-width` | minimum column width of the layout
|
|
35
35
|
* `--vaadin-dashboard-col-max-width` | maximum column width of the layout
|
|
36
36
|
* `--vaadin-dashboard-row-min-height` | minimum row height of the layout
|
|
37
|
+
* `--vaadin-dashboard-row-height` | fixed row height of the layout. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content
|
|
37
38
|
* `--vaadin-dashboard-col-max-count` | maximum column count of the layout
|
|
38
39
|
* `--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)
|
|
39
40
|
* `--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -39,6 +38,7 @@ import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
|
|
|
39
38
|
* `--vaadin-dashboard-col-min-width` | minimum column width of the layout
|
|
40
39
|
* `--vaadin-dashboard-col-max-width` | maximum column width of the layout
|
|
41
40
|
* `--vaadin-dashboard-row-min-height` | minimum row height of the layout
|
|
41
|
+
* `--vaadin-dashboard-row-height` | fixed row height of the layout. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content
|
|
42
42
|
* `--vaadin-dashboard-col-max-count` | maximum column count of the layout
|
|
43
43
|
* `--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)
|
|
44
44
|
* `--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)
|
|
@@ -53,9 +53,6 @@ import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
|
|
|
53
53
|
*
|
|
54
54
|
* @customElement vaadin-dashboard-layout
|
|
55
55
|
* @extends HTMLElement
|
|
56
|
-
* @mixes DashboardLayoutMixin
|
|
57
|
-
* @mixes ElementMixin
|
|
58
|
-
* @mixes ThemableMixin
|
|
59
56
|
*/
|
|
60
57
|
class DashboardLayout extends DashboardLayoutMixin(
|
|
61
58
|
ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -67,9 +66,6 @@ import { getDefaultI18n } from './vaadin-dashboard-item-mixin.js';
|
|
|
67
66
|
*
|
|
68
67
|
* @customElement vaadin-dashboard-section
|
|
69
68
|
* @extends HTMLElement
|
|
70
|
-
* @mixes ElementMixin
|
|
71
|
-
* @mixes ThemableMixin
|
|
72
|
-
* @mixes DashboardItemMixin
|
|
73
69
|
*/
|
|
74
70
|
class DashboardSection extends DashboardItemMixin(
|
|
75
71
|
ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -101,9 +100,6 @@ import { DashboardSection } from './vaadin-dashboard-section.js';
|
|
|
101
100
|
*
|
|
102
101
|
* @customElement vaadin-dashboard-widget
|
|
103
102
|
* @extends HTMLElement
|
|
104
|
-
* @mixes ElementMixin
|
|
105
|
-
* @mixes ThemableMixin
|
|
106
|
-
* @mixes DashboardItemMixin
|
|
107
103
|
*/
|
|
108
104
|
class DashboardWidget extends DashboardItemMixin(
|
|
109
105
|
ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
@@ -211,6 +211,7 @@ export interface DashboardI18n {
|
|
|
211
211
|
* `--vaadin-dashboard-col-min-width` | minimum column width of the dashboard
|
|
212
212
|
* `--vaadin-dashboard-col-max-width` | maximum column width of the dashboard
|
|
213
213
|
* `--vaadin-dashboard-row-min-height` | minimum row height of the dashboard
|
|
214
|
+
* `--vaadin-dashboard-row-height` | fixed row height of the dashboard. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content
|
|
214
215
|
* `--vaadin-dashboard-col-max-count` | maximum column count of the dashboard
|
|
215
216
|
* `--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)
|
|
216
217
|
* `--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)
|
|
@@ -234,7 +235,7 @@ export interface DashboardI18n {
|
|
|
234
235
|
* @fires {CustomEvent} dashboard-item-resize-mode-changed - Fired when an item resize mode changed
|
|
235
236
|
*/
|
|
236
237
|
declare class Dashboard<TItem extends DashboardItem = DashboardItem> extends DashboardLayoutMixin(
|
|
237
|
-
I18nMixin
|
|
238
|
+
I18nMixin<typeof HTMLElement, DashboardI18n>(ElementMixin(ThemableMixin(HTMLElement))),
|
|
238
239
|
) {
|
|
239
240
|
/**
|
|
240
241
|
* An array containing the items of the dashboard
|
package/src/vaadin-dashboard.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
7
|
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
8
|
* license.
|
|
10
9
|
*/
|
|
@@ -79,6 +78,7 @@ const DEFAULT_I18N = getDefaultI18n();
|
|
|
79
78
|
* `--vaadin-dashboard-col-min-width` | minimum column width of the dashboard
|
|
80
79
|
* `--vaadin-dashboard-col-max-width` | maximum column width of the dashboard
|
|
81
80
|
* `--vaadin-dashboard-row-min-height` | minimum row height of the dashboard
|
|
81
|
+
* `--vaadin-dashboard-row-height` | fixed row height of the dashboard. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content
|
|
82
82
|
* `--vaadin-dashboard-col-max-count` | maximum column count of the dashboard
|
|
83
83
|
* `--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)
|
|
84
84
|
* `--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)
|
|
@@ -103,13 +103,9 @@ const DEFAULT_I18N = getDefaultI18n();
|
|
|
103
103
|
*
|
|
104
104
|
* @customElement vaadin-dashboard
|
|
105
105
|
* @extends HTMLElement
|
|
106
|
-
* @mixes ElementMixin
|
|
107
|
-
* @mixes DashboardLayoutMixin
|
|
108
|
-
* @mixes I18nMixin
|
|
109
|
-
* @mixes ThemableMixin
|
|
110
106
|
*/
|
|
111
107
|
class Dashboard extends DashboardLayoutMixin(
|
|
112
|
-
I18nMixin(
|
|
108
|
+
I18nMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
|
|
113
109
|
) {
|
|
114
110
|
static get is() {
|
|
115
111
|
return 'vaadin-dashboard';
|
|
@@ -173,6 +169,10 @@ class Dashboard extends DashboardLayoutMixin(
|
|
|
173
169
|
return ['__itemsOrRendererChanged(items, renderer, editable, __effectiveI18n)'];
|
|
174
170
|
}
|
|
175
171
|
|
|
172
|
+
static get defaultI18n() {
|
|
173
|
+
return DEFAULT_I18N;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
176
|
/**
|
|
177
177
|
* The object used to localize this component. To change the default
|
|
178
178
|
* localization, replace this with an object that provides all properties, or
|
|
@@ -266,6 +266,7 @@ class Dashboard extends DashboardLayoutMixin(
|
|
|
266
266
|
let wrappers = [...hostElement.children].filter((el) => el.localName === WRAPPER_LOCAL_NAME);
|
|
267
267
|
|
|
268
268
|
const focusedWrapper = wrappers.find((wrapper) => wrapper.querySelector(':focus'));
|
|
269
|
+
const focusedElement = focusedWrapper?.querySelector(':focus');
|
|
269
270
|
const focusedWrapperWillBeRemoved = focusedWrapper && !this.__isActiveWrapper(focusedWrapper);
|
|
270
271
|
const wrapperClosestToRemovedFocused =
|
|
271
272
|
focusedWrapperWillBeRemoved && this.__getClosestActiveWrapper(focusedWrapper);
|
|
@@ -313,6 +314,10 @@ class Dashboard extends DashboardLayoutMixin(
|
|
|
313
314
|
if (focusedWrapperWillBeRemoved) {
|
|
314
315
|
// The wrapper containing the focused element was removed. Try to focus the element in the closest wrapper.
|
|
315
316
|
this.__focusWrapperContent(wrapperClosestToRemovedFocused || this.querySelector(WRAPPER_LOCAL_NAME));
|
|
317
|
+
} else if (focusedElement && !focusedElement.matches(':focus')) {
|
|
318
|
+
// Firefox loses focus from a slotted element when the <slot> it was projected through is
|
|
319
|
+
// removed during the shadow re-render, even after re-projection through a different slot.
|
|
320
|
+
focusedElement.focus();
|
|
316
321
|
}
|
|
317
322
|
|
|
318
323
|
const focusedItem = this.querySelector(':focus');
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dashboard",
|
|
4
|
-
"version": "25.2.0-
|
|
4
|
+
"version": "25.2.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-dashboard-layout",
|
|
11
|
-
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
11
|
+
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-row-height` | fixed row height of the layout. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "dense-layout",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
"name": "vaadin-dashboard",
|
|
149
|
-
"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/25.2.0-
|
|
149
|
+
"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/25.2.0-alpha11/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha11/#/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-row-height` | fixed row height of the dashboard. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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.",
|
|
150
150
|
"attributes": [
|
|
151
151
|
{
|
|
152
152
|
"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": "25.2.0-
|
|
4
|
+
"version": "25.2.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-dashboard-layout",
|
|
19
|
-
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
19
|
+
"description": "A responsive, grid-based dashboard layout component\n\n```html\n<vaadin-dashboard-layout>\n <vaadin-dashboard-widget widget-title=\"Widget 1\"></vaadin-dashboard-widget>\n <vaadin-dashboard-widget widget-title=\"Widget 2\"></vaadin-dashboard-widget>\n <vaadin-dashboard-section section-title=\"Section\">\n <vaadin-dashboard-widget widget-title=\"Widget in Section\"></vaadin-dashboard-widget>\n </vaadin-dashboard-section>\n</vaadin-dashboard-layout>\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 layout\n`--vaadin-dashboard-col-max-width` | maximum column width of the layout\n`--vaadin-dashboard-row-min-height` | minimum row height of the layout\n`--vaadin-dashboard-row-height` | fixed row height of the layout. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the layout\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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`dense-layout` | Set when the dashboard is in dense mode.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"name": "vaadin-dashboard",
|
|
68
|
-
"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/25.2.0-
|
|
68
|
+
"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/25.2.0-alpha11/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.2.0-alpha11/#/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-row-height` | fixed row height of the dashboard. Must be in length units. Overrides `--vaadin-dashboard-row-min-height` and prevents rows from growing to fit content\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's 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.",
|
|
69
69
|
"extension": true,
|
|
70
70
|
"attributes": [
|
|
71
71
|
{
|