tyrell-components 1.0.0-TC48 → 1.0.0-TC49
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/dist/tyrell.js +1 -1
- package/lib/components/modal.d.ts +4 -0
- package/lib/components/modal.js +27 -7
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -56,6 +56,10 @@ export declare class TyModal extends HTMLElement {
|
|
|
56
56
|
set closeOnOutsideClick(v: boolean);
|
|
57
57
|
get closeOnEscape(): boolean;
|
|
58
58
|
set closeOnEscape(v: boolean);
|
|
59
|
+
get preventOutsideClick(): boolean;
|
|
60
|
+
set preventOutsideClick(v: boolean);
|
|
61
|
+
get preventEscape(): boolean;
|
|
62
|
+
set preventEscape(v: boolean);
|
|
59
63
|
constructor();
|
|
60
64
|
connectedCallback(): void;
|
|
61
65
|
disconnectedCallback(): void;
|
package/lib/components/modal.js
CHANGED
|
@@ -23,12 +23,16 @@ function getModalAttributes(el) {
|
|
|
23
23
|
return {
|
|
24
24
|
open: parseBoolAttr(el, 'open'),
|
|
25
25
|
backdrop: el.hasAttribute('backdrop') ? parseBoolAttr(el, 'backdrop') : true,
|
|
26
|
-
closeOnOutsideClick: el
|
|
27
|
-
?
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
closeOnOutsideClick: parseBoolAttr(el, 'prevent-outside-click')
|
|
27
|
+
? false
|
|
28
|
+
: el.hasAttribute('close-on-outside-click')
|
|
29
|
+
? parseBoolAttr(el, 'close-on-outside-click')
|
|
30
|
+
: true,
|
|
31
|
+
closeOnEscape: parseBoolAttr(el, 'prevent-escape')
|
|
32
|
+
? false
|
|
33
|
+
: el.hasAttribute('close-on-escape')
|
|
34
|
+
? parseBoolAttr(el, 'close-on-escape')
|
|
35
|
+
: true,
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
38
|
function getModalDialog(shadowRoot) {
|
|
@@ -156,6 +160,14 @@ function setupEscapeKey(el, dialog, enabled) {
|
|
|
156
160
|
escapeKeyHandlers.set(el, handler);
|
|
157
161
|
dialog.addEventListener('keydown', handler);
|
|
158
162
|
}
|
|
163
|
+
else {
|
|
164
|
+
const handler = (e) => {
|
|
165
|
+
if (e.key === 'Escape')
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
};
|
|
168
|
+
escapeKeyHandlers.set(el, handler);
|
|
169
|
+
dialog.addEventListener('keydown', handler);
|
|
170
|
+
}
|
|
159
171
|
}
|
|
160
172
|
function setupCloseButton(el, dialog, showButton) {
|
|
161
173
|
const closeButton = dialog.querySelector('.close-button');
|
|
@@ -321,7 +333,7 @@ function cleanup(el) {
|
|
|
321
333
|
}
|
|
322
334
|
export class TyModal extends HTMLElement {
|
|
323
335
|
static get observedAttributes() {
|
|
324
|
-
return ['open', 'backdrop', 'close-on-outside-click', 'close-on-escape', 'label'];
|
|
336
|
+
return ['open', 'backdrop', 'close-on-outside-click', 'close-on-escape', 'prevent-outside-click', 'prevent-escape', 'label'];
|
|
325
337
|
}
|
|
326
338
|
get open() { return parseBoolAttr(this, 'open'); }
|
|
327
339
|
set open(v) { v ? this.setAttribute('open', 'true') : this.removeAttribute('open'); }
|
|
@@ -331,6 +343,14 @@ export class TyModal extends HTMLElement {
|
|
|
331
343
|
set closeOnOutsideClick(v) { this.setAttribute('close-on-outside-click', String(!!v)); }
|
|
332
344
|
get closeOnEscape() { return getModalAttributes(this).closeOnEscape; }
|
|
333
345
|
set closeOnEscape(v) { this.setAttribute('close-on-escape', String(!!v)); }
|
|
346
|
+
get preventOutsideClick() { return parseBoolAttr(this, 'prevent-outside-click'); }
|
|
347
|
+
set preventOutsideClick(v) {
|
|
348
|
+
v ? this.setAttribute('prevent-outside-click', '') : this.removeAttribute('prevent-outside-click');
|
|
349
|
+
}
|
|
350
|
+
get preventEscape() { return parseBoolAttr(this, 'prevent-escape'); }
|
|
351
|
+
set preventEscape(v) {
|
|
352
|
+
v ? this.setAttribute('prevent-escape', '') : this.removeAttribute('prevent-escape');
|
|
353
|
+
}
|
|
334
354
|
constructor() {
|
|
335
355
|
super();
|
|
336
356
|
this.attachShadow({ mode: 'open' });
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.0.0-
|
|
1
|
+
export const VERSION = '1.0.0-TC49';
|