@gisce/react-ooui 0.1.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/Config.d.ts +6 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +7 -0
- package/dist/Config.js.map +1 -0
- package/dist/ConnectionProvider.d.ts +7 -0
- package/dist/ConnectionProvider.d.ts.map +1 -0
- package/dist/ConnectionProvider.js +18 -0
- package/dist/ConnectionProvider.js.map +1 -0
- package/dist/actionbar/ActionButton.d.ts +13 -0
- package/dist/actionbar/ActionButton.d.ts.map +1 -0
- package/dist/actionbar/ActionButton.js +17 -0
- package/dist/actionbar/ActionButton.js.map +1 -0
- package/dist/actionbar/AttachmentsButton.d.ts +11 -0
- package/dist/actionbar/AttachmentsButton.d.ts.map +1 -0
- package/dist/actionbar/AttachmentsButton.js +170 -0
- package/dist/actionbar/AttachmentsButton.js.map +1 -0
- package/dist/actionbar/AttachmentsButtonWrapper.d.ts +18 -0
- package/dist/actionbar/AttachmentsButtonWrapper.d.ts.map +1 -0
- package/dist/actionbar/AttachmentsButtonWrapper.js +72 -0
- package/dist/actionbar/AttachmentsButtonWrapper.js.map +1 -0
- package/dist/actionbar/ButtonWithBadge.d.ts +8 -0
- package/dist/actionbar/ButtonWithBadge.d.ts.map +1 -0
- package/dist/actionbar/ButtonWithBadge.js +47 -0
- package/dist/actionbar/ButtonWithBadge.js.map +1 -0
- package/dist/actionbar/ChangeViewButton.d.ts +12 -0
- package/dist/actionbar/ChangeViewButton.d.ts.map +1 -0
- package/dist/actionbar/ChangeViewButton.js +97 -0
- package/dist/actionbar/ChangeViewButton.js.map +1 -0
- package/dist/actionbar/DashboardActionBar.d.ts +4 -0
- package/dist/actionbar/DashboardActionBar.d.ts.map +1 -0
- package/dist/actionbar/DashboardActionBar.js +50 -0
- package/dist/actionbar/DashboardActionBar.js.map +1 -0
- package/dist/actionbar/DropdownButton.d.ts +12 -0
- package/dist/actionbar/DropdownButton.d.ts.map +1 -0
- package/dist/actionbar/DropdownButton.js +38 -0
- package/dist/actionbar/DropdownButton.js.map +1 -0
- package/dist/actionbar/FormActionBar.d.ts +4 -0
- package/dist/actionbar/FormActionBar.d.ts.map +1 -0
- package/dist/actionbar/FormActionBar.js +346 -0
- package/dist/actionbar/FormActionBar.js.map +1 -0
- package/dist/actionbar/NewButton.d.ts +7 -0
- package/dist/actionbar/NewButton.d.ts.map +1 -0
- package/dist/actionbar/NewButton.js +50 -0
- package/dist/actionbar/NewButton.js.map +1 -0
- package/dist/actionbar/SearchBar.d.ts +9 -0
- package/dist/actionbar/SearchBar.d.ts.map +1 -0
- package/dist/actionbar/SearchBar.js +55 -0
- package/dist/actionbar/SearchBar.js.map +1 -0
- package/dist/actionbar/TreeActionBar.d.ts +7 -0
- package/dist/actionbar/TreeActionBar.d.ts.map +1 -0
- package/dist/actionbar/TreeActionBar.js +233 -0
- package/dist/actionbar/TreeActionBar.js.map +1 -0
- package/dist/common/ButtonWithTooltip.d.ts +8 -0
- package/dist/common/ButtonWithTooltip.d.ts.map +1 -0
- package/dist/common/ButtonWithTooltip.js +36 -0
- package/dist/common/ButtonWithTooltip.js.map +1 -0
- package/dist/common/DatePicker.d.ts +8 -0
- package/dist/common/DatePicker.d.ts.map +1 -0
- package/dist/common/DatePicker.js +66 -0
- package/dist/common/DatePicker.js.map +1 -0
- package/dist/common/Field.d.ts +14 -0
- package/dist/common/Field.d.ts.map +1 -0
- package/dist/common/Field.js +68 -0
- package/dist/common/Field.js.map +1 -0
- package/dist/context/ActionViewContext.d.ts +54 -0
- package/dist/context/ActionViewContext.d.ts.map +1 -0
- package/dist/context/ActionViewContext.js +93 -0
- package/dist/context/ActionViewContext.js.map +1 -0
- package/dist/context/ContentRootContext.d.ts +19 -0
- package/dist/context/ContentRootContext.d.ts.map +1 -0
- package/dist/context/ContentRootContext.js +419 -0
- package/dist/context/ContentRootContext.js.map +1 -0
- package/dist/context/DashboardActionContext.d.ts +19 -0
- package/dist/context/DashboardActionContext.d.ts.map +1 -0
- package/dist/context/DashboardActionContext.js +39 -0
- package/dist/context/DashboardActionContext.js.map +1 -0
- package/dist/context/FormContext.d.ts +30 -0
- package/dist/context/FormContext.d.ts.map +1 -0
- package/dist/context/FormContext.js +29 -0
- package/dist/context/FormContext.js.map +1 -0
- package/dist/context/FormModalContext.d.ts +11 -0
- package/dist/context/FormModalContext.d.ts.map +1 -0
- package/dist/context/FormModalContext.js +16 -0
- package/dist/context/FormModalContext.js.map +1 -0
- package/dist/context/LocaleContext.d.ts +14 -0
- package/dist/context/LocaleContext.d.ts.map +1 -0
- package/dist/context/LocaleContext.js +34 -0
- package/dist/context/LocaleContext.js.map +1 -0
- package/dist/context/One2manyContext.d.ts +17 -0
- package/dist/context/One2manyContext.d.ts.map +1 -0
- package/dist/context/One2manyContext.js +40 -0
- package/dist/context/One2manyContext.js.map +1 -0
- package/dist/context/TabManagerContext.d.ts +50 -0
- package/dist/context/TabManagerContext.d.ts.map +1 -0
- package/dist/context/TabManagerContext.js +45 -0
- package/dist/context/TabManagerContext.js.map +1 -0
- package/dist/helpers/containerHelper.d.ts +22 -0
- package/dist/helpers/containerHelper.d.ts.map +1 -0
- package/dist/helpers/containerHelper.js +108 -0
- package/dist/helpers/containerHelper.js.map +1 -0
- package/dist/helpers/dynamicColumnsHelper.d.ts +8 -0
- package/dist/helpers/dynamicColumnsHelper.d.ts.map +1 -0
- package/dist/helpers/dynamicColumnsHelper.js +67 -0
- package/dist/helpers/dynamicColumnsHelper.js.map +1 -0
- package/dist/helpers/filesHelper.d.ts +8 -0
- package/dist/helpers/filesHelper.d.ts.map +1 -0
- package/dist/helpers/filesHelper.js +91 -0
- package/dist/helpers/filesHelper.js.map +1 -0
- package/dist/helpers/formHelper.d.ts +31 -0
- package/dist/helpers/formHelper.d.ts.map +1 -0
- package/dist/helpers/formHelper.js +191 -0
- package/dist/helpers/formHelper.js.map +1 -0
- package/dist/helpers/iconMapper.d.ts +3 -0
- package/dist/helpers/iconMapper.d.ts.map +1 -0
- package/dist/helpers/iconMapper.js +125 -0
- package/dist/helpers/iconMapper.js.map +1 -0
- package/dist/helpers/logInfoHelper.d.ts +3 -0
- package/dist/helpers/logInfoHelper.d.ts.map +1 -0
- package/dist/helpers/logInfoHelper.js +78 -0
- package/dist/helpers/logInfoHelper.js.map +1 -0
- package/dist/helpers/one2manyHelper.d.ts +29 -0
- package/dist/helpers/one2manyHelper.d.ts.map +1 -0
- package/dist/helpers/one2manyHelper.js +159 -0
- package/dist/helpers/one2manyHelper.js.map +1 -0
- package/dist/helpers/searchFilterHelper.d.ts +5 -0
- package/dist/helpers/searchFilterHelper.d.ts.map +1 -0
- package/dist/helpers/searchFilterHelper.js +157 -0
- package/dist/helpers/searchFilterHelper.js.map +1 -0
- package/dist/helpers/timeHelper.d.ts +4 -0
- package/dist/helpers/timeHelper.d.ts.map +1 -0
- package/dist/helpers/timeHelper.js +53 -0
- package/dist/helpers/timeHelper.js.map +1 -0
- package/dist/helpers/treeHelper.d.ts +16 -0
- package/dist/helpers/treeHelper.d.ts.map +1 -0
- package/dist/helpers/treeHelper.js +128 -0
- package/dist/helpers/treeHelper.js.map +1 -0
- package/dist/hooks/useEffectDebugger.d.ts +3 -0
- package/dist/hooks/useEffectDebugger.d.ts.map +1 -0
- package/dist/hooks/useEffectDebugger.js +43 -0
- package/dist/hooks/useEffectDebugger.js.map +1 -0
- package/dist/hooks/useWindowDimensions.d.ts +7 -0
- package/dist/hooks/useWindowDimensions.d.ts.map +1 -0
- package/dist/hooks/useWindowDimensions.js +29 -0
- package/dist/hooks/useWindowDimensions.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +76 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/ca_ES.d.ts +81 -0
- package/dist/locales/ca_ES.d.ts.map +1 -0
- package/dist/locales/ca_ES.js +82 -0
- package/dist/locales/ca_ES.js.map +1 -0
- package/dist/locales/en_US.d.ts +81 -0
- package/dist/locales/en_US.d.ts.map +1 -0
- package/dist/locales/en_US.js +82 -0
- package/dist/locales/en_US.js.map +1 -0
- package/dist/locales/es_ES.d.ts +81 -0
- package/dist/locales/es_ES.d.ts.map +1 -0
- package/dist/locales/es_ES.js +82 -0
- package/dist/locales/es_ES.js.map +1 -0
- package/dist/main.css +180 -0
- package/dist/types/index.d.ts +205 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/ActionErrorDialog.d.ts +3 -0
- package/dist/ui/ActionErrorDialog.d.ts.map +1 -0
- package/dist/ui/ActionErrorDialog.js +38 -0
- package/dist/ui/ActionErrorDialog.js.map +1 -0
- package/dist/ui/ConfirmDialog.d.ts +7 -0
- package/dist/ui/ConfirmDialog.d.ts.map +1 -0
- package/dist/ui/ConfirmDialog.js +24 -0
- package/dist/ui/ConfirmDialog.js.map +1 -0
- package/dist/ui/FavouriteButton.d.ts +26 -0
- package/dist/ui/FavouriteButton.d.ts.map +1 -0
- package/dist/ui/FavouriteButton.js +238 -0
- package/dist/ui/FavouriteButton.js.map +1 -0
- package/dist/ui/Fieldset.d.ts +8 -0
- package/dist/ui/Fieldset.d.ts.map +1 -0
- package/dist/ui/Fieldset.js +22 -0
- package/dist/ui/Fieldset.js.map +1 -0
- package/dist/ui/FormErrorsDialog.d.ts +3 -0
- package/dist/ui/FormErrorsDialog.d.ts.map +1 -0
- package/dist/ui/FormErrorsDialog.js +20 -0
- package/dist/ui/FormErrorsDialog.js.map +1 -0
- package/dist/ui/GenericErrorDialog.d.ts +3 -0
- package/dist/ui/GenericErrorDialog.d.ts.map +1 -0
- package/dist/ui/GenericErrorDialog.js +19 -0
- package/dist/ui/GenericErrorDialog.js.map +1 -0
- package/dist/ui/GoToResourceModal.d.ts +10 -0
- package/dist/ui/GoToResourceModal.d.ts.map +1 -0
- package/dist/ui/GoToResourceModal.js +49 -0
- package/dist/ui/GoToResourceModal.js.map +1 -0
- package/dist/ui/InfoDialog.d.ts +3 -0
- package/dist/ui/InfoDialog.d.ts.map +1 -0
- package/dist/ui/InfoDialog.js +13 -0
- package/dist/ui/InfoDialog.js.map +1 -0
- package/dist/ui/RefreshItemDialog.d.ts +7 -0
- package/dist/ui/RefreshItemDialog.d.ts.map +1 -0
- package/dist/ui/RefreshItemDialog.js +25 -0
- package/dist/ui/RefreshItemDialog.js.map +1 -0
- package/dist/ui/RemoveItemDialog.d.ts +6 -0
- package/dist/ui/RemoveItemDialog.d.ts.map +1 -0
- package/dist/ui/RemoveItemDialog.js +24 -0
- package/dist/ui/RemoveItemDialog.js.map +1 -0
- package/dist/ui/TitleHeader.d.ts +7 -0
- package/dist/ui/TitleHeader.d.ts.map +1 -0
- package/dist/ui/TitleHeader.js +93 -0
- package/dist/ui/TitleHeader.js.map +1 -0
- package/dist/ui/UnlinkItemDialog.d.ts +6 -0
- package/dist/ui/UnlinkItemDialog.d.ts.map +1 -0
- package/dist/ui/UnlinkItemDialog.js +24 -0
- package/dist/ui/UnlinkItemDialog.js.map +1 -0
- package/dist/ui/UnsavedChangesDialog.d.ts +7 -0
- package/dist/ui/UnsavedChangesDialog.d.ts.map +1 -0
- package/dist/ui/UnsavedChangesDialog.js +25 -0
- package/dist/ui/UnsavedChangesDialog.js.map +1 -0
- package/dist/ui/WarningDialog.d.ts +3 -0
- package/dist/ui/WarningDialog.d.ts.map +1 -0
- package/dist/ui/WarningDialog.js +20 -0
- package/dist/ui/WarningDialog.js.map +1 -0
- package/dist/views/ActionView.d.ts +24 -0
- package/dist/views/ActionView.d.ts.map +1 -0
- package/dist/views/ActionView.js +376 -0
- package/dist/views/ActionView.js.map +1 -0
- package/dist/views/CurrentTabContent.d.ts +4 -0
- package/dist/views/CurrentTabContent.d.ts.map +1 -0
- package/dist/views/CurrentTabContent.js +35 -0
- package/dist/views/CurrentTabContent.js.map +1 -0
- package/dist/views/RootView.d.ts +14 -0
- package/dist/views/RootView.d.ts.map +1 -0
- package/dist/views/RootView.js +469 -0
- package/dist/views/RootView.js.map +1 -0
- package/dist/views/TabContent.d.ts +8 -0
- package/dist/views/TabContent.d.ts.map +1 -0
- package/dist/views/TabContent.js +34 -0
- package/dist/views/TabContent.js.map +1 -0
- package/dist/views/TabSelector.d.ts +4 -0
- package/dist/views/TabSelector.d.ts.map +1 -0
- package/dist/views/TabSelector.js +34 -0
- package/dist/views/TabSelector.js.map +1 -0
- package/dist/views/Welcome.d.ts +4 -0
- package/dist/views/Welcome.d.ts.map +1 -0
- package/dist/views/Welcome.js +33 -0
- package/dist/views/Welcome.js.map +1 -0
- package/dist/views/tabs/Tab.d.ts +11 -0
- package/dist/views/tabs/Tab.d.ts.map +1 -0
- package/dist/views/tabs/Tab.js +54 -0
- package/dist/views/tabs/Tab.js.map +1 -0
- package/dist/widgets/WidgetFactory.d.ts +4 -0
- package/dist/widgets/WidgetFactory.d.ts.map +1 -0
- package/dist/widgets/WidgetFactory.js +85 -0
- package/dist/widgets/WidgetFactory.js.map +1 -0
- package/dist/widgets/base/Binary.d.ts +14 -0
- package/dist/widgets/base/Binary.d.ts.map +1 -0
- package/dist/widgets/base/Binary.js +173 -0
- package/dist/widgets/base/Binary.js.map +1 -0
- package/dist/widgets/base/Boolean.d.ts +4 -0
- package/dist/widgets/base/Boolean.d.ts.map +1 -0
- package/dist/widgets/base/Boolean.js +53 -0
- package/dist/widgets/base/Boolean.js.map +1 -0
- package/dist/widgets/base/Button.d.ts +8 -0
- package/dist/widgets/base/Button.d.ts.map +1 -0
- package/dist/widgets/base/Button.js +118 -0
- package/dist/widgets/base/Button.js.map +1 -0
- package/dist/widgets/base/Char.d.ts +8 -0
- package/dist/widgets/base/Char.d.ts.map +1 -0
- package/dist/widgets/base/Char.js +145 -0
- package/dist/widgets/base/Char.js.map +1 -0
- package/dist/widgets/base/Date.d.ts +5 -0
- package/dist/widgets/base/Date.d.ts.map +1 -0
- package/dist/widgets/base/Date.js +13 -0
- package/dist/widgets/base/Date.js.map +1 -0
- package/dist/widgets/base/DateTime.d.ts +5 -0
- package/dist/widgets/base/DateTime.d.ts.map +1 -0
- package/dist/widgets/base/DateTime.js +13 -0
- package/dist/widgets/base/DateTime.js.map +1 -0
- package/dist/widgets/base/Email.d.ts +4 -0
- package/dist/widgets/base/Email.d.ts.map +1 -0
- package/dist/widgets/base/Email.js +34 -0
- package/dist/widgets/base/Email.js.map +1 -0
- package/dist/widgets/base/Float.d.ts +4 -0
- package/dist/widgets/base/Float.d.ts.map +1 -0
- package/dist/widgets/base/Float.js +54 -0
- package/dist/widgets/base/Float.js.map +1 -0
- package/dist/widgets/base/FloatTime.d.ts +12 -0
- package/dist/widgets/base/FloatTime.d.ts.map +1 -0
- package/dist/widgets/base/FloatTime.js +122 -0
- package/dist/widgets/base/FloatTime.js.map +1 -0
- package/dist/widgets/base/Image.d.ts +14 -0
- package/dist/widgets/base/Image.d.ts.map +1 -0
- package/dist/widgets/base/Image.js +153 -0
- package/dist/widgets/base/Image.js.map +1 -0
- package/dist/widgets/base/Integer.d.ts +8 -0
- package/dist/widgets/base/Integer.d.ts.map +1 -0
- package/dist/widgets/base/Integer.js +57 -0
- package/dist/widgets/base/Integer.js.map +1 -0
- package/dist/widgets/base/Label.d.ts +9 -0
- package/dist/widgets/base/Label.d.ts.map +1 -0
- package/dist/widgets/base/Label.js +27 -0
- package/dist/widgets/base/Label.js.map +1 -0
- package/dist/widgets/base/LinkInput.d.ts +12 -0
- package/dist/widgets/base/LinkInput.d.ts.map +1 -0
- package/dist/widgets/base/LinkInput.js +70 -0
- package/dist/widgets/base/LinkInput.js.map +1 -0
- package/dist/widgets/base/MultiSelection.d.ts +10 -0
- package/dist/widgets/base/MultiSelection.d.ts.map +1 -0
- package/dist/widgets/base/MultiSelection.js +69 -0
- package/dist/widgets/base/MultiSelection.js.map +1 -0
- package/dist/widgets/base/ProgressBar.d.ts +7 -0
- package/dist/widgets/base/ProgressBar.d.ts.map +1 -0
- package/dist/widgets/base/ProgressBar.js +45 -0
- package/dist/widgets/base/ProgressBar.js.map +1 -0
- package/dist/widgets/base/Reference.d.ts +16 -0
- package/dist/widgets/base/Reference.d.ts.map +1 -0
- package/dist/widgets/base/Reference.js +93 -0
- package/dist/widgets/base/Reference.js.map +1 -0
- package/dist/widgets/base/Selection.d.ts +10 -0
- package/dist/widgets/base/Selection.d.ts.map +1 -0
- package/dist/widgets/base/Selection.js +51 -0
- package/dist/widgets/base/Selection.js.map +1 -0
- package/dist/widgets/base/Separator.d.ts +8 -0
- package/dist/widgets/base/Separator.d.ts.map +1 -0
- package/dist/widgets/base/Separator.js +15 -0
- package/dist/widgets/base/Separator.js.map +1 -0
- package/dist/widgets/base/Text.d.ts +8 -0
- package/dist/widgets/base/Text.d.ts.map +1 -0
- package/dist/widgets/base/Text.js +142 -0
- package/dist/widgets/base/Text.js.map +1 -0
- package/dist/widgets/base/Url.d.ts +4 -0
- package/dist/widgets/base/Url.d.ts.map +1 -0
- package/dist/widgets/base/Url.js +34 -0
- package/dist/widgets/base/Url.js.map +1 -0
- package/dist/widgets/base/many2one/Many2one.d.ts +16 -0
- package/dist/widgets/base/many2one/Many2one.d.ts.map +1 -0
- package/dist/widgets/base/many2one/Many2one.js +353 -0
- package/dist/widgets/base/many2one/Many2one.js.map +1 -0
- package/dist/widgets/base/many2one/Many2oneSuffix.d.ts +9 -0
- package/dist/widgets/base/many2one/Many2oneSuffix.d.ts.map +1 -0
- package/dist/widgets/base/many2one/Many2oneSuffix.js +215 -0
- package/dist/widgets/base/many2one/Many2oneSuffix.js.map +1 -0
- package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts +10 -0
- package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts.map +1 -0
- package/dist/widgets/base/many2one/Many2oneSuffixModal.js +37 -0
- package/dist/widgets/base/many2one/Many2oneSuffixModal.js.map +1 -0
- package/dist/widgets/base/one2many/One2many.d.ts +9 -0
- package/dist/widgets/base/one2many/One2many.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2many.js +188 -0
- package/dist/widgets/base/one2many/One2many.js.map +1 -0
- package/dist/widgets/base/one2many/One2manyInput.d.ts +23 -0
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2manyInput.js +602 -0
- package/dist/widgets/base/one2many/One2manyInput.js.map +1 -0
- package/dist/widgets/base/one2many/One2manyTopBar.d.ts +21 -0
- package/dist/widgets/base/one2many/One2manyTopBar.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2manyTopBar.js +59 -0
- package/dist/widgets/base/one2many/One2manyTopBar.js.map +1 -0
- package/dist/widgets/containers/Container.d.ts +9 -0
- package/dist/widgets/containers/Container.d.ts.map +1 -0
- package/dist/widgets/containers/Container.js +77 -0
- package/dist/widgets/containers/Container.js.map +1 -0
- package/dist/widgets/containers/Group.d.ts +10 -0
- package/dist/widgets/containers/Group.d.ts.map +1 -0
- package/dist/widgets/containers/Group.js +15 -0
- package/dist/widgets/containers/Group.js.map +1 -0
- package/dist/widgets/containers/Notebook.d.ts +9 -0
- package/dist/widgets/containers/Notebook.d.ts.map +1 -0
- package/dist/widgets/containers/Notebook.js +21 -0
- package/dist/widgets/containers/Notebook.js.map +1 -0
- package/dist/widgets/custom/FiberGrid.d.ts +10 -0
- package/dist/widgets/custom/FiberGrid.d.ts.map +1 -0
- package/dist/widgets/custom/FiberGrid.js +50 -0
- package/dist/widgets/custom/FiberGrid.js.map +1 -0
- package/dist/widgets/custom/Indicator.d.ts +10 -0
- package/dist/widgets/custom/Indicator.d.ts.map +1 -0
- package/dist/widgets/custom/Indicator.js +44 -0
- package/dist/widgets/custom/Indicator.js.map +1 -0
- package/dist/widgets/custom/Timeline.d.ts +16 -0
- package/dist/widgets/custom/Timeline.d.ts.map +1 -0
- package/dist/widgets/custom/Timeline.js +231 -0
- package/dist/widgets/custom/Timeline.js.map +1 -0
- package/dist/widgets/modals/FormModal.d.ts +12 -0
- package/dist/widgets/modals/FormModal.d.ts.map +1 -0
- package/dist/widgets/modals/FormModal.js +174 -0
- package/dist/widgets/modals/FormModal.js.map +1 -0
- package/dist/widgets/modals/SearchModal.d.ts +13 -0
- package/dist/widgets/modals/SearchModal.d.ts.map +1 -0
- package/dist/widgets/modals/SearchModal.js +129 -0
- package/dist/widgets/modals/SearchModal.js.map +1 -0
- package/dist/widgets/modals/TranslationModal.d.ts +12 -0
- package/dist/widgets/modals/TranslationModal.d.ts.map +1 -0
- package/dist/widgets/modals/TranslationModal.js +254 -0
- package/dist/widgets/modals/TranslationModal.js.map +1 -0
- package/dist/widgets/views/Dashboard/Dashboard.d.ts +7 -0
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -0
- package/dist/widgets/views/Dashboard/Dashboard.js +368 -0
- package/dist/widgets/views/Dashboard/Dashboard.js.map +1 -0
- package/dist/widgets/views/Dashboard/Dashboard.types.d.ts +8 -0
- package/dist/widgets/views/Dashboard/Dashboard.types.d.ts.map +1 -0
- package/dist/widgets/views/Dashboard/Dashboard.types.js +3 -0
- package/dist/widgets/views/Dashboard/Dashboard.types.js.map +1 -0
- package/dist/widgets/views/Dashboard/DashboardForm.d.ts +4 -0
- package/dist/widgets/views/Dashboard/DashboardForm.d.ts.map +1 -0
- package/dist/widgets/views/Dashboard/DashboardForm.js +106 -0
- package/dist/widgets/views/Dashboard/DashboardForm.js.map +1 -0
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts +19 -0
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -0
- package/dist/widgets/views/Dashboard/DashboardTree.js +318 -0
- package/dist/widgets/views/Dashboard/DashboardTree.js.map +1 -0
- package/dist/widgets/views/Dashboard/dashboardHelper.d.ts +6 -0
- package/dist/widgets/views/Dashboard/dashboardHelper.d.ts.map +1 -0
- package/dist/widgets/views/Dashboard/dashboardHelper.js +136 -0
- package/dist/widgets/views/Dashboard/dashboardHelper.js.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts +6 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.js +31 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.js.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.types.d.ts +6 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.types.d.ts.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.types.js +3 -0
- package/dist/widgets/views/DashboardGrid/DashboardGrid.types.js.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts +4 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.js +38 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.js.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.types.d.ts +11 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.types.d.ts.map +1 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.types.js +3 -0
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.types.js.map +1 -0
- package/dist/widgets/views/DashboardGrid/index.d.ts +5 -0
- package/dist/widgets/views/DashboardGrid/index.d.ts.map +1 -0
- package/dist/widgets/views/DashboardGrid/index.js +17 -0
- package/dist/widgets/views/DashboardGrid/index.js.map +1 -0
- package/dist/widgets/views/Form.d.ts +28 -0
- package/dist/widgets/views/Form.d.ts.map +1 -0
- package/dist/widgets/views/Form.js +933 -0
- package/dist/widgets/views/Form.js.map +1 -0
- package/dist/widgets/views/Graph/Graph.d.ts +10 -0
- package/dist/widgets/views/Graph/Graph.d.ts.map +1 -0
- package/dist/widgets/views/Graph/Graph.js +150 -0
- package/dist/widgets/views/Graph/Graph.js.map +1 -0
- package/dist/widgets/views/Graph/GraphChart.d.ts +10 -0
- package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -0
- package/dist/widgets/views/Graph/GraphChart.js +104 -0
- package/dist/widgets/views/Graph/GraphChart.js.map +1 -0
- package/dist/widgets/views/Graph/GraphDefaults.d.ts +47 -0
- package/dist/widgets/views/Graph/GraphDefaults.d.ts.map +1 -0
- package/dist/widgets/views/Graph/GraphDefaults.js +62 -0
- package/dist/widgets/views/Graph/GraphDefaults.js.map +1 -0
- package/dist/widgets/views/Graph/GraphIndicator.d.ts +16 -0
- package/dist/widgets/views/Graph/GraphIndicator.d.ts.map +1 -0
- package/dist/widgets/views/Graph/GraphIndicator.js +292 -0
- package/dist/widgets/views/Graph/GraphIndicator.js.map +1 -0
- package/dist/widgets/views/Graph/useGraphData.d.ts +18 -0
- package/dist/widgets/views/Graph/useGraphData.d.ts.map +1 -0
- package/dist/widgets/views/Graph/useGraphData.js +163 -0
- package/dist/widgets/views/Graph/useGraphData.js.map +1 -0
- package/dist/widgets/views/SearchTree.d.ts +25 -0
- package/dist/widgets/views/SearchTree.d.ts.map +1 -0
- package/dist/widgets/views/SearchTree.js +495 -0
- package/dist/widgets/views/SearchTree.js.map +1 -0
- package/dist/widgets/views/Tree.d.ts +23 -0
- package/dist/widgets/views/Tree.d.ts.map +1 -0
- package/dist/widgets/views/Tree.js +180 -0
- package/dist/widgets/views/Tree.js.map +1 -0
- package/dist/widgets/views/searchFilter/DateRangePicker.d.ts +4 -0
- package/dist/widgets/views/searchFilter/DateRangePicker.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/DateRangePicker.js +26 -0
- package/dist/widgets/views/searchFilter/DateRangePicker.js.map +1 -0
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts +4 -0
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.js +53 -0
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.js.map +1 -0
- package/dist/widgets/views/searchFilter/PairFields.d.ts +4 -0
- package/dist/widgets/views/searchFilter/PairFields.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/PairFields.js +45 -0
- package/dist/widgets/views/searchFilter/PairFields.js.map +1 -0
- package/dist/widgets/views/searchFilter/SearchBottomBar.d.ts +10 -0
- package/dist/widgets/views/searchFilter/SearchBottomBar.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/SearchBottomBar.js +40 -0
- package/dist/widgets/views/searchFilter/SearchBottomBar.js.map +1 -0
- package/dist/widgets/views/searchFilter/SearchField.d.ts +8 -0
- package/dist/widgets/views/searchFilter/SearchField.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/SearchField.js +84 -0
- package/dist/widgets/views/searchFilter/SearchField.js.map +1 -0
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts +15 -0
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/SearchFilter.js +78 -0
- package/dist/widgets/views/searchFilter/SearchFilter.js.map +1 -0
- package/dist/widgets/views/searchFilter/SearchParams.d.ts +7 -0
- package/dist/widgets/views/searchFilter/SearchParams.d.ts.map +1 -0
- package/dist/widgets/views/searchFilter/SearchParams.js +44 -0
- package/dist/widgets/views/searchFilter/SearchParams.js.map +1 -0
- package/package.json +89 -0
- package/src/.eslintcache +1 -0
- package/src/Config.ts +4 -0
- package/src/ConnectionProvider.ts +16 -0
- package/src/__tests__/iconMapper.test.ts +15 -0
- package/src/__tests__/searchFilterHelper.spec.ts +386 -0
- package/src/actionbar/ActionButton.tsx +40 -0
- package/src/actionbar/AttachmentsButton.tsx +128 -0
- package/src/actionbar/AttachmentsButtonWrapper.tsx +139 -0
- package/src/actionbar/ButtonWithBadge.tsx +39 -0
- package/src/actionbar/ChangeViewButton.tsx +136 -0
- package/src/actionbar/DashboardActionBar.tsx +67 -0
- package/src/actionbar/DropdownButton.tsx +61 -0
- package/src/actionbar/FormActionBar.tsx +412 -0
- package/src/actionbar/NewButton.tsx +46 -0
- package/src/actionbar/SearchBar.tsx +69 -0
- package/src/actionbar/TreeActionBar.tsx +265 -0
- package/src/common/ButtonWithTooltip.tsx +18 -0
- package/src/common/DatePicker.tsx +93 -0
- package/src/common/Field.tsx +92 -0
- package/src/context/ActionViewContext.tsx +161 -0
- package/src/context/ContentRootContext.tsx +422 -0
- package/src/context/DashboardActionContext.tsx +45 -0
- package/src/context/FormContext.tsx +79 -0
- package/src/context/FormModalContext.tsx +29 -0
- package/src/context/LocaleContext.tsx +50 -0
- package/src/context/One2manyContext.tsx +46 -0
- package/src/context/TabManagerContext.tsx +117 -0
- package/src/helpers/containerHelper.ts +145 -0
- package/src/helpers/dynamicColumnsHelper.ts +73 -0
- package/src/helpers/filesHelper.ts +41 -0
- package/src/helpers/formHelper.ts +225 -0
- package/src/helpers/iconMapper.ts +108 -0
- package/src/helpers/logInfoHelper.tsx +28 -0
- package/src/helpers/one2manyHelper.ts +139 -0
- package/src/helpers/searchFilterHelper.ts +167 -0
- package/src/helpers/timeHelper.ts +58 -0
- package/src/helpers/treeHelper.ts +127 -0
- package/src/hooks/useEffectDebugger.ts +43 -0
- package/src/hooks/useWindowDimensions.ts +33 -0
- package/src/index.ts +136 -0
- package/src/locales/ca_ES.tsx +85 -0
- package/src/locales/en_US.tsx +82 -0
- package/src/locales/es_ES.tsx +86 -0
- package/src/stories/Binary.stories.tsx +23 -0
- package/src/stories/Boolean.stories.tsx +22 -0
- package/src/stories/Button.stories.tsx +120 -0
- package/src/stories/Char.stories.tsx +49 -0
- package/src/stories/FiberGrid.stories.tsx +109 -0
- package/src/stories/Float.stories.tsx +22 -0
- package/src/stories/FloatTime.stories.tsx +32 -0
- package/src/stories/Image.stories.tsx +25 -0
- package/src/stories/Integer.stories.tsx +22 -0
- package/src/stories/Label.stories.tsx +22 -0
- package/src/stories/Many2one.stories.tsx +31 -0
- package/src/stories/One2many.stories.tsx +292 -0
- package/src/stories/ProgressBar.stories.tsx +22 -0
- package/src/stories/Reference.stories.tsx +43 -0
- package/src/stories/Selection.stories.tsx +34 -0
- package/src/stories/Separator.stories.tsx +21 -0
- package/src/stories/Text.stories.tsx +35 -0
- package/src/stories/containers/Group.stories.tsx +63 -0
- package/src/stories/containers/NewLine.stories.tsx +53 -0
- package/src/stories/containers/Notebook.stories.tsx +91 -0
- package/src/stories/custom/Indicator.stories.tsx +41 -0
- package/src/stories/dashboard/Dashboard.stories.tsx +23 -0
- package/src/stories/dashboard/DashboardGrid.stories.tsx +30 -0
- package/src/stories/forms/Attachment.stories.tsx +24 -0
- package/src/stories/forms/CUPSForm.stories.tsx +25 -0
- package/src/stories/forms/Company.stories.tsx +25 -0
- package/src/stories/forms/CrmCaseForm.stories.tsx +25 -0
- package/src/stories/forms/Documents.stories.tsx +25 -0
- package/src/stories/forms/FormWithGridFiber.stories.tsx +25 -0
- package/src/stories/forms/FormWithLinks.stories.tsx +31 -0
- package/src/stories/forms/Lead.stories.tsx +25 -0
- package/src/stories/forms/ModContractForm.stories.tsx +25 -0
- package/src/stories/forms/PartnersForm.stories.tsx +25 -0
- package/src/stories/forms/PolissaForm.stories.tsx +25 -0
- package/src/stories/forms/PreferencesForm.stories.tsx +693 -0
- package/src/stories/forms/Signatures.stories.tsx +25 -0
- package/src/stories/forms/Switching.stories.tsx +25 -0
- package/src/stories/graphs/GraphIndicator.stories.tsx +20 -0
- package/src/stories/graphs/PieGraph.stories.tsx +78 -0
- package/src/stories/mocks/index.ts +42 -0
- package/src/stories/mocks/mockProvider.ts +180 -0
- package/src/stories/mocks/models/attachment.ts +1327 -0
- package/src/stories/mocks/models/butlleti.ts +344 -0
- package/src/stories/mocks/models/company.ts +137 -0
- package/src/stories/mocks/models/crm_case.ts +598 -0
- package/src/stories/mocks/models/cups.ts +910 -0
- package/src/stories/mocks/models/document.ts +225 -0
- package/src/stories/mocks/models/factura.ts +2727 -0
- package/src/stories/mocks/models/form_with_gridfiber.ts +143 -0
- package/src/stories/mocks/models/hist_autoconsum.ts +148 -0
- package/src/stories/mocks/models/lead.ts +2109 -0
- package/src/stories/mocks/models/modcontractual.ts +806 -0
- package/src/stories/mocks/models/partner.ts +1360 -0
- package/src/stories/mocks/models/polissa.ts +3133 -0
- package/src/stories/mocks/models/signatura.ts +618 -0
- package/src/stories/mocks/models/switching.ts +769 -0
- package/src/stories/modals/FormModal.stories.tsx +36 -0
- package/src/stories/modals/SearchModal.stories.tsx +37 -0
- package/src/stories/trees/FacturesTree.stories.tsx +16 -0
- package/src/stories/ui/ActionBar.stories.tsx +23 -0
- package/src/stories/ui/FavouriteButton.stories.tsx +18 -0
- package/src/stories/ui/GoToResourceModal.stories.tsx +26 -0
- package/src/stories/views/ActionView.stories.tsx +28 -0
- package/src/stories/views/SearchTree.stories.tsx +946 -0
- package/src/stories/views/Tab.stories.tsx +94 -0
- package/src/stories/views/TabManager.stories.tsx +15 -0
- package/src/stories/views/TabsAndContent.stories.tsx +89 -0
- package/src/stories/views/Tree.stories.js +166 -0
- package/src/stories/views/searchFilter/DateRangePicker.stories.tsx +23 -0
- package/src/stories/views/searchFilter/DateTimeRangePicker.stories.tsx +23 -0
- package/src/stories/views/searchFilter/PairFields.stories.tsx +23 -0
- package/src/stories/views/searchFilter/SearchFilter.stories.tsx +166 -0
- package/src/stories/views/searchFilter/examples/PartnersSearchFilter.stories.tsx +425 -0
- package/src/tailwind.css +8 -0
- package/src/tailwind.generated.css +168533 -0
- package/src/types/index.ts +275 -0
- package/src/ui/ActionErrorDialog.tsx +41 -0
- package/src/ui/ConfirmDialog.tsx +28 -0
- package/src/ui/FavouriteButton.tsx +261 -0
- package/src/ui/Fieldset.tsx +31 -0
- package/src/ui/FormErrorsDialog.tsx +17 -0
- package/src/ui/GenericErrorDialog.tsx +16 -0
- package/src/ui/GoToResourceModal.tsx +71 -0
- package/src/ui/InfoDialog.tsx +13 -0
- package/src/ui/RefreshItemDialog.tsx +29 -0
- package/src/ui/RemoveItemDialog.tsx +20 -0
- package/src/ui/TitleHeader.tsx +95 -0
- package/src/ui/UnlinkItemDialog.tsx +20 -0
- package/src/ui/UnsavedChangesDialog.tsx +29 -0
- package/src/ui/WarningDialog.tsx +17 -0
- package/src/views/ActionView.tsx +455 -0
- package/src/views/CurrentTabContent.tsx +21 -0
- package/src/views/RootView.tsx +467 -0
- package/src/views/TabContent.tsx +31 -0
- package/src/views/TabSelector.tsx +31 -0
- package/src/views/Welcome.tsx +18 -0
- package/src/views/tabs/Tab.tsx +77 -0
- package/src/widgets/WidgetFactory.tsx +109 -0
- package/src/widgets/base/Binary.tsx +141 -0
- package/src/widgets/base/Boolean.tsx +44 -0
- package/src/widgets/base/Button.tsx +77 -0
- package/src/widgets/base/Char.tsx +155 -0
- package/src/widgets/base/Date.tsx +12 -0
- package/src/widgets/base/DateTime.tsx +12 -0
- package/src/widgets/base/Email.tsx +27 -0
- package/src/widgets/base/Float.tsx +33 -0
- package/src/widgets/base/FloatTime.tsx +69 -0
- package/src/widgets/base/Image.tsx +120 -0
- package/src/widgets/base/Integer.tsx +38 -0
- package/src/widgets/base/Label.tsx +40 -0
- package/src/widgets/base/LinkInput.tsx +96 -0
- package/src/widgets/base/MultiSelection.tsx +82 -0
- package/src/widgets/base/ProgressBar.tsx +38 -0
- package/src/widgets/base/Reference.tsx +105 -0
- package/src/widgets/base/Selection.tsx +61 -0
- package/src/widgets/base/Separator.tsx +18 -0
- package/src/widgets/base/Text.tsx +156 -0
- package/src/widgets/base/Url.tsx +26 -0
- package/src/widgets/base/many2one/Many2one.tsx +331 -0
- package/src/widgets/base/many2one/Many2oneSuffix.tsx +210 -0
- package/src/widgets/base/many2one/Many2oneSuffixModal.tsx +41 -0
- package/src/widgets/base/one2many/One2many.tsx +102 -0
- package/src/widgets/base/one2many/One2manyInput.tsx +635 -0
- package/src/widgets/base/one2many/One2manyTopBar.tsx +143 -0
- package/src/widgets/containers/Container.tsx +97 -0
- package/src/widgets/containers/Group.tsx +34 -0
- package/src/widgets/containers/Notebook.tsx +35 -0
- package/src/widgets/custom/FiberGrid.tsx +51 -0
- package/src/widgets/custom/Indicator.tsx +66 -0
- package/src/widgets/custom/Timeline.tsx +190 -0
- package/src/widgets/modals/FormModal.tsx +127 -0
- package/src/widgets/modals/SearchModal.tsx +131 -0
- package/src/widgets/modals/TranslationModal.tsx +201 -0
- package/src/widgets/views/Dashboard/Dashboard.tsx +371 -0
- package/src/widgets/views/Dashboard/Dashboard.types.ts +8 -0
- package/src/widgets/views/Dashboard/DashboardForm.tsx +30 -0
- package/src/widgets/views/Dashboard/DashboardTree.tsx +287 -0
- package/src/widgets/views/Dashboard/dashboardHelper.ts +71 -0
- package/src/widgets/views/DashboardGrid/DashboardGrid.tsx +53 -0
- package/src/widgets/views/DashboardGrid/DashboardGrid.types.ts +4 -0
- package/src/widgets/views/DashboardGrid/DashboardGridItem.tsx +58 -0
- package/src/widgets/views/DashboardGrid/DashboardGridItem.types.ts +10 -0
- package/src/widgets/views/DashboardGrid/index.ts +4 -0
- package/src/widgets/views/Form.tsx +991 -0
- package/src/widgets/views/Graph/Graph.tsx +108 -0
- package/src/widgets/views/Graph/GraphChart.tsx +102 -0
- package/src/widgets/views/Graph/GraphDefaults.ts +57 -0
- package/src/widgets/views/Graph/GraphIndicator.tsx +360 -0
- package/src/widgets/views/Graph/useGraphData.tsx +142 -0
- package/src/widgets/views/SearchTree.tsx +542 -0
- package/src/widgets/views/Tree.tsx +267 -0
- package/src/widgets/views/searchFilter/DateRangePicker.tsx +16 -0
- package/src/widgets/views/searchFilter/DateTimeRangePicker.tsx +63 -0
- package/src/widgets/views/searchFilter/PairFields.tsx +56 -0
- package/src/widgets/views/searchFilter/SearchBottomBar.tsx +58 -0
- package/src/widgets/views/searchFilter/SearchField.tsx +73 -0
- package/src/widgets/views/searchFilter/SearchFilter.tsx +113 -0
- package/src/widgets/views/searchFilter/SearchParams.tsx +32 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useContext,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from "react";
|
|
9
|
+
import ActionView from "@/views/ActionView";
|
|
10
|
+
import { DashboardProps } from "./Dashboard.types";
|
|
11
|
+
import { fetchAction } from "./dashboardHelper";
|
|
12
|
+
import "react-resizable/css/styles.css";
|
|
13
|
+
import "react-grid-layout/css/styles.css";
|
|
14
|
+
import { Graph } from "../Graph/Graph";
|
|
15
|
+
import { DashboardGrid, DashboardGridItem } from "../DashboardGrid";
|
|
16
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
17
|
+
import { FormView } from "@/types";
|
|
18
|
+
import { One2manyItem } from "@/index";
|
|
19
|
+
import { readObjectValues } from "@/helpers/one2manyHelper";
|
|
20
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
21
|
+
import { Alert } from "antd";
|
|
22
|
+
import {
|
|
23
|
+
DashboardActionContext,
|
|
24
|
+
DashboardActionContextType,
|
|
25
|
+
} from "@/context/DashboardActionContext";
|
|
26
|
+
import { ShortcutApi } from "@/ui/FavouriteButton";
|
|
27
|
+
import DashboardTree from "./DashboardTree";
|
|
28
|
+
import { DashboardForm } from "./DashboardForm";
|
|
29
|
+
|
|
30
|
+
const itemsField = "line_ids";
|
|
31
|
+
|
|
32
|
+
function Dashboard(props: DashboardProps, ref: any) {
|
|
33
|
+
const { model, context = {}, id, configAction } = props;
|
|
34
|
+
const [dashboardItems, setDashboardItems] = useState<any[]>([]);
|
|
35
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
36
|
+
const [error, setError] = useState<string>();
|
|
37
|
+
const {
|
|
38
|
+
setIsLoading: setActionBarLoading,
|
|
39
|
+
openAction,
|
|
40
|
+
moveItemsEnabled,
|
|
41
|
+
} = useContext(DashboardActionContext) as DashboardActionContextType;
|
|
42
|
+
|
|
43
|
+
const itemsFields = useRef<any>();
|
|
44
|
+
const boardFields = useRef<any>();
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
fetchData();
|
|
48
|
+
}, [model, id, context]);
|
|
49
|
+
|
|
50
|
+
useImperativeHandle(ref, () => ({
|
|
51
|
+
refresh: () => {
|
|
52
|
+
fetchData();
|
|
53
|
+
},
|
|
54
|
+
configDashboard: openConfigDashboard,
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
async function fetchData() {
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
setActionBarLoading(true);
|
|
60
|
+
setError(undefined);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const view = await fetchView();
|
|
64
|
+
const values = await fetchValues(view);
|
|
65
|
+
const model = view.fields[itemsField].relation;
|
|
66
|
+
const items: One2manyItem[] = values[itemsField].items;
|
|
67
|
+
boardFields.current = view.fields;
|
|
68
|
+
|
|
69
|
+
const originalItems: One2manyItem[] = await fetchDashboardItems({
|
|
70
|
+
items,
|
|
71
|
+
model,
|
|
72
|
+
context,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const itemsWithActions = await getItemsWithActions(originalItems);
|
|
76
|
+
setDashboardItems(itemsWithActions);
|
|
77
|
+
setIsLoading(false);
|
|
78
|
+
setActionBarLoading(false);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
setError(JSON.stringify(err));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function fetchView() {
|
|
85
|
+
return await ConnectionProvider.getHandler().getView({
|
|
86
|
+
model,
|
|
87
|
+
type: "form",
|
|
88
|
+
context,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function fetchDashboardItems({
|
|
93
|
+
items,
|
|
94
|
+
model,
|
|
95
|
+
context,
|
|
96
|
+
}: {
|
|
97
|
+
items: One2manyItem[];
|
|
98
|
+
model: string;
|
|
99
|
+
context: any;
|
|
100
|
+
}) {
|
|
101
|
+
itemsFields.current = (
|
|
102
|
+
await ConnectionProvider.getHandler().getView({
|
|
103
|
+
model,
|
|
104
|
+
type: "form",
|
|
105
|
+
context,
|
|
106
|
+
})
|
|
107
|
+
).fields;
|
|
108
|
+
|
|
109
|
+
return await readObjectValues({
|
|
110
|
+
treeFields: itemsFields.current,
|
|
111
|
+
formFields: itemsFields.current,
|
|
112
|
+
model,
|
|
113
|
+
items,
|
|
114
|
+
context,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function fetchValues(view: FormView) {
|
|
119
|
+
return (
|
|
120
|
+
await ConnectionProvider.getHandler().readObjects({
|
|
121
|
+
arch: view.arch,
|
|
122
|
+
model,
|
|
123
|
+
ids: [id],
|
|
124
|
+
fields: view.fields,
|
|
125
|
+
context,
|
|
126
|
+
})
|
|
127
|
+
)[0];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function getItemsWithActions(items: One2manyItem[]) {
|
|
131
|
+
const itemsWithActions = [];
|
|
132
|
+
|
|
133
|
+
for (const dashboardItem of items) {
|
|
134
|
+
const { values } = dashboardItem;
|
|
135
|
+
if (values.action_id && values.action_id.length > 0) {
|
|
136
|
+
const actionId = parseInt(values.action_id[0], 10);
|
|
137
|
+
const actionData = await fetchAction({
|
|
138
|
+
actionId,
|
|
139
|
+
rootContext: context,
|
|
140
|
+
});
|
|
141
|
+
itemsWithActions.push({ ...dashboardItem, actionData });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return itemsWithActions;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function onPositionItemsChanged(itemPositions: any[]) {
|
|
149
|
+
if (!moveItemsEnabled) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const differences = itemPositions.filter((itemPosition) => {
|
|
154
|
+
const dashboardItem = dashboardItems.find(
|
|
155
|
+
(dashboardItem) => dashboardItem.id === itemPosition.id
|
|
156
|
+
);
|
|
157
|
+
if (!dashboardItem) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!dashboardItem.position) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const remotePosition = {
|
|
166
|
+
...JSON.parse(dashboardItem.position.replace(/'/g, '"')),
|
|
167
|
+
id: dashboardItem.id,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return JSON.stringify(itemPosition) !== JSON.stringify(remotePosition);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
if (differences.length === 0) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const itemsToUpdate = dashboardItems.filter((dashboardItem) => {
|
|
178
|
+
return differences.map((diff) => diff.id).includes(dashboardItem.id);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const itemsToUpdateWithUpdatedPos = itemsToUpdate.map((dashboardItem) => {
|
|
182
|
+
const diffItem = {
|
|
183
|
+
...differences.find((diffItem) => diffItem.id === dashboardItem.id),
|
|
184
|
+
};
|
|
185
|
+
delete diffItem.id;
|
|
186
|
+
|
|
187
|
+
const item = { ...dashboardItem };
|
|
188
|
+
delete item.actionData;
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
...dashboardItem,
|
|
192
|
+
operation: "pendingUpdate",
|
|
193
|
+
values: {
|
|
194
|
+
...dashboardItem.values,
|
|
195
|
+
position: JSON.stringify(diffItem).replace(/"/g, "'"),
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const valueToUpdate = {
|
|
201
|
+
fields: itemsFields.current,
|
|
202
|
+
items: itemsToUpdateWithUpdatedPos,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
await ConnectionProvider.getHandler().update({
|
|
206
|
+
model,
|
|
207
|
+
id,
|
|
208
|
+
values: { [itemsField]: valueToUpdate },
|
|
209
|
+
fields: boardFields.current,
|
|
210
|
+
context,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function openConfigDashboard() {
|
|
215
|
+
openAction(configAction);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (error) {
|
|
219
|
+
return (
|
|
220
|
+
<Alert className="mt-10 mb-20" message={error} type="error" banner />
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (isLoading) {
|
|
225
|
+
return <LoadingOutlined />;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<DashboardGrid onPositionItemsChanged={onPositionItemsChanged}>
|
|
230
|
+
{dashboardItems.map((item, idx) => {
|
|
231
|
+
const { actionData, values } = item;
|
|
232
|
+
const { position, id } = values;
|
|
233
|
+
|
|
234
|
+
const {
|
|
235
|
+
actionId,
|
|
236
|
+
actionType,
|
|
237
|
+
key,
|
|
238
|
+
title,
|
|
239
|
+
views,
|
|
240
|
+
model,
|
|
241
|
+
context,
|
|
242
|
+
domain,
|
|
243
|
+
initialView,
|
|
244
|
+
limit,
|
|
245
|
+
} = actionData as any;
|
|
246
|
+
|
|
247
|
+
let parmsParsed = {};
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
parmsParsed = JSON.parse(position.replace(/'/g, '"'));
|
|
251
|
+
} catch (err) {
|
|
252
|
+
// console.error(`Error parsing parms: ${action.position}`);
|
|
253
|
+
parmsParsed = { x: idx * 2, y: 0, w: 2, h: 3 };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let childContent = null;
|
|
257
|
+
|
|
258
|
+
if (initialView?.type === "graph") {
|
|
259
|
+
childContent = (
|
|
260
|
+
<Graph
|
|
261
|
+
view_id={
|
|
262
|
+
views.filter(
|
|
263
|
+
(view: [number, string]) => view[1] === "graph"
|
|
264
|
+
)[0][0]
|
|
265
|
+
}
|
|
266
|
+
model={model}
|
|
267
|
+
context={context}
|
|
268
|
+
domain={domain}
|
|
269
|
+
limit={limit}
|
|
270
|
+
/>
|
|
271
|
+
);
|
|
272
|
+
} else if (initialView?.type === "form") {
|
|
273
|
+
childContent = <DashboardForm model={model} actionDomain={domain} />;
|
|
274
|
+
} else if (initialView?.type === "tree") {
|
|
275
|
+
childContent = (
|
|
276
|
+
<DashboardTree
|
|
277
|
+
model={model}
|
|
278
|
+
domain={domain}
|
|
279
|
+
view_id={
|
|
280
|
+
views.filter(
|
|
281
|
+
(view: [number, string]) => view[1] === "tree"
|
|
282
|
+
)[0][0]
|
|
283
|
+
}
|
|
284
|
+
onRowClicked={(record) => {
|
|
285
|
+
const formView = views.find((view: any[]) => {
|
|
286
|
+
const [, type] = view;
|
|
287
|
+
return type === "form";
|
|
288
|
+
});
|
|
289
|
+
if (formView) {
|
|
290
|
+
const [id, type] = formView;
|
|
291
|
+
const {
|
|
292
|
+
actionId: action_id,
|
|
293
|
+
actionType: action_type,
|
|
294
|
+
title: name,
|
|
295
|
+
model: res_model,
|
|
296
|
+
} = actionData;
|
|
297
|
+
|
|
298
|
+
const action: ShortcutApi = {
|
|
299
|
+
action_id,
|
|
300
|
+
action_type,
|
|
301
|
+
name,
|
|
302
|
+
res_id: record.id,
|
|
303
|
+
res_model,
|
|
304
|
+
view_id: id,
|
|
305
|
+
view_type: type,
|
|
306
|
+
};
|
|
307
|
+
openAction(action);
|
|
308
|
+
}
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
);
|
|
312
|
+
} else if (initialView !== undefined) {
|
|
313
|
+
childContent = (
|
|
314
|
+
<ActionView
|
|
315
|
+
action_id={actionId}
|
|
316
|
+
action_type={actionType}
|
|
317
|
+
tabKey={key}
|
|
318
|
+
title={title}
|
|
319
|
+
views={views}
|
|
320
|
+
model={model}
|
|
321
|
+
context={context}
|
|
322
|
+
domain={domain}
|
|
323
|
+
setCanWeClose={() => {}}
|
|
324
|
+
initialView={initialView}
|
|
325
|
+
/>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
let action: ShortcutApi;
|
|
330
|
+
const treeView = views.find((view: any[]) => {
|
|
331
|
+
const [, type] = view;
|
|
332
|
+
return type === "tree";
|
|
333
|
+
});
|
|
334
|
+
if (treeView) {
|
|
335
|
+
const [id, type] = treeView;
|
|
336
|
+
const {
|
|
337
|
+
actionId: action_id,
|
|
338
|
+
actionType: action_type,
|
|
339
|
+
title: name,
|
|
340
|
+
model: res_model,
|
|
341
|
+
} = actionData;
|
|
342
|
+
|
|
343
|
+
action = {
|
|
344
|
+
action_id,
|
|
345
|
+
action_type,
|
|
346
|
+
name,
|
|
347
|
+
res_id: false,
|
|
348
|
+
res_model,
|
|
349
|
+
view_id: id,
|
|
350
|
+
view_type: type,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<DashboardGridItem
|
|
356
|
+
key={id}
|
|
357
|
+
id={id}
|
|
358
|
+
title={title}
|
|
359
|
+
parms={parmsParsed}
|
|
360
|
+
action={action!}
|
|
361
|
+
openAction={openAction}
|
|
362
|
+
>
|
|
363
|
+
{childContent}
|
|
364
|
+
</DashboardGridItem>
|
|
365
|
+
);
|
|
366
|
+
})}
|
|
367
|
+
</DashboardGrid>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export default forwardRef(Dashboard);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import Form, { FormProps } from "../Form";
|
|
4
|
+
|
|
5
|
+
export const DashboardForm = (props: FormProps) => {
|
|
6
|
+
const { model } = props;
|
|
7
|
+
const [firstId, setFirstId] = useState<number>();
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
fetchData();
|
|
11
|
+
}, [model]);
|
|
12
|
+
|
|
13
|
+
async function fetchData() {
|
|
14
|
+
const results: any[] = (await ConnectionProvider.getHandler().search({
|
|
15
|
+
params: [],
|
|
16
|
+
model,
|
|
17
|
+
limit: 1,
|
|
18
|
+
})) as any;
|
|
19
|
+
|
|
20
|
+
if (results.length > 0) {
|
|
21
|
+
setFirstId(results[0].id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div style={{ padding: "0.5rem", overflowY: "scroll" }}>
|
|
27
|
+
<Form {...props} model={model} id={firstId} readOnly />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import { Alert, Spin } from "antd";
|
|
3
|
+
|
|
4
|
+
import Tree from "@/widgets/views/Tree";
|
|
5
|
+
import { FormView, TreeView } from "@/types/index";
|
|
6
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
7
|
+
|
|
8
|
+
import { getColorMap, getTree } from "@/helpers/treeHelper";
|
|
9
|
+
|
|
10
|
+
const DEFAULT_SEARCH_LIMIT = 80;
|
|
11
|
+
|
|
12
|
+
type OnRowClickedData = {
|
|
13
|
+
id: number;
|
|
14
|
+
model: string;
|
|
15
|
+
treeView: TreeView;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
action?: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
view_id?: number;
|
|
22
|
+
onRowClicked: (data: OnRowClickedData) => void;
|
|
23
|
+
domain?: any;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
parentContext?: any;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function DashboardTree(props: Props) {
|
|
29
|
+
const {
|
|
30
|
+
action,
|
|
31
|
+
model,
|
|
32
|
+
view_id,
|
|
33
|
+
onRowClicked,
|
|
34
|
+
domain = [],
|
|
35
|
+
visible = true,
|
|
36
|
+
parentContext = {},
|
|
37
|
+
} = props;
|
|
38
|
+
|
|
39
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
40
|
+
const [initialFetchDone, setInitialFetchDone] = useState<boolean>(false);
|
|
41
|
+
|
|
42
|
+
const [currentModel, setCurrentModel] = useState<string>();
|
|
43
|
+
const [treeView, setTreeView] = useState<TreeView>();
|
|
44
|
+
const [formView, setFormView] = useState<FormView>();
|
|
45
|
+
|
|
46
|
+
const [page, setPage] = useState<number>(1);
|
|
47
|
+
const [offset, setOffset] = useState<number>(0);
|
|
48
|
+
const limitRef = useRef<number>(DEFAULT_SEARCH_LIMIT);
|
|
49
|
+
|
|
50
|
+
const paramsRef = useRef<Array<any>>([]);
|
|
51
|
+
|
|
52
|
+
const [totalItems, setTotalItems] = useState<number>(0);
|
|
53
|
+
const [results, setResults] = useState<any>([]);
|
|
54
|
+
const [colorsForResults, setColorsForResults] = useState<any>(undefined);
|
|
55
|
+
const [sorter, setSorter] = useState<any>();
|
|
56
|
+
|
|
57
|
+
const [searchError, setSearchError] = useState<string>();
|
|
58
|
+
const [initialError, setInitialError] = useState<string>();
|
|
59
|
+
|
|
60
|
+
const [tableRefreshing, setTableRefreshing] = useState<boolean>(false);
|
|
61
|
+
|
|
62
|
+
const actionDomain = useRef<any>([]);
|
|
63
|
+
|
|
64
|
+
const onRequestPageChange = (page: number) => {
|
|
65
|
+
setTableRefreshing(true);
|
|
66
|
+
setPage(page);
|
|
67
|
+
setOffset((page - 1) * limitRef.current!);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const getUniqueFieldsForParams = (params: any[]) => {
|
|
71
|
+
const uniqueFields: any = {};
|
|
72
|
+
|
|
73
|
+
params.forEach((param) => {
|
|
74
|
+
if (Array.isArray(param) && param[0]) {
|
|
75
|
+
uniqueFields[param[0]] = true;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return Object.keys(uniqueFields);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const mergeParams = (searchParams: any[], domainParams: any[]) => {
|
|
83
|
+
const finalParams = searchParams;
|
|
84
|
+
const uniqueParams = getUniqueFieldsForParams(searchParams);
|
|
85
|
+
|
|
86
|
+
domainParams.forEach((element) => {
|
|
87
|
+
if (Array.isArray(element) && element[0]) {
|
|
88
|
+
if (!uniqueParams.includes(element[0])) {
|
|
89
|
+
finalParams.push(element);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return finalParams;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const searchResults = async () => {
|
|
98
|
+
const domainParams =
|
|
99
|
+
actionDomain.current.length > 0 ? actionDomain.current : domain;
|
|
100
|
+
|
|
101
|
+
const searchParams = mergeParams(paramsRef.current, domainParams);
|
|
102
|
+
const { colors } = getTree(treeView!);
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
totalItems,
|
|
106
|
+
results,
|
|
107
|
+
attrsEvaluated,
|
|
108
|
+
} = await ConnectionProvider.getHandler().searchForTree({
|
|
109
|
+
params: searchParams,
|
|
110
|
+
limit: limitRef.current,
|
|
111
|
+
offset,
|
|
112
|
+
model: currentModel!,
|
|
113
|
+
fields: treeView!.fields,
|
|
114
|
+
context: parentContext,
|
|
115
|
+
attrs: colors && { colors },
|
|
116
|
+
});
|
|
117
|
+
setTotalItems(totalItems);
|
|
118
|
+
setColorsForResults(getColorMap(attrsEvaluated));
|
|
119
|
+
|
|
120
|
+
const resultsSorted = sortResults(results, sorter);
|
|
121
|
+
setResults(resultsSorted);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const fetchResults = async () => {
|
|
125
|
+
try {
|
|
126
|
+
setTableRefreshing(true);
|
|
127
|
+
await searchResults();
|
|
128
|
+
} catch (error) {
|
|
129
|
+
setSearchError(JSON.stringify(error));
|
|
130
|
+
} finally {
|
|
131
|
+
setTableRefreshing(false);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (!initialFetchDone) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (visible) {
|
|
141
|
+
fetchResults();
|
|
142
|
+
}
|
|
143
|
+
}, [page, offset, initialFetchDone, visible]);
|
|
144
|
+
|
|
145
|
+
const fetchData = async (type: "action" | "model") => {
|
|
146
|
+
setInitialFetchDone(false);
|
|
147
|
+
setIsLoading(true);
|
|
148
|
+
setInitialError(undefined);
|
|
149
|
+
|
|
150
|
+
try {
|
|
151
|
+
if (type === "action") {
|
|
152
|
+
await fetchActionData();
|
|
153
|
+
} else {
|
|
154
|
+
await fetchModelData();
|
|
155
|
+
}
|
|
156
|
+
setInitialFetchDone(true);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
setInitialError(error);
|
|
159
|
+
} finally {
|
|
160
|
+
setIsLoading(false);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const fetchActionData = async () => {
|
|
165
|
+
const dataForAction = await ConnectionProvider.getHandler().getViewsForAction(
|
|
166
|
+
{
|
|
167
|
+
action: action!,
|
|
168
|
+
context: parentContext,
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
actionDomain.current = dataForAction.domain;
|
|
172
|
+
setFormView(dataForAction.views.get("form"));
|
|
173
|
+
setTreeView(dataForAction.views.get("tree"));
|
|
174
|
+
setCurrentModel(dataForAction.model);
|
|
175
|
+
limitRef.current = dataForAction.limit;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const fetchModelData = async () => {
|
|
179
|
+
setCurrentModel(model);
|
|
180
|
+
|
|
181
|
+
const _formView = (await ConnectionProvider.getHandler().getView({
|
|
182
|
+
model: model!,
|
|
183
|
+
type: "form",
|
|
184
|
+
context: parentContext,
|
|
185
|
+
})) as FormView;
|
|
186
|
+
setFormView(_formView as FormView);
|
|
187
|
+
|
|
188
|
+
const _treeView = (await ConnectionProvider.getHandler().getView({
|
|
189
|
+
model: model!,
|
|
190
|
+
type: "tree",
|
|
191
|
+
id: view_id,
|
|
192
|
+
context: parentContext,
|
|
193
|
+
})) as TreeView;
|
|
194
|
+
|
|
195
|
+
setTreeView(_treeView as TreeView);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
if (action) {
|
|
200
|
+
fetchData("action");
|
|
201
|
+
} else if (model) {
|
|
202
|
+
fetchData("model");
|
|
203
|
+
}
|
|
204
|
+
}, [action, model]);
|
|
205
|
+
|
|
206
|
+
const onRowClickedHandler = (id: number) => {
|
|
207
|
+
onRowClicked({
|
|
208
|
+
id,
|
|
209
|
+
model: currentModel!,
|
|
210
|
+
treeView: treeView!,
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
function sortResults(resultsToSort: any[], sorter: any) {
|
|
215
|
+
if (!sorter) {
|
|
216
|
+
return resultsToSort;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const { field, order } = sorter;
|
|
220
|
+
const fields = { ...treeView!.fields, ...formView!.fields };
|
|
221
|
+
const type = fields[field].type;
|
|
222
|
+
|
|
223
|
+
const sortFn = (a: any, b: any) => {
|
|
224
|
+
let aItem = a[field] || "",
|
|
225
|
+
bItem = b[field] || "";
|
|
226
|
+
|
|
227
|
+
if (type === "many2one") {
|
|
228
|
+
aItem = a[field]?.value || "";
|
|
229
|
+
bItem = b[field]?.value || "";
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (aItem === bItem) {
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (order === "ascend") {
|
|
237
|
+
return aItem > bItem ? 1 : -1;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return aItem < bItem ? 1 : -1;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
return resultsToSort.sort(sortFn);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const content = () => {
|
|
247
|
+
if (!treeView || !formView) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<div style={{ overflowY: "scroll" }}>
|
|
253
|
+
{searchError && (
|
|
254
|
+
<Alert className="mt-10" message={searchError} type="error" banner />
|
|
255
|
+
)}
|
|
256
|
+
<Tree
|
|
257
|
+
showPagination={false}
|
|
258
|
+
total={totalItems}
|
|
259
|
+
limit={limitRef.current}
|
|
260
|
+
disableScroll
|
|
261
|
+
page={page}
|
|
262
|
+
treeView={treeView}
|
|
263
|
+
results={results}
|
|
264
|
+
onRequestPageChange={onRequestPageChange}
|
|
265
|
+
loading={tableRefreshing}
|
|
266
|
+
onRowClicked={onRowClickedHandler}
|
|
267
|
+
colorsForResults={colorsForResults}
|
|
268
|
+
onChangeSort={(newSorter) => {
|
|
269
|
+
setSorter?.(newSorter);
|
|
270
|
+
const sortedResults = sortResults(results, newSorter);
|
|
271
|
+
setResults(sortedResults);
|
|
272
|
+
}}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
if (initialError) {
|
|
279
|
+
return (
|
|
280
|
+
<Alert className="mt-10" message={initialError} type="error" banner />
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return isLoading ? <Spin style={{ padding: "2rem" }} /> : content();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export default DashboardTree;
|