@sankhyalabs/ezui 2.0.8 → 2.0.10

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 (31) hide show
  1. package/dist/cjs/ez-form.cjs.entry.js +22 -4
  2. package/dist/cjs/ez-grid.cjs.entry.js +5 -20
  3. package/dist/cjs/ez-scroller.cjs.entry.js +82 -4
  4. package/dist/cjs/ezui.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/collection/components/ez-form/DataBinder.js +14 -2
  7. package/dist/collection/components/ez-form/ez-form.js +8 -2
  8. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +1 -1
  9. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +2 -17
  10. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +2 -2
  11. package/dist/collection/components/ez-grid/ez-grid.js +1 -1
  12. package/dist/collection/components/ez-scroller/ez-scroller.css +87 -14
  13. package/dist/collection/components/ez-scroller/ez-scroller.js +125 -5
  14. package/dist/custom-elements/index.js +110 -30
  15. package/dist/esm/ez-form.entry.js +22 -4
  16. package/dist/esm/ez-grid.entry.js +5 -20
  17. package/dist/esm/ez-scroller.entry.js +83 -5
  18. package/dist/esm/ezui.js +1 -1
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/ezui/ezui.esm.js +1 -1
  21. package/dist/ezui/p-1ba371a3.entry.js +1 -0
  22. package/dist/ezui/p-ac296141.entry.js +1 -0
  23. package/dist/ezui/{p-36d7e2d2.entry.js → p-d0b8330e.entry.js} +1 -1
  24. package/dist/types/components/ez-form/DataBinder.d.ts +1 -0
  25. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -2
  26. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -1
  27. package/dist/types/components/ez-scroller/ez-scroller.d.ts +21 -16
  28. package/dist/types/components.d.ts +16 -0
  29. package/package.json +1 -1
  30. package/dist/ezui/p-e0aa9cb1.entry.js +0 -1
  31. package/dist/ezui/p-e3ee814c.entry.js +0 -1
@@ -1,21 +1,74 @@
1
- import { Component, h, Listen, Prop } from '@stencil/core';
1
+ import { UserAgentUtils } from '@sankhyalabs/core';
2
+ import { Component, h, Host, Listen, Prop, State } from '@stencil/core';
2
3
  import { EzScrollDirection } from './EzScrollDirection';
3
4
  export class EzScroller {
4
5
  constructor() {
6
+ this._classHidden = "ez-scroller__shadow--hidden";
7
+ this.isFirefox = false;
5
8
  /**
6
9
  * Determina se haverá scroll na direção Vertical, Horizontal ou Ambos.
7
10
  * Por padrão, a direção é "Ambos".
8
11
  */
9
12
  this.direction = EzScrollDirection.BOTH;
13
+ /**
14
+ * Determina se o scroll estará bloqueado quando necessário.
15
+ */
16
+ this.locked = false;
17
+ /**
18
+ * Determina de o efeito de sombreado está ativo.
19
+ */
20
+ this.activeShadow = false;
10
21
  }
11
22
  //---------------------------------------------
12
23
  // Private methods
13
24
  //---------------------------------------------
14
25
  getContainerClass() {
15
- return `ez-scroller__container ez-scroller__container--${this.direction}`;
26
+ return `ez-scroller__container ez-scroller__container--${this.direction}
27
+ ${this.locked ? " ez-scroller__container--locked" : ""}
28
+ ${this.isFirefox ? " ez-scroller__container--no-overlay" : ""}
29
+ `;
30
+ }
31
+ getShadowStartClass() {
32
+ return `ez-scroller__shadow-start ez-scroller__shadow-start--${this.direction}`;
33
+ }
34
+ getShadowEndClass() {
35
+ return `ez-scroller__shadow-end ez-scroller__shadow-end--${this.direction}`;
16
36
  }
17
37
  finishDrag() {
18
- this._container.classList.remove("dragging");
38
+ if (this._controller) {
39
+ this._container.classList.remove("dragging");
40
+ }
41
+ }
42
+ updateShadow() {
43
+ const container = this._container;
44
+ if (container) {
45
+ let remainingScroll;
46
+ if (this.direction === EzScrollDirection.HORIZONTAL) {
47
+ const { scrollWidth, clientWidth, scrollLeft } = container;
48
+ remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
49
+ this._startHidden = container.scrollLeft > 0;
50
+ }
51
+ else if (this.direction === EzScrollDirection.VERTICAL) {
52
+ const { scrollHeight, clientHeight, scrollTop } = container;
53
+ remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
54
+ this._startHidden = container.scrollTop > 0;
55
+ }
56
+ this._endHidden = remainingScroll > 0;
57
+ const shadowPositions = ["", "start", "end", "middle"];
58
+ const currentPosition = shadowPositions[Number(this._startHidden) | Number(this._endHidden) << 1];
59
+ if (currentPosition === "start") {
60
+ this._shadowStart.classList.remove(this._classHidden);
61
+ this._shadowEnd.classList.add(this._classHidden);
62
+ }
63
+ else if (currentPosition === "end") {
64
+ this._shadowStart.classList.add(this._classHidden);
65
+ this._shadowEnd.classList.remove(this._classHidden);
66
+ }
67
+ else {
68
+ this._shadowStart.classList.remove(this._classHidden);
69
+ this._shadowEnd.classList.remove(this._classHidden);
70
+ }
71
+ }
19
72
  }
20
73
  //---------------------------------------------
21
74
  // Event handlers
@@ -28,6 +81,10 @@ export class EzScroller {
28
81
  }
29
82
  }
