@vaadin/master-detail-layout 25.1.2 → 25.2.0-alpha10
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 +276 -64
- package/package.json +8 -8
- package/src/styles/vaadin-master-detail-layout-base-styles.js +204 -105
- package/src/vaadin-master-detail-layout-helpers.js +173 -0
- package/src/vaadin-master-detail-layout.d.ts +102 -66
- package/src/vaadin-master-detail-layout.js +446 -329
- package/web-types.json +56 -92
- package/web-types.lit.json +22 -22
- package/src/styles/vaadin-master-detail-layout-transition-base-styles.js +0 -147
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
-
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
8
|
-
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
9
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
8
|
|
|
11
9
|
export interface MasterDetailLayoutCustomEventMap {
|
|
@@ -21,25 +19,53 @@ export interface MasterDetailLayoutEventMap extends HTMLElementEventMap, MasterD
|
|
|
21
19
|
* (or primary) area and a detail (or secondary) area that is displayed next to, or
|
|
22
20
|
* overlaid on top of, the master area, depending on configuration and viewport size.
|
|
23
21
|
*
|
|
22
|
+
* ### Slots
|
|
23
|
+
*
|
|
24
|
+
* The component has two main content areas: the master area (default slot)
|
|
25
|
+
* and the detail area (`detail` slot). When the detail doesn't fit next to
|
|
26
|
+
* the master, it is shown as an overlay on top of the master area:
|
|
27
|
+
*
|
|
28
|
+
* ```html
|
|
29
|
+
* <vaadin-master-detail-layout>
|
|
30
|
+
* <div>Master content</div>
|
|
31
|
+
* <div slot="detail">Detail content</div>
|
|
32
|
+
* </vaadin-master-detail-layout>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The component also supports a `detail-placeholder` slot for content shown
|
|
36
|
+
* in the detail area when no detail is selected. Unlike the `detail` slot,
|
|
37
|
+
* the placeholder is simply hidden when it doesn't fit next to the master area,
|
|
38
|
+
* rather than shown as an overlay:
|
|
39
|
+
*
|
|
40
|
+
* ```html
|
|
41
|
+
* <vaadin-master-detail-layout>
|
|
42
|
+
* <div>Master content</div>
|
|
43
|
+
* <div slot="detail-placeholder">Select an item</div>
|
|
44
|
+
* </vaadin-master-detail-layout>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
24
47
|
* ### Styling
|
|
25
48
|
*
|
|
26
49
|
* The following shadow DOM parts are available for styling:
|
|
27
50
|
*
|
|
28
|
-
* Part name
|
|
29
|
-
*
|
|
30
|
-
* `backdrop`
|
|
31
|
-
* `master`
|
|
32
|
-
* `detail`
|
|
51
|
+
* Part name | Description
|
|
52
|
+
* ----------------------|----------------------
|
|
53
|
+
* `backdrop` | Backdrop covering the master area in the overlay mode
|
|
54
|
+
* `master` | The master area
|
|
55
|
+
* `detail` | The detail area
|
|
56
|
+
* `detail-placeholder` | The detail placeholder area
|
|
33
57
|
*
|
|
34
58
|
* The following state attributes are available for styling:
|
|
35
59
|
*
|
|
36
|
-
* Attribute
|
|
37
|
-
*
|
|
38
|
-
* `
|
|
39
|
-
* `
|
|
40
|
-
* `
|
|
41
|
-
* `
|
|
42
|
-
* `
|
|
60
|
+
* Attribute | Description
|
|
61
|
+
* --------------------------|----------------------
|
|
62
|
+
* `expand-master` | Set when the master area expands to fill available space.
|
|
63
|
+
* `expand-detail` | Set when the detail area expands to fill available space.
|
|
64
|
+
* `orientation` | Set to `horizontal` or `vertical` depending on the orientation.
|
|
65
|
+
* `has-detail` | Set when the detail content is provided and visible.
|
|
66
|
+
* `has-detail-placeholder` | Set when the detail placeholder content is provided.
|
|
67
|
+
* `overlay` | Set when columns don't fit and the detail is shown as an overlay.
|
|
68
|
+
* `overlay-containment` | Set to `layout` or `page`.
|
|
43
69
|
*
|
|
44
70
|
* The following custom CSS properties are available for styling:
|
|
45
71
|
*
|
|
@@ -53,53 +79,44 @@ export interface MasterDetailLayoutEventMap extends HTMLElementEventMap, MasterD
|
|
|
53
79
|
*
|
|
54
80
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
55
81
|
*
|
|
56
|
-
* @fires {CustomEvent} backdrop-click - Fired when the user clicks the backdrop in the
|
|
82
|
+
* @fires {CustomEvent} backdrop-click - Fired when the user clicks the backdrop in the overlay mode.
|
|
57
83
|
* @fires {CustomEvent} detail-escape-press - Fired when the user presses Escape in the detail area.
|
|
58
84
|
*/
|
|
59
|
-
declare class MasterDetailLayout extends
|
|
85
|
+
declare class MasterDetailLayout extends ThemableMixin(ElementMixin(HTMLElement)) {
|
|
60
86
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
87
|
+
* Size (in CSS length units) to be set on the detail area in
|
|
88
|
+
* the CSS grid layout. When there is not enough space to show
|
|
89
|
+
* master and detail areas next to each other, the detail area
|
|
90
|
+
* is shown as an overlay.
|
|
91
|
+
* <p>
|
|
92
|
+
* If not specified, the size is determined automatically by measuring
|
|
93
|
+
* the detail content in a `min-content` CSS grid column when it first
|
|
94
|
+
* becomes visible, and then caching the resulting intrinsic size. To
|
|
95
|
+
* recalculate the cached intrinsic size, use the `recalculateLayout`
|
|
96
|
+
* method.
|
|
66
97
|
*
|
|
67
98
|
* @attr {string} detail-size
|
|
68
99
|
*/
|
|
69
100
|
detailSize: string | null | undefined;
|
|
70
101
|
|
|
71
102
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* either as drawer or stack, depending on the `stackOverlay` property.
|
|
77
|
-
*
|
|
78
|
-
* @attr {string} detail-min-size
|
|
79
|
-
*/
|
|
80
|
-
detailMinSize: string | null | undefined;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Fixed size (in CSS length units) to be set on the master area.
|
|
84
|
-
* When specified, it prevents the master area from growing or
|
|
85
|
-
* shrinking. If there is not enough space to show master and detail
|
|
86
|
-
* areas next to each other, the details are shown as an overlay:
|
|
87
|
-
* either as drawer or stack, depending on the `stackOverlay` property.
|
|
103
|
+
* Size (in CSS length units) to be set on the master area in
|
|
104
|
+
* the CSS grid layout. If there is not enough space to show
|
|
105
|
+
* master and detail areas next to each other, the detail area
|
|
106
|
+
* is shown as an overlay. Defaults to 30em.
|
|
88
107
|
*
|
|
89
108
|
* @attr {string} master-size
|
|
90
109
|
*/
|
|
91
110
|
masterSize: string | null | undefined;
|
|
92
111
|
|
|
93
112
|
/**
|
|
94
|
-
*
|
|
95
|
-
* When
|
|
96
|
-
*
|
|
97
|
-
* areas next to each other, the details are shown as an overlay:
|
|
98
|
-
* either as drawer or stack, depending on the `stackOverlay` property.
|
|
113
|
+
* Size (in CSS length units) for the detail area when shown as an
|
|
114
|
+
* overlay. When not set, falls back to `detailSize`. Set to `100%`
|
|
115
|
+
* to make the detail cover the full layout.
|
|
99
116
|
*
|
|
100
|
-
* @attr {string}
|
|
117
|
+
* @attr {string} overlay-size
|
|
101
118
|
*/
|
|
102
|
-
|
|
119
|
+
overlaySize: string | null | undefined;
|
|
103
120
|
|
|
104
121
|
/**
|
|
105
122
|
* Define how master and detail areas are shown next to each other,
|
|
@@ -109,38 +126,33 @@ declare class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ThemableMix
|
|
|
109
126
|
*/
|
|
110
127
|
orientation: 'horizontal' | 'vertical';
|
|
111
128
|
|
|
112
|
-
/**
|
|
113
|
-
* When specified, forces the details to be shown as an overlay
|
|
114
|
-
* (either as drawer or stack), even if there is enough space for
|
|
115
|
-
* master and detail to be shown next to each other using the default
|
|
116
|
-
* (split) mode.
|
|
117
|
-
*
|
|
118
|
-
* In order to enforce the stack mode, use this property together with
|
|
119
|
-
* `stackOverlay` property and set both to `true`.
|
|
120
|
-
*
|
|
121
|
-
* @attr {boolean} force-overlay
|
|
122
|
-
*/
|
|
123
|
-
forceOverlay: boolean;
|
|
124
|
-
|
|
125
129
|
/**
|
|
126
130
|
* Defines the containment of the detail area when the layout is in
|
|
127
131
|
* overlay mode. When set to `layout`, the overlay is confined to the
|
|
128
|
-
* layout. When set to `
|
|
132
|
+
* layout. When set to `page`, the overlay is confined to the
|
|
129
133
|
* browser's viewport. Defaults to `layout`.
|
|
134
|
+
*
|
|
135
|
+
* @attr {string} overlay-containment
|
|
130
136
|
*/
|
|
131
|
-
|
|
137
|
+
overlayContainment: 'layout' | 'page';
|
|
132
138
|
|
|
133
139
|
/**
|
|
134
|
-
* When true, the
|
|
135
|
-
*
|
|
136
|
-
*
|
|
140
|
+
* When true, the master area grows to fill the available space.
|
|
141
|
+
* If `expandDetail` is also true, both areas share the available
|
|
142
|
+
* space equally.
|
|
137
143
|
*
|
|
138
|
-
*
|
|
139
|
-
|
|
144
|
+
* @attr {boolean} expand-master
|
|
145
|
+
*/
|
|
146
|
+
expandMaster: boolean;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* When true, the detail area grows to fill the available space.
|
|
150
|
+
* If `expandMaster` is also true, both areas share the available
|
|
151
|
+
* space equally.
|
|
140
152
|
*
|
|
141
|
-
* @attr {
|
|
153
|
+
* @attr {boolean} expand-detail
|
|
142
154
|
*/
|
|
143
|
-
|
|
155
|
+
expandDetail: boolean;
|
|
144
156
|
|
|
145
157
|
/**
|
|
146
158
|
* When true, the layout does not use animated transitions for the detail area.
|
|
@@ -149,6 +161,30 @@ declare class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ThemableMix
|
|
|
149
161
|
*/
|
|
150
162
|
noAnimation: boolean;
|
|
151
163
|
|
|
164
|
+
/**
|
|
165
|
+
* When true, the layout forces the detail area to be shown as an overlay,
|
|
166
|
+
* even if there is enough space for master and detail to be shown next to
|
|
167
|
+
* each other using the default (split) mode.
|
|
168
|
+
*
|
|
169
|
+
* @attr {boolean} force-overlay
|
|
170
|
+
*/
|
|
171
|
+
forceOverlay: boolean;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* When `detailSize` is not explicitly set, re-measures the cached intrinsic size of
|
|
175
|
+
* the detail content by placing it in a min-content CSS grid column, then repeats
|
|
176
|
+
* this process for ancestor master-detail layouts without an explicit `detailSize`,
|
|
177
|
+
* if any, so that their detail areas also adapt.
|
|
178
|
+
*
|
|
179
|
+
* Call this method after changing the detail content in a way that affects its intrinsic
|
|
180
|
+
* size — for example, when opening a detail in a nested master-detail layout that was
|
|
181
|
+
* not previously visible.
|
|
182
|
+
*
|
|
183
|
+
* NOTE: This method can be expensive in large layouts as it triggers consecutive
|
|
184
|
+
* synchronous DOM reads and writes.
|
|
185
|
+
*/
|
|
186
|
+
recalculateLayout(): void;
|
|
187
|
+
|
|
152
188
|
addEventListener<K extends keyof MasterDetailLayoutEventMap>(
|
|
153
189
|
type: K,
|
|
154
190
|
listener: (this: MasterDetailLayout, ev: MasterDetailLayoutEventMap[K]) => void,
|