@sankhyalabs/ezui 1.1.8 → 1.1.9
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/README.md +72 -72
- package/dist/cjs/{DataUnit-28b290cb.js → DataUnit-9a4a35ca.js} +415 -371
- package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
- package/dist/cjs/ez-button_14.cjs.entry.js +1911 -1911
- package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
- package/dist/cjs/ez-modal.cjs.entry.js +104 -104
- package/dist/cjs/ez-number-input.cjs.entry.js +236 -236
- package/dist/cjs/ez-time-input.cjs.entry.js +168 -168
- package/dist/cjs/form-metadata.cjs.entry.js +65 -65
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -82
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -109
- package/dist/collection/components/ez-button/ez-button.css +94 -94
- package/dist/collection/components/ez-button/ez-button.js +125 -125
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -210
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -215
- package/dist/collection/components/ez-check/ez-check.css +265 -265
- package/dist/collection/components/ez-check/ez-check.js +168 -168
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +67 -67
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -108
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -167
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -363
- package/dist/collection/components/ez-date-input/ez-date-input.css +38 -38
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -172
- package/dist/collection/components/ez-form/ez-form.css +19 -19
- package/dist/collection/components/ez-form/ez-form.js +368 -368
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +251 -207
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -16
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +23 -23
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -173
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -71
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -40
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -27
- package/dist/collection/components/ez-icon/ez-icon.css +36 -36
- package/dist/collection/components/ez-icon/ez-icon.js +56 -56
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -117
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -276
- package/dist/collection/components/ez-modal/ez-modal.css +86 -86
- package/dist/collection/components/ez-modal/ez-modal.js +224 -224
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -144
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -465
- package/dist/collection/components/ez-popover/ez-popover.css +38 -38
- package/dist/collection/components/ez-popover/ez-popover.js +323 -323
- package/dist/collection/components/ez-search/ez-search.css +295 -295
- package/dist/collection/components/ez-search/ez-search.js +527 -527
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +125 -125
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +283 -283
- package/dist/collection/components/ez-text-area/ez-text-area.css +139 -139
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -267
- package/dist/collection/components/ez-text-input/ez-text-input.css +169 -169
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -395
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -155
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -326
- package/dist/collection/index.js +1 -1
- package/dist/collection/servidor.js +100 -100
- package/dist/collection/utils/FloatingManager.js +15 -15
- package/dist/collection/utils/utils.js +6 -6
- package/dist/custom-elements/index.js +3125 -3081
- package/dist/esm/{DataUnit-69e518fa.js → DataUnit-d5d4c9a3.js} +415 -371
- package/dist/esm/ez-action-chip.entry.js +41 -41
- package/dist/esm/ez-button_14.entry.js +1911 -1911
- package/dist/esm/ez-label-chip.entry.js +120 -120
- package/dist/esm/ez-modal.entry.js +104 -104
- package/dist/esm/ez-number-input.entry.js +236 -236
- package/dist/esm/ez-time-input.entry.js +168 -168
- package/dist/esm/form-metadata.entry.js +65 -65
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-b0974f4f.entry.js → p-0fcdfb51.entry.js} +1 -1
- package/dist/ezui/p-dac7a6c2.js +1 -0
- package/dist/ezui/{p-db11c600.entry.js → p-dbef7060.entry.js} +1 -1
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +26 -31
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +60 -55
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -17
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -32
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/package.json +114 -114
- package/dist/ezui/p-10ef58b3.js +0 -1
- package/react/components.d.ts +0 -22
- package/react/components.js +0 -25
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -59
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -20
- package/react/react-component-lib/createOverlayComponent.js +0 -89
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -96
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -7
- package/react/react-component-lib/utils/index.js +0 -21
- package/react/react-component-lib/utils/index.js.map +0 -1
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
--modal-z-index: var(--most-visible, 3);
|
|
3
|
-
--modal-vertical-padding: var(--space--extra-large, 48px);
|
|
4
|
-
display: block;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.modal {
|
|
8
|
-
position: fixed;
|
|
9
|
-
padding: var(--modal-vertical-padding) 0;
|
|
10
|
-
display: flex;
|
|
11
|
-
top: 0px;
|
|
12
|
-
z-index: var(--modal-z-index);
|
|
13
|
-
left: 0px;
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100vh;
|
|
16
|
-
backdrop-filter: blur(4px);
|
|
17
|
-
background: rgb(0 4 12 / 40%);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@keyframes expand-modal--left {
|
|
21
|
-
from {
|
|
22
|
-
transform: translate(-100%)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@keyframes expand-modal--right {
|
|
27
|
-
from {
|
|
28
|
-
transform: translate(100%)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.modal__container {
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-wrap: wrap;
|
|
35
|
-
width: 100%;
|
|
36
|
-
align-items: flex-start;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.modal__container--right {
|
|
40
|
-
animation: expand-modal--right .2s ease-in-out 1;
|
|
41
|
-
justify-content: flex-end;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.modal__container--left {
|
|
45
|
-
animation: expand-modal--left .2s ease-in-out 1;
|
|
46
|
-
justify-content: flex-start;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.modal__content {
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-wrap: wrap;
|
|
52
|
-
/* position: fixed; */
|
|
53
|
-
max-height: 89.6vh;
|
|
54
|
-
overflow-y: auto;
|
|
55
|
-
background-color: #fff;
|
|
56
|
-
padding: 24px;
|
|
57
|
-
border-radius: 12px 0px 0px 12px;
|
|
58
|
-
box-shadow: 0px 0px 16px 0px rgba(0, 38, 111, 0.12);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.modal__content--right {
|
|
62
|
-
border-radius: 12px 0px 0px 12px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.modal__content--left {
|
|
66
|
-
border-radius: 0px 12px 12px 0px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.modal__box__container {
|
|
70
|
-
display: flex;
|
|
71
|
-
flex-wrap: wrap;
|
|
72
|
-
background-color: #fff;
|
|
73
|
-
width: 100%;
|
|
74
|
-
border-radius: 12px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.small {
|
|
78
|
-
width: 30%;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.medium {
|
|
82
|
-
width: 50%;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.large {
|
|
86
|
-
width: 70%;
|
|
1
|
+
:host {
|
|
2
|
+
--modal-z-index: var(--most-visible, 3);
|
|
3
|
+
--modal-vertical-padding: var(--space--extra-large, 48px);
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.modal {
|
|
8
|
+
position: fixed;
|
|
9
|
+
padding: var(--modal-vertical-padding) 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
top: 0px;
|
|
12
|
+
z-index: var(--modal-z-index);
|
|
13
|
+
left: 0px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100vh;
|
|
16
|
+
backdrop-filter: blur(4px);
|
|
17
|
+
background: rgb(0 4 12 / 40%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes expand-modal--left {
|
|
21
|
+
from {
|
|
22
|
+
transform: translate(-100%)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@keyframes expand-modal--right {
|
|
27
|
+
from {
|
|
28
|
+
transform: translate(100%)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.modal__container {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
width: 100%;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.modal__container--right {
|
|
40
|
+
animation: expand-modal--right .2s ease-in-out 1;
|
|
41
|
+
justify-content: flex-end;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.modal__container--left {
|
|
45
|
+
animation: expand-modal--left .2s ease-in-out 1;
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.modal__content {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
/* position: fixed; */
|
|
53
|
+
max-height: 89.6vh;
|
|
54
|
+
overflow-y: auto;
|
|
55
|
+
background-color: #fff;
|
|
56
|
+
padding: 24px;
|
|
57
|
+
border-radius: 12px 0px 0px 12px;
|
|
58
|
+
box-shadow: 0px 0px 16px 0px rgba(0, 38, 111, 0.12);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.modal__content--right {
|
|
62
|
+
border-radius: 12px 0px 0px 12px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.modal__content--left {
|
|
66
|
+
border-radius: 0px 12px 12px 0px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.modal__box__container {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
background-color: #fff;
|
|
73
|
+
width: 100%;
|
|
74
|
+
border-radius: 12px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.small {
|
|
78
|
+
width: 30%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.medium {
|
|
82
|
+
width: 50%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.large {
|
|
86
|
+
width: 70%;
|
|
87
87
|
}
|
|
@@ -1,224 +1,224 @@
|
|
|
1
|
-
import { Component, Host, h, Prop, Watch, Event } from '@stencil/core';
|
|
2
|
-
export class EzModal {
|
|
3
|
-
constructor() {
|
|
4
|
-
/**
|
|
5
|
-
* Controle de exibição do Modal
|
|
6
|
-
*/
|
|
7
|
-
this.oppened = true;
|
|
8
|
-
/**
|
|
9
|
-
* Define se o modal será fechado ao digitar ESC
|
|
10
|
-
*/
|
|
11
|
-
this.closeesc = false;
|
|
12
|
-
/**
|
|
13
|
-
* Define se o modal será fechado ao clicar fora do conteúdo.
|
|
14
|
-
*/
|
|
15
|
-
this.closeoutsideclick = false;
|
|
16
|
-
this.handleKeyboardEvent = (ev) => {
|
|
17
|
-
console.log(ev === null || ev === void 0 ? void 0 : ev.key);
|
|
18
|
-
if ((ev === null || ev === void 0 ? void 0 : ev.key) === 'Escape' && this.closeesc) {
|
|
19
|
-
this.oppened = false;
|
|
20
|
-
debugger;
|
|
21
|
-
this.ezChange.emit(this.oppened);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
handleClickOverlay(ev) {
|
|
26
|
-
ev === null || ev === void 0 ? void 0 : ev.stopPropagation();
|
|
27
|
-
if (ev instanceof PointerEvent && this.closeoutsideclick) {
|
|
28
|
-
this.oppened = false;
|
|
29
|
-
debugger;
|
|
30
|
-
this.ezChange.emit(this.oppened);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
handleOppenedChange() {
|
|
34
|
-
if (this.oppened) {
|
|
35
|
-
document.addEventListener('keydown', this.handleKeyboardEvent);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
document.removeEventListener('keydown', this.handleKeyboardEvent);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
///////
|
|
42
|
-
// trapTabKey(e) {
|
|
43
|
-
// // Check for TAB key press
|
|
44
|
-
// if (e.keyCode === 9) {
|
|
45
|
-
// // SHIFT + TAB
|
|
46
|
-
// if (e.shiftKey) {
|
|
47
|
-
// if (document.activeElement === this._firstTabStop) {
|
|
48
|
-
// e.preventDefault();
|
|
49
|
-
// this._lastTabStop.focus();
|
|
50
|
-
// }
|
|
51
|
-
// // TAB
|
|
52
|
-
// } else {
|
|
53
|
-
// if (document.activeElement === this._lastTabStop) {
|
|
54
|
-
// e.preventDefault();
|
|
55
|
-
// this._firstTabStop.focus();
|
|
56
|
-
// }
|
|
57
|
-
// }
|
|
58
|
-
// }
|
|
59
|
-
// if (e.keyCode === 27) {
|
|
60
|
-
// this.closeModal();
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// closeModal() {
|
|
64
|
-
// this.oppened = false;
|
|
65
|
-
// this._focusedElementBeforeModal.focus();
|
|
66
|
-
// }
|
|
67
|
-
// componentDidLoad() {
|
|
68
|
-
// this._overlay.addEventListener('keydown', (ev) => { this.trapTabKey(ev) });
|
|
69
|
-
// // Save current focus
|
|
70
|
-
// this._focusedElementBeforeModal = document.activeElement;
|
|
71
|
-
// // Find all focusable children
|
|
72
|
-
// var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
|
|
73
|
-
// var focusableElements = this._modalContainer.querySelectorAll(focusableElementsString);
|
|
74
|
-
// // Convert NodeList to Array
|
|
75
|
-
// focusableElements = Array.prototype.slice.call(focusableElements);
|
|
76
|
-
// this._firstTabStop = focusableElements[0];
|
|
77
|
-
// this._lastTabStop = focusableElements[focusableElements.length - 1];
|
|
78
|
-
// // Focus first child
|
|
79
|
-
// this._firstTabStop.focus();
|
|
80
|
-
// }
|
|
81
|
-
// componentDidUpdate() {
|
|
82
|
-
// var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
|
|
83
|
-
// var focusableElements = this._modalContainer.querySelectorAll(focusableElementsString);
|
|
84
|
-
// }
|
|
85
|
-
/////
|
|
86
|
-
componentDidLoad() {
|
|
87
|
-
this.handleOppenedChange();
|
|
88
|
-
}
|
|
89
|
-
//Ainda teremos ajustes visuais
|
|
90
|
-
render() {
|
|
91
|
-
return (h(Host, null, this.oppened ?
|
|
92
|
-
h("div", { class: 'modal' /* ref={el => this._overlay = el} */, onClick: (ev) => this.handleClickOverlay(ev) },
|
|
93
|
-
this.align === 'left'
|
|
94
|
-
?
|
|
95
|
-
h("div", { onClick: (ev) => this.handleClickOverlay(ev), class: "modal__container modal__container--left" },
|
|
96
|
-
h("div", { onClick: (ev) => ev.stopPropagation(), class: "modal__content modal__content--left " + this.modalsize },
|
|
97
|
-
h("slot", null)))
|
|
98
|
-
: undefined,
|
|
99
|
-
this.align === 'right' ?
|
|
100
|
-
h("div", { onClick: (ev) => this.handleClickOverlay(ev), class: "modal__container modal__container--right" },
|
|
101
|
-
h("div", { onClick: (ev) => ev.stopPropagation(), class: "modal__content modal__content--right " + this.modalsize },
|
|
102
|
-
h("slot", null)))
|
|
103
|
-
: undefined)
|
|
104
|
-
: undefined));
|
|
105
|
-
}
|
|
106
|
-
static get is() { return "ez-modal"; }
|
|
107
|
-
static get encapsulation() { return "shadow"; }
|
|
108
|
-
static get originalStyleUrls() { return {
|
|
109
|
-
"$": ["ez-modal.css"]
|
|
110
|
-
}; }
|
|
111
|
-
static get styleUrls() { return {
|
|
112
|
-
"$": ["ez-modal.css"]
|
|
113
|
-
}; }
|
|
114
|
-
static get properties() { return {
|
|
115
|
-
"modalsize": {
|
|
116
|
-
"type": "string",
|
|
117
|
-
"mutable": true,
|
|
118
|
-
"complexType": {
|
|
119
|
-
"original": "string",
|
|
120
|
-
"resolved": "string",
|
|
121
|
-
"references": {}
|
|
122
|
-
},
|
|
123
|
-
"required": false,
|
|
124
|
-
"optional": false,
|
|
125
|
-
"docs": {
|
|
126
|
-
"tags": [],
|
|
127
|
-
"text": "Define o tamanho do modal devem ser utilizados os tamanhos definidos de colunas como \"col-sd-3\""
|
|
128
|
-
},
|
|
129
|
-
"attribute": "modalsize",
|
|
130
|
-
"reflect": true
|
|
131
|
-
},
|
|
132
|
-
"align": {
|
|
133
|
-
"type": "string",
|
|
134
|
-
"mutable": true,
|
|
135
|
-
"complexType": {
|
|
136
|
-
"original": "string",
|
|
137
|
-
"resolved": "string",
|
|
138
|
-
"references": {}
|
|
139
|
-
},
|
|
140
|
-
"required": false,
|
|
141
|
-
"optional": false,
|
|
142
|
-
"docs": {
|
|
143
|
-
"tags": [],
|
|
144
|
-
"text": "Define o alinhamento do modal, seus valores podem ser 'right' ou 'left'"
|
|
145
|
-
},
|
|
146
|
-
"attribute": "align",
|
|
147
|
-
"reflect": true
|
|
148
|
-
},
|
|
149
|
-
"oppened": {
|
|
150
|
-
"type": "boolean",
|
|
151
|
-
"mutable": true,
|
|
152
|
-
"complexType": {
|
|
153
|
-
"original": "boolean",
|
|
154
|
-
"resolved": "boolean",
|
|
155
|
-
"references": {}
|
|
156
|
-
},
|
|
157
|
-
"required": false,
|
|
158
|
-
"optional": false,
|
|
159
|
-
"docs": {
|
|
160
|
-
"tags": [],
|
|
161
|
-
"text": "Controle de exibi\u00E7\u00E3o do Modal"
|
|
162
|
-
},
|
|
163
|
-
"attribute": "oppened",
|
|
164
|
-
"reflect": true,
|
|
165
|
-
"defaultValue": "true"
|
|
166
|
-
},
|
|
167
|
-
"closeesc": {
|
|
168
|
-
"type": "boolean",
|
|
169
|
-
"mutable": true,
|
|
170
|
-
"complexType": {
|
|
171
|
-
"original": "boolean",
|
|
172
|
-
"resolved": "boolean",
|
|
173
|
-
"references": {}
|
|
174
|
-
},
|
|
175
|
-
"required": false,
|
|
176
|
-
"optional": false,
|
|
177
|
-
"docs": {
|
|
178
|
-
"tags": [],
|
|
179
|
-
"text": "Define se o modal ser\u00E1 fechado ao digitar ESC"
|
|
180
|
-
},
|
|
181
|
-
"attribute": "closeesc",
|
|
182
|
-
"reflect": true,
|
|
183
|
-
"defaultValue": "false"
|
|
184
|
-
},
|
|
185
|
-
"closeoutsideclick": {
|
|
186
|
-
"type": "boolean",
|
|
187
|
-
"mutable": true,
|
|
188
|
-
"complexType": {
|
|
189
|
-
"original": "boolean",
|
|
190
|
-
"resolved": "boolean",
|
|
191
|
-
"references": {}
|
|
192
|
-
},
|
|
193
|
-
"required": false,
|
|
194
|
-
"optional": false,
|
|
195
|
-
"docs": {
|
|
196
|
-
"tags": [],
|
|
197
|
-
"text": "Define se o modal ser\u00E1 fechado ao clicar fora do conte\u00FAdo."
|
|
198
|
-
},
|
|
199
|
-
"attribute": "closeoutsideclick",
|
|
200
|
-
"reflect": true,
|
|
201
|
-
"defaultValue": "false"
|
|
202
|
-
}
|
|
203
|
-
}; }
|
|
204
|
-
static get events() { return [{
|
|
205
|
-
"method": "ezChange",
|
|
206
|
-
"name": "ezChange",
|
|
207
|
-
"bubbles": true,
|
|
208
|
-
"cancelable": true,
|
|
209
|
-
"composed": true,
|
|
210
|
-
"docs": {
|
|
211
|
-
"tags": [],
|
|
212
|
-
"text": "Um evento disparado quando a propriedade oppened \u00E9 alterada."
|
|
213
|
-
},
|
|
214
|
-
"complexType": {
|
|
215
|
-
"original": "boolean",
|
|
216
|
-
"resolved": "boolean",
|
|
217
|
-
"references": {}
|
|
218
|
-
}
|
|
219
|
-
}]; }
|
|
220
|
-
static get watchers() { return [{
|
|
221
|
-
"propName": "oppened",
|
|
222
|
-
"methodName": "handleOppenedChange"
|
|
223
|
-
}]; }
|
|
224
|
-
}
|
|
1
|
+
import { Component, Host, h, Prop, Watch, Event } from '@stencil/core';
|
|
2
|
+
export class EzModal {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Controle de exibição do Modal
|
|
6
|
+
*/
|
|
7
|
+
this.oppened = true;
|
|
8
|
+
/**
|
|
9
|
+
* Define se o modal será fechado ao digitar ESC
|
|
10
|
+
*/
|
|
11
|
+
this.closeesc = false;
|
|
12
|
+
/**
|
|
13
|
+
* Define se o modal será fechado ao clicar fora do conteúdo.
|
|
14
|
+
*/
|
|
15
|
+
this.closeoutsideclick = false;
|
|
16
|
+
this.handleKeyboardEvent = (ev) => {
|
|
17
|
+
console.log(ev === null || ev === void 0 ? void 0 : ev.key);
|
|
18
|
+
if ((ev === null || ev === void 0 ? void 0 : ev.key) === 'Escape' && this.closeesc) {
|
|
19
|
+
this.oppened = false;
|
|
20
|
+
debugger;
|
|
21
|
+
this.ezChange.emit(this.oppened);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
handleClickOverlay(ev) {
|
|
26
|
+
ev === null || ev === void 0 ? void 0 : ev.stopPropagation();
|
|
27
|
+
if (ev instanceof PointerEvent && this.closeoutsideclick) {
|
|
28
|
+
this.oppened = false;
|
|
29
|
+
debugger;
|
|
30
|
+
this.ezChange.emit(this.oppened);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
handleOppenedChange() {
|
|
34
|
+
if (this.oppened) {
|
|
35
|
+
document.addEventListener('keydown', this.handleKeyboardEvent);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
document.removeEventListener('keydown', this.handleKeyboardEvent);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
///////
|
|
42
|
+
// trapTabKey(e) {
|
|
43
|
+
// // Check for TAB key press
|
|
44
|
+
// if (e.keyCode === 9) {
|
|
45
|
+
// // SHIFT + TAB
|
|
46
|
+
// if (e.shiftKey) {
|
|
47
|
+
// if (document.activeElement === this._firstTabStop) {
|
|
48
|
+
// e.preventDefault();
|
|
49
|
+
// this._lastTabStop.focus();
|
|
50
|
+
// }
|
|
51
|
+
// // TAB
|
|
52
|
+
// } else {
|
|
53
|
+
// if (document.activeElement === this._lastTabStop) {
|
|
54
|
+
// e.preventDefault();
|
|
55
|
+
// this._firstTabStop.focus();
|
|
56
|
+
// }
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
// if (e.keyCode === 27) {
|
|
60
|
+
// this.closeModal();
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
// closeModal() {
|
|
64
|
+
// this.oppened = false;
|
|
65
|
+
// this._focusedElementBeforeModal.focus();
|
|
66
|
+
// }
|
|
67
|
+
// componentDidLoad() {
|
|
68
|
+
// this._overlay.addEventListener('keydown', (ev) => { this.trapTabKey(ev) });
|
|
69
|
+
// // Save current focus
|
|
70
|
+
// this._focusedElementBeforeModal = document.activeElement;
|
|
71
|
+
// // Find all focusable children
|
|
72
|
+
// var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
|
|
73
|
+
// var focusableElements = this._modalContainer.querySelectorAll(focusableElementsString);
|
|
74
|
+
// // Convert NodeList to Array
|
|
75
|
+
// focusableElements = Array.prototype.slice.call(focusableElements);
|
|
76
|
+
// this._firstTabStop = focusableElements[0];
|
|
77
|
+
// this._lastTabStop = focusableElements[focusableElements.length - 1];
|
|
78
|
+
// // Focus first child
|
|
79
|
+
// this._firstTabStop.focus();
|
|
80
|
+
// }
|
|
81
|
+
// componentDidUpdate() {
|
|
82
|
+
// var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
|
|
83
|
+
// var focusableElements = this._modalContainer.querySelectorAll(focusableElementsString);
|
|
84
|
+
// }
|
|
85
|
+
/////
|
|
86
|
+
componentDidLoad() {
|
|
87
|
+
this.handleOppenedChange();
|
|
88
|
+
}
|
|
89
|
+
//Ainda teremos ajustes visuais
|
|
90
|
+
render() {
|
|
91
|
+
return (h(Host, null, this.oppened ?
|
|
92
|
+
h("div", { class: 'modal' /* ref={el => this._overlay = el} */, onClick: (ev) => this.handleClickOverlay(ev) },
|
|
93
|
+
this.align === 'left'
|
|
94
|
+
?
|
|
95
|
+
h("div", { onClick: (ev) => this.handleClickOverlay(ev), class: "modal__container modal__container--left" },
|
|
96
|
+
h("div", { onClick: (ev) => ev.stopPropagation(), class: "modal__content modal__content--left " + this.modalsize },
|
|
97
|
+
h("slot", null)))
|
|
98
|
+
: undefined,
|
|
99
|
+
this.align === 'right' ?
|
|
100
|
+
h("div", { onClick: (ev) => this.handleClickOverlay(ev), class: "modal__container modal__container--right" },
|
|
101
|
+
h("div", { onClick: (ev) => ev.stopPropagation(), class: "modal__content modal__content--right " + this.modalsize },
|
|
102
|
+
h("slot", null)))
|
|
103
|
+
: undefined)
|
|
104
|
+
: undefined));
|
|
105
|
+
}
|
|
106
|
+
static get is() { return "ez-modal"; }
|
|
107
|
+
static get encapsulation() { return "shadow"; }
|
|
108
|
+
static get originalStyleUrls() { return {
|
|
109
|
+
"$": ["ez-modal.css"]
|
|
110
|
+
}; }
|
|
111
|
+
static get styleUrls() { return {
|
|
112
|
+
"$": ["ez-modal.css"]
|
|
113
|
+
}; }
|
|
114
|
+
static get properties() { return {
|
|
115
|
+
"modalsize": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"mutable": true,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "string",
|
|
120
|
+
"resolved": "string",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Define o tamanho do modal devem ser utilizados os tamanhos definidos de colunas como \"col-sd-3\""
|
|
128
|
+
},
|
|
129
|
+
"attribute": "modalsize",
|
|
130
|
+
"reflect": true
|
|
131
|
+
},
|
|
132
|
+
"align": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"mutable": true,
|
|
135
|
+
"complexType": {
|
|
136
|
+
"original": "string",
|
|
137
|
+
"resolved": "string",
|
|
138
|
+
"references": {}
|
|
139
|
+
},
|
|
140
|
+
"required": false,
|
|
141
|
+
"optional": false,
|
|
142
|
+
"docs": {
|
|
143
|
+
"tags": [],
|
|
144
|
+
"text": "Define o alinhamento do modal, seus valores podem ser 'right' ou 'left'"
|
|
145
|
+
},
|
|
146
|
+
"attribute": "align",
|
|
147
|
+
"reflect": true
|
|
148
|
+
},
|
|
149
|
+
"oppened": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": true,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "Controle de exibi\u00E7\u00E3o do Modal"
|
|
162
|
+
},
|
|
163
|
+
"attribute": "oppened",
|
|
164
|
+
"reflect": true,
|
|
165
|
+
"defaultValue": "true"
|
|
166
|
+
},
|
|
167
|
+
"closeesc": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": true,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": "Define se o modal ser\u00E1 fechado ao digitar ESC"
|
|
180
|
+
},
|
|
181
|
+
"attribute": "closeesc",
|
|
182
|
+
"reflect": true,
|
|
183
|
+
"defaultValue": "false"
|
|
184
|
+
},
|
|
185
|
+
"closeoutsideclick": {
|
|
186
|
+
"type": "boolean",
|
|
187
|
+
"mutable": true,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "boolean",
|
|
190
|
+
"resolved": "boolean",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "Define se o modal ser\u00E1 fechado ao clicar fora do conte\u00FAdo."
|
|
198
|
+
},
|
|
199
|
+
"attribute": "closeoutsideclick",
|
|
200
|
+
"reflect": true,
|
|
201
|
+
"defaultValue": "false"
|
|
202
|
+
}
|
|
203
|
+
}; }
|
|
204
|
+
static get events() { return [{
|
|
205
|
+
"method": "ezChange",
|
|
206
|
+
"name": "ezChange",
|
|
207
|
+
"bubbles": true,
|
|
208
|
+
"cancelable": true,
|
|
209
|
+
"composed": true,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": "Um evento disparado quando a propriedade oppened \u00E9 alterada."
|
|
213
|
+
},
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "boolean",
|
|
216
|
+
"resolved": "boolean",
|
|
217
|
+
"references": {}
|
|
218
|
+
}
|
|
219
|
+
}]; }
|
|
220
|
+
static get watchers() { return [{
|
|
221
|
+
"propName": "oppened",
|
|
222
|
+
"methodName": "handleOppenedChange"
|
|
223
|
+
}]; }
|
|
224
|
+
}
|