30
83
  mouseDownHandler(evt) {
84
+ if (this.locked) {
85
+ this.finishDrag();
86
+ return;
87
+ }
31
88
  if (!this._controller) {
32
89
  this._controller = new ScrollCtrl(this._container);
33
90
  }
@@ -38,6 +95,10 @@ export class EzScroller {
38
95
  this.finishDrag();
39
96
  }
40
97
  mouseMoveHandler(evt) {
98
+ if (this.locked) {
99
+ this.finishDrag();
100
+ return;
101
+ }
41
102
  if (this._controller) {
42
103
  if (evt.buttons === 0) {
43
104
  this.finishDrag();
@@ -47,9 +108,29 @@ export class EzScroller {
47
108
  }
48
109
  }
49
110
  }
111
+ componentDidLoad() {
112
+ this.isFirefox = UserAgentUtils.isFirefox();
113
+ }
114
+ componentDidRender() {
115
+ var _a, _b;
116
+ if (this.direction === EzScrollDirection.BOTH) {
117
+ (_a = this._shadowStart) === null || _a === void 0 ? void 0 : _a.classList.add(this._classHidden);
118
+ (_b = this._shadowEnd) === null || _b === void 0 ? void 0 : _b.classList.add(this._classHidden);
119
+ return;
120
+ }
121
+ if (this._container && this.activeShadow) {
122
+ this._container.onscroll = this.updateShadow.bind(this);
123
+ this.updateShadow();
124
+ }
125
+ }
50
126
  render() {
51
- return (h("div", { ref: ref => this._container = ref, class: this.getContainerClass() },
52
- h("slot", null)));
127
+ return (h(Host, null,
128
+ this.activeShadow &&
129
+ h("span", { ref: ref => this._shadowStart = ref, class: this.getShadowStartClass() }),
130
+ h("div", { ref: ref => this._container = ref, class: this.getContainerClass() },
131
+ h("slot", null)),
132
+ this.activeShadow &&
133
+ h("span", { ref: ref => this._shadowEnd = ref, class: this.getShadowEndClass() })));
53
134
  }
54
135
  static get is() { return "ez-scroller"; }
55
136
  static get encapsulation() { return "shadow"; }
@@ -82,8 +163,47 @@ export class EzScroller {
82
163
  "attribute": "direction",
83
164
  "reflect": false,
84
165
  "defaultValue": "EzScrollDirection.BOTH"
166
+ },
167
+ "locked": {
168
+ "type": "boolean",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "boolean",
172
+ "resolved": "boolean",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": false,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": "Determina se o scroll estar\u00E1 bloqueado quando necess\u00E1rio."
180
+ },
181
+ "attribute": "locked",
182
+ "reflect": false,
183
+ "defaultValue": "false"
184
+ },
185
+ "activeShadow": {
186
+ "type": "boolean",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "boolean",
190
+ "resolved": "boolean",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": "Determina de o efeito de sombreado est\u00E1 ativo."
198
+ },
199
+ "attribute": "active-shadow",
200
+ "reflect": false,
201
+ "defaultValue": "false"
85
202
  }
86
203
  }; }
204
+ static get states() { return {
205
+ "isFirefox": {}
206
+ }; }
87
207
  static get listeners() { return [{
88
208
  "name": "click",
89
209
  "method": "clickListener",
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement as HTMLElement$1, createEvent, h, Host, forceUpdate, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
- import { FloatingManager, DateUtils as DateUtils$1, TimeFormatter, UserInterface, Action, WaitingChangeException, ApplicationContext, DataUnitAction, DataUnit, ObjectUtils as ObjectUtils$1, StringUtils as StringUtils$1, NumberUtils as NumberUtils$1, DataType, SortMode, MaskFormatter } from '@sankhyalabs/core';
3
+ import { FloatingManager, DateUtils as DateUtils$1, TimeFormatter, UserInterface, Action, WaitingChangeException, ApplicationContext, DataUnitAction, DataUnit, ObjectUtils as ObjectUtils$1, StringUtils as StringUtils$1, NumberUtils as NumberUtils$1, DataType, SortMode, UserAgentUtils, MaskFormatter } from '@sankhyalabs/core';
4
4
 
5
5
  var DialogType;
6
6
  (function (DialogType) {
@@ -2652,7 +2652,10 @@ class DataBinder {
2652
2652
  markInvalid(field) {
2653
2653
  this._invalidFields.set(field.name, field);
2654
2654
  if (this._fields.has(field.name)) {
2655
- this.updateErrorMessage(field.name, this._fields.get(field.name).field);
2655
+ const fieldElement = this._fields.get(field.name).field;
2656
+ if (!fieldElement["errorMessage"]) {
2657
+ this.updateErrorMessage(field.name, fieldElement);
2658
+ }
2656
2659
  }
2657
2660
  }
2658
2661
  clearInvalid() {
@@ -2679,7 +2682,16 @@ class DataBinder {
2679
2682
  }
2680
2683
  updateErrorMessage(fieldName, field) {
2681
2684
  const invalidField = this._invalidFields.get(fieldName);
2682
- field["errorMessage"] = invalidField ? invalidField.message : "";
2685
+ if (invalidField) {
2686
+ field["errorMessage"] = invalidField.message;
2687
+ }
2688
+ }
2689
+ getErrorMessage(fieldName) {
2690
+ if (this._fields.has(fieldName)) {
2691
+ const fieldElement = this._fields.get(fieldName).field;
2692
+ return fieldElement["errorMessage"] || null;
2693
+ }
2694
+ return undefined;
2683
2695
  }
2684
2696
  updateBind(fieldName, field) {
2685
2697
  const oldBind = this._fields.get(fieldName);
@@ -2857,10 +2869,16 @@ let EzForm$1 = class extends HTMLElement$1 {
2857
2869
  .map(f => f.dataset.fieldName)
2858
2870
  .concat(metadata.getRequiredFields());
2859
2871
  const invalidFields = [];
2860
- requiredFields.forEach(field => {
2872
+ new Set(requiredFields).forEach(field => {
2861
2873
  const value = record[field];
2862
2874
  if (value == undefined || value === "") {
2863
- invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
2875
+ const errorMessage = this._dataBinder.getErrorMessage(field);
2876
+ if (errorMessage) {
2877
+ invalidFields.push({ name: field, message: errorMessage });
2878
+ }
2879
+ else {
2880
+ invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
2881
+ }
2864
2882
  }
2865
2883
  });
2866
2884
  if (invalidFields.length > 0) {
@@ -117574,7 +117592,7 @@ class DataSource {
117574
117592
  this.duObserver = (action) => {
117575
117593
  switch (action.type) {
117576
117594
  case Action.METADATA_LOADED:
117577
- this._controller.setColumnsDef(this.buildColumnDefs(), true);
117595
+ this._controller.setColumnsDef(this.buildColumnDefs());
117578
117596
  break;
117579
117597
  case Action.LOADING_DATA:
117580
117598
  this._waitingForLoad = true;
@@ -117602,7 +117620,7 @@ class DataSource {
117602
117620
  };
117603
117621
  this._dataUnit = dataUnit;
117604
117622
  this._controller = controller;
117605
- this._controller.setColumnsDef(this.buildColumnDefs(), true);
117623
+ this._controller.setColumnsDef(this.buildColumnDefs());
117606
117624
  this._options = options;
117607
117625
  this._dataUnit.subscribe(this.duObserver);
117608
117626
  }
@@ -117921,23 +117939,8 @@ class AgGridController {
117921
117939
  }
117922
117940
  this._gridOptions.api.refreshServerSide({ purge: false });
117923
117941
  }
117924
- setColumnsDef(cols, showCheckSelection) {
117925
- const newColDefs = [];
117926
- if (showCheckSelection) {
117927
- newColDefs.push({
117928
- colId: this.CHECK_BOX_COL_ID,
117929
- headerName: "",
117930
- checkboxSelection: true,
117931
- headerComponent: "ezGridHeaderComponent",
117932
- headerClass: "ag-column-select-header",
117933
- width: 28,
117934
- suppressMovable: true,
117935
- suppressAutoSize: true,
117936
- suppressMenu: true,
117937
- lockPosition: true,
117938
- pinned: true
117939
- });
117940
- }
117942
+ setColumnsDef(cols) {
117943
+ const newColDefs = [Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: "", checkboxSelection: true, width: 28, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, this._multipleSelection && { headerComponent: "ezGridHeaderComponent", headerClass: "ag-column-select-header" })];
117941
117944
  if (this._statusResolver != undefined) {
117942
117945
  newColDefs.push({
117943
117946
  colId: this.STATUS_COL_ID,
@@ -118210,7 +118213,7 @@ let EzGrid$1 = class extends HTMLElement$1 {
118210
118213
  * Método responsável por receber a definição das colunas
118211
118214
  */
118212
118215
  async setColumnsDef(cols) {
118213
- this._gridController.setColumnsDef(cols, this.multipleSelection);
118216
+ this._gridController.setColumnsDef(cols);
118214
118217
  }
118215
118218
  /**
118216
118219
  * Adiciona item de menu nas colunas.
@@ -119453,27 +119456,79 @@ var EzScrollDirection;
119453
119456
  EzScrollDirection["BOTH"] = "both";
119454
119457
  })(EzScrollDirection || (EzScrollDirection = {}));
119455
119458
 
119456
- const ezScrollerCss = ":host{display:flex;cursor:grab;width:100%}.dragging{cursor:grabbing}.ez-scroller__container{display:flex;flex-direction:column;overflow:hidden;scrollbar-width:thin}.ez-scroller__container--horizontal{flex-direction:row;overflow-y:hidden;overflow-x:auto}.ez-scroller__container--vertical{overflow-y:auto;overflow-x:hidden}.ez-scroller__container--both{overflow:auto}::-webkit-scrollbar-track{background-color:var(--scrollbar--secondary);border-radius:var(--border--radius-small);visibility:hidden}::-webkit-scrollbar-thumb{background-color:transparent;border-radius:var(--border--radius-small);background-color:var(--scrollbar--primary)}:hover::-webkit-scrollbar-thumb{background-color:var(--scrollbar--primary)}::-webkit-scrollbar{background-color:transparent;width:var(--space--small);height:var(--space--small);max-width:var(--space--small);min-width:var(--space--small)}:hover::-webkit-scrollbar{background-color:var(--scrollbar--secondary)}";
119459
+ const ezScrollerCss = ":host{--ez-scroller--box-shadow-color:var(--background--body, #fafcff);display:flex;cursor:grab;width:100%}.dragging{cursor:grabbing}.ez-scroller__container{display:flex;flex-direction:column;overflow-y:hidden;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--scrollbar--primary) var(--scrollbar--secondary)}.ez-scroller__container--horizontal{flex-direction:row;overflow-y:hidden;overflow-x:hidden;padding-bottom:var(--space--small);margin-bottom:calc(var(--space--small) * -1)}.ez-scroller__container--horizontal:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-x:overlay}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay{padding-bottom:8px;margin-bottom:-8px}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-x:auto;padding-bottom:0px}.ez-scroller__container--vertical{overflow-y:hidden;overflow-x:hidden;padding-right:var(--space--small);margin-right:calc(var(--space--small) * -1)}.ez-scroller__container--vertical:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-y:overlay}.ez-scroller__container--vertical.ez-scroller__container--no-overlay{padding-right:8px;margin-right:-8px}.ez-scroller__container--vertical.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-y:auto;padding-right:0px}.ez-scroller__container--both{overflow:auto}.ez-scroller__container::-webkit-scrollbar-track{background-color:var(--scrollbar--secondary);border-radius:var(--border--radius-small);visibility:hidden}.ez-scroller__container::-webkit-scrollbar-thumb{background-color:var(--scrollbar--primary);border-radius:var(--border--radius-small)}.ez-scroller__container::-webkit-scrollbar{background-color:var(--scrollbar--secondary);width:var(--space--small);height:var(--space--small);max-width:var(--space--small);min-width:var(--space--small)}.ez-scroller__shadow-start,.ez-scroller__shadow-end{display:flex;z-index:1;background:var(--ez-scroller--box-shadow-color)}.ez-scroller__shadow-start--horizontal,.ez-scroller__shadow-end--horizontal{min-height:100%;width:10px}.ez-scroller__shadow-start--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) 6px 0px 10px 8px;margin-right:-6px}.ez-scroller__shadow-end--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) -6px 0px 10px 8px;margin-left:-6px}.ez-scroller__shadow-start--vertical,.ez-scroller__shadow-end--vertical{min-width:100%;height:10px}.ez-scroller__shadow-start--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px 6px 10px 8px;margin-bottom:-6px}.ez-scroller__shadow-end--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px -6px 10px 8px;margin-top:-6px}.ez-scroller__shadow--hidden{display:none}";
119457
119460
 
119458
119461
  let EzScroller$1 = class extends HTMLElement$1 {
119459
119462
  constructor() {
119460
119463
  super();
119461
119464
  this.__registerHost();
119462
119465
  this.__attachShadow();
119466
+ this._classHidden = "ez-scroller__shadow--hidden";
119467
+ this.isFirefox = false;
119463
119468
  /**
119464
119469
  * Determina se haverá scroll na direção Vertical, Horizontal ou Ambos.
119465
119470
  * Por padrão, a direção é "Ambos".
119466
119471
  */
119467
119472
  this.direction = EzScrollDirection.BOTH;
119473
+ /**
119474
+ * Determina se o scroll estará bloqueado quando necessário.
119475
+ */
119476
+ this.locked = false;
119477
+ /**
119478
+ * Determina de o efeito de sombreado está ativo.
119479
+ */
119480
+ this.activeShadow = false;
119468
119481
  }
119469
119482
  //---------------------------------------------
119470
119483
  // Private methods
119471
119484
  //---------------------------------------------
119472
119485
  getContainerClass() {
119473
- return `ez-scroller__container ez-scroller__container--${this.direction}`;
119486
+ return `ez-scroller__container ez-scroller__container--${this.direction}
119487
+ ${this.locked ? " ez-scroller__container--locked" : ""}
119488
+ ${this.isFirefox ? " ez-scroller__container--no-overlay" : ""}
119489
+ `;
119490
+ }
119491
+ getShadowStartClass() {
119492
+ return `ez-scroller__shadow-start ez-scroller__shadow-start--${this.direction}`;
119493
+ }
119494
+ getShadowEndClass() {
119495
+ return `ez-scroller__shadow-end ez-scroller__shadow-end--${this.direction}`;
119474
119496
  }
119475
119497
  finishDrag() {
119476
- this._container.classList.remove("dragging");
119498
+ if (this._controller) {
119499
+ this._container.classList.remove("dragging");
119500
+ }
119501
+ }
119502
+ updateShadow() {
119503
+ const container = this._container;
119504
+ if (container) {
119505
+ let remainingScroll;
119506
+ if (this.direction === EzScrollDirection.HORIZONTAL) {
119507
+ const { scrollWidth, clientWidth, scrollLeft } = container;
119508
+ remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
119509
+ this._startHidden = container.scrollLeft > 0;
119510
+ }
119511
+ else if (this.direction === EzScrollDirection.VERTICAL) {
119512
+ const { scrollHeight, clientHeight, scrollTop } = container;
119513
+ remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
119514
+ this._startHidden = container.scrollTop > 0;
119515
+ }
119516
+ this._endHidden = remainingScroll > 0;
119517
+ const shadowPositions = ["", "start", "end", "middle"];
119518
+ const currentPosition = shadowPositions[Number(this._startHidden) | Number(this._endHidden) << 1];
119519
+ if (currentPosition === "start") {
119520
+ this._shadowStart.classList.remove(this._classHidden);
119521
+ this._shadowEnd.classList.add(this._classHidden);
119522
+ }
119523
+ else if (currentPosition === "end") {
119524
+ this._shadowStart.classList.add(this._classHidden);
119525
+ this._shadowEnd.classList.remove(this._classHidden);
119526
+ }
119527
+ else {
119528
+ this._shadowStart.classList.remove(this._classHidden);
119529
+ this._shadowEnd.classList.remove(this._classHidden);
119530
+ }
119531
+ }
119477
119532
  }
119478
119533
  //---------------------------------------------
119479
119534
  // Event handlers
@@ -119486,6 +119541,10 @@ let EzScroller$1 = class extends HTMLElement$1 {
119486
119541
  }
119487
119542
  }
119488
119543
  mouseDownHandler(evt) {
119544
+ if (this.locked) {
119545
+ this.finishDrag();
119546
+ return;
119547
+ }
119489
119548
  if (!this._controller) {
119490
119549
  this._controller = new ScrollCtrl(this._container);
119491
119550
  }
@@ -119496,6 +119555,10 @@ let EzScroller$1 = class extends HTMLElement$1 {
119496
119555
  this.finishDrag();
119497
119556
  }
119498
119557
  mouseMoveHandler(evt) {
119558
+ if (this.locked) {
119559
+ this.finishDrag();
119560
+ return;
119561
+ }
119499
119562
  if (this._controller) {
119500
119563
  if (evt.buttons === 0) {
119501
119564
  this.finishDrag();
@@ -119505,8 +119568,25 @@ let EzScroller$1 = class extends HTMLElement$1 {
119505
119568
  }
119506
119569
  }
119507
119570
  }
119571
+ componentDidLoad() {
119572
+ this.isFirefox = UserAgentUtils.isFirefox();
119573
+ }
119574
+ componentDidRender() {
119575
+ var _a, _b;
119576
+ if (this.direction === EzScrollDirection.BOTH) {
119577
+ (_a = this._shadowStart) === null || _a === void 0 ? void 0 : _a.classList.add(this._classHidden);
119578
+ (_b = this._shadowEnd) === null || _b === void 0 ? void 0 : _b.classList.add(this._classHidden);
119579
+ return;
119580
+ }
119581
+ if (this._container && this.activeShadow) {
119582
+ this._container.onscroll = this.updateShadow.bind(this);
119583
+ this.updateShadow();
119584
+ }
119585
+ }
119508
119586
  render() {
119509
- return (h("div", { ref: ref => this._container = ref, class: this.getContainerClass() }, h("slot", null)));
119587
+ return (h(Host, null, this.activeShadow &&
119588
+ h("span", { ref: ref => this._shadowStart = ref, class: this.getShadowStartClass() }), h("div", { ref: ref => this._container = ref, class: this.getContainerClass() }, h("slot", null)), this.activeShadow &&
119589
+ h("span", { ref: ref => this._shadowEnd = ref, class: this.getShadowEndClass() })));
119510
119590
  }
119511
119591
  static get style() { return ezScrollerCss; }
119512
119592
  };
@@ -121045,7 +121125,7 @@ const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-nu
121045
121125
  const EzPopover = /*@__PURE__*/proxyCustomElement(EzPopover$1, [1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"]}]);
121046
121126
  const EzPopup = /*@__PURE__*/proxyCustomElement(EzPopup$1, [1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"heightMode":[1537,"height-mode"],"ezTitle":[1,"ez-title"]}]);
121047
121127
  const EzRadioButton = /*@__PURE__*/proxyCustomElement(EzRadioButton$1, [1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]);
121048
- const EzScroller = /*@__PURE__*/proxyCustomElement(EzScroller$1, [1,"ez-scroller",{"direction":[1]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]);
121128
+ const EzScroller = /*@__PURE__*/proxyCustomElement(EzScroller$1, [1,"ez-scroller",{"direction":[1],"locked":[4],"activeShadow":[4,"active-shadow"],"isFirefox":[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]);
121049
121129
  const EzSearch = /*@__PURE__*/proxyCustomElement(EzSearch$1, [1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513]}]);
121050
121130
  const EzTabselector = /*@__PURE__*/proxyCustomElement(EzTabselector$1, [1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32]}]);
121051
121131
  const EzTextArea = /*@__PURE__*/proxyCustomElement(EzTextArea$1, [1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513]}]);
@@ -676,7 +676,10 @@ class DataBinder {
676
676
  markInvalid(field) {
677
677
  this._invalidFields.set(field.name, field);
678
678
  if (this._fields.has(field.name)) {
679
- this.updateErrorMessage(field.name, this._fields.get(field.name).field);
679
+ const fieldElement = this._fields.get(field.name).field;
680
+ if (!fieldElement["errorMessage"]) {
681
+ this.updateErrorMessage(field.name, fieldElement);
682
+ }
680
683
  }
681
684
  }
682
685
  clearInvalid() {
@@ -703,7 +706,16 @@ class DataBinder {
703
706
  }
704
707
  updateErrorMessage(fieldName, field) {
705
708
  const invalidField = this._invalidFields.get(fieldName);
706
- field["errorMessage"] = invalidField ? invalidField.message : "";
709
+ if (invalidField) {
710
+ field["errorMessage"] = invalidField.message;
711
+ }
712
+ }
713
+ getErrorMessage(fieldName) {
714
+ if (this._fields.has(fieldName)) {
715
+ const fieldElement = this._fields.get(fieldName).field;
716
+ return fieldElement["errorMessage"] || null;
717
+ }
718
+ return undefined;
707
719
  }
708
720
  updateBind(fieldName, field) {
709
721
  const oldBind = this._fields.get(fieldName);
@@ -880,10 +892,16 @@ let EzForm = class {
880
892
  .map(f => f.dataset.fieldName)
881
893
  .concat(metadata.getRequiredFields());
882
894
  const invalidFields = [];
883
- requiredFields.forEach(field => {
895
+ new Set(requiredFields).forEach(field => {
884
896
  const value = record[field];
885
897
  if (value == undefined || value === "") {
886
- invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
898
+ const errorMessage = this._dataBinder.getErrorMessage(field);
899
+ if (errorMessage) {
900
+ invalidFields.push({ name: field, message: errorMessage });
901
+ }
902
+ else {
903
+ invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
904
+ }
887
905
  }
888
906
  });
889
907
  if (invalidFields.length > 0) {
@@ -114590,7 +114590,7 @@ class DataSource {
114590
114590
  this.duObserver = (action) => {
114591
114591
  switch (action.type) {
114592
114592
  case Action.METADATA_LOADED:
114593
- this._controller.setColumnsDef(this.buildColumnDefs(), true);
114593
+ this._controller.setColumnsDef(this.buildColumnDefs());
114594
114594
  break;
114595
114595
  case Action.LOADING_DATA:
114596
114596
  this._waitingForLoad = true;
@@ -114618,7 +114618,7 @@ class DataSource {
114618
114618
  };
114619
114619
  this._dataUnit = dataUnit;
114620
114620
  this._controller = controller;
114621
- this._controller.setColumnsDef(this.buildColumnDefs(), true);
114621
+ this._controller.setColumnsDef(this.buildColumnDefs());
114622
114622
  this._options = options;
114623
114623
  this._dataUnit.subscribe(this.duObserver);
114624
114624
  }
@@ -114937,23 +114937,8 @@ class AgGridController {
114937
114937
  }
114938
114938
  this._gridOptions.api.refreshServerSide({ purge: false });
114939
114939
  }
114940
- setColumnsDef(cols, showCheckSelection) {
114941
- const newColDefs = [];
114942
- if (showCheckSelection) {
114943
- newColDefs.push({
114944
- colId: this.CHECK_BOX_COL_ID,
114945
- headerName: "",
114946
- checkboxSelection: true,
114947
- headerComponent: "ezGridHeaderComponent",
114948
- headerClass: "ag-column-select-header",
114949
- width: 28,
114950
- suppressMovable: true,
114951
- suppressAutoSize: true,
114952
- suppressMenu: true,
114953
- lockPosition: true,
114954
- pinned: true
114955
- });
114956
- }
114940
+ setColumnsDef(cols) {
114941
+ const newColDefs = [Object.assign({ colId: this.CHECK_BOX_COL_ID, headerName: "", checkboxSelection: true, width: 28, suppressMovable: true, suppressAutoSize: true, suppressMenu: true, lockPosition: true, pinned: true }, this._multipleSelection && { headerComponent: "ezGridHeaderComponent", headerClass: "ag-column-select-header" })];
114957
114942
  if (this._statusResolver != undefined) {
114958
114943
  newColDefs.push({
114959
114944
  colId: this.STATUS_COL_ID,
@@ -115225,7 +115210,7 @@ let EzGrid = class {
115225
115210
  * Método responsável por receber a definição das colunas
115226
115211
  */
115227
115212
  async setColumnsDef(cols) {
115228
- this._gridController.setColumnsDef(cols, this.multipleSelection);
115213
+ this._gridController.setColumnsDef(cols);
115229
115214
  }
115230
115215
  /**
115231
115216
  * Adiciona item de menu nas colunas.
@@ -1,4 +1,5 @@
1
- import { r as registerInstance, h } from './index-7bc778b3.js';
1
+ import { r as registerInstance, h, H as Host } from './index-7bc778b3.js';
2
+ import { UserAgentUtils } from '@sankhyalabs/core';
2
3
 
3
4
  var EzScrollDirection;
4
5
  (function (EzScrollDirection) {
@@ -7,25 +8,77 @@ var EzScrollDirection;
7
8
  EzScrollDirection["BOTH"] = "both";
8
9
  })(EzScrollDirection || (EzScrollDirection = {}));
9
10
 
10
- const ezScrollerCss = ":host{display:flex;cursor:grab;width:100%}.dragging{cursor:grabbing}.ez-scroller__container{display:flex;flex-direction:column;overflow:hidden;scrollbar-width:thin}.ez-scroller__container--horizontal{flex-direction:row;overflow-y:hidden;overflow-x:auto}.ez-scroller__container--vertical{overflow-y:auto;overflow-x:hidden}.ez-scroller__container--both{overflow:auto}::-webkit-scrollbar-track{background-color:var(--scrollbar--secondary);border-radius:var(--border--radius-small);visibility:hidden}::-webkit-scrollbar-thumb{background-color:transparent;border-radius:var(--border--radius-small);background-color:var(--scrollbar--primary)}:hover::-webkit-scrollbar-thumb{background-color:var(--scrollbar--primary)}::-webkit-scrollbar{background-color:transparent;width:var(--space--small);height:var(--space--small);max-width:var(--space--small);min-width:var(--space--small)}:hover::-webkit-scrollbar{background-color:var(--scrollbar--secondary)}";
11
+ const ezScrollerCss = ":host{--ez-scroller--box-shadow-color:var(--background--body, #fafcff);display:flex;cursor:grab;width:100%}.dragging{cursor:grabbing}.ez-scroller__container{display:flex;flex-direction:column;overflow-y:hidden;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--scrollbar--primary) var(--scrollbar--secondary)}.ez-scroller__container--horizontal{flex-direction:row;overflow-y:hidden;overflow-x:hidden;padding-bottom:var(--space--small);margin-bottom:calc(var(--space--small) * -1)}.ez-scroller__container--horizontal:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-x:overlay}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay{padding-bottom:8px;margin-bottom:-8px}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-x:auto;padding-bottom:0px}.ez-scroller__container--vertical{overflow-y:hidden;overflow-x:hidden;padding-right:var(--space--small);margin-right:calc(var(--space--small) * -1)}.ez-scroller__container--vertical:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-y:overlay}.ez-scroller__container--vertical.ez-scroller__container--no-overlay{padding-right:8px;margin-right:-8px}.ez-scroller__container--vertical.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-y:auto;padding-right:0px}.ez-scroller__container--both{overflow:auto}.ez-scroller__container::-webkit-scrollbar-track{background-color:var(--scrollbar--secondary);border-radius:var(--border--radius-small);visibility:hidden}.ez-scroller__container::-webkit-scrollbar-thumb{background-color:var(--scrollbar--primary);border-radius:var(--border--radius-small)}.ez-scroller__container::-webkit-scrollbar{background-color:var(--scrollbar--secondary);width:var(--space--small);height:var(--space--small);max-width:var(--space--small);min-width:var(--space--small)}.ez-scroller__shadow-start,.ez-scroller__shadow-end{display:flex;z-index:1;background:var(--ez-scroller--box-shadow-color)}.ez-scroller__shadow-start--horizontal,.ez-scroller__shadow-end--horizontal{min-height:100%;width:10px}.ez-scroller__shadow-start--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) 6px 0px 10px 8px;margin-right:-6px}.ez-scroller__shadow-end--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) -6px 0px 10px 8px;margin-left:-6px}.ez-scroller__shadow-start--vertical,.ez-scroller__shadow-end--vertical{min-width:100%;height:10px}.ez-scroller__shadow-start--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px 6px 10px 8px;margin-bottom:-6px}.ez-scroller__shadow-end--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px -6px 10px 8px;margin-top:-6px}.ez-scroller__shadow--hidden{display:none}";
11
12
 
12
13
  let EzScroller = class {
13
14
  constructor(hostRef) {
14
15
  registerInstance(this, hostRef);
16
+ this._classHidden = "ez-scroller__shadow--hidden";
17
+ this.isFirefox = false;
15
18
  /**
16
19
  * Determina se haverá scroll na direção Vertical, Horizontal ou Ambos.
17
20
  * Por padrão, a direção é "Ambos".
18
21
  */
19
22
  this.direction = EzScrollDirection.BOTH;
23
+ /**
24
+ * Determina se o scroll estará bloqueado quando necessário.
25
+ */
26
+ this.locked = false;
27
+ /**
28
+ * Determina de o efeito de sombreado está ativo.
29
+ */
30
+ this.activeShadow = false;
20
31
  }
21
32
  //---------------------------------------------
22
33
  // Private methods
23
34
  //---------------------------------------------
24
35
  getContainerClass() {
25
- return `ez-scroller__container ez-scroller__container--${this.direction}`;
36
+ return `ez-scroller__container ez-scroller__container--${this.direction}
37
+ ${this.locked ? " ez-scroller__container--locked" : ""}
38
+ ${this.isFirefox ? " ez-scroller__container--no-overlay" : ""}
39
+ `;
40
+ }
41
+ getShadowStartClass() {
42
+ return `ez-scroller__shadow-start ez-scroller__shadow-start--${this.direction}`;
43
+ }
44
+ getShadowEndClass() {
45
+ return `ez-scroller__shadow-end ez-scroller__shadow-end--${this.direction}`;
26
46
  }
27
47
  finishDrag() {
28
- this._container.classList.remove("dragging");
48
+ if (this._controller) {
49
+ this._container.classList.remove("dragging");
50
+ }
51
+ }
52
+ updateShadow() {
53
+ const container = this._container;
54
+ if (container) {
55
+ let remainingScroll;
56
+ if (this.direction === EzScrollDirection.HORIZONTAL) {
57
+ const { scrollWidth, clientWidth, scrollLeft } = container;
58
+ remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
59
+ this._startHidden = container.scrollLeft > 0;
60
+ }
61
+ else if (this.direction === EzScrollDirection.VERTICAL) {
62
+ const { scrollHeight, clientHeight, scrollTop } = container;
63
+ remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
64
+ this._startHidden = container.scrollTop > 0;
65
+ }
66
+ this._endHidden = remainingScroll > 0;
67
+ const shadowPositions = ["", "start", "end", "middle"];
68
+ const currentPosition = shadowPositions[Number(this._startHidden) | Number(this._endHidden) << 1];
69
+ if (currentPosition === "start") {
70
+ this._shadowStart.classList.remove(this._classHidden);
71
+ this._shadowEnd.classList.add(this._classHidden);
72
+ }
73
+ else if (currentPosition === "end") {
74
+ this._shadowStart.classList.add(this._classHidden);
75
+ this._shadowEnd.classList.remove(this._classHidden);
76
+ }
77
+ else {
78
+ this._shadowStart.classList.remove(this._classHidden);
79
+ this._shadowEnd.classList.remove(this._classHidden);
80
+ }
81
+ }
29
82
  }
30
83
  //---------------------------------------------
31
84
  // Event handlers
@@ -38,6 +91,10 @@ let EzScroller = class {
38
91
  }
39
92
  }
40
93
  mouseDownHandler(evt) {
94
+ if (this.locked) {
95
+ this.finishDrag();
96
+ return;
97
+ }
41
98
  if (!this._controller) {
42
99
  this._controller = new ScrollCtrl(this._container);
43
100
  }
@@ -48,6 +105,10 @@ let EzScroller = class {
48
105
  this.finishDrag();
49
106
  }
50
107
  mouseMoveHandler(evt) {
108
+ if (this.locked) {
109
+ this.finishDrag();
110
+ return;
111
+ }
51
112
  if (this._controller) {
52
113
  if (evt.buttons === 0) {
53
114
  this.finishDrag();
@@ -57,8 +118,25 @@ let EzScroller = class {
57
118
  }
58
119
  }
59
120
  }
121
+ componentDidLoad() {
122
+ this.isFirefox = UserAgentUtils.isFirefox();
123
+ }
124
+ componentDidRender() {
125
+ var _a, _b;
126
+ if (this.direction === EzScrollDirection.BOTH) {
127
+ (_a = this._shadowStart) === null || _a === void 0 ? void 0 : _a.classList.add(this._classHidden);
128
+ (_b = this._shadowEnd) === null || _b === void 0 ? void 0 : _b.classList.add(this._classHidden);
129
+ return;
130
+ }
131
+ if (this._container && this.activeShadow) {
132
+ this._container.onscroll = this.updateShadow.bind(this);
133
+ this.updateShadow();
134
+ }
135
+ }
60
136
  render() {
61
- return (h("div", { ref: ref => this._container = ref, class: this.getContainerClass() }, h("slot", null)));
137
+ return (h(Host, null, this.activeShadow &&
138
+ h("span", { ref: ref => this._shadowStart = ref, class: this.getShadowStartClass() }), h("div", { ref: ref => this._container = ref, class: this.getContainerClass() }, h("slot", null)), this.activeShadow &&
139
+ h("span", { ref: ref => this._shadowEnd = ref, class: this.getShadowEndClass() })));
62
140
  }
63
141
  };
64
142
  class ScrollCtrl {