@apia/execution 4.0.102 → 5.0.1
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/dist/index.d.ts +92 -3784
- package/dist/index.js +83 -8740
- package/dist/index.js.map +1 -1
- package/dist/main/Execution/Entity/index.d.ts +30 -0
- package/dist/main/Execution/Entity/index.d.ts.map +1 -0
- package/dist/main/Execution/Entity/index.js +268 -0
- package/dist/main/Execution/Entity/index.js.map +1 -0
- package/dist/main/Execution/Entity/type.d.ts +98 -0
- package/dist/main/Execution/Entity/type.d.ts.map +1 -0
- package/dist/main/Execution/EntityFlowModals/confirmFlow.js +200 -0
- package/dist/main/Execution/EntityFlowModals/confirmFlow.js.map +1 -0
- package/dist/main/Execution/FlowModals/FlowModal.d.ts +18 -0
- package/dist/main/Execution/FlowModals/FlowModal.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/FlowModal.js +5 -0
- package/dist/main/Execution/FlowModals/FlowModal.js.map +1 -0
- package/dist/main/Execution/FlowModals/ShowConfirmMessage.d.ts +16 -0
- package/dist/main/Execution/FlowModals/ShowConfirmMessage.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/ShowConfirmMessage.js +12 -0
- package/dist/main/Execution/FlowModals/ShowConfirmMessage.js.map +1 -0
- package/dist/main/Execution/FlowModals/ShowPathSelection.d.ts +29 -0
- package/dist/main/Execution/FlowModals/ShowPathSelection.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/ShowPathSelection.js +50 -0
- package/dist/main/Execution/FlowModals/ShowPathSelection.js.map +1 -0
- package/dist/main/Execution/FlowModals/ShowPoolSelection.d.ts +20 -0
- package/dist/main/Execution/FlowModals/ShowPoolSelection.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/ShowPoolSelection.js +12 -0
- package/dist/main/Execution/FlowModals/ShowPoolSelection.js.map +1 -0
- package/dist/main/Execution/FlowModals/ShowSign.d.ts +16 -0
- package/dist/main/Execution/FlowModals/ShowSign.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/ShowSign.js +12 -0
- package/dist/main/Execution/FlowModals/ShowSign.js.map +1 -0
- package/dist/main/Execution/FlowModals/ShowSignSelection.d.ts +19 -0
- package/dist/main/Execution/FlowModals/ShowSignSelection.d.ts.map +1 -0
- package/dist/main/Execution/FlowModals/ShowSignSelection.js +12 -0
- package/dist/main/Execution/FlowModals/ShowSignSelection.js.map +1 -0
- package/dist/main/Execution/FlowModals/confirmFlow.js +420 -0
- package/dist/main/Execution/FlowModals/confirmFlow.js.map +1 -0
- package/dist/main/Execution/FlowModals/types.d.ts +44 -0
- package/dist/main/Execution/FlowModals/types.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/Field.d.ts +43 -0
- package/dist/main/Execution/FormsExecution/Field.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/Field.js +289 -0
- package/dist/main/Execution/FormsExecution/Field.js.map +1 -0
- package/dist/main/Execution/FormsExecution/FieldWithAttribute.d.ts +43 -0
- package/dist/main/Execution/FormsExecution/FieldWithAttribute.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/FieldWithAttribute.js +244 -0
- package/dist/main/Execution/FormsExecution/FieldWithAttribute.js.map +1 -0
- package/dist/main/Execution/FormsExecution/Form.d.ts +83 -0
- package/dist/main/Execution/FormsExecution/Form.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/Form.js +378 -0
- package/dist/main/Execution/FormsExecution/Form.js.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/Translation.d.ts +19 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/Translation.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/Translation.js +72 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/Translation.js.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/index.d.ts +38 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/index.js +141 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/types.d.ts +11 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/types.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/util.js +9 -0
- package/dist/main/Execution/FormsExecution/TranslatableField/util.js.map +1 -0
- package/dist/main/Execution/FormsExecution/WithProperties.d.ts +17 -0
- package/dist/main/Execution/FormsExecution/WithProperties.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/WithProperties.js +38 -0
- package/dist/main/Execution/FormsExecution/WithProperties.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/IProperty.js +10 -0
- package/dist/main/Execution/FormsExecution/constants/IProperty.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/actions.js +5 -0
- package/dist/main/Execution/FormsExecution/constants/actions.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/eventTypes.js +5 -0
- package/dist/main/Execution/FormsExecution/constants/eventTypes.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/fieldProps.js +124 -0
- package/dist/main/Execution/FormsExecution/constants/fieldProps.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/formProps.js +18 -0
- package/dist/main/Execution/FormsExecution/constants/formProps.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/props/booleanProps.js +67 -0
- package/dist/main/Execution/FormsExecution/constants/props/booleanProps.js.map +1 -0
- package/dist/main/Execution/FormsExecution/constants/props/numberProps.js +14 -0
- package/dist/main/Execution/FormsExecution/constants/props/numberProps.js.map +1 -0
- package/dist/main/Execution/FormsExecution/customComponents/CustomComponent.d.ts +62 -0
- package/dist/main/Execution/FormsExecution/customComponents/CustomComponent.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/customComponents/CustomComponent.js +378 -0
- package/dist/main/Execution/FormsExecution/customComponents/CustomComponent.js.map +1 -0
- package/dist/main/Execution/FormsExecution/events/setAjaxFormResponse.js +150 -0
- package/dist/main/Execution/FormsExecution/events/setAjaxFormResponse.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Button/index.d.ts +10 -0
- package/dist/main/Execution/FormsExecution/fields/Button/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Button/index.js +10 -0
- package/dist/main/Execution/FormsExecution/fields/Button/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Captcha/index.d.ts +28 -0
- package/dist/main/Execution/FormsExecution/fields/Captcha/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Captcha/index.js +71 -0
- package/dist/main/Execution/FormsExecution/fields/Captcha/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Checkbox/index.d.ts +12 -0
- package/dist/main/Execution/FormsExecution/fields/Checkbox/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Checkbox/index.js +19 -0
- package/dist/main/Execution/FormsExecution/fields/Checkbox/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Editor/index.d.ts +14 -0
- package/dist/main/Execution/FormsExecution/fields/Editor/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Editor/index.js +18 -0
- package/dist/main/Execution/FormsExecution/fields/Editor/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/File/index.d.ts +22 -0
- package/dist/main/Execution/FormsExecution/fields/File/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/File/index.js +116 -0
- package/dist/main/Execution/FormsExecution/fields/File/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/AdditionalCell.d.ts +15 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/AdditionalCell.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/AdditionalCell.js +17 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/AdditionalCell.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/FieldsCache.d.ts +24 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/FieldsCache.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/FieldsCache.js +43 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/FieldsCache.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridCell.d.ts +9 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridCell.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridCell.js +10 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridCell.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridEditionModal.d.ts +7 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridEditionModal.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridFooterHandler.d.ts +27 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridFooterHandler.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridFooterHandler.js +100 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/GridFooterHandler.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/HeaderCell.d.ts +14 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/HeaderCell.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/HeaderCell.js +17 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/HeaderCell.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/index.d.ts +122 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/index.js +961 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/types.d.ts +47 -0
- package/dist/main/Execution/FormsExecution/fields/Grid/types.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/GridPaginated/index.d.ts +21 -0
- package/dist/main/Execution/FormsExecution/fields/GridPaginated/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/GridPaginated/index.js +204 -0
- package/dist/main/Execution/FormsExecution/fields/GridPaginated/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Hidden/index.d.ts +8 -0
- package/dist/main/Execution/FormsExecution/fields/Hidden/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Hidden/index.js +7 -0
- package/dist/main/Execution/FormsExecution/fields/Hidden/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Image/index.d.ts +8 -0
- package/dist/main/Execution/FormsExecution/fields/Image/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Image/index.js +7 -0
- package/dist/main/Execution/FormsExecution/fields/Image/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Input/index.d.ts +18 -0
- package/dist/main/Execution/FormsExecution/fields/Input/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Input/index.js +146 -0
- package/dist/main/Execution/FormsExecution/fields/Input/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Label/index.d.ts +9 -0
- package/dist/main/Execution/FormsExecution/fields/Label/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Label/index.js +7 -0
- package/dist/main/Execution/FormsExecution/fields/Label/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Link/index.d.ts +8 -0
- package/dist/main/Execution/FormsExecution/fields/Link/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Link/index.js +7 -0
- package/dist/main/Execution/FormsExecution/fields/Link/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/ModalInput/index.d.ts +25 -0
- package/dist/main/Execution/FormsExecution/fields/ModalInput/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/ModalInput/index.js +145 -0
- package/dist/main/Execution/FormsExecution/fields/ModalInput/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Multiple/index.d.ts +19 -0
- package/dist/main/Execution/FormsExecution/fields/Multiple/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Multiple/index.js +42 -0
- package/dist/main/Execution/FormsExecution/fields/Multiple/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Password/index.d.ts +9 -0
- package/dist/main/Execution/FormsExecution/fields/Password/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Password/index.js +10 -0
- package/dist/main/Execution/FormsExecution/fields/Password/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Radio/index.d.ts +15 -0
- package/dist/main/Execution/FormsExecution/fields/Radio/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Radio/index.js +26 -0
- package/dist/main/Execution/FormsExecution/fields/Radio/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Scheduler/index.d.ts +36 -0
- package/dist/main/Execution/FormsExecution/fields/Scheduler/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Scheduler/index.js +156 -0
- package/dist/main/Execution/FormsExecution/fields/Scheduler/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Select/index.d.ts +15 -0
- package/dist/main/Execution/FormsExecution/fields/Select/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Select/index.js +35 -0
- package/dist/main/Execution/FormsExecution/fields/Select/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Textarea/index.d.ts +11 -0
- package/dist/main/Execution/FormsExecution/fields/Textarea/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Textarea/index.js +15 -0
- package/dist/main/Execution/FormsExecution/fields/Textarea/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Title/index.d.ts +8 -0
- package/dist/main/Execution/FormsExecution/fields/Title/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Title/index.js +7 -0
- package/dist/main/Execution/FormsExecution/fields/Title/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Tree/index.d.ts +30 -0
- package/dist/main/Execution/FormsExecution/fields/Tree/index.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fields/Tree/index.js +115 -0
- package/dist/main/Execution/FormsExecution/fields/Tree/index.js.map +1 -0
- package/dist/main/Execution/FormsExecution/fieldsMap.d.ts +9 -0
- package/dist/main/Execution/FormsExecution/fieldsMap.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/fieldsMap.js +64 -0
- package/dist/main/Execution/FormsExecution/fieldsMap.js.map +1 -0
- package/dist/main/Execution/FormsExecution/types.d.ts +55 -0
- package/dist/main/Execution/FormsExecution/types.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/util/isFieldShowAsText.js +8 -0
- package/dist/main/Execution/FormsExecution/util/isFieldShowAsText.js.map +1 -0
- package/dist/main/Execution/FormsExecution/util/util.d.ts +6 -0
- package/dist/main/Execution/FormsExecution/util/util.d.ts.map +1 -0
- package/dist/main/Execution/FormsExecution/util/util.js +7 -0
- package/dist/main/Execution/FormsExecution/util/util.js.map +1 -0
- package/dist/main/Execution/Observations/index.d.ts +16 -0
- package/dist/main/Execution/Observations/index.d.ts.map +1 -0
- package/dist/main/Execution/Observations/index.js +89 -0
- package/dist/main/Execution/Observations/index.js.map +1 -0
- package/dist/main/Execution/Observations/types.d.ts +26 -0
- package/dist/main/Execution/Observations/types.d.ts.map +1 -0
- package/dist/main/Execution/Process/index.d.ts +23 -0
- package/dist/main/Execution/Process/index.d.ts.map +1 -0
- package/dist/main/Execution/Process/index.js +77 -0
- package/dist/main/Execution/Process/index.js.map +1 -0
- package/dist/main/Execution/Process/types.d.ts +95 -0
- package/dist/main/Execution/Process/types.d.ts.map +1 -0
- package/dist/main/Execution/Signature/SignatureController.d.ts +23 -0
- package/dist/main/Execution/Signature/SignatureController.d.ts.map +1 -0
- package/dist/main/Execution/Signature/SignatureController.js +71 -0
- package/dist/main/Execution/Signature/SignatureController.js.map +1 -0
- package/dist/main/Execution/Task.d.ts +9 -0
- package/dist/main/Execution/Task.d.ts.map +1 -0
- package/dist/main/Execution/Task.js +34 -0
- package/dist/main/Execution/Task.js.map +1 -0
- package/dist/main/Execution/Uploader/FormsUploader.d.ts +145 -0
- package/dist/main/Execution/Uploader/FormsUploader.d.ts.map +1 -0
- package/dist/main/Execution/Uploader/FormsUploader.js +299 -0
- package/dist/main/Execution/Uploader/FormsUploader.js.map +1 -0
- package/dist/main/Execution/Uploader/UploaderApi.d.ts +40 -0
- package/dist/main/Execution/Uploader/UploaderApi.d.ts.map +1 -0
- package/dist/main/Execution/Uploader/UploaderApi.js +127 -0
- package/dist/main/Execution/Uploader/UploaderApi.js.map +1 -0
- package/dist/main/Execution/index.d.ts +184 -0
- package/dist/main/Execution/index.d.ts.map +1 -0
- package/dist/main/Execution/index.js +662 -0
- package/dist/main/Execution/index.js.map +1 -0
- package/dist/main/Execution/types.d.ts +99 -0
- package/dist/main/Execution/types.d.ts.map +1 -0
- package/dist/main/Execution/types.js +12 -0
- package/dist/main/Execution/types.js.map +1 -0
- package/dist/main/InitialData/bootstrap/readFormsDefinition.js +55 -0
- package/dist/main/InitialData/bootstrap/readFormsDefinition.js.map +1 -0
- package/dist/main/InitialData/index.js +10 -0
- package/dist/main/InitialData/index.js.map +1 -0
- package/dist/main/InitialData/types/TApiaField.d.ts +73 -0
- package/dist/main/InitialData/types/TApiaField.d.ts.map +1 -0
- package/dist/main/InitialData/types/TApiaForm.d.ts +102 -0
- package/dist/main/InitialData/types/TApiaForm.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaButtonDefinition.d.ts +9 -0
- package/dist/main/InitialData/types/fields/TApiaButtonDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaCaptchaDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaCaptchaDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaCheckboxDefinition.d.ts +10 -0
- package/dist/main/InitialData/types/fields/TApiaCheckboxDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaEditorDefinition.d.ts +10 -0
- package/dist/main/InitialData/types/fields/TApiaEditorDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaFieldProperties.d.ts +194 -0
- package/dist/main/InitialData/types/fields/TApiaFieldProperties.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaFileUploaderDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaFileUploaderDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaGridDefinition.d.ts +33 -0
- package/dist/main/InitialData/types/fields/TApiaGridDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaHiddenInputDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaHiddenInputDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaImageDefinition.d.ts +9 -0
- package/dist/main/InitialData/types/fields/TApiaImageDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaInputDefinition.d.ts +21 -0
- package/dist/main/InitialData/types/fields/TApiaInputDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaLabelDefinition.d.ts +10 -0
- package/dist/main/InitialData/types/fields/TApiaLabelDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaLinkDefinition.d.ts +10 -0
- package/dist/main/InitialData/types/fields/TApiaLinkDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaModalInputDefinition.d.ts +24 -0
- package/dist/main/InitialData/types/fields/TApiaModalInputDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaMultipleDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaMultipleDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaPasswordDefinition.d.ts +10 -0
- package/dist/main/InitialData/types/fields/TApiaPasswordDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaRadioButtonDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaRadioButtonDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaSelectDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaSelectDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaTextareaDefinition.d.ts +11 -0
- package/dist/main/InitialData/types/fields/TApiaTextareaDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaTitleDefinition.d.ts +9 -0
- package/dist/main/InitialData/types/fields/TApiaTitleDefinition.d.ts.map +1 -0
- package/dist/main/InitialData/types/fields/TApiaTreeDefinition.d.ts +17 -0
- package/dist/main/InitialData/types/fields/TApiaTreeDefinition.d.ts.map +1 -0
- package/dist/main/Notifications/MessageNotification.d.ts +8 -0
- package/dist/main/Notifications/MessageNotification.d.ts.map +1 -0
- package/dist/main/Notifications/MessageNotification.js +10 -0
- package/dist/main/Notifications/MessageNotification.js.map +1 -0
- package/dist/main/Notifications/Notification.d.ts +26 -0
- package/dist/main/Notifications/Notification.d.ts.map +1 -0
- package/dist/main/Notifications/Notification.js +40 -0
- package/dist/main/Notifications/Notification.js.map +1 -0
- package/dist/main/Notifications/StatusNotification.d.ts +15 -0
- package/dist/main/Notifications/StatusNotification.d.ts.map +1 -0
- package/dist/main/Notifications/StatusNotification.js +11 -0
- package/dist/main/Notifications/StatusNotification.js.map +1 -0
- package/dist/main/Notifications/index.d.ts +26 -0
- package/dist/main/Notifications/index.d.ts.map +1 -0
- package/dist/main/Notifications/index.js +48 -0
- package/dist/main/Notifications/index.js.map +1 -0
- package/dist/programming/ActionController/index.d.ts +36 -0
- package/dist/programming/ActionController/index.d.ts.map +1 -0
- package/dist/programming/ActionController/index.js +69 -0
- package/dist/programming/ActionController/index.js.map +1 -0
- package/dist/programming/ApiaField.d.ts +21 -0
- package/dist/programming/ApiaField.d.ts.map +1 -0
- package/dist/programming/ApiaField.js +58 -0
- package/dist/programming/ApiaField.js.map +1 -0
- package/dist/programming/ApiaFieldWithAttribute.d.ts +31 -0
- package/dist/programming/ApiaFieldWithAttribute.d.ts.map +1 -0
- package/dist/programming/ApiaFieldWithAttribute.js +72 -0
- package/dist/programming/ApiaFieldWithAttribute.js.map +1 -0
- package/dist/programming/ApiaForm.d.ts +148 -0
- package/dist/programming/ApiaForm.d.ts.map +1 -0
- package/dist/programming/ApiaForm.js +105 -0
- package/dist/programming/ApiaForm.js.map +1 -0
- package/dist/programming/ApiaFunctions.d.ts +54 -0
- package/dist/programming/ApiaFunctions.d.ts.map +1 -0
- package/dist/programming/ApiaFunctions.js +223 -0
- package/dist/programming/ApiaFunctions.js.map +1 -0
- package/dist/programming/constants/BooleanProps.d.ts +4 -0
- package/dist/programming/constants/BooleanProps.d.ts.map +1 -0
- package/dist/programming/constants/BooleanProps.js +67 -0
- package/dist/programming/constants/BooleanProps.js.map +1 -0
- package/dist/programming/constants/FieldConstants.d.ts +121 -0
- package/dist/programming/constants/FieldConstants.d.ts.map +1 -0
- package/dist/programming/constants/FieldConstants.js +127 -0
- package/dist/programming/constants/FieldConstants.js.map +1 -0
- package/dist/programming/constants/FormConstants.d.ts +15 -0
- package/dist/programming/constants/FormConstants.d.ts.map +1 -0
- package/dist/programming/constants/FormConstants.js +15 -0
- package/dist/programming/constants/FormConstants.js.map +1 -0
- package/dist/programming/constants/IProperty.d.ts +131 -0
- package/dist/programming/constants/IProperty.d.ts.map +1 -0
- package/dist/programming/constants/IProperty.js +10 -0
- package/dist/programming/constants/IProperty.js.map +1 -0
- package/dist/programming/constants/NumberProps.d.ts +4 -0
- package/dist/programming/constants/NumberProps.d.ts.map +1 -0
- package/dist/programming/constants/NumberProps.js +14 -0
- package/dist/programming/constants/NumberProps.js.map +1 -0
- package/dist/programming/fields/AreaField.d.ts +7 -0
- package/dist/programming/fields/AreaField.d.ts.map +1 -0
- package/dist/programming/fields/AreaField.js +7 -0
- package/dist/programming/fields/AreaField.js.map +1 -0
- package/dist/programming/fields/ButtonField.d.ts +22 -0
- package/dist/programming/fields/ButtonField.d.ts.map +1 -0
- package/dist/programming/fields/ButtonField.js +49 -0
- package/dist/programming/fields/ButtonField.js.map +1 -0
- package/dist/programming/fields/CaptchaField.d.ts +9 -0
- package/dist/programming/fields/CaptchaField.d.ts.map +1 -0
- package/dist/programming/fields/CaptchaField.js +7 -0
- package/dist/programming/fields/CaptchaField.js.map +1 -0
- package/dist/programming/fields/CheckField.d.ts +9 -0
- package/dist/programming/fields/CheckField.d.ts.map +1 -0
- package/dist/programming/fields/CheckField.js +23 -0
- package/dist/programming/fields/CheckField.js.map +1 -0
- package/dist/programming/fields/CustomComponentField.js +56 -0
- package/dist/programming/fields/CustomComponentField.js.map +1 -0
- package/dist/programming/fields/EditorField.d.ts +7 -0
- package/dist/programming/fields/EditorField.d.ts.map +1 -0
- package/dist/programming/fields/EditorField.js +7 -0
- package/dist/programming/fields/EditorField.js.map +1 -0
- package/dist/programming/fields/FileUploaderField.d.ts +17 -0
- package/dist/programming/fields/FileUploaderField.d.ts.map +1 -0
- package/dist/programming/fields/FileUploaderField.js +58 -0
- package/dist/programming/fields/FileUploaderField.js.map +1 -0
- package/dist/programming/fields/GridField.d.ts +624 -0
- package/dist/programming/fields/GridField.d.ts.map +1 -0
- package/dist/programming/fields/GridField.js +181 -0
- package/dist/programming/fields/GridField.js.map +1 -0
- package/dist/programming/fields/HiddenField.d.ts +7 -0
- package/dist/programming/fields/HiddenField.d.ts.map +1 -0
- package/dist/programming/fields/HiddenField.js +7 -0
- package/dist/programming/fields/HiddenField.js.map +1 -0
- package/dist/programming/fields/ImageField.d.ts +24 -0
- package/dist/programming/fields/ImageField.d.ts.map +1 -0
- package/dist/programming/fields/ImageField.js +61 -0
- package/dist/programming/fields/ImageField.js.map +1 -0
- package/dist/programming/fields/InputField.d.ts +15 -0
- package/dist/programming/fields/InputField.d.ts.map +1 -0
- package/dist/programming/fields/InputField.js +42 -0
- package/dist/programming/fields/InputField.js.map +1 -0
- package/dist/programming/fields/LinkField.d.ts +18 -0
- package/dist/programming/fields/LinkField.d.ts.map +1 -0
- package/dist/programming/fields/LinkField.js +39 -0
- package/dist/programming/fields/LinkField.js.map +1 -0
- package/dist/programming/fields/ModalInput.d.ts +16 -0
- package/dist/programming/fields/ModalInput.d.ts.map +1 -0
- package/dist/programming/fields/ModalInput.js +41 -0
- package/dist/programming/fields/ModalInput.js.map +1 -0
- package/dist/programming/fields/MultipleField.d.ts +22 -0
- package/dist/programming/fields/MultipleField.d.ts.map +1 -0
- package/dist/programming/fields/MultipleField.js +102 -0
- package/dist/programming/fields/MultipleField.js.map +1 -0
- package/dist/programming/fields/PasswordField.d.ts +7 -0
- package/dist/programming/fields/PasswordField.d.ts.map +1 -0
- package/dist/programming/fields/PasswordField.js +7 -0
- package/dist/programming/fields/PasswordField.js.map +1 -0
- package/dist/programming/fields/RadioField.d.ts +22 -0
- package/dist/programming/fields/RadioField.d.ts.map +1 -0
- package/dist/programming/fields/RadioField.js +98 -0
- package/dist/programming/fields/RadioField.js.map +1 -0
- package/dist/programming/fields/SelectField.d.ts +24 -0
- package/dist/programming/fields/SelectField.d.ts.map +1 -0
- package/dist/programming/fields/SelectField.js +104 -0
- package/dist/programming/fields/SelectField.js.map +1 -0
- package/dist/programming/fields/TextField.d.ts +18 -0
- package/dist/programming/fields/TextField.d.ts.map +1 -0
- package/dist/programming/fields/TextField.js +43 -0
- package/dist/programming/fields/TextField.js.map +1 -0
- package/dist/programming/fields/TreeField.d.ts +14 -0
- package/dist/programming/fields/TreeField.d.ts.map +1 -0
- package/dist/programming/fields/TreeField.js +36 -0
- package/dist/programming/fields/TreeField.js.map +1 -0
- package/dist/programming/types.d.ts +73 -0
- package/dist/programming/types.d.ts.map +1 -0
- package/dist/programming/utils/asynCreateApiaField.d.ts +10 -0
- package/dist/programming/utils/asynCreateApiaField.d.ts.map +1 -0
- package/dist/programming/utils/asynCreateApiaField.js +10 -0
- package/dist/programming/utils/asynCreateApiaField.js.map +1 -0
- package/dist/programming/utils/createApiaField.d.ts +6 -0
- package/dist/programming/utils/createApiaField.d.ts.map +1 -0
- package/dist/programming/utils/createApiaField.js +94 -0
- package/dist/programming/utils/createApiaField.js.map +1 -0
- package/dist/util/api/apiaApi.d.ts +159 -0
- package/dist/util/api/apiaApi.d.ts.map +1 -0
- package/dist/util/api/apiaApi.js +243 -0
- package/dist/util/api/apiaApi.js.map +1 -0
- package/dist/util/api/types.d.ts +38 -0
- package/dist/util/api/types.d.ts.map +1 -0
- package/dist/util/app/getCurrentTabsString.js +13 -0
- package/dist/util/app/getCurrentTabsString.js.map +1 -0
- package/dist/util/comparators/deepEqual.d.ts +5 -0
- package/dist/util/comparators/deepEqual.d.ts.map +1 -0
- package/dist/util/comparators/deepEqual.js +38 -0
- package/dist/util/comparators/deepEqual.js.map +1 -0
- package/dist/util/comparators/shallowEqual.d.ts +5 -0
- package/dist/util/comparators/shallowEqual.d.ts.map +1 -0
- package/dist/util/comparators/shallowEqual.js +38 -0
- package/dist/util/comparators/shallowEqual.js.map +1 -0
- package/dist/util/dataTypes/parseBoolean.js +12 -0
- package/dist/util/dataTypes/parseBoolean.js.map +1 -0
- package/dist/util/dom/getDocument.js +6 -0
- package/dist/util/dom/getDocument.js.map +1 -0
- package/dist/util/dom/getWindow.js +6 -0
- package/dist/util/dom/getWindow.js.map +1 -0
- package/dist/util/events/BouncingEmitter.d.ts +66 -0
- package/dist/util/events/BouncingEmitter.d.ts.map +1 -0
- package/dist/util/events/BouncingEmitter.js +78 -0
- package/dist/util/events/BouncingEmitter.js.map +1 -0
- package/dist/util/events/EventEmitter.d.ts +47 -0
- package/dist/util/events/EventEmitter.d.ts.map +1 -0
- package/dist/util/events/EventEmitter.js +81 -0
- package/dist/util/events/EventEmitter.js.map +1 -0
- package/dist/util/events/StatefulEmitter.d.ts +37 -0
- package/dist/util/events/StatefulEmitter.d.ts.map +1 -0
- package/dist/util/events/StatefulEmitter.js +51 -0
- package/dist/util/events/StatefulEmitter.js.map +1 -0
- package/dist/util/events/types.d.ts +30 -0
- package/dist/util/events/types.d.ts.map +1 -0
- package/dist/util/labels/labels.d.ts +12 -0
- package/dist/util/labels/labels.d.ts.map +1 -0
- package/dist/util/labels/labels.js +35 -0
- package/dist/util/labels/labels.js.map +1 -0
- package/dist/util/number/noNaN.js +9 -0
- package/dist/util/number/noNaN.js.map +1 -0
- package/dist/util/other/asyncRetry.js +32 -0
- package/dist/util/other/asyncRetry.js.map +1 -0
- package/dist/util/other/parseFakeJSON.d.ts +4 -0
- package/dist/util/other/parseFakeJSON.d.ts.map +1 -0
- package/dist/util/other/parseFakeJSON.js +45 -0
- package/dist/util/other/parseFakeJSON.js.map +1 -0
- package/dist/util/xml/parseXml.d.ts +10 -0
- package/dist/util/xml/parseXml.d.ts.map +1 -0
- package/dist/util/xml/parseXml.js +172 -0
- package/dist/util/xml/parseXml.js.map +1 -0
- package/package.json +7 -8
- package/LICENSE.md +0 -6
|
@@ -0,0 +1,961 @@
|
|
|
1
|
+
import { noNaN } from '../../../../../util/number/noNaN.js';
|
|
2
|
+
import { actions } from '../../constants/actions.js';
|
|
3
|
+
import { FieldWithAttribute } from '../../FieldWithAttribute.js';
|
|
4
|
+
import { TableController, Row, FocusControllerPlugin } from '@apia/table2-controller';
|
|
5
|
+
import { Field } from '../../Field.js';
|
|
6
|
+
import { parseFakeJSON } from '../../../../../util/other/parseFakeJSON.js';
|
|
7
|
+
import { GridFooterHandler } from './GridFooterHandler.js';
|
|
8
|
+
import { GridCell } from './GridCell.js';
|
|
9
|
+
import { Mutex, arrayOrArray } from '@apia/util';
|
|
10
|
+
import { AdditionalCell } from './AdditionalCell.js';
|
|
11
|
+
import { setAjaxFormResponse } from '../../events/setAjaxFormResponse.js';
|
|
12
|
+
import { File } from '../File/index.js';
|
|
13
|
+
import { HeaderCell } from './HeaderCell.js';
|
|
14
|
+
import { FieldsCache } from './FieldsCache.js';
|
|
15
|
+
import { ModalInput } from '../ModalInput/index.js';
|
|
16
|
+
import { getWindow } from '../../../../../util/dom/getWindow.js';
|
|
17
|
+
import { getDocument } from '../../../../../util/dom/getDocument.js';
|
|
18
|
+
import { Hidden } from '../Hidden/index.js';
|
|
19
|
+
import { parseXml } from '../../../../../util/xml/parseXml.js';
|
|
20
|
+
import { post, makeApiaUrl } from '../../../../../util/api/apiaApi.js';
|
|
21
|
+
|
|
22
|
+
var __defProp = Object.defineProperty;
|
|
23
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
24
|
+
var __publicField = (obj, key, value) => {
|
|
25
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
async function inlineCaller(cb, _t) {
|
|
29
|
+
return cb();
|
|
30
|
+
}
|
|
31
|
+
async function inlineTimeout(cb, _t) {
|
|
32
|
+
setTimeout(cb, _t);
|
|
33
|
+
return Promise.resolve(true);
|
|
34
|
+
}
|
|
35
|
+
class Grid extends Field {
|
|
36
|
+
constructor(definition) {
|
|
37
|
+
const parsedDefinition = Grid.parseGridDefinition(definition);
|
|
38
|
+
const { properties, field, ...gridDefinition } = parsedDefinition;
|
|
39
|
+
super({
|
|
40
|
+
...gridDefinition,
|
|
41
|
+
properties: {
|
|
42
|
+
currentPage: noNaN(parsedDefinition.curPage, 1),
|
|
43
|
+
maxRows: properties.maxRecords || Infinity,
|
|
44
|
+
paged: false,
|
|
45
|
+
pages: noNaN(parsedDefinition.pages, 1),
|
|
46
|
+
pageSize: noNaN(
|
|
47
|
+
properties.pagedGridSize,
|
|
48
|
+
properties.paged ? 5 : Infinity
|
|
49
|
+
),
|
|
50
|
+
shownDeleteButtons: /* @__PURE__ */ new Map(),
|
|
51
|
+
shownEditionButtons: /* @__PURE__ */ new Map(),
|
|
52
|
+
...properties,
|
|
53
|
+
hideDocInfoButton: String(properties.hideDocInfoButton) === "true"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
__publicField(this, "rowId", 0);
|
|
57
|
+
__publicField(this, "cache", new FieldsCache());
|
|
58
|
+
__publicField(this, "mutex", new Mutex());
|
|
59
|
+
__publicField(this, "newRowStates", []);
|
|
60
|
+
__publicField(this, "initialStates");
|
|
61
|
+
__publicField(this, "fieldsDefinitions");
|
|
62
|
+
__publicField(this, "managedAttIds", /* @__PURE__ */ new Set());
|
|
63
|
+
__publicField(this, "managedAttNames", /* @__PURE__ */ new Set());
|
|
64
|
+
__publicField(this, "managedFieldIds", /* @__PURE__ */ new Set());
|
|
65
|
+
__publicField(this, "managedFieldsNames", /* @__PURE__ */ new Set());
|
|
66
|
+
__publicField(this, "_editionModalHandler", null);
|
|
67
|
+
__publicField(this, "_footerController");
|
|
68
|
+
__publicField(this, "tableController");
|
|
69
|
+
const fieldsArray = arrayOrArray(field);
|
|
70
|
+
this.initialStates = fieldsArray.map(
|
|
71
|
+
(current) => current.fieldValue || current.row ? arrayOrArray(current.fieldValue || current.row) : void 0
|
|
72
|
+
).filter(Boolean);
|
|
73
|
+
this.fieldsDefinitions = fieldsArray.map(
|
|
74
|
+
({ fieldValue, properties: properties2, ...current }) => {
|
|
75
|
+
return { ...current, properties: parseFakeJSON(properties2) };
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
this.state.header = arrayOrArray(parsedDefinition.gridHeader.col).map(
|
|
79
|
+
(c) => ({
|
|
80
|
+
fldId: c.fldId,
|
|
81
|
+
label: c.colTitle,
|
|
82
|
+
title: c.title,
|
|
83
|
+
width: c.colWidth || this.resolveHeaderWidth(c),
|
|
84
|
+
hidden: false,
|
|
85
|
+
required: false,
|
|
86
|
+
fldType: c.fldType
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
this.state.isLoading = false;
|
|
90
|
+
this.state.isMaximized = false;
|
|
91
|
+
}
|
|
92
|
+
get controller() {
|
|
93
|
+
return this.tableController;
|
|
94
|
+
}
|
|
95
|
+
get currentPage() {
|
|
96
|
+
return this.properties.currentPage;
|
|
97
|
+
}
|
|
98
|
+
get editionModalHandler() {
|
|
99
|
+
return this._editionModalHandler;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns the final index of the current page
|
|
103
|
+
*/
|
|
104
|
+
get finalIndex() {
|
|
105
|
+
return (this.controller.body.rows.at(-1)?.cells.find((c) => c instanceof GridCell)).getField().definition.index;
|
|
106
|
+
}
|
|
107
|
+
get footerController() {
|
|
108
|
+
return this._footerController;
|
|
109
|
+
}
|
|
110
|
+
get header() {
|
|
111
|
+
return this.state.header;
|
|
112
|
+
}
|
|
113
|
+
get isPaged() {
|
|
114
|
+
return this.properties.paged;
|
|
115
|
+
}
|
|
116
|
+
get length() {
|
|
117
|
+
return this.tableController.body.rows.length;
|
|
118
|
+
}
|
|
119
|
+
get minIndex() {
|
|
120
|
+
return Number.isFinite(this.properties.pageSize) ? (this.properties.currentPage - 1) * this.properties.pageSize : 0;
|
|
121
|
+
}
|
|
122
|
+
get pageCount() {
|
|
123
|
+
return this.properties.pages;
|
|
124
|
+
}
|
|
125
|
+
get pageSize() {
|
|
126
|
+
return this.properties.pageSize;
|
|
127
|
+
}
|
|
128
|
+
get selectedIndices() {
|
|
129
|
+
return [...this.tableController.getState("selection").values()].map(
|
|
130
|
+
(c) => c.getIndex()
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
get selectedItems() {
|
|
134
|
+
return this.selectedIndices.map((current) => this.getRow(current));
|
|
135
|
+
}
|
|
136
|
+
get startIndex() {
|
|
137
|
+
const pageSize = this.properties.pageSize;
|
|
138
|
+
return noNaN((this.properties.currentPage - 1) * pageSize, 0);
|
|
139
|
+
}
|
|
140
|
+
static parseGridDefinition(xml) {
|
|
141
|
+
const definition = typeof xml === "string" ? parseXml(xml) : xml;
|
|
142
|
+
if (!definition.properties?.gridQuery) {
|
|
143
|
+
return definition;
|
|
144
|
+
}
|
|
145
|
+
const fields = arrayOrArray(definition.field);
|
|
146
|
+
const columns = arrayOrArray(definition.gridHeader?.col);
|
|
147
|
+
const totalColumns = Math.max(fields.length, columns.length);
|
|
148
|
+
return {
|
|
149
|
+
...definition,
|
|
150
|
+
gridHeader: {
|
|
151
|
+
...definition.gridHeader,
|
|
152
|
+
col: new Array(totalColumns).fill(null).map((_, index) => {
|
|
153
|
+
const column = columns[index] || {};
|
|
154
|
+
const field = fields[index];
|
|
155
|
+
return {
|
|
156
|
+
...column,
|
|
157
|
+
colTitle: column.colTitle || field?.properties?.gridColTitle || field?.attLabel || field?.properties?.name || "",
|
|
158
|
+
colWidth: column.colWidth || field?.colWidth || field?.properties?.colWidth || "",
|
|
159
|
+
dataType: column.dataType || field?.valueType || "S",
|
|
160
|
+
fldId: column.fldId || field?.id || String(index),
|
|
161
|
+
fldType: column.fldType || "",
|
|
162
|
+
hasQuery: typeof column.hasQuery === "boolean" ? column.hasQuery : !!field?.qryId,
|
|
163
|
+
title: column.title || field?.attLabel || ""
|
|
164
|
+
};
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
getMaximizedStorageKey() {
|
|
170
|
+
return [
|
|
171
|
+
getWindow(this.form.execution).TAB_ID,
|
|
172
|
+
this.form.definition.frmParent,
|
|
173
|
+
this.form.definition.id,
|
|
174
|
+
this.definition.id,
|
|
175
|
+
"isMaximized"
|
|
176
|
+
].join("__");
|
|
177
|
+
}
|
|
178
|
+
resolveHeaderWidth(c) {
|
|
179
|
+
if (c.fldType === "3") {
|
|
180
|
+
return "150px";
|
|
181
|
+
}
|
|
182
|
+
return "230px";
|
|
183
|
+
}
|
|
184
|
+
getGridActionFromEventName(eventName) {
|
|
185
|
+
switch (eventName) {
|
|
186
|
+
case "gridAdd":
|
|
187
|
+
return "add";
|
|
188
|
+
case "gridColumnSelect":
|
|
189
|
+
return void 0;
|
|
190
|
+
case "gridDelete":
|
|
191
|
+
return "delete";
|
|
192
|
+
case "gridSort":
|
|
193
|
+
return void 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
fireServerEvent(eventName, params) {
|
|
197
|
+
return super.fireServerEvent(eventName, {
|
|
198
|
+
gridAction: this.getGridActionFromEventName(eventName),
|
|
199
|
+
...params
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Grid methods
|
|
204
|
+
*/
|
|
205
|
+
async addRow() {
|
|
206
|
+
return this.asyncAction(async () => {
|
|
207
|
+
if (this.hasServerNoAjaxEventsOfType("gridAdd")) {
|
|
208
|
+
await this.fireServerEvent("gridAdd", {});
|
|
209
|
+
} else {
|
|
210
|
+
const res = this.runAction({
|
|
211
|
+
postData: {
|
|
212
|
+
gridAction: "add",
|
|
213
|
+
addRowsCount: 1,
|
|
214
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridAdd")
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
const response = await res;
|
|
218
|
+
if (response?.data?.gridXml) {
|
|
219
|
+
const xml = Grid.parseGridDefinition(response.data.gridXml);
|
|
220
|
+
const fieldsArray = arrayOrArray(xml.field);
|
|
221
|
+
this.newRowStates = fieldsArray.map(
|
|
222
|
+
(current) => current.fieldValue || current.row ? arrayOrArray(current.fieldValue || current.row) : void 0
|
|
223
|
+
).filter(Boolean);
|
|
224
|
+
} else {
|
|
225
|
+
throw new Error(
|
|
226
|
+
!getWindow(this.form.execution).SERVER_MODE ? "Something went wrong on the add row action." : ""
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
const addedRow = await this.addRowFromDefinitions(
|
|
230
|
+
true,
|
|
231
|
+
this.fieldsDefinitions.map((c, i) => ({
|
|
232
|
+
...c,
|
|
233
|
+
...this.newRowStates[i][0]
|
|
234
|
+
}))
|
|
235
|
+
);
|
|
236
|
+
return await (this.hasServerAjaxEventsOfType("gridAdd") ? inlineCaller : inlineTimeout)(async () => {
|
|
237
|
+
return this.asyncAction(async () => {
|
|
238
|
+
const evs = (await res)?.data?.eventsXml;
|
|
239
|
+
if (evs) {
|
|
240
|
+
setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
241
|
+
}
|
|
242
|
+
const scriptResult = await this.fireScriptEvent("gridAdd");
|
|
243
|
+
if (!scriptResult || !(await res)?.data?.success) {
|
|
244
|
+
(await addedRow).remove();
|
|
245
|
+
return false;
|
|
246
|
+
} else {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
}, !this.hasServerAjaxEventsOfType("gridAdd"));
|
|
250
|
+
}, 0);
|
|
251
|
+
}
|
|
252
|
+
return false;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
closeEditionModal() {
|
|
256
|
+
this._editionModalHandler?.close();
|
|
257
|
+
this._editionModalHandler = null;
|
|
258
|
+
this.refresh();
|
|
259
|
+
}
|
|
260
|
+
async deleteAllRows() {
|
|
261
|
+
this.cache.clear();
|
|
262
|
+
return this.asyncAction(async () => {
|
|
263
|
+
const res = this.runAction({
|
|
264
|
+
postData: {
|
|
265
|
+
gridAction: "delete",
|
|
266
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
const currentRows = [...this.tableController.body.rows];
|
|
270
|
+
const currentSelection = new Set(
|
|
271
|
+
this.tableController.getState("selection")
|
|
272
|
+
);
|
|
273
|
+
this.controller.body.clear();
|
|
274
|
+
this.tableController.clearSelection();
|
|
275
|
+
if (this.tableController.body.rows.length === 0 && this.getProperty("includeFirstRow")) {
|
|
276
|
+
await res;
|
|
277
|
+
await this.actualRefreshAction();
|
|
278
|
+
}
|
|
279
|
+
(this.tableController.body.getRowByIndex(0) || this.tableController.body.getRowByIndex(0 - 1))?.toggleSelection(true);
|
|
280
|
+
(this.tableController.body.getRowByIndex(0) || this.tableController.body.getRowByIndex(0 - 1) || this.tableController.head.getRowByIndex(0)).scrollIntoView();
|
|
281
|
+
const evs = (await res)?.data?.eventsXml;
|
|
282
|
+
if (evs) {
|
|
283
|
+
setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
284
|
+
}
|
|
285
|
+
if (!(await res)?.data?.success) {
|
|
286
|
+
this.tableController.body.setState("rows", currentRows);
|
|
287
|
+
this.tableController.setState("selection", currentSelection);
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
return true;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* @param index Si se pasa, se borran el o los índices provistos. Sino, se borran las filas seleccionadas, si es que hay alguna.
|
|
295
|
+
*/
|
|
296
|
+
async deleteRows(index) {
|
|
297
|
+
return this.asyncAction(async () => {
|
|
298
|
+
if (void 0 === index) {
|
|
299
|
+
index = [...this.controller.getState("selection")].map((c) => {
|
|
300
|
+
return c.getIndex();
|
|
301
|
+
});
|
|
302
|
+
} else {
|
|
303
|
+
this.controller.setSelection(arrayOrArray(index));
|
|
304
|
+
}
|
|
305
|
+
const deletingIndices = arrayOrArray(index).sort((a, b) => b - a);
|
|
306
|
+
if (this.hasServerNoAjaxEventsOfType("gridDelete")) {
|
|
307
|
+
await this.fireServerEvent("gridDelete", {
|
|
308
|
+
gridAction: "delete",
|
|
309
|
+
rowId: deletingIndices
|
|
310
|
+
});
|
|
311
|
+
} else {
|
|
312
|
+
let minIndex = Infinity;
|
|
313
|
+
deletingIndices.forEach((i) => {
|
|
314
|
+
if (i < minIndex) {
|
|
315
|
+
minIndex = i;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
this.cache.truncate(minIndex);
|
|
319
|
+
const res = this.runAction({
|
|
320
|
+
postData: {
|
|
321
|
+
gridAction: "delete",
|
|
322
|
+
rowId: deletingIndices,
|
|
323
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridDelete")
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
const currentRows = [...this.tableController.body.rows];
|
|
327
|
+
const currentSelection = new Set(
|
|
328
|
+
this.tableController.getState("selection")
|
|
329
|
+
);
|
|
330
|
+
deletingIndices.forEach(
|
|
331
|
+
(c) => this.controller.body.getRowByIndex(c).remove()
|
|
332
|
+
);
|
|
333
|
+
for (let i = minIndex; i < this.controller.body.rows.length; i++) {
|
|
334
|
+
this.controller.body.getRowByIndex(i).cells.forEach((c) => {
|
|
335
|
+
if (c instanceof GridCell) {
|
|
336
|
+
c.getField().definition.index = i;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
this.tableController.clearSelection();
|
|
341
|
+
if (this.tableController.body.rows.length === 0 && this.getProperty("includeFirstRow")) {
|
|
342
|
+
await res;
|
|
343
|
+
await this.actualRefreshAction();
|
|
344
|
+
}
|
|
345
|
+
(this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1))?.toggleSelection(true);
|
|
346
|
+
(this.tableController.body.getRowByIndex(minIndex) || this.tableController.body.getRowByIndex(minIndex - 1) || this.tableController.head.getRowByIndex(0)).scrollIntoView();
|
|
347
|
+
return await (this.hasServerAjaxEventsOfType("gridDelete") ? inlineCaller : inlineTimeout)(async () => {
|
|
348
|
+
return this.asyncAction(async () => {
|
|
349
|
+
const evs = (await res)?.data?.eventsXml;
|
|
350
|
+
if (evs) {
|
|
351
|
+
setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
352
|
+
}
|
|
353
|
+
const scriptResult = await this.fireScriptEvent("gridAdd");
|
|
354
|
+
if (!scriptResult || !(await res)?.data?.success) {
|
|
355
|
+
this.tableController.body.setState("rows", currentRows);
|
|
356
|
+
this.tableController.setState("selection", currentSelection);
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
}, !this.hasServerAjaxEventsOfType("gridDelete"));
|
|
361
|
+
}, 0);
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
async fireScriptEvent(eventName) {
|
|
367
|
+
return super.fireScriptEvent(eventName);
|
|
368
|
+
}
|
|
369
|
+
async fireEvent(eventName, params) {
|
|
370
|
+
return this.asyncAction(async () => {
|
|
371
|
+
return super.fireEvent(eventName, params);
|
|
372
|
+
}, params?.mutex);
|
|
373
|
+
}
|
|
374
|
+
getAllColumns() {
|
|
375
|
+
return [...Object.values(this.fieldsDefinitions)].map(
|
|
376
|
+
(f) => this.tableController.body.rows.map(
|
|
377
|
+
(c) => c.getCellByColumnName(f.id).getField()
|
|
378
|
+
)
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @param field - Nombre del campo o del atributo
|
|
383
|
+
*/
|
|
384
|
+
getColumn(field) {
|
|
385
|
+
return this.getField(field);
|
|
386
|
+
}
|
|
387
|
+
getCurrentPage() {
|
|
388
|
+
return 0;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* @param field - Nombre del campo o del atributo
|
|
392
|
+
*/
|
|
393
|
+
getField(field, index) {
|
|
394
|
+
return this.getFieldByName(field, index) || this.getFieldByAttributeName(field, index);
|
|
395
|
+
}
|
|
396
|
+
getFieldByAttributeId(attId, index) {
|
|
397
|
+
if (this.managedAttIds.has(attId)) {
|
|
398
|
+
if (index !== void 0) {
|
|
399
|
+
return this.getRowByFieldIndex(index)?.find(
|
|
400
|
+
(c) => c.attribute.id === attId
|
|
401
|
+
);
|
|
402
|
+
} else {
|
|
403
|
+
return this.tableController.body.rows.map(
|
|
404
|
+
(current) => current.cells.find(
|
|
405
|
+
(c) => c.getState("properties")?.field?.attribute.id === attId
|
|
406
|
+
)?.getState("properties").field
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
getFieldByAttributeName(attName, index) {
|
|
412
|
+
if (this.managedAttNames.has(attName)) {
|
|
413
|
+
if (index !== void 0) {
|
|
414
|
+
return this.getRowByFieldIndex(index)?.find(
|
|
415
|
+
(c) => c.attribute.name === attName
|
|
416
|
+
);
|
|
417
|
+
} else {
|
|
418
|
+
return this.tableController.body.rows.map(
|
|
419
|
+
(current) => current.cells.find(
|
|
420
|
+
(c) => c.getState("properties")?.field?.attribute.name === attName
|
|
421
|
+
)?.getState("properties").field
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
getFieldById(id, index) {
|
|
427
|
+
if (this.managedFieldIds.has(String(id))) {
|
|
428
|
+
if (index !== void 0) {
|
|
429
|
+
const found = this.cache.get(index, id) || this.getRow(index)?.find((c) => c.definition.id === id);
|
|
430
|
+
this.cache.set(index, id, found);
|
|
431
|
+
return found;
|
|
432
|
+
} else {
|
|
433
|
+
return this.tableController.body.rows.map(
|
|
434
|
+
(current) => current.cells.find(
|
|
435
|
+
(c) => c.getState("properties")?.field?.definition.id === id
|
|
436
|
+
)?.getState("properties").field
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
getFieldByName(name, index) {
|
|
442
|
+
if (this.managedFieldsNames.has(name)) {
|
|
443
|
+
if (index !== void 0) {
|
|
444
|
+
return this.getRow(index)?.find((c) => c.properties.name === name);
|
|
445
|
+
} else {
|
|
446
|
+
return this.tableController.body.rows.map(
|
|
447
|
+
(current) => current.cells.find(
|
|
448
|
+
(c) => c.getState("properties")?.field?.properties.name === name
|
|
449
|
+
)?.getState("properties").field
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return void 0;
|
|
454
|
+
}
|
|
455
|
+
getRowByFieldIndex(index) {
|
|
456
|
+
const row = this.tableController.body.rows.find(
|
|
457
|
+
(c) => c.cells.find((current) => current instanceof GridCell)?.getField().definition.index === index
|
|
458
|
+
);
|
|
459
|
+
if (row) {
|
|
460
|
+
return row?.cells.filter((c) => c instanceof GridCell).map((c) => c.getField());
|
|
461
|
+
}
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
getSelectedRows() {
|
|
465
|
+
return this.tableController.getSelectedRows().map((c) => this.getRow(c.getIndex()));
|
|
466
|
+
}
|
|
467
|
+
refreshColumnsVisibilities() {
|
|
468
|
+
const shownColumns = /* @__PURE__ */ new Set();
|
|
469
|
+
this.tableController.head.rows[0]?.cells.forEach((c) => {
|
|
470
|
+
shownColumns.add(c.getState("colName"));
|
|
471
|
+
});
|
|
472
|
+
for (let i = 0; i < this.tableController.head.rows[0]?.cells.length || 0; i++) {
|
|
473
|
+
for (const row of this.tableController.head.rows) {
|
|
474
|
+
const cell = row.cells[i];
|
|
475
|
+
if (cell instanceof HeaderCell && cell.getState("isHidden")) {
|
|
476
|
+
shownColumns.delete(cell.getState("colName"));
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
for (const column of new Set(
|
|
482
|
+
this.tableController.head.rows[0].cells.map((c) => c.getState("colName"))
|
|
483
|
+
)) {
|
|
484
|
+
this.tableController.toggleColumnVisibility(
|
|
485
|
+
column,
|
|
486
|
+
shownColumns.has(column)
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
async init(form) {
|
|
491
|
+
await super.init(form);
|
|
492
|
+
this.state.isMaximized = this.getForm().execution.environment.localStorage.getItem(
|
|
493
|
+
this.getMaximizedStorageKey()
|
|
494
|
+
) === "true";
|
|
495
|
+
this.tableController = new TableController(
|
|
496
|
+
{ labels: this.form.execution.environment.window.labels },
|
|
497
|
+
{
|
|
498
|
+
allowEdition: true,
|
|
499
|
+
allowSelection: true,
|
|
500
|
+
isSelectionMultiple: true
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
this._footerController = new GridFooterHandler(this);
|
|
504
|
+
this.controller.on("columnSort", (col) => {
|
|
505
|
+
this.sortColumn(col.getState("properties").col.fldId);
|
|
506
|
+
});
|
|
507
|
+
const headerRow = new Row("header");
|
|
508
|
+
if (this.properties.gridForm || !this.properties.hideDelButton && !this.properties.readonly && !this.properties.inputAsText && !this.getForm().definition.readOnly && !this.getForm().definition.readonly && getWindow(this.getForm().execution)?.config?.execution?.components?.dataGrid?.showDeleteButton)
|
|
509
|
+
headerRow.addCell(
|
|
510
|
+
new AdditionalCell(
|
|
511
|
+
this,
|
|
512
|
+
() => -1,
|
|
513
|
+
() => {
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
);
|
|
517
|
+
const hiddenColumns = /* @__PURE__ */ new Set();
|
|
518
|
+
this.header.forEach((c) => {
|
|
519
|
+
hiddenColumns.add(c.fldId);
|
|
520
|
+
});
|
|
521
|
+
for (const def of this.fieldsDefinitions) {
|
|
522
|
+
if (!def.properties.visibilityHidden && def.fieldType !== "hidden") {
|
|
523
|
+
hiddenColumns.delete(def.id);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
for (let index = 0; index < this.initialStates[0]?.length || 0; index++) {
|
|
527
|
+
await this.addRowFromDefinitions(
|
|
528
|
+
false,
|
|
529
|
+
this.fieldsDefinitions.map((c, i) => {
|
|
530
|
+
return {
|
|
531
|
+
...c,
|
|
532
|
+
...this.initialStates[i][index]
|
|
533
|
+
};
|
|
534
|
+
})
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
this.header.forEach((col, i) => {
|
|
538
|
+
let width = String(col.width || 200);
|
|
539
|
+
if (!width.endsWith("px")) {
|
|
540
|
+
width = `${width}px`;
|
|
541
|
+
}
|
|
542
|
+
headerRow.addCell(
|
|
543
|
+
new HeaderCell(this, {
|
|
544
|
+
colName: col.fldId || String(i),
|
|
545
|
+
content: col.label,
|
|
546
|
+
domProperties: {
|
|
547
|
+
style: { width, maxWidth: width },
|
|
548
|
+
title: col.title
|
|
549
|
+
},
|
|
550
|
+
properties: { col },
|
|
551
|
+
isHidden: hiddenColumns.has(col.fldId)
|
|
552
|
+
})
|
|
553
|
+
);
|
|
554
|
+
});
|
|
555
|
+
for (const column of hiddenColumns) {
|
|
556
|
+
this.tableController.toggleColumnVisibility(column, false);
|
|
557
|
+
}
|
|
558
|
+
this.controller.head.addRow(headerRow);
|
|
559
|
+
getDocument(this.form.execution).addEventListener?.("keydown", (ev) => {
|
|
560
|
+
if (ev.code === "Escape") {
|
|
561
|
+
this.clearMaximizeState();
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
openEditionModal(handler) {
|
|
566
|
+
this._editionModalHandler = handler;
|
|
567
|
+
handler.open();
|
|
568
|
+
}
|
|
569
|
+
async refresh() {
|
|
570
|
+
return this.asyncAction(this.actualRefreshAction.bind(this));
|
|
571
|
+
}
|
|
572
|
+
async sortColumn(fldId) {
|
|
573
|
+
await this.fireEvent("gridColumnSelect", {
|
|
574
|
+
firingField: fldId,
|
|
575
|
+
mutex: true
|
|
576
|
+
});
|
|
577
|
+
return true;
|
|
578
|
+
}
|
|
579
|
+
async sortDown(index) {
|
|
580
|
+
return this.asyncAction(async () => {
|
|
581
|
+
const indices = arrayOrArray(index || this.selectedIndices).sort(
|
|
582
|
+
(a, b) => b - a
|
|
583
|
+
);
|
|
584
|
+
if (this.hasServerNoAjaxEventsOfType("gridSort")) {
|
|
585
|
+
await this.fireServerEvent("gridSort", {
|
|
586
|
+
gridAction: "down",
|
|
587
|
+
rowId: indices
|
|
588
|
+
});
|
|
589
|
+
} else {
|
|
590
|
+
const currentRows = [...this.tableController.body.rows];
|
|
591
|
+
const res = this.runAction({
|
|
592
|
+
postData: {
|
|
593
|
+
gridAction: "down",
|
|
594
|
+
rowId: indices,
|
|
595
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
this.swapRows(indices, "down");
|
|
599
|
+
return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
|
|
600
|
+
return this.asyncAction(async () => {
|
|
601
|
+
const evs = (await res)?.data?.eventsXml;
|
|
602
|
+
if (evs) {
|
|
603
|
+
setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
604
|
+
}
|
|
605
|
+
const scriptEvent = await this.fireScriptEvent("gridSort");
|
|
606
|
+
if (!scriptEvent || !(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
|
|
607
|
+
this.tableController.body.setState("rows", currentRows);
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
return true;
|
|
611
|
+
}, !this.hasServerAjaxEventsOfType("gridSort"));
|
|
612
|
+
}, 0);
|
|
613
|
+
}
|
|
614
|
+
return false;
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
async sortUp(index) {
|
|
618
|
+
return this.asyncAction(async () => {
|
|
619
|
+
const indices = arrayOrArray(index || this.selectedIndices).sort(
|
|
620
|
+
(a, b) => a - b
|
|
621
|
+
);
|
|
622
|
+
if (this.hasServerNoAjaxEventsOfType("gridSort")) {
|
|
623
|
+
await this.fireServerEvent("gridSort", {
|
|
624
|
+
gridAction: "down",
|
|
625
|
+
rowId: indices
|
|
626
|
+
});
|
|
627
|
+
} else {
|
|
628
|
+
const currentRows = [...this.tableController.body.rows];
|
|
629
|
+
const res = this.runAction({
|
|
630
|
+
postData: {
|
|
631
|
+
gridAction: "up",
|
|
632
|
+
rowId: indices,
|
|
633
|
+
fireEvents: this.hasServerAjaxEventsOfType("gridSort")
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
this.swapRows(indices, "up");
|
|
637
|
+
return await (this.hasServerAjaxEventsOfType("gridSort") ? inlineCaller : inlineTimeout)(() => {
|
|
638
|
+
return this.asyncAction(async () => {
|
|
639
|
+
const evs = (await res)?.data?.eventsXml;
|
|
640
|
+
if (evs) {
|
|
641
|
+
setAjaxFormResponse(this.form.execution, parseXml(evs));
|
|
642
|
+
}
|
|
643
|
+
const scriptEvent = await this.fireScriptEvent("gridSort");
|
|
644
|
+
if (!scriptEvent || !(await res)?.data?.success || !await this.fireEvent("gridSort", { mutex: false })) {
|
|
645
|
+
this.tableController.body.setState("rows", currentRows);
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
return true;
|
|
649
|
+
}, !this.hasServerAjaxEventsOfType("gridSort"));
|
|
650
|
+
}, 0);
|
|
651
|
+
}
|
|
652
|
+
return false;
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
toggleColumnVisibility(fieldName, isShown) {
|
|
656
|
+
this.controller.toggleColumnVisibility(fieldName, isShown);
|
|
657
|
+
}
|
|
658
|
+
toggleDeleteButton(rowIndex, isShown) {
|
|
659
|
+
const currentValue = this.properties.shownDeleteButtons.get(rowIndex);
|
|
660
|
+
this.properties.shownDeleteButtons.set(rowIndex, isShown ?? !currentValue);
|
|
661
|
+
this.calculateMustShowAdditionalColumn();
|
|
662
|
+
}
|
|
663
|
+
toggleEditFormButton(rowIndex, isShown) {
|
|
664
|
+
const currentValue = this.properties.shownEditionButtons.get(rowIndex);
|
|
665
|
+
this.properties.shownEditionButtons.set(rowIndex, isShown ?? !currentValue);
|
|
666
|
+
this.calculateMustShowAdditionalColumn();
|
|
667
|
+
}
|
|
668
|
+
async validate() {
|
|
669
|
+
let isValid = true;
|
|
670
|
+
let firstInvalid = null;
|
|
671
|
+
for await (const row of this.tableController.body.rows) {
|
|
672
|
+
for await (const cell of row.cells) {
|
|
673
|
+
const field = cell.getState("properties")?.field;
|
|
674
|
+
if (field instanceof Field) {
|
|
675
|
+
const result = await field.validate();
|
|
676
|
+
if (!result && isValid && !firstInvalid) {
|
|
677
|
+
isValid = false;
|
|
678
|
+
firstInvalid = field;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return isValid || firstInvalid;
|
|
684
|
+
}
|
|
685
|
+
async actualRefreshAction() {
|
|
686
|
+
const res = await this.runAction({
|
|
687
|
+
postData: {
|
|
688
|
+
gridAction: "refresh"
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
if (res?.data?.gridXml) {
|
|
692
|
+
await this.rebuildGrid(res.data.gridXml, { recreateRows: true });
|
|
693
|
+
} else {
|
|
694
|
+
throw new Error("The server didn't return a valid XML response.");
|
|
695
|
+
}
|
|
696
|
+
return true;
|
|
697
|
+
}
|
|
698
|
+
async addRowFromDefinitions(select, definitions) {
|
|
699
|
+
const pageSize = this.properties.pageSize;
|
|
700
|
+
const offset = Number.isFinite(pageSize) ? (this.properties.currentPage - 1) * pageSize : 0;
|
|
701
|
+
const index = this.tableController.body.rows.length + offset;
|
|
702
|
+
if (!definitions) {
|
|
703
|
+
definitions = this.fieldsDefinitions.map((current, columnIndex) => {
|
|
704
|
+
this.getForm().addFieldToRender(current.id, index);
|
|
705
|
+
return {
|
|
706
|
+
...current,
|
|
707
|
+
...this.initialStates[columnIndex][0]
|
|
708
|
+
};
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
const newRow = new Row(String(this.rowId++), {
|
|
712
|
+
cells: [],
|
|
713
|
+
isSelectable: true
|
|
714
|
+
});
|
|
715
|
+
if (this.properties.gridForm || !this.properties.hideDelButton && !this.properties.readonly && !this.properties.inputAsText && !this.getForm().definition.readOnly && !this.getForm().definition.readonly && getWindow(this.getForm().execution)?.config?.execution?.components?.dataGrid?.showDeleteButton)
|
|
716
|
+
newRow.addCell(
|
|
717
|
+
new AdditionalCell(
|
|
718
|
+
this,
|
|
719
|
+
() => newRow.getIndex(),
|
|
720
|
+
() => {
|
|
721
|
+
this.deleteRows(newRow.getIndex());
|
|
722
|
+
},
|
|
723
|
+
this.properties.gridForm ? (handler) => {
|
|
724
|
+
this.openEditionModal(handler);
|
|
725
|
+
} : void 0
|
|
726
|
+
)
|
|
727
|
+
);
|
|
728
|
+
this.tableController.body.addRow(newRow);
|
|
729
|
+
for await (const field of definitions) {
|
|
730
|
+
const fieldProps = parseFakeJSON(
|
|
731
|
+
field.properties
|
|
732
|
+
);
|
|
733
|
+
field.properties = fieldProps;
|
|
734
|
+
const fieldConstructor = this.form.execution.fieldsMapping[field.fieldType](field);
|
|
735
|
+
if (fieldConstructor) {
|
|
736
|
+
const newField = new fieldConstructor({
|
|
737
|
+
...field,
|
|
738
|
+
...field.fieldValue,
|
|
739
|
+
index
|
|
740
|
+
});
|
|
741
|
+
await newField.init(this.getForm());
|
|
742
|
+
newField.setParentGrid(this);
|
|
743
|
+
if (newField instanceof FieldWithAttribute) {
|
|
744
|
+
this.managedAttIds.add(newField.attribute.id);
|
|
745
|
+
this.managedAttNames.add(newField.attribute.name);
|
|
746
|
+
}
|
|
747
|
+
this.managedFieldIds.add(newField.definition.id);
|
|
748
|
+
this.managedFieldsNames.add(newField.properties.name);
|
|
749
|
+
if (!(newField instanceof Hidden)) {
|
|
750
|
+
this.cache.set(index, newField.definition.id, newField);
|
|
751
|
+
let width = String(
|
|
752
|
+
this.header.find((c) => c.fldId === field.id)?.width || 250
|
|
753
|
+
);
|
|
754
|
+
if (!width.endsWith("px")) {
|
|
755
|
+
width = `${width}px`;
|
|
756
|
+
}
|
|
757
|
+
newRow.addCell(
|
|
758
|
+
new GridCell({
|
|
759
|
+
colName: newField.definition.id,
|
|
760
|
+
properties: { field: newField }
|
|
761
|
+
})
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
} else {
|
|
765
|
+
throw new Error(
|
|
766
|
+
`Cannot build field of type ${field.fieldType}. There is no mapping for such type.`
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
if (select) {
|
|
771
|
+
this.tableController.clearSelection();
|
|
772
|
+
this.tableController.toggleRowSelection(newRow, true);
|
|
773
|
+
}
|
|
774
|
+
return newRow;
|
|
775
|
+
}
|
|
776
|
+
async asyncAction(cb, mutex = true) {
|
|
777
|
+
if (mutex) {
|
|
778
|
+
await this.mutex.acquire();
|
|
779
|
+
}
|
|
780
|
+
try {
|
|
781
|
+
this.state.isLoading = true;
|
|
782
|
+
const res = await cb();
|
|
783
|
+
return res;
|
|
784
|
+
} finally {
|
|
785
|
+
this.state.isLoading = false;
|
|
786
|
+
if (mutex) {
|
|
787
|
+
this.mutex.release();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
calculateMustShowAdditionalColumn() {
|
|
792
|
+
const { hideDelButton, shownDeleteButtons, shownEditionButtons, gridForm } = this.properties;
|
|
793
|
+
const mustShowAdditionalColumn = !hideDelButton && [...shownDeleteButtons.values()].some((c) => c !== false) || !!gridForm && [...shownEditionButtons.values()].some((c) => c !== false);
|
|
794
|
+
this.controller.toggleColumnVisibility(
|
|
795
|
+
"additional",
|
|
796
|
+
mustShowAdditionalColumn
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
getRow(index) {
|
|
800
|
+
return this.tableController.body.getRowByIndex(index)?.cells.filter((c) => c instanceof GridCell).map((c) => c.getField());
|
|
801
|
+
}
|
|
802
|
+
async rebuildGrid(xmlString, options) {
|
|
803
|
+
const xml = Grid.parseGridDefinition(xmlString);
|
|
804
|
+
const fieldsArray = arrayOrArray(xml.field);
|
|
805
|
+
const statesArray = fieldsArray.map(
|
|
806
|
+
(field) => arrayOrArray(field.fieldValue || field.row)
|
|
807
|
+
);
|
|
808
|
+
const rowCount = statesArray[0]?.length || 0;
|
|
809
|
+
this.properties.pages = xml.pages || this.properties.pages;
|
|
810
|
+
this.properties.currentPage = xml.curPage || this.properties.currentPage;
|
|
811
|
+
this.properties.visibilityHidden = xml.properties.visibilityHidden ?? this.properties.visibilityHidden;
|
|
812
|
+
if (options?.recreateRows) {
|
|
813
|
+
this.cache.clear();
|
|
814
|
+
this.controller.clearSelection();
|
|
815
|
+
this.controller.body.clear();
|
|
816
|
+
this.fieldsDefinitions = fieldsArray.map(
|
|
817
|
+
({ fieldValue, properties, ...current }) => {
|
|
818
|
+
return { ...current, properties: parseFakeJSON(properties) };
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
for (let i = 0; i < rowCount; i++) {
|
|
822
|
+
const parsedFieldGroups = fieldsArray.map((field, columnIndex) => {
|
|
823
|
+
if (field.fieldType === "radio" || field.fieldType === "select") {
|
|
824
|
+
return {
|
|
825
|
+
...field,
|
|
826
|
+
...arrayOrArray(field.row)[i]
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
return {
|
|
830
|
+
...field,
|
|
831
|
+
index: i,
|
|
832
|
+
fieldValue: {
|
|
833
|
+
...statesArray[columnIndex][i]
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
});
|
|
837
|
+
await this.addRowFromDefinitions(false, parsedFieldGroups);
|
|
838
|
+
}
|
|
839
|
+
} else if (rowCount > this.controller.body.rows.length) {
|
|
840
|
+
for (let i = this.controller.body.rows.length; i < rowCount; i++) {
|
|
841
|
+
const parsedFieldGroups = fieldsArray.map((field, columnIndex) => {
|
|
842
|
+
if (field.fieldType === "radio" || field.fieldType === "select") {
|
|
843
|
+
const parsedField = {
|
|
844
|
+
...field,
|
|
845
|
+
...arrayOrArray(field.row)[i]
|
|
846
|
+
};
|
|
847
|
+
return parsedField;
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
...field,
|
|
851
|
+
index: i,
|
|
852
|
+
fieldValue: {
|
|
853
|
+
...statesArray[columnIndex][i]
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
});
|
|
857
|
+
await this.addRowFromDefinitions(false, parsedFieldGroups);
|
|
858
|
+
}
|
|
859
|
+
} else if (rowCount < this.controller.body.rows.length) {
|
|
860
|
+
const removeIndices = new Array(
|
|
861
|
+
this.controller.body.rows.length - rowCount
|
|
862
|
+
).fill(0).map((_, i) => i + rowCount);
|
|
863
|
+
removeIndices.sort((a, b) => b - a).forEach((i) => {
|
|
864
|
+
this.controller.body.getRowByIndex(i)?.remove();
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
statesArray.forEach((fieldStates, fieldIndex) => {
|
|
868
|
+
fieldStates.forEach((state, rowIndex) => {
|
|
869
|
+
const fieldDefinition = fieldsArray[fieldIndex];
|
|
870
|
+
const id = fieldDefinition.id;
|
|
871
|
+
const field = this.getFieldById(id, rowIndex);
|
|
872
|
+
if (field) {
|
|
873
|
+
const possibleValues = state?.possibleValue;
|
|
874
|
+
if (possibleValues) {
|
|
875
|
+
field.setProperty(
|
|
876
|
+
"possibleValue",
|
|
877
|
+
arrayOrArray(possibleValues)
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
Object.assign(
|
|
881
|
+
field.properties,
|
|
882
|
+
parseFakeJSON(state.properties)
|
|
883
|
+
);
|
|
884
|
+
field.definition.index = this.startIndex + rowIndex;
|
|
885
|
+
if (field instanceof File) {
|
|
886
|
+
field.loadFromDefinition(
|
|
887
|
+
state.file_prp ?? fieldDefinition.file_prp
|
|
888
|
+
);
|
|
889
|
+
} else if (field instanceof ModalInput) {
|
|
890
|
+
field.setValue(
|
|
891
|
+
{
|
|
892
|
+
showValue: state.qry_show_value || "",
|
|
893
|
+
storeValue: state.value || ""
|
|
894
|
+
},
|
|
895
|
+
{ force: true }
|
|
896
|
+
);
|
|
897
|
+
} else if (field instanceof FieldWithAttribute) {
|
|
898
|
+
field.setValue(state.value, { synchronize: false, force: true });
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
this.refreshColumnsVisibilities();
|
|
904
|
+
}
|
|
905
|
+
async runAction(postData) {
|
|
906
|
+
return post(
|
|
907
|
+
this.form.execution,
|
|
908
|
+
await makeApiaUrl(this.form.execution, {
|
|
909
|
+
action: "gridAction",
|
|
910
|
+
ajaxUrl: actions.forms,
|
|
911
|
+
fldId: this.definition.id,
|
|
912
|
+
frmId: this.form.definition.id,
|
|
913
|
+
frmParent: this.form.definition.frmParent
|
|
914
|
+
}),
|
|
915
|
+
{
|
|
916
|
+
postDataTreatment: "stringify",
|
|
917
|
+
stringifyOptions: { arrayFormat: "repeat" },
|
|
918
|
+
...postData
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
swapRows(rows, direction) {
|
|
923
|
+
let min = Infinity;
|
|
924
|
+
for (const i of rows) {
|
|
925
|
+
min = Math.min(min, i);
|
|
926
|
+
const swapIndex = direction === "up" ? i - 1 : i + 1;
|
|
927
|
+
const aRow = this.tableController.body.getRowByIndex(i);
|
|
928
|
+
const bRow = this.tableController.body.getRowByIndex(swapIndex);
|
|
929
|
+
if (aRow && bRow) {
|
|
930
|
+
this.getRow(i).forEach((c) => {
|
|
931
|
+
this.cache.clearIndex(c.definition.index);
|
|
932
|
+
this.cache.clearIndex(swapIndex);
|
|
933
|
+
c.definition.index = swapIndex;
|
|
934
|
+
});
|
|
935
|
+
this.getRow(swapIndex).forEach((c) => c.definition.index = i);
|
|
936
|
+
this.tableController.body.swapRows(aRow, bRow);
|
|
937
|
+
const selection = this.tableController.getState("selection");
|
|
938
|
+
selection.forEach((c) => c.toggleSelection(true));
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
if (min < Infinity) {
|
|
942
|
+
this.tableController.getPluginOfType(FocusControllerPlugin)?.scrollIntoView(
|
|
943
|
+
this.tableController.body.getRowByIndex(min).getState("id")
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
toggleMaximize() {
|
|
948
|
+
this.state.isMaximized = !this.state.isMaximized;
|
|
949
|
+
this.getForm().execution.environment.localStorage.setItem(
|
|
950
|
+
`${this.definition.id}__isMaximized`,
|
|
951
|
+
String(this.state.isMaximized)
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
clearMaximizeState() {
|
|
955
|
+
this.state.isMaximized = false;
|
|
956
|
+
localStorage.removeItem(this.getMaximizedStorageKey());
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export { Grid };
|
|
961
|
+
//# sourceMappingURL=index.js.map
|