@sankhyalabs/ezui 1.1.8 → 1.1.12
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-79f69df9.js} +421 -371
- package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
- package/dist/cjs/ez-button_14.cjs.entry.js +1943 -1911
- package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
- package/dist/cjs/ez-modal.cjs.entry.js +102 -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 +400 -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 +257 -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 +222 -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 +3161 -3081
- package/dist/esm/{DataUnit-69e518fa.js → DataUnit-bce6b190.js} +421 -371
- package/dist/esm/ez-action-chip.entry.js +41 -41
- package/dist/esm/ez-button_14.entry.js +1943 -1911
- package/dist/esm/ez-label-chip.entry.js +120 -120
- package/dist/esm/ez-modal.entry.js +102 -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-db11c600.entry.js → p-039054b7.entry.js} +1 -1
- package/dist/ezui/p-10ac6d78.js +1 -0
- package/dist/ezui/{p-b0974f4f.entry.js → p-419c9a35.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 +27 -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 +61 -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,323 +1,323 @@
|
|
|
1
|
-
import { Component, h, Method, Element, Host, Prop } from '@stencil/core';
|
|
2
|
-
import { FloatingManager } from '@sankhyalabs/core';
|
|
3
|
-
export class EzPopover {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._firstRender = true;
|
|
6
|
-
/**
|
|
7
|
-
* No modo floating = false o popover só se tornará visível
|
|
8
|
-
* quando o método show() for acionado.
|
|
9
|
-
*/
|
|
10
|
-
this.autoclose = true;
|
|
11
|
-
/**
|
|
12
|
-
* Offset top do popover em relação ao componente pai
|
|
13
|
-
*/
|
|
14
|
-
this.top = '0px';
|
|
15
|
-
/**
|
|
16
|
-
* Offset left do popover em relação ao componente pai
|
|
17
|
-
*/
|
|
18
|
-
this.left = '0px';
|
|
19
|
-
/**
|
|
20
|
-
* Offset bottom do popover em relação ao componente pai
|
|
21
|
-
*/
|
|
22
|
-
this.bottom = '0px';
|
|
23
|
-
/**
|
|
24
|
-
* Offset right do popover em relação ao componente pai
|
|
25
|
-
*/
|
|
26
|
-
this.right = '0px';
|
|
27
|
-
/**
|
|
28
|
-
* Ajusta o comportamento da largura do popover.
|
|
29
|
-
* Opções: "100% e "fit-content" (default)
|
|
30
|
-
*/
|
|
31
|
-
this.boxwidth = 'fit-content';
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Atualiza a posição do popover em relação ao componente pai.
|
|
35
|
-
*/
|
|
36
|
-
async updatePosition(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
37
|
-
const floatingOptions = {
|
|
38
|
-
autoClose: this.autoclose,
|
|
39
|
-
top,
|
|
40
|
-
left,
|
|
41
|
-
bottom,
|
|
42
|
-
right,
|
|
43
|
-
innerClickTest: (_container, node) => {
|
|
44
|
-
if (_container.contains(node)) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
//Here: we pass this._box as parameter but we need to change to _host
|
|
51
|
-
//because we need to get the lasChild (inner content to put in slot)
|
|
52
|
-
_container = this._host;
|
|
53
|
-
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
FloatingManager.updateFloatPosition(this._box, this._container, floatingOptions);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Faz com que o popover seja renderizado na DOM.
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
async show(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
63
|
-
const floatingOptions = {
|
|
64
|
-
autoClose: this.autoclose,
|
|
65
|
-
top,
|
|
66
|
-
left,
|
|
67
|
-
bottom,
|
|
68
|
-
right,
|
|
69
|
-
innerClickTest: (_container, node) => {
|
|
70
|
-
if (_container.contains(node)) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
// Here: we pass this._box as parameter but we need to change to _host
|
|
77
|
-
// because we need to get the lasChild (inner content to put in slot)
|
|
78
|
-
_container = this._host;
|
|
79
|
-
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this._floatingID = FloatingManager.float(this._box, this._container, floatingOptions);
|
|
83
|
-
this.isOpened = true;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
87
|
-
*/
|
|
88
|
-
async hide() {
|
|
89
|
-
if (this._floatingID !== undefined) {
|
|
90
|
-
FloatingManager.close(this._floatingID);
|
|
91
|
-
this._floatingID = undefined;
|
|
92
|
-
this.isOpened = false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
componentDidRender() {
|
|
96
|
-
if (this._firstRender) {
|
|
97
|
-
this._box.remove();
|
|
98
|
-
this._firstRender = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
render() {
|
|
102
|
-
return (h(Host, null,
|
|
103
|
-
h("section", { ref: el => this._container = el },
|
|
104
|
-
h("div", { class: `box ${this.boxwidth === 'fit-content' ? 'box--fit-content' : 'box--full-width'}`, ref: el => this._box = el },
|
|
105
|
-
h("slot", null)))));
|
|
106
|
-
}
|
|
107
|
-
static get is() { return "ez-popover"; }
|
|
108
|
-
static get encapsulation() { return "shadow"; }
|
|
109
|
-
static get originalStyleUrls() { return {
|
|
110
|
-
"$": ["ez-popover.css"]
|
|
111
|
-
}; }
|
|
112
|
-
static get styleUrls() { return {
|
|
113
|
-
"$": ["ez-popover.css"]
|
|
114
|
-
}; }
|
|
115
|
-
static get properties() { return {
|
|
116
|
-
"autoclose": {
|
|
117
|
-
"type": "boolean",
|
|
118
|
-
"mutable": false,
|
|
119
|
-
"complexType": {
|
|
120
|
-
"original": "boolean",
|
|
121
|
-
"resolved": "boolean",
|
|
122
|
-
"references": {}
|
|
123
|
-
},
|
|
124
|
-
"required": false,
|
|
125
|
-
"optional": false,
|
|
126
|
-
"docs": {
|
|
127
|
-
"tags": [],
|
|
128
|
-
"text": "No modo floating = false o popover s\u00F3 se tornar\u00E1 vis\u00EDvel\nquando o m\u00E9todo show() for acionado."
|
|
129
|
-
},
|
|
130
|
-
"attribute": "autoclose",
|
|
131
|
-
"reflect": true,
|
|
132
|
-
"defaultValue": "true"
|
|
133
|
-
},
|
|
134
|
-
"top": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"mutable": true,
|
|
137
|
-
"complexType": {
|
|
138
|
-
"original": "string",
|
|
139
|
-
"resolved": "string",
|
|
140
|
-
"references": {}
|
|
141
|
-
},
|
|
142
|
-
"required": false,
|
|
143
|
-
"optional": false,
|
|
144
|
-
"docs": {
|
|
145
|
-
"tags": [],
|
|
146
|
-
"text": "Offset top do popover em rela\u00E7\u00E3o ao componente pai"
|
|
147
|
-
},
|
|
148
|
-
"attribute": "top",
|
|
149
|
-
"reflect": true,
|
|
150
|
-
"defaultValue": "'0px'"
|
|
151
|
-
},
|
|
152
|
-
"left": {
|
|
153
|
-
"type": "string",
|
|
154
|
-
"mutable": true,
|
|
155
|
-
"complexType": {
|
|
156
|
-
"original": "string",
|
|
157
|
-
"resolved": "string",
|
|
158
|
-
"references": {}
|
|
159
|
-
},
|
|
160
|
-
"required": false,
|
|
161
|
-
"optional": false,
|
|
162
|
-
"docs": {
|
|
163
|
-
"tags": [],
|
|
164
|
-
"text": "Offset left do popover em rela\u00E7\u00E3o ao componente pai"
|
|
165
|
-
},
|
|
166
|
-
"attribute": "left",
|
|
167
|
-
"reflect": true,
|
|
168
|
-
"defaultValue": "'0px'"
|
|
169
|
-
},
|
|
170
|
-
"bottom": {
|
|
171
|
-
"type": "string",
|
|
172
|
-
"mutable": true,
|
|
173
|
-
"complexType": {
|
|
174
|
-
"original": "string",
|
|
175
|
-
"resolved": "string",
|
|
176
|
-
"references": {}
|
|
177
|
-
},
|
|
178
|
-
"required": false,
|
|
179
|
-
"optional": false,
|
|
180
|
-
"docs": {
|
|
181
|
-
"tags": [],
|
|
182
|
-
"text": "Offset bottom do popover em rela\u00E7\u00E3o ao componente pai"
|
|
183
|
-
},
|
|
184
|
-
"attribute": "bottom",
|
|
185
|
-
"reflect": true,
|
|
186
|
-
"defaultValue": "'0px'"
|
|
187
|
-
},
|
|
188
|
-
"right": {
|
|
189
|
-
"type": "string",
|
|
190
|
-
"mutable": true,
|
|
191
|
-
"complexType": {
|
|
192
|
-
"original": "string",
|
|
193
|
-
"resolved": "string",
|
|
194
|
-
"references": {}
|
|
195
|
-
},
|
|
196
|
-
"required": false,
|
|
197
|
-
"optional": false,
|
|
198
|
-
"docs": {
|
|
199
|
-
"tags": [],
|
|
200
|
-
"text": "Offset right do popover em rela\u00E7\u00E3o ao componente pai"
|
|
201
|
-
},
|
|
202
|
-
"attribute": "right",
|
|
203
|
-
"reflect": true,
|
|
204
|
-
"defaultValue": "'0px'"
|
|
205
|
-
},
|
|
206
|
-
"boxwidth": {
|
|
207
|
-
"type": "string",
|
|
208
|
-
"mutable": false,
|
|
209
|
-
"complexType": {
|
|
210
|
-
"original": "string",
|
|
211
|
-
"resolved": "string",
|
|
212
|
-
"references": {}
|
|
213
|
-
},
|
|
214
|
-
"required": false,
|
|
215
|
-
"optional": false,
|
|
216
|
-
"docs": {
|
|
217
|
-
"tags": [],
|
|
218
|
-
"text": "Ajusta o comportamento da largura do popover.\nOp\u00E7\u00F5es: \"100% e \"fit-content\" (default)"
|
|
219
|
-
},
|
|
220
|
-
"attribute": "boxwidth",
|
|
221
|
-
"reflect": true,
|
|
222
|
-
"defaultValue": "'fit-content'"
|
|
223
|
-
},
|
|
224
|
-
"isOpened": {
|
|
225
|
-
"type": "boolean",
|
|
226
|
-
"mutable": true,
|
|
227
|
-
"complexType": {
|
|
228
|
-
"original": "boolean",
|
|
229
|
-
"resolved": "boolean",
|
|
230
|
-
"references": {}
|
|
231
|
-
},
|
|
232
|
-
"required": false,
|
|
233
|
-
"optional": false,
|
|
234
|
-
"docs": {
|
|
235
|
-
"tags": [],
|
|
236
|
-
"text": "Externaliza estado atual do componente."
|
|
237
|
-
},
|
|
238
|
-
"attribute": "is-opened",
|
|
239
|
-
"reflect": true
|
|
240
|
-
}
|
|
241
|
-
}; }
|
|
242
|
-
static get methods() { return {
|
|
243
|
-
"updatePosition": {
|
|
244
|
-
"complexType": {
|
|
245
|
-
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
246
|
-
"parameters": [{
|
|
247
|
-
"tags": [],
|
|
248
|
-
"text": ""
|
|
249
|
-
}, {
|
|
250
|
-
"tags": [],
|
|
251
|
-
"text": ""
|
|
252
|
-
}, {
|
|
253
|
-
"tags": [],
|
|
254
|
-
"text": ""
|
|
255
|
-
}, {
|
|
256
|
-
"tags": [],
|
|
257
|
-
"text": ""
|
|
258
|
-
}],
|
|
259
|
-
"references": {
|
|
260
|
-
"Promise": {
|
|
261
|
-
"location": "global"
|
|
262
|
-
},
|
|
263
|
-
"HTMLElement": {
|
|
264
|
-
"location": "global"
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
"return": "Promise<void>"
|
|
268
|
-
},
|
|
269
|
-
"docs": {
|
|
270
|
-
"text": "Atualiza a posi\u00E7\u00E3o do popover em rela\u00E7\u00E3o ao componente pai.",
|
|
271
|
-
"tags": []
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
"show": {
|
|
275
|
-
"complexType": {
|
|
276
|
-
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
277
|
-
"parameters": [{
|
|
278
|
-
"tags": [],
|
|
279
|
-
"text": ""
|
|
280
|
-
}, {
|
|
281
|
-
"tags": [],
|
|
282
|
-
"text": ""
|
|
283
|
-
}, {
|
|
284
|
-
"tags": [],
|
|
285
|
-
"text": ""
|
|
286
|
-
}, {
|
|
287
|
-
"tags": [],
|
|
288
|
-
"text": ""
|
|
289
|
-
}],
|
|
290
|
-
"references": {
|
|
291
|
-
"Promise": {
|
|
292
|
-
"location": "global"
|
|
293
|
-
},
|
|
294
|
-
"HTMLElement": {
|
|
295
|
-
"location": "global"
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
"return": "Promise<void>"
|
|
299
|
-
},
|
|
300
|
-
"docs": {
|
|
301
|
-
"text": "Faz com que o popover seja renderizado na DOM.",
|
|
302
|
-
"tags": []
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
"hide": {
|
|
306
|
-
"complexType": {
|
|
307
|
-
"signature": "() => Promise<void>",
|
|
308
|
-
"parameters": [],
|
|
309
|
-
"references": {
|
|
310
|
-
"Promise": {
|
|
311
|
-
"location": "global"
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
"return": "Promise<void>"
|
|
315
|
-
},
|
|
316
|
-
"docs": {
|
|
317
|
-
"text": "Usado no modo floating. Faz com que o componente seja ocultado.",
|
|
318
|
-
"tags": []
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}; }
|
|
322
|
-
static get elementRef() { return "_host"; }
|
|
323
|
-
}
|
|
1
|
+
import { Component, h, Method, Element, Host, Prop } from '@stencil/core';
|
|
2
|
+
import { FloatingManager } from '@sankhyalabs/core';
|
|
3
|
+
export class EzPopover {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._firstRender = true;
|
|
6
|
+
/**
|
|
7
|
+
* No modo floating = false o popover só se tornará visível
|
|
8
|
+
* quando o método show() for acionado.
|
|
9
|
+
*/
|
|
10
|
+
this.autoclose = true;
|
|
11
|
+
/**
|
|
12
|
+
* Offset top do popover em relação ao componente pai
|
|
13
|
+
*/
|
|
14
|
+
this.top = '0px';
|
|
15
|
+
/**
|
|
16
|
+
* Offset left do popover em relação ao componente pai
|
|
17
|
+
*/
|
|
18
|
+
this.left = '0px';
|
|
19
|
+
/**
|
|
20
|
+
* Offset bottom do popover em relação ao componente pai
|
|
21
|
+
*/
|
|
22
|
+
this.bottom = '0px';
|
|
23
|
+
/**
|
|
24
|
+
* Offset right do popover em relação ao componente pai
|
|
25
|
+
*/
|
|
26
|
+
this.right = '0px';
|
|
27
|
+
/**
|
|
28
|
+
* Ajusta o comportamento da largura do popover.
|
|
29
|
+
* Opções: "100% e "fit-content" (default)
|
|
30
|
+
*/
|
|
31
|
+
this.boxwidth = 'fit-content';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Atualiza a posição do popover em relação ao componente pai.
|
|
35
|
+
*/
|
|
36
|
+
async updatePosition(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
37
|
+
const floatingOptions = {
|
|
38
|
+
autoClose: this.autoclose,
|
|
39
|
+
top,
|
|
40
|
+
left,
|
|
41
|
+
bottom,
|
|
42
|
+
right,
|
|
43
|
+
innerClickTest: (_container, node) => {
|
|
44
|
+
if (_container.contains(node)) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
//Here: we pass this._box as parameter but we need to change to _host
|
|
51
|
+
//because we need to get the lasChild (inner content to put in slot)
|
|
52
|
+
_container = this._host;
|
|
53
|
+
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
FloatingManager.updateFloatPosition(this._box, this._container, floatingOptions);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Faz com que o popover seja renderizado na DOM.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
async show(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
63
|
+
const floatingOptions = {
|
|
64
|
+
autoClose: this.autoclose,
|
|
65
|
+
top,
|
|
66
|
+
left,
|
|
67
|
+
bottom,
|
|
68
|
+
right,
|
|
69
|
+
innerClickTest: (_container, node) => {
|
|
70
|
+
if (_container.contains(node)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
// Here: we pass this._box as parameter but we need to change to _host
|
|
77
|
+
// because we need to get the lasChild (inner content to put in slot)
|
|
78
|
+
_container = this._host;
|
|
79
|
+
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
this._floatingID = FloatingManager.float(this._box, this._container, floatingOptions);
|
|
83
|
+
this.isOpened = true;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
87
|
+
*/
|
|
88
|
+
async hide() {
|
|
89
|
+
if (this._floatingID !== undefined) {
|
|
90
|
+
FloatingManager.close(this._floatingID);
|
|
91
|
+
this._floatingID = undefined;
|
|
92
|
+
this.isOpened = false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
componentDidRender() {
|
|
96
|
+
if (this._firstRender) {
|
|
97
|
+
this._box.remove();
|
|
98
|
+
this._firstRender = false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
render() {
|
|
102
|
+
return (h(Host, null,
|
|
103
|
+
h("section", { ref: el => this._container = el },
|
|
104
|
+
h("div", { class: `box ${this.boxwidth === 'fit-content' ? 'box--fit-content' : 'box--full-width'}`, ref: el => this._box = el },
|
|
105
|
+
h("slot", null)))));
|
|
106
|
+
}
|
|
107
|
+
static get is() { return "ez-popover"; }
|
|
108
|
+
static get encapsulation() { return "shadow"; }
|
|
109
|
+
static get originalStyleUrls() { return {
|
|
110
|
+
"$": ["ez-popover.css"]
|
|
111
|
+
}; }
|
|
112
|
+
static get styleUrls() { return {
|
|
113
|
+
"$": ["ez-popover.css"]
|
|
114
|
+
}; }
|
|
115
|
+
static get properties() { return {
|
|
116
|
+
"autoclose": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": false,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": "No modo floating = false o popover s\u00F3 se tornar\u00E1 vis\u00EDvel\r\nquando o m\u00E9todo show() for acionado."
|
|
129
|
+
},
|
|
130
|
+
"attribute": "autoclose",
|
|
131
|
+
"reflect": true,
|
|
132
|
+
"defaultValue": "true"
|
|
133
|
+
},
|
|
134
|
+
"top": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"mutable": true,
|
|
137
|
+
"complexType": {
|
|
138
|
+
"original": "string",
|
|
139
|
+
"resolved": "string",
|
|
140
|
+
"references": {}
|
|
141
|
+
},
|
|
142
|
+
"required": false,
|
|
143
|
+
"optional": false,
|
|
144
|
+
"docs": {
|
|
145
|
+
"tags": [],
|
|
146
|
+
"text": "Offset top do popover em rela\u00E7\u00E3o ao componente pai"
|
|
147
|
+
},
|
|
148
|
+
"attribute": "top",
|
|
149
|
+
"reflect": true,
|
|
150
|
+
"defaultValue": "'0px'"
|
|
151
|
+
},
|
|
152
|
+
"left": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"mutable": true,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "string",
|
|
157
|
+
"resolved": "string",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "Offset left do popover em rela\u00E7\u00E3o ao componente pai"
|
|
165
|
+
},
|
|
166
|
+
"attribute": "left",
|
|
167
|
+
"reflect": true,
|
|
168
|
+
"defaultValue": "'0px'"
|
|
169
|
+
},
|
|
170
|
+
"bottom": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"mutable": true,
|
|
173
|
+
"complexType": {
|
|
174
|
+
"original": "string",
|
|
175
|
+
"resolved": "string",
|
|
176
|
+
"references": {}
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"optional": false,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": "Offset bottom do popover em rela\u00E7\u00E3o ao componente pai"
|
|
183
|
+
},
|
|
184
|
+
"attribute": "bottom",
|
|
185
|
+
"reflect": true,
|
|
186
|
+
"defaultValue": "'0px'"
|
|
187
|
+
},
|
|
188
|
+
"right": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"mutable": true,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "string",
|
|
193
|
+
"resolved": "string",
|
|
194
|
+
"references": {}
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"optional": false,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "Offset right do popover em rela\u00E7\u00E3o ao componente pai"
|
|
201
|
+
},
|
|
202
|
+
"attribute": "right",
|
|
203
|
+
"reflect": true,
|
|
204
|
+
"defaultValue": "'0px'"
|
|
205
|
+
},
|
|
206
|
+
"boxwidth": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "string",
|
|
211
|
+
"resolved": "string",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": false,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": "Ajusta o comportamento da largura do popover.\r\nOp\u00E7\u00F5es: \"100% e \"fit-content\" (default)"
|
|
219
|
+
},
|
|
220
|
+
"attribute": "boxwidth",
|
|
221
|
+
"reflect": true,
|
|
222
|
+
"defaultValue": "'fit-content'"
|
|
223
|
+
},
|
|
224
|
+
"isOpened": {
|
|
225
|
+
"type": "boolean",
|
|
226
|
+
"mutable": true,
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "boolean",
|
|
229
|
+
"resolved": "boolean",
|
|
230
|
+
"references": {}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Externaliza estado atual do componente."
|
|
237
|
+
},
|
|
238
|
+
"attribute": "is-opened",
|
|
239
|
+
"reflect": true
|
|
240
|
+
}
|
|
241
|
+
}; }
|
|
242
|
+
static get methods() { return {
|
|
243
|
+
"updatePosition": {
|
|
244
|
+
"complexType": {
|
|
245
|
+
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
246
|
+
"parameters": [{
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": ""
|
|
249
|
+
}, {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": ""
|
|
252
|
+
}, {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": ""
|
|
255
|
+
}, {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": ""
|
|
258
|
+
}],
|
|
259
|
+
"references": {
|
|
260
|
+
"Promise": {
|
|
261
|
+
"location": "global"
|
|
262
|
+
},
|
|
263
|
+
"HTMLElement": {
|
|
264
|
+
"location": "global"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"return": "Promise<void>"
|
|
268
|
+
},
|
|
269
|
+
"docs": {
|
|
270
|
+
"text": "Atualiza a posi\u00E7\u00E3o do popover em rela\u00E7\u00E3o ao componente pai.",
|
|
271
|
+
"tags": []
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"show": {
|
|
275
|
+
"complexType": {
|
|
276
|
+
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
277
|
+
"parameters": [{
|
|
278
|
+
"tags": [],
|
|
279
|
+
"text": ""
|
|
280
|
+
}, {
|
|
281
|
+
"tags": [],
|
|
282
|
+
"text": ""
|
|
283
|
+
}, {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": ""
|
|
286
|
+
}, {
|
|
287
|
+
"tags": [],
|
|
288
|
+
"text": ""
|
|
289
|
+
}],
|
|
290
|
+
"references": {
|
|
291
|
+
"Promise": {
|
|
292
|
+
"location": "global"
|
|
293
|
+
},
|
|
294
|
+
"HTMLElement": {
|
|
295
|
+
"location": "global"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"return": "Promise<void>"
|
|
299
|
+
},
|
|
300
|
+
"docs": {
|
|
301
|
+
"text": "Faz com que o popover seja renderizado na DOM.",
|
|
302
|
+
"tags": []
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"hide": {
|
|
306
|
+
"complexType": {
|
|
307
|
+
"signature": "() => Promise<void>",
|
|
308
|
+
"parameters": [],
|
|
309
|
+
"references": {
|
|
310
|
+
"Promise": {
|
|
311
|
+
"location": "global"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"return": "Promise<void>"
|
|
315
|
+
},
|
|
316
|
+
"docs": {
|
|
317
|
+
"text": "Usado no modo floating. Faz com que o componente seja ocultado.",
|
|
318
|
+
"tags": []
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}; }
|
|
322
|
+
static get elementRef() { return "_host"; }
|
|
323
|
+
}
|