@sankhyalabs/ezui 1.1.89 → 1.1.92

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 (73) hide show
  1. package/dist/cjs/{AssetsUtils-caf95dab.js → AssetsUtils-4909c6de.js} +1 -1
  2. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-button_11.cjs.entry.js +85 -51
  5. package/dist/cjs/ez-calendar.cjs.entry.js +11 -4
  6. package/dist/cjs/ez-collapsible-box_7.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-form.cjs.entry.js +2 -2
  10. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-time-input.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  15. package/dist/cjs/ezui.cjs.js +2 -2
  16. package/dist/cjs/{index-0bce1636.js → index-88286449.js} +358 -8
  17. package/dist/cjs/loader.cjs.js +2 -2
  18. package/dist/collection/collection-manifest.json +1 -1
  19. package/dist/collection/components/ez-calendar/ez-calendar.css +33 -29
  20. package/dist/collection/components/ez-calendar/ez-calendar.js +9 -2
  21. package/dist/collection/components/ez-form/store/form.slice.js +1 -1
  22. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +7 -5
  23. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +42 -1
  24. package/dist/collection/components/ez-grid/ez-grid.css +7 -2
  25. package/dist/collection/components/ez-grid/ez-grid.js +6 -3
  26. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +1 -1
  27. package/dist/collection/components/ez-list/ez-list.js +2 -1
  28. package/dist/collection/components/ez-tabselector/ez-tabselector.js +40 -46
  29. package/dist/custom-elements/index.js +96 -55
  30. package/dist/esm/{AssetsUtils-9b1d9c38.js → AssetsUtils-9b1329a3.js} +1 -1
  31. package/dist/esm/ez-action-chip.entry.js +1 -1
  32. package/dist/esm/ez-application.entry.js +1 -1
  33. package/dist/esm/ez-button_11.entry.js +85 -51
  34. package/dist/esm/ez-calendar.entry.js +11 -4
  35. package/dist/esm/ez-collapsible-box_7.entry.js +1 -1
  36. package/dist/esm/ez-combo-box.entry.js +1 -1
  37. package/dist/esm/ez-dialog.entry.js +1 -1
  38. package/dist/esm/ez-form.entry.js +2 -2
  39. package/dist/esm/ez-label-chip.entry.js +1 -1
  40. package/dist/esm/ez-popover.entry.js +1 -1
  41. package/dist/esm/ez-popup.entry.js +1 -1
  42. package/dist/esm/ez-time-input.entry.js +2 -2
  43. package/dist/esm/ez-toast.entry.js +1 -1
  44. package/dist/esm/ezui.js +2 -2
  45. package/dist/esm/{index-d80a8d1f.js → index-6b8bfbeb.js} +358 -8
  46. package/dist/esm/loader.js +2 -2
  47. package/dist/ezui/ezui.esm.js +1 -1
  48. package/dist/ezui/{p-4e08b842.entry.js → p-0094463f.entry.js} +1 -1
  49. package/dist/ezui/{p-091b27f2.entry.js → p-020f1285.entry.js} +1 -1
  50. package/dist/ezui/{p-27a35580.entry.js → p-038fd0cb.entry.js} +1 -1
  51. package/dist/ezui/{p-f87c7082.js → p-477bb703.js} +1 -1
  52. package/dist/ezui/{p-a52b3368.entry.js → p-502d7e0d.entry.js} +1 -1
  53. package/dist/ezui/{p-19d8a928.entry.js → p-542d3d29.entry.js} +1 -1
  54. package/dist/ezui/{p-826b6c4d.entry.js → p-552a0b2e.entry.js} +1 -1
  55. package/dist/ezui/{p-3e79877f.entry.js → p-60469339.entry.js} +1 -1
  56. package/dist/ezui/{p-eefc1f9d.entry.js → p-7e0281cd.entry.js} +1 -1
  57. package/dist/ezui/p-89a57641.js +1 -0
  58. package/dist/ezui/p-95fc543c.entry.js +1 -0
  59. package/dist/ezui/{p-b678dc80.entry.js → p-b217f40b.entry.js} +1 -1
  60. package/dist/ezui/{p-6206515e.entry.js → p-b8678ee6.entry.js} +1 -1
  61. package/dist/ezui/p-d22db59d.entry.js +1 -0
  62. package/dist/ezui/{p-93bb1854.entry.js → p-d4386e30.entry.js} +24 -24
  63. package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -0
  64. package/dist/types/components/ez-form/store/form.slice.d.ts +2 -1
  65. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +8 -0
  66. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
  67. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +13 -6
  68. package/dist/types/components.d.ts +5 -4
  69. package/package.json +2 -2
  70. package/dist/collection/utils/FloatingManager.js +0 -16
  71. package/dist/ezui/p-39218c31.entry.js +0 -1
  72. package/dist/ezui/p-535771b6.entry.js +0 -1
  73. package/dist/ezui/p-7c101b34.js +0 -1
