@sankhyalabs/ezui 5.10.8 → 5.11.0-dev.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 (168) hide show
  1. package/README.md +8 -11
  2. package/dist/cjs/{CSSVarsUtils-af809e73.js → CSSVarsUtils-b136a156.js} +5 -0
  3. package/dist/cjs/RecordValidationProcessor-edd23705.js +102 -0
  4. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-calendar.cjs.entry.js +34 -5
  6. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-combo-box.cjs.entry.js +99 -16
  8. package/dist/cjs/ez-date-input.cjs.entry.js +53 -22
  9. package/dist/cjs/ez-date-time-input.cjs.entry.js +53 -19
  10. package/dist/cjs/ez-filter-input_2.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-form-view.cjs.entry.js +42 -1
  12. package/dist/cjs/ez-form.cjs.entry.js +11 -84
  13. package/dist/cjs/ez-grid.cjs.entry.js +575 -44
  14. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
  15. package/dist/cjs/ez-number-input.cjs.entry.js +39 -15
  16. package/dist/cjs/ez-search.cjs.entry.js +13 -2
  17. package/dist/cjs/ez-text-area.cjs.entry.js +6 -2
  18. package/dist/cjs/ez-text-input.cjs.entry.js +7 -4
  19. package/dist/cjs/ez-time-input.cjs.entry.js +11 -7
  20. package/dist/cjs/ezui.cjs.js +1 -1
  21. package/dist/cjs/filter-column.cjs.entry.js +30 -7
  22. package/dist/cjs/loader.cjs.js +1 -1
  23. package/dist/collection/collection-manifest.json +2 -2
  24. package/dist/collection/components/ez-calendar/ez-calendar.js +63 -6
  25. package/dist/collection/components/ez-card-item/ez-card-item.css +1 -0
  26. package/dist/collection/components/ez-combo-box/ez-combo-box.css +6 -0
  27. package/dist/collection/components/ez-combo-box/ez-combo-box.js +168 -14
  28. package/dist/collection/components/ez-date-input/ez-date-input.js +71 -21
  29. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +71 -18
  30. package/dist/collection/components/ez-form/ez-form.js +20 -0
  31. package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
  32. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
  33. package/dist/collection/components/ez-form-view/structure/index.js +34 -0
  34. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +41 -8
  35. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
  36. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +230 -0
  37. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  38. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +49 -0
  39. package/dist/collection/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.js +10 -0
  40. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.js +4 -0
  41. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +38 -0
  42. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +40 -0
  43. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +20 -0
  44. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +15 -0
  45. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +41 -0
  46. package/dist/collection/components/ez-grid/ez-grid.js +78 -39
  47. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
  48. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
  49. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
  50. package/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
  51. package/dist/collection/components/ez-number-input/ez-number-input.js +62 -15
  52. package/dist/collection/components/ez-search/ez-search.css +1 -1
  53. package/dist/collection/components/ez-search/ez-search.js +84 -1
  54. package/dist/collection/components/ez-text-area/ez-text-area.css +4 -0
  55. package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
  56. package/dist/collection/components/ez-text-input/ez-text-input.css +8 -1
  57. package/dist/collection/components/ez-text-input/ez-text-input.js +14 -5
  58. package/dist/collection/components/ez-time-input/ez-time-input.css +4 -0
  59. package/dist/collection/components/ez-time-input/ez-time-input.js +18 -7
  60. package/dist/collection/utils/CSSVarsUtils.js +5 -0
  61. package/dist/collection/utils/form/DataBinder.js +8 -63
  62. package/dist/collection/utils/form/FormMetadata.js +3 -22
  63. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +21 -0
  64. package/dist/collection/utils/validators/recordvalidator/IValidationResult.js +1 -0
  65. package/dist/collection/utils/validators/recordvalidator/IValidationSource.js +1 -0
  66. package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +74 -0
  67. package/dist/custom-elements/index.js +1101 -256
  68. package/dist/esm/{CSSVarsUtils-00f67f32.js → CSSVarsUtils-a97cfa29.js} +5 -0
  69. package/dist/esm/RecordValidationProcessor-abc814af.js +99 -0
  70. package/dist/esm/ez-actions-button.entry.js +1 -1
  71. package/dist/esm/ez-calendar.entry.js +35 -6
  72. package/dist/esm/ez-card-item.entry.js +1 -1
  73. package/dist/esm/ez-combo-box.entry.js +99 -16
  74. package/dist/esm/ez-date-input.entry.js +53 -22
  75. package/dist/esm/ez-date-time-input.entry.js +53 -19
  76. package/dist/esm/ez-filter-input_2.entry.js +1 -1
  77. package/dist/esm/ez-form-view.entry.js +42 -1
  78. package/dist/esm/ez-form.entry.js +12 -85
  79. package/dist/esm/ez-grid.entry.js +576 -45
  80. package/dist/esm/ez-multi-selection-list.entry.js +3 -1
  81. package/dist/esm/ez-number-input.entry.js +39 -15
  82. package/dist/esm/ez-search.entry.js +13 -2
  83. package/dist/esm/ez-text-area.entry.js +6 -2
  84. package/dist/esm/ez-text-input.entry.js +7 -4
  85. package/dist/esm/ez-time-input.entry.js +11 -7
  86. package/dist/esm/ezui.js +1 -1
  87. package/dist/esm/filter-column.entry.js +30 -7
  88. package/dist/esm/loader.js +1 -1
  89. package/dist/ezui/ezui.esm.js +1 -1
  90. package/dist/ezui/p-028f264f.entry.js +1 -0
  91. package/dist/ezui/p-061f4d73.entry.js +1 -0
  92. package/dist/ezui/p-25562cf8.entry.js +1 -0
  93. package/dist/ezui/p-3078d25c.entry.js +1 -0
  94. package/dist/ezui/p-391de0e4.entry.js +1 -0
  95. package/dist/ezui/{p-68352e41.entry.js → p-47afb974.entry.js} +1 -1
  96. package/dist/ezui/p-5cef0264.entry.js +1 -0
  97. package/dist/ezui/p-5e55a42b.entry.js +1 -0
  98. package/dist/ezui/p-7526f2b6.entry.js +1 -0
  99. package/dist/ezui/p-7eb3e1a5.js +1 -0
  100. package/dist/ezui/p-86a2036d.js +1 -0
  101. package/dist/ezui/{p-12303d2e.entry.js → p-87e85160.entry.js} +1 -1
  102. package/dist/ezui/{p-c7a23be9.entry.js → p-964e5571.entry.js} +2 -2
  103. package/dist/ezui/p-ce035beb.entry.js +1 -0
  104. package/dist/ezui/p-d43b22f3.entry.js +1 -0
  105. package/dist/ezui/p-df93558d.entry.js +1 -0
  106. package/dist/ezui/p-e2dfd935.entry.js +1 -0
  107. package/dist/ezui/p-e67d0bd5.entry.js +1 -0
  108. package/dist/ezui/{p-f1a537e3.entry.js → p-ff82b176.entry.js} +1 -1
  109. package/dist/types/components/ez-calendar/ez-calendar.d.ts +9 -1
  110. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +23 -0
  111. package/dist/types/components/ez-date-input/ez-date-input.d.ts +4 -0
  112. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +4 -0
  113. package/dist/types/components/ez-form/ez-form.d.ts +5 -0
  114. package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
  115. package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +2 -14
  116. package/dist/types/components/ez-form-view/structure/index.d.ts +15 -0
  117. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +18 -0
  118. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
  119. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +38 -0
  120. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  121. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +10 -0
  122. package/dist/types/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.d.ts +1 -0
  123. package/dist/types/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.d.ts +9 -0
  124. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +10 -0
  125. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.d.ts +4 -0
  126. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.d.ts +5 -0
  127. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.d.ts +4 -0
  128. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.d.ts +3 -0
  129. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.d.ts +4 -0
  130. package/dist/types/components/ez-grid/ez-grid.d.ts +16 -5
  131. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
  132. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
  133. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
  134. package/dist/types/components/ez-number-input/ez-number-input.d.ts +5 -1
  135. package/dist/types/components/ez-search/ez-search.d.ts +14 -1
  136. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  137. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -1
  138. package/dist/types/components/ez-time-input/ez-time-input.d.ts +2 -1
  139. package/dist/types/components.d.ts +116 -6
  140. package/dist/types/utils/form/DataBinder.d.ts +1 -3
  141. package/dist/types/utils/form/interfaces/IFormConfig.d.ts +1 -1
  142. package/dist/types/utils/form/interfaces/index.d.ts +4 -4
  143. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +17 -0
  144. package/dist/types/utils/{form/interfaces → interfaces}/IFieldConfig.d.ts +2 -2
  145. package/dist/types/utils/validators/recordvalidator/IValidationSource.d.ts +6 -0
  146. package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +13 -0
  147. package/package.json +3 -3
  148. package/dist/ezui/p-00c7c25d.entry.js +0 -1
  149. package/dist/ezui/p-0b160fec.entry.js +0 -1
  150. package/dist/ezui/p-0bd54a6f.entry.js +0 -1
  151. package/dist/ezui/p-2a0e1679.entry.js +0 -1
  152. package/dist/ezui/p-39153935.entry.js +0 -1
  153. package/dist/ezui/p-4a5e37a7.js +0 -1
  154. package/dist/ezui/p-4c8b029b.entry.js +0 -1
  155. package/dist/ezui/p-4e31b69b.entry.js +0 -1
  156. package/dist/ezui/p-5782443e.entry.js +0 -1
  157. package/dist/ezui/p-5d45e384.entry.js +0 -1
  158. package/dist/ezui/p-70ea4beb.entry.js +0 -1
  159. package/dist/ezui/p-78a6e049.entry.js +0 -1
  160. package/dist/ezui/p-8bcb197f.entry.js +0 -1
  161. package/dist/ezui/p-a4c9f3c4.entry.js +0 -1
  162. /package/dist/collection/{utils/form/interfaces/IFieldConfig.js → components/ez-grid/controller/ag-grid/editor/IUICellEditor.js} +0 -0
  163. /package/dist/collection/utils/{form/interfaces/IInvalidField.js → interfaces/IFieldConfig.js} +0 -0
  164. /package/dist/collection/utils/{form/interfaces/IRecordValidator.js → validators/recordvalidator/IInvalidField.js} +0 -0
  165. /package/dist/collection/utils/{form/interfaces/IValidationResult.js → validators/recordvalidator/IRecordValidator.js} +0 -0
  166. /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IInvalidField.d.ts +0 -0
  167. /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IRecordValidator.d.ts +0 -0
  168. /package/dist/types/utils/{form/interfaces → validators/recordvalidator}/IValidationResult.d.ts +0 -0
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,H as s,g as n}from"./p-e318d280.js";import{DateUtils as a,TimeFormatter as o,ElementIDUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-7eb3e1a5.js";const l=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.showSeconds=!1,this.mode="regular",this.canShowError=!0}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const e=a.validateDate(t,!0),s=a.validateDate(i,!0);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}handleKeyDown(t){const i=this._textInput.shadowRoot.querySelector("input");if(t.shiftKey&&"Tab"===t.key){if(i.selectionStart>0){let e=i.value.lastIndexOf(" ",i.selectionStart);-1!==e&&(i.setSelectionRange(0,e),t.preventDefault())}}else if("Tab"===t.key&&i.value.length!==i.selectionEnd){let e=i.value.indexOf(" ",i.selectionEnd);e=-1===e?i.selectionEnd:e+1,i.setSelectionRange(e,i.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let i=t.value.indexOf(" ",t.selectionStart);i=-1===i?t.value.length:i,t.setSelectionRange(0,i)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let i=t.value.lastIndexOf(" ",t.selectionEnd);i=-1===i?0:i+1,i=i>t.selectionEnd?0:i;let e=0===i?t.value.indexOf(" "):t.value.length;t.setSelectionRange(i,e)}changeValue(t){const i=a.validateDate(this.value,!0),e=a.validateDate(t,!0);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}showCalendar(){let t;this.isFixed()?(t=29,this._calendar.fitHorizontal(0)):t=this.errorMessage||"slim"===this.mode?6:-13,this._calendar.fitVertical(t,this._elem.clientHeight),this._calendar.style.visibility="inherit"}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}getParsedDateTime(t){var i,e;if(void 0===t&&(t=(null===(e=null===(i=this._textInput)||void 0===i?void 0:i.value)||void 0===e?void 0:e.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,h=o.prepareValue(s[1]?s[1]:"",this.showSeconds);return a.strToDate(n+(h&&" "+h))}handleBlur(){var t,i;try{const e=(null===(i=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===i?void 0:i.trim())||"",s=this.getParsedDateTime();if(s||!e){this.errorMessage="";const t=a.validateDate(this.value,!0),i=a.validateDate(s,!0);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){if(t)return a.formatDateTime(t,this.showSeconds)}handleInput(t){const i=this.getParsedDateTime(),e=a.validateDate(this.value,!0),s=a.validateDate(i,!0);(null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}isFixed(){return"true"===this._elem.dataset.isFixed}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return h.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,restrict:"0123456789/: ",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,onKeyDown:t=>{this.handleKeyDown(t)},onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),onFocus:()=>this.handleFocus(),onClick:()=>this.handleClick(),canShowError:this.canShowError},e("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,time:!0,showSeconds:this.showSeconds,"data-is-fixed":this._elem.dataset.isFixed}))}get _elem(){return n(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};l.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{l as ez_date_time_input}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,H as s,g as a}from"./p-e318d280.js";import{DateUtils as n,ElementIDUtils as r}from"@sankhyalabs/core";import{C as h}from"./p-7eb3e1a5.js";const o=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.mode="regular",this.canShowError=!0}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const e=n.validateDate(t),s=n.validateDate(i);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}changeValue(t){const i=n.validateDate(this.value),e=n.validateDate(t);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}showCalendar(){let t;this.handleBlur(),this._calendar.value=this.value,this.isFixed()?(t=29,this._calendar.fitHorizontal(0)):t=this.errorMessage||"slim"===this.mode?6:-13,this._calendar.fitVertical(t,this._elem.clientHeight)}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}handleBlur(){try{const t=this._textInput.value,i=n.strToDate(t);if(i||!t){this.errorMessage="";const t=n.validateDate(this.value),e=n.validateDate(i);(null==t?void 0:t.getTime())===(null==e?void 0:e.getTime())?(e&&(this._textInput.value=this.getTextValue(e)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(e)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){return t?n.formatDate(t):void 0}handleInput(t){const i=n.strToDate(this._textInput.value),e=n.validateDate(this.value),s=n.validateDate(i);(null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}isFixed(){return"true"===this._elem.dataset.isFixed}componentDidLoad(){h.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return r.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":r.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),restrict:"0123456789/",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError},e("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":r.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,"data-is-fixed":this._elem.dataset.isFixed}))}get _elem(){return a(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};o.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{o as ez_date_input}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,f as s,H as n,g as r}from"./p-e318d280.js";import{DateUtils as o,Action as a,WaitingChangeException as h,ApplicationContext as l,DataUnitAction as c,StringUtils as u,DataUnit as d,ElementIDUtils as f}from"@sankhyalabs/core";import{b as v,R as p}from"./p-86a2036d.js";import"./p-f15ec3bb.js";import"./p-ab574d59.js";const b=/child\[([^\]]+)\]/,m=/\$\{.+\}/;class y{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const i=b.exec(t);return i?i[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([i,e])=>{if("string"==typeof e){const t=m.exec(e);t&&(e=this.getDefaultVar(t[0]))}t[i]=e})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const _=(t,i)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(i[0].order||1e4);class g{constructor(t){this.onDataUnitEvent=t=>{var i,e;switch(t.type){case a.DATA_LOADED:case a.DATA_SAVED:case a.RECORDS_REMOVED:case a.RECORDS_ADDED:case a.RECORDS_COPIED:case a.EDITION_CANCELED:case a.SELECTION_CHANGED:case a.NEXT_SELECTED:case a.PREVIOUS_SELECTED:this.clearInvalid();case a.DATA_CHANGED:case a.CHANGE_UNDONE:case a.CHANGE_REDONE:case a.RECORD_LOADED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateValue(t.fieldName,t.field)}));break;case a.FIELD_INVALIDATED:null===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const i=this.getDefaultValues();i&&Object.keys(i).forEach((e=>{this._dataUnit.setFieldValue(e,i[e],t)}))}}bind(t,i,e,s){t.forEach((t=>{const{fieldName:e,contextName:s}=t.dataset;null!=s&&s!==i||this.updateBind(e,t)})),this._formMetadata=e,this._recordValidatorProcessor=new p(this._dataUnit,{getRequiredFields:()=>this._formMetadata.getRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},s)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this)}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const i=this._fields.get(t.name).field;this.updateErrorMessage(t.name,i,t.message)}}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}updateValue(t,i){const e=this._fields.get(t);try{e&&(e.listen=!1),i.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,i)}finally{e&&(e.listen=!0)}}validate(){return this._recordValidatorProcessor.validate()}updateErrorMessage(t,i,e){null==e&&(e=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),i.errorMessage||(i.errorMessage=e)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,i){const e=this._fields.get(t);e&&e.destroy(),i.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,i),this._fields.set(t,w.create(t,i,((t,i)=>this.changeStarted(t,i)),(t=>this.cancelWaitingChange(t)),((t,i)=>this.setFieldValue(t,i)))),this.bindSearchOptionsLoader(t,i),this.applyEzUploadContext(t,i)}changeStarted(t,i){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!i.blocking&&null==i.promise){const e=this._fields.get(t);e&&(i.promise=new Promise(((t,i)=>{e.waitingChangePromiseResolve=t,e.waitingChangePromiseReject=i})))}this._dataUnit.startChange(t,i)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const i=this._fields.get(t);i&&i.rejectWaitingChange(new h("Change canceled",t))}}setFieldValue(t,i){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t),this._dataUnit.setFieldValue(t,i,[this.getCurrentRecordId()]),this._dataUnit.waitingForChange(t)){const i=this._fields.get(t);i&&i.acceptWaitingChange()}}bindSearchOptionsLoader(t,i){if("EZ-SEARCH"===i.nodeName&&null==i.optionLoader){const e=l.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");e&&(i.optionLoader=i=>e(i,t,this._dataUnit))}}applyEzUploadContext(t,i){var e,s;if("EZ-UPLOAD"===i.nodeName){i.urlUpload=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),i.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const n=this._dataUnit.getField(t),r=null===(e=n.properties)||void 0===e?void 0:e.DESTINATION;r&&(i.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),i.maxFiles=(null===(s=n.properties)||void 0===s?void 0:s.MAX_FILES)||0}}interceptAction(t){if(t.type===a.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new c(a.RECORDS_COPIED,t.payload.map((t=>{const e=Object.assign({},t);return i.forEach((t=>delete e[t])),e})))}if(t.type===a.SAVING_DATA)return new Promise((i=>{this.validate().then((()=>i(t))).catch((()=>{}))}));if(t.type===a.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new c(a.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const i=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(i){const t={};for(const e in i)t[e]=this._dataUnit.valueFromString(e,i[e]);return t}}}class w{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,i,e,s,n){const r=new w;return r.field=i,r.fieldName=t,r.startChangeListener=i=>{r.listen&&e(t,i.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{r.listen&&s(t)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=i=>{r.listen&&n(t,i.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}function E(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var O="function"==typeof Symbol&&Symbol.observable||"@@observable",C=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+C(),REPLACE:"@@redux/REPLACE"+C(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+C()}};function j(t){if("object"!=typeof t||null===t)return!1;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(t)===i}function R(t,i,e){var s;if("function"==typeof i&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(E(0));if("function"==typeof i&&void 0===e&&(e=i,i=void 0),void 0!==e){if("function"!=typeof e)throw new Error(E(1));return e(R)(t,i)}if("function"!=typeof t)throw new Error(E(2));var n=t,r=i,o=[],a=o,h=!1;function l(){a===o&&(a=o.slice())}function c(){if(h)throw new Error(E(3));return r}function u(t){if("function"!=typeof t)throw new Error(E(4));if(h)throw new Error(E(5));var i=!0;return l(),a.push(t),function(){if(i){if(h)throw new Error(E(6));i=!1,l();var e=a.indexOf(t);a.splice(e,1),o=null}}}function d(t){if(!j(t))throw new Error(E(7));if(void 0===t.type)throw new Error(E(8));if(h)throw new Error(E(9));try{h=!0,r=n(r,t)}finally{h=!1}for(var i=o=a,e=0;e<i.length;e++)(0,i[e])();return t}function f(t){if("function"!=typeof t)throw new Error(E(10));n=t,d({type:A.REPLACE})}function v(){var t,i=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(E(11));function e(){t.next&&t.next(c())}return e(),{unsubscribe:i(e)}}})[O]=function(){return this},t}return d({type:A.INIT}),(s={dispatch:d,subscribe:u,getState:c,replaceReducer:f})[O]=v,s}const D={};function z(t=D,i){switch(i.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:i.payload,currentSheet:void 0});case N.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:i.payload});default:return t}}function I(t){return t.formMetadata}var N;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));const x=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.formItemsReady=i(this,"formItemsReady",7),this.onDataUnitAction=t=>{t.type===a.METADATA_LOADED&&this.processMetadata()},this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0}validate(){return this._dataBinder.validate()}observeConfig(){this.processMetadata()}getDynamicContent(){var t;const i=I(this._store.getState());if(!i)return null;const s=Array.from(i.getAllSheets().values()),n=function(t){const i=function(t){return t.currentSheet}(t);return i?t.formMetadata.getSheet(i):Array.from(t.formMetadata.getAllSheets().values())[0]}(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(s.length>1){const t=s.map(((t,i)=>({tabKey:t.name,label:t.label,index:i}))),i="selector";r.push(e("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:N.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:n.name,"data-element-id":i}))}return r=r.concat(this.buildFormContent(n)),r}buildFormContent(t){const i=null==t?void 0:t.fields;if(null==t)return;const s=`${u.replaceAccentuatedChars(u.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return e("div",{class:"dynamic-content","data-element-id":s},e("ez-form-view",{class:"ez-row ez-padding-vertical--small",fields:i}))}processMetadata(){if(!this.isStatic()&&this.dataUnit&&this._store){const t=((t,i,e=!1)=>{var s,n;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const i=t.metadata;let e;return i&&(e=i.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:e}})(i));const r=new Map,o=new Map,a=[],h=[],l={};null===(s=null==t?void 0:t.tabs)||void 0===s||s.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(n=null==t?void 0:t.fields)||void 0===n||n.forEach((t=>{var e,s,n;if(!1!==t.visible){const c=((t,i)=>("string"==typeof t?Array.from(i.keys()).find((i=>i.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",r);if(o.has(c.label))return;const u=i.getField(t.name);if(u&&c.visible){r.has(c)||r.set(c,[]);const i=v(u,t);r.get(c).push(i),i.required&&a.push(t.name),((null==t.cleanOnCopy?null===(e=u.properties)||void 0===e?void 0:e.cleanOnCopy:t.cleanOnCopy)||(null===(s=u.properties)||void 0===s?void 0:s.cleanOnCopy))&&h.push(t.name);let o=null==t.defaultValue?null===(n=u.properties)||void 0===n?void 0:n.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:i,value:e}=o;if(i)if("V"===i)o=e;else try{const t=JSON.parse(e);o=t&&"value"in t?t:e}catch(t){}l[t.name]=o}}}}));const c=new y;if(c.setDefaultVars(t.defaultVars),e){const t=i.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:i,name:e,fields:s}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);r.set({name:e,label:i},s)}))}return Array.from(r.entries()).sort(_).forEach((([t,i])=>{c.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:i})})),c.addRequiredFields(a),c.addCleanOnCopyFields(h),c.addDefaultValues(l),c})(this.config,this.dataUnit);this._store.dispatch({type:N.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new g(this.dataUnit),this._store=R(z),this._store.subscribe((()=>s(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),f.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=I(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[f.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=u.toCamelCase(t.label))),t}render(){return e(n,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};x.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{x as ez_form}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,g as e}from"./p-e318d280.js";import{NumberUtils as h,ElementIDUtils as r}from"@sankhyalabs/core";import{C as o}from"./p-7eb3e1a5.js";const a=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.ezStartChange=s(this,"ezStartChange",7),this.ezCancelWaitingChange=s(this,"ezCancelWaitingChange",7),this._focused=!1,this._changePending=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.canShowError=!0,this.errorMessage=void 0,this.precision=void 0,this.prettyPrecision=void 0,this.mode="regular"}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,s){if(this._textInput&&t!=s){const i=this.validateValue(t),e=this.validateValue(s);if(null===i&&(this._textInput.value=""),i!=e){const t=this.getTextValue(i)||"";(this._textInput.value||"")!==t&&(void 0===this.getParsedNumber(t)&&this._focused||(this._textInput.value=t,this._focused=!1,this.errorMessage="")),this.ezChange.emit(null===i?void 0:i)}}this._changePending=!1}validateValue(t){return isNaN(t)||void 0===t?null:t}getTextValue(t){if(null!=t)return this.precision>0?h.format(t.toString(),Number(this.precision),Number(this.prettyPrecision)):t.toString()}changeValue(t){this.errorMessage="",this.value!=t?this.value=void 0===t?null:t:(this.setInputValue(),this.ezCancelWaitingChange.emit())}setError(t){this.value=null,this.errorMessage=t,this.ezCancelWaitingChange.emit()}handleBlur(){try{const t=this.getParsedNumber();if(void 0!==t&&isNaN(t))this.setError("O valor digitado não é um número válido");else try{this.changeValue(t)}catch(t){return void this.setError(t.message)}}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}handleInput(){this.getParsedNumber()!==this.value&&(this._focused=!0,this._changePending=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}getParsedNumber(t){var s;return void 0===t&&(t=null===(s=this._textInput)||void 0===s?void 0:s.value),(null==t?void 0:t.trim())?h.stringToNumber(t):void 0}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return r.addIDInfoIfNotExists(this._elem,"input"),i("ez-text-input",{class:"number__input","data-element-id":r.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"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})}get _elem(){return e(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};a.style=":host{display:block;width:100%}.number__input{height:100%}";export{a as ez_number_input}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,H as o,g as n}from"./p-e318d280.js";import{MaskFormatter as r,ElementIDUtils as s}from"@sankhyalabs/core";const a=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.mask=void 0,this.canShowError=!0,this.restrict=void 0,this.mode="regular",this.noBorder=!1}observeErrorMessage(){this._inputElem&&this.isInvalid().then((t=>{var i,e;t?(this._inputElem.classList.add("hasError"),null===(i=this._messageBoxElem)||void 0===i||i.classList.add("hasError")):(this._inputElem.classList.remove("hasError"),null===(e=this._messageBoxElem)||void 0===e||e.classList.remove("hasError"))}))}observeMask(){this.mask&&(null==this._maskFormatter?this._maskFormatter=new r(this.mask):this._maskFormatter.mask=this.mask)}observeValue(t,i){this._inputElem&&t!=i&&(this._inputElem.value=this.value||"",this.handleChange(),this.adjustFloatingLabel(),this.isSlaveMode()||(this.errorMessage="",this.ezChange.emit(this.value)))}adjustFloatingLabel(){if(this.label&&this._labelElem){this._inputElem&&!this._inputElem.classList.contains("input--with--label")&&this._inputElem.classList.add("input--with--label");const t=this.value&&this.value.toString().length>0,i=this._labelElem.classList.contains("input__label--floated");t||this.isFocused()?i||this._labelElem.classList.add("input__label--floated"):i&&this._labelElem.classList.remove("input__label--floated")}}isFocused(){return null!==this._hostElement.shadowRoot.activeElement}isSlaveMode(){var t,i;return"true"===(null===(i=null===(t=this._hostElement)||void 0===t?void 0:t.dataset)||void 0===i?void 0:i.slaveMode)}adjustColorContentSlot(t=""){this._contentLeftSlot&&(this._contentLeftSlot.style.color=t)}adjustBorderInput(){this.noBorder&&this._inputElem.classList.add("input__slim--noborder")}async setFocus(t){const{selectText:i}=t||{};i&&this._inputElem.select(),this._inputElem.focus()}async setBlur(){this._inputElem.blur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}handleFocusout(){const t=this._inputElem.value;if(t&&this._maskFormatter)try{this._inputElem.value=this._maskFormatter.format(t)}catch(t){this.errorMessage=t.message}this.controlChangeValue(),this.adjustFloatingLabel(),this.adjustColorContentSlot()}isValidValue(t){return!this.restrict||Array.from(t).reduce(((t,i)=>t&&this.restrict.indexOf(i)>-1),!0)}controlChangeValue(){this._inputElem&&(this.value||"")!==this._inputElem.value&&(this.value=this._inputElem.value)}handleChange(){if(!this._inputElem)return;const t=this._inputElem.value;this.isValidValue(t)?this._lastValidValue=t:this._inputElem.value=null==this._lastValidValue?"":this._lastValidValue,this.controlChangeValue()}handleSlotChange(t){const i=t.target,e=i.assignedElements()[0];e&&(e.style.position="absolute",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.overflow="hidden",e.style.top="0px",e.style.width="var(--ez-text-input__icon--width)",e.style.height="slim"!=this.mode?"var(--ez-text-input--height)":"var(--ez-text-input--height--slim)","leftIcon"==i.name?(e.style.left="0px",e.style.borderRadius="var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)",this._inputElem.classList.add("icon--left"),this._labelElem&&this._labelElem.classList.add("input__label--left"),this._contentLeftSlot=e):"rightIcon"==i.name&&(e.style.right="0px",e.style.borderRadius="0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0",this._inputElem.classList.add("icon--right"),this._labelElem&&this._labelElem.classList.add("input__label--right")),i.name&&s.addIDInfo(e,i.name)),this.observeErrorMessage()}doFocus(){this.label&&this._labelElem&&!this._labelElem.classList.contains("input__label--floated")&&this._labelElem.classList.add("input__label--floated"),this.adjustColorContentSlot("var(--ez-text-input__input--focus--icon-color)")}componentDidLoad(){this.observeErrorMessage(),this.observeMask(),this.adjustFloatingLabel(),this.adjustBorderInput()}componentWillLoad(){if(this.observeMask(),this.value){if(this._maskFormatter)try{this.value=this._maskFormatter.format(this.value)}catch(t){this.errorMessage=t.message}this.isValidValue(this.value)||(this._lastValidValue="",this.value="")}}render(){return s.addIDInfoIfNotExists(this._hostElement,"input"),e(o,{style:this._hostElement.classList.contains("grid_editor")?{height:"100%"}:null},e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label&&"slim"!=this.mode?e("label",{ref:t=>this._labelElem=t,class:this.enabled?"input__label":"input__label input__label--disabled",onClick:()=>this._inputElem.focus(),title:this.label},this.label):null,e("input",{"data-element-id":s.getInternalIDInfo("input"),onFocus:()=>this.doFocus(),ref:t=>this._inputElem=t,type:"text",class:"slim"===this.mode?"input--slim":"",placeholder:"slim"===this.mode&&this.label?this.label:"",value:this.value,disabled:!this.enabled,onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()}}),e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.canShowError&&"slim"!=this.mode&&e("span",{class:"message-box",ref:t=>this._messageBoxElem=t,title:this.errorMessage,"data-element-id":s.getInternalIDInfo("message_box")},this.errorMessage))}get _hostElement(){return n(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],mask:["observeMask"],value:["observeValue"]}}};a.style=":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__input--noborder-color:white;--ez-text-input__input--padding:var(--space--medium, 6px);--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;--ez-text-input__input--focus--icon-color:var(--ez-text-input__input--focus--border-color);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}:host(.grid_editor){--ez-text-input--height--slim:25px}input{width:100%;box-sizing:border-box;height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color);font-weight:var(--ez-text-input--font-weight);padding:var(--ez-text-input__input--padding)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:read-only{cursor:default}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input__slim--title{font-size:16px;font-weight:bold}.input--slim::-webkit-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-ms-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:disabled::-webkit-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-ms-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}input.input__slim--noborder{box-shadow:0 0 0 0;border:0 none;outline:0;background:var(--ez-text-input__input--noborder-color)}";export{a as ez_text_input}
@@ -1 +1 @@
1
- import{r as t,c as i,h as o,H as n,g as s}from"./p-e318d280.js";import{FloatingManager as a,ElementIDUtils as e}from"@sankhyalabs/core";import"./p-f15ec3bb.js";import{C as r}from"./p-4a5e37a7.js";import"./p-ab574d59.js";import"./p-b853763b.js";const c=class{constructor(o){t(this,o),this.ezAction=i(this,"ezAction",7),this._arrowOffset=5,this.innerClickCheck=(t,i)=>{var o;if(i&&t){if(i===t)return!0;const n=t.children;for(let t=0;t<n.length;t++)if(null===(o=n[t].shadowRoot)||void 0===o?void 0:o.contains(i))return!0}return!1},this._selectedAction=void 0,this.enabled=!0,this.actions=void 0,this.size="medium",this.showLabel=!1,this.displayIcon=void 0,this.checkOption=!1,this.value=void 0,this.isTransparent=!1,this.arrowActive=!1}async hideActions(){null!=this._floatingID&&a.close(this._floatingID),this._floatingID=void 0}async isOpened(){return null!=this._floatingID}getFloatOptions(){return{autoClose:!0,innerClickTest:this.innerClickCheck,isFixed:!0,top:this.getPositionTop(),left:this.getPositionLeft()}}getSideLimit(){var t;const i=document.body.clientWidth,o=null===(t=this._actionsList)||void 0===t?void 0:t.getBoundingClientRect();if((null==o?void 0:o.right)>i)return i-o.width+"px"}showActions(){if(!this.enabled)return;const t=this.getFloatOptions();this._floatingID=a.float(this._actionsList,this._listContainer,t);const i=this.getSideLimit();null!=i&&(t.left=i,a.updateFloatPosition(this._actionsList,this._listContainer,t)),window.requestAnimationFrame((()=>{this._actionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}updatePosition(){if(!this.enabled||null==this._floatingID)return;const t=this.getFloatOptions(),i=this.getSideLimit();null!=i&&(t.left=i),a.updateFloatPosition(this._actionsList,this._listContainer,t)}getPositionTop(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.y+i.height+"px"}getBoundingLeft(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.x-(this.arrowActive?this._arrowOffset:0)+"px"}getPositionLeft(){return this.getBoundingLeft()||(this.arrowActive?`-${this._arrowOffset}px`:null)}hasLabelOrCheckOption(){var t;return(this.showLabel||this.checkOption)&&(null===(t=this.actions)||void 0===t?void 0:t.length)>0}hasIconName(){var t;return null===(t=this.actions)||void 0===t?void 0:t.some((t=>null!=t.iconName))}controlScrollPage(){window.removeEventListener("scroll",this.updatePosition.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this))}handlerButtonClick(){this.showActions()}actionClick(t){this._selectedAction=t,this.hideActions(),this.ezAction.emit(t)}componentWillLoad(){if(null==this.actions){this.actions=[];const t=this._element.querySelectorAll("action");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value"),n=!("false"===t.getAttribute("enabled"));o||(o=i),this.actions.push({label:i,value:o,enabled:n}),t.hidden=!0}))}}componentDidLoad(){r.applyVarsButton(this._element,this._button),e.addIDInfo(this._element),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._actionsList.remove(),this.hasLabelOrCheckOption()&&(this.value?this._selectedAction=this.actions.find((t=>t.value===this.value)):this._selectedAction||(this._selectedAction=this.actions[0]))}render(){var t;return o(n,null,o("ez-button",{ref:t=>this._button=t,class:(this.isTransparent?"ez-actions-button__btn-transparent":"")+(this.showLabel?" ez-actions-button__btn-label":""),label:this.showLabel&&(null===(t=this._selectedAction)||void 0===t?void 0:t.label),enabled:this.enabled,mode:this.showLabel?void 0:"icon",iconName:this.showLabel?"":this.displayIcon||"dots-vertical",size:this.size,onClick:()=>this.handlerButtonClick()},this.showLabel&&o("ez-icon",{class:"ez-actions-button__icon-right",slot:"rightIcon",iconName:this.displayIcon||"dots-vertical"})),o("section",{class:"ez-actions-button__list-container",ref:t=>this._listContainer=t},this.arrowActive&&o("div",{class:"ez-actions-button__arrow ez-actions-button__arrow--"+(this.size||"small")+(this.isTransparent?" ez-actions-button__arrow--upped":"")}),o("div",{ref:t=>this._actionsList=t,class:"ez-actions-button__actions-list"+(this.arrowActive&&!this.isTransparent?" ez-actions-button__actions-list--lowered":"")},this.actions.map((t=>{var i;return o("ez-button",{size:"small",label:t.label,onClick:()=>this.actionClick(t),enabled:t.enabled,class:"ez-actions-button__btn-action"+(this.checkOption||this.hasIconName()?" ez-actions-button__btn-action--spaced":"")},this.checkOption&&(null===(i=this._selectedAction)||void 0===i?void 0:i.value)===t.value&&o("ez-icon",{class:"ez-actions-button__icon-check",slot:"leftIcon",size:"small",iconName:"check"}),!this.checkOption&&t.iconName&&o("ez-icon",{class:"ez-actions-button__icon-item",slot:"leftIcon",size:"small",iconName:t.iconName}))})))))}get _element(){return s(this)}};c.style=":host{--ez-actions-button__actions-list--border-radius:var(--border--radius-medium, 12px);--ez-actions-button__actions-list--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-actions-button__actions-list--background-color:var(--background--xlight, #fff);--ez-actions-button__actions-list--padding:var(--space--small, 6px);--ez-actions-button__actions-list--top-margin:var(--space-small, 6px);--ez-actions-button__btn-action--min-width:'auto';--ez-actions-button__btn-action--background-color:var(--background--xlight, #fff);display:flex;flex-direction:column;height:fit-content;user-select:none}.ez-actions-button__actions-list{display:flex;flex-direction:column;position:fixed;width:fit-content;height:fit-content;z-index:var(--more-visible, 2);padding:var(--ez-actions-button__actions-list--padding);margin-top:var(--ez-actions-button__actions-list--top-margin);background-color:var(--ez-actions-button__actions-list--background-color);border-radius:var(--ez-actions-button__actions-list--border-radius);box-shadow:var(--ez-actions-button__actions-list--box-shadow)}.ez-actions-button__actions-list--lowered{margin-top:calc(var(--ez-actions-button__actions-list--top-margin) + 6px)}.ez-actions-button__btn-action{--ez-button--justify-content:flex-start;--ez-button--width:100%;--ez-button--min-width:var(--ez-actions-button__btn-action--min-width);--ez-button--background-color:var(--ez-actions-button__btn-action--background-color);--ez-button--font-weight:var(--text-weight--medium, 400);--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__btn-action--spaced{--ez-button--padding-left:calc(var(--space--medium, 12px) + 24px)}.ez-actions-button__icon-right{margin-left:var(--space--small, 6px)}.ez-actions-button__icon-check,.ez-actions-button__icon-item{position:absolute;left:var(--space--medium, 12px)}.ez-actions-button__icon-check{color:var(--ez-button--hover-color)}.ez-actions-button__arrow{position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;width:0;height:0;z-index:calc(var(--more-visible, 2) + 1);border-bottom:15px solid var(--ez-actions-button__btn-action--background-color)}.ez-actions-button__arrow--upped{margin-top:calc((var(--ez-actions-button__actions-list--top-margin) + 2px) * -1)}.ez-actions-button__arrow--small{margin-left:6px}.ez-actions-button__arrow--medium{margin-left:11px}.ez-actions-button__arrow--large{margin-left:13px}.ez-actions-button__arrow:only-child{display:none}.ez-actions-button__btn-transparent{--ez-button--background-color:transparent;--ez-button--hover--background-color:transparent;--ez-button--active--background-color:transparent;--ez-button--focus--border:none}.ez-actions-button__btn-label{--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__list-container{position:relative}";export{c as ez_actions_button}
1
+ import{r as t,c as i,h as o,H as n,g as s}from"./p-e318d280.js";import{FloatingManager as e,ElementIDUtils as a}from"@sankhyalabs/core";import"./p-f15ec3bb.js";import{C as r}from"./p-7eb3e1a5.js";import"./p-ab574d59.js";import"./p-b853763b.js";const c=class{constructor(o){t(this,o),this.ezAction=i(this,"ezAction",7),this._arrowOffset=5,this.innerClickCheck=(t,i)=>{var o;if(i&&t){if(i===t)return!0;const n=t.children;for(let t=0;t<n.length;t++)if(null===(o=n[t].shadowRoot)||void 0===o?void 0:o.contains(i))return!0}return!1},this._selectedAction=void 0,this.enabled=!0,this.actions=void 0,this.size="medium",this.showLabel=!1,this.displayIcon=void 0,this.checkOption=!1,this.value=void 0,this.isTransparent=!1,this.arrowActive=!1}async hideActions(){null!=this._floatingID&&e.close(this._floatingID),this._floatingID=void 0}async isOpened(){return null!=this._floatingID}getFloatOptions(){return{autoClose:!0,innerClickTest:this.innerClickCheck,isFixed:!0,top:this.getPositionTop(),left:this.getPositionLeft()}}getSideLimit(){var t;const i=document.body.clientWidth,o=null===(t=this._actionsList)||void 0===t?void 0:t.getBoundingClientRect();if((null==o?void 0:o.right)>i)return i-o.width+"px"}showActions(){if(!this.enabled)return;const t=this.getFloatOptions();this._floatingID=e.float(this._actionsList,this._listContainer,t);const i=this.getSideLimit();null!=i&&(t.left=i,e.updateFloatPosition(this._actionsList,this._listContainer,t)),window.requestAnimationFrame((()=>{this._actionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}updatePosition(){if(!this.enabled||null==this._floatingID)return;const t=this.getFloatOptions(),i=this.getSideLimit();null!=i&&(t.left=i),e.updateFloatPosition(this._actionsList,this._listContainer,t)}getPositionTop(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.y+i.height+"px"}getBoundingLeft(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.x-(this.arrowActive?this._arrowOffset:0)+"px"}getPositionLeft(){return this.getBoundingLeft()||(this.arrowActive?`-${this._arrowOffset}px`:null)}hasLabelOrCheckOption(){var t;return(this.showLabel||this.checkOption)&&(null===(t=this.actions)||void 0===t?void 0:t.length)>0}hasIconName(){var t;return null===(t=this.actions)||void 0===t?void 0:t.some((t=>null!=t.iconName))}controlScrollPage(){window.removeEventListener("scroll",this.updatePosition.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this))}handlerButtonClick(){this.showActions()}actionClick(t){this._selectedAction=t,this.hideActions(),this.ezAction.emit(t)}componentWillLoad(){if(null==this.actions){this.actions=[];const t=this._element.querySelectorAll("action");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value"),n=!("false"===t.getAttribute("enabled"));o||(o=i),this.actions.push({label:i,value:o,enabled:n}),t.hidden=!0}))}}componentDidLoad(){r.applyVarsButton(this._element,this._button),a.addIDInfo(this._element),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._actionsList.remove(),this.hasLabelOrCheckOption()&&(this.value?this._selectedAction=this.actions.find((t=>t.value===this.value)):this._selectedAction||(this._selectedAction=this.actions[0]))}render(){var t;return o(n,null,o("ez-button",{ref:t=>this._button=t,class:(this.isTransparent?"ez-actions-button__btn-transparent":"")+(this.showLabel?" ez-actions-button__btn-label":""),label:this.showLabel&&(null===(t=this._selectedAction)||void 0===t?void 0:t.label),enabled:this.enabled,mode:this.showLabel?void 0:"icon",iconName:this.showLabel?"":this.displayIcon||"dots-vertical",size:this.size,onClick:()=>this.handlerButtonClick()},this.showLabel&&o("ez-icon",{class:"ez-actions-button__icon-right",slot:"rightIcon",iconName:this.displayIcon||"dots-vertical"})),o("section",{class:"ez-actions-button__list-container",ref:t=>this._listContainer=t},this.arrowActive&&o("div",{class:"ez-actions-button__arrow ez-actions-button__arrow--"+(this.size||"small")+(this.isTransparent?" ez-actions-button__arrow--upped":"")}),o("div",{ref:t=>this._actionsList=t,class:"ez-actions-button__actions-list"+(this.arrowActive&&!this.isTransparent?" ez-actions-button__actions-list--lowered":"")},this.actions.map((t=>{var i;return o("ez-button",{size:"small",label:t.label,onClick:()=>this.actionClick(t),enabled:t.enabled,class:"ez-actions-button__btn-action"+(this.checkOption||this.hasIconName()?" ez-actions-button__btn-action--spaced":"")},this.checkOption&&(null===(i=this._selectedAction)||void 0===i?void 0:i.value)===t.value&&o("ez-icon",{class:"ez-actions-button__icon-check",slot:"leftIcon",size:"small",iconName:"check"}),!this.checkOption&&t.iconName&&o("ez-icon",{class:"ez-actions-button__icon-item",slot:"leftIcon",size:"small",iconName:t.iconName}))})))))}get _element(){return s(this)}};c.style=":host{--ez-actions-button__actions-list--border-radius:var(--border--radius-medium, 12px);--ez-actions-button__actions-list--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-actions-button__actions-list--background-color:var(--background--xlight, #fff);--ez-actions-button__actions-list--padding:var(--space--small, 6px);--ez-actions-button__actions-list--top-margin:var(--space-small, 6px);--ez-actions-button__btn-action--min-width:'auto';--ez-actions-button__btn-action--background-color:var(--background--xlight, #fff);display:flex;flex-direction:column;height:fit-content;user-select:none}.ez-actions-button__actions-list{display:flex;flex-direction:column;position:fixed;width:fit-content;height:fit-content;z-index:var(--more-visible, 2);padding:var(--ez-actions-button__actions-list--padding);margin-top:var(--ez-actions-button__actions-list--top-margin);background-color:var(--ez-actions-button__actions-list--background-color);border-radius:var(--ez-actions-button__actions-list--border-radius);box-shadow:var(--ez-actions-button__actions-list--box-shadow)}.ez-actions-button__actions-list--lowered{margin-top:calc(var(--ez-actions-button__actions-list--top-margin) + 6px)}.ez-actions-button__btn-action{--ez-button--justify-content:flex-start;--ez-button--width:100%;--ez-button--min-width:var(--ez-actions-button__btn-action--min-width);--ez-button--background-color:var(--ez-actions-button__btn-action--background-color);--ez-button--font-weight:var(--text-weight--medium, 400);--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__btn-action--spaced{--ez-button--padding-left:calc(var(--space--medium, 12px) + 24px)}.ez-actions-button__icon-right{margin-left:var(--space--small, 6px)}.ez-actions-button__icon-check,.ez-actions-button__icon-item{position:absolute;left:var(--space--medium, 12px)}.ez-actions-button__icon-check{color:var(--ez-button--hover-color)}.ez-actions-button__arrow{position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;width:0;height:0;z-index:calc(var(--more-visible, 2) + 1);border-bottom:15px solid var(--ez-actions-button__btn-action--background-color)}.ez-actions-button__arrow--upped{margin-top:calc((var(--ez-actions-button__actions-list--top-margin) + 2px) * -1)}.ez-actions-button__arrow--small{margin-left:6px}.ez-actions-button__arrow--medium{margin-left:11px}.ez-actions-button__arrow--large{margin-left:13px}.ez-actions-button__arrow:only-child{display:none}.ez-actions-button__btn-transparent{--ez-button--background-color:transparent;--ez-button--hover--background-color:transparent;--ez-button--active--background-color:transparent;--ez-button--focus--border:none}.ez-actions-button__btn-label{--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__list-container{position:relative}";export{c as ez_actions_button}
@@ -9,6 +9,7 @@ export declare class EzCalendar {
9
9
  private _weekDayLabels;
10
10
  private _monthLabels;
11
11
  private _calendarHeight;
12
+ private _calendarWidth;
12
13
  private _hoursLabel;
13
14
  private _minutosLabel;
14
15
  private _hoursSelect;
@@ -17,6 +18,7 @@ export declare class EzCalendar {
17
18
  private _hoursScroll;
18
19
  private _minutesScroll;
19
20
  private _secondsScroll;
21
+ _hostElem: HTMLEzCalendarElement;
20
22
  /**
21
23
  * Define o valor do calendário.
22
24
  */
@@ -43,14 +45,20 @@ export declare class EzCalendar {
43
45
  */
44
46
  show(top?: string, left?: string, bottom?: string, right?: string): Promise<void>;
45
47
  /**
46
- * Ajusta o posicionamento do ez-calendar conforme a disponibilidade de espaço.
48
+ * Ajusta o posicionamento vertical do ez-calendar conforme a disponibilidade de espaço.
47
49
  */
48
50
  fitVertical(topOffset: number, bottomOffset: number): Promise<void>;
51
+ /**
52
+ * Ajusta o posicionamento horizontal do ez-calendar conforme a disponibilidade de espaço.
53
+ */
54
+ fitHorizontal(rightOffset: number): Promise<void>;
49
55
  /**
50
56
  * Oculta o ez-calendar.
51
57
  */
52
58
  hide(): Promise<void>;
53
59
  observeValue(): void;
60
+ scrollListener(): void;
61
+ private isFixed;
54
62
  private getMonthLabel;
55
63
  private isSelectedDate;
56
64
  private changeMonth;
@@ -75,6 +75,18 @@ export declare class EzComboBox {
75
75
  * Define o tamanho do campo.
76
76
  */
77
77
  mode: "slim" | "regular";
78
+ /**
79
+ * Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
80
+ */
81
+ hideErrorOnFocusOut: boolean;
82
+ /**
83
+ * Define um posicionamento fixo para a lista de opções do CheckBox.
84
+ */
85
+ listOptionsPosition: IEzCheckBoxListPosition;
86
+ /**
87
+ * Informa se a pesquisa é do tipo texto.
88
+ */
89
+ isTextSearch: boolean;
78
90
  /**
79
91
  * Emitido quando acontece a alteração de valor do campo.
80
92
  */
@@ -82,6 +94,7 @@ export declare class EzComboBox {
82
94
  observeErrorMessage(): void;
83
95
  observeValue(newValue: IOption | string, oldValue: IOption | string): void;
84
96
  observeOptions(newOptions: IOption[], oldOptions: IOption[]): void;
97
+ getValueAsync(): Promise<unknown>;
85
98
  /**
86
99
  * Aplica o foco no campo.
87
100
  */
@@ -100,6 +113,7 @@ export declare class EzComboBox {
100
113
  clearValue(): Promise<void>;
101
114
  scrollListener(): void;
102
115
  private updateListPosition;
116
+ private getListPosition;
103
117
  private isDifferentValues;
104
118
  private getFormattedText;
105
119
  private getText;
@@ -135,6 +149,7 @@ export declare class EzComboBox {
135
149
  componentDidRender(): void;
136
150
  componentDidLoad(): void;
137
151
  private handlerIconClick;
152
+ private buildNumberArgument;
138
153
  private onTextInputChangeHandler;
139
154
  private clearDeboucingTimeout;
140
155
  private onTextInputClickHandler;
@@ -156,4 +171,12 @@ declare enum SearchMode {
156
171
  PRELOAD = "PRELOAD",
157
172
  PREDICTIVE = "PREDICTIVE"
158
173
  }
174
+ export interface IEzCheckBoxListPosition {
175
+ hardPosition?: boolean;
176
+ horizontalPosition?: number;
177
+ verticalPosition?: number;
178
+ fromRight?: boolean;
179
+ fromBottom?: boolean;
180
+ bottomLimit?: number;
181
+ }
159
182
  export {};
@@ -3,7 +3,9 @@ import { WaitingChange } from '@sankhyalabs/core';
3
3
  export declare class EzDateInput {
4
4
  private _calendar;
5
5
  private _textInput;
6
+ private _changePending;
6
7
  private _focused;
8
+ private _valuePromiseCallbacks;
7
9
  private _elem;
8
10
  /**
9
11
  * Emitido quando acontece a alteração de valor do campo.
@@ -56,6 +58,7 @@ export declare class EzDateInput {
56
58
  * Retorna se o conteúdo é inválido.
57
59
  */
58
60
  isInvalid(): Promise<boolean>;
61
+ getValueAsync(): Promise<Date>;
59
62
  private changeValue;
60
63
  private showCalendar;
61
64
  private hideCalendar;
@@ -63,6 +66,7 @@ export declare class EzDateInput {
63
66
  private getTextValue;
64
67
  private handleInput;
65
68
  private setInputValue;
69
+ private isFixed;
66
70
  componentDidLoad(): void;
67
71
  render(): any;
68
72
  }
@@ -3,7 +3,9 @@ import { WaitingChange } from '@sankhyalabs/core';
3
3
  export declare class EzDateTimeInput {
4
4
  private _calendar;
5
5
  private _textInput;
6
+ private _changePending;
6
7
  private _focused;
8
+ private _valuePromiseCallbacks;
7
9
  private _elem;
8
10
  /**
9
11
  * Emitido quando acontece a alteração de valor do campo.
@@ -60,6 +62,7 @@ export declare class EzDateTimeInput {
60
62
  * Retorna se o conteúdo é inválido.
61
63
  */
62
64
  isInvalid(): Promise<boolean>;
65
+ getValueAsync(): Promise<Date>;
63
66
  private handleKeyDown;
64
67
  private handleFocus;
65
68
  private handleClick;
@@ -71,6 +74,7 @@ export declare class EzDateTimeInput {
71
74
  private getTextValue;
72
75
  private handleInput;
73
76
  private setInputValue;
77
+ private isFixed;
74
78
  componentDidLoad(): void;
75
79
  render(): any;
76
80
  }
@@ -2,6 +2,7 @@ import { DataUnit } from "@sankhyalabs/core";
2
2
  import { EventEmitter } from "../../stencil-public-runtime";
3
3
  import { Tab } from "../ez-tabselector/ez-tabselector";
4
4
  import { IFormConfig, IRecordValidator } from "../../utils/form/interfaces";
5
+ import { FormItems } from "../ez-form-view/structure";
5
6
  export declare class EzForm {
6
7
  private _element;
7
8
  private _store;
@@ -24,6 +25,10 @@ export declare class EzForm {
24
25
  * Evento disparado quando o formulário está disponível na DOM.
25
26
  */
26
27
  ezReady: EventEmitter<void>;
28
+ /**
29
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
30
+ */
31
+ formItemsReady: EventEmitter<FormItems>;
27
32
  /**
28
33
  * Realiza validação no conteúdo de todos os campos.
29
34
  */
@@ -1,11 +1,16 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import { IFormViewField } from './interfaces/IFormViewField';
3
+ import { FormItems } from './structure';
3
4
  export declare class EzFormView {
4
5
  _element: HTMLEzFormViewElement;
5
6
  /**
6
7
  * Evento emitido quando o componente foi totalmente carregado na DOM.
7
8
  */
8
9
  ezContentReady: EventEmitter<Array<HTMLElement>>;
10
+ /**
11
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
12
+ */
13
+ formItemsReady: EventEmitter<FormItems>;
9
14
  /**
10
15
  * Define a lista de metadados usada para criar os campos de user interface.
11
16
  */
@@ -1,15 +1,3 @@
1
- import { UserInterface } from "@sankhyalabs/core";
2
- import { IOption, ISearchArgument } from "../../ez-combo-box/ez-combo-box";
3
- export interface IFormViewField {
4
- userInterface: UserInterface;
5
- name: string;
6
- label?: string;
7
- group?: string;
8
- readOnly?: boolean;
9
- required?: boolean;
10
- props?: any;
11
- contextName?: string;
12
- canShowError?: boolean;
13
- rows?: number;
14
- optionLoader?: (argument: ISearchArgument) => Promise<Array<IOption>> | Array<IOption> | IOption;
1
+ import IAbstractFieldMetadata from "../../../utils/interfaces/AbstractFieldMetadata";
2
+ export interface IFormViewField extends IAbstractFieldMetadata {
15
3
  }
@@ -0,0 +1,15 @@
1
+ declare class FormItem {
2
+ private elem;
3
+ constructor(elem: HTMLElement);
4
+ addRightElement(el: Element): void;
5
+ removeRightElement(): void;
6
+ get fieldName(): string;
7
+ }
8
+ export declare class FormItems {
9
+ items: Map<string, FormItem>;
10
+ private formId;
11
+ constructor(items: Array<HTMLElement>, formId?: string);
12
+ getItem(name: string): FormItem;
13
+ get formName(): string;
14
+ }
15
+ export {};
@@ -1,6 +1,8 @@
1
1
  import { DataUnit, Filter } from '@sankhyalabs/core';
2
2
  import { Components } from '../../../components';
3
3
  import FilterCollumn = Components.FilterColumn;
4
+ import { IRecordValidator } from '../../../utils/form/interfaces';
5
+ import { GridApi } from 'ag-grid-community';
4
6
  /**
5
7
  * O intuito desta abstração, é isolar o componente EzGrid de uma implementação
6
8
  * específica, permitindo que usemos componentes de terceiros sem um acoplamento
@@ -20,6 +22,10 @@ export default interface EzGridController {
20
22
  * @param options - A contextualização dessa instância de grade.
21
23
  */
22
24
  initDatagrid(container: HTMLElement, options: EzGridOptions): void;
25
+ /**
26
+ * Chamado pelo EzGrid para retornar a api de manipulação da grade.
27
+ */
28
+ getGridApi(): GridApi;
23
29
  /**
24
30
  * Método responsável por receber a definição das colunas.
25
31
  * @param cols - Array contendo a definição de todas as colunas.
@@ -142,6 +148,18 @@ export interface EzGridOptions {
142
148
  * Exemplo: { "RECDESP": { "-1" : "#BD0025", "1" : "#157A00" } }
143
149
  */
144
150
  statusResolver: IStatusResolver | StatusResolverFunction;
151
+ /**
152
+ * Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
153
+ */
154
+ useEnterLikeTab: boolean;
155
+ /**
156
+ * Antes de executar o salvamento da edição, pode-se atribuir um validador de registros.
157
+ */
158
+ recordsValidator?: IRecordValidator;
159
+ /**
160
+ * Desabilita edição na grade independente da configuração de coluna.
161
+ */
162
+ editionIsDisabled?: () => boolean;
145
163
  }
146
164
  /**
147
165
  * Representa cada coluna da grade.
@@ -1,5 +1,6 @@
1
1
  import { Sort, SortingProvider } from '@sankhyalabs/core';
2
2
  import { Filter, FilterProvider } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
3
+ import { GridApi } from 'ag-grid-community';
3
4
  import EzGridController, { EzGridColumn, EzGridColumnConfig, EzGridColumnMenuItemDef, EzGridOptions } from '../EzGridController';
4
5
  export default class AgGridController implements EzGridController, SortingProvider, FilterProvider {
5
6
  private readonly DEFAULT_ROW_HEIGHT;
@@ -29,11 +30,13 @@ export default class AgGridController implements EzGridController, SortingProvid
29
30
  private _filteredColumns;
30
31
  private _filterColumn;
31
32
  private _filterColumnleftPosition;
33
+ private _editionManager;
32
34
  configFilterColumn(filterColumn: HTMLFilterColumnElement): void;
33
35
  private handleFilteredColumnsChanged;
34
36
  private showFilterColumn;
35
37
  constructor(enterprise: boolean);
36
38
  getGridConfig(): Array<EzGridColumnConfig>;
39
+ getGridApi(): GridApi;
37
40
  getSort(): Array<Sort>;
38
41
  getFilter(): Array<Filter> | undefined;
39
42
  initDatagrid(container: HTMLElement, options: EzGridOptions): void;
@@ -76,6 +79,7 @@ export default class AgGridController implements EzGridController, SortingProvid
76
79
  private getStyleByColumn;
77
80
  private getFormatterByColumn;
78
81
  private onCallStateChange;
82
+ private onCellClicked;
79
83
  private isElementResize;
80
84
  private isUIEvent;
81
85
  private onSelectionChange;
@@ -0,0 +1,38 @@
1
+ import { DataUnit } from "@sankhyalabs/core";
2
+ import { CellPosition, ColDef, GridApi, GridOptions } from "ag-grid-community";
3
+ import { IRecordValidator } from "../../../../utils/form/interfaces";
4
+ export default class GridEditionManager {
5
+ private _dataUnit;
6
+ private _lastCellClicked;
7
+ private _lastCellEdited;
8
+ private _targetEditionCell;
9
+ private _recordValidationProcessor;
10
+ private _gridOptions;
11
+ private _useEnterLikeTab;
12
+ private _editionIsDisabled;
13
+ private _isGridEdition;
14
+ constructor(dataUnit: DataUnit, useEnterLikeTab: boolean, recordsValidator: IRecordValidator, editionIsDisabled: () => boolean);
15
+ configureGrid(options: GridOptions): GridOptions;
16
+ proceedAutoSave(): void;
17
+ navigateByEnterKey(keyboardEvent: KeyboardEvent): void;
18
+ getComponents(): {
19
+ [p: string]: any;
20
+ };
21
+ verifyClickToEdition(api: GridApi, cellClicked: CellPosition): void;
22
+ configureColumn(col: ColDef): ColDef;
23
+ private getRequiredFields;
24
+ private saveSuccess;
25
+ private saveFail;
26
+ private focusOnCell;
27
+ private onCellKeyDown;
28
+ private processEnterKey;
29
+ private nextEditionRow;
30
+ private editPreviousRow;
31
+ private editNextRow;
32
+ private moveEditionVertically;
33
+ private finishEdition;
34
+ private canEdit;
35
+ private isColEditable;
36
+ private isSecondClick;
37
+ private onCellEditRequest;
38
+ }
@@ -2,7 +2,7 @@ import { IHeaderParams } from 'ag-grid-community';
2
2
  export interface IEzGridCustomHeaderParams {
3
3
  tooltip?: string;
4
4
  hasFilter?: () => boolean;
5
- showColumnFilter?: (leftPosition: string) => void;
5
+ showColumnFilter?: (leftPosition: string, fromIcon: boolean) => void;
6
6
  }
7
7
  export declare class EzGridCustomHeader {
8
8
  private params;
@@ -0,0 +1,10 @@
1
+ import { ICellEditorComp, ICellEditorParams } from "ag-grid-community";
2
+ export default class EzCellEditor implements ICellEditorComp {
3
+ private _gui;
4
+ init(params: ICellEditorParams): void;
5
+ getGui(): HTMLElement;
6
+ afterGuiAttached(): void;
7
+ focusIn(): void;
8
+ getValue(): any;
9
+ isPopup(): boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export declare function getViewPortHeight(cell: Element): number | undefined;
@@ -0,0 +1,9 @@
1
+ import { DataUnit, FieldDescriptor } from '@sankhyalabs/core';
2
+ import IAbstractFieldMetadata from '../../../../../utils/interfaces/AbstractFieldMetadata';
3
+ import GridEditionManager from '../GridEditionManager';
4
+ export interface IEditorMetadata extends IAbstractFieldMetadata {
5
+ eGridCell: HTMLElement;
6
+ dataUnit: DataUnit;
7
+ editionManager: GridEditionManager;
8
+ }
9
+ export declare const buildEditorMetadata: (descriptor: FieldDescriptor, eGridCell: HTMLElement, dataUnit: DataUnit, editionManager: GridEditionManager) => IEditorMetadata;
@@ -0,0 +1,10 @@
1
+ export interface IUICellEditor extends HTMLElement {
2
+ setFocus: (options: IFocusOptions) => void;
3
+ value: any;
4
+ valueSetter?: (value: any) => void;
5
+ valueGetter?: () => any;
6
+ isPopUp?: boolean;
7
+ }
8
+ export interface IFocusOptions {
9
+ selectText: boolean;
10
+ }
@@ -0,0 +1,4 @@
1
+ import { IEditorMetadata } from "../IEditorMetadata";
2
+ import { IUICellEditor } from "../IUICellEditor";
3
+ export declare const buildComboBox: ({ required, props, eGridCell }: IEditorMetadata) => IUICellEditor;
4
+ export declare const buildSwitch: (fieldMetadata: IEditorMetadata) => IUICellEditor;
@@ -0,0 +1,5 @@
1
+ import { IEditorMetadata } from "../IEditorMetadata";
2
+ import { IUICellEditor } from "../IUICellEditor";
3
+ export declare const buildDate: () => IUICellEditor;
4
+ export declare const buildTime: ({ readOnly }: IEditorMetadata) => IUICellEditor;
5
+ export declare const buildDateTime: ({ readOnly }: IEditorMetadata) => IUICellEditor;
@@ -0,0 +1,4 @@
1
+ import { IEditorMetadata } from "../IEditorMetadata";
2
+ import { IUICellEditor } from "../IUICellEditor";
3
+ export declare const buildDecimal: ({ readOnly, props }: IEditorMetadata) => IUICellEditor;
4
+ export declare const buildInteger: ({ readOnly }: IEditorMetadata) => IUICellEditor;
@@ -0,0 +1,3 @@
1
+ import { IUICellEditor } from "../IUICellEditor";
2
+ import { IEditorMetadata } from '../IEditorMetadata';
3
+ export declare const buildSearch: ({ name, required, readOnly, eGridCell, dataUnit }: IEditorMetadata) => IUICellEditor;
@@ -0,0 +1,4 @@
1
+ import { IEditorMetadata } from "../IEditorMetadata";
2
+ import { IUICellEditor } from "../IUICellEditor";
3
+ export declare const buildTextInput: ({ name, contextName }: IEditorMetadata) => IUICellEditor;
4
+ export declare const buildTextAreaInput: ({ eGridCell, editionManager }: IEditorMetadata) => IUICellEditor;
@@ -1,8 +1,9 @@
1
1
  import { DataUnit } from '@sankhyalabs/core';
2
2
  import { EventEmitter } from '../../stencil-public-runtime';
3
3
  import { IMultiSelectionListDataSource } from '../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource';
4
- import { EzGridColumStateEvent, EzGridColumn, EzGridColumnConfig, IGridConfig, IStatusResolver, StatusResolverFunction } from './controller/EzGridController';
4
+ import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from './controller/EzGridController';
5
5
  import { ISelection, ISelectionToastConfig } from './interfaces';
6
+ import { IRecordValidator } from '../../utils/form/interfaces';
6
7
  export declare class EzGrid {
7
8
  private _container;
8
9
  private _refPaginationControl;
@@ -18,7 +19,7 @@ export declare class EzGrid {
18
19
  private _isAllSelection;
19
20
  private _currentPageSelected;
20
21
  private _selectionCount;
21
- private _originalRecords;
22
+ private _hasLeftButtons;
22
23
  /**
23
24
  * Emitido quando acontece a alteração de estado das colunas do grid: Ordenação, largura, etc.
24
25
  */
@@ -68,6 +69,18 @@ export declare class EzGrid {
68
69
  * Define um `IMultiSelectionListDataSource` responsável por alimentar o filtro de colunas.
69
70
  */
70
71
  columnfilterDataSource: IMultiSelectionListDataSource;
72
+ /**
73
+ * Quando verdadeiro, o ENTER fará a navegação como se fosse a tecla TAB na grade.
74
+ */
75
+ useEnterLikeTab: boolean;
76
+ /**
77
+ * Define um validador responsável pela integridade dos registros.
78
+ */
79
+ recordsValidator: IRecordValidator;
80
+ /**
81
+ * Define se a edição está habilitada na grid.
82
+ */
83
+ canEdit: boolean;
71
84
  /**
72
85
  * Aplica a definição de colunas.
73
86
  */
@@ -120,9 +133,7 @@ export declare class EzGrid {
120
133
  componentWillRender(): void;
121
134
  componentDidRender(): void;
122
135
  componentWillLoad(): void;
123
- onDataUnitAction: (action: any) => void;
124
136
  private getDataSource;
125
- private buildDefaultDataSource;
126
- private formatLabel;
137
+ private hideHeader;
127
138
  render(): any;
128
139
  }