@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-08202.0
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.
- package/README.md +78 -0
- package/dist/assets/actions-sprite.svg +257 -0
- package/dist/cjs/ApplicationUtils-2e444734.js +162 -0
- package/dist/cjs/CSSVarsUtils-b136a156.js +77 -0
- package/dist/cjs/CheckMode-ecb90b87.js +7 -0
- package/dist/cjs/DialogType-2114c337.js +9 -0
- package/dist/cjs/EzScrollDirection-b2c99895.js +8 -0
- package/dist/cjs/RecordValidationProcessor-edd23705.js +102 -0
- package/dist/cjs/constants-3a1d64fb.js +7 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +212 -0
- package/dist/cjs/ez-alert.cjs.entry.js +30 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-badge.cjs.entry.js +120 -0
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +285 -0
- package/dist/cjs/ez-button.cjs.entry.js +87 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +238 -0
- package/dist/cjs/ez-card-item.cjs.entry.js +52 -0
- package/dist/cjs/ez-check.cjs.entry.js +95 -0
- package/dist/cjs/ez-chip.cjs.entry.js +116 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +133 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +690 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +188 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +242 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +180 -0
- package/dist/cjs/ez-dropdown.cjs.entry.js +515 -0
- package/dist/cjs/ez-file-item.cjs.entry.js +74 -0
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +191 -0
- package/dist/cjs/ez-form.cjs.entry.js +933 -0
- package/dist/cjs/ez-grid.cjs.entry.js +120838 -0
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +96 -0
- package/dist/cjs/ez-icon.cjs.entry.js +44 -0
- package/dist/cjs/ez-list.cjs.entry.js +558 -0
- package/dist/cjs/ez-loading-bar.cjs.entry.js +32 -0
- package/dist/cjs/ez-modal-container.cjs.entry.js +64 -0
- package/dist/cjs/ez-modal.cjs.entry.js +72 -0
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +183 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +181 -0
- package/dist/cjs/ez-popover.cjs.entry.js +156 -0
- package/dist/cjs/ez-popup.cjs.entry.js +66 -0
- package/dist/cjs/ez-radio-button.cjs.entry.js +48 -0
- package/dist/cjs/ez-scroller_3.cjs.entry.js +792 -0
- package/dist/cjs/ez-search.cjs.entry.js +96 -0
- package/dist/cjs/ez-skeleton.cjs.entry.js +67 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +228 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +179 -0
- package/dist/cjs/ez-text-edit.cjs.entry.js +107 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +247 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +168 -0
- package/dist/cjs/ez-toast.cjs.entry.js +101 -0
- package/dist/cjs/ez-upload.cjs.entry.js +395 -0
- package/dist/cjs/ez-view-stack.cjs.entry.js +86 -0
- package/dist/cjs/ezui.cjs.js +23 -0
- package/dist/cjs/filter-column.cjs.entry.js +151 -0
- package/dist/cjs/index-1064511f.js +2340 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/collection/collection-manifest.json +184 -0
- package/dist/collection/components/assets/actions-sprite.svg +257 -0
- package/dist/collection/components/ez-actions-button/ez-actions-button.css +139 -0
- package/dist/collection/components/ez-actions-button/ez-actions-button.js +440 -0
- package/dist/collection/components/ez-alert/ez-alert.css +76 -0
- package/dist/collection/components/ez-alert/ez-alert.js +53 -0
- package/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/collection/components/ez-application/ez-application.js +41 -0
- package/dist/collection/components/ez-badge/enum/sizes.js +9 -0
- package/dist/collection/components/ez-badge/ez-badge.css +165 -0
- package/dist/collection/components/ez-badge/ez-badge.js +211 -0
- package/dist/collection/components/ez-badge/interfaces/IPosition.js +1 -0
- package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.css +66 -0
- package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.js +373 -0
- package/dist/collection/components/ez-breadcrumb/subcomponents/breadcrumb-item.js +20 -0
- package/dist/collection/components/ez-button/ez-button.css +255 -0
- package/dist/collection/components/ez-button/ez-button.js +241 -0
- package/dist/collection/components/ez-calendar/ez-calendar.css +318 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +439 -0
- package/dist/collection/components/ez-card-item/ez-card-item.css +126 -0
- package/dist/collection/components/ez-card-item/ez-card-item.js +97 -0
- package/dist/collection/components/ez-check/CheckMode.js +5 -0
- package/dist/collection/components/ez-check/ez-check.css +366 -0
- package/dist/collection/components/ez-check/ez-check.js +272 -0
- package/dist/collection/components/ez-chip/ez-chip.css +163 -0
- package/dist/collection/components/ez-chip/ez-chip.js +312 -0
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +254 -0
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +442 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +334 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1125 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +432 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +504 -0
- package/dist/collection/components/ez-dialog/DialogType.js +7 -0
- package/dist/collection/components/ez-dialog/ez-dialog.css +544 -0
- package/dist/collection/components/ez-dialog/ez-dialog.js +401 -0
- package/dist/collection/components/ez-dropdown/ez-dropdown.css +349 -0
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +356 -0
- package/dist/collection/components/ez-dropdown/structure/DropdownItem.js +30 -0
- package/dist/collection/components/ez-dropdown/structure/SubmenuControl.js +241 -0
- package/dist/collection/components/ez-file-item/ez-file-item.css +125 -0
- package/dist/collection/components/ez-file-item/ez-file-item.js +200 -0
- package/dist/collection/components/ez-filter-input/ez-filter-input.css +4 -0
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +407 -0
- package/dist/collection/components/ez-form/ez-form.css +10 -0
- package/dist/collection/components/ez-form/ez-form.js +237 -0
- package/dist/collection/components/ez-form/store/form.slice.js +42 -0
- package/dist/collection/components/ez-form-view/ez-form-view.css +6 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +154 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +30 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +11 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +13 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +10 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +11 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +12 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +4 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.js +4 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +4 -0
- package/dist/collection/components/ez-form-view/interfaces/IFormViewField.js +1 -0
- package/dist/collection/components/ez-form-view/interfaces/index.js +1 -0
- package/dist/collection/components/ez-form-view/structure/index.js +29 -0
- package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +791 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +101 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +230 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +88 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/cellRendererStatus.js +43 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/selectionHeader.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +49 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.js +10 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.js +4 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellEditor.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +38 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +20 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +15 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +41 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
- package/dist/collection/components/ez-grid/ez-grid.css +97 -0
- package/dist/collection/components/ez-grid/ez-grid.js +833 -0
- package/dist/collection/components/ez-grid/interfaces/ISelection.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/ISelectionToastConfig.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/index.js +2 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +377 -0
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +29 -0
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.css +66 -0
- package/dist/collection/components/ez-guide-navigator/ez-guide-navigator.js +385 -0
- package/dist/collection/components/ez-guide-navigator/interfaces/IGuideItem.js +1 -0
- package/dist/collection/components/ez-guide-navigator/interfaces/index.js +1 -0
- package/dist/collection/components/ez-icon/ez-icon.css +223 -0
- package/dist/collection/components/ez-icon/ez-icon.js +101 -0
- package/dist/collection/components/ez-list/ez-list.css +434 -0
- package/dist/collection/components/ez-list/ez-list.js +911 -0
- package/dist/collection/components/ez-loading-bar/ez-loading-bar.css +85 -0
- package/dist/collection/components/ez-loading-bar/ez-loading-bar.js +74 -0
- package/dist/collection/components/ez-modal/ez-modal.css +369 -0
- package/dist/collection/components/ez-modal/ez-modal.js +239 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +55 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +191 -0
- package/dist/collection/components/ez-modal-container/index.js +2 -0
- package/dist/collection/components/ez-modal-container/modal-action.js +8 -0
- package/dist/collection/components/ez-modal-container/modal-button-status.js +7 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +338 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +8 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +457 -0
- package/dist/collection/components/ez-popover/ez-popover.css +42 -0
- package/dist/collection/components/ez-popover/ez-popover.js +365 -0
- package/dist/collection/components/ez-popup/ez-popup.css +418 -0
- package/dist/collection/components/ez-popup/ez-popup.js +180 -0
- package/dist/collection/components/ez-radio-button/ez-radio-button.css +217 -0
- package/dist/collection/components/ez-radio-button/ez-radio-button.js +163 -0
- package/dist/collection/components/ez-scroller/EzScrollDirection.js +6 -0
- package/dist/collection/components/ez-scroller/ez-scroller.css +192 -0
- package/dist/collection/components/ez-scroller/ez-scroller.js +293 -0
- package/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/collection/components/ez-search/ez-search.js +462 -0
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +63 -0
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +47 -0
- package/dist/collection/components/ez-skeleton/ez-skeleton.constants.js +1 -0
- package/dist/collection/components/ez-skeleton/ez-skeleton.css +94 -0
- package/dist/collection/components/ez-skeleton/ez-skeleton.js +211 -0
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +149 -0
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +321 -0
- package/dist/collection/components/ez-text-area/ez-text-area.css +242 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +428 -0
- package/dist/collection/components/ez-text-edit/ez-text-edit.css +19 -0
- package/dist/collection/components/ez-text-edit/ez-text-edit.js +202 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +301 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +491 -0
- package/dist/collection/components/ez-time-input/ez-time-input.css +14 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +412 -0
- package/dist/collection/components/ez-toast/ez-toast.css +167 -0
- package/dist/collection/components/ez-toast/ez-toast.js +209 -0
- package/dist/collection/components/ez-tree/ez-tree.css +159 -0
- package/dist/collection/components/ez-tree/ez-tree.js +696 -0
- package/dist/collection/components/ez-tree/interfaces/ITree.js +1 -0
- package/dist/collection/components/ez-tree/interfaces/ITreeItem.js +1 -0
- package/dist/collection/components/ez-tree/subcomponents/DefaultIconResolver.js +8 -0
- package/dist/collection/components/ez-tree/subcomponents/DefaultTooltipResolver.js +3 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +24 -0
- package/dist/collection/components/ez-tree/subcomponents/index.js +2 -0
- package/dist/collection/components/ez-tree/types/Node.js +110 -0
- package/dist/collection/components/ez-tree/types/Tree.js +132 -0
- package/dist/collection/components/ez-upload/RemoteFile.js +94 -0
- package/dist/collection/components/ez-upload/ez-upload.css +582 -0
- package/dist/collection/components/ez-upload/ez-upload.js +587 -0
- package/dist/collection/components/ez-view-stack/ez-view-stack.css +9 -0
- package/dist/collection/components/ez-view-stack/ez-view-stack.js +126 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/servidor.js +101 -0
- package/dist/collection/setupTests.js +1 -0
- package/dist/collection/utils/ApplicationUtils.js +94 -0
- package/dist/collection/utils/AssetsUtils.js +19 -0
- package/dist/collection/utils/CSSVarsUtils.js +73 -0
- package/dist/collection/utils/constants.js +3 -0
- package/dist/collection/utils/form/DataBinder.js +287 -0
- package/dist/collection/utils/form/FormMetadata.js +176 -0
- package/dist/collection/utils/form/index.js +2 -0
- package/dist/collection/utils/form/interfaces/IDefaultConfig.js +1 -0
- package/dist/collection/utils/form/interfaces/IFormCardConfig.js +1 -0
- package/dist/collection/utils/form/interfaces/IFormConfig.js +1 -0
- package/dist/collection/utils/form/interfaces/IFormSheetMetadata.js +1 -0
- package/dist/collection/utils/form/interfaces/ISummaryField.js +1 -0
- package/dist/collection/utils/form/interfaces/ITabConfig.js +1 -0
- package/dist/collection/utils/form/interfaces/index.js +1 -0
- package/dist/collection/utils/index.js +6 -0
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +21 -0
- package/dist/collection/utils/interfaces/IFieldConfig.js +1 -0
- package/dist/collection/utils/mock/ez-upload-mock.js +30 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/collection/utils/validators/recordvalidator/IInvalidField.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/IRecordValidator.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationResult.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/IValidationSource.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +74 -0
- package/dist/custom-elements/index.d.ts +321 -0
- package/dist/custom-elements/index.js +129655 -0
- package/dist/esm/ApplicationUtils-d9a34a16.js +160 -0
- package/dist/esm/CSSVarsUtils-a97cfa29.js +75 -0
- package/dist/esm/CheckMode-bdb2ec19.js +7 -0
- package/dist/esm/DialogType-54a62731.js +9 -0
- package/dist/esm/EzScrollDirection-2df26c93.js +8 -0
- package/dist/esm/RecordValidationProcessor-abc814af.js +99 -0
- package/dist/esm/constants-6dab64f7.js +4 -0
- package/dist/esm/ez-actions-button.entry.js +208 -0
- package/dist/esm/ez-alert.entry.js +26 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-badge.entry.js +116 -0
- package/dist/esm/ez-breadcrumb.entry.js +281 -0
- package/dist/esm/ez-button.entry.js +83 -0
- package/dist/esm/ez-calendar.entry.js +234 -0
- package/dist/esm/ez-card-item.entry.js +48 -0
- package/dist/esm/ez-check.entry.js +91 -0
- package/dist/esm/ez-chip.entry.js +112 -0
- package/dist/esm/ez-collapsible-box.entry.js +129 -0
- package/dist/esm/ez-combo-box.entry.js +686 -0
- package/dist/esm/ez-date-input.entry.js +184 -0
- package/dist/esm/ez-date-time-input.entry.js +238 -0
- package/dist/esm/ez-dialog.entry.js +176 -0
- package/dist/esm/ez-dropdown.entry.js +511 -0
- package/dist/esm/ez-file-item.entry.js +70 -0
- package/dist/esm/ez-filter-input_2.entry.js +132 -0
- package/dist/esm/ez-form-view.entry.js +187 -0
- package/dist/esm/ez-form.entry.js +929 -0
- package/dist/esm/ez-grid.entry.js +120834 -0
- package/dist/esm/ez-guide-navigator.entry.js +92 -0
- package/dist/esm/ez-icon.entry.js +40 -0
- package/dist/esm/ez-list.entry.js +554 -0
- package/dist/esm/ez-loading-bar.entry.js +28 -0
- package/dist/esm/ez-modal-container.entry.js +60 -0
- package/dist/esm/ez-modal.entry.js +68 -0
- package/dist/esm/ez-multi-selection-list.entry.js +179 -0
- package/dist/esm/ez-number-input.entry.js +177 -0
- package/dist/esm/ez-popover.entry.js +152 -0
- package/dist/esm/ez-popup.entry.js +62 -0
- package/dist/esm/ez-radio-button.entry.js +44 -0
- package/dist/esm/ez-scroller_3.entry.js +786 -0
- package/dist/esm/ez-search.entry.js +92 -0
- package/dist/esm/ez-skeleton.entry.js +63 -0
- package/dist/esm/ez-tabselector.entry.js +224 -0
- package/dist/esm/ez-text-area.entry.js +175 -0
- package/dist/esm/ez-text-edit.entry.js +103 -0
- package/dist/esm/ez-text-input.entry.js +243 -0
- package/dist/esm/ez-time-input.entry.js +164 -0
- package/dist/esm/ez-toast.entry.js +97 -0
- package/dist/esm/ez-upload.entry.js +391 -0
- package/dist/esm/ez-view-stack.entry.js +82 -0
- package/dist/esm/ezui.js +18 -0
- package/dist/esm/filter-column.entry.js +147 -0
- package/dist/esm/index-296b8458.js +2309 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/ezui/ezui.esm.js +1 -0
- package/dist/ezui/index.esm.js +0 -0
- package/dist/ezui/p-028f264f.entry.js +1 -0
- package/dist/ezui/p-050247dc.entry.js +1 -0
- package/dist/ezui/p-061f4d73.entry.js +1 -0
- package/dist/ezui/p-1e7c4986.entry.js +1 -0
- package/dist/ezui/p-244dfe8a.entry.js +1 -0
- package/dist/ezui/p-25562cf8.entry.js +1 -0
- package/dist/ezui/p-27a01a26.js +1 -0
- package/dist/ezui/p-2da09f70.entry.js +1 -0
- package/dist/ezui/p-32b4163f.entry.js +1 -0
- package/dist/ezui/p-37673563.entry.js +1 -0
- package/dist/ezui/p-391de0e4.entry.js +1 -0
- package/dist/ezui/p-5ce6548c.entry.js +1 -0
- package/dist/ezui/p-5cef0264.entry.js +1 -0
- package/dist/ezui/p-5d6f2550.entry.js +1 -0
- package/dist/ezui/p-5e55a42b.entry.js +1 -0
- package/dist/ezui/p-60ba28ea.entry.js +1 -0
- package/dist/ezui/p-68352e41.entry.js +1 -0
- package/dist/ezui/p-6ab2f7c2.entry.js +1 -0
- package/dist/ezui/p-7525e604.entry.js +1 -0
- package/dist/ezui/p-7526f2b6.entry.js +1 -0
- package/dist/ezui/p-7eb3e1a5.js +1 -0
- package/dist/ezui/p-83885b21.entry.js +1 -0
- package/dist/ezui/p-86a2036d.js +1 -0
- package/dist/ezui/p-87e85160.entry.js +1 -0
- package/dist/ezui/p-8bd3903b.entry.js +1 -0
- package/dist/ezui/p-8fdff9cd.entry.js +1 -0
- package/dist/ezui/p-9285b53e.entry.js +1 -0
- package/dist/ezui/p-95426f93.entry.js +1 -0
- package/dist/ezui/p-964e5571.entry.js +304 -0
- package/dist/ezui/p-98bb8b16.js +1 -0
- package/dist/ezui/p-9b347f04.entry.js +1 -0
- package/dist/ezui/p-a01068e1.entry.js +1 -0
- package/dist/ezui/p-a510a4c5.entry.js +1 -0
- package/dist/ezui/p-a5e09759.entry.js +1 -0
- package/dist/ezui/p-ab574d59.js +1 -0
- package/dist/ezui/p-b11f035c.entry.js +1 -0
- package/dist/ezui/p-b853763b.js +1 -0
- package/dist/ezui/p-c49dbf23.entry.js +1 -0
- package/dist/ezui/p-ccb4ccd9.entry.js +1 -0
- package/dist/ezui/p-cd19a6f8.entry.js +1 -0
- package/dist/ezui/p-ce035beb.entry.js +1 -0
- package/dist/ezui/p-d43b22f3.entry.js +1 -0
- package/dist/ezui/p-d51aa09b.entry.js +1 -0
- package/dist/ezui/p-db528b31.entry.js +1 -0
- package/dist/ezui/p-e2dfd935.entry.js +1 -0
- package/dist/ezui/p-e318d280.js +2 -0
- package/dist/ezui/p-e67d0bd5.entry.js +1 -0
- package/dist/ezui/p-e7fa0ad6.entry.js +1 -0
- package/dist/ezui/p-f15ec3bb.js +1 -0
- package/dist/ezui/p-f4208819.entry.js +1 -0
- package/dist/ezui/p-fa571a4e.entry.js +1 -0
- package/dist/ezui/p-ff82b176.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +82 -0
- package/dist/types/components/ez-alert/ez-alert.d.ts +10 -0
- package/dist/types/components/ez-application/ez-application.d.ts +10 -0
- package/dist/types/components/ez-badge/enum/sizes.d.ts +8 -0
- package/dist/types/components/ez-badge/ez-badge.d.ts +35 -0
- package/dist/types/components/ez-badge/interfaces/IPosition.d.ts +4 -0
- package/dist/types/components/ez-breadcrumb/ez-breadcrumb.d.ts +71 -0
- package/dist/types/components/ez-breadcrumb/subcomponents/breadcrumb-item.d.ts +13 -0
- package/dist/types/components/ez-button/ez-button.d.ts +41 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +74 -0
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +32 -0
- package/dist/types/components/ez-check/CheckMode.d.ts +4 -0
- package/dist/types/components/ez-check/ez-check.d.ts +49 -0
- package/dist/types/components/ez-chip/ez-chip.d.ts +60 -0
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +91 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +182 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +72 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +80 -0
- package/dist/types/components/ez-dialog/DialogType.d.ts +6 -0
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +82 -0
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +60 -0
- package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +28 -0
- package/dist/types/components/ez-dropdown/structure/SubmenuControl.d.ts +78 -0
- package/dist/types/components/ez-file-item/ez-file-item.d.ts +36 -0
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +77 -0
- package/dist/types/components/ez-form/ez-form.d.ts +47 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +27 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +22 -0
- package/dist/types/components/ez-form-view/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.d.ts +3 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextArea.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +2 -0
- package/dist/types/components/ez-form-view/interfaces/IFormViewField.d.ts +3 -0
- package/dist/types/components/ez-form-view/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-form-view/structure/index.d.ts +14 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +287 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +89 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +20 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +38 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +32 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +12 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/GridEditorUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IEditorMetadata.d.ts +9 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.d.ts +5 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +139 -0
- package/dist/types/components/ez-grid/interfaces/ISelection.d.ts +3 -0
- package/dist/types/components/ez-grid/interfaces/ISelectionToastConfig.d.ts +3 -0
- package/dist/types/components/ez-grid/interfaces/index.d.ts +2 -0
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +57 -0
- package/dist/types/components/ez-grid/subcomponents/selection-counter.d.ts +15 -0
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
- package/dist/types/components/ez-guide-navigator/ez-guide-navigator.d.ts +64 -0
- package/dist/types/components/ez-guide-navigator/interfaces/IGuideItem.d.ts +4 -0
- package/dist/types/components/ez-guide-navigator/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-icon/ez-icon.d.ts +20 -0
- package/dist/types/components/ez-list/ez-list.d.ts +133 -0
- package/dist/types/components/ez-loading-bar/ez-loading-bar.d.ts +12 -0
- package/dist/types/components/ez-modal/ez-modal.d.ts +53 -0
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +47 -0
- package/dist/types/components/ez-modal-container/index.d.ts +2 -0
- package/dist/types/components/ez-modal-container/modal-action.d.ts +7 -0
- package/dist/types/components/ez-modal-container/modal-button-status.d.ts +6 -0
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +68 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +81 -0
- package/dist/types/components/ez-popover/ez-popover.d.ts +60 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +37 -0
- package/dist/types/components/ez-radio-button/ez-radio-button.d.ts +37 -0
- package/dist/types/components/ez-scroller/EzScrollDirection.d.ts +5 -0
- package/dist/types/components/ez-scroller/ez-scroller.d.ts +38 -0
- package/dist/types/components/ez-search/ez-search.d.ts +84 -0
- package/dist/types/components/ez-sidebar-button/ez-sidebar-button.d.ts +11 -0
- package/dist/types/components/ez-skeleton/ez-skeleton.constants.d.ts +1 -0
- package/dist/types/components/ez-skeleton/ez-skeleton.d.ts +54 -0
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +52 -0
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +78 -0
- package/dist/types/components/ez-text-edit/ez-text-edit.d.ts +41 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +82 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +74 -0
- package/dist/types/components/ez-toast/ez-toast.d.ts +45 -0
- package/dist/types/components/ez-tree/ez-tree.d.ts +101 -0
- package/dist/types/components/ez-tree/interfaces/ITree.d.ts +5 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +11 -0
- package/dist/types/components/ez-tree/subcomponents/DefaultIconResolver.d.ts +2 -0
- package/dist/types/components/ez-tree/subcomponents/DefaultTooltipResolver.d.ts +2 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +15 -0
- package/dist/types/components/ez-tree/subcomponents/index.d.ts +2 -0
- package/dist/types/components/ez-tree/types/Node.d.ts +22 -0
- package/dist/types/components/ez-tree/types/Tree.d.ts +21 -0
- package/dist/types/components/ez-upload/RemoteFile.d.ts +14 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +101 -0
- package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +25 -0
- package/dist/types/components.d.ts +3464 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1637 -0
- package/dist/types/utils/ApplicationUtils.d.ts +31 -0
- package/dist/types/utils/AssetsUtils.d.ts +1 -0
- package/dist/types/utils/CSSVarsUtils.d.ts +6 -0
- package/dist/types/utils/constants.d.ts +3 -0
- package/dist/types/utils/form/DataBinder.d.ts +30 -0
- package/dist/types/utils/form/FormMetadata.d.ts +23 -0
- package/dist/types/utils/form/index.d.ts +2 -0
- package/dist/types/utils/form/interfaces/IDefaultConfig.d.ts +5 -0
- package/dist/types/utils/form/interfaces/IFormCardConfig.d.ts +5 -0
- package/dist/types/utils/form/interfaces/IFormConfig.d.ts +13 -0
- package/dist/types/utils/form/interfaces/IFormSheetMetadata.d.ts +6 -0
- package/dist/types/utils/form/interfaces/ISummaryField.d.ts +4 -0
- package/dist/types/utils/form/interfaces/ITabConfig.d.ts +6 -0
- package/dist/types/utils/form/interfaces/index.d.ts +10 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +17 -0
- package/dist/types/utils/interfaces/IFieldConfig.d.ts +13 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/dist/types/utils/validators/recordvalidator/IInvalidField.d.ts +4 -0
- package/dist/types/utils/validators/recordvalidator/IRecordValidator.d.ts +5 -0
- package/dist/types/utils/validators/recordvalidator/IValidationResult.d.ts +8 -0
- package/dist/types/utils/validators/recordvalidator/IValidationSource.d.ts +6 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +13 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +93 -0
- package/react/.keepfolder +0 -0
- package/react/components.d.ts +48 -0
- package/react/components.js +52 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +59 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
- package/react/react-component-lib/createOverlayComponent.js +89 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +96 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +7 -0
- package/react/react-component-lib/utils/index.js +21 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { ApplicationContext, Action, WaitingChangeException, DataUnitAction } from "@sankhyalabs/core";
|
|
2
|
+
import { RecordValidationProcessor } from "../validators/recordvalidator/RecordValidationProcessor";
|
|
3
|
+
export default class DataBinder {
|
|
4
|
+
constructor(dataUnit) {
|
|
5
|
+
this.onDataUnitEvent = (action) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case Action.DATA_LOADED:
|
|
9
|
+
case Action.DATA_SAVED:
|
|
10
|
+
case Action.RECORDS_REMOVED:
|
|
11
|
+
case Action.RECORDS_ADDED:
|
|
12
|
+
case Action.RECORDS_COPIED:
|
|
13
|
+
case Action.EDITION_CANCELED:
|
|
14
|
+
case Action.SELECTION_CHANGED:
|
|
15
|
+
case Action.NEXT_SELECTED:
|
|
16
|
+
case Action.PREVIOUS_SELECTED:
|
|
17
|
+
this.clearInvalid();
|
|
18
|
+
case Action.DATA_CHANGED:
|
|
19
|
+
case Action.CHANGE_UNDONE:
|
|
20
|
+
case Action.CHANGE_REDONE:
|
|
21
|
+
case Action.RECORD_LOADED:
|
|
22
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
23
|
+
this.updateValue(field.fieldName, field.field);
|
|
24
|
+
});
|
|
25
|
+
break;
|
|
26
|
+
case Action.FIELD_INVALIDATED:
|
|
27
|
+
(_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
28
|
+
this.updateErrorMessage(field.fieldName, field.field);
|
|
29
|
+
});
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this._fields = new Map();
|
|
34
|
+
this._dataUnit = dataUnit;
|
|
35
|
+
this.applyDefaultValues();
|
|
36
|
+
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
37
|
+
this._dataUnit.addInterceptor(this);
|
|
38
|
+
}
|
|
39
|
+
applyDefaultValues() {
|
|
40
|
+
const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
|
|
41
|
+
if (recordIds.length > 0) {
|
|
42
|
+
const defaultValues = this.getDefaultValues();
|
|
43
|
+
if (defaultValues) {
|
|
44
|
+
Object.keys(defaultValues).forEach(field => {
|
|
45
|
+
this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
51
|
+
fields.forEach(fieldElement => {
|
|
52
|
+
const { fieldName, contextName } = fieldElement.dataset;
|
|
53
|
+
if (contextName == undefined || contextName === currentContextName) {
|
|
54
|
+
this.updateBind(fieldName, fieldElement);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
this._formMetadata = formMetadata;
|
|
58
|
+
this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
59
|
+
getRequiredFields: () => this._formMetadata.getRequiredFields(),
|
|
60
|
+
markAsInvalid: field => this.markInvalid(field),
|
|
61
|
+
getMessageForField: field => this.getErrorMessage(field)
|
|
62
|
+
}, recordsValidator);
|
|
63
|
+
}
|
|
64
|
+
onDisconnectedCallback() {
|
|
65
|
+
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
66
|
+
this._dataUnit.removeInterceptor(this);
|
|
67
|
+
}
|
|
68
|
+
getCurrentRecordId() {
|
|
69
|
+
const record = this._dataUnit.getSelectedRecord();
|
|
70
|
+
return record === null || record === void 0 ? void 0 : record.__record__id__;
|
|
71
|
+
}
|
|
72
|
+
markInvalid(field) {
|
|
73
|
+
if (this._fields.has(field.name)) {
|
|
74
|
+
const fieldElement = this._fields.get(field.name).field;
|
|
75
|
+
this.updateErrorMessage(field.name, fieldElement, field.message);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
clearInvalid(recordId) {
|
|
79
|
+
this._dataUnit.clearInvalid(recordId);
|
|
80
|
+
this._fields.forEach(fieldBinder => {
|
|
81
|
+
const fieldElement = fieldBinder.field;
|
|
82
|
+
fieldElement["errorMessage"] = "";
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
updateValue(fieldName, field) {
|
|
86
|
+
const bind = this._fields.get(fieldName);
|
|
87
|
+
try {
|
|
88
|
+
if (bind) {
|
|
89
|
+
bind.listen = false;
|
|
90
|
+
}
|
|
91
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
92
|
+
this.updateErrorMessage(fieldName, field);
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
if (bind) {
|
|
96
|
+
bind.listen = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
validate() {
|
|
101
|
+
return this._recordValidatorProcessor.validate();
|
|
102
|
+
}
|
|
103
|
+
updateErrorMessage(fieldName, field, message) {
|
|
104
|
+
if (message == undefined) {
|
|
105
|
+
message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
|
|
106
|
+
}
|
|
107
|
+
if (!field["errorMessage"]) {
|
|
108
|
+
field["errorMessage"] = message;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
getErrorMessage(fieldName) {
|
|
112
|
+
if (this._fields.has(fieldName)) {
|
|
113
|
+
const fieldElement = this._fields.get(fieldName).field;
|
|
114
|
+
return fieldElement["errorMessage"];
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
updateBind(fieldName, field) {
|
|
119
|
+
const oldBind = this._fields.get(fieldName);
|
|
120
|
+
if (oldBind) {
|
|
121
|
+
oldBind.destroy();
|
|
122
|
+
}
|
|
123
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
124
|
+
this.updateErrorMessage(fieldName, field);
|
|
125
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
126
|
+
this.bindSearchOptionsLoader(fieldName, field);
|
|
127
|
+
this.applyEzUploadContext(fieldName, field);
|
|
128
|
+
}
|
|
129
|
+
changeStarted(fieldName, waitingChange) {
|
|
130
|
+
/**
|
|
131
|
+
* se o waitingChange não é blocante, add um event listener pra
|
|
132
|
+
* fazer o accept da promise
|
|
133
|
+
*
|
|
134
|
+
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
if (this._dataUnit.records.length === 0) {
|
|
139
|
+
this._dataUnit.addRecord();
|
|
140
|
+
}
|
|
141
|
+
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
142
|
+
const bind = this._fields.get(fieldName);
|
|
143
|
+
if (bind) {
|
|
144
|
+
waitingChange.promise = new Promise((resolve, reject) => {
|
|
145
|
+
bind.waitingChangePromiseResolve = resolve;
|
|
146
|
+
bind.waitingChangePromiseReject = reject;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
this._dataUnit.startChange(fieldName, waitingChange);
|
|
151
|
+
}
|
|
152
|
+
cancelWaitingChange(fieldName) {
|
|
153
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
154
|
+
this._dataUnit.cancelWaitingChange(fieldName);
|
|
155
|
+
const bind = this._fields.get(fieldName);
|
|
156
|
+
if (bind) {
|
|
157
|
+
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
setFieldValue(fieldName, newValue) {
|
|
162
|
+
if (this._dataUnit.records.length === 0) {
|
|
163
|
+
this._dataUnit.addRecord();
|
|
164
|
+
}
|
|
165
|
+
this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
|
|
166
|
+
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
167
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
168
|
+
const bind = this._fields.get(fieldName);
|
|
169
|
+
if (bind) {
|
|
170
|
+
bind.acceptWaitingChange();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
bindSearchOptionsLoader(fieldName, field) {
|
|
175
|
+
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
176
|
+
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
177
|
+
if (loader) {
|
|
178
|
+
field["optionLoader"] = (arg) => {
|
|
179
|
+
return loader(arg, fieldName, this._dataUnit);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
applyEzUploadContext(fieldName, field) {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
if (field.nodeName === "EZ-UPLOAD") {
|
|
187
|
+
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
188
|
+
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
189
|
+
const descriptor = this._dataUnit.getField(fieldName);
|
|
190
|
+
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
191
|
+
if (destination) {
|
|
192
|
+
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
193
|
+
}
|
|
194
|
+
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
interceptAction(action) {
|
|
198
|
+
if (action.type === Action.RECORDS_COPIED) {
|
|
199
|
+
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
200
|
+
if (cleanFields) {
|
|
201
|
+
const records = action.payload;
|
|
202
|
+
return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
203
|
+
const newRecord = Object.assign({}, record);
|
|
204
|
+
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
205
|
+
return newRecord;
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (action.type === Action.SAVING_DATA) {
|
|
210
|
+
return new Promise((resolve) => {
|
|
211
|
+
this.validate()
|
|
212
|
+
.then(() => resolve(action))
|
|
213
|
+
.catch(() => { });
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (action.type === Action.RECORDS_ADDED) {
|
|
217
|
+
const defaultValues = this.getDefaultValues();
|
|
218
|
+
if (defaultValues) {
|
|
219
|
+
const records = action.payload;
|
|
220
|
+
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
221
|
+
return Object.assign(Object.assign({}, record), defaultValues);
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return action;
|
|
226
|
+
}
|
|
227
|
+
getDefaultValues() {
|
|
228
|
+
var _a;
|
|
229
|
+
const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
230
|
+
if (rawDefaultValues) {
|
|
231
|
+
const defaultValues = {};
|
|
232
|
+
for (const field in rawDefaultValues) {
|
|
233
|
+
defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
|
|
234
|
+
}
|
|
235
|
+
return defaultValues;
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
class Bind {
|
|
241
|
+
constructor() {
|
|
242
|
+
this.listen = true;
|
|
243
|
+
this.startChangeEventName = "ezStartChange";
|
|
244
|
+
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
245
|
+
this.changeEventName = "ezChange";
|
|
246
|
+
}
|
|
247
|
+
destroy() {
|
|
248
|
+
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
249
|
+
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
250
|
+
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
251
|
+
}
|
|
252
|
+
acceptWaitingChange() {
|
|
253
|
+
if (this.waitingChangePromiseResolve) {
|
|
254
|
+
this.waitingChangePromiseResolve();
|
|
255
|
+
this.waitingChangePromiseReject = undefined;
|
|
256
|
+
this.waitingChangePromiseResolve = undefined;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
rejectWaitingChange(reason) {
|
|
260
|
+
if (this.waitingChangePromiseReject) {
|
|
261
|
+
this.waitingChangePromiseReject(reason);
|
|
262
|
+
this.waitingChangePromiseReject = undefined;
|
|
263
|
+
this.waitingChangePromiseResolve = undefined;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
267
|
+
const b = new Bind();
|
|
268
|
+
b.field = field;
|
|
269
|
+
b.fieldName = fieldName;
|
|
270
|
+
b.startChangeListener = (evt) => {
|
|
271
|
+
if (b.listen)
|
|
272
|
+
startChangeCallback(fieldName, evt.detail);
|
|
273
|
+
};
|
|
274
|
+
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
275
|
+
b.cancelWaitingChangeListener = () => {
|
|
276
|
+
if (b.listen)
|
|
277
|
+
cancelWaitingChangeCallback(fieldName);
|
|
278
|
+
};
|
|
279
|
+
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
280
|
+
b.changeListener = (evt) => {
|
|
281
|
+
if (b.listen)
|
|
282
|
+
changeCallback(fieldName, evt.detail);
|
|
283
|
+
};
|
|
284
|
+
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
285
|
+
return b;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { DateUtils } from "@sankhyalabs/core";
|
|
2
|
+
import { buildFieldMetadata } from "../interfaces/AbstractFieldMetadata";
|
|
3
|
+
const DETAIL_PATTERN = /child\[([^\]]+)\]/;
|
|
4
|
+
const REGEX_DEFAULT_VAR_KEY = /\$\{.+\}/;
|
|
5
|
+
export class FormMetadata {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._sheets = new Map();
|
|
8
|
+
this._requiredFields = [];
|
|
9
|
+
this._cleanOnCopyFields = [];
|
|
10
|
+
this._defaultValues = {};
|
|
11
|
+
}
|
|
12
|
+
static getDetailName(name) {
|
|
13
|
+
const result = DETAIL_PATTERN.exec(name);
|
|
14
|
+
return result ? result[1] : undefined;
|
|
15
|
+
}
|
|
16
|
+
getSheet(name) {
|
|
17
|
+
return this._sheets.get(name);
|
|
18
|
+
}
|
|
19
|
+
getAllSheets() {
|
|
20
|
+
return this._sheets;
|
|
21
|
+
}
|
|
22
|
+
addSheet(sheet) {
|
|
23
|
+
this._sheets.set(sheet.name, sheet);
|
|
24
|
+
}
|
|
25
|
+
addRequiredFields(fields) {
|
|
26
|
+
this._requiredFields = this._requiredFields.concat(fields);
|
|
27
|
+
}
|
|
28
|
+
getRequiredFields() {
|
|
29
|
+
return this._requiredFields;
|
|
30
|
+
}
|
|
31
|
+
addCleanOnCopyFields(fields) {
|
|
32
|
+
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(fields);
|
|
33
|
+
}
|
|
34
|
+
getCleanOnCopyFields() {
|
|
35
|
+
return this._cleanOnCopyFields;
|
|
36
|
+
}
|
|
37
|
+
addDefaultValues(defaultValues) {
|
|
38
|
+
return this._defaultValues = Object.assign(Object.assign({}, this._defaultValues), defaultValues);
|
|
39
|
+
}
|
|
40
|
+
getDefaultValues() {
|
|
41
|
+
const result = {};
|
|
42
|
+
Object.entries(this._defaultValues).forEach(([key, value]) => {
|
|
43
|
+
if (typeof value === "string") {
|
|
44
|
+
const result = REGEX_DEFAULT_VAR_KEY.exec(value);
|
|
45
|
+
if (result) {
|
|
46
|
+
value = this.getDefaultVar(result[0]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
result[key] = value;
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
getDefaultVar(name) {
|
|
54
|
+
if (name === "${data}") {
|
|
55
|
+
return DateUtils.getToday();
|
|
56
|
+
}
|
|
57
|
+
if (name === "${datahora}") {
|
|
58
|
+
return DateUtils.getToday(true);
|
|
59
|
+
}
|
|
60
|
+
return this._defaultVars ? this._defaultVars.get(name) : undefined;
|
|
61
|
+
}
|
|
62
|
+
setDefaultVars(vars) {
|
|
63
|
+
this._defaultVars = vars;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const buildFormConfigFromDataUnit = (dataUnit) => {
|
|
67
|
+
const unitMD = dataUnit.metadata;
|
|
68
|
+
let fields;
|
|
69
|
+
if (unitMD) {
|
|
70
|
+
fields = unitMD.fields
|
|
71
|
+
.filter(descriptor => descriptor.visible !== false)
|
|
72
|
+
.map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
|
|
73
|
+
}
|
|
74
|
+
const config = { emptyConfig: false, fields };
|
|
75
|
+
return config;
|
|
76
|
+
};
|
|
77
|
+
export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
|
|
80
|
+
config = buildFormConfigFromDataUnit(dataUnit);
|
|
81
|
+
}
|
|
82
|
+
const sheets = new Map();
|
|
83
|
+
const hiddenTabs = new Map();
|
|
84
|
+
const requiredFields = [];
|
|
85
|
+
const cleanOnCopyFields = [];
|
|
86
|
+
const defaultValues = {};
|
|
87
|
+
(_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
|
|
88
|
+
if (!hiddenTabs.has(tab.label) && tab.visible === false) {
|
|
89
|
+
hiddenTabs.set(tab.label, tab);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
(_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
|
|
93
|
+
var _a, _b, _c;
|
|
94
|
+
if (field.visible !== false) {
|
|
95
|
+
const tabConfig = getTabConfig(field.tab || "__main", sheets);
|
|
96
|
+
if (hiddenTabs.has(tabConfig.label)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const descriptor = dataUnit.getField(field.name);
|
|
100
|
+
if (descriptor && tabConfig.visible) {
|
|
101
|
+
if (!sheets.has(tabConfig)) {
|
|
102
|
+
sheets.set(tabConfig, []);
|
|
103
|
+
}
|
|
104
|
+
const formField = buildFieldMetadata(descriptor, field);
|
|
105
|
+
sheets.get(tabConfig).push(formField);
|
|
106
|
+
if (formField.required) {
|
|
107
|
+
requiredFields.push(field.name);
|
|
108
|
+
}
|
|
109
|
+
const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
|
|
110
|
+
if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.cleanOnCopy)) {
|
|
111
|
+
cleanOnCopyFields.push(field.name);
|
|
112
|
+
}
|
|
113
|
+
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
114
|
+
if (defaultValue && defaultValue.value != undefined) {
|
|
115
|
+
const { type, value } = defaultValue;
|
|
116
|
+
if (type) {
|
|
117
|
+
if (type === "V") {
|
|
118
|
+
defaultValue = value;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
try {
|
|
122
|
+
const parsed = JSON.parse(value);
|
|
123
|
+
if (parsed && "value" in parsed) {
|
|
124
|
+
defaultValue = parsed;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
defaultValue = value;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (_d) { }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
defaultValues[field.name] = defaultValue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
const metadata = new FormMetadata();
|
|
139
|
+
metadata.setDefaultVars(config.defaultVars);
|
|
140
|
+
if (includeDetails) {
|
|
141
|
+
const unitMD = dataUnit.metadata;
|
|
142
|
+
if (unitMD != undefined && unitMD.children != undefined) {
|
|
143
|
+
unitMD.children.forEach(child => {
|
|
144
|
+
const { label, name, fields } = buildDetailSheet(child);
|
|
145
|
+
sheets.set({ name, label }, fields);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
Array.from(sheets.entries())
|
|
150
|
+
.sort(sortTabs)
|
|
151
|
+
.forEach(([key, fields]) => {
|
|
152
|
+
metadata.addSheet({
|
|
153
|
+
label: (key.label === "__main") ? "Principal" : key.label,
|
|
154
|
+
name: key.name || key.label,
|
|
155
|
+
fields
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
metadata.addRequiredFields(requiredFields);
|
|
159
|
+
metadata.addCleanOnCopyFields(cleanOnCopyFields);
|
|
160
|
+
metadata.addDefaultValues(defaultValues);
|
|
161
|
+
return metadata;
|
|
162
|
+
};
|
|
163
|
+
const getTabConfig = (tab, sheets) => {
|
|
164
|
+
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
165
|
+
return tabConfig || { label: tab, visible: true };
|
|
166
|
+
};
|
|
167
|
+
const sortTabs = (a, b) => {
|
|
168
|
+
return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
169
|
+
};
|
|
170
|
+
const buildDetailSheet = (child) => {
|
|
171
|
+
return {
|
|
172
|
+
name: `child[${child.name}]`,
|
|
173
|
+
label: child.label,
|
|
174
|
+
fields: []
|
|
175
|
+
};
|
|
176
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as ApplicationUtils } from './ApplicationUtils';
|
|
2
|
+
export { default as CSSVarsUtils } from './CSSVarsUtils';
|
|
3
|
+
export { DialogType } from '../components/ez-dialog/DialogType';
|
|
4
|
+
export { CheckMode } from '../components/ez-check/CheckMode';
|
|
5
|
+
export { FormMetadata } from './form/FormMetadata';
|
|
6
|
+
export { default as DataBinder } from './form/DataBinder';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
export const buildFieldMetadata = (descriptor, config) => {
|
|
3
|
+
let { name, label, group } = Object.assign({}, config);
|
|
4
|
+
let { readOnly, required } = Object.assign({}, config);
|
|
5
|
+
let props;
|
|
6
|
+
let userInterface;
|
|
7
|
+
if (descriptor) {
|
|
8
|
+
label = label || descriptor.label;
|
|
9
|
+
name = name || descriptor.name;
|
|
10
|
+
required = descriptor.required || (config === null || config === void 0 ? void 0 : config.required);
|
|
11
|
+
readOnly = descriptor.readOnly || (config === null || config === void 0 ? void 0 : config.readOnly);
|
|
12
|
+
props = descriptor.properties;
|
|
13
|
+
userInterface = descriptor.userInterface;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
name, label, group,
|
|
17
|
+
readOnly, required,
|
|
18
|
+
props,
|
|
19
|
+
userInterface: userInterface || UserInterface.SHORTTEXT
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
global.XMLHttpRequest = class XMLHttpRequest {
|
|
2
|
+
|
|
3
|
+
readyState = 4;
|
|
4
|
+
status = 200;
|
|
5
|
+
statusText = 'OK';
|
|
6
|
+
response = { "A": "B" };
|
|
7
|
+
responseText = JSON.stringify(this.response);
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
open(method, url, async) {
|
|
14
|
+
if (url != "post") {
|
|
15
|
+
this.onreadystatechange();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
abort(){
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
send(data) {
|
|
24
|
+
this.responseText = data;
|
|
25
|
+
this.response = JSON.parse(data);
|
|
26
|
+
this.onreadystatechange();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import ApplicationUtils from "../../ApplicationUtils";
|
|
2
|
+
export class RecordValidationProcessor {
|
|
3
|
+
constructor(dataUnit, validationSource, validator) {
|
|
4
|
+
this._dataUnit = dataUnit;
|
|
5
|
+
this._validationSource = validationSource;
|
|
6
|
+
this._validator = validator;
|
|
7
|
+
}
|
|
8
|
+
validate() {
|
|
9
|
+
return new Promise((accept, reject) => {
|
|
10
|
+
const records = this._dataUnit.getModifiedRecords();
|
|
11
|
+
for (let i = 0; i < records.length; i++) {
|
|
12
|
+
const record = records[i];
|
|
13
|
+
const invalidResults = [];
|
|
14
|
+
let validationResult = this.validateRequired(record);
|
|
15
|
+
if (validationResult && !validationResult.isValid) {
|
|
16
|
+
invalidResults.push(validationResult);
|
|
17
|
+
}
|
|
18
|
+
if (this._validator) {
|
|
19
|
+
validationResult = this._validator.validateRecord(record);
|
|
20
|
+
if (validationResult && !validationResult.isValid) {
|
|
21
|
+
invalidResults.push(validationResult);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (invalidResults.length > 0) {
|
|
25
|
+
this.processValidationResult(invalidResults, record.__record__id__);
|
|
26
|
+
reject();
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return accept();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
validateRequired(record) {
|
|
34
|
+
const requiredFields = this._validationSource.getRequiredFields();
|
|
35
|
+
const invalidFields = [];
|
|
36
|
+
new Set(requiredFields).forEach(field => {
|
|
37
|
+
const value = record[field];
|
|
38
|
+
if (value == undefined || value === "") {
|
|
39
|
+
const errorMessage = this._validationSource.getMessageForField(field, record.__record__id__);
|
|
40
|
+
if (errorMessage) {
|
|
41
|
+
invalidFields.push({ name: field, message: errorMessage });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
invalidFields.push({ name: field, message: "Essa informação é obrigatória" });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
if (invalidFields.length > 0) {
|
|
49
|
+
return { isValid: false, invalidFields, infoMessage: "Há pelo menos um campo obrigatório não preenchido." };
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
processValidationResult(validationResult, recordId) {
|
|
54
|
+
validationResult.forEach(invalidResult => {
|
|
55
|
+
const invalidFields = invalidResult.invalidFields;
|
|
56
|
+
if (invalidFields) {
|
|
57
|
+
invalidFields.forEach(field => {
|
|
58
|
+
this.markAsInvalid(field, recordId);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (invalidResult.infoMessage) {
|
|
62
|
+
ApplicationUtils.info(invalidResult.infoMessage);
|
|
63
|
+
}
|
|
64
|
+
if (invalidResult.errorMessage) {
|
|
65
|
+
const { errorTitle, errorMessage } = invalidResult;
|
|
66
|
+
ApplicationUtils.error(errorTitle, errorMessage);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
markAsInvalid(field, recordId) {
|
|
71
|
+
this._dataUnit.setInvalidField(field.name, field.message, recordId);
|
|
72
|
+
this._validationSource.markAsInvalid(field, recordId);
|
|
73
|
+
}
|
|
74
|
+
}
|