@sankhyalabs/ezui 1.1.129 → 1.1.132

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.
Files changed (56) hide show
  1. package/dist/cjs/ez-button.cjs.entry.js +10 -12
  2. package/dist/cjs/ez-form.cjs.entry.js +14 -3
  3. package/dist/cjs/ez-grid.cjs.entry.js +22 -12
  4. package/dist/cjs/ez-list.cjs.entry.js +11 -0
  5. package/dist/cjs/ez-modal.cjs.entry.js +6 -0
  6. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-text-input.cjs.entry.js +10 -8
  8. package/dist/cjs/ezui.cjs.js +1 -1
  9. package/dist/cjs/grid-config.cjs.entry.js +44 -2
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/collection/components/ez-button/ez-button.css +73 -28
  12. package/dist/collection/components/ez-button/ez-button.js +15 -18
  13. package/dist/collection/components/ez-form/DataBinder.js +13 -2
  14. package/dist/collection/components/ez-form/ez-form.js +1 -1
  15. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +6 -1
  16. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +10 -4
  17. package/dist/collection/components/ez-grid/ez-grid.js +22 -12
  18. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +44 -2
  19. package/dist/collection/components/ez-list/ez-list.js +27 -0
  20. package/dist/collection/components/ez-modal/ez-modal.js +20 -0
  21. package/dist/collection/components/ez-number-input/ez-number-input.js +1 -1
  22. package/dist/collection/components/ez-text-input/ez-text-input.js +10 -8
  23. package/dist/custom-elements/index.js +119 -40
  24. package/dist/esm/ez-button.entry.js +10 -12
  25. package/dist/esm/ez-form.entry.js +14 -3
  26. package/dist/esm/ez-grid.entry.js +23 -13
  27. package/dist/esm/ez-list.entry.js +11 -0
  28. package/dist/esm/ez-modal.entry.js +6 -0
  29. package/dist/esm/ez-number-input.entry.js +1 -1
  30. package/dist/esm/ez-text-input.entry.js +10 -8
  31. package/dist/esm/ezui.js +1 -1
  32. package/dist/esm/grid-config.entry.js +44 -2
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/ezui/ezui.esm.js +1 -1
  35. package/dist/ezui/p-27db8fba.entry.js +1 -0
  36. package/dist/ezui/p-48ba92b2.entry.js +1 -0
  37. package/dist/ezui/p-4ded39c2.entry.js +1 -0
  38. package/dist/ezui/{p-2d165ca8.entry.js → p-a0e6f47b.entry.js} +7 -7
  39. package/dist/ezui/p-c8f9b691.entry.js +1 -0
  40. package/dist/ezui/{p-47fe4273.entry.js → p-cfa7378a.entry.js} +1 -1
  41. package/dist/ezui/p-d5c93280.entry.js +1 -0
  42. package/dist/ezui/p-d9bb2a96.entry.js +1 -0
  43. package/dist/types/components/ez-button/ez-button.d.ts +3 -3
  44. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
  45. package/dist/types/components/ez-grid/ez-grid.d.ts +3 -3
  46. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
  47. package/dist/types/components/ez-list/ez-list.d.ts +4 -0
  48. package/dist/types/components/ez-modal/ez-modal.d.ts +5 -0
  49. package/dist/types/components.d.ts +13 -4
  50. package/package.json +1 -1
  51. package/dist/ezui/p-495cdb4c.entry.js +0 -1
  52. package/dist/ezui/p-6d39b7ea.entry.js +0 -1
  53. package/dist/ezui/p-7d5b2ebf.entry.js +0 -1
  54. package/dist/ezui/p-c6b2b2e5.entry.js +0 -1
  55. package/dist/ezui/p-ef8f1275.entry.js +0 -1
  56. package/dist/ezui/p-f65302bb.entry.js +0 -1
@@ -37,15 +37,10 @@
37
37
  /*@doc Define o estilo da borda do botão.*/
38
38
  --ez-button--border: none;
39
39
 
