@sankhyalabs/ezui 1.1.131 → 1.1.134

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 (44) hide show
  1. package/dist/cjs/ez-form.cjs.entry.js +14 -3
  2. package/dist/cjs/ez-grid.cjs.entry.js +215 -51
  3. package/dist/cjs/ez-list.cjs.entry.js +11 -0
  4. package/dist/cjs/ez-time-input.cjs.entry.js +1 -2
  5. package/dist/cjs/ezui.cjs.js +1 -1
  6. package/dist/cjs/grid-config.cjs.entry.js +64 -4
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/components/ez-form/DataBinder.js +13 -2
  9. package/dist/collection/components/ez-form/ez-form.js +1 -1
  10. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +10 -5
  11. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +128 -36
  12. package/dist/collection/components/ez-grid/ez-grid.js +253 -15
  13. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +44 -2
  14. package/dist/collection/components/ez-list/ez-list.js +27 -0
  15. package/dist/collection/components/ez-time-input/ez-time-input.js +1 -2
  16. package/dist/collection/utils/interfaces/PageableComponent.js +1 -0
  17. package/dist/custom-elements/index.js +305 -78
  18. package/dist/esm/ez-form.entry.js +14 -3
  19. package/dist/esm/ez-grid.entry.js +216 -52
  20. package/dist/esm/ez-list.entry.js +11 -0
  21. package/dist/esm/ez-time-input.entry.js +1 -2
  22. package/dist/esm/ezui.js +1 -1
  23. package/dist/esm/grid-config.entry.js +64 -4
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/ezui/ezui.esm.js +1 -1
  26. package/dist/ezui/{p-2d165ca8.entry.js → p-80d863c2.entry.js} +7 -7
  27. package/dist/ezui/p-bb7ad4ae.entry.js +1 -0
  28. package/dist/ezui/{p-47fe4273.entry.js → p-cfa7378a.entry.js} +1 -1
  29. package/dist/ezui/p-d9bb2a96.entry.js +1 -0
  30. package/dist/ezui/p-f1a18697.entry.js +1 -0
  31. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +46 -0
  32. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +12 -0
  33. package/dist/types/components/ez-grid/ez-grid.d.ts +45 -4
  34. package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
  35. package/dist/types/components/ez-list/ez-list.d.ts +4 -0
  36. package/dist/types/components.d.ts +45 -0
  37. package/dist/types/utils/interfaces/PageableComponent.d.ts +12 -0
  38. package/package.json +1 -1
  39. package/dist/cjs/AssetsUtils-78164781.js +0 -24
  40. package/dist/esm/AssetsUtils-aab9ca8f.js +0 -22
  41. package/dist/ezui/p-51b878f7.js +0 -1
  42. package/dist/ezui/p-6d39b7ea.entry.js +0 -1
  43. package/dist/ezui/p-7d5b2ebf.entry.js +0 -1
  44. package/dist/ezui/p-ed1e0331.entry.js +0 -1
