@sankhyalabs/ezui 5.22.0-dev.2 → 5.22.0-dev.21

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 (87) hide show
  1. package/dist/cjs/{RecordValidationProcessor-4c893e04.js → RecordValidationProcessor-10846595.js} +7 -1
  2. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +31 -4
  3. package/dist/cjs/ez-form-view.cjs.entry.js +3 -2
  4. package/dist/cjs/ez-form.cjs.entry.js +7 -3
  5. package/dist/cjs/ez-grid.cjs.entry.js +264 -20
  6. package/dist/cjs/ez-modal-container.cjs.entry.js +2 -1
  7. package/dist/cjs/ez-modal.cjs.entry.js +7 -1
  8. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-popup.cjs.entry.js +9 -2
  10. package/dist/cjs/ez-search.cjs.entry.js +6 -3
  11. package/dist/cjs/ez-tabselector.cjs.entry.js +8 -2
  12. package/dist/cjs/ezui.cjs.js +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +45 -5
  15. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
  16. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +106 -8
  17. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +83 -5
  18. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +58 -7
  19. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +8 -0
  20. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  21. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +1 -0
  22. package/dist/collection/components/ez-grid/ez-grid.js +45 -0
  23. package/dist/collection/components/ez-modal/ez-modal.js +25 -1
  24. package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
  25. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
  26. package/dist/collection/components/ez-popup/ez-popup.css +5 -1
  27. package/dist/collection/components/ez-popup/ez-popup.js +26 -1
  28. package/dist/collection/components/ez-search/ez-search.js +24 -3
  29. package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -2
  30. package/dist/collection/utils/form/DataBinder.js +7 -3
  31. package/dist/collection/utils/validators/recordvalidator/IInvalidCells.js +1 -0
  32. package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +7 -1
  33. package/dist/custom-elements/index.js +349 -44
  34. package/dist/esm/{RecordValidationProcessor-b00b8b77.js → RecordValidationProcessor-9c6cc267.js} +7 -1
  35. package/dist/esm/ez-custom-form-input_2.entry.js +32 -5
  36. package/dist/esm/ez-form-view.entry.js +3 -2
  37. package/dist/esm/ez-form.entry.js +8 -4
  38. package/dist/esm/ez-grid.entry.js +264 -20
  39. package/dist/esm/ez-modal-container.entry.js +2 -1
  40. package/dist/esm/ez-modal.entry.js +7 -1
  41. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  42. package/dist/esm/ez-popup.entry.js +9 -2
  43. package/dist/esm/ez-search.entry.js +6 -3
  44. package/dist/esm/ez-tabselector.entry.js +8 -2
  45. package/dist/esm/ezui.js +1 -1
  46. package/dist/esm/loader.js +1 -1
  47. package/dist/ezui/ezui.esm.js +1 -1
  48. package/dist/ezui/p-08061683.entry.js +1 -0
  49. package/dist/ezui/p-34b6916c.entry.js +1 -0
  50. package/dist/ezui/p-42533ea4.entry.js +1 -0
  51. package/dist/ezui/p-4d64a3e4.entry.js +1 -0
  52. package/dist/ezui/{p-816cece6.entry.js → p-a9156fef.entry.js} +2 -2
  53. package/dist/ezui/p-c0d9c4f8.entry.js +1 -0
  54. package/dist/ezui/p-c36b7c56.entry.js +1 -0
  55. package/dist/ezui/p-cdc472cc.entry.js +1 -0
  56. package/dist/ezui/p-e26f12dd.entry.js +1 -0
  57. package/dist/ezui/p-f42855b9.js +1 -0
  58. package/dist/ezui/p-f9e551de.entry.js +1 -0
  59. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +7 -1
  60. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
  61. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +32 -4
  62. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +19 -3
  63. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +18 -0
  64. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +13 -2
  65. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -0
  66. package/dist/types/components/ez-grid/ez-grid.d.ts +9 -0
  67. package/dist/types/components/ez-modal/ez-modal.d.ts +5 -0
  68. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
  69. package/dist/types/components/ez-popup/ez-popup.d.ts +6 -0
  70. package/dist/types/components/ez-search/ez-search.d.ts +4 -0
  71. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -1
  72. package/dist/types/components.d.ts +49 -0
  73. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
  74. package/dist/types/utils/form/DataBinder.d.ts +2 -0
  75. package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
  76. package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
  77. package/package.json +1 -1
  78. package/dist/ezui/p-04f24913.js +0 -1
  79. package/dist/ezui/p-12ae1104.entry.js +0 -1
  80. package/dist/ezui/p-2dcb50d4.entry.js +0 -1
  81. package/dist/ezui/p-30775e7f.entry.js +0 -1
  82. package/dist/ezui/p-4d5235f1.entry.js +0 -1
  83. package/dist/ezui/p-5056284a.entry.js +0 -1
  84. package/dist/ezui/p-784fe207.entry.js +0 -1
  85. package/dist/ezui/p-9ab22a07.entry.js +0 -1
  86. package/dist/ezui/p-d9401ea0.entry.js +0 -1
  87. package/dist/ezui/p-f3c526cc.entry.js +0 -1
@@ -15,6 +15,7 @@ export class EzPopup {
15
15
  this.useHeader = true;
16
16
  this.heightMode = "full";
17
17
  this.ezTitle = undefined;
18
+ this.enabledScroll = false;
18
19
  }
19
20
  observeConfig() {
20
21
  this.manageOverflow();
@@ -52,11 +53,17 @@ export class EzPopup {
52
53
  getGridSize() {
53
54
  return this._sizeClasses[this.size] || this._sizeClasses["medium"];
54
55
  }
56
+ handlePopupHeight() {
57
+ return this.heightMode === 'auto' ? 'popup__container--auto' : '';
58
+ }
59
+ handlePopupOverflowY() {
60
+ return this.enabledScroll ? 'popup__overflow-y--auto' : '';
61
+ }
55
62
  componentDidRender() {
56
63
  this.manageOverlay();
57
64
  }
58
65
  render() {
59
- return (h(Host, null, this.opened ? (h("div", { class: "overlay", ref: ref => this._popupRef = ref, tabIndex: -1 }, h("div", { class: "popup col " + this.getGridSize() }, h("div", { class: "popup__container " + (this.heightMode === "auto" ? "popup__container--auto" : "") }, h("div", { class: "popup__content" }, h("div", { class: "popup__header " + (this.useHeader ? "popup__header--padding" : "") }, this.useHeader &&
66
+ return (h(Host, null, this.opened ? (h("div", { class: "overlay", ref: ref => this._popupRef = ref, tabIndex: -1 }, h("div", { class: "popup col " + this.getGridSize() }, h("div", { class: `popup__container ${(this.handlePopupHeight())} ${this.handlePopupOverflowY()}` }, h("div", { class: "popup__content" }, h("div", { class: "popup__header " + (this.useHeader ? "popup__header--padding" : "") }, this.useHeader &&
60
67
  h(Fragment, null, !!this.ezTitle && h("div", { class: "popup__title" }, this.ezTitle), h("button", { class: this.ezTitle ? "btn-close" : "btn-close btn-close--solo", onClick: () => { this.opened = false; this.ezClosePopup.emit(); } }))), h("div", { class: "popup__expandable-content" }, h("slot", null))))))) : undefined));
61
68
  }
62
69
  static get is() { return "ez-popup"; }
@@ -161,6 +168,24 @@ export class EzPopup {
161
168
  },
162
169
  "attribute": "ez-title",
163
170
  "reflect": false
171
+ },
172
+ "enabledScroll": {
173
+ "type": "boolean",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "boolean",
177
+ "resolved": "boolean",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Possibilita scroll vertical no conte\u00FAdo interno do componente"
185
+ },
186
+ "attribute": "enabled-scroll",
187
+ "reflect": false,
188
+ "defaultValue": "false"
164
189
  }
165
190
  };
166
191
  }
@@ -35,6 +35,7 @@ export class EzSearch {
35
35
  this.ignoreLimitCharsToSearch = false;
36
36
  this.options = undefined;
37
37
  this.suppressSearch = false;
38
+ this.fromGrid = false;
38
39
  }
39
40
  observeErrorMessage() {
40
41
  var _a;
@@ -67,6 +68,8 @@ export class EzSearch {
67
68
  }
68
69
  }
69
70
  observeOptions(newOptions, oldOptions) {
71
+ if (!newOptions.length && this.fromGrid)
72
+ return;
70
73
  if ((newOptions === null || newOptions === void 0 ? void 0 : newOptions.join('')) === (oldOptions === null || oldOptions === void 0 ? void 0 : oldOptions.join('')))
71
74
  return;
72
75
  this.loadOptions(SearchMode.PRELOAD);
@@ -190,7 +193,7 @@ export class EzSearch {
190
193
  if (currentValue == undefined) {
191
194
  return;
192
195
  }
193
- let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : `${currentValue.value} - ${currentValue.label}`;
196
+ let text = (!this.showSelectedValue || currentValue.value == undefined) ? currentValue.label : currentValue.label ? `${currentValue.value} - ${currentValue.label}` : currentValue.value;
194
197
  text = text.replace(new RegExp(this._startHighlightTag, 'g'), '').replace(new RegExp(this._endHighlightTag, 'g'), '');
195
198
  return text;
196
199
  }
@@ -587,7 +590,7 @@ export class EzSearch {
587
590
  if (argument) {
588
591
  this._showLoading = false;
589
592
  this.clearSource();
590
- if (!isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch) {
593
+ if (this.ignoreLimitCharsToSearch || !isNaN(argumentNumber) || argument.length >= this._limitCharsToSearch) {
591
594
  this._showLoading = true;
592
595
  this._changeDeboucingTimeout = window.setTimeout(() => {
593
596
  this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
@@ -659,7 +662,7 @@ export class EzSearch {
659
662
  render() {
660
663
  var _a;
661
664
  ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
662
- return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: "leftIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: "search" })), ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
665
+ return (h(Host, null, h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, h("button", { class: "btn", slot: "leftIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { iconName: "search" })), (((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value) || this.fromGrid)
663
666
  ? h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
664
667
  : undefined), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
665
668
  && this._visibleOptions.length === 0
@@ -984,6 +987,24 @@ export class EzSearch {
984
987
  "attribute": "suppress-search",
985
988
  "reflect": false,
986
989
  "defaultValue": "false"
990
+ },
991
+ "fromGrid": {
992
+ "type": "boolean",
993
+ "mutable": false,
994
+ "complexType": {
995
+ "original": "boolean",
996
+ "resolved": "boolean",
997
+ "references": {}
998
+ },
999
+ "required": false,
1000
+ "optional": false,
1001
+ "docs": {
1002
+ "tags": [],
1003
+ "text": "Informa se o componente est\u00E1 instanciado de dentro de uma grade"
1004
+ },
1005
+ "attribute": "from-grid",
1006
+ "reflect": false,
1007
+ "defaultValue": "false"
987
1008
  }
988
1009
  };
989
1010
  }
@@ -67,11 +67,17 @@ export class EzTabselector {
67
67
  this.processesTabs();
68
68
  }
69
69
  }
70
- handleTabClick(tab) {
70
+ async goToTab(tabIndex, silent = false) {
71
+ const tab = this._processedTabs.find(tab => tab.index === tabIndex);
72
+ this.handleTabClick(tab, !silent);
73
+ }
74
+ handleTabClick(tab, emitChange = true) {
71
75
  this.selectedIndex = tab.index;
72
76
  this._focusedIndex = undefined;
73
77
  this.selectedTab = tab.tabKey;
74
- this.ezChange.emit(tab);
78
+ if (emitChange) {
79
+ this.ezChange.emit(tab);
80
+ }
75
81
  this.setFocusedBtn(false, tab.index);
76
82
  }
77
83
  componentWillLoad() {
@@ -316,6 +322,32 @@ export class EzTabselector {
316
322
  }
317
323
  }];
318
324
  }
325
+ static get methods() {
326
+ return {
327
+ "goToTab": {
328
+ "complexType": {
329
+ "signature": "(tabIndex: number, silent?: boolean) => Promise<void>",
330
+ "parameters": [{
331
+ "tags": [],
332
+ "text": ""
333
+ }, {
334
+ "tags": [],
335
+ "text": ""
336
+ }],
337
+ "references": {
338
+ "Promise": {
339
+ "location": "global"
340
+ }
341
+ },
342
+ "return": "Promise<void>"
343
+ },
344
+ "docs": {
345
+ "text": "",
346
+ "tags": []
347
+ }
348
+ }
349
+ };
350
+ }
319
351
  static get elementRef() { return "_hostElem"; }
320
352
  static get watchers() {
321
353
  return [{
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, Action, WaitingChangeException, DataUnitAction } from "@sankhyalabs/core";
1
+ import { ApplicationContext, Action, WaitingChangeException, DataUnitAction, StringUtils } from "@sankhyalabs/core";
2
2
  import { RecordValidationProcessor } from "../validators/recordvalidator/RecordValidationProcessor";
3
3
  export default class DataBinder {
4
4
  constructor(dataUnit) {
@@ -30,6 +30,7 @@ export default class DataBinder {
30
30
  break;
31
31
  }
32
32
  };
33
+ this._uuid = StringUtils.generateUUID();
33
34
  this._fields = new Map();
34
35
  this._dataUnit = dataUnit;
35
36
  this.applyDefaultValues();
@@ -37,6 +38,9 @@ export default class DataBinder {
37
38
  this._dataUnit.addInterceptor(this);
38
39
  this.setContextDataBinder(dataUnit);
39
40
  }
41
+ get dataBinderId() {
42
+ return this._uuid;
43
+ }
40
44
  setContextDataBinder(dataUnit) {
41
45
  const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
42
46
  const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
@@ -65,13 +69,13 @@ export default class DataBinder {
65
69
  this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
66
70
  getRequiredFields: () => this._formMetadata.getRequiredFields(),
67
71
  markAsInvalid: field => this.markInvalid(field),
68
- getMessageForField: field => this.getErrorMessage(field)
72
+ getMessageForField: field => this.getErrorMessage(field),
69
73
  }, recordsValidator);
70
74
  }
71
75
  disconnectDataUnit() {
72
76
  const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
73
77
  const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
74
- const dataBindersFiltered = dataBinders.filter((dataBinder) => JSON.stringify(dataBinder) !== JSON.stringify(this));
78
+ const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
75
79
  dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
76
80
  ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
77
81
  }
@@ -5,7 +5,7 @@ export class RecordValidationProcessor {
5
5
  this._validationSource = validationSource;
6
6
  this._validator = validator;
7
7
  }
8
- validate() {
8
+ validate(isSaving = true) {
9
9
  return new Promise((accept, reject) => {
10
10
  const records = this._dataUnit.getModifiedRecords();
11
11
  for (let i = 0; i < records.length; i++) {
@@ -22,6 +22,11 @@ export class RecordValidationProcessor {
22
22
  }
23
23
  }
24
24
  if (invalidResults.length > 0) {
25
+ if (!isSaving && invalidResults[0].invalidFields.length > 0) {
26
+ this._validationSource.markAsInvalid(invalidResults[0].invalidFields[0], record.__record__id__);
27
+ reject();
28
+ break;
29
+ }
25
30
  this.processValidationResult(invalidResults, record.__record__id__);
26
31
  reject();
27
32
  break;
@@ -53,6 +58,7 @@ export class RecordValidationProcessor {
53
58
  processValidationResult(validationResult, recordId) {
54
59
  validationResult.forEach(invalidResult => {
55
60
  const invalidFields = invalidResult.invalidFields;
61
+ this._dataUnit.savingCanceled(invalidFields, recordId);
56
62
  if (invalidFields) {
57
63
  invalidFields.forEach(field => {
58
64
  this.markAsInvalid(field, recordId);