40
- /*@doc Define a cor de fundo quando o cursor está sobre o botão.*/
41
- --ez-button--hover--background-color: var(--background--strong, var(--ez-button--background-color));
42
- /*@doc Define a cor do texto quando o cursor está sobre o botão.*/
40
+ /*@doc Define a cor do texto e do ícone quando o cursor está sobre o botão.*/
43
41
  --ez-button--hover-color: var(--color--primary-600);
44
-
45
- /*@doc Define a cor de fundo quando o botão está ativado.*/
46
- --ez-button--active--background-color: var(--background--strong, --color--primary-700);
47
- /*@doc Define a cor do texto quando o botão está ativado.*/
48
- --ez-button--active-color: var(--color--primary-700);
42
+ /*@doc Define a cor de fundo quando o cursor está sobre o botão.*/
43
+ --ez-button--hover--background-color: var(--background--medium, var(--ez-button--background-color));
49
44
 
50
45
  /*@doc Define a cor do texto quando o botão está desabilitado.*/
51
46
  --ez-button--disabled-color: var(--text--disable);
@@ -57,6 +52,11 @@
57
52
  /*@doc Define a sombra do botão quando selecionado.*/
58
53
  --ez-button--focus--box-shadow: none;
59
54
 
55
+ /*@doc Define a cor do texto e do ícone ao ativar o botão.*/
56
+ --ez-button--active-color: var(--color--primary-700);
57
+ /*@doc Define a cor do fundo ao ativar o botão.*/
58
+ --ez-button--active--background-color: var(--background--strong);
59
+
60
60
  /*@doc Define a cor do texto do botão no modo link.*/
61
61
  --ez-button--link-color: var(--color--primary, '#008561');
62
62
  --ez-button--link--hover-color: var(--color--primary-700, '#1C1D22');
@@ -92,23 +92,21 @@ button {
92
92
  color: var(--ez-button--color);
93
93
  fill: var(--ez-button--color);
94
94
  border: var(--ez-button--border);
95
- --ez-icon--color: var(--ez-button--color);
95
+ }
96
+
97
+ button:focus {
98
+ outline: var(--ez-button--focus--border);
99
+ box-shadow: var(--ez-button--focus--box-shadow);
96
100
  }
97
101
 
98
102
  button:hover {
99
103
  outline: none;
104
+ background-color: var(--ez-button--hover--background-color);
100
105
  color: var(--ez-button--hover-color);
101
106
  fill: var(--ez-button--hover-color);
102
- background-color: var(--ez-button--hover--background-color);
103
107
  --ez-icon--color: var(--ez-button--hover-color);
104
108
  }
105
109
 