@@ -12,7 +12,7 @@
12
12
  /*@doc Define a cor de fundo do corpo da hora do calendário.*/
13
13
  --ez-calendar__Time--background-color: var(--background--xlight, #FAFAFA);
14
14
  /*@doc Define o espaçamento do corpo do calendário.*/
15
- --ez-calendar__body--padding: var(--space--medium, 12px);
15
+ --ez-calendar__body--padding: var(--space--medium, 12px) var(--space--small, 6px) ;
16
16
  /*@doc Define o raio da borda do corpo do calendário.*/
17
17
  --ez-calendar__body--border-radius: var(--border--radius-medium, 12px);
18
18
  /*@doc Define a sombra do corpo do calendário.*/
@@ -20,7 +20,7 @@
20
20
 
21
21
  /* cal__header */
22
22
  /*@doc Define a espessura da borda inferior do header.*/
23
- --ez-calendar__header-line--stroke: 2px;
23
+ --ez-calendar__header-line--stroke: 1px;
24
24
  /*@doc Define a cor da borda inferior do header.*/
25
25
  --ez-calendar__header-line--color: var(--color--strokes, #C0C0C0);
26
26
 
@@ -40,17 +40,19 @@
40
40
 
41
41
  /* cell */
42
42
  /*@doc Define o espaçamento vertical entre as células.*/
43
- --ez-calendar__cell--margin: 0px var(--space--small, 12px);
43
+ --ez-calendar__cell--margin: 0px 1.5px;
44
44
  /*@doc Define a largura das células.*/
45
45
  --ez-calendar__cell--width: var(--space--large, 24px);
46
46
  /*@doc Define o espaçamento horizontal entre as células.*/
47
- --ez-calendar__cell--padding: var(--space--extra-small, 3px) 0px;
47
+ --ez-calendar__cell--padding: 1.5px 0px;
48
48
  /*@doc Define o raio da borda das células.*/
49
49
  --ez-calendar__cell--border-radius: var(--border--radius-small, 6px);
50
50
  /*@doc Define a cor de fundo das células.*/
51
- --ez-calendar__cell--over--background-color: var(--color--strokes, #E2F4EF);
51
+ --ez-calendar__cell--over--background-color: var(--color--primary, #E2F4EF);
52
+ /*@doc Define a cor de do texto das células.*/
53
+ --ez-calendar__cell--over--color: var(--color--primary-300, #008561);
52
54
  /*@doc Define a cor do texto para células secundárias (fora do mês selecionado).*/
53
- --ez-calendar__cell--outset--color: var(--color--strokes, #C0C0C0);
55
+ --ez-calendar__cell--outset--color: var(--color--disable-primary, #E5EAF0);
54
56
  /*@doc Define a cor de fundo das células selecionadas.*/
55
57
  --ez-calendar__cell--selected--background-color: var(--color--primary, #008561);
56
58
  /*@doc Define a cor do texto da célula selecionada.*/
@@ -60,7 +62,7 @@
60
62
  /*@doc Define a cor do texto do botão "Hoje".*/
61
63
  --ez-calendar__btn-today--color: var(--color--primary);
62
64
  /*@doc Define a cor de fundo do botão "Hoje" quando o cursor está sobre ele.*/
63
- --ez-calendar__btn-today--hover--background-color: var(--color--strokes, #E2F4EF);
65
+ --ez-calendar__btn-today--hover--background-color: var(--color--primary-300, #E2F4EF);
64
66
  /*@doc Define o raio da borda do botão "Hoje".*/
65
67
  --ez-calendar__btn-today--border-radius: var(--border--radius-small, 6px);
66
68
 
@@ -90,8 +92,8 @@
90
92
  /*private*/
91
93
  display: flex;
92
94
  justify-content: space-between;
93
- padding-bottom: var(--space--medium, 12px);
94
- margin: var(--space--small, 6px) var(--space--, 12px);
95
+ padding-bottom: var(--space--small, 6px);
96
+ margin: 0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);
95
97
 
96
98
  /*public*/
97
99
  font-family: var(--ez-calendar--font-family);
@@ -140,8 +142,8 @@
140
142
 
141
143
  .calendar__lbl-month {
142
144
  /*private*/
143
- font-weight: var(--text-weight--large, 600);
144
- font-size: var(--title--medium, 16px);
145
+ font-weight: var(--text-weight--extra-large, 700);
146
+ font-size: var(--title--small, 14px);
145
147
 
146
148
  /*public*/
147
149
  font-family: var(--ez-calendar--font-family);
@@ -162,7 +164,7 @@
162
164
  justify-content: center;
163
165
  align-content: center;
164
166
  cursor: pointer;
165
- font-size: var(--text--small, 12px);
167
+ font-size: var(--text--extra-small, 10px);
166
168
 
167
169
  /*public*/
168
170
  font-family: var(--ez-calendar--font-family);
@@ -178,6 +180,7 @@
178
180
  .calendar__cell:hover {
179
181
  /*public*/
180
182
  background-color: var(--ez-calendar__cell--over--background-color);
183
+ color: var(--ez-calendar__cell--over--color);
181
184
  }
182
185
 
183
186
  .calendar__cell--secondary {
@@ -208,11 +211,6 @@
208
211
  color: var(--ez-calendar__cell--selected--color);
209
212
  }
210
213
 
211
- .calendar__body {
212
- /*private*/
213
- padding: var(--space--small, 6px) 0px;
214
- }
215
-
216
214
  .calendar__footer {
217
215
  /*private*/
218
216
  display: flex;
@@ -225,8 +223,8 @@
225
223
  background-color: unset;
226
224
  cursor: pointer;
227
225
  font-weight: var(--text-weight--large, 600);
228
- font-size: var(--title--small);
229
- padding: var(--space--extra-small, 6px);
226
+ font-size: var(--title--extra-small, 12px);
227
+ padding: 0px;
230
228
 
231
229
  /*public*/
232
230
  font-family: var(--ez-calendar--font-family);
@@ -249,9 +247,7 @@ section{
249
247
  margin-left: -10px;
250
248
  display: flex;
251
249
  flex-direction: column;
252
- padding: 12px 6px;
253
- padding-left: 16px;
254
- padding-bottom: 0px;
250
+ padding: 12px 0px 0px 10px;
255
251
 
256
252
  /*public*/
257
253
  /*TODO Criar variavel para color o calendar_time var(--ez-calendar__body-time--background-color)*/
@@ -261,7 +257,7 @@ section{
261
257
  box-shadow: var(--ez-calendar__body--shadow);
262
258
  }
263
259
  .calendar__column {
264
- height: 180px;
260
+ height: 136px;
265
261
  padding: 0px;
266
262
  margin: 0px;
267
263
  overflow: auto;
@@ -276,14 +272,14 @@ section{
276
272
 
277
273
  .calendarTime__header{
278
274
  /*private*/
279
- padding-left: 6px;
280
- padding-right: 6px;
275
+ padding-left: var(--space--small, 6px);
276
+ padding-right: var(--space--small, 6px);
281
277
  display: flex;
282
278
  justify-content: space-between;
283
- padding-bottom: var(--space--medium, 12px);
284
- margin: var(--space--small, 6px) var(--space--, 12px);
285
- font-weight: var(--text-weight--large, 600);
286
- font-size: var(--title--medium, 16px);
279
+ padding-bottom: var(--space--small, 6px);
280
+ margin: 0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);
281
+ font-weight: var(--text-weight--extra-large, 700);
282
+ font-size: var(--title--small, 14px);
287
283
 
288
284
 
289
285
  /*public*/
@@ -298,9 +294,17 @@ section{
298
294
 
299
295
  .separatorTime{
300
296
  color: #A2ABB9;
297
+ padding: 0px 1px;
298
+ line-height: 16px;
299
+ font-size: 17px;
300
+ font-weight: normal;
301
301
  }
302
302
 
303
303
  .endHidden {
304
304
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%);
305
305
  }
306
306
 
307
+ .calendar__column .calendar__cell{
308
+ margin: 0px;
309
+ padding: 1.5px 1.5px;
310
+ }
@@ -7,7 +7,7 @@ export class EzCalendar {
7
7
  this._weekDayLabels = ["D", "S", "T", "Q", "Q", "S", "S"];
8
8
  this._monthLabels = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
9
9
  this._hoursLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
10
- this._minutosLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"];
10
+ this._minutosLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"];
11
11
  /**
12
12
  * A data selecionada no calendário
13
13
  */
@@ -38,6 +38,7 @@ export class EzCalendar {
38
38
  window.requestAnimationFrame(() => {
39
39
  this._box.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
40
40
  });
41
+ this.scroll();
41
42
  }
42
43
  }
43
44
  /**
@@ -140,11 +141,17 @@ export class EzCalendar {
140
141
  this.updateScroll(this._secondsScroll);
141
142
  }
142
143
  componentDidLoad() {
144
+ this.scroll();
145
+ }
146
+ scroll() {
143
147
  if (this.time || this.showSeconds) {
144
148
  this._hoursScroll.scrollTop = this._hoursSelect.offsetTop - 64;
145
149
  this._minutesScroll.scrollTop = this._minutesSelect.offsetTop - 64;
150
+ this.updateScroll(this._hoursScroll);
151
+ this.updateScroll(this._minutesScroll);
146
152
  if (this.showSeconds) {
147
153
  this._secondsScroll.scrollTop = this._secondsSelect.offsetTop - 64;
154
+ this.updateScroll(this._secondsScroll);
148
155
  }
149
156
  }
150
157
  }
@@ -193,7 +200,7 @@ export class EzCalendar {
193
200
  h("div", { class: "separatorTime" }, ":"),
194
201
  this.showSeconds &&
195
202
  h("div", null, "S")),
196
- h("div", { class: "calendar__body ", style: { display: 'flex', paddingLeft: '6px', paddingRight: '6px' } },
203
+ h("div", { class: "calendar__body ", style: { display: 'flex', paddingLeft: '12px', paddingRight: '12px' } },
197
204
  h("div", { class: "calendar__column", ref: elem => this._hoursScroll = elem, onScroll: () => this.updateScroll(this._hoursScroll) }, this._hoursLabel.map((offset, index) => {
198
205
  if (index === this.value.getHours()) {
199
206
  return (h("div", { style: { display: 'flex' }, ref: elem => this._hoursSelect = elem },
@@ -20,7 +20,7 @@ export function loadMetadata(formMetadata) {
20
20
  export function changeTab(currentSheet) {
21
21
  return {
22
22
  type: FormActions.CHANGE_TAB,
23
- payload: currentSheet
23
+ payload: currentSheet.tabKey
24
24
  };
25
25
  }
26
26
  /////////////////////////////// SELECTORS ///////////////////////////////
@@ -14,11 +14,13 @@ export default class DataUnitBridge {
14
14
  }
15
15
  buildColumnDefs() {
16
16
  const columnDefs = [];
17
- this._dataUnit.metadata.fields.forEach(f => {
18
- if (f.visible !== false) {
19
- columnDefs.push({ label: f.label, name: f.name });
20
- }
21
- });
17
+ if (this._dataUnit.metadata) {
18
+ this._dataUnit.metadata.fields.forEach(f => {
19
+ if (f.visible !== false) {
20
+ columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: this._dataUnit.getField(f.name).properties.options });
21
+ }
22
+ });
23
+ }
22
24
  return columnDefs;
23
25
  }
24
26
  }
@@ -112,7 +112,13 @@ export default class AgGridController {
112
112
  if (this._grid === undefined) {
113
113
  throw new Error("Erro interno: Grid ainda não inicializado.");
114
114
  }
115
- this._gridOptions.columnApi.applyColumnState({ state: state.map(s => this.buildColState(s)) });
115
+ //TODO neste ponto estamos utilizando um método descontinuado,
116
+ //pelo fato de que o applyColumnState não reordena as colunas conforme
117
+ //o estado passado.
118
+ //https://stackoverflow.com/questions/51488241/ag-grid-how-to-save-and-reload-column-order
119
+ //Assim que for corrigido o applyColumnState devemos substituir o setColumnState por ele.
120
+ // this._gridOptions.columnApi.applyColumnState({ state: state.map(s => this.buildColState(s)) });
121
+ this._gridOptions.columnApi.setColumnState(state.map(s => this.buildColState(s)));
116
122
  }
117
123
  getColumnsState() {
118
124
  if (this._grid === undefined) {
@@ -152,9 +158,44 @@ export default class AgGridController {
152
158
  resizable: true,
153
159
  headerComponentParams: {
154
160
  template: HeaderColumnTemplate
161
+ },
162
+ valueFormatter: params => {
163
+ return this.getFormatterByColumn(params, source);
155
164
  }
156
165
  };
157
166
  }
167
+ getFormatterByColumn(params, source) {
168
+ var _a, _b;
169
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "OPTIONSELECTOR" && source.options) {
170
+ const prop = source === null || source === void 0 ? void 0 : source.options;
171
+ let options;
172
+ if (typeof prop === "string") {
173
+ const parsed = JSON.parse(prop);
174
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
175
+ }
176
+ else {
177
+ options = prop;
178
+ }
179
+ let optionSelected;
180
+ options.forEach((option) => {
181
+ if (option.value == params.value) {
182
+ optionSelected = option;
183
+ }
184
+ });
185
+ return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
186
+ }
187
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
188
+ if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
189
+ return "Sim";
190
+ }
191
+ else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
192
+ return "Não";
193
+ }
194
+ }
195
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
196
+ 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);
197
+ }
198
+ }
158
199
  buildColState(source) {
159
200
  return {
160
201
  colId: source.name,
@@ -7,12 +7,17 @@
7
7
  --ezgrid__header--background-color: var(--background--xlight, #FFF)
8
8
  }
9
9
 
10
- .grid__header {
10
+ .grid-header {
11
11
  /*private*/
12
12
  display: flex;
13
- justify-content: flex-end;
13
+ justify-content: space-between;
14
14
  align-items: center;
15
15
 
16
16
  /*public*/
17
17
  background-color: var(--ezgrid__header--background-color);
18
+ }
19
+
20
+ .grid-header__container{
21
+ display: flex;
22
+ align-items: center;
18
23
  }
@@ -109,9 +109,12 @@ export class EzGrid {
109
109
  }
110
110
  render() {
111
111
  return (h(Host, null,
112
- h("div", { class: "box box--shadow padding--medium grid__header margin-bottom--small" },
113
- this.getPaginationControl(),
114
- h("ez-button", { size: "small", iconName: "settings", class: "button--secondary", mode: "icon", onClick: () => { this.openConfig(); } })),
112
+ h("div", { class: "box box--shadow padding--medium grid-header margin-bottom--small" },
113
+ h("div", { class: "grid-header__container" },
114
+ h("slot", { name: "leftButtons" })),
115
+ h("div", { class: "grid-header__container" },
116
+ this.getPaginationControl(),
117
+ h("ez-button", { size: "small", iconName: "settings", class: "button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))),
115
118
  h("div", { class: "grid__container ag-sankhya-theme", ref: elem => this._container = elem }),
116
119
  h("div", { class: "grid__footer" }),
117
120
  h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false },
@@ -249,7 +249,7 @@ export class GridConfig {
249
249
  h("div", { class: "button-close" },
250
250
  h("ez-button", { mode: 'icon', image: getSpritePath("close"), size: 'medium', onClick: () => this.closeConfig() }))),
251
251
  h("div", { class: "tabselector-container" },
252
- h("ez-tabselector", { selectedTab: this.selectedTab, selectedIndex: '0', onEzChange: (ev) => { this.handleTabChange(ev); }, tabs: 'Colunas, Ordena\u00E7\u00E3o' })),
252
+ h("ez-tabselector", { selectedTab: this.selectedTab, selectedIndex: 0, onEzChange: (ev) => { this.handleTabChange(ev); }, tabs: 'Colunas, Ordena\u00E7\u00E3o' })),
253
253
  h("div", null,
254
254
  h("ez-text-input", { ref: (el) => this._searchElement = el, label: "Localizar coluna", onKeyUp: evt => this.locateColumn(evt) },
255
255
  h("ez-icon", { slot: "leftIcon", size: "medium", href: getSpritePath("search") })))),
@@ -162,7 +162,8 @@ export class EzList {
162
162
  }
163
163
  }
164
164
  else {
165
- newList.find(group => group.group == dragEndItem.groupName).items.splice(dragEndItem.index, 0, this._dragStartItem.item);
165
+ let indexForAdd = (dragEndItem.index > this._dragStartItem.index) ? dragEndItem.index - 1 : dragEndItem.index;
166
+ newList.find(group => group.group == dragEndItem.groupName).items.splice(indexForAdd, 0, this._dragStartItem.item);
166
167
  }
167
168
  this._listGroupItems = newList;
168
169
  this.ezChange.emit(this._listGroupItems);
@@ -3,12 +3,10 @@ export class EzTabselector {
3
3
  constructor() {
4
4
  this.setFocusedParam = (ev) => {
5
5
  if (ev.key === "Enter") {
6
- this.selectedIndex = this.focusedIndex;
7
- this.focusedIndex = undefined;
8
- this.selectedTab = this._processedTabs[this.selectedIndex]["tabKey"];
9
- this.handleTabClick(this.selectedTab, parseInt(this.selectedIndex));
6
+ const selectedTab = this._processedTabs[this._focusedIndex];
7
+ this.handleTabClick(selectedTab);
10
8
  ev.preventDefault();
11
- this.setFocusedTab(this.selectedIndex);
9
+ this.setFocusedTab(selectedTab.index);
12
10
  }
13
11
  else if (ev.key === "ArrowLeft" || ev.key === "ArrowRight") {
14
12
  let operator = undefined;
@@ -21,48 +19,46 @@ export class EzTabselector {
21
19
  else {
22
20
  return;
23
21
  }
24
- if (this.focusedIndex === undefined) {
22
+ if (this._focusedIndex === undefined) {
25
23
  if (operator === false) {
26
- this.focusedIndex = this.selectedIndex !== undefined ? (parseInt(this.selectedIndex) - 1).toString() : undefined;
24
+ this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex - 1 : undefined;
27
25
  }
28
26
  else {
29
- this.focusedIndex = this.selectedIndex !== undefined ? (parseInt(this.selectedIndex) + 1).toString() : undefined;
27
+ this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex + 1 : undefined;
30
28
  }
31
29
  }
32
30
  else {
33
31
  if (operator === false) {
34
- this.focusedIndex = (parseInt(this.focusedIndex) - 1).toString();
32
+ this._focusedIndex = this._focusedIndex - 1;
35
33
  }
36
34
  else {
37
- this.focusedIndex = (parseInt(this.focusedIndex) + 1).toString();
35
+ this._focusedIndex = this._focusedIndex + 1;
38
36
  }
39
37
  }
40
- if (parseInt(this.focusedIndex) < 0) {
41
- this.focusedIndex = "0";
38
+ if (this._focusedIndex < 0) {
39
+ this._focusedIndex = 0;
42
40
  }
43
- else if (parseInt(this.focusedIndex) > this._processedTabs.length - 1) {
44
- this.focusedIndex = (this._processedTabs.length - 1).toString();
41
+ else if (this._focusedIndex > this._processedTabs.length - 1) {
42
+ this._focusedIndex = this._processedTabs.length - 1;
45
43
  }
46
- this.setFocusedBtn(true, this.focusedIndex);
47
- this.setFocusedTab(this.focusedIndex);
48
- this.ezChange.emit(this.selectedTab);
44
+ this.setFocusedBtn(true, this._focusedIndex);
45
+ this.setFocusedTab(this._focusedIndex);
49
46
  }
50
47
  else if (ev.key === "Tab" || ev.key === "Escape") {
51
- this.focusedIndex = undefined;
52
- this.selectedTab = this._processedTabs[this.selectedIndex]["tabKey"];
53
- this.handleTabClick(this.selectedTab, parseInt(this.selectedIndex));
48
+ const currentTab = this._processedTabs[this.selectedIndex];
49
+ this._focusedIndex = undefined;
50
+ this.handleTabClick(currentTab);
54
51
  ev.preventDefault();
55
52
  this.setFocusedTab(this.selectedIndex);
56
53
  }
57
- // this.setFocusedTab();
58
54
  };
59
55
  }
60
- handleTabClick(tab, index) {
61
- this.selectedIndex = index.toString();
62
- this.focusedIndex = undefined;
63
- this.selectedTab = tab;
64
- this.ezChange.emit(this.selectedTab);
65
- this.setFocusedBtn(false, this.selectedIndex);
56
+ handleTabClick(tab) {
57
+ this.selectedIndex = tab.index;
58
+ this._focusedIndex = undefined;
59
+ this.selectedTab = tab.tabKey;
60
+ this.ezChange.emit(tab);
61
+ this.setFocusedBtn(false, tab.index);
66
62
  }
67
63
  componentWillRender() {
68
64
  if (!this._processedTabs) {
@@ -70,16 +66,16 @@ export class EzTabselector {
70
66
  if (this.tabs) {
71
67
  this.tabs.split(",").forEach((label) => {
72
68
  label = label.trim();
73
- this._processedTabs.push(new Tab(label, label));
69
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
74
70
  });
75
71
  }
76
72
  this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
77
73
  const tabKey = elem.getAttribute("tabKey");
78
74
  const label = elem.getAttribute("label");
79
- const t = new Tab(label, tabKey);
75
+ const t = { label, tabKey, index: this._processedTabs.length };
80
76
  const content = elem.firstChild;
81
77
  if (content) {
82
- content.setAttribute("slot", "tab" + this._processedTabs.length);
78
+ content.setAttribute("slot", "tab" + t.index);
83
79
  this._hostElem.appendChild(content);
84
80
  }
85
81
  this._processedTabs.push(t);
@@ -181,12 +177,12 @@ export class EzTabselector {
181
177
  h("div", { class: "scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.setFocusedParam(ev) }, this._processedTabs.map((tab, index) => {
182
178
  const labelStyle = { "min-width": this.getTextWidth(tab.label) };
183
179
  const tabId = "tab" + index;
184
- const isSelected = index === parseInt(this.selectedIndex) || (this.selectedTab && tab.tabKey === this.selectedTab);
180
+ const isSelected = index === this.selectedIndex || (this.selectedTab && tab.tabKey === this.selectedTab);
185
181
  if (isSelected) {
186
182
  this.selectedTab = tab.tabKey;
187
- this.selectedIndex = index.toString();
183
+ this.selectedIndex = index;
188
184
  }
189
- return h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab.tabKey, index), style: labelStyle },
185
+ return h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab), style: labelStyle },
190
186
  h("span", { class: "tab-label", title: tab.label }, tab.label),
191
187
  h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } }));
192
188
  })),
@@ -202,11 +198,11 @@ export class EzTabselector {
202
198
  }; }
203
199
  static get properties() { return {
204
200
  "selectedIndex": {
205
- "type": "string",
201
+ "type": "number",
206
202
  "mutable": true,
207
203
  "complexType": {
208
- "original": "string",
209
- "resolved": "string",
204
+ "original": "number",
205
+ "resolved": "number",
210
206
  "references": {}
211
207
  },
212
208
  "required": false,
@@ -261,19 +257,17 @@ export class EzTabselector {
261
257
  "composed": true,
262
258
  "docs": {
263
259
  "tags": [],
264
- "text": "Evento emitido ao clicar para abrir o popup (ezChange)."
260
+ "text": "Evento emitido ao clicar para abrir o popup (ezChange).\nO detail desse evento carrega tanto o tabKey quanto o index da aba\nselecionada."
265
261
  },
266
262
  "complexType": {
267
- "original": "string",
268
- "resolved": "string",
269
- "references": {}
263
+ "original": "Tab",
264
+ "resolved": "Tab",
265
+ "references": {
266
+ "Tab": {
267
+ "location": "local"
268
+ }
269
+ }
270
270
  }
271
271
  }]; }
272
272
  static get elementRef() { return "_hostElem"; }
273
273
  }
274
- class Tab {
275
- constructor(label, tabKey) {
276
- this.label = label;
277
- this.tabKey = tabKey;
278
- }
279
- }