@sankhyalabs/ezui 1.1.124 → 1.1.127
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/{CSSVarsUtils-8fbdf2e0.js → CSSVarsUtils-1034b7b6.js} +2 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +22 -9
- package/dist/cjs/ez-combo-box.cjs.entry.js +7 -3
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +7 -4
- package/dist/cjs/ez-grid.cjs.entry.js +112 -22
- package/dist/cjs/ez-list.cjs.entry.js +6 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +13 -3
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/grid-config.cjs.entry.js +167 -31
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/select-box.cjs.entry.js +1 -1
- package/dist/collection/components/ez-check/ez-check.js +1 -1
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +91 -83
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +49 -18
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +6 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +23 -1
- package/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/collection/components/ez-form/structure/FormItem.js +1 -1
- package/dist/collection/components/ez-form/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +4 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +38 -18
- package/dist/collection/components/ez-grid/ez-grid.js +117 -7
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +190 -37
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +3 -3
- package/dist/collection/components/ez-list/ez-list.js +23 -1
- package/dist/collection/components/ez-text-area/ez-text-area.js +15 -4
- package/dist/collection/components/ez-text-input/ez-text-input.css +4 -0
- package/dist/collection/utils/CSSVarsUtils.js +2 -0
- package/dist/custom-elements/index.js +341 -77
- package/dist/esm/{CSSVarsUtils-667e0016.js → CSSVarsUtils-eb4c5af6.js} +2 -0
- package/dist/esm/ez-collapsible-box.entry.js +23 -10
- package/dist/esm/ez-combo-box.entry.js +7 -3
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-filter-input.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +7 -4
- package/dist/esm/ez-grid.entry.js +112 -22
- package/dist/esm/ez-list.entry.js +6 -0
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +13 -3
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/grid-config.entry.js +167 -31
- package/dist/esm/loader.js +1 -1
- package/dist/esm/select-box.entry.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-4262a462.entry.js → p-248d8511.entry.js} +1 -1
- package/dist/ezui/p-35edc488.entry.js +1 -0
- package/dist/ezui/{p-2d894fed.entry.js → p-5821c335.entry.js} +1 -1
- package/dist/ezui/p-5a9ab4f7.entry.js +1 -0
- package/dist/ezui/{p-e62f5c77.entry.js → p-5f725a93.entry.js} +1 -1
- package/dist/ezui/p-7d5657c7.entry.js +1 -0
- package/dist/ezui/p-7d5b2ebf.entry.js +1 -0
- package/dist/ezui/p-7f87f762.entry.js +1 -0
- package/dist/ezui/p-933a7475.js +1 -0
- package/dist/ezui/p-b59ab2d5.entry.js +1 -0
- package/dist/ezui/{p-1db59c89.entry.js → p-c6b2b2e5.entry.js} +1 -1
- package/dist/ezui/{p-0927092b.entry.js → p-cbfb94cb.entry.js} +1 -1
- package/dist/ezui/p-cf8309fc.entry.js +1 -0
- package/dist/ezui/{p-5e989ecf.entry.js → p-ec205792.entry.js} +1 -1
- package/dist/ezui/{p-8543a1b3.entry.js → p-ed1e0331.entry.js} +1 -1
- package/dist/ezui/{p-28ce145e.entry.js → p-f65302bb.entry.js} +1 -1
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +12 -3
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +35 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +3 -3
- package/dist/types/components/ez-grid/ez-grid.d.ts +14 -3
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +10 -4
- package/dist/types/components/ez-list/ez-list.d.ts +5 -0
- package/dist/types/components.d.ts +44 -10
- package/package.json +3 -3
- package/dist/ezui/p-0965bcae.entry.js +0 -1
- package/dist/ezui/p-46d1340b.entry.js +0 -1
- package/dist/ezui/p-6745931a.entry.js +0 -1
- package/dist/ezui/p-91e51dc9.entry.js +0 -1
- package/dist/ezui/p-9a9b2936.entry.js +0 -1
- package/dist/ezui/p-a44dcc62.entry.js +0 -1
- package/dist/ezui/p-c621cab9.entry.js +0 -1
- package/dist/ezui/p-d54c157f.js +0 -1
|
@@ -1,39 +1,52 @@
|
|
|
1
|
-
import { Component, h,
|
|
1
|
+
import { Component, h, Prop, Event, Watch, Method } from "@stencil/core";
|
|
2
2
|
export class EzCollapsibleBox {
|
|
3
3
|
constructor() {
|
|
4
4
|
/**
|
|
5
|
-
* Valor externalizado que garante a exibição ou não do componente
|
|
5
|
+
* Valor externalizado que garante a exibição ou não do componente.
|
|
6
6
|
*/
|
|
7
7
|
this.value = false;
|
|
8
8
|
/**
|
|
9
9
|
* Define o tamanho do texto e do ícone do componente.
|
|
10
|
+
* Tamanhos suportados: "x-small", "small", "medium", "large" e "x-large".
|
|
10
11
|
*/
|
|
11
12
|
this.headerSize = "small";
|
|
12
13
|
/**
|
|
13
14
|
* Define o local onde o ícone será renderizado.
|
|
14
15
|
*/
|
|
15
16
|
this.iconPlacement = "left";
|
|
17
|
+
/**
|
|
18
|
+
* Define se o titulo irá ocupar toda a largura do componente.
|
|
19
|
+
*/
|
|
20
|
+
this.stretchTitle = false;
|
|
16
21
|
}
|
|
17
|
-
|
|
22
|
+
observeCollapsedValue() {
|
|
18
23
|
this.ezChange.emit(this.value);
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
* Esconde ou revela o conteúdo do componente
|
|
26
|
+
* Esconde ou revela o conteúdo do componente.
|
|
22
27
|
*/
|
|
23
28
|
async showHide() {
|
|
24
29
|
this.value = !this.value;
|
|
25
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Retorna o tamanho configurado do texto e do ícone.
|
|
33
|
+
*/
|
|
34
|
+
getHeaderSize() {
|
|
35
|
+
const sizeAlias = ["xsmall", "xlarge"];
|
|
36
|
+
const sizeList = ["x-small", "small", "medium", "large", "x-large"];
|
|
37
|
+
const headerSize = sizeAlias.includes(this.headerSize) ? this.headerSize.replace('x', 'x-') : this.headerSize;
|
|
38
|
+
return sizeList.includes(headerSize) ? headerSize : "small";
|
|
39
|
+
}
|
|
26
40
|
render() {
|
|
27
|
-
return (h(
|
|
28
|
-
|
|
29
|
-
h("
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
h("
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
!this.value ? h("slot", null) : null));
|
|
41
|
+
return (h("div", { class: "collapsible-box" },
|
|
42
|
+
h("div", { class: "collapsible-box__header" },
|
|
43
|
+
h("button", { onClick: () => this.showHide(), class: "collapsible-box__title" +
|
|
44
|
+
(this.iconPlacement === "right" ? " collapsible-box__title--icon-right" : "") +
|
|
45
|
+
(this.stretchTitle ? " collapsible-box__title--stretched" : "") },
|
|
46
|
+
h("ez-icon", { slot: "icon", "icon-name": "chevron-right", size: this.getHeaderSize(), class: "collapsible-box__icon collapsible-box__icon--" + this.getHeaderSize() + (this.value ? " collapsible-box__icon--collapsed" : "") }),
|
|
47
|
+
h("label", { class: "collapsible-box__label font--" + this.getHeaderSize(), title: this.label }, this.label))),
|
|
48
|
+
h("div", { class: "collapsible-box__content" + (this.value ? "" : " collapsible-box__content--show") },
|
|
49
|
+
h("slot", null))));
|
|
37
50
|
}
|
|
38
51
|
static get is() { return "ez-collapsible-box"; }
|
|
39
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -56,7 +69,7 @@ export class EzCollapsibleBox {
|
|
|
56
69
|
"optional": false,
|
|
57
70
|
"docs": {
|
|
58
71
|
"tags": [],
|
|
59
|
-
"text": "Valor externalizado que garante a exibi\u00E7\u00E3o ou n\u00E3o do componente"
|
|
72
|
+
"text": "Valor externalizado que garante a exibi\u00E7\u00E3o ou n\u00E3o do componente."
|
|
60
73
|
},
|
|
61
74
|
"attribute": "value",
|
|
62
75
|
"reflect": true,
|
|
@@ -91,7 +104,7 @@ export class EzCollapsibleBox {
|
|
|
91
104
|
"optional": false,
|
|
92
105
|
"docs": {
|
|
93
106
|
"tags": [],
|
|
94
|
-
"text": "Define o tamanho do texto e do \u00EDcone do componente."
|
|
107
|
+
"text": "Define o tamanho do texto e do \u00EDcone do componente.\nTamanhos suportados: \"x-small\", \"small\", \"medium\", \"large\" e \"x-large\"."
|
|
95
108
|
},
|
|
96
109
|
"attribute": "header-size",
|
|
97
110
|
"reflect": true,
|
|
@@ -114,6 +127,24 @@ export class EzCollapsibleBox {
|
|
|
114
127
|
"attribute": "icon-placement",
|
|
115
128
|
"reflect": true,
|
|
116
129
|
"defaultValue": "\"left\""
|
|
130
|
+
},
|
|
131
|
+
"stretchTitle": {
|
|
132
|
+
"type": "boolean",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "boolean",
|
|
136
|
+
"resolved": "boolean",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": "Define se o titulo ir\u00E1 ocupar toda a largura do componente."
|
|
144
|
+
},
|
|
145
|
+
"attribute": "stretch-title",
|
|
146
|
+
"reflect": true,
|
|
147
|
+
"defaultValue": "false"
|
|
117
148
|
}
|
|
118
149
|
}; }
|
|
119
150
|
static get events() { return [{
|
|
@@ -145,13 +176,13 @@ export class EzCollapsibleBox {
|
|
|
145
176
|
"return": "Promise<void>"
|
|
146
177
|
},
|
|
147
178
|
"docs": {
|
|
148
|
-
"text": "Esconde ou revela o conte\u00FAdo do componente",
|
|
179
|
+
"text": "Esconde ou revela o conte\u00FAdo do componente.",
|
|
149
180
|
"tags": []
|
|
150
181
|
}
|
|
151
182
|
}
|
|
152
183
|
}; }
|
|
153
184
|
static get watchers() { return [{
|
|
154
185
|
"propName": "value",
|
|
155
|
-
"methodName": "
|
|
186
|
+
"methodName": "observeCollapsedValue"
|
|
156
187
|
}]; }
|
|
157
188
|
}
|
|
@@ -89,6 +89,12 @@
|
|
|
89
89
|
width: var(--ez-combo-box--width);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
.suppressed-search-input{
|
|
93
|
+
--ez-text-input__input--border-color: var(--color--strokes, #dce0e8);
|
|
94
|
+
--ez-text-input__input--disabled--background-color: var(--background--xlight, #fff);
|
|
95
|
+
--ez-text-input__input--disabled--color: var(--title--primary, #000);
|
|
96
|
+
}
|
|
97
|
+
|
|
92
98
|
.list-container {
|
|
93
99
|
position: relative;
|
|
94
100
|
width: 100%;
|
|
@@ -15,6 +15,10 @@ export class EzComboBox {
|
|
|
15
15
|
* Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
|
|
16
16
|
*/
|
|
17
17
|
this.showOptionValue = false;
|
|
18
|
+
/**
|
|
19
|
+
* Desabilita a digitação dentro do componente.
|
|
20
|
+
*/
|
|
21
|
+
this.suppressSearch = false;
|
|
18
22
|
/**
|
|
19
23
|
* Remove a opção vazia da lista de opções
|
|
20
24
|
*/
|
|
@@ -266,7 +270,7 @@ export class EzComboBox {
|
|
|
266
270
|
}
|
|
267
271
|
render() {
|
|
268
272
|
return (h(Host, null,
|
|
269
|
-
h("ez-text-input", { ref: elem => this._inputElement = elem, enabled: this.enabled, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, this.searchMode ?
|
|
273
|
+
h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._inputElement = elem, enabled: this.enabled && !this.suppressSearch, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, this.searchMode ?
|
|
270
274
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-search", onClick: () => { this.loadOptions("ADVANCED"); }, slot: "leftIcon" })
|
|
271
275
|
:
|
|
272
276
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })),
|
|
@@ -430,6 +434,24 @@ export class EzComboBox {
|
|
|
430
434
|
"reflect": false,
|
|
431
435
|
"defaultValue": "false"
|
|
432
436
|
},
|
|
437
|
+
"suppressSearch": {
|
|
438
|
+
"type": "boolean",
|
|
439
|
+
"mutable": false,
|
|
440
|
+
"complexType": {
|
|
441
|
+
"original": "boolean",
|
|
442
|
+
"resolved": "boolean",
|
|
443
|
+
"references": {}
|
|
444
|
+
},
|
|
445
|
+
"required": false,
|
|
446
|
+
"optional": false,
|
|
447
|
+
"docs": {
|
|
448
|
+
"tags": [],
|
|
449
|
+
"text": "Desabilita a digita\u00E7\u00E3o dentro do componente."
|
|
450
|
+
},
|
|
451
|
+
"attribute": "suppress-search",
|
|
452
|
+
"reflect": false,
|
|
453
|
+
"defaultValue": "false"
|
|
454
|
+
},
|
|
433
455
|
"optionLoader": {
|
|
434
456
|
"type": "unknown",
|
|
435
457
|
"mutable": false,
|
|
@@ -3,7 +3,7 @@ import { buildField } from "../fieldbuilder/FieldBuilder";
|
|
|
3
3
|
export const FormItem = ({ source }) => {
|
|
4
4
|
if ("items" in source) {
|
|
5
5
|
const fieldSet = source;
|
|
6
|
-
return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
|
|
6
|
+
return h("ez-collapsible-box", { label: source.label, "header-size": "large" }, fieldSet.items.map(fi => buildField(fi)));
|
|
7
7
|
}
|
|
8
8
|
else {
|
|
9
9
|
return buildField(source);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { FormItem } from "./FormItem";
|
|
3
3
|
export const FormSheet = ({ store, source }) => {
|
|
4
|
-
return (h("div", { class: "box__container" },
|
|
4
|
+
return (h("div", { class: "dynamic-content box__container" },
|
|
5
5
|
h("div", { class: "row padding-vertical--small" }, source.items.map(item => h(FormItem, { store: store, source: item })))));
|
|
6
6
|
};
|
|
@@ -46,6 +46,9 @@ function getTabConfig(tab, sheets) {
|
|
|
46
46
|
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
47
47
|
return tabConfig || { label: tab, visible: true };
|
|
48
48
|
}
|
|
49
|
+
function sortTabs(a, b) {
|
|
50
|
+
return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
51
|
+
}
|
|
49
52
|
export const buildFromConfig = (fields, dataUnit) => {
|
|
50
53
|
const sheets = new Map();
|
|
51
54
|
const requiredFields = [];
|
|
@@ -87,7 +90,7 @@ export const buildFromConfig = (fields, dataUnit) => {
|
|
|
87
90
|
});
|
|
88
91
|
const metadata = new FormMetadata();
|
|
89
92
|
Array.from(sheets.entries())
|
|
90
|
-
.sort(
|
|
93
|
+
.sort(sortTabs)
|
|
91
94
|
.forEach(([key, value]) => {
|
|
92
95
|
metadata.addSheet({
|
|
93
96
|
label: key.label,
|
|
@@ -44,6 +44,7 @@ export default class AgGridController {
|
|
|
44
44
|
serverSideStoreType: "partial",
|
|
45
45
|
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
46
46
|
serverSideDatasource: this._dataSource,
|
|
47
|
+
sortingOrder: ['desc', 'asc', null],
|
|
47
48
|
getRowNodeId: (params) => typeof params === "string" ? params : params[this._idAttribName],
|
|
48
49
|
getMainMenuItems: (params) => {
|
|
49
50
|
const column = params.column;
|
|
@@ -83,6 +84,7 @@ export default class AgGridController {
|
|
|
83
84
|
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
84
85
|
opt.onPaginationChanged = () => this.onPaginationChange();
|
|
85
86
|
opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
|
|
87
|
+
opt.onDragStopped = evt => this.onCallStateChange("columnMovedEnd", evt);
|
|
86
88
|
opt.onViewportChanged = () => {
|
|
87
89
|
if (this._dataUnit) {
|
|
88
90
|
this.selectRows(this._dataUnit.getSelection());
|
|
@@ -170,6 +172,7 @@ export default class AgGridController {
|
|
|
170
172
|
const colDefs = [];
|
|
171
173
|
if (showCheckSelection) {
|
|
172
174
|
colDefs.push({
|
|
175
|
+
colId: "checkBoxColumn",
|
|
173
176
|
headerName: "",
|
|
174
177
|
checkboxSelection: true,
|
|
175
178
|
headerCheckboxSelection: false,
|
|
@@ -207,13 +210,24 @@ export default class AgGridController {
|
|
|
207
210
|
if (this._grid === undefined) {
|
|
208
211
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
209
212
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
let columns = this.getColumnsDef();
|
|
214
|
+
let visibleColumns = [];
|
|
215
|
+
let sort = [];
|
|
216
|
+
state.forEach((cfgColumn, index) => {
|
|
217
|
+
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + 1);
|
|
218
|
+
this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, cfgColumn.width);
|
|
219
|
+
visibleColumns.push(cfgColumn.name);
|
|
220
|
+
if (cfgColumn.ascending !== undefined) {
|
|
221
|
+
sort.push({ colId: cfgColumn.name, sort: cfgColumn.ascending !== true ? 'desc' : 'asc', sortIndex: cfgColumn.orderIndex });
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
let invisibleColumns = columns.filter(column => !visibleColumns.includes(column.name)).map(column => column.name);
|
|
225
|
+
this._gridOptions.columnApi.setColumnsVisible(visibleColumns, true);
|
|
226
|
+
this._gridOptions.columnApi.setColumnsVisible(invisibleColumns, false);
|
|
227
|
+
this._gridOptions.columnApi.applyColumnState({
|
|
228
|
+
state: sort,
|
|
229
|
+
defaultState: { sort: null },
|
|
230
|
+
});
|
|
217
231
|
}
|
|
218
232
|
getColumnsState() {
|
|
219
233
|
if (this._grid === undefined) {
|
|
@@ -306,21 +320,27 @@ export default class AgGridController {
|
|
|
306
320
|
}
|
|
307
321
|
}
|
|
308
322
|
}
|
|
309
|
-
buildColState(source) {
|
|
310
|
-
return {
|
|
311
|
-
colId: source.name,
|
|
312
|
-
sort: source.sort,
|
|
313
|
-
sortIndex: source.sortIndex,
|
|
314
|
-
width: source.width,
|
|
315
|
-
pinned: source.pinned ? "left" : null,
|
|
316
|
-
hide: source.hidden
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
323
|
onCallStateChange(type, e) {
|
|
320
324
|
const finished = !("finished" in e) || e["finished"];
|
|
321
325
|
if (finished && this._columnStateChangeCallback) {
|
|
322
|
-
|
|
326
|
+
let info = {};
|
|
327
|
+
let isUserChange = this.isUIEvent(e['source'], e['type']);
|
|
328
|
+
if (type === 'columnResize') {
|
|
329
|
+
info['column'] = { colId: e['column'].colId, actualWidth: e['column'].actualWidth };
|
|
330
|
+
}
|
|
331
|
+
info['isUserChange'] = isUserChange;
|
|
332
|
+
this._columnStateChangeCallback(type, this.getColumnsState(), info);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
isUIEvent(source, type) {
|
|
336
|
+
let optionsArr = ["uiColumnMoved", "uiColumnResized", "uiColumnDragged", "uiColumnExpanded", "uiColumnSorted"];
|
|
337
|
+
if (type === 'dragStopped') {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
if (source) {
|
|
341
|
+
return optionsArr.includes(source);
|
|
323
342
|
}
|
|
343
|
+
return false;
|
|
324
344
|
}
|
|
325
345
|
onSelectionChange(e) {
|
|
326
346
|
if (this._selectionChangeCallback) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, Host, Prop, Method, Event, State } from "@stencil/core";
|
|
1
|
+
import { Component, h, Host, Prop, Method, Event, State, Watch } from "@stencil/core";
|
|
2
2
|
import AgGridController from "./controller/ag-grid/AgGridController";
|
|
3
3
|
import DataUnitBridge from "./controller/DataUnitBridge";
|
|
4
4
|
export class EzGrid {
|
|
@@ -72,9 +72,72 @@ export class EzGrid {
|
|
|
72
72
|
addEventListener("ezSelectionChange", (evt) => this.dataUnit.setSelection(evt.detail.map((r) => r.__record__id__)));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
onColumnStateChange(type, state, info) {
|
|
76
|
+
var _a;
|
|
77
|
+
this.ezColumnStateChange.emit({ type, state, isUserChange: info.isUserChange });
|
|
78
|
+
if (info.isUserChange) {
|
|
79
|
+
if (type === 'columnMovedEnd') {
|
|
80
|
+
let newConfig;
|
|
81
|
+
if (this.config) {
|
|
82
|
+
newConfig = { columns: [] };
|
|
83
|
+
state.forEach(columnState => {
|
|
84
|
+
let newConfigColumn = this.config.columns.find(column => column.name === columnState.name);
|
|
85
|
+
if (newConfigColumn) {
|
|
86
|
+
newConfigColumn.width = columnState.width;
|
|
87
|
+
newConfig.columns.push(newConfigColumn);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
newConfig = this.createConfigFromState(state);
|
|
93
|
+
}
|
|
94
|
+
if (newConfig.columns.length > 0) {
|
|
95
|
+
this.configChange.emit(newConfig);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (type === 'columnResize') {
|
|
99
|
+
if ((_a = info.column) === null || _a === void 0 ? void 0 : _a.colId) {
|
|
100
|
+
let newConfig;
|
|
101
|
+
if (this.config) {
|
|
102
|
+
newConfig = Object.assign({}, this.config);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
newConfig = this.createConfigFromState(state);
|
|
106
|
+
}
|
|
107
|
+
let newColumn = newConfig.columns.find(column => column.name === info.column.colId);
|
|
108
|
+
if (newColumn) {
|
|
109
|
+
newColumn.width = info.column.actualWidth;
|
|
110
|
+
this.configChange.emit(newConfig);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
createConfigFromState(state) {
|
|
117
|
+
let newConfig = { columns: [] };
|
|
118
|
+
state.forEach(columnState => {
|
|
119
|
+
if (!columnState.hidden) {
|
|
120
|
+
let newConfigColumn = { name: columnState.name };
|
|
121
|
+
if (columnState.width) {
|
|
122
|
+
newConfigColumn['width'] = columnState.width;
|
|
123
|
+
}
|
|
124
|
+
if (columnState.sort) {
|
|
125
|
+
newConfigColumn['ascending'] = (columnState.sort.toUpperCase() === 'ASC');
|
|
126
|
+
newConfigColumn['orderIndex'] = columnState.sortIndex;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
newConfigColumn['orderIndex'] = 0;
|
|
130
|
+
}
|
|
131
|
+
if (newConfigColumn) {
|
|
132
|
+
newConfig.columns.push(newConfigColumn);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return newConfig;
|
|
137
|
+
}
|
|
75
138
|
componentDidLoad() {
|
|
76
139
|
this._gridController.initDatagrid(this._container, {
|
|
77
|
-
onColumnStateChange: (type, state) => this.
|
|
140
|
+
onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
|
|
78
141
|
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
79
142
|
onPaginationChange: (status) => {
|
|
80
143
|
this._navigationHasPrevious = status.hasPrevious;
|
|
@@ -94,6 +157,9 @@ export class EzGrid {
|
|
|
94
157
|
if (this._dataUnitBridge) {
|
|
95
158
|
this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
|
|
96
159
|
}
|
|
160
|
+
if (this.config) {
|
|
161
|
+
this.applyConfig(this.config);
|
|
162
|
+
}
|
|
97
163
|
}
|
|
98
164
|
disconnectedCallback() {
|
|
99
165
|
if (this._dataUnitBridge) {
|
|
@@ -112,8 +178,8 @@ export class EzGrid {
|
|
|
112
178
|
h("ez-button", { size: "small", iconName: "chevron-right", class: "margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this._gridController.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
|
|
113
179
|
];
|
|
114
180
|
}
|
|
115
|
-
applyConfig(
|
|
116
|
-
this._gridController.setColumnsState(
|
|
181
|
+
applyConfig(config) {
|
|
182
|
+
this._gridController.setColumnsState(config.columns);
|
|
117
183
|
this.closeConfig();
|
|
118
184
|
}
|
|
119
185
|
closeConfig() {
|
|
@@ -135,7 +201,7 @@ export class EzGrid {
|
|
|
135
201
|
h("div", { class: "grid__container ag-sankhya-theme", ref: elem => this._container = elem }),
|
|
136
202
|
h("div", { class: "grid__footer" }),
|
|
137
203
|
h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false },
|
|
138
|
-
h("grid-config", { ref: ref => this._gridConfig = ref, selectedTab: "Colunas", onConfigFinish: evt => this.applyConfig(evt.detail), onConfigCancel: _evt => this.closeConfig() }))));
|
|
204
|
+
h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeConfig() }))));
|
|
139
205
|
}
|
|
140
206
|
static get is() { return "ez-grid"; }
|
|
141
207
|
static get encapsulation() { return "scoped"; }
|
|
@@ -164,6 +230,26 @@ export class EzGrid {
|
|
|
164
230
|
"attribute": "multiple-selection",
|
|
165
231
|
"reflect": false
|
|
166
232
|
},
|
|
233
|
+
"config": {
|
|
234
|
+
"type": "unknown",
|
|
235
|
+
"mutable": true,
|
|
236
|
+
"complexType": {
|
|
237
|
+
"original": "EzGridConfig",
|
|
238
|
+
"resolved": "EzGridConfig",
|
|
239
|
+
"references": {
|
|
240
|
+
"EzGridConfig": {
|
|
241
|
+
"location": "import",
|
|
242
|
+
"path": "./controller/EzGridController"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "Configura\u00E7\u00E3o de exibi\u00E7\u00E3o da grade."
|
|
251
|
+
}
|
|
252
|
+
},
|
|
167
253
|
"pageSize": {
|
|
168
254
|
"type": "number",
|
|
169
255
|
"mutable": false,
|
|
@@ -282,6 +368,26 @@ export class EzGrid {
|
|
|
282
368
|
"resolved": "any",
|
|
283
369
|
"references": {}
|
|
284
370
|
}
|
|
371
|
+
}, {
|
|
372
|
+
"method": "configChange",
|
|
373
|
+
"name": "configChange",
|
|
374
|
+
"bubbles": true,
|
|
375
|
+
"cancelable": true,
|
|
376
|
+
"composed": true,
|
|
377
|
+
"docs": {
|
|
378
|
+
"tags": [],
|
|
379
|
+
"text": "Evento disparado ao realizar alguma modifica\u00E7\u00E3o na configura\u00E7\u00E3o da grid."
|
|
380
|
+
},
|
|
381
|
+
"complexType": {
|
|
382
|
+
"original": "EzGridConfig",
|
|
383
|
+
"resolved": "EzGridConfig",
|
|
384
|
+
"references": {
|
|
385
|
+
"EzGridConfig": {
|
|
386
|
+
"location": "import",
|
|
387
|
+
"path": "./controller/EzGridController"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
285
391
|
}]; }
|
|
286
392
|
static get methods() { return {
|
|
287
393
|
"setColumnsDef": {
|
|
@@ -340,7 +446,7 @@ export class EzGrid {
|
|
|
340
446
|
},
|
|
341
447
|
"setColumnsState": {
|
|
342
448
|
"complexType": {
|
|
343
|
-
"signature": "(state: Array<
|
|
449
|
+
"signature": "(state: Array<EzGridColumnConfig>) => Promise<any>",
|
|
344
450
|
"parameters": [{
|
|
345
451
|
"tags": [],
|
|
346
452
|
"text": ""
|
|
@@ -352,7 +458,7 @@ export class EzGrid {
|
|
|
352
458
|
"Array": {
|
|
353
459
|
"location": "global"
|
|
354
460
|
},
|
|
355
|
-
"
|
|
461
|
+
"EzGridColumnConfig": {
|
|
356
462
|
"location": "import",
|
|
357
463
|
"path": "./controller/EzGridController"
|
|
358
464
|
}
|
|
@@ -487,4 +593,8 @@ export class EzGrid {
|
|
|
487
593
|
}
|
|
488
594
|
}
|
|
489
595
|
}; }
|
|
596
|
+
static get watchers() { return [{
|
|
597
|
+
"propName": "config",
|
|
598
|
+
"methodName": "applyConfig"
|
|
599
|
+
}]; }
|
|
490
600
|
}
|