106
- button:focus {
107
- outline: none;
108
- outline: var(--ez-button--focus--border);
109
- box-shadow: var(--ez-button--focus--box-shadow);
110
- }
111
-
112
110
  button:active {
113
111
  outline: none;
114
112
  box-shadow: none;
@@ -122,31 +120,44 @@ button:disabled {
122
120
  background-color: var(--ez-button--disabled--background-color);
123
121
  color: var(--ez-button--disabled-color);
124
122
  fill: var(--ez-button--disabled-color);
125
- --ez-icon--color: var(--ez-button--disabled-color);
126
123
  border: none;
124
+ --ez-icon--color: var(--ez-button--disabled-color);
127
125
  cursor: no-drop;
128
126
  }
129
127
 
130
- button.icon {
131
- padding: 0px;
128
+ .small{
129
+ height: 32px;
130
+ --ez-button--font-size: var(--text--small, 12px);
132
131
  }
133
132
 
134
- button.small {
135
- width: 32px;
136
- min-width: 32px;
137
- height: 32px;
133
+ .medium{
134
+ height: 42px;
135
+ }
136
+
137
+ .large{
138
+ height: 46px;
138
139
  }
139
140
 
140
- button.medium {
141
+ .btn-icon {
142
+ padding: 0px;
143
+ }
144
+
145
+ .btn-icon--medium {
141
146
  width: 42px;
142
147
  min-width: 42px;
143
148
  height: 42px;
144
149
  }
145
150
 
146
- button.large {
147
- width: 52px;
148
- min-width: 52px;
149
- height: 52px;
151
+ .btn-icon--small {
152
+ width: 32px;
153
+ min-width: 32px;
154
+ height: 32px;
155
+ }
156
+
157
+ .btn-icon--large {
158
+ width: 46px;
159
+ min-width: 46px;
160
+ height: 46px;
150
161
  }
151
162
 
152
163
  .label-icon {
@@ -156,6 +167,18 @@ button.large {
156
167
  color: var(--ez-button--color);
157
168
  }
158
169
 
170
+ .label-icon:hover {
171
+ color: var(--ez-button--hover-color);
172
+ fill: var(--ez-button--hover-color);
173
+ --ez-icon--color: var(--ez-button--hover-color);
174
+ }
175
+
176
+ .label-icon:active {
177
+ color: var(--ez-button--active-color);
178
+ fill: var(--ez-button--active-color);
179
+ --ez-icon--color: var(--ez-button--active-color);
180
+ }
181
+
159
182
  .label-icon label {
160
183
  max-width: 150px;
161
184
  white-space: nowrap;
@@ -165,6 +188,28 @@ button.large {
165
188
  font-family: var(--ez-button--font-family);
166
189
  font-size: var(--ez-button--font-size);
167
190
  font-weight: var(--ez-button--font-weight);
191
+ user-select: none;
192
+ }
193
+
194
+ button:disabled+label {
195
+ max-width: 150px;
196
+ white-space: nowrap;
197
+ overflow: hidden;
198
+ text-overflow: ellipsis;
199
+ cursor: pointer;
200
+ font-family: var(--ez-button--font-family);
201
+ font-size: var(--ez-button--font-size);
202
+ font-weight: var(--ez-button--font-weight);
203
+ color: var(--ez-button--disabled-color);
204
+ cursor: no-drop;
205
+ }
206
+
207
+ div.label-icon{
208
+ cursor: pointer;
209
+ }
210
+
211
+ div.label-icon,button:disabled{
212
+ cursor: no-drop;
168
213
  }
169
214
 
170
215
 
@@ -1,4 +1,4 @@
1
- import { Component, h, Prop, Method } from '@stencil/core';
1
+ import { Component, h, Prop, Method } from "@stencil/core";
2
2
  export class EzButton {
3
3
  constructor() {
4
4
  /**
@@ -9,10 +9,6 @@ export class EzButton {
9
9
  * Define o modo de uso do botão; opções: icon, link e regular
10
10
  */
11
11
  this.mode = "regular";
12
- /**
13
- * É possível escolher entre [small,medium,large] (somente para os modos "icon" e "link")
14
- */
15
- this.size = "medium";
16
12
  }
17
13
  /**
18
14
  * Realiza o foco no botão
@@ -26,8 +22,10 @@ export class EzButton {
26
22
  async setBlur() {
27
23
  this._button.blur();
28
24
  }
29
- getIconSize() {
30
- return this.size;
25
+ getIconSize(sizeParam = "medium") {
26
+ const sizeList = ["small", "medium", "large"];
27
+ const sizeLowerCase = this.size && this.size.toLowerCase();
28
+ return sizeList.includes(sizeLowerCase) ? sizeLowerCase : sizeParam;
31
29
  }
32
30
  handleSlotChange(ev) {
33
31
  const slot = ev.target;
@@ -42,30 +40,30 @@ export class EzButton {
42
40
  }
43
41
  }
44
42
  else {
45
- content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
43
+ content.style.setProperty("--ez-icon--color", "var(--ez-icon--color)");
46
44
  }
47
45
  }
48
46
  render() {
49
47
  if (this.mode == "icon") {
50
- return (h("button", { class: "icon " + this.size, type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
48
+ return (h("button", { class: "btn-icon " + ((this.getIconSize()) ? `btn-icon--${this.getIconSize()}` : ""), type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
51
49
  h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: this.getIconSize(), onClick: evt => { if (!this.enabled)
52
50
  evt.stopPropagation(); } })));
53
51
  }
54
52
  else if (this.mode == "label-icon") {
55
53
  return (h("div", { class: "label-icon" },
56
- h("button", { class: "icon", type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
57
- h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: "large", onClick: evt => { if (!this.enabled)
54
+ h("button", { class: "btn-icon " + ((this.getIconSize()) ? `btn-icon--${this.getIconSize()}` : ""), type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
55
+ h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: this.getIconSize(), onClick: evt => { if (!this.enabled)
58
56
  evt.stopPropagation(); } })),
59
57
  h("label", { title: this.label }, this.label)));
60
58
  }
61
59
  else if (this.mode == "link") {
62
- return (h("a", { class: this.size, ref: (el) => this._button = el },
60
+ return (h("a", { class: this.getIconSize(), ref: (el) => this._button = el },
63
61
  h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }),
64
62
  this.label,
65
63
  h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
66
64
  }
67
65
  else {
68
- return (h("button", { type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
66
+ return (h("button", { class: this.getIconSize(""), type: "button", disabled: !this.enabled, ref: (el) => this._button = el },
69
67
  h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }),
70
68
  this.label,
71
69
  h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
@@ -145,7 +143,7 @@ export class EzButton {
145
143
  "optional": false,
146
144
  "docs": {
147
145
  "tags": [],
148
- "text": "Define o icone svg que ser\u00E1 utilizado no bot\u00E3o. Esta propriedade s\u00F3 \u00E9 utilizada caso o componente esteja no modo 'icon'"
146
+ "text": "Define o icone svg que ser\u00E1 utilizado no bot\u00E3o. Esta propriedade s\u00F3 \u00E9 utilizada caso o componente esteja no modo \"icon\""
149
147
  },
150
148
  "attribute": "image",
151
149
  "reflect": true
@@ -171,8 +169,8 @@ export class EzButton {
171
169
  "type": "string",
172
170
  "mutable": false,
173
171
  "complexType": {
174
- "original": "string",
175
- "resolved": "string",
172
+ "original": "\"small\" | \"medium\" | \"large\" | undefined",
173
+ "resolved": "\"large\" | \"medium\" | \"small\"",
176
174
  "references": {}
177
175
  },
178
176
  "required": false,
@@ -182,8 +180,7 @@ export class EzButton {
182
180
  "text": "\u00C9 poss\u00EDvel escolher entre [small,medium,large] (somente para os modos \"icon\" e \"link\")"
183
181
  },
184
182
  "attribute": "size",
185
- "reflect": true,
186
- "defaultValue": "\"medium\""
183
+ "reflect": true
187
184
  }
188
185
  }; }
189
186
  static get methods() { return {
@@ -39,7 +39,12 @@ export default class DataBinder {
39
39
  const oldValue = field["value"];
40
40
  const newValue = this._dataUnit.getFieldValue(fieldName);
41
41
  if (oldValue != newValue) {
42
- field["value"] = newValue;
42
+ if (newValue === undefined) {
43
+ field.removeAttribute("value");
44
+ }
45
+ else {
46
+ field["value"] = newValue;
47
+ }
43
48
  }
44
49
  }
45
50
  updateBind(fieldName, field) {
@@ -47,7 +52,13 @@ export default class DataBinder {
47
52
  if (oldBind) {
48
53
  oldBind.destroy();
49
54
  }
50
- field["value"] = this._dataUnit.getFieldValue(fieldName);
55
+ const value = this._dataUnit.getFieldValue(fieldName);
56
+ if (value === undefined) {
57
+ field.removeAttribute("value");
58
+ }
59
+ else {
60
+ field["value"] = value;
61
+ }
51
62
  this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
52
63
  this.bindSearchOptionsLoader(fieldName, field);
53
64
  this.applyEzUploadContext(fieldName, field);
@@ -27,7 +27,7 @@ export class EzForm {
27
27
  .filter(f => f.dataset.required)
28
28
  .map(f => f.dataset.fieldName)
29
29
  .concat(metadata.getRequiredFields());
30
- const records = this.dataUnit.records;
30
+ const records = this.dataUnit.getModifiedRecords();
31
31
  for (let i = 0; i < records.length; i++) {
32
32
  if (!this.validateRequired(requiredFields, records[i])) {
33
33
  reject();
@@ -38,7 +38,12 @@ export default class DataUnitBridge {
38
38
  this._dataUnit.metadata.fields.forEach(f => {
39
39
  var _a;
40
40
  if (f.visible !== false) {
41
- columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options });
41
+ const props = new Map();
42
+ const properties = this._dataUnit.getField(f.name).properties;
43
+ for (const value in properties) {
44
+ props.set(value, properties[value]);
45
+ }
46
+ columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options, props });
42
47
  }
43
48
  });
44
49
  }
@@ -5,6 +5,7 @@ import HeaderColumnTemplate from "./template/HeaderColumnTemplate.js";
5
5
  import DataSource from "./DataSource";
6
6
  import { DataType } from "@sankhyalabs/core";
7
7
  import { SortMode, UserInterface } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
8
+ import { NumberUtils } from "@sankhyalabs/core";
8
9
  export default class AgGridController {
9
10
  constructor(enterprise) {
10
11
  this._menuItems = [];
@@ -301,19 +302,24 @@ export default class AgGridController {
301
302
  });
302
303
  return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
303
304
  }
304
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
305
- if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
305
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SWITCH) {
306
+ if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true || (params === null || params === void 0 ? void 0 : params.value) === "true") {
306
307
  return "Sim";
307
308
  }
308
- else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
309
+ else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false || (params === null || params === void 0 ? void 0 : params.value) === "false") {
309
310
  return "Não";
310
311
  }
311
312
  }
312
- if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
313
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.SEARCH) {
313
314
  if (params.value !== undefined) {
314
315
  return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
315
316
  }
316
317
  }
318
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DECIMALNUMBER) {
319
+ if (params.value !== undefined) {
320
+ return NumberUtils.format(params.value.toString(), 2, 2);
321
+ }
322
+ }
317
323
  if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATETIME) {
318
324
  if (params.value !== undefined) {
319
325
  return params.value.toLocaleDateString();
@@ -4,7 +4,7 @@ import DataUnitBridge from "./controller/DataUnitBridge";
4
4
  export class EzGrid {
5
5
  constructor() {
6
6
  this._gridController = new AgGridController(false);
7
- this._popUpVisible = false;
7
+ this._popUpGridConfig = false;
8
8
  /**
9
9
  * Determina o número de linhas de cada página. Caso informado o valor -1
10
10
  * não haverá paginação.
@@ -180,28 +180,26 @@ export class EzGrid {
180
180
  }
181
181
  applyConfig(config) {
182
182
  this._gridController.setColumnsState(config.columns);
183
- this.closeConfig();
183
+ this.closeGridConfig();
184
184
  }
185
- closeConfig() {
186
- this._popUpVisible = false;
185
+ closeGridConfig() {
186
+ this._popUpGridConfig = false;
187
187
  }
188
- openConfig() {
188
+ openGridConfig() {
189
189
  this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
190
190
  this._gridConfig.selectedTab = "Colunas";
191
- this._popUpVisible = true;
191
+ this._popUpGridConfig = true;
192
192
  }
193
193
  render() {
194
194
  return (h(Host, null,
195
195
  h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" },
196
196
  h("div", { class: "grid-header__container" },
197
197
  h("slot", { name: "leftButtons" })),
198
- h("div", { class: "grid-header__container" },
199
- this.getPaginationControl(),
200
- h("ez-button", { size: "small", iconName: "settings", class: "ez-button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))),
198
+ h("div", { class: "grid-header__container" }, this.getPaginationControl())),
201
199
  h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }),
202
200
  h("div", { class: "grid__footer" }),
203
- h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false },
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() }))));
201
+ h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() },
202
+ 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.closeGridConfig() }))));
205
203
  }
206
204
  static get is() { return "ez-grid"; }
207
205
  static get encapsulation() { return "scoped"; }
@@ -312,7 +310,7 @@ export class EzGrid {
312
310
  "_navigationFirstRow": {},
313
311
  "_navigationLastRow": {},
314
312
  "_navigationTotalRows": {},
315
- "_popUpVisible": {}
313
+ "_popUpGridConfig": {}
316
314
  }; }
317
315
  static get events() { return [{
318
316
  "method": "ezColumnStateChange",
@@ -591,6 +589,18 @@ export class EzGrid {
591
589
  "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
592
590
  "tags": []
593
591
  }
592
+ },
593
+ "openGridConfig": {
594
+ "complexType": {
595
+ "signature": "() => Promise<void>",
596
+ "parameters": [],
597
+ "references": {},
598
+ "return": "Promise<void>"
599
+ },
600
+ "docs": {
601
+ "text": "",
602
+ "tags": []
603
+ }
594
604
  }
595
605
  }; }
596
606
  static get watchers() { return [{
@@ -1,12 +1,14 @@
1
1
  import { StringUtils } from '@sankhyalabs/core';
2
2
  import { Component, Event, h, Host, Prop } from '@stencil/core';
3
3
  import { getSpritePath } from '../../../../utils/AssetsUtils';
4
+ import ApplicationUtils from '../../../../utils/ApplicationUtils';
4
5
  export class GridConfig {
5
6
  constructor() {
6
7
  this._orderListItems = [];
7
8
  this._orderPriorityList = [];
8
9
  this._columListItems = [];
9
10
  this._selectedIndex = -1;
11
+ this._dataChanged = false;
10
12
  this.selectedTab = "Colunas";
11
13
  }
12
14
  /* Creation Methods */
@@ -84,6 +86,7 @@ export class GridConfig {
84
86
  }
85
87
  updateOrder(sortOrder, updatedItemLabel) {
86
88
  var _a;
89
+ this._dataChanged = true;
87
90
  let newList = [...this.columns];
88
91
  let newItem = newList.find(item => item.label === updatedItemLabel);
89
92
  if (newItem) {
@@ -112,6 +115,7 @@ export class GridConfig {
112
115
  switchColumnGroup(ev, switchedItem) {
113
116
  ev.stopPropagation();
114
117
  let newList = [...this._columListItems];
118
+ this._dataChanged = true;
115
119
  if (ev.detail === true) {
116
120
  let hiddenGroup = newList.find(group => group.group === "Ocultas");
117
121
  let index = hiddenGroup.items.findIndex(item => item.label === switchedItem.label);
@@ -151,6 +155,9 @@ export class GridConfig {
151
155
  });
152
156
  });
153
157
  this.columns = newColumnList;
158
+ this._dataChanged = false;
159
+ this.closeConfig();
160
+ ApplicationUtils.info("As configurações foram salvas com sucesso!");
154
161
  this.save();
155
162
  }
156
163
  save() {
@@ -333,13 +340,46 @@ export class GridConfig {
333
340
  return false;
334
341
  }
335
342
  closeConfig() {
336
- this.configCancel.emit();
337
- this._orderList.clearHistory();
343
+ this._orderList.scrollToTop();
344
+ this._columnList.scrollToTop();
345
+ this._searchElement.value = "";
346
+ if (this._dataChanged) {
347
+ let options = {
348
+ canClose: false,
349
+ labelCancel: "Descartar",
350
+ labelConfirm: "Salvar",
351
+ btnConfirmDanger: false
352
+ };
353
+ ApplicationUtils.confirm("Aviso", "As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?", null, false, options)
354
+ .then(response => {
355
+ if (!response) {
356
+ this._dataChanged = false;
357
+ this.configCancel.emit();
358
+ this._orderList.clearHistory();
359
+ }
360
+ else {
361
+ this.finish();
362
+ }
363
+ });
364
+ }
365
+ else {
366
+ this.configCancel.emit();
367
+ this._orderList.clearHistory();
368
+ }
338
369
  }
339
370
  /* Handlers */
340
371
  handleTabChange(ev) {
341
372
  var _a;
342
373
  if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.selectedTab) {
374
+ if (this.selectedTab !== ev.target.selectedTab) {
375
+ if (ev.target.selectedTab === "Colunas") {
376
+ this._orderList.scrollToTop();
377
+ }
378
+ else if (ev.target.selectedTab === "Ordenação das linhas") {
379
+ this._columnList.scrollToTop();
380
+ }
381
+ this._searchElement.value = "";
382
+ }
343
383
  if (ev.target.selectedTab === "Ordenação das linhas") {
344
384
  this.createOrderList();
345
385
  }
@@ -351,6 +391,7 @@ export class GridConfig {
351
391
  if (ev.detail) {
352
392
  let visibleItems = (_a = ev.detail.find(group => group.group === "Visíveis")) === null || _a === void 0 ? void 0 : _a.items;
353
393
  if (visibleItems) {
394
+ this._dataChanged = true;
354
395
  this._orderListItems = visibleItems;
355
396
  }
356
397
  }
@@ -359,6 +400,7 @@ export class GridConfig {
359
400
  if (ev.detail) {
360
401
  let orderPriorityList = ev.detail;
361
402
  if (orderPriorityList) {
403
+ this._dataChanged = true;
362
404
  this._orderPriorityList = orderPriorityList;
363
405
  }
364
406
  }
@@ -52,6 +52,17 @@ export class EzList {
52
52
  this._listItemsHistory = [];
53
53
  }
54
54
  /**
55
+ * Responsável por dar um scroll top no componente da lista.
56
+ */
57
+ async scrollToTop() {
58
+ if (this.useGroups) {
59
+ this._element.shadowRoot.querySelector('.group-container').scrollTop = 0;
60
+ }
61
+ else {
62
+ this._element.shadowRoot.querySelector('.items-container').scrollTop = 0;
63
+ }
64
+ }
65
+ /**
55
66
  * Recebe como argumento um ListItem {label: string} e um booleano que define se o componente deve fazer scroll para exibir o item específico (opcional).
56
67
  */
57
68
  async setSelection(selectedItem, scrollToOption) {
@@ -658,6 +669,22 @@ export class EzList {
658
669
  "tags": []
659
670
  }
660
671
  },
672
+ "scrollToTop": {
673
+ "complexType": {
674
+ "signature": "() => Promise<void>",
675
+ "parameters": [],
676
+ "references": {
677
+ "Promise": {
678
+ "location": "global"
679
+ }
680
+ },
681
+ "return": "Promise<void>"
682
+ },
683
+ "docs": {
684
+ "text": "Respons\u00E1vel por dar um scroll top no componente da lista.",
685
+ "tags": []
686
+ }
687
+ },
661
688
  "setSelection": {
662
689
  "complexType": {
663
690
  "signature": "(selectedItem: ListItem, scrollToOption?: boolean) => Promise<void>",
@@ -34,6 +34,11 @@ export class EzModal {
34
34
  componentDidLoad() {
35
35
  this.handleopenedChange();
36
36
  }
37
+ componentDidRender() {
38
+ if (this.opened) {
39
+ this.ezOpenModal.emit();
40
+ }
41
+ }
37
42
  onMouseDownHandler(event) {
38
43
  if (this.closeOutsideClick && event.target === this._overlay) {
39
44
  this.closeModal();
@@ -163,6 +168,21 @@ export class EzModal {
163
168
  "resolved": "boolean",
164
169
  "references": {}
165
170
  }
171
+ }, {
172
+ "method": "ezOpenModal",
173
+ "name": "ezOpenModal",
174
+ "bubbles": true,
175
+ "cancelable": true,
176
+ "composed": true,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": "Um evento disparado quando o modal \u00E9 aberto (onEzOpenModal)."
180
+ },
181
+ "complexType": {
182
+ "original": "any",
183
+ "resolved": "any",
184
+ "references": {}
185
+ }
166
186
  }]; }
167
187
  static get watchers() { return [{
168
188
  "propName": "opened",
@@ -37,7 +37,7 @@ export class EzNumberInput {
37
37
  }
38
38
  changeValue(newValue) {
39
39
  this.errorMessage = "";
40
- if (newValue && newValue !== this.value) {
40
+ if (newValue !== this.value) {
41
41
  this.value = newValue;
42
42
  this.ezChange.emit(this.value);
43
43
  }
@@ -17,14 +17,16 @@ export class EzTextInput {
17
17
  }
18
18
  showError() {
19
19
  var _a, _b;
20
- const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
21
- if (hasError) {
22
- this._inputElem.classList.add("hasError");
23
- (_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
24
- }
25
- else {
26
- this._inputElem.classList.remove("hasError");
27
- (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
20
+ if (this._inputElem) {
21
+ const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
22
+ if (hasError) {
23
+ this._inputElem.classList.add("hasError");
24
+ (_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
25
+ }
26
+ else {
27
+ this._inputElem.classList.remove("hasError");
28
+ (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
29
+ }
28
30
  }
29
31
  }
30
32
  prepareMask() {