@sankhyalabs/ezui 1.1.117 → 1.1.120
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/cjs/{ApplicationUtils-c8f07135.js → ApplicationUtils-93721afc.js} +1 -4
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +45 -12
- package/dist/cjs/ez-popover.cjs.entry.js +41 -22
- package/dist/cjs/ez-toast.cjs.entry.js +53 -10
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/test-du.cjs.entry.js +14 -10
- package/dist/collection/components/ez-check/ez-check.css +28 -10
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +27 -9
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -3
- package/dist/collection/components/ez-grid/ez-grid.js +47 -0
- package/dist/collection/components/ez-popover/ez-popover.css +3 -5
- package/dist/collection/components/ez-popover/ez-popover.js +62 -28
- package/dist/collection/components/ez-toast/ez-toast.css +1 -1
- package/dist/collection/components/ez-toast/ez-toast.js +72 -16
- package/dist/collection/components/test-du/test-du.js +14 -10
- package/dist/collection/utils/ApplicationUtils.js +1 -4
- package/dist/custom-elements/index.js +156 -60
- package/dist/esm/{ApplicationUtils-36e38de9.js → ApplicationUtils-3ca0e68d.js} +1 -4
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +45 -12
- package/dist/esm/ez-popover.entry.js +41 -22
- package/dist/esm/ez-toast.entry.js +54 -11
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/test-du.entry.js +14 -10
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-f26f6d67.entry.js → p-126d33e2.entry.js} +1 -1
- package/dist/ezui/{p-3602ab8c.entry.js → p-1339fde7.entry.js} +1 -1
- package/dist/ezui/p-149a8241.entry.js +1 -0
- package/dist/ezui/p-25e050f5.entry.js +1 -0
- package/dist/ezui/{p-62daf508.js → p-3c71a597.js} +1 -1
- package/dist/ezui/p-76b64956.entry.js +1 -0
- package/dist/ezui/{p-3cd17150.entry.js → p-c86cd69e.entry.js} +1 -1
- package/dist/ezui/p-f8d3c04d.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +6 -2
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -2
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +8 -0
- package/dist/types/components/ez-popover/ez-popover.d.ts +7 -0
- package/dist/types/components/ez-toast/ez-toast.d.ts +15 -1
- package/dist/types/components.d.ts +17 -1
- package/package.json +1 -1
- package/dist/ezui/p-080045a0.entry.js +0 -1
- package/dist/ezui/p-7247379d.entry.js +0 -1
- package/dist/ezui/p-73d3f767.entry.js +0 -1
- package/dist/ezui/p-f3f9c7e6.entry.js +0 -1
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
/*@doc Define a altura do slider do checkbox.*/
|
|
58
58
|
--ez-switch--slider--height: 14px;
|
|
59
59
|
/*@doc Define a largura do pino do slider do checkbox.*/
|
|
60
|
-
--ez-switch--pin--width:
|
|
60
|
+
--ez-switch--pin--width: 19px;
|
|
61
61
|
/*@doc Define a altura do pino do slider do checkbox.*/
|
|
62
|
-
--ez-switch--pin--height:
|
|
62
|
+
--ez-switch--pin--height: 19px;
|
|
63
63
|
/*@doc Define a largura do slider quando focado.*/
|
|
64
64
|
--ez-switch--focus--width: 32px;
|
|
65
65
|
/*@doc Define a altura do slider quando focado.*/
|
|
@@ -71,15 +71,17 @@
|
|
|
71
71
|
/*@doc Define a cor de fundo do checkbox desabilitado no modo switch.*/
|
|
72
72
|
--ez-switch--disabled--background-color: var(--color--disable-secondary);
|
|
73
73
|
/*@doc Define a cor de fundo do checkbox marcado no modo switch.*/
|
|
74
|
-
--ez-switch--checked--background-color: var(--color--primary-300);
|
|
74
|
+
--ez-switch--disabled--checked--background-color: var(--color--primary-300);
|
|
75
|
+
/*@doc Define a cor de fundo do checkbox marcado no modo switch.*/
|
|
76
|
+
--ez-switch--checked--background-color: var(--color--primary);
|
|
75
77
|
|
|
76
78
|
/*pin*/
|
|
77
79
|
/*@doc Define a cor de fundo do pino do slider. */
|
|
78
80
|
--ez-switch--pin--background-color: var(--background--xlight);
|
|
79
81
|
/*@doc Define a cor de fundo do pino do slider quando desabilitado. */
|
|
80
|
-
--ez-switch--pin--disabled--background-color: var(--color--disable-
|
|
82
|
+
--ez-switch--pin--disabled--background-color: var(--color--disable-primary);
|
|
81
83
|
/*@doc Define a cor de fundo do pino do slider quando marcado. */
|
|
82
|
-
--ez-switch--pin--checked--background-color: var(--
|
|
84
|
+
--ez-switch--pin--checked--background-color: var(--background--xlight);
|
|
83
85
|
/*@doc Define a cor de fundo do pino do slider quando marcado e desabilitado1. */
|
|
84
86
|
--ez-switch--pin--checked--disabled--background-color: #E8F7F4;
|
|
85
87
|
/*@doc Define a cor de fundo do pino do slider quando focado. */
|
|
@@ -87,6 +89,11 @@
|
|
|
87
89
|
/*@doc Define a cor de fundo do pino do slider quando marcado e focado. */
|
|
88
90
|
--ez-switch--pin--checked--focus--background-color: var(--color--primary);
|
|
89
91
|
|
|
92
|
+
/*@doc Define a cor da borda do pino do slider. */
|
|
93
|
+
--ez-switch--pin--border-color: var(--text--primary);
|
|
94
|
+
/*@doc Define a cor da borda do pino do slider quando desabilitado. */
|
|
95
|
+
--ez-switch--pin--disabled--border-color: var(--text--secondary);
|
|
96
|
+
|
|
90
97
|
/*@doc Define o tamanho da fonte do label.*/
|
|
91
98
|
--ez-check--label--font-size: var(--text--medium, 14px);
|
|
92
99
|
/*@doc Define a família da fonte do label.*/
|
|
@@ -218,7 +225,7 @@ input.switchMode {
|
|
|
218
225
|
outline: none;
|
|
219
226
|
cursor: pointer;
|
|
220
227
|
border-radius: 20px;
|
|
221
|
-
border: var(--border--small, 1px solid) var(--
|
|
228
|
+
border: var(--border--small, 1px solid) var(--ez-switch--pin--border-color, #626e82);
|
|
222
229
|
transition: background-color var(--transition);
|
|
223
230
|
|
|
224
231
|
/*public*/
|
|
@@ -230,6 +237,12 @@ input.switchMode {
|
|
|
230
237
|
input.switchMode:disabled {
|
|
231
238
|
/*public*/
|
|
232
239
|
background-color: var(--ez-switch--disabled--background-color);
|
|
240
|
+
border: var(--border--small, 1px solid) var(--ez-switch--pin--disabled--border-color, #a2abb9);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
input.switchMode:checked:disabled {
|
|
244
|
+
/*public*/
|
|
245
|
+
background-color: var(--ez-switch--disabled--checked--background-color);
|
|
233
246
|
}
|
|
234
247
|
|
|
235
248
|
input.switchMode::after {
|
|
@@ -240,8 +253,10 @@ input.switchMode::after {
|
|
|
240
253
|
box-shadow: var(--shadow);
|
|
241
254
|
transition: transform var(--transition);
|
|
242
255
|
transition: background-color var(--transition);
|
|
243
|
-
|
|
256
|
+
transition: border-color var(--transition);
|
|
257
|
+
transform: translateX(-2px) translateY(-4px);
|
|
244
258
|
border-radius: 50%;
|
|
259
|
+
border: var(--border--small, 1px solid) var(--ez-switch--pin--border-color, #626e82);
|
|
245
260
|
|
|
246
261
|
/*public*/
|
|
247
262
|
width: var(--ez-switch--pin--width);
|
|
@@ -252,6 +267,7 @@ input.switchMode::after {
|
|
|
252
267
|
input.switchMode:disabled::after {
|
|
253
268
|
/*public*/
|
|
254
269
|
background-color: var(--ez-switch--pin--disabled--background-color);
|
|
270
|
+
border: var(--border--small, 1px solid) var(--ez-switch--pin--disabled--border-color, #a2abb9);
|
|
255
271
|
}
|
|
256
272
|
|
|
257
273
|
/*-------------------------------ON---------------------------------*/
|
|
@@ -277,7 +293,7 @@ input.switchMode::before {
|
|
|
277
293
|
width: var(--ez-switch--focus--width);
|
|
278
294
|
height: var(--ez-switch--focus--height);
|
|
279
295
|
top: calc((var(--ez-switch--slider--height) - var(--ez-switch--focus--height)) / 2);
|
|
280
|
-
left: calc((var(--ez-switch--pin--width) - var(--ez-switch--focus--width))/2);
|
|
296
|
+
left: calc((var(--ez-switch--pin--width) - var(--ez-switch--focus--width) - 2px) / 2);
|
|
281
297
|
background-color: var(--ez-switch--pin--focus--background-color);
|
|
282
298
|
}
|
|
283
299
|
|
|
@@ -290,18 +306,20 @@ input.switchMode:focus::before {
|
|
|
290
306
|
input.switchMode:checked:focus::before {
|
|
291
307
|
/*private*/
|
|
292
308
|
background-color: var(--ez-switch--pin--checked--focus--background-color);
|
|
293
|
-
transform: translateX(calc(var(--ez-switch--slider--width) - var(--ez-switch--pin--width)));
|
|
309
|
+
transform: translateX(calc(var(--ez-switch--slider--width) - var(--ez-switch--pin--width) + 2px));
|
|
294
310
|
}
|
|
295
311
|
|
|
296
312
|
input.switchMode:checked::after {
|
|
297
313
|
/*private*/
|
|
298
314
|
transition: transform var(--transition);
|
|
299
315
|
transition: background-color var(--transition);
|
|
300
|
-
|
|
316
|
+
transition: border-color var(--transition);
|
|
317
|
+
transform: translateX(calc(var(--ez-switch--slider--width) - var(--ez-switch--pin--width))) translateY(-4px);
|
|
301
318
|
box-shadow: var(--shadow);
|
|
302
319
|
|
|
303
320
|
/*public*/
|
|
304
321
|
background-color: var(--ez-switch--pin--checked--background-color);
|
|
322
|
+
border: var(--border--small, 1px solid) var(--color--primary, #008561);
|
|
305
323
|
}
|
|
306
324
|
|
|
307
325
|
input.switchMode:checked:disabled::after {
|
|
@@ -37,11 +37,13 @@ export default class AgGridController {
|
|
|
37
37
|
this._serverURL = options.serverURL;
|
|
38
38
|
this._dataUnit = options.dataUnit;
|
|
39
39
|
this._dataUnit.sortingProvider = this;
|
|
40
|
+
this._dataSource = new DataSource(this._dataUnit, this._serverURL);
|
|
40
41
|
this._gridOptions = {
|
|
41
42
|
localeText: gridTerms,
|
|
42
43
|
rowModelType: "serverSide",
|
|
44
|
+
serverSideStoreType: "partial",
|
|
43
45
|
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
44
|
-
serverSideDatasource:
|
|
46
|
+
serverSideDatasource: this._dataSource,
|
|
45
47
|
getRowNodeId: (params) => typeof params === "string" ? params : params[this._idAttribName],
|
|
46
48
|
getMainMenuItems: (params) => {
|
|
47
49
|
const column = params.column;
|
|
@@ -52,10 +54,13 @@ export default class AgGridController {
|
|
|
52
54
|
}));
|
|
53
55
|
return items;
|
|
54
56
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
getRowHeight: () => {
|
|
58
|
+
//FIXME: Existe um bug no PartialStore.prototype.destroyAllBlocks do ag-grid, pois
|
|
59
|
+
//apesar de destruir os blocos, mantém a variável "blockHeights" com o tamanho antigo
|
|
60
|
+
//dos blocos, então, quando removemos uma linha, a altura do bloco não é recalculada.
|
|
61
|
+
//Descobri que setando manualmente a altura das linhas, apesar do bloco ficar com
|
|
62
|
+
//tamanho errado, isso afeta menos o componente.
|
|
63
|
+
return 25;
|
|
59
64
|
}
|
|
60
65
|
};
|
|
61
66
|
this.setOptionsEvents(this._gridOptions);
|
|
@@ -78,6 +83,11 @@ export default class AgGridController {
|
|
|
78
83
|
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
79
84
|
opt.onPaginationChanged = () => this.onPaginationChange();
|
|
80
85
|
opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
|
|
86
|
+
opt.onViewportChanged = () => {
|
|
87
|
+
if (this._dataUnit) {
|
|
88
|
+
this.selectRows(this._dataUnit.getSelection());
|
|
89
|
+
}
|
|
90
|
+
};
|
|
81
91
|
}
|
|
82
92
|
setOptionsPagination(opt) {
|
|
83
93
|
opt.pagination = (this._pageSize > -1);
|
|
@@ -95,11 +105,11 @@ export default class AgGridController {
|
|
|
95
105
|
}
|
|
96
106
|
this._gridOptions.api.setRowData(data);
|
|
97
107
|
}
|
|
98
|
-
addRows(
|
|
108
|
+
addRows() {
|
|
99
109
|
if (this._grid === undefined) {
|
|
100
110
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
101
111
|
}
|
|
102
|
-
this._gridOptions.api.
|
|
112
|
+
this._gridOptions.api.refreshServerSideStore({});
|
|
103
113
|
}
|
|
104
114
|
selectRows(rowIds) {
|
|
105
115
|
if (this._grid === undefined) {
|
|
@@ -114,11 +124,11 @@ export default class AgGridController {
|
|
|
114
124
|
});
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
|
-
removeRows(
|
|
127
|
+
removeRows() {
|
|
118
128
|
if (this._grid === undefined) {
|
|
119
129
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
120
130
|
}
|
|
121
|
-
this._gridOptions.api.
|
|
131
|
+
this._gridOptions.api.refreshServerSideStore({});
|
|
122
132
|
}
|
|
123
133
|
changeValues(changes, rowIds) {
|
|
124
134
|
if (this._grid === undefined) {
|
|
@@ -235,6 +245,14 @@ export default class AgGridController {
|
|
|
235
245
|
previousPage() {
|
|
236
246
|
this._gridOptions.api.paginationGoToPreviousPage();
|
|
237
247
|
}
|
|
248
|
+
goToPage(page) {
|
|
249
|
+
this._gridOptions.api.paginationGoToPage(page);
|
|
250
|
+
}
|
|
251
|
+
quickFilter(term) {
|
|
252
|
+
this._dataSource.setQuickFilter(term);
|
|
253
|
+
this.goToPage(0);
|
|
254
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
255
|
+
}
|
|
238
256
|
buildColDef(source) {
|
|
239
257
|
return {
|
|
240
258
|
headerName: source.label,
|
|
@@ -19,15 +19,15 @@ export default class DataSource {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
this.loadData()
|
|
22
|
+
this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this._quickFilterTerm })
|
|
23
23
|
.then(data => params.success(data))
|
|
24
24
|
.catch(() => params.fail());
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
loadData() {
|
|
27
|
+
loadData(page) {
|
|
28
28
|
return new Promise((resolve, reject) => {
|
|
29
29
|
if (this._dataUnit) {
|
|
30
|
-
this._dataUnit.loadData().then(
|
|
30
|
+
this._dataUnit.loadData(page).then(pageRes => resolve({ rowData: this._dataUnit.records, rowCount: pageRes.total }));
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
fetch(this._serverURL)
|
|
@@ -38,4 +38,7 @@ export default class DataSource {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
setQuickFilter(term) {
|
|
42
|
+
this._quickFilterTerm = term;
|
|
43
|
+
}
|
|
41
44
|
}
|
|
@@ -54,6 +54,18 @@ export class EzGrid {
|
|
|
54
54
|
async getColumns() {
|
|
55
55
|
return Promise.resolve(this._gridController.getColumnsDef());
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Método para recarregar pagina atual da grid.
|
|
59
|
+
*/
|
|
60
|
+
async refresh() {
|
|
61
|
+
this._gridController.refresh();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Método para fazer um filtro rápido na grid.
|
|
65
|
+
*/
|
|
66
|
+
async quickFilter(term) {
|
|
67
|
+
this._gridController.quickFilter(term);
|
|
68
|
+
}
|
|
57
69
|
componentWillLoad() {
|
|
58
70
|
if (this.dataUnit) {
|
|
59
71
|
this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
|
|
@@ -433,6 +445,41 @@ export class EzGrid {
|
|
|
433
445
|
"text": "M\u00E9todo retornar o estado atual das colunas do grid.",
|
|
434
446
|
"tags": []
|
|
435
447
|
}
|
|
448
|
+
},
|
|
449
|
+
"refresh": {
|
|
450
|
+
"complexType": {
|
|
451
|
+
"signature": "() => Promise<any>",
|
|
452
|
+
"parameters": [],
|
|
453
|
+
"references": {
|
|
454
|
+
"Promise": {
|
|
455
|
+
"location": "global"
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
"return": "Promise<any>"
|
|
459
|
+
},
|
|
460
|
+
"docs": {
|
|
461
|
+
"text": "M\u00E9todo para recarregar pagina atual da grid.",
|
|
462
|
+
"tags": []
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
"quickFilter": {
|
|
466
|
+
"complexType": {
|
|
467
|
+
"signature": "(term: string) => Promise<any>",
|
|
468
|
+
"parameters": [{
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": ""
|
|
471
|
+
}],
|
|
472
|
+
"references": {
|
|
473
|
+
"Promise": {
|
|
474
|
+
"location": "global"
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
"return": "Promise<any>"
|
|
478
|
+
},
|
|
479
|
+
"docs": {
|
|
480
|
+
"text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
|
|
481
|
+
"tags": []
|
|
482
|
+
}
|
|
436
483
|
}
|
|
437
484
|
}; }
|
|
438
485
|
}
|
|
@@ -17,11 +17,9 @@
|
|
|
17
17
|
position: relative;
|
|
18
18
|
display: flex;
|
|
19
19
|
user-select: none;
|
|
20
|
-
width: 100%;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
.box {
|
|
22
|
+
.popover__box {
|
|
25
23
|
/*private*/
|
|
26
24
|
z-index: var(--ez-popover__box--z-index);
|
|
27
25
|
display: flex;
|
|
@@ -35,10 +33,10 @@
|
|
|
35
33
|
box-shadow: var(--ez-popover__box--box-shadow);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
.
|
|
36
|
+
.popover__box--fit-content {
|
|
39
37
|
width: fit-content;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
.
|
|
40
|
+
.popover__box--full-width {
|
|
43
41
|
width: 100%;
|
|
44
42
|
}
|
|
@@ -29,6 +29,41 @@ export class EzPopover {
|
|
|
29
29
|
* Opções: "100% e "fit-content" (default)
|
|
30
30
|
*/
|
|
31
31
|
this.boxWidth = "fit-content";
|
|
32
|
+
this.innerClickTest = (_popOvercontainer, node, eventOrigin) => {
|
|
33
|
+
const innerContainers = [_popOvercontainer];
|
|
34
|
+
if (this.innerElement) {
|
|
35
|
+
if (typeof (this.innerElement) == "string") {
|
|
36
|
+
innerContainers.push(document.querySelector(`#${this.innerElement}`));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.innerElement.forEach(comp => {
|
|
40
|
+
innerContainers.push(document.querySelector(`#${comp}`));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (var i = 0; i < innerContainers.length; i++) {
|
|
45
|
+
let _container = innerContainers[i];
|
|
46
|
+
if (_container != undefined) {
|
|
47
|
+
if (_container.contains(node)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (eventOrigin && "nodeType" in (eventOrigin === null || eventOrigin === void 0 ? void 0 : eventOrigin.target) && _container.contains(eventOrigin.target)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
_container = this._host;
|
|
57
|
+
if (!_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
64
|
+
this.backClickListener = () => {
|
|
65
|
+
this.ezVisibilityChange.emit(false);
|
|
66
|
+
};
|
|
32
67
|
}
|
|
33
68
|
dispatchVisibilityChange(newValue, oldValue) {
|
|
34
69
|
if (newValue != oldValue) {
|
|
@@ -45,16 +80,8 @@ export class EzPopover {
|
|
|
45
80
|
left,
|
|
46
81
|
bottom,
|
|
47
82
|
right,
|
|
48
|
-
innerClickTest:
|
|
49
|
-
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
_container = this._host;
|
|
56
|
-
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
57
|
-
}
|
|
83
|
+
innerClickTest: this.innerClickTest,
|
|
84
|
+
backClickListener: this.backClickListener
|
|
58
85
|
};
|
|
59
86
|
FloatingManager.updateFloatPosition(this._box, this._container, floatingOptions);
|
|
60
87
|
}
|
|
@@ -68,16 +95,8 @@ export class EzPopover {
|
|
|
68
95
|
left,
|
|
69
96
|
bottom,
|
|
70
97
|
right,
|
|
71
|
-
innerClickTest:
|
|
72
|
-
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
_container = this._host;
|
|
79
|
-
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
80
|
-
}
|
|
98
|
+
innerClickTest: this.innerClickTest,
|
|
99
|
+
backClickListener: this.backClickListener
|
|
81
100
|
};
|
|
82
101
|
this._floatingID = FloatingManager.float(this._box, this._container, floatingOptions);
|
|
83
102
|
this.opened = true;
|
|
@@ -101,7 +120,7 @@ export class EzPopover {
|
|
|
101
120
|
render() {
|
|
102
121
|
return (h(Host, null,
|
|
103
122
|
h("section", { ref: el => this._container = el },
|
|
104
|
-
h("div", { class: `
|
|
123
|
+
h("div", { class: `popover__box ${this.boxWidth === "fit-content" ? "popover__box--fit-content" : "popover__box--full-width"}`, ref: el => this._box = el },
|
|
105
124
|
h("slot", null)))));
|
|
106
125
|
}
|
|
107
126
|
static get is() { return "ez-popover"; }
|
|
@@ -237,6 +256,27 @@ export class EzPopover {
|
|
|
237
256
|
},
|
|
238
257
|
"attribute": "opened",
|
|
239
258
|
"reflect": true
|
|
259
|
+
},
|
|
260
|
+
"innerElement": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"mutable": true,
|
|
263
|
+
"complexType": {
|
|
264
|
+
"original": "Array<string> | string",
|
|
265
|
+
"resolved": "string | string[]",
|
|
266
|
+
"references": {
|
|
267
|
+
"Array": {
|
|
268
|
+
"location": "global"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": false,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": "Array de componente(s) que ir\u00E1(\u00E3o) abrir o popover."
|
|
277
|
+
},
|
|
278
|
+
"attribute": "inner-element",
|
|
279
|
+
"reflect": true
|
|
240
280
|
}
|
|
241
281
|
}; }
|
|
242
282
|
static get events() { return [{
|
|
@@ -247,7 +287,7 @@ export class EzPopover {
|
|
|
247
287
|
"composed": true,
|
|
248
288
|
"docs": {
|
|
249
289
|
"tags": [],
|
|
250
|
-
"text": "
|
|
290
|
+
"text": "\nEvento disparado ao exibir/ocultar o componente."
|
|
251
291
|
},
|
|
252
292
|
"complexType": {
|
|
253
293
|
"original": "boolean",
|
|
@@ -275,9 +315,6 @@ export class EzPopover {
|
|
|
275
315
|
"references": {
|
|
276
316
|
"Promise": {
|
|
277
317
|
"location": "global"
|
|
278
|
-
},
|
|
279
|
-
"HTMLElement": {
|
|
280
|
-
"location": "global"
|
|
281
318
|
}
|
|
282
319
|
},
|
|
283
320
|
"return": "Promise<void>"
|
|
@@ -306,9 +343,6 @@ export class EzPopover {
|
|
|
306
343
|
"references": {
|
|
307
344
|
"Promise": {
|
|
308
345
|
"location": "global"
|
|
309
|
-
},
|
|
310
|
-
"HTMLElement": {
|
|
311
|
-
"location": "global"
|
|
312
346
|
}
|
|
313
347
|
},
|
|
314
348
|
"return": "Promise<void>"
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { Component, h, Prop,
|
|
1
|
+
import { Component, h, Method, Prop, Host, forceUpdate } from '@stencil/core';
|
|
2
2
|
export class EzToast {
|
|
3
3
|
constructor() {
|
|
4
|
+
this._nextMessages = [];
|
|
5
|
+
this._currentMessageInfo = { message: "", fadeTime: undefined, useIcon: undefined };
|
|
6
|
+
this._toastOpenedClass = "toast__container--opened";
|
|
7
|
+
this._lastTimeOut = undefined;
|
|
4
8
|
this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
|
|
5
9
|
/**
|
|
6
10
|
* Controla o tempo de exibição do componente em milissegundos.
|
|
@@ -18,21 +22,61 @@ export class EzToast {
|
|
|
18
22
|
/**
|
|
19
23
|
* Exibe o componente na tela.
|
|
20
24
|
*/
|
|
21
|
-
async show() {
|
|
22
|
-
|
|
25
|
+
async show(message, fadeTime, useIcon, canClose) {
|
|
26
|
+
return new Promise(resolve => {
|
|
27
|
+
var _a;
|
|
28
|
+
if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
|
|
29
|
+
this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this._currentMessageInfo.message = message || this.message;
|
|
33
|
+
this._currentMessageInfo.fadeTime = fadeTime || this.fadeTime;
|
|
34
|
+
this._currentMessageInfo.useIcon = useIcon || this.useIcon;
|
|
35
|
+
this._currentMessageInfo.callBack = resolve;
|
|
36
|
+
if (canClose) {
|
|
37
|
+
this._currentMessageInfo.canClose = this.canClose;
|
|
38
|
+
}
|
|
39
|
+
forceUpdate(this);
|
|
40
|
+
this.displayToast();
|
|
41
|
+
this._lastTimeOut = setTimeout(() => {
|
|
42
|
+
this.hideToast();
|
|
43
|
+
}, this._currentMessageInfo.fadeTime + 400);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
hideToast() {
|
|
48
|
+
this.makeToastInvisible();
|
|
49
|
+
if (this._nextMessages.length > 0) {
|
|
50
|
+
if (this._currentMessageInfo.callBack) {
|
|
51
|
+
this._currentMessageInfo.callBack(true);
|
|
52
|
+
}
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
let newMessageInfo = this._nextMessages.shift();
|
|
55
|
+
this.show(newMessageInfo.message, newMessageInfo.fadeTime, newMessageInfo.useIcon);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (this._currentMessageInfo.callBack) {
|
|
59
|
+
this._currentMessageInfo.callBack(true);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
makeToastInvisible() {
|
|
63
|
+
this.container.classList.remove(this._toastOpenedClass);
|
|
64
|
+
this.container.style.animation = `none`;
|
|
65
|
+
if (this._lastTimeOut)
|
|
66
|
+
clearTimeout(this._lastTimeOut);
|
|
67
|
+
}
|
|
68
|
+
displayToast() {
|
|
69
|
+
this.container.classList.add(this._toastOpenedClass);
|
|
23
70
|
this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
|
|
24
|
-
setTimeout(() => {
|
|
25
|
-
this.container.classList.remove("toast__container--oppened");
|
|
26
|
-
this.container.style.animation = `none`;
|
|
27
|
-
}, this.fadeTime + 400);
|
|
28
71
|
}
|
|
29
72
|
render() {
|
|
30
|
-
return (h(
|
|
31
|
-
this.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
73
|
+
return (h(Host, null,
|
|
74
|
+
h("div", { ref: (el) => this.container = el, class: "toast__container" },
|
|
75
|
+
this._currentMessageInfo.useIcon &&
|
|
76
|
+
h("slot", { name: "icon" }),
|
|
77
|
+
h("div", { lang: this._lang, class: this._currentMessageInfo.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this._currentMessageInfo.message, innerHTML: this._currentMessageInfo.message }),
|
|
78
|
+
this._currentMessageInfo.canClose &&
|
|
79
|
+
h("button", { class: "btn-close", onClick: () => { this.hideToast(); } }))));
|
|
36
80
|
}
|
|
37
81
|
static get is() { return "ez-toast"; }
|
|
38
82
|
static get encapsulation() { return "shadow"; }
|
|
@@ -118,14 +162,26 @@ export class EzToast {
|
|
|
118
162
|
static get methods() { return {
|
|
119
163
|
"show": {
|
|
120
164
|
"complexType": {
|
|
121
|
-
"signature": "() => Promise<
|
|
122
|
-
"parameters": [
|
|
165
|
+
"signature": "(message: string, fadeTime: number, useIcon: boolean, canClose?: boolean) => Promise<unknown>",
|
|
166
|
+
"parameters": [{
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
}, {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
}, {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
}, {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": ""
|
|
178
|
+
}],
|
|
123
179
|
"references": {
|
|
124
180
|
"Promise": {
|
|
125
181
|
"location": "global"
|
|
126
182
|
}
|
|
127
183
|
},
|
|
128
|
-
"return": "Promise<
|
|
184
|
+
"return": "Promise<unknown>"
|
|
129
185
|
},
|
|
130
186
|
"docs": {
|
|
131
187
|
"text": "Exibe o componente na tela.",
|
|
@@ -47,16 +47,20 @@ export class TestDu {
|
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
49
|
};
|
|
50
|
-
this.dataUnit.dataLoader = () => new Promise(accept => accept(
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
this.dataUnit.dataLoader = () => new Promise(accept => accept({
|
|
51
|
+
records: [{
|
|
52
|
+
__record__id__: "1321321321321321",
|
|
53
|
+
CODPARC: 10,
|
|
54
|
+
NOMEPARC: "Parceiro 10",
|
|
55
|
+
P: "M",
|
|
56
|
+
L: "Bagaço",
|
|
57
|
+
LI: "Azedo"
|
|
58
|
+
}],
|
|
59
|
+
limit: 0,
|
|
60
|
+
offset: 2,
|
|
61
|
+
total: 100,
|
|
62
|
+
hasMore: true
|
|
63
|
+
}));
|
|
60
64
|
}
|
|
61
65
|
render() {
|
|
62
66
|
return (h("ez-form", { dataUnit: this.dataUnit }));
|
|
@@ -24,10 +24,7 @@ export default class ApplicationUtils {
|
|
|
24
24
|
toast = document.createElement("ez-toast");
|
|
25
25
|
window.document.body.appendChild(toast);
|
|
26
26
|
}
|
|
27
|
-
toast.
|
|
28
|
-
toast.message = message;
|
|
29
|
-
toast.fadeTime = 4000;
|
|
30
|
-
toast.show();
|
|
27
|
+
toast.show(message, 4000, false, options.canClose);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
ApplicationUtils.defaultMessageOptions = {
|