@@ -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.
@@ -66,6 +66,74 @@ export class EzGrid {
66
66
  async quickFilter(term) {
67
67
  this._gridController.quickFilter(term);
68
68
  }
69
+ /**
70
+ * Método para fazer um filtro rápido na grid.
71
+ */
72
+ async nextPage() {
73
+ this._gridController.nextPage();
74
+ }
75
+ /**
76
+ * Método para fazer um filtro rápido na grid.
77
+ */
78
+ async previousPage() {
79
+ this._gridController.previousPage();
80
+ }
81
+ /**
82
+ * Método para fazer um filtro rápido na grid.
83
+ */
84
+ async hasNextPage() {
85
+ return new Promise(resolve => {
86
+ resolve(this._navigationHasNext);
87
+ });
88
+ }
89
+ /**
90
+ * Método para fazer um filtro rápido na grid.
91
+ */
92
+ async hasPreviousPage() {
93
+ return new Promise(resolve => {
94
+ resolve(this._navigationHasPrevious);
95
+ });
96
+ }
97
+ /**
98
+ * Método para verificar se o registro selecionado é o ultimo da página.
99
+ */
100
+ async isLastOfPage() {
101
+ return new Promise(resolve => {
102
+ resolve(this._gridController.isLastOfPage());
103
+ });
104
+ }
105
+ /**
106
+ * Método para verificar se o registro selecionado é o primeiro da página.
107
+ */
108
+ async isFirstOfPage() {
109
+ return new Promise(resolve => {
110
+ resolve(this._gridController.isFirstOfPage());
111
+ });
112
+ }
113
+ /**
114
+ * Método para navegar para o proxímo registro da grid.
115
+ */
116
+ async nextRecord() {
117
+ this._gridController.nextRecord();
118
+ }
119
+ /**
120
+ * Método para navegar para o registro anterior da grid.
121
+ */
122
+ async previousRecord() {
123
+ this._gridController.previousRecord();
124
+ }
125
+ /**
126
+ * Método para verificar se existem proximos registros.
127
+ */
128
+ async hasNextRecord() {
129
+ return Promise.resolve(this._gridController.hasNextRecord());
130
+ }
131
+ /**
132
+ * Método para verificar se existem registros anteriores.
133
+ */
134
+ async hasPreviousRecord() {
135
+ return Promise.resolve(this._gridController.hasPreviousRecord());
136
+ }
69
137
  componentWillLoad() {
70
138
  if (this.dataUnit) {
71
139
  this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
@@ -138,7 +206,7 @@ export class EzGrid {
138
206
  componentDidLoad() {
139
207
  this._gridController.initDatagrid(this._container, {
140
208
  onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
141
- onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
209
+ onSelectionChange: (state) => this.ezSelectionChange.emit(state.selection),
142
210
  onPaginationChange: (status) => {
143
211
  this._navigationHasPrevious = status.hasPrevious;
144
212
  this._navigationHasNext = status.hasNext;
@@ -174,34 +242,32 @@ export class EzGrid {
174
242
  h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" },
175
243
  h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, `${this._navigationFirstRow}-${this._navigationLastRow}`),
176
244
  ` de ${this._navigationTotalRows}`),
177
- h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this._gridController.previousPage(), label: "P\u00E1gina anterior" }),
178
- h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this._gridController.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
245
+ h("ez-button", { size: "small", iconName: "chevron-left", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }),
246
+ h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
179
247
  ];
180
248
  }
181
249
  applyConfig(config) {
182
250
  this._gridController.setColumnsState(config.columns);
183
- this.closeConfig();
251
+ this.closeGridConfig();
184
252
  }
185
- closeConfig() {
186
- this._popUpVisible = false;
253
+ closeGridConfig() {
254
+ this._popUpGridConfig = false;
187
255
  }
188
- openConfig() {
256
+ openGridConfig() {
189
257
  this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
190
258
  this._gridConfig.selectedTab = "Colunas";
191
- this._popUpVisible = true;
259
+ this._popUpGridConfig = true;
192
260
  }
193
261
  render() {
194
262
  return (h(Host, null,
195
263
  h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" },
196
264
  h("div", { class: "grid-header__container" },
197
265
  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(); } }))),
266
+ h("div", { class: "grid-header__container" }, this.getPaginationControl())),
201
267
  h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }),
202
268
  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() }))));
269
+ h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() },
270
+ 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
271
  }
206
272
  static get is() { return "ez-grid"; }
207
273
  static get encapsulation() { return "scoped"; }
@@ -312,7 +378,7 @@ export class EzGrid {
312
378
  "_navigationFirstRow": {},
313
379
  "_navigationLastRow": {},
314
380
  "_navigationTotalRows": {},
315
- "_popUpVisible": {}
381
+ "_popUpGridConfig": {}
316
382
  }; }
317
383
  static get events() { return [{
318
384
  "method": "ezColumnStateChange",
@@ -591,6 +657,178 @@ export class EzGrid {
591
657
  "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
592
658
  "tags": []
593
659
  }
660
+ },
661
+ "nextPage": {
662
+ "complexType": {
663
+ "signature": "() => Promise<void>",
664
+ "parameters": [],
665
+ "references": {
666
+ "Promise": {
667
+ "location": "global"
668
+ }
669
+ },
670
+ "return": "Promise<void>"
671
+ },
672
+ "docs": {
673
+ "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
674
+ "tags": []
675
+ }
676
+ },
677
+ "previousPage": {
678
+ "complexType": {
679
+ "signature": "() => Promise<void>",
680
+ "parameters": [],
681
+ "references": {
682
+ "Promise": {
683
+ "location": "global"
684
+ }
685
+ },
686
+ "return": "Promise<void>"
687
+ },
688
+ "docs": {
689
+ "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
690
+ "tags": []
691
+ }
692
+ },
693
+ "hasNextPage": {
694
+ "complexType": {
695
+ "signature": "() => Promise<boolean>",
696
+ "parameters": [],
697
+ "references": {
698
+ "Promise": {
699
+ "location": "global"
700
+ }
701
+ },
702
+ "return": "Promise<boolean>"
703
+ },
704
+ "docs": {
705
+ "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
706
+ "tags": []
707
+ }
708
+ },
709
+ "hasPreviousPage": {
710
+ "complexType": {
711
+ "signature": "() => Promise<boolean>",
712
+ "parameters": [],
713
+ "references": {
714
+ "Promise": {
715
+ "location": "global"
716
+ }
717
+ },
718
+ "return": "Promise<boolean>"
719
+ },
720
+ "docs": {
721
+ "text": "M\u00E9todo para fazer um filtro r\u00E1pido na grid.",
722
+ "tags": []
723
+ }
724
+ },
725
+ "isLastOfPage": {
726
+ "complexType": {
727
+ "signature": "() => Promise<boolean>",
728
+ "parameters": [],
729
+ "references": {
730
+ "Promise": {
731
+ "location": "global"
732
+ }
733
+ },
734
+ "return": "Promise<boolean>"
735
+ },
736
+ "docs": {
737
+ "text": "M\u00E9todo para verificar se o registro selecionado \u00E9 o ultimo da p\u00E1gina.",
738
+ "tags": []
739
+ }
740
+ },
741
+ "isFirstOfPage": {
742
+ "complexType": {
743
+ "signature": "() => Promise<boolean>",
744
+ "parameters": [],
745
+ "references": {
746
+ "Promise": {
747
+ "location": "global"
748
+ }
749
+ },
750
+ "return": "Promise<boolean>"
751
+ },
752
+ "docs": {
753
+ "text": "M\u00E9todo para verificar se o registro selecionado \u00E9 o primeiro da p\u00E1gina.",
754
+ "tags": []
755
+ }
756
+ },
757
+ "nextRecord": {
758
+ "complexType": {
759
+ "signature": "() => Promise<void>",
760
+ "parameters": [],
761
+ "references": {
762
+ "Promise": {
763
+ "location": "global"
764
+ }
765
+ },
766
+ "return": "Promise<void>"
767
+ },
768
+ "docs": {
769
+ "text": "M\u00E9todo para navegar para o prox\u00EDmo registro da grid.",
770
+ "tags": []
771
+ }
772
+ },
773
+ "previousRecord": {
774
+ "complexType": {
775
+ "signature": "() => Promise<void>",
776
+ "parameters": [],
777
+ "references": {
778
+ "Promise": {
779
+ "location": "global"
780
+ }
781
+ },
782
+ "return": "Promise<void>"
783
+ },
784
+ "docs": {
785
+ "text": "M\u00E9todo para navegar para o registro anterior da grid.",
786
+ "tags": []
787
+ }
788
+ },
789
+ "hasNextRecord": {
790
+ "complexType": {
791
+ "signature": "() => Promise<boolean>",
792
+ "parameters": [],
793
+ "references": {
794
+ "Promise": {
795
+ "location": "global"
796
+ }
797
+ },
798
+ "return": "Promise<boolean>"
799
+ },
800
+ "docs": {
801
+ "text": "M\u00E9todo para verificar se existem proximos registros.",
802
+ "tags": []
803
+ }
804
+ },
805
+ "hasPreviousRecord": {
806
+ "complexType": {
807
+ "signature": "() => Promise<boolean>",
808
+ "parameters": [],
809
+ "references": {
810
+ "Promise": {
811
+ "location": "global"
812
+ }
813
+ },
814
+ "return": "Promise<boolean>"
815
+ },
816
+ "docs": {
817
+ "text": "M\u00E9todo para verificar se existem registros anteriores.",
818
+ "tags": []
819
+ }
820
+ },
821
+ "openGridConfig": {
822
+ "complexType": {
823
+ "signature": "() => Promise<void>",
824
+ "parameters": [],
825
+ "references": {},
826
+ "return": "Promise<void>"
827
+ },
828
+ "docs": {
829
+ "text": "",
830
+ "tags": []
831
+ }
594
832
  }
595
833
  }; }
596
834
  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>",
@@ -1,7 +1,6 @@
1
1
  import { Element, Component, Prop, h, Watch, Host, Method } from "@stencil/core";
2
2
  import { TimeFormatter, MaskFormatter, NumberUtils } from "@sankhyalabs/core";
3
3
  import CSSVarsUtils from "../../utils/CSSVarsUtils";
4
- import { getSpritePath } from "../../utils/AssetsUtils";
5
4
  export class EzTimeInput {
6
5
  constructor() {
7
6
  /**
@@ -103,7 +102,7 @@ export class EzTimeInput {
103
102
  render() {
104
103
  return (h(Host, null,
105
104
  h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode },
106
- h("ez-icon", { slot: "leftIcon", href: getSpritePath("timer-outline") }))));
105
+ h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
107
106
  }
108
107
  static get is() { return "ez-time-input"; }
109
108
  static get encapsulation() { return "shadow"; }