@vaadin/vaadin-confirm-dialog 21.0.1 → 22.0.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/package.json +23 -32
- package/src/vaadin-confirm-dialog.d.ts +11 -140
- package/src/vaadin-confirm-dialog.js +4 -408
- package/theme/lumo/vaadin-confirm-dialog.js +1 -4
- package/theme/material/vaadin-confirm-dialog.js +1 -4
- package/theme/lumo/vaadin-confirm-dialog-styles.js +0 -115
- package/theme/material/vaadin-confirm-dialog-styles.js +0 -89
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-confirm-dialog",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0-alpha10",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "vaadin-confirm-dialog",
|
|
8
|
+
"license": "https://raw.githubusercontent.com/vaadin/vaadin-confirm-dialog/master/LICENSE",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-confirm-dialog"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/components",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/vaadin-confirm-dialog/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "vaadin-confirm-dialog.js",
|
|
6
20
|
"module": "vaadin-confirm-dialog.js",
|
|
7
|
-
"
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"theme",
|
|
24
|
+
"vaadin-*.d.ts",
|
|
25
|
+
"vaadin-*.js"
|
|
26
|
+
],
|
|
8
27
|
"keywords": [
|
|
9
28
|
"Vaadin",
|
|
10
29
|
"vaadin-confirm-dialog",
|
|
@@ -12,36 +31,8 @@
|
|
|
12
31
|
"web-component",
|
|
13
32
|
"polymer"
|
|
14
33
|
],
|
|
15
|
-
"author": "Vaadin Ltd",
|
|
16
|
-
"license": "https://raw.githubusercontent.com/vaadin/vaadin-confirm-dialog/master/LICENSE",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vaadin/vaadin-confirm-dialog/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://vaadin.com/components",
|
|
21
|
-
"files": [
|
|
22
|
-
"vaadin-*.d.ts",
|
|
23
|
-
"vaadin-*.js",
|
|
24
|
-
"src",
|
|
25
|
-
"theme"
|
|
26
|
-
],
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@vaadin/vaadin-button": "^21.0.1",
|
|
30
|
-
"@vaadin/vaadin-dialog": "^21.0.1",
|
|
31
|
-
"@vaadin/vaadin-element-mixin": "^21.0.1",
|
|
32
|
-
"@vaadin/vaadin-license-checker": "^2.1.0",
|
|
33
|
-
"@vaadin/vaadin-lumo-styles": "^21.0.1",
|
|
34
|
-
"@vaadin/vaadin-material-styles": "^21.0.1",
|
|
35
|
-
"@vaadin/vaadin-overlay": "^21.0.1",
|
|
36
|
-
"@vaadin/vaadin-themable-mixin": "^21.0.1"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@esm-bundle/chai": "^4.1.5",
|
|
40
|
-
"@vaadin/testing-helpers": "^0.2.1",
|
|
41
|
-
"sinon": "^9.2.1"
|
|
42
|
-
},
|
|
43
|
-
"publishConfig": {
|
|
44
|
-
"access": "public"
|
|
35
|
+
"@vaadin/confirm-dialog": "22.0.0-alpha10"
|
|
45
36
|
},
|
|
46
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "6d3055383b9c3c8306ea34c6f2e2087e63c49348"
|
|
47
38
|
}
|
|
@@ -1,147 +1,18 @@
|
|
|
1
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
|
-
|
|
3
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2021 Vaadin Ltd
|
|
4
|
+
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface ConfirmDialogElementEventMap {
|
|
11
|
-
'opened-changed': ConfirmDialogOpenedChangedEvent;
|
|
12
|
-
|
|
13
|
-
confirm: Event;
|
|
14
|
-
|
|
15
|
-
cancel: Event;
|
|
16
|
-
|
|
17
|
-
reject: Event;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type ConfirmDialogEventMap = HTMLElementEventMap & ConfirmDialogElementEventMap;
|
|
6
|
+
import { ConfirmDialog } from '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
21
7
|
|
|
22
8
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* ```
|
|
26
|
-
* <vaadin-confirm-dialog cancel>
|
|
27
|
-
* There are unsaved changes. Do you really want to leave?
|
|
28
|
-
* </vaadin-confirm-dialog>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* ### Styling
|
|
32
|
-
*
|
|
33
|
-
* The following Shadow DOM parts are available for styling the dialog parts:
|
|
34
|
-
*
|
|
35
|
-
* Part name | Description
|
|
36
|
-
* -----------|---------------------------------------------------------|
|
|
37
|
-
* `header` | Header of the confirmation dialog
|
|
38
|
-
* `message` | Container for the message of the dialog
|
|
39
|
-
* `footer` | Container for the buttons
|
|
40
|
-
*
|
|
41
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
42
|
-
*
|
|
43
|
-
* ### Custom content
|
|
44
|
-
*
|
|
45
|
-
* The following parts are available for replacement:
|
|
46
|
-
*
|
|
47
|
-
* Slot name | Description
|
|
48
|
-
* ------------------|---------------------------------------------------------|
|
|
49
|
-
* `header` | Header of the confirmation dialog
|
|
50
|
-
* `message` | Container for the message of the dialog
|
|
51
|
-
* `cancel-button` | Container for the Cancel button
|
|
52
|
-
* `reject-button` | Container for the Reject button
|
|
53
|
-
* `confirm-button` | Container for the Confirm button
|
|
54
|
-
*
|
|
55
|
-
* @fires {Event} confirm - Fired when Confirm button was pressed.
|
|
56
|
-
* @fires {Event} cancel - Fired when Cancel button or Escape key was pressed.
|
|
57
|
-
* @fires {Event} reject - Fired when Reject button was pressed.
|
|
58
|
-
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
9
|
+
* @deprecated Import `ConfirmDialog` from `@vaadin/confirm-dialog` instead.
|
|
59
10
|
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* True if the overlay is currently displayed.
|
|
63
|
-
*/
|
|
64
|
-
opened: boolean;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Set the confirmation dialog title.
|
|
68
|
-
*/
|
|
69
|
-
header: string;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Set the message or confirmation question.
|
|
73
|
-
*/
|
|
74
|
-
message: string | null | undefined;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Text displayed on confirm-button.
|
|
78
|
-
* @attr {string} confirm-text
|
|
79
|
-
*/
|
|
80
|
-
confirmText: string;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Theme for a confirm-button.
|
|
84
|
-
* @attr {string} confirm-theme
|
|
85
|
-
*/
|
|
86
|
-
confirmTheme: string;
|
|
11
|
+
export type ConfirmDialogElement = ConfirmDialog;
|
|
87
12
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
noCloseOnEsc: boolean;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Whether to show cancel button or not.
|
|
96
|
-
*/
|
|
97
|
-
reject: boolean;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Text displayed on reject-button.
|
|
101
|
-
* @attr {string} reject-text
|
|
102
|
-
*/
|
|
103
|
-
rejectText: string;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Theme for a reject-button.
|
|
107
|
-
* @attr {string} reject-theme
|
|
108
|
-
*/
|
|
109
|
-
rejectTheme: string;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Whether to show cancel button or not.
|
|
113
|
-
*/
|
|
114
|
-
cancel: boolean;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Text displayed on cancel-button.
|
|
118
|
-
* @attr {string} cancel-text
|
|
119
|
-
*/
|
|
120
|
-
cancelText: string;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Theme for a cancel-button.
|
|
124
|
-
* @attr {string} cancel-theme
|
|
125
|
-
*/
|
|
126
|
-
cancelTheme: string;
|
|
127
|
-
|
|
128
|
-
addEventListener<K extends keyof ConfirmDialogEventMap>(
|
|
129
|
-
type: K,
|
|
130
|
-
listener: (this: ConfirmDialogElement, ev: ConfirmDialogEventMap[K]) => void,
|
|
131
|
-
options?: boolean | AddEventListenerOptions
|
|
132
|
-
): void;
|
|
133
|
-
|
|
134
|
-
removeEventListener<K extends keyof ConfirmDialogEventMap>(
|
|
135
|
-
type: K,
|
|
136
|
-
listener: (this: ConfirmDialogElement, ev: ConfirmDialogEventMap[K]) => void,
|
|
137
|
-
options?: boolean | EventListenerOptions
|
|
138
|
-
): void;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
declare global {
|
|
142
|
-
interface HTMLElementTagNameMap {
|
|
143
|
-
'vaadin-confirm-dialog': ConfirmDialogElement;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Import `ConfirmDialog` from `@vaadin/confirm-dialog` instead.
|
|
15
|
+
*/
|
|
16
|
+
export const ConfirmDialogElement: typeof ConfirmDialog;
|
|
146
17
|
|
|
147
|
-
export
|
|
18
|
+
export * from '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
@@ -3,415 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2021 Vaadin Ltd
|
|
4
4
|
* This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
9
|
-
import '@vaadin/vaadin-license-checker/vaadin-license-checker.js';
|
|
10
|
-
import '@vaadin/vaadin-button/src/vaadin-button.js';
|
|
11
|
-
import '@vaadin/vaadin-dialog/src/vaadin-dialog.js';
|
|
6
|
+
import { ConfirmDialog } from '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* ```
|
|
17
|
-
* <vaadin-confirm-dialog cancel>
|
|
18
|
-
* There are unsaved changes. Do you really want to leave?
|
|
19
|
-
* </vaadin-confirm-dialog>
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* ### Styling
|
|
23
|
-
*
|
|
24
|
-
* The following Shadow DOM parts are available for styling the dialog parts:
|
|
25
|
-
*
|
|
26
|
-
* Part name | Description
|
|
27
|
-
* -----------|---------------------------------------------------------|
|
|
28
|
-
* `header` | Header of the confirmation dialog
|
|
29
|
-
* `message` | Container for the message of the dialog
|
|
30
|
-
* `footer` | Container for the buttons
|
|
31
|
-
*
|
|
32
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
33
|
-
*
|
|
34
|
-
* ### Custom content
|
|
35
|
-
*
|
|
36
|
-
* The following parts are available for replacement:
|
|
37
|
-
*
|
|
38
|
-
* Slot name | Description
|
|
39
|
-
* ------------------|---------------------------------------------------------|
|
|
40
|
-
* `header` | Header of the confirmation dialog
|
|
41
|
-
* `message` | Container for the message of the dialog
|
|
42
|
-
* `cancel-button` | Container for the Cancel button
|
|
43
|
-
* `reject-button` | Container for the Reject button
|
|
44
|
-
* `confirm-button` | Container for the Confirm button
|
|
45
|
-
*
|
|
46
|
-
* @fires {Event} confirm - Fired when Confirm button was pressed.
|
|
47
|
-
* @fires {Event} cancel - Fired when Cancel button or Escape key was pressed.
|
|
48
|
-
* @fires {Event} reject - Fired when Reject button was pressed.
|
|
49
|
-
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
50
|
-
*
|
|
51
|
-
* @extends HTMLElement
|
|
52
|
-
* @mixes ElementMixin
|
|
53
|
-
* @mixes ThemableMixin
|
|
9
|
+
* @deprecated Import `ConfirmDialog` from `@vaadin/confirm-dialog` instead.
|
|
54
10
|
*/
|
|
55
|
-
|
|
56
|
-
static get template() {
|
|
57
|
-
return html`
|
|
58
|
-
<style>
|
|
59
|
-
:host {
|
|
60
|
-
display: none;
|
|
61
|
-
--_vaadin-confirm-dialog-content-width: auto;
|
|
62
|
-
--_vaadin-confirm-dialog-content-height: auto;
|
|
63
|
-
--_vaadin-confirm-dialog-footer-height: auto;
|
|
64
|
-
}
|
|
65
|
-
</style>
|
|
11
|
+
export const ConfirmDialogElement = ConfirmDialog;
|
|
66
12
|
|
|
67
|
-
|
|
68
|
-
id="dialog"
|
|
69
|
-
opened="{{opened}}"
|
|
70
|
-
aria-label="[[_getAriaLabel(header)]]"
|
|
71
|
-
theme$="_vaadin-confirm-dialog-dialog-overlay-theme [[theme]]"
|
|
72
|
-
no-close-on-outside-click
|
|
73
|
-
no-close-on-esc="[[noCloseOnEsc]]"
|
|
74
|
-
></vaadin-dialog>
|
|
75
|
-
|
|
76
|
-
<template id="dialogTemplate">
|
|
77
|
-
<div id="content">
|
|
78
|
-
<div part="header">
|
|
79
|
-
<slot name="header">
|
|
80
|
-
<h3 class="header">[[header]]</h3>
|
|
81
|
-
</slot>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div part="message" id="message">
|
|
85
|
-
<slot></slot>
|
|
86
|
-
[[message]]
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<div part="footer">
|
|
91
|
-
<div class="cancel-button">
|
|
92
|
-
<slot name="cancel-button">
|
|
93
|
-
<vaadin-button
|
|
94
|
-
id="cancel"
|
|
95
|
-
theme$="[[cancelTheme]]"
|
|
96
|
-
on-click="_cancel"
|
|
97
|
-
hidden$="[[!cancel]]"
|
|
98
|
-
aria-describedby="message"
|
|
99
|
-
>
|
|
100
|
-
[[cancelText]]
|
|
101
|
-
</vaadin-button>
|
|
102
|
-
</slot>
|
|
103
|
-
</div>
|
|
104
|
-
<div class="reject-button">
|
|
105
|
-
<slot name="reject-button">
|
|
106
|
-
<vaadin-button
|
|
107
|
-
id="reject"
|
|
108
|
-
theme$="[[rejectTheme]]"
|
|
109
|
-
on-click="_reject"
|
|
110
|
-
hidden$="[[!reject]]"
|
|
111
|
-
aria-describedby="message"
|
|
112
|
-
>
|
|
113
|
-
[[rejectText]]
|
|
114
|
-
</vaadin-button>
|
|
115
|
-
</slot>
|
|
116
|
-
</div>
|
|
117
|
-
<div class="confirm-button">
|
|
118
|
-
<slot name="confirm-button">
|
|
119
|
-
<vaadin-button id="confirm" theme$="[[confirmTheme]]" on-click="_confirm" aria-describedby="message">
|
|
120
|
-
[[confirmText]]
|
|
121
|
-
</vaadin-button>
|
|
122
|
-
</slot>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
</template>
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
static get is() {
|
|
130
|
-
return 'vaadin-confirm-dialog';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
static get version() {
|
|
134
|
-
return '21.0.1';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
static get properties() {
|
|
138
|
-
return {
|
|
139
|
-
/**
|
|
140
|
-
* True if the overlay is currently displayed.
|
|
141
|
-
* @type {boolean}
|
|
142
|
-
*/
|
|
143
|
-
opened: {
|
|
144
|
-
type: Boolean,
|
|
145
|
-
value: false,
|
|
146
|
-
notify: true,
|
|
147
|
-
observer: '_openedChanged'
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Set the confirmation dialog title.
|
|
152
|
-
* @type {string}
|
|
153
|
-
*/
|
|
154
|
-
header: {
|
|
155
|
-
type: String,
|
|
156
|
-
value: ''
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Set the message or confirmation question.
|
|
161
|
-
*/
|
|
162
|
-
message: {
|
|
163
|
-
type: String
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Text displayed on confirm-button.
|
|
168
|
-
* @attr {string} confirm-text
|
|
169
|
-
* @type {string}
|
|
170
|
-
*/
|
|
171
|
-
confirmText: {
|
|
172
|
-
type: String,
|
|
173
|
-
value: 'Confirm'
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Theme for a confirm-button.
|
|
178
|
-
* @attr {string} confirm-theme
|
|
179
|
-
* @type {string}
|
|
180
|
-
*/
|
|
181
|
-
confirmTheme: {
|
|
182
|
-
type: String,
|
|
183
|
-
value: 'primary'
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Set to true to disable closing dialog on Escape press
|
|
188
|
-
* @attr {boolean} no-close-on-esc
|
|
189
|
-
* @type {boolean}
|
|
190
|
-
*/
|
|
191
|
-
noCloseOnEsc: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
value: false
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Whether to show cancel button or not.
|
|
198
|
-
* @type {boolean}
|
|
199
|
-
*/
|
|
200
|
-
reject: {
|
|
201
|
-
type: Boolean,
|
|
202
|
-
reflectToAttribute: true,
|
|
203
|
-
value: false
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Text displayed on reject-button.
|
|
208
|
-
* @attr {string} reject-text
|
|
209
|
-
* @type {string}
|
|
210
|
-
*/
|
|
211
|
-
rejectText: {
|
|
212
|
-
type: String,
|
|
213
|
-
value: 'Reject'
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Theme for a reject-button.
|
|
218
|
-
* @attr {string} reject-theme
|
|
219
|
-
* @type {string}
|
|
220
|
-
*/
|
|
221
|
-
rejectTheme: {
|
|
222
|
-
type: String,
|
|
223
|
-
value: 'error tertiary'
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Whether to show cancel button or not.
|
|
228
|
-
* @type {boolean}
|
|
229
|
-
*/
|
|
230
|
-
cancel: {
|
|
231
|
-
type: Boolean,
|
|
232
|
-
reflectToAttribute: true,
|
|
233
|
-
value: false
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Text displayed on cancel-button.
|
|
238
|
-
* @attr {string} cancel-text
|
|
239
|
-
* @type {string}
|
|
240
|
-
*/
|
|
241
|
-
cancelText: {
|
|
242
|
-
type: String,
|
|
243
|
-
value: 'Cancel'
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Theme for a cancel-button.
|
|
248
|
-
* @attr {string} cancel-theme
|
|
249
|
-
* @type {string}
|
|
250
|
-
*/
|
|
251
|
-
cancelTheme: {
|
|
252
|
-
type: String,
|
|
253
|
-
value: 'tertiary'
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
/** @private */
|
|
257
|
-
_confirmButton: {
|
|
258
|
-
type: Element
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/** @protected */
|
|
264
|
-
static _finalizeClass() {
|
|
265
|
-
super._finalizeClass();
|
|
266
|
-
|
|
267
|
-
const devModeCallback = window.Vaadin.developmentModeCallback;
|
|
268
|
-
const licenseChecker = devModeCallback && devModeCallback['vaadin-license-checker'];
|
|
269
|
-
/* c8 ignore next 3 */
|
|
270
|
-
if (typeof licenseChecker === 'function') {
|
|
271
|
-
licenseChecker(ConfirmDialogElement);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/** @protected */
|
|
276
|
-
ready() {
|
|
277
|
-
super.ready();
|
|
278
|
-
|
|
279
|
-
this.$.dialog.$.overlay.addEventListener('vaadin-overlay-escape-press', this._escPressed.bind(this));
|
|
280
|
-
if (this._dimensions) {
|
|
281
|
-
Object.keys(this._dimensions).forEach((name) => {
|
|
282
|
-
this._setDimension(name, this._dimensions[name]);
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @param {string} name
|
|
289
|
-
* @param {?string} oldValue
|
|
290
|
-
* @param {?string} newValue
|
|
291
|
-
* @protected
|
|
292
|
-
*/
|
|
293
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
294
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
295
|
-
if (name === 'dir') {
|
|
296
|
-
const value = newValue === 'rtl';
|
|
297
|
-
this.__isRTL = value;
|
|
298
|
-
this.opened && this.__toggleContentRTL(value);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/** @private */
|
|
303
|
-
__toggleContentRTL(rtl) {
|
|
304
|
-
const contentBlock = this.$.dialog.$.overlay.content.querySelector('#content');
|
|
305
|
-
const footerBlock = this.$.dialog.$.overlay.content.querySelector('[part=footer]');
|
|
306
|
-
if (rtl) {
|
|
307
|
-
contentBlock.setAttribute('dir', 'rtl');
|
|
308
|
-
footerBlock.setAttribute('dir', 'rtl');
|
|
309
|
-
} else {
|
|
310
|
-
contentBlock.removeAttribute('dir');
|
|
311
|
-
footerBlock.removeAttribute('dir');
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/** @private */
|
|
316
|
-
_openedChanged() {
|
|
317
|
-
if (!this.opened) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// TODO: A temporary hack as far as `vaadin-dialog` doesn't support the Polymer Template API anymore.
|
|
322
|
-
this.$.dialog.$.overlay.template = this.$.dialogTemplate;
|
|
323
|
-
|
|
324
|
-
const overlay = this.$.dialog.$.overlay;
|
|
325
|
-
|
|
326
|
-
Array.from(this.childNodes).forEach((c) => {
|
|
327
|
-
const newChild = overlay.$.content.appendChild(c);
|
|
328
|
-
if (newChild.getAttribute && newChild.getAttribute('slot') == 'confirm-button' && newChild.focus) {
|
|
329
|
-
this._confirmButton = newChild;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
this.__toggleContentRTL(this.__isRTL);
|
|
334
|
-
|
|
335
|
-
requestAnimationFrame(() => {
|
|
336
|
-
const confirmButton = this._confirmButton || overlay.content.querySelector('#confirm');
|
|
337
|
-
confirmButton.focus();
|
|
338
|
-
|
|
339
|
-
const { height } = getComputedStyle(overlay.content.querySelector('[part=footer]'));
|
|
340
|
-
this.$.dialog.$.overlay.style.setProperty('--_vaadin-confirm-dialog-footer-height', height);
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/** @private */
|
|
345
|
-
_escPressed(event) {
|
|
346
|
-
if (!event.defaultPrevented) {
|
|
347
|
-
this._cancel();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/** @private */
|
|
352
|
-
_confirm() {
|
|
353
|
-
this.dispatchEvent(new CustomEvent('confirm'));
|
|
354
|
-
this.opened = false;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/** @private */
|
|
358
|
-
_cancel() {
|
|
359
|
-
this.dispatchEvent(new CustomEvent('cancel'));
|
|
360
|
-
this.opened = false;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/** @private */
|
|
364
|
-
_reject() {
|
|
365
|
-
this.dispatchEvent(new CustomEvent('reject'));
|
|
366
|
-
this.opened = false;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/** @private */
|
|
370
|
-
_getAriaLabel(header) {
|
|
371
|
-
return header || 'confirmation';
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/** @private */
|
|
375
|
-
_setWidth(width) {
|
|
376
|
-
this._setDimensionIfAttached('width', width);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/** @private */
|
|
380
|
-
_setHeight(height) {
|
|
381
|
-
this._setDimensionIfAttached('height', height);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/** @private */
|
|
385
|
-
_setDimensionIfAttached(name, value) {
|
|
386
|
-
if (this.$ && this.$.dialog) {
|
|
387
|
-
this._setDimension(name, value);
|
|
388
|
-
} else {
|
|
389
|
-
this._dimensions = this._dimensions || {};
|
|
390
|
-
this._dimensions[name] = value;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/** @private */
|
|
395
|
-
_setDimension(name, value) {
|
|
396
|
-
this.$.dialog.$.overlay.style.setProperty(`--_vaadin-confirm-dialog-content-${name}`, value);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* @event confirm
|
|
401
|
-
* fired when Confirm button was pressed.
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* @event cancel
|
|
406
|
-
* fired when Cancel button or Escape key was pressed.
|
|
407
|
-
*/
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* @event reject
|
|
411
|
-
* fired when Reject button was pressed.
|
|
412
|
-
*/
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
customElements.define(ConfirmDialogElement.is, ConfirmDialogElement);
|
|
416
|
-
|
|
417
|
-
export { ConfirmDialogElement };
|
|
13
|
+
export * from '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/vaadin-button/theme/lumo/vaadin-button.js';
|
|
3
|
-
import './vaadin-confirm-dialog-styles.js';
|
|
4
|
-
import '../../src/vaadin-confirm-dialog.js';
|
|
1
|
+
import '@vaadin/confirm-dialog/theme/lumo/vaadin-confirm-dialog.js';
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/vaadin-button/theme/material/vaadin-button.js';
|
|
3
|
-
import './vaadin-confirm-dialog-styles.js';
|
|
4
|
-
import '../../src/vaadin-confirm-dialog.js';
|
|
1
|
+
import '@vaadin/confirm-dialog/theme/material/vaadin-confirm-dialog.js';
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
4
|
-
|
|
5
|
-
registerStyles(
|
|
6
|
-
'vaadin-dialog-overlay',
|
|
7
|
-
css`
|
|
8
|
-
:host([theme~='_vaadin-confirm-dialog-dialog-overlay-theme']) [part='content'] {
|
|
9
|
-
height: auto;
|
|
10
|
-
box-sizing: content-box;
|
|
11
|
-
}
|
|
12
|
-
`,
|
|
13
|
-
{ moduleId: 'lumo-confirm-dialog-overlay' }
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
registerStyles(
|
|
17
|
-
'vaadin-confirm-dialog',
|
|
18
|
-
css`
|
|
19
|
-
#content {
|
|
20
|
-
height: calc(
|
|
21
|
-
var(--_vaadin-confirm-dialog-content-height) - var(--_vaadin-confirm-dialog-footer-height) - var(--lumo-space-s)
|
|
22
|
-
);
|
|
23
|
-
width: var(--_vaadin-confirm-dialog-content-width);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[part='header'],
|
|
27
|
-
.header {
|
|
28
|
-
margin-top: var(--lumo-space-s);
|
|
29
|
-
margin-bottom: var(--lumo-space-m);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part='message'] {
|
|
33
|
-
width: 25em;
|
|
34
|
-
min-width: 100%;
|
|
35
|
-
max-width: 100%;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[part='footer'] {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-wrap: wrap;
|
|
41
|
-
justify-content: flex-end;
|
|
42
|
-
margin: calc(var(--lumo-space-l) * -1);
|
|
43
|
-
margin-top: var(--lumo-space-l);
|
|
44
|
-
padding: 0 var(--lumo-space-l);
|
|
45
|
-
background-color: var(--lumo-contrast-5pct);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[part='footer'] div {
|
|
49
|
-
margin-top: var(--lumo-space-s);
|
|
50
|
-
margin-bottom: var(--lumo-space-s);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
vaadin-button[theme~='tertiary'] {
|
|
54
|
-
padding-left: var(--lumo-space-s);
|
|
55
|
-
padding-right: var(--lumo-space-s);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.cancel-button {
|
|
59
|
-
flex-grow: 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
:not([dir='rtl']) > .cancel-button {
|
|
63
|
-
margin-left: calc(var(--lumo-space-s) * -1);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:not([dir='rtl']) > .confirm-button {
|
|
67
|
-
margin-right: calc(var(--lumo-space-s) * -1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:not([dir='rtl']) > .reject-button,
|
|
71
|
-
:not([dir='rtl']) > .confirm-button {
|
|
72
|
-
margin-left: var(--lumo-space-s);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@media (max-width: 360px) {
|
|
76
|
-
[part='footer'] {
|
|
77
|
-
flex-direction: column-reverse;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
[part='footer'] div {
|
|
81
|
-
margin: var(--lumo-space-xs) calc(var(--lumo-space-l) / -2) calc(var(--lumo-space-xs) * -1);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
[part='footer'] vaadin-button,
|
|
85
|
-
[part='footer'] ::slotted(*) {
|
|
86
|
-
width: 100%;
|
|
87
|
-
margin-top: var(--lumo-space-xs);
|
|
88
|
-
margin-bottom: var(--lumo-space-xs);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
[part='footer'] .confirm-button {
|
|
92
|
-
margin-top: var(--lumo-space-s);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
[part='footer'] .cancel-button {
|
|
96
|
-
margin-bottom: var(--lumo-space-s);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* RTL specific styles */
|
|
101
|
-
[dir='rtl'] > .cancel-button {
|
|
102
|
-
margin-right: calc(var(--lumo-space-s) * -1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[dir='rtl'] > .confirm-button {
|
|
106
|
-
margin-left: calc(var(--lumo-space-s) * -1);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[dir='rtl'] > .reject-button,
|
|
110
|
-
[dir='rtl'] > .confirm-button {
|
|
111
|
-
margin-right: var(--lumo-space-s);
|
|
112
|
-
}
|
|
113
|
-
`,
|
|
114
|
-
{ moduleId: 'lumo-confirm-dialog' }
|
|
115
|
-
);
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
|
-
|
|
3
|
-
registerStyles(
|
|
4
|
-
'vaadin-dialog-overlay',
|
|
5
|
-
css`
|
|
6
|
-
:host([theme~='_vaadin-confirm-dialog-dialog-overlay-theme']) [part='overlay'] {
|
|
7
|
-
max-width: 100%;
|
|
8
|
-
min-width: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
:host([theme~='_vaadin-confirm-dialog-dialog-overlay-theme']) [part='content'] {
|
|
12
|
-
padding: 8px 24px;
|
|
13
|
-
min-width: 0;
|
|
14
|
-
height: auto;
|
|
15
|
-
box-sizing: content-box;
|
|
16
|
-
}
|
|
17
|
-
`,
|
|
18
|
-
{ moduleId: 'material-confirm-dialog-overlay' }
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
registerStyles(
|
|
22
|
-
'vaadin-confirm-dialog',
|
|
23
|
-
css`
|
|
24
|
-
#content {
|
|
25
|
-
height: calc(var(--_vaadin-confirm-dialog-content-height) - var(--_vaadin-confirm-dialog-footer-height) - 39px);
|
|
26
|
-
width: var(--_vaadin-confirm-dialog-content-width);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
[part='message'] {
|
|
30
|
-
width: 25em;
|
|
31
|
-
max-width: 100%;
|
|
32
|
-
margin-right: 24px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[part='footer'] {
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-wrap: wrap;
|
|
38
|
-
justify-content: flex-end;
|
|
39
|
-
margin-top: 28px;
|
|
40
|
-
margin-right: -16px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part='footer']:not([dir='rtl']) div:nth-child(-n + 2) vaadin-button,
|
|
44
|
-
[part='footer']:not([dir='rtl']) div:nth-child(-n + 2) ::slotted(*) {
|
|
45
|
-
margin-right: 8px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@media (max-width: 360px) {
|
|
49
|
-
[part='footer'] {
|
|
50
|
-
flex-direction: column-reverse;
|
|
51
|
-
align-items: flex-end;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[part='footer'] div:nth-child(-n + 2) vaadin-button,
|
|
55
|
-
[part='footer'] div:nth-child(-n + 2) ::slotted(*) {
|
|
56
|
-
margin-top: 8px;
|
|
57
|
-
margin-right: 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
[part='footer'] div:nth-last-child(1) vaadin-button,
|
|
61
|
-
[part='footer'] div:nth-last-child(1) ::slotted(*) {
|
|
62
|
-
margin-top: 8px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* RTL specific styles */
|
|
66
|
-
[part='footer'][dir='rtl'] div:nth-child(-n + 2) vaadin-button,
|
|
67
|
-
[part='footer'][dir='rtl'] div:nth-child(-n + 2) ::slotted(*) {
|
|
68
|
-
margin-left: 0;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/* RTL specific styles */
|
|
73
|
-
[dir='rtl'] > [part='message'] {
|
|
74
|
-
margin-left: 24px;
|
|
75
|
-
margin-right: 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
[part='footer'][dir='rtl'] {
|
|
79
|
-
margin-left: -16px;
|
|
80
|
-
margin-right: 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
[part='footer'][dir='rtl'] div:nth-child(-n + 2) vaadin-button,
|
|
84
|
-
[part='footer'][dir='rtl'] div:nth-child(-n + 2) ::slotted(*) {
|
|
85
|
-
margin-left: 8px;
|
|
86
|
-
}
|
|
87
|
-
`,
|
|
88
|
-
{ moduleId: 'material-confirm-dialog' }
|
|
89
|
-
);
|