@sankhyalabs/ezui 5.21.0-dev.3 → 5.21.0-dev.30

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 (188) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ICustomRender-6fafffce.js +13 -0
  3. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -0
  4. package/dist/cjs/ez-alert-list.cjs.entry.js +6 -4
  5. package/dist/cjs/ez-button.cjs.entry.js +2 -2
  6. package/dist/cjs/ez-chart.cjs.entry.js +433 -0
  7. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -0
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -0
  9. package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +94 -0
  10. package/dist/cjs/ez-form-view.cjs.entry.js +33 -3
  11. package/dist/cjs/ez-form.cjs.entry.js +77 -2
  12. package/dist/cjs/ez-grid.cjs.entry.js +360 -34
  13. package/dist/cjs/ez-list.cjs.entry.js +11 -3
  14. package/dist/cjs/ez-modal-container.cjs.entry.js +2 -2
  15. package/dist/cjs/ez-number-input.cjs.entry.js +37 -31
  16. package/dist/cjs/ez-search.cjs.entry.js +26 -5
  17. package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
  18. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-tabselector.cjs.entry.js +34 -29
  20. package/dist/cjs/ezui.cjs.js +1 -1
  21. package/dist/cjs/index-a7b0c73d.js +8 -4
  22. package/dist/cjs/loader.cjs.js +1 -1
  23. package/dist/collection/collection-manifest.json +2 -0
  24. package/dist/collection/components/ez-alert-list/ez-alert-list.js +6 -4
  25. package/dist/collection/components/ez-button/ez-button.css +7 -0
  26. package/dist/collection/components/ez-button/ez-button.js +1 -1
  27. package/dist/collection/components/ez-chart/components/BarChart.js +27 -0
  28. package/dist/collection/components/ez-chart/components/ColumnChart.js +27 -0
  29. package/dist/collection/components/ez-chart/components/DonutChart.js +42 -0
  30. package/dist/collection/components/ez-chart/components/LineChart.js +27 -0
  31. package/dist/collection/components/ez-chart/components/PieChart.js +45 -0
  32. package/dist/collection/components/ez-chart/components/index.js +5 -0
  33. package/dist/collection/components/ez-chart/ez-chart.css +5 -0
  34. package/dist/collection/components/ez-chart/ez-chart.js +284 -0
  35. package/dist/collection/components/ez-chart/interfaces/ChartAxis.js +1 -0
  36. package/dist/collection/components/ez-chart/interfaces/ChartContext.js +14 -0
  37. package/dist/collection/components/ez-chart/interfaces/ChartOptions.js +1 -0
  38. package/dist/collection/components/ez-chart/interfaces/ChartSerie.js +1 -0
  39. package/dist/collection/components/ez-chart/interfaces/ChartStrategies.js +1 -0
  40. package/dist/collection/components/ez-chart/interfaces/ChartType.js +8 -0
  41. package/dist/collection/components/ez-chart/interfaces/index.js +5 -0
  42. package/dist/collection/components/ez-chart/test/mock-chart.js +137 -0
  43. package/dist/collection/components/ez-chart/types/BaseHighChartsRender.js +146 -0
  44. package/dist/collection/components/ez-form/ez-form.js +130 -4
  45. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +253 -0
  46. package/dist/collection/components/ez-form-view/ez-form-view.js +89 -1
  47. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
  48. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +62 -5
  49. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +9 -0
  50. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +35 -1
  51. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +58 -0
  52. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
  53. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
  54. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
  55. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +6 -3
  56. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
  57. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
  58. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +3 -2
  59. package/dist/collection/components/ez-grid/ez-grid.css +1 -0
  60. package/dist/collection/components/ez-grid/ez-grid.js +265 -13
  61. package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
  62. package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
  63. package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +3 -11
  64. package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +22 -0
  65. package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
  66. package/dist/collection/components/ez-list/ez-list.css +6 -2
  67. package/dist/collection/components/ez-list/ez-list.js +28 -2
  68. package/dist/collection/components/ez-modal-container/ez-modal-container.css +4 -0
  69. package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -1
  70. package/dist/collection/components/ez-number-input/ez-number-input.js +46 -31
  71. package/dist/collection/components/ez-search/ez-search.js +25 -5
  72. package/dist/collection/components/ez-split-panel/ez-split-panel.css +1 -0
  73. package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -29
  74. package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
  75. package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
  76. package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
  77. package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
  78. package/dist/collection/utils/form/DataBinder.js +26 -0
  79. package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
  80. package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
  81. package/dist/collection/utils/index.js +2 -0
  82. package/dist/custom-elements/index.d.ts +12 -0
  83. package/dist/custom-elements/index.js +1130 -122
  84. package/dist/esm/ICustomRender-875b5a40.js +13 -0
  85. package/dist/esm/ez-actions-button.entry.js +1 -0
  86. package/dist/esm/ez-alert-list.entry.js +6 -4
  87. package/dist/esm/ez-button.entry.js +2 -2
  88. package/dist/esm/ez-chart.entry.js +429 -0
  89. package/dist/esm/ez-collapsible-box.entry.js +1 -0
  90. package/dist/esm/ez-combo-box.entry.js +1 -0
  91. package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +96 -3
  92. package/dist/esm/ez-form-view.entry.js +33 -3
  93. package/dist/esm/ez-form.entry.js +78 -3
  94. package/dist/esm/ez-grid.entry.js +360 -34
  95. package/dist/esm/ez-list.entry.js +11 -3
  96. package/dist/esm/ez-modal-container.entry.js +2 -2
  97. package/dist/esm/ez-number-input.entry.js +38 -32
  98. package/dist/esm/ez-search.entry.js +26 -5
  99. package/dist/esm/ez-split-item.entry.js +1 -0
  100. package/dist/esm/ez-split-panel.entry.js +1 -1
  101. package/dist/esm/ez-tabselector.entry.js +34 -29
  102. package/dist/esm/ezui.js +1 -1
  103. package/dist/esm/index-baa5e267.js +8 -4
  104. package/dist/esm/loader.js +1 -1
  105. package/dist/ezui/ezui.esm.js +1 -1
  106. package/dist/ezui/p-09de35a2.entry.js +1 -0
  107. package/dist/ezui/{p-af2ecb1b.entry.js → p-1285c902.entry.js} +1 -1
  108. package/dist/ezui/p-13d2fe2d.entry.js +1 -0
  109. package/dist/ezui/p-1a35324b.entry.js +1 -0
  110. package/dist/ezui/p-1ee2479b.entry.js +1 -0
  111. package/dist/ezui/p-2097d0cf.entry.js +1 -0
  112. package/dist/ezui/p-2dcb50d4.entry.js +1 -0
  113. package/dist/ezui/p-30775e7f.entry.js +1 -0
  114. package/dist/ezui/p-3b4eeeb6.entry.js +1 -0
  115. package/dist/ezui/p-3b56d2ef.entry.js +1 -0
  116. package/dist/ezui/p-4607fb89.js +1 -0
  117. package/dist/ezui/p-6517c8c7.entry.js +1 -0
  118. package/dist/ezui/p-7922142b.entry.js +1 -0
  119. package/dist/ezui/p-84e439b9.entry.js +1 -0
  120. package/dist/ezui/p-922ac38b.entry.js +1 -0
  121. package/dist/ezui/{p-b44741b0.entry.js → p-97db197f.entry.js} +2 -2
  122. package/dist/ezui/p-bcb53f27.entry.js +1 -0
  123. package/dist/ezui/p-ffef392d.entry.js +1 -0
  124. package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +2 -2
  125. package/dist/types/components/ez-chart/components/BarChart.d.ts +9 -0
  126. package/dist/types/components/ez-chart/components/ColumnChart.d.ts +9 -0
  127. package/dist/types/components/ez-chart/components/DonutChart.d.ts +9 -0
  128. package/dist/types/components/ez-chart/components/LineChart.d.ts +9 -0
  129. package/dist/types/components/ez-chart/components/PieChart.d.ts +9 -0
  130. package/dist/types/components/ez-chart/components/index.d.ts +5 -0
  131. package/dist/types/components/ez-chart/ez-chart.d.ts +58 -0
  132. package/dist/types/components/ez-chart/interfaces/ChartAxis.d.ts +7 -0
  133. package/dist/types/components/ez-chart/interfaces/ChartContext.d.ts +11 -0
  134. package/dist/types/components/ez-chart/interfaces/ChartOptions.d.ts +10 -0
  135. package/dist/types/components/ez-chart/interfaces/ChartSerie.d.ts +20 -0
  136. package/dist/types/components/ez-chart/interfaces/ChartStrategies.d.ts +7 -0
  137. package/dist/types/components/ez-chart/interfaces/ChartType.d.ts +7 -0
  138. package/dist/types/components/ez-chart/interfaces/index.d.ts +5 -0
  139. package/dist/types/components/ez-chart/types/BaseHighChartsRender.d.ts +15 -0
  140. package/dist/types/components/ez-form/ez-form.d.ts +20 -1
  141. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +43 -0
  142. package/dist/types/components/ez-form-view/ez-form-view.d.ts +11 -0
  143. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +42 -0
  144. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +15 -0
  145. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -0
  146. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
  147. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
  148. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
  149. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
  150. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
  151. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +3 -0
  152. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
  153. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
  154. package/dist/types/components/ez-grid/ez-grid.d.ts +39 -1
  155. package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
  156. package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
  157. package/dist/types/components/ez-grid/subcomponents/utils/selectionCounterUtils.d.ts +4 -0
  158. package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
  159. package/dist/types/components/ez-list/ez-list.d.ts +5 -0
  160. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
  161. package/dist/types/components/ez-search/ez-search.d.ts +3 -1
  162. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +3 -2
  163. package/dist/types/components.d.ts +231 -4
  164. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +29 -0
  165. package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
  166. package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
  167. package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
  168. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  169. package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
  170. package/dist/types/utils/index.d.ts +2 -0
  171. package/package.json +2 -1
  172. package/react/components.d.ts +2 -0
  173. package/react/components.js +2 -0
  174. package/react/components.js.map +1 -1
  175. package/dist/ezui/p-0447d17c.entry.js +0 -1
  176. package/dist/ezui/p-20ec22c0.entry.js +0 -1
  177. package/dist/ezui/p-2a1a0e04.entry.js +0 -1
  178. package/dist/ezui/p-44c5b6a5.entry.js +0 -1
  179. package/dist/ezui/p-5ef056ce.entry.js +0 -1
  180. package/dist/ezui/p-637f69f2.entry.js +0 -1
  181. package/dist/ezui/p-8defa6d3.entry.js +0 -1
  182. package/dist/ezui/p-99ead599.entry.js +0 -1
  183. package/dist/ezui/p-9aefaa52.entry.js +0 -1
  184. package/dist/ezui/p-b041333c.entry.js +0 -1
  185. package/dist/ezui/p-b567fa8c.entry.js +0 -1
  186. package/dist/ezui/p-bae3d0aa.entry.js +0 -1
  187. package/dist/ezui/p-cc2dc4f4.entry.js +0 -1
  188. package/dist/ezui/p-db77a984.entry.js +0 -1
@@ -514,6 +514,9 @@ export class EzList {
514
514
  }
515
515
  return h("div", { class: className, innerHTML: customContent });
516
516
  }
517
+ doubleClickItem(item) {
518
+ this.ezDoubleClick.emit(item);
519
+ }
517
520
  render() {
518
521
  return (h(Host, { ref: el => (this._element = el) }, this.useGroups ? (h("div", { class: "group-container", ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => {
519
522
  this.keyDownHandler(event);
@@ -523,7 +526,9 @@ export class EzList {
523
526
  'hover-feedback': this.hoverFeedback,
524
527
  }, key: 'item_' + item.id }, {
525
528
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`),
526
- }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onClick: () => {
529
+ }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDblClick: () => {
530
+ this.doubleClickItem(item);
531
+ }, onClick: () => {
527
532
  this.setSelection(item);
528
533
  }, onDragLeave: () => {
529
534
  group.sort ? undefined : this.removeOverClass();
@@ -537,7 +542,9 @@ export class EzList {
537
542
  } }, h("div", { class: "draggable-list" }, this._listItems.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
538
543
  'selectable-container': this.ezSelectable,
539
544
  'hover-feedback': this.hoverFeedback,
540
- }, key: 'item_' + item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`) }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDragStart: () => this.onDragStart({ item: item, index: index }), onClick: () => {
545
+ }, key: 'item_' + item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`) }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDragStart: () => this.onDragStart({ item: item, index: index }), onDblClick: () => {
546
+ this.doubleClickItem(item);
547
+ }, onClick: () => {
541
548
  this.setSelection(item);
542
549
  }, onDragLeave: () => this.removeOverClass(), onDragOver: event => this.onDragOverItem(event), onDragEnd: () => this.onDragEnd(), onDrop: event => this.onDrop(event, { item: item, index: index }), draggable: this.ezDraggable }, h("div", { class: "item-content" }, this.listMode === 'regular' ? (h(Fragment, null, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, !!this.itemLeftSlotBuilder && this.getContainerItemBuilder('left', item), h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label))) : (h(Fragment, null, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, h("ez-check", { label: item.label, value: item.check, onEzChange: evt => this.ezCheckChange.emit({ id: item.id, label: item.label, check: evt.detail }) })))), !!this.itemSlotBuilder && this.getContainerItemBuilder('right', item))))), h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: event => {
543
550
  this.onDragOverLastIndex(event);
@@ -787,6 +794,25 @@ export class EzList {
787
794
  }
788
795
  }
789
796
  }
797
+ }, {
798
+ "method": "ezDoubleClick",
799
+ "name": "ezDoubleClick",
800
+ "bubbles": true,
801
+ "cancelable": true,
802
+ "composed": true,
803
+ "docs": {
804
+ "tags": [],
805
+ "text": "Emitido quando ocorre um duplo clique em um item da lista."
806
+ },
807
+ "complexType": {
808
+ "original": "ListItem",
809
+ "resolved": "ListItem",
810
+ "references": {
811
+ "ListItem": {
812
+ "location": "local"
813
+ }
814
+ }
815
+ }
790
816
  }];
791
817
  }
792
818
  static get methods() {
@@ -7,6 +7,10 @@
7
7
  height: 100%;
8
8
  }
9
9
 
10
+ .ez-modal-container__header-container{
11
+ outline: none;
12
+ }
13
+
10
14
  .ez-modal-container__header {
11
15
  display: flex;
12
16
  flex-wrap: nowrap;
@@ -47,7 +47,7 @@ export class EzModalContainer {
47
47
  this._closeButton.focus();
48
48
  }
49
49
  render() {
50
- return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1 }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--large" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" }))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
50
+ return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--large" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" }))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
51
51
  }
52
52
  static get is() { return "ez-modal-container"; }
53
53
  static get encapsulation() { return "scoped"; }
@@ -1,4 +1,4 @@
1
- import { ElementIDUtils, NumberUtils } from "@sankhyalabs/core";
1
+ import { ElementIDUtils, NumberUtils, StringUtils } from "@sankhyalabs/core";
2
2
  import { h } from "@stencil/core";
3
3
  import CSSVarsUtils from "../../utils/CSSVarsUtils";
4
4
  export class EzNumberInput {
@@ -6,6 +6,7 @@ export class EzNumberInput {
6
6
  this._focused = false;
7
7
  this._changePending = false;
8
8
  this._valuePromiseCallbacks = [];
9
+ this._value = undefined;
9
10
  this.label = undefined;
10
11
  this.value = undefined;
11
12
  this.enabled = true;
@@ -61,35 +62,42 @@ export class EzNumberInput {
61
62
  }
62
63
  observeValue(newValue, oldValue) {
63
64
  if (this._textInput && newValue != oldValue) {
64
- const newValueValidated = this.validateValue(newValue);
65
- const oldValueValidated = this.validateValue(oldValue);
66
- if (newValueValidated === null) {
67
- this._textInput.value = '';
68
- }
69
- if (newValueValidated != oldValueValidated) {
70
- const textValue = this.getTextValue(newValueValidated) || '';
71
- if ((this._textInput.value || '') !== textValue) {
72
- const parsedNumber = this.getParsedNumber(textValue);
73
- if (parsedNumber !== undefined || !this._focused) {
74
- this._textInput.value = textValue;
75
- this._focused = false;
76
- this.errorMessage = "";
77
- }
78
- }
79
- const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
80
- this.ezChange.emit(valueEmitted);
81
- }
65
+ this.handleNewValue(newValue, oldValue);
82
66
  }
83
67
  this._changePending = false;
84
68
  }
69
+ observePrecision() {
70
+ if (this._textInput) {
71
+ this.setInputValue();
72
+ }
73
+ }
74
+ handleNewValue(newValue, oldValue) {
75
+ const newValueValidated = this.validateValue(newValue);
76
+ const oldValueValidated = this.validateValue(oldValue);
77
+ if (newValueValidated === null) {
78
+ this._value = '';
79
+ }
80
+ if (newValueValidated === oldValueValidated) {
81
+ return;
82
+ }
83
+ const textValue = this.getTextValue(newValueValidated) || '';
84
+ const parsedNumber = this.getParsedNumber(textValue);
85
+ if ((this._value || '') !== textValue && (parsedNumber !== undefined || !this._focused)) {
86
+ this._value = textValue;
87
+ this._focused = false;
88
+ this.errorMessage = "";
89
+ }
90
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
91
+ this.ezChange.emit(valueEmitted);
92
+ }
85
93
  validateValue(value) {
86
94
  return isNaN(value) || value === undefined ? null : value;
87
95
  }
88
96
  getTextValue(value) {
89
- if (value != undefined) {
90
- return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
91
- }
92
- return undefined;
97
+ if (value == undefined)
98
+ return undefined;
99
+ let textValue = this.precision >= 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
100
+ return (this.precision === 0) ? StringUtils.replaceAll(textValue, ".", "") : textValue;
93
101
  }
94
102
  changeValue(newValue) {
95
103
  this.errorMessage = "";
@@ -140,17 +148,13 @@ export class EzNumberInput {
140
148
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
141
149
  }
142
150
  }
143
- getParsedNumber(value) {
144
- var _a;
145
- if (value === void 0) {
146
- value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
147
- }
151
+ getParsedNumber(value = this._textInput.value) {
148
152
  return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
149
153
  }
150
154
  setInputValue() {
151
155
  const textValue = this.getTextValue(this.value) || '';
152
- if ((this._textInput.value || '') !== textValue) {
153
- this._textInput.value = textValue;
156
+ if ((this._value || '') !== textValue) {
157
+ this._value = textValue;
154
158
  }
155
159
  }
156
160
  componentDidLoad() {
@@ -159,7 +163,7 @@ export class EzNumberInput {
159
163
  }
160
164
  render() {
161
165
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
162
- return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }));
166
+ return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError, value: this._value }));
163
167
  }
164
168
  static get is() { return "ez-number-input"; }
165
169
  static get encapsulation() { return "shadow"; }
@@ -316,6 +320,11 @@ export class EzNumberInput {
316
320
  }
317
321
  };
318
322
  }
323
+ static get states() {
324
+ return {
325
+ "_value": {}
326
+ };
327
+ }
319
328
  static get events() {
320
329
  return [{
321
330
  "method": "ezChange",
@@ -455,6 +464,12 @@ export class EzNumberInput {
455
464
  }, {
456
465
  "propName": "value",
457
466
  "methodName": "observeValue"
467
+ }, {
468
+ "propName": "precision",
469
+ "methodName": "observePrecision"
470
+ }, {
471
+ "propName": "prettyPrecision",
472
+ "methodName": "observePrecision"
458
473
  }];
459
474
  }
460
475
  }
@@ -46,11 +46,18 @@ export class EzSearch {
46
46
  }
47
47
  }
48
48
  }
49
- observeValue(newValue, oldValue) {
49
+ async observeValue(newValue, oldValue) {
50
+ if (ObjectUtils.equals(newValue, oldValue))
51
+ return;
52
+ if (ObjectUtils.hasEquivalentProps(newValue, oldValue) && this._textInput.value) {
53
+ this.value = this._currentValue;
54
+ return;
55
+ }
50
56
  if (this._textInput && newValue != oldValue) {
57
+ this._currentValue = newValue;
51
58
  try {
52
- if (newValue === "string") {
53
- this.setInputValue();
59
+ if (typeof newValue === "string") {
60
+ await this.handleValueAsString(newValue);
54
61
  return;
55
62
  }
56
63
  const newValueSelected = this.getSelectedOption(newValue);
@@ -137,6 +144,16 @@ export class EzSearch {
137
144
  });
138
145
  }
139
146
  }
147
+ async handleValueAsString(value) {
148
+ const selectedOption = this.getSelectedOption(value);
149
+ if (selectedOption) {
150
+ this.setInputValue();
151
+ this.ezChange.emit(selectedOption);
152
+ return;
153
+ }
154
+ await this.loadDescriptionValue(value);
155
+ this.ezChange.emit(this.value);
156
+ }
140
157
  updateListPosition() {
141
158
  let { verticalPosition, horizontalPosition, fromBottom, fromRight, bottomLimit, hardPosition } = this.getListPosition();
142
159
  const elementRect = this._listWrapper.getBoundingClientRect();
@@ -308,9 +325,12 @@ export class EzSearch {
308
325
  }
309
326
  scrollToOption(opt) {
310
327
  window.requestAnimationFrame(() => {
311
- const liElem = (opt === null || opt === void 0 ? void 0 : opt.value) ? this._optionsList.querySelector(`div#item_${this.replaceHighlight(opt.value).replace(/[<>\[\]#=]/g, '\\$&').replace(/:/g, '\\:')}`) : undefined;
312
- if (liElem)
328
+ const liElem = (opt === null || opt === void 0 ? void 0 : opt.value)
329
+ ? this._optionsList.querySelector(`div#item_${opt.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g, '\\$1')}`)
330
+ : undefined;
331
+ if (liElem) {
313
332
  liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
333
+ }
314
334
  });
315
335
  }
316
336
  selectCurrentOption() {
@@ -4,4 +4,5 @@
4
4
  .ez-split-gutter {
5
5
  cursor: grab;
6
6
  background-color: transparent;
7
+ max-width: 100%;
7
8
  }
@@ -58,9 +58,13 @@ export class EzTabselector {
58
58
  this.selectedTab = undefined;
59
59
  this.tabs = undefined;
60
60
  }
61
- observeTabs(newValue) {
61
+ observeTabs(newValue, oldValue) {
62
62
  if (newValue && typeof newValue !== "string") {
63
63
  this._processedTabs = newValue;
64
+ return;
65
+ }
66
+ if (newValue !== oldValue) {
67
+ this.processesTabs();
64
68
  }
65
69
  }
66
70
  handleTabClick(tab) {
@@ -70,36 +74,37 @@ export class EzTabselector {
70
74
  this.ezChange.emit(tab);
71
75
  this.setFocusedBtn(false, tab.index);
72
76
  }
73
- componentWillRender() {
74
- if (!this._processedTabs) {
75
- if (this.tabs) {
76
- if (Array.isArray(this.tabs)) {
77
- this._processedTabs = [...this.tabs];
78
- }
79
- else {
80
- this._processedTabs = [];
81
- this.tabs.split(",").forEach((label) => {
82
- label = label.trim();
83
- this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
84
- this.buildElementIdTab(this._processedTabs);
85
- });
86
- }
77
+ componentWillLoad() {
78
+ this.processesTabs();
79
+ }
80
+ processesTabs() {
81
+ if (this.tabs) {
82
+ if (Array.isArray(this.tabs)) {
83
+ this._processedTabs = [...this.tabs];
84
+ }
85
+ else {
86
+ this._processedTabs = [];
87
+ this.tabs.split(",").forEach((label) => {
88
+ label = label.trim();
89
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
90
+ this.buildElementIdTab(this._processedTabs);
91
+ });
87
92
  }
88
- this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
89
- const tabKey = elem.getAttribute("tabKey");
90
- const label = elem.getAttribute("label");
91
- const leftIcon = elem.getAttribute("leftIcon");
92
- const rightIcon = elem.getAttribute("rightIcon");
93
- const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
94
- const content = elem.firstChild;
95
- if (content) {
96
- content.setAttribute("slot", "tab" + tab.index);
97
- this._hostElem.appendChild(content);
98
- }
99
- this._processedTabs.push(tab);
100
- this.buildElementIdTab(this._processedTabs);
101
- });
102
93
  }
94
+ this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
95
+ const tabKey = elem.getAttribute("tabKey");
96
+ const label = elem.getAttribute("label");
97
+ const leftIcon = elem.getAttribute("leftIcon");
98
+ const rightIcon = elem.getAttribute("rightIcon");
99
+ const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
100
+ const content = elem.firstChild;
101
+ if (content) {
102
+ content.setAttribute("slot", "tab" + tab.index);
103
+ this._hostElem.appendChild(content);
104
+ }
105
+ this._processedTabs.push(tab);
106
+ this.buildElementIdTab(this._processedTabs);
107
+ });
103
108
  }
104
109
  componentDidRender() {
105
110
  this.updateScroll();
@@ -0,0 +1,5 @@
1
+ export var CustomEditorSource;
2
+ (function (CustomEditorSource) {
3
+ CustomEditorSource["GRID"] = "GRID";
4
+ CustomEditorSource["FORM"] = "FORM";
5
+ })(CustomEditorSource || (CustomEditorSource = {}));
@@ -0,0 +1,5 @@
1
+ export var CustomRenderSource;
2
+ (function (CustomRenderSource) {
3
+ CustomRenderSource["GRID"] = "GRID";
4
+ CustomRenderSource["FORM"] = "FORM";
5
+ })(CustomRenderSource || (CustomRenderSource = {}));
@@ -35,6 +35,13 @@ export default class DataBinder {
35
35
  this.applyDefaultValues();
36
36
  this._dataUnit.subscribe(this.onDataUnitEvent);
37
37
  this._dataUnit.addInterceptor(this);
38
+ this.setContextDataBinder(dataUnit);
39
+ }
40
+ setContextDataBinder(dataUnit) {
41
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
42
+ const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
43
+ dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
44
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
38
45
  }
39
46
  applyDefaultValues() {
40
47
  const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
@@ -61,9 +68,17 @@ export default class DataBinder {
61
68
  getMessageForField: field => this.getErrorMessage(field)
62
69
  }, recordsValidator);
63
70
  }
71
+ disconnectDataUnit() {
72
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
73
+ const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
74
+ const dataBindersFiltered = dataBinders.filter((dataBinder) => JSON.stringify(dataBinder) !== JSON.stringify(this));
75
+ dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
76
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
77
+ }
64
78
  onDisconnectedCallback() {
65
79
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
66
80
  this._dataUnit.removeInterceptor(this);
81
+ this.disconnectDataUnit();
67
82
  }
68
83
  getCurrentRecordId() {
69
84
  const record = this._dataUnit.getSelectedRecord();
@@ -110,6 +125,17 @@ export default class DataBinder {
110
125
  validate() {
111
126
  return this._recordValidatorProcessor.validate();
112
127
  }
128
+ static async validateByDataunit(dataUnit) {
129
+ try {
130
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
131
+ const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
132
+ await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
133
+ return true;
134
+ }
135
+ catch (_a) {
136
+ return false;
137
+ }
138
+ }
113
139
  updateErrorMessage(fieldName, field, message) {
114
140
  if (message == undefined) {
115
141
  message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
@@ -1,9 +1,46 @@
1
- import { DataUnit } from "@sankhyalabs/core";
1
+ import { ApplicationContext, DataUnit } from "@sankhyalabs/core";
2
2
  import DataBinder from "../DataBinder";
3
+ import { metadataTest } from "./resources/metadataTest";
3
4
  describe('DataBinder', () => {
5
+ let dataBinder;
6
+ let dataUnit;
7
+ beforeEach(() => {
8
+ dataUnit = new DataUnit();
9
+ dataUnit.metadata = metadataTest;
10
+ dataUnit.addRecord();
11
+ dataUnit.selectFirst();
12
+ dataBinder = new DataBinder(dataUnit);
13
+ });
4
14
  it('constructor', async () => {
5
- const du = new DataUnit();
6
- const db = new DataBinder(du);
7
- expect(db).toBeTruthy();
15
+ expect(dataBinder).toBeTruthy();
16
+ });
17
+ it('ApplicationContext should be filled', () => {
18
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
19
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBeGreaterThan(0);
20
+ });
21
+ it('ApplicationContext should be filled with two binders', () => {
22
+ new DataBinder(dataUnit);
23
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
24
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBe(2);
25
+ });
26
+ it('should be invalid for empty fields', async () => {
27
+ const isValid = await DataBinder.validateByDataunit(dataUnit);
28
+ dataBinder['_recordValidatorProcessor'] = {
29
+ validate: () => Promise.reject(),
30
+ };
31
+ expect(isValid).toBe(false);
32
+ });
33
+ it('should be valid for filled fields', async () => {
34
+ await dataUnit.setFieldValue('NAME', 'João');
35
+ dataBinder['_recordValidatorProcessor'] = {
36
+ validate: () => Promise.resolve(),
37
+ };
38
+ const isValid = await DataBinder.validateByDataunit(dataUnit);
39
+ expect(isValid).toBe(true);
40
+ });
41
+ it('should be remove dataBinder on disconnected', async () => {
42
+ dataBinder.onDisconnectedCallback();
43
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
44
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBe(0);
8
45
  });
9
46
  });
@@ -0,0 +1,15 @@
1
+ import { DataType, UserInterface } from "@sankhyalabs/core";
2
+ export const metadataTest = {
3
+ "name": "clients",
4
+ "label": "clients",
5
+ "fields": [
6
+ {
7
+ "name": "NAME",
8
+ "label": "Nome",
9
+ "dataType": DataType.TEXT,
10
+ "userInterface": UserInterface.SHORTTEXT,
11
+ "readOnly": false,
12
+ "required": true
13
+ },
14
+ ]
15
+ };
@@ -4,3 +4,5 @@ export { DialogType } from '../components/ez-dialog/DialogType';
4
4
  export { CheckMode } from '../components/ez-check/CheckMode';
5
5
  export { FormMetadata } from './form/FormMetadata';
6
6
  export { default as DataBinder } from './form/DataBinder';
7
+ export { CustomEditorSource } from './customEditor/interfaces/ICustomEditor';
8
+ export { CustomRenderSource } from './customRender/interfaces/ICustomRender';
@@ -56,6 +56,12 @@ export const EzCardItem: {
56
56
  new (): EzCardItem;
57
57
  };
58
58
 
59
+ interface EzChart extends Components.EzChart, HTMLElement {}
60
+ export const EzChart: {
61
+ prototype: EzChart;
62
+ new (): EzChart;
63
+ };
64
+
59
65
  interface EzCheck extends Components.EzCheck, HTMLElement {}
60
66
  export const EzCheck: {
61
67
  prototype: EzCheck;
@@ -80,6 +86,12 @@ export const EzComboBox: {
80
86
  new (): EzComboBox;
81
87
  };
82
88
 
89
+ interface EzCustomFormInput extends Components.EzCustomFormInput, HTMLElement {}
90
+ export const EzCustomFormInput: {
91
+ prototype: EzCustomFormInput;
92
+ new (): EzCustomFormInput;
93
+ };
94
+
83
95
  interface EzDateInput extends Components.EzDateInput, HTMLElement {}
84
96
  export const EzDateInput: {
85
97
  prototype: EzDateInput;