@vaadin/dialog 25.1.0-alpha8 → 25.1.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/custom-elements.json +74 -42
- package/package.json +11 -11
- package/src/styles/vaadin-dialog-overlay-base-styles.js +4 -1
- package/src/vaadin-dialog-base-mixin.d.ts +10 -0
- package/src/vaadin-dialog-base-mixin.js +15 -0
- package/src/vaadin-dialog-draggable-mixin.d.ts +0 -8
- package/src/vaadin-dialog-draggable-mixin.js +15 -25
- package/src/vaadin-dialog-overlay-mixin.d.ts +5 -0
- package/src/vaadin-dialog-overlay-mixin.js +73 -0
- package/src/vaadin-dialog.js +1 -0
- package/web-types.json +91 -91
- package/web-types.lit.json +39 -39
package/custom-elements.json
CHANGED
|
@@ -26,6 +26,16 @@
|
|
|
26
26
|
"description": "",
|
|
27
27
|
"name": "DialogBaseMixin",
|
|
28
28
|
"members": [
|
|
29
|
+
{
|
|
30
|
+
"kind": "field",
|
|
31
|
+
"name": "keepInViewport",
|
|
32
|
+
"privacy": "public",
|
|
33
|
+
"type": {
|
|
34
|
+
"text": "boolean"
|
|
35
|
+
},
|
|
36
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
37
|
+
"attribute": "keep-in-viewport"
|
|
38
|
+
},
|
|
29
39
|
{
|
|
30
40
|
"kind": "field",
|
|
31
41
|
"name": "left",
|
|
@@ -117,6 +127,14 @@
|
|
|
117
127
|
}
|
|
118
128
|
],
|
|
119
129
|
"attributes": [
|
|
130
|
+
{
|
|
131
|
+
"name": "keep-in-viewport",
|
|
132
|
+
"type": {
|
|
133
|
+
"text": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
136
|
+
"fieldName": "keepInViewport"
|
|
137
|
+
},
|
|
120
138
|
{
|
|
121
139
|
"name": "left",
|
|
122
140
|
"type": {
|
|
@@ -219,16 +237,6 @@
|
|
|
219
237
|
},
|
|
220
238
|
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
221
239
|
"attribute": "draggable"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"kind": "field",
|
|
225
|
-
"name": "keepInViewport",
|
|
226
|
-
"privacy": "public",
|
|
227
|
-
"type": {
|
|
228
|
-
"text": "boolean"
|
|
229
|
-
},
|
|
230
|
-
"description": "Set to true to prevent dragging the dialog outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible during dragging.\nThe dialog may still become partially hidden when the viewport is resized.",
|
|
231
|
-
"attribute": "keep-in-viewport"
|
|
232
240
|
}
|
|
233
241
|
],
|
|
234
242
|
"events": [
|
|
@@ -253,14 +261,6 @@
|
|
|
253
261
|
},
|
|
254
262
|
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
255
263
|
"fieldName": "draggable"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
"name": "keep-in-viewport",
|
|
259
|
-
"type": {
|
|
260
|
-
"text": "boolean"
|
|
261
|
-
},
|
|
262
|
-
"description": "Set to true to prevent dragging the dialog outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible during dragging.\nThe dialog may still become partially hidden when the viewport is resized.",
|
|
263
|
-
"fieldName": "keepInViewport"
|
|
264
264
|
}
|
|
265
265
|
],
|
|
266
266
|
"parameters": [
|
|
@@ -383,6 +383,16 @@
|
|
|
383
383
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
|
+
{
|
|
387
|
+
"kind": "field",
|
|
388
|
+
"name": "keepInViewport",
|
|
389
|
+
"privacy": "public",
|
|
390
|
+
"type": {
|
|
391
|
+
"text": "boolean"
|
|
392
|
+
},
|
|
393
|
+
"description": "Whether to keep the overlay within the viewport.",
|
|
394
|
+
"attribute": "keep-in-viewport"
|
|
395
|
+
},
|
|
386
396
|
{
|
|
387
397
|
"kind": "field",
|
|
388
398
|
"name": "model",
|
|
@@ -495,20 +505,14 @@
|
|
|
495
505
|
"name": "setBounds",
|
|
496
506
|
"parameters": [
|
|
497
507
|
{
|
|
498
|
-
"name": "bounds"
|
|
499
|
-
"type": {
|
|
500
|
-
"text": "!OverlayBoundsParam"
|
|
501
|
-
}
|
|
508
|
+
"name": "bounds"
|
|
502
509
|
},
|
|
503
510
|
{
|
|
504
511
|
"name": "absolute",
|
|
505
|
-
"default": "true"
|
|
506
|
-
"type": {
|
|
507
|
-
"text": "boolean"
|
|
508
|
-
}
|
|
512
|
+
"default": "true"
|
|
509
513
|
}
|
|
510
514
|
],
|
|
511
|
-
"description": "
|
|
515
|
+
"description": "Override method from OverlayMixin to adjust the position of the overlay if `keepInViewport` is true.",
|
|
512
516
|
"inheritedFrom": {
|
|
513
517
|
"name": "OverlayMixin",
|
|
514
518
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
@@ -562,6 +566,14 @@
|
|
|
562
566
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
563
567
|
}
|
|
564
568
|
},
|
|
569
|
+
{
|
|
570
|
+
"name": "keep-in-viewport",
|
|
571
|
+
"type": {
|
|
572
|
+
"text": "boolean"
|
|
573
|
+
},
|
|
574
|
+
"description": "Whether to keep the overlay within the viewport.",
|
|
575
|
+
"fieldName": "keepInViewport"
|
|
576
|
+
},
|
|
565
577
|
{
|
|
566
578
|
"name": "modeless",
|
|
567
579
|
"type": {
|
|
@@ -811,6 +823,20 @@
|
|
|
811
823
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
812
824
|
}
|
|
813
825
|
},
|
|
826
|
+
{
|
|
827
|
+
"kind": "field",
|
|
828
|
+
"name": "keepInViewport",
|
|
829
|
+
"privacy": "public",
|
|
830
|
+
"type": {
|
|
831
|
+
"text": "boolean"
|
|
832
|
+
},
|
|
833
|
+
"description": "Whether to keep the overlay within the viewport.",
|
|
834
|
+
"attribute": "keep-in-viewport",
|
|
835
|
+
"inheritedFrom": {
|
|
836
|
+
"name": "DialogOverlayMixin",
|
|
837
|
+
"module": "src/vaadin-dialog-overlay-mixin.js"
|
|
838
|
+
}
|
|
839
|
+
},
|
|
814
840
|
{
|
|
815
841
|
"kind": "field",
|
|
816
842
|
"name": "model",
|
|
@@ -923,20 +949,14 @@
|
|
|
923
949
|
"name": "setBounds",
|
|
924
950
|
"parameters": [
|
|
925
951
|
{
|
|
926
|
-
"name": "bounds"
|
|
927
|
-
"type": {
|
|
928
|
-
"text": "!OverlayBoundsParam"
|
|
929
|
-
}
|
|
952
|
+
"name": "bounds"
|
|
930
953
|
},
|
|
931
954
|
{
|
|
932
955
|
"name": "absolute",
|
|
933
|
-
"default": "true"
|
|
934
|
-
"type": {
|
|
935
|
-
"text": "boolean"
|
|
936
|
-
}
|
|
956
|
+
"default": "true"
|
|
937
957
|
}
|
|
938
958
|
],
|
|
939
|
-
"description": "
|
|
959
|
+
"description": "Override method from OverlayMixin to adjust the position of the overlay if `keepInViewport` is true.",
|
|
940
960
|
"inheritedFrom": {
|
|
941
961
|
"name": "OverlayMixin",
|
|
942
962
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
@@ -1022,6 +1042,18 @@
|
|
|
1022
1042
|
"package": "@vaadin/overlay/src/vaadin-overlay-mixin.js"
|
|
1023
1043
|
}
|
|
1024
1044
|
},
|
|
1045
|
+
{
|
|
1046
|
+
"name": "keep-in-viewport",
|
|
1047
|
+
"type": {
|
|
1048
|
+
"text": "boolean"
|
|
1049
|
+
},
|
|
1050
|
+
"description": "Whether to keep the overlay within the viewport.",
|
|
1051
|
+
"fieldName": "keepInViewport",
|
|
1052
|
+
"inheritedFrom": {
|
|
1053
|
+
"name": "DialogOverlayMixin",
|
|
1054
|
+
"module": "src/vaadin-dialog-overlay-mixin.js"
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1025
1057
|
{
|
|
1026
1058
|
"name": "modeless",
|
|
1027
1059
|
"type": {
|
|
@@ -1516,11 +1548,11 @@
|
|
|
1516
1548
|
"type": {
|
|
1517
1549
|
"text": "boolean"
|
|
1518
1550
|
},
|
|
1519
|
-
"description": "Set to true to prevent
|
|
1551
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
1520
1552
|
"attribute": "keep-in-viewport",
|
|
1521
1553
|
"inheritedFrom": {
|
|
1522
|
-
"name": "
|
|
1523
|
-
"module": "src/vaadin-dialog-
|
|
1554
|
+
"name": "DialogBaseMixin",
|
|
1555
|
+
"module": "src/vaadin-dialog-base-mixin.js"
|
|
1524
1556
|
}
|
|
1525
1557
|
},
|
|
1526
1558
|
{
|
|
@@ -1855,11 +1887,11 @@
|
|
|
1855
1887
|
"type": {
|
|
1856
1888
|
"text": "boolean"
|
|
1857
1889
|
},
|
|
1858
|
-
"description": "Set to true to prevent
|
|
1890
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
1859
1891
|
"fieldName": "keepInViewport",
|
|
1860
1892
|
"inheritedFrom": {
|
|
1861
|
-
"name": "
|
|
1862
|
-
"module": "src/vaadin-dialog-
|
|
1893
|
+
"name": "DialogBaseMixin",
|
|
1894
|
+
"module": "src/vaadin-dialog-base-mixin.js"
|
|
1863
1895
|
}
|
|
1864
1896
|
},
|
|
1865
1897
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dialog",
|
|
3
|
-
"version": "25.1.0-
|
|
3
|
+
"version": "25.1.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/component-base": "25.1.0-
|
|
41
|
-
"@vaadin/lit-renderer": "25.1.0-
|
|
42
|
-
"@vaadin/overlay": "25.1.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.1.0-
|
|
40
|
+
"@vaadin/component-base": "25.1.0-beta1",
|
|
41
|
+
"@vaadin/lit-renderer": "25.1.0-beta1",
|
|
42
|
+
"@vaadin/overlay": "25.1.0-beta1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.1.0-beta1",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/a11y-base": "25.1.0-
|
|
48
|
-
"@vaadin/aura": "25.1.0-
|
|
49
|
-
"@vaadin/chai-plugins": "25.1.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.1.0-
|
|
47
|
+
"@vaadin/a11y-base": "25.1.0-beta1",
|
|
48
|
+
"@vaadin/aura": "25.1.0-beta1",
|
|
49
|
+
"@vaadin/chai-plugins": "25.1.0-beta1",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.1.0-beta1",
|
|
51
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "25.1.0-
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.1.0-beta1",
|
|
53
53
|
"sinon": "^21.0.0"
|
|
54
54
|
},
|
|
55
55
|
"customElements": "custom-elements.json",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "0ccf77c385fc6a92ac2a6344ce8804b94956226d"
|
|
61
61
|
}
|
|
@@ -124,6 +124,9 @@ const dialogResizableOverlay = css`
|
|
|
124
124
|
|
|
125
125
|
:host([has-bounds-set]) [part='overlay'] {
|
|
126
126
|
min-width: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([has-bounds-set]:not([keep-in-viewport])) [part='overlay'] {
|
|
127
130
|
max-width: none;
|
|
128
131
|
max-height: none;
|
|
129
132
|
}
|
|
@@ -138,7 +141,7 @@ const dialogResizableOverlay = css`
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
[part='header'],
|
|
141
|
-
:host(:not([has-header])) [part='content'] {
|
|
144
|
+
:host(:not([has-title], [has-header])) [part='content'] {
|
|
142
145
|
border-top-left-radius: inherit;
|
|
143
146
|
border-top-right-radius: inherit;
|
|
144
147
|
}
|
|
@@ -63,4 +63,14 @@ export declare class DialogBaseMixinClass {
|
|
|
63
63
|
* additional spacing, which can be overridden by the theme.
|
|
64
64
|
*/
|
|
65
65
|
left: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Set to true to prevent the dialog from moving outside the viewport bounds.
|
|
69
|
+
* When enabled, all four edges of the dialog will remain visible, for example
|
|
70
|
+
* when dragging the dialog or when the viewport is resized. Note that the
|
|
71
|
+
* dialog will also adjust any programmatically configured size and position
|
|
72
|
+
* so that it stays within the viewport.
|
|
73
|
+
* @attr {boolean} keep-in-viewport
|
|
74
|
+
*/
|
|
75
|
+
keepInViewport: boolean;
|
|
66
76
|
}
|
|
@@ -93,6 +93,21 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
93
93
|
overlayRole: {
|
|
94
94
|
type: String,
|
|
95
95
|
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Set to true to prevent the dialog from moving outside the viewport bounds.
|
|
99
|
+
* When enabled, all four edges of the dialog will remain visible, for example
|
|
100
|
+
* when dragging the dialog or when the viewport is resized. Note that the
|
|
101
|
+
* dialog will also adjust any programmatically configured size and position
|
|
102
|
+
* so that it stays within the viewport.
|
|
103
|
+
* @attr {boolean} keep-in-viewport
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
*/
|
|
106
|
+
keepInViewport: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
value: false,
|
|
109
|
+
reflectToAttribute: true,
|
|
110
|
+
},
|
|
96
111
|
};
|
|
97
112
|
}
|
|
98
113
|
|
|
@@ -21,12 +21,4 @@ export declare class DialogDraggableMixinClass {
|
|
|
21
21
|
* "`draggable-leaf-only`" class name.
|
|
22
22
|
*/
|
|
23
23
|
draggable: boolean;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Set to true to prevent dragging the dialog outside the viewport bounds.
|
|
27
|
-
* When enabled, all four edges of the dialog will remain visible during dragging.
|
|
28
|
-
* The dialog may still become partially hidden when the viewport is resized.
|
|
29
|
-
* @attr {boolean} keep-in-viewport
|
|
30
|
-
*/
|
|
31
|
-
keepInViewport: boolean;
|
|
32
24
|
}
|
|
@@ -31,19 +31,6 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
31
31
|
reflectToAttribute: true,
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* Set to true to prevent dragging the dialog outside the viewport bounds.
|
|
36
|
-
* When enabled, all four edges of the dialog will remain visible during dragging.
|
|
37
|
-
* The dialog may still become partially hidden when the viewport is resized.
|
|
38
|
-
* @attr {boolean} keep-in-viewport
|
|
39
|
-
* @type {boolean}
|
|
40
|
-
*/
|
|
41
|
-
keepInViewport: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
value: false,
|
|
44
|
-
reflectToAttribute: true,
|
|
45
|
-
},
|
|
46
|
-
|
|
47
34
|
/** @private */
|
|
48
35
|
_touchDevice: {
|
|
49
36
|
type: Boolean,
|
|
@@ -77,6 +64,12 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
77
64
|
return;
|
|
78
65
|
}
|
|
79
66
|
|
|
67
|
+
// Don't initiate drag if a nested dialog already handled this event.
|
|
68
|
+
// This prevents dragging both dialogs simultaneously.
|
|
69
|
+
if (e.defaultPrevented) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
80
73
|
if (this.draggable && (e.button === 0 || e.touches)) {
|
|
81
74
|
const resizerContainer = this.$.overlay.$.resizerContainer;
|
|
82
75
|
const isResizerContainer = e.target === resizerContainer;
|
|
@@ -96,9 +89,8 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
96
89
|
});
|
|
97
90
|
|
|
98
91
|
if ((isResizerContainer && !isResizerContainerScrollbar) || isContentPart || isDraggable) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
92
|
+
// Signal that we're handling this drag event, so parent dialogs won't also drag
|
|
93
|
+
e.preventDefault();
|
|
102
94
|
this._originalBounds = this.$.overlay.getBounds();
|
|
103
95
|
const event = getMouseOrFirstTouchEvent(e);
|
|
104
96
|
this._originalMouseCoords = { top: event.pageY, left: event.pageX };
|
|
@@ -127,16 +119,14 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
127
119
|
let left = this._originalBounds.left + (event.pageX - this._originalMouseCoords.left);
|
|
128
120
|
|
|
129
121
|
if (this.keepInViewport) {
|
|
122
|
+
// Constrain the dialog position so that it stays within the overlay host bounds,
|
|
123
|
+
// respecting the `--vaadin-overlay-viewport-inset` (offset from the viewport edges).
|
|
130
124
|
const { width, height } = this._originalBounds;
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const minTop = -containerBounds.top;
|
|
137
|
-
const maxTop = window.innerHeight - containerBounds.top - height;
|
|
138
|
-
left = Math.max(minLeft, Math.min(left, maxLeft));
|
|
139
|
-
top = Math.max(minTop, Math.min(top, maxTop));
|
|
125
|
+
const overlayHostBounds = this.$.overlay.getBoundingClientRect();
|
|
126
|
+
const maxLeft = overlayHostBounds.right - overlayHostBounds.left - width;
|
|
127
|
+
const maxTop = overlayHostBounds.bottom - overlayHostBounds.top - height;
|
|
128
|
+
left = Math.max(0, Math.min(left, maxLeft));
|
|
129
|
+
top = Math.max(0, Math.min(top, maxTop));
|
|
140
130
|
}
|
|
141
131
|
|
|
142
132
|
this.top = top;
|
|
@@ -35,6 +35,14 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
35
35
|
footerRenderer: {
|
|
36
36
|
type: Object,
|
|
37
37
|
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Whether to keep the overlay within the viewport.
|
|
41
|
+
*/
|
|
42
|
+
keepInViewport: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
reflectToAttribute: true,
|
|
45
|
+
},
|
|
38
46
|
};
|
|
39
47
|
}
|
|
40
48
|
|
|
@@ -77,6 +85,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
77
85
|
// Update overflow attribute on resize
|
|
78
86
|
this.__resizeObserver = new ResizeObserver(() => {
|
|
79
87
|
requestAnimationFrame(() => {
|
|
88
|
+
this.__adjustPosition();
|
|
80
89
|
this.__updateOverflow();
|
|
81
90
|
});
|
|
82
91
|
});
|
|
@@ -104,6 +113,20 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
104
113
|
setOverlayStateAttribute(this, 'has-footer', currentNodes.length > 0);
|
|
105
114
|
this.__updateOverflow();
|
|
106
115
|
});
|
|
116
|
+
|
|
117
|
+
this.__handleWindowResize = this.__handleWindowResize.bind(this);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
updated(props) {
|
|
121
|
+
super.updated(props);
|
|
122
|
+
|
|
123
|
+
if (props.has('opened') || props.has('keepInViewport')) {
|
|
124
|
+
if (this.opened && this.keepInViewport) {
|
|
125
|
+
window.addEventListener('resize', this.__handleWindowResize);
|
|
126
|
+
} else {
|
|
127
|
+
window.removeEventListener('resize', this.__handleWindowResize);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
/** @private */
|
|
@@ -233,6 +256,15 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
233
256
|
return { top, left, width, height };
|
|
234
257
|
}
|
|
235
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Override method from OverlayMixin to adjust the position of the overlay if `keepInViewport` is true.
|
|
261
|
+
* @override
|
|
262
|
+
*/
|
|
263
|
+
setBounds(bounds, absolute = true) {
|
|
264
|
+
super.setBounds(bounds, absolute);
|
|
265
|
+
this.__adjustPosition();
|
|
266
|
+
}
|
|
267
|
+
|
|
236
268
|
/** @private */
|
|
237
269
|
__updateOverflow() {
|
|
238
270
|
let overflow = '';
|
|
@@ -254,4 +286,45 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
254
286
|
setOverlayStateAttribute(this, 'overflow', null);
|
|
255
287
|
}
|
|
256
288
|
}
|
|
289
|
+
|
|
290
|
+
/** @private */
|
|
291
|
+
__handleWindowResize() {
|
|
292
|
+
this.__adjustPosition();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Adjusts the position of the overlay to keep it within the viewport if `keepInViewport` is true.
|
|
297
|
+
* @private
|
|
298
|
+
*/
|
|
299
|
+
__adjustPosition() {
|
|
300
|
+
if (!this.opened || !this.keepInViewport) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Centered dialogs do not use absolute positioning and automatically adjust their position / size to fit the viewport
|
|
305
|
+
const style = getComputedStyle(this.$.overlay);
|
|
306
|
+
if (style.position !== 'absolute') {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const overlayHostBounds = this.getBoundingClientRect();
|
|
311
|
+
const bounds = this.getBounds();
|
|
312
|
+
// Prefer dimensions from getComputedStyle, as bounding rect is affected
|
|
313
|
+
// by scale transform applied by opening animation in Lumo
|
|
314
|
+
const width = parseFloat(style.width) || bounds.width;
|
|
315
|
+
const height = parseFloat(style.height) || bounds.height;
|
|
316
|
+
|
|
317
|
+
const maxLeft = overlayHostBounds.right - overlayHostBounds.left - width;
|
|
318
|
+
const maxTop = overlayHostBounds.bottom - overlayHostBounds.top - height;
|
|
319
|
+
|
|
320
|
+
if (bounds.left > maxLeft || bounds.top > maxTop) {
|
|
321
|
+
const left = Math.max(0, Math.min(bounds.left, maxLeft));
|
|
322
|
+
const top = Math.max(0, Math.min(bounds.top, maxTop));
|
|
323
|
+
|
|
324
|
+
Object.assign(this.$.overlay.style, {
|
|
325
|
+
left: `${left}px`,
|
|
326
|
+
top: `${top}px`,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
257
330
|
};
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -148,6 +148,7 @@ class Dialog extends DialogSizeMixin(
|
|
|
148
148
|
.renderer="${this.renderer}"
|
|
149
149
|
.headerRenderer="${this.headerRenderer}"
|
|
150
150
|
.footerRenderer="${this.footerRenderer}"
|
|
151
|
+
.keepInViewport="${this.keepInViewport}"
|
|
151
152
|
@opened-changed="${this._onOverlayOpened}"
|
|
152
153
|
@mousedown="${this._bringOverlayToFront}"
|
|
153
154
|
@touchstart="${this._bringOverlayToFront}"
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dialog",
|
|
4
|
-
"version": "25.1.0-
|
|
4
|
+
"version": "25.1.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"description": "`<vaadin-dialog>` is a Web Component for creating customized modal dialogs.\n\n### Rendering\n\nThe content of the dialog can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `dialog` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `dialog`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-dialog id=\"dialog\"></vaadin-dialog>\n```\n```js\nconst dialog = document.querySelector('#dialog');\ndialog.renderer = function(root, dialog) {\n root.textContent = \"Sample dialog\";\n};\n```\n\nRenderer is called on the opening of the dialog.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n`header` | Element wrapping title and header content\n`header-content` | Element wrapping the header content slot\n`title` | Element wrapping the title slot\n`footer` | Element wrapping the footer slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|--------------------------------------------\n`has-title` | Set when the element has a title\n`has-header` | Set when the element has header renderer\n`has-footer` | Set when the element has footer renderer\n`overflow` | Set to `top`, `bottom`, none or both\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------|\n|`--vaadin-dialog-background` |\n|`--vaadin-dialog-border-color` |\n|`--vaadin-dialog-border-radius` |\n|`--vaadin-dialog-border-width` |\n|`--vaadin-dialog-max-width` |\n|`--vaadin-dialog-min-width` |\n|`--vaadin-dialog-padding` |\n|`--vaadin-dialog-shadow` |\n|`--vaadin-dialog-title-color` |\n|`--vaadin-dialog-title-font-size` |\n|`--vaadin-dialog-title-font-weight` |\n|`--vaadin-dialog-title-line-height` |\n|`--vaadin-overlay-backdrop-background` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
|
-
"name": "
|
|
15
|
-
"description": "
|
|
14
|
+
"name": "draggable",
|
|
15
|
+
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
16
16
|
"value": {
|
|
17
17
|
"type": [
|
|
18
18
|
"boolean"
|
|
@@ -20,26 +20,30 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
"name": "
|
|
24
|
-
"description": "
|
|
23
|
+
"name": "header-title",
|
|
24
|
+
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is set on the dialog.",
|
|
25
25
|
"value": {
|
|
26
26
|
"type": [
|
|
27
|
-
"
|
|
27
|
+
"string",
|
|
28
|
+
"null",
|
|
29
|
+
"undefined"
|
|
28
30
|
]
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
{
|
|
32
|
-
"name": "
|
|
33
|
-
"description": "Set
|
|
34
|
+
"name": "height",
|
|
35
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
34
36
|
"value": {
|
|
35
37
|
"type": [
|
|
36
|
-
"
|
|
38
|
+
"string",
|
|
39
|
+
"null",
|
|
40
|
+
"undefined"
|
|
37
41
|
]
|
|
38
42
|
}
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
|
-
"name": "
|
|
42
|
-
"description": "Set to true to
|
|
45
|
+
"name": "keep-in-viewport",
|
|
46
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
43
47
|
"value": {
|
|
44
48
|
"type": [
|
|
45
49
|
"boolean"
|
|
@@ -47,50 +51,46 @@
|
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
{
|
|
50
|
-
"name": "
|
|
51
|
-
"description": "Set
|
|
54
|
+
"name": "left",
|
|
55
|
+
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
52
56
|
"value": {
|
|
53
57
|
"type": [
|
|
54
|
-
"
|
|
58
|
+
"string",
|
|
59
|
+
"null",
|
|
60
|
+
"undefined"
|
|
55
61
|
]
|
|
56
62
|
}
|
|
57
63
|
},
|
|
58
64
|
{
|
|
59
|
-
"name": "
|
|
60
|
-
"description": "Set
|
|
65
|
+
"name": "modeless",
|
|
66
|
+
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
61
67
|
"value": {
|
|
62
68
|
"type": [
|
|
63
|
-
"
|
|
64
|
-
"null",
|
|
65
|
-
"undefined"
|
|
69
|
+
"boolean"
|
|
66
70
|
]
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
73
|
{
|
|
70
|
-
"name": "
|
|
71
|
-
"description": "Set
|
|
74
|
+
"name": "no-close-on-esc",
|
|
75
|
+
"description": "Set to true to disable closing dialog on Escape press",
|
|
72
76
|
"value": {
|
|
73
77
|
"type": [
|
|
74
|
-
"
|
|
75
|
-
"null",
|
|
76
|
-
"undefined"
|
|
78
|
+
"boolean"
|
|
77
79
|
]
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
82
|
{
|
|
81
|
-
"name": "
|
|
82
|
-
"description": "
|
|
83
|
+
"name": "no-close-on-outside-click",
|
|
84
|
+
"description": "Set to true to disable closing dialog on outside click",
|
|
83
85
|
"value": {
|
|
84
86
|
"type": [
|
|
85
|
-
"
|
|
86
|
-
"null",
|
|
87
|
-
"undefined"
|
|
87
|
+
"boolean"
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"name": "
|
|
93
|
-
"description": "Set to true to
|
|
92
|
+
"name": "no-focus-trap",
|
|
93
|
+
"description": "Set to true to disable focus trapping.",
|
|
94
94
|
"value": {
|
|
95
95
|
"type": [
|
|
96
96
|
"boolean"
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
"name": "
|
|
102
|
-
"description": "
|
|
101
|
+
"name": "opened",
|
|
102
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
103
103
|
"value": {
|
|
104
104
|
"type": [
|
|
105
105
|
"boolean"
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
|
-
"name": "
|
|
111
|
-
"description": "
|
|
110
|
+
"name": "overlay-role",
|
|
111
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
112
112
|
"value": {
|
|
113
113
|
"type": [
|
|
114
114
|
"string",
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
"name": "
|
|
131
|
-
"description": "
|
|
130
|
+
"name": "theme",
|
|
131
|
+
"description": "The theme variants to apply to the component.",
|
|
132
132
|
"value": {
|
|
133
133
|
"type": [
|
|
134
134
|
"string",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
"name": "
|
|
142
|
-
"description": "Set the
|
|
141
|
+
"name": "top",
|
|
142
|
+
"description": "Set the distance of the dialog from the top of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
143
143
|
"value": {
|
|
144
144
|
"type": [
|
|
145
145
|
"string",
|
|
@@ -149,8 +149,8 @@
|
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
|
-
"name": "
|
|
153
|
-
"description": "
|
|
152
|
+
"name": "width",
|
|
153
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
154
154
|
"value": {
|
|
155
155
|
"type": [
|
|
156
156
|
"string",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"js": {
|
|
164
164
|
"properties": [
|
|
165
165
|
{
|
|
166
|
-
"name": "
|
|
167
|
-
"description": "
|
|
166
|
+
"name": "draggable",
|
|
167
|
+
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
168
168
|
"value": {
|
|
169
169
|
"type": [
|
|
170
170
|
"boolean"
|
|
@@ -172,49 +172,53 @@
|
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
|
-
"name": "
|
|
176
|
-
"description": "
|
|
175
|
+
"name": "footerRenderer",
|
|
176
|
+
"description": "Custom function for rendering the dialog footer.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nWhen `footerRenderer` is set, the attribute `has-footer` is set on the dialog.",
|
|
177
177
|
"value": {
|
|
178
178
|
"type": [
|
|
179
|
-
"
|
|
179
|
+
"DialogRenderer",
|
|
180
|
+
"undefined"
|
|
180
181
|
]
|
|
181
182
|
}
|
|
182
183
|
},
|
|
183
184
|
{
|
|
184
|
-
"name": "
|
|
185
|
-
"description": "
|
|
185
|
+
"name": "headerRenderer",
|
|
186
|
+
"description": "Custom function for rendering the dialog header.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerRenderer` is set, the attribute `has-header` is set on the dialog.",
|
|
186
187
|
"value": {
|
|
187
188
|
"type": [
|
|
188
|
-
"
|
|
189
|
+
"DialogRenderer",
|
|
190
|
+
"undefined"
|
|
189
191
|
]
|
|
190
192
|
}
|
|
191
193
|
},
|
|
192
194
|
{
|
|
193
|
-
"name": "
|
|
194
|
-
"description": "
|
|
195
|
+
"name": "headerTitle",
|
|
196
|
+
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is set on the dialog.",
|
|
195
197
|
"value": {
|
|
196
198
|
"type": [
|
|
197
|
-
"
|
|
199
|
+
"string",
|
|
200
|
+
"null",
|
|
201
|
+
"undefined"
|
|
198
202
|
]
|
|
199
203
|
}
|
|
200
204
|
},
|
|
201
205
|
{
|
|
202
|
-
"name": "
|
|
203
|
-
"description": "Set
|
|
206
|
+
"name": "height",
|
|
207
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
204
208
|
"value": {
|
|
205
209
|
"type": [
|
|
206
|
-
"
|
|
210
|
+
"string",
|
|
211
|
+
"null",
|
|
212
|
+
"undefined"
|
|
207
213
|
]
|
|
208
214
|
}
|
|
209
215
|
},
|
|
210
216
|
{
|
|
211
|
-
"name": "
|
|
212
|
-
"description": "Set
|
|
217
|
+
"name": "keepInViewport",
|
|
218
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
213
219
|
"value": {
|
|
214
220
|
"type": [
|
|
215
|
-
"
|
|
216
|
-
"null",
|
|
217
|
-
"undefined"
|
|
221
|
+
"boolean"
|
|
218
222
|
]
|
|
219
223
|
}
|
|
220
224
|
},
|
|
@@ -230,19 +234,17 @@
|
|
|
230
234
|
}
|
|
231
235
|
},
|
|
232
236
|
{
|
|
233
|
-
"name": "
|
|
234
|
-
"description": "
|
|
237
|
+
"name": "modeless",
|
|
238
|
+
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
235
239
|
"value": {
|
|
236
240
|
"type": [
|
|
237
|
-
"
|
|
238
|
-
"null",
|
|
239
|
-
"undefined"
|
|
241
|
+
"boolean"
|
|
240
242
|
]
|
|
241
243
|
}
|
|
242
244
|
},
|
|
243
245
|
{
|
|
244
|
-
"name": "
|
|
245
|
-
"description": "Set to true to
|
|
246
|
+
"name": "noCloseOnEsc",
|
|
247
|
+
"description": "Set to true to disable closing dialog on Escape press",
|
|
246
248
|
"value": {
|
|
247
249
|
"type": [
|
|
248
250
|
"boolean"
|
|
@@ -250,8 +252,8 @@
|
|
|
250
252
|
}
|
|
251
253
|
},
|
|
252
254
|
{
|
|
253
|
-
"name": "
|
|
254
|
-
"description": "Set to true to
|
|
255
|
+
"name": "noCloseOnOutsideClick",
|
|
256
|
+
"description": "Set to true to disable closing dialog on outside click",
|
|
255
257
|
"value": {
|
|
256
258
|
"type": [
|
|
257
259
|
"boolean"
|
|
@@ -259,39 +261,37 @@
|
|
|
259
261
|
}
|
|
260
262
|
},
|
|
261
263
|
{
|
|
262
|
-
"name": "
|
|
263
|
-
"description": "
|
|
264
|
+
"name": "noFocusTrap",
|
|
265
|
+
"description": "Set to true to disable focus trapping.",
|
|
264
266
|
"value": {
|
|
265
267
|
"type": [
|
|
266
|
-
"
|
|
267
|
-
"undefined"
|
|
268
|
+
"boolean"
|
|
268
269
|
]
|
|
269
270
|
}
|
|
270
271
|
},
|
|
271
272
|
{
|
|
272
|
-
"name": "
|
|
273
|
-
"description": "
|
|
273
|
+
"name": "opened",
|
|
274
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
274
275
|
"value": {
|
|
275
276
|
"type": [
|
|
276
|
-
"
|
|
277
|
-
"null",
|
|
278
|
-
"undefined"
|
|
277
|
+
"boolean"
|
|
279
278
|
]
|
|
280
279
|
}
|
|
281
280
|
},
|
|
282
281
|
{
|
|
283
|
-
"name": "
|
|
284
|
-
"description": "
|
|
282
|
+
"name": "overlayRole",
|
|
283
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
285
284
|
"value": {
|
|
286
285
|
"type": [
|
|
287
|
-
"
|
|
286
|
+
"string",
|
|
287
|
+
"null",
|
|
288
288
|
"undefined"
|
|
289
289
|
]
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
|
-
"name": "
|
|
294
|
-
"description": "Custom function for rendering the dialog
|
|
293
|
+
"name": "renderer",
|
|
294
|
+
"description": "Custom function for rendering the content of the dialog.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.",
|
|
295
295
|
"value": {
|
|
296
296
|
"type": [
|
|
297
297
|
"DialogRenderer",
|
|
@@ -309,8 +309,8 @@
|
|
|
309
309
|
}
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
|
-
"name": "
|
|
313
|
-
"description": "Set the
|
|
312
|
+
"name": "top",
|
|
313
|
+
"description": "Set the distance of the dialog from the top of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
314
314
|
"value": {
|
|
315
315
|
"type": [
|
|
316
316
|
"string",
|
|
@@ -320,8 +320,8 @@
|
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
{
|
|
323
|
-
"name": "
|
|
324
|
-
"description": "Set the
|
|
323
|
+
"name": "width",
|
|
324
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
325
325
|
"value": {
|
|
326
326
|
"type": [
|
|
327
327
|
"string",
|
|
@@ -344,6 +344,10 @@
|
|
|
344
344
|
"name": "dragged",
|
|
345
345
|
"description": "Fired when the dialog drag is finished."
|
|
346
346
|
},
|
|
347
|
+
{
|
|
348
|
+
"name": "opened-changed",
|
|
349
|
+
"description": "Fired when the `opened` property changes."
|
|
350
|
+
},
|
|
347
351
|
{
|
|
348
352
|
"name": "resize",
|
|
349
353
|
"description": "Fired when the dialog resize is finished."
|
|
@@ -351,10 +355,6 @@
|
|
|
351
355
|
{
|
|
352
356
|
"name": "resize-start",
|
|
353
357
|
"description": "Fired when the dialog resize is started."
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"name": "opened-changed",
|
|
357
|
-
"description": "Fired when the `opened` property changes."
|
|
358
358
|
}
|
|
359
359
|
]
|
|
360
360
|
}
|
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/dialog",
|
|
4
|
-
"version": "25.1.0-
|
|
4
|
+
"version": "25.1.0-beta1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -20,50 +20,50 @@
|
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
23
|
-
"name": "?
|
|
24
|
-
"description": "
|
|
23
|
+
"name": "?draggable",
|
|
24
|
+
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
25
25
|
"value": {
|
|
26
26
|
"kind": "expression"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"name": "?
|
|
31
|
-
"description": "Set to true to
|
|
30
|
+
"name": "?keepInViewport",
|
|
31
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
"name": "?
|
|
38
|
-
"description": "Set to true to
|
|
37
|
+
"name": "?modeless",
|
|
38
|
+
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
39
39
|
"value": {
|
|
40
40
|
"kind": "expression"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
"name": "?
|
|
45
|
-
"description": "Set to true to
|
|
44
|
+
"name": "?noCloseOnEsc",
|
|
45
|
+
"description": "Set to true to disable closing dialog on Escape press",
|
|
46
46
|
"value": {
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"name": "?
|
|
52
|
-
"description": "Set to true to disable
|
|
51
|
+
"name": "?noCloseOnOutsideClick",
|
|
52
|
+
"description": "Set to true to disable closing dialog on outside click",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
"name": "?
|
|
59
|
-
"description": "Set to true to
|
|
58
|
+
"name": "?noFocusTrap",
|
|
59
|
+
"description": "Set to true to disable focus trapping.",
|
|
60
60
|
"value": {
|
|
61
61
|
"kind": "expression"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
"name": "?
|
|
66
|
-
"description": "
|
|
65
|
+
"name": "?opened",
|
|
66
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
67
67
|
"value": {
|
|
68
68
|
"kind": "expression"
|
|
69
69
|
}
|
|
@@ -76,64 +76,64 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
"name": ".
|
|
80
|
-
"description": "
|
|
79
|
+
"name": ".footerRenderer",
|
|
80
|
+
"description": "Custom function for rendering the dialog footer.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nWhen `footerRenderer` is set, the attribute `has-footer` is set on the dialog.",
|
|
81
81
|
"value": {
|
|
82
82
|
"kind": "expression"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"name": ".
|
|
87
|
-
"description": "
|
|
86
|
+
"name": ".headerRenderer",
|
|
87
|
+
"description": "Custom function for rendering the dialog header.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerRenderer` is set, the attribute `has-header` is set on the dialog.",
|
|
88
88
|
"value": {
|
|
89
89
|
"kind": "expression"
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
"name": ".
|
|
94
|
-
"description": "
|
|
93
|
+
"name": ".headerTitle",
|
|
94
|
+
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is set on the dialog.",
|
|
95
95
|
"value": {
|
|
96
96
|
"kind": "expression"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"name": ".
|
|
101
|
-
"description": "
|
|
100
|
+
"name": ".height",
|
|
101
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
102
102
|
"value": {
|
|
103
103
|
"kind": "expression"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
"name": ".
|
|
108
|
-
"description": "
|
|
107
|
+
"name": ".left",
|
|
108
|
+
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
109
109
|
"value": {
|
|
110
110
|
"kind": "expression"
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
"name": ".
|
|
115
|
-
"description": "
|
|
114
|
+
"name": ".overlayRole",
|
|
115
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
116
116
|
"value": {
|
|
117
117
|
"kind": "expression"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
"name": ".
|
|
122
|
-
"description": "Custom function for rendering the dialog
|
|
121
|
+
"name": ".renderer",
|
|
122
|
+
"description": "Custom function for rendering the content of the dialog.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.",
|
|
123
123
|
"value": {
|
|
124
124
|
"kind": "expression"
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
|
-
"name": ".
|
|
129
|
-
"description": "Set the
|
|
128
|
+
"name": ".top",
|
|
129
|
+
"description": "Set the distance of the dialog from the top of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
130
130
|
"value": {
|
|
131
131
|
"kind": "expression"
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
|
-
"name": ".
|
|
136
|
-
"description": "Set the
|
|
135
|
+
"name": ".width",
|
|
136
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
137
137
|
"value": {
|
|
138
138
|
"kind": "expression"
|
|
139
139
|
}
|
|
@@ -160,22 +160,22 @@
|
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
"name": "@
|
|
164
|
-
"description": "Fired when the
|
|
163
|
+
"name": "@opened-changed",
|
|
164
|
+
"description": "Fired when the `opened` property changes.",
|
|
165
165
|
"value": {
|
|
166
166
|
"kind": "expression"
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
|
-
"name": "@resize
|
|
171
|
-
"description": "Fired when the dialog resize is
|
|
170
|
+
"name": "@resize",
|
|
171
|
+
"description": "Fired when the dialog resize is finished.",
|
|
172
172
|
"value": {
|
|
173
173
|
"kind": "expression"
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
|
-
"name": "@
|
|
178
|
-
"description": "Fired when the
|
|
177
|
+
"name": "@resize-start",
|
|
178
|
+
"description": "Fired when the dialog resize is started.",
|
|
179
179
|
"value": {
|
|
180
180
|
"kind": "expression"
|
|
181
181
|
}
|