@gisce/react-ooui 1.2.0-rc.9 → 1.2.0-rc.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/dist/actionbar/ActionButton.d.ts +2 -2
- package/dist/actionbar/ActionButton.d.ts.map +1 -1
- package/dist/actionbar/AttachmentsButton.d.ts +2 -2
- package/dist/actionbar/AttachmentsButton.d.ts.map +1 -1
- package/dist/actionbar/AttachmentsButtonWrapper.d.ts +2 -2
- package/dist/actionbar/AttachmentsButtonWrapper.d.ts.map +1 -1
- package/dist/actionbar/ButtonWithBadge.d.ts +2 -2
- package/dist/actionbar/ButtonWithBadge.d.ts.map +1 -1
- package/dist/actionbar/ChangeViewButton.d.ts +2 -2
- package/dist/actionbar/ChangeViewButton.d.ts.map +1 -1
- package/dist/actionbar/DashboardActionBar.d.ts +2 -2
- package/dist/actionbar/DashboardActionBar.d.ts.map +1 -1
- package/dist/actionbar/DropdownButton.d.ts +2 -2
- package/dist/actionbar/DropdownButton.d.ts.map +1 -1
- package/dist/actionbar/FormActionBar.d.ts +2 -2
- package/dist/actionbar/FormActionBar.d.ts.map +1 -1
- package/dist/actionbar/GraphActionBar.d.ts +2 -2
- package/dist/actionbar/GraphActionBar.d.ts.map +1 -1
- package/dist/actionbar/NewButton.d.ts +2 -2
- package/dist/actionbar/NewButton.d.ts.map +1 -1
- package/dist/actionbar/SearchBar.d.ts +2 -2
- package/dist/actionbar/SearchBar.d.ts.map +1 -1
- package/dist/actionbar/TreeActionBar.d.ts +2 -2
- package/dist/actionbar/TreeActionBar.d.ts.map +1 -1
- package/dist/common/ButtonWithTooltip.d.ts +2 -2
- package/dist/common/ButtonWithTooltip.d.ts.map +1 -1
- package/dist/common/DatePicker.d.ts +14 -2
- package/dist/common/DatePicker.d.ts.map +1 -1
- package/dist/common/Field.d.ts +1 -1
- package/dist/common/Field.d.ts.map +1 -1
- package/dist/context/ActionViewContext.d.ts +5 -1
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/context/ConfigContext.d.ts +7 -0
- package/dist/context/ConfigContext.d.ts.map +1 -0
- package/dist/context/ContentRootContext.d.ts.map +1 -1
- package/dist/context/FormContext.d.ts +4 -2
- package/dist/context/FormContext.d.ts.map +1 -1
- package/dist/helpers/errorHelper.d.ts +6 -0
- package/dist/helpers/errorHelper.d.ts.map +1 -0
- package/dist/helpers/filesHelper.d.ts.map +1 -1
- package/dist/helpers/formHelper.d.ts +5 -3
- package/dist/helpers/formHelper.d.ts.map +1 -1
- package/dist/helpers/iconMapper.d.ts +11 -2
- package/dist/helpers/iconMapper.d.ts.map +1 -1
- package/dist/helpers/one2manyHelper.d.ts +12 -4
- package/dist/helpers/one2manyHelper.d.ts.map +1 -1
- package/dist/helpers/searchHelper.d.ts +1 -1
- package/dist/helpers/searchHelper.d.ts.map +1 -1
- package/dist/helpers/treeHelper.d.ts +1 -1
- package/dist/helpers/treeHelper.d.ts.map +1 -1
- package/dist/hooks/useExport.d.ts +44 -0
- package/dist/hooks/useExport.d.ts.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/ca_ES.d.ts +2 -0
- package/dist/locales/ca_ES.d.ts.map +1 -1
- package/dist/locales/en_US.d.ts +2 -0
- package/dist/locales/en_US.d.ts.map +1 -1
- package/dist/locales/es_ES.d.ts +2 -0
- package/dist/locales/es_ES.d.ts.map +1 -1
- package/dist/react-ooui.es.js +9360 -29063
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +16 -265
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/ActionErrorDialog.d.ts.map +1 -1
- package/dist/ui/ErrorAlert.d.ts +6 -0
- package/dist/ui/ErrorAlert.d.ts.map +1 -0
- package/dist/ui/FavouriteButton.d.ts +2 -2
- package/dist/ui/FavouriteButton.d.ts.map +1 -1
- package/dist/ui/GoToResourceModal.d.ts +2 -2
- package/dist/ui/GoToResourceModal.d.ts.map +1 -1
- package/dist/ui/TitleHeader.d.ts +2 -2
- package/dist/ui/TitleHeader.d.ts.map +1 -1
- package/dist/views/ActionView.d.ts.map +1 -1
- package/dist/views/CurrentTabContent.d.ts +2 -2
- package/dist/views/CurrentTabContent.d.ts.map +1 -1
- package/dist/views/RootView.d.ts.map +1 -1
- package/dist/views/TabContent.d.ts +1 -1
- package/dist/views/TabContent.d.ts.map +1 -1
- package/dist/views/TabSelector.d.ts +2 -2
- package/dist/views/TabSelector.d.ts.map +1 -1
- package/dist/views/actionViews/DashboardActionView.d.ts +2 -2
- package/dist/views/actionViews/DashboardActionView.d.ts.map +1 -1
- package/dist/views/actionViews/FormActionView.d.ts +2 -2
- package/dist/views/actionViews/FormActionView.d.ts.map +1 -1
- package/dist/views/actionViews/GraphActionView.d.ts +2 -2
- package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
- package/dist/views/actionViews/TreeActionView.d.ts +2 -2
- package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
- package/dist/views/tabs/Tab.d.ts +2 -2
- package/dist/views/tabs/Tab.d.ts.map +1 -1
- package/dist/widgets/WidgetFactory.d.ts.map +1 -1
- package/dist/widgets/base/Binary.d.ts +3 -3
- package/dist/widgets/base/Binary.d.ts.map +1 -1
- package/dist/widgets/base/Boolean.d.ts +2 -2
- package/dist/widgets/base/Boolean.d.ts.map +1 -1
- package/dist/widgets/base/Button.d.ts +2 -2
- package/dist/widgets/base/Button.d.ts.map +1 -1
- package/dist/widgets/base/Char.d.ts +2 -2
- package/dist/widgets/base/Char.d.ts.map +1 -1
- package/dist/widgets/base/Date.d.ts +2 -2
- package/dist/widgets/base/Date.d.ts.map +1 -1
- package/dist/widgets/base/DateTime.d.ts +2 -2
- package/dist/widgets/base/DateTime.d.ts.map +1 -1
- package/dist/widgets/base/Email.d.ts +2 -2
- package/dist/widgets/base/Email.d.ts.map +1 -1
- package/dist/widgets/base/Float.d.ts +2 -2
- package/dist/widgets/base/Float.d.ts.map +1 -1
- package/dist/widgets/base/FloatTime.d.ts +1 -1
- package/dist/widgets/base/FloatTime.d.ts.map +1 -1
- package/dist/widgets/base/Image.d.ts +3 -3
- package/dist/widgets/base/Image.d.ts.map +1 -1
- package/dist/widgets/base/Integer.d.ts +2 -2
- package/dist/widgets/base/Integer.d.ts.map +1 -1
- package/dist/widgets/base/Label.d.ts +2 -2
- package/dist/widgets/base/Label.d.ts.map +1 -1
- package/dist/widgets/base/LinkInput.d.ts +2 -2
- package/dist/widgets/base/LinkInput.d.ts.map +1 -1
- package/dist/widgets/base/MultiSelection.d.ts +3 -3
- package/dist/widgets/base/MultiSelection.d.ts.map +1 -1
- package/dist/widgets/base/ProgressBar.d.ts +3 -3
- package/dist/widgets/base/ProgressBar.d.ts.map +1 -1
- package/dist/widgets/base/Reference.d.ts +1 -1
- package/dist/widgets/base/Reference.d.ts.map +1 -1
- package/dist/widgets/base/ReferenceTree.d.ts +8 -0
- package/dist/widgets/base/ReferenceTree.d.ts.map +1 -0
- package/dist/widgets/base/Selection.d.ts +3 -3
- package/dist/widgets/base/Selection.d.ts.map +1 -1
- package/dist/widgets/base/Separator.d.ts +2 -2
- package/dist/widgets/base/Separator.d.ts.map +1 -1
- package/dist/widgets/base/Text.d.ts +2 -2
- package/dist/widgets/base/Text.d.ts.map +1 -1
- package/dist/widgets/base/Url.d.ts +2 -2
- package/dist/widgets/base/Url.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2one.d.ts +1 -1
- package/dist/widgets/base/many2one/Many2one.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2oneSuffix.d.ts +2 -2
- package/dist/widgets/base/many2one/Many2oneSuffix.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts +2 -2
- package/dist/widgets/base/many2one/Many2oneSuffixModal.d.ts.map +1 -1
- package/dist/widgets/base/many2one/Many2oneTree.d.ts +6 -0
- package/dist/widgets/base/many2one/Many2oneTree.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2many.d.ts +2 -2
- package/dist/widgets/base/one2many/One2many.d.ts.map +1 -1
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
- package/dist/widgets/base/one2many/One2manyTopBar.d.ts +2 -2
- package/dist/widgets/base/one2many/One2manyTopBar.d.ts.map +1 -1
- package/dist/widgets/containers/Group.d.ts.map +1 -1
- package/dist/widgets/custom/Avatar.d.ts +10 -0
- package/dist/widgets/custom/Avatar.d.ts.map +1 -0
- package/dist/widgets/custom/ButtonGroup.d.ts +2 -2
- package/dist/widgets/custom/ButtonGroup.d.ts.map +1 -1
- package/dist/widgets/custom/CodeEditor.d.ts +2 -2
- package/dist/widgets/custom/CodeEditor.d.ts.map +1 -1
- package/dist/widgets/custom/FiberGrid.d.ts +3 -3
- package/dist/widgets/custom/FiberGrid.d.ts.map +1 -1
- package/dist/widgets/custom/Indicator.d.ts +2 -2
- package/dist/widgets/custom/Indicator.d.ts.map +1 -1
- package/dist/widgets/custom/Markdown.d.ts +5 -0
- package/dist/widgets/custom/Markdown.d.ts.map +1 -0
- package/dist/widgets/custom/MultiCheckbox.d.ts +3 -3
- package/dist/widgets/custom/MultiCheckbox.d.ts.map +1 -1
- package/dist/widgets/custom/Radio.d.ts +3 -3
- package/dist/widgets/custom/Radio.d.ts.map +1 -1
- package/dist/widgets/custom/Steps.d.ts +3 -3
- package/dist/widgets/custom/Steps.d.ts.map +1 -1
- package/dist/widgets/custom/Switch.d.ts +2 -2
- package/dist/widgets/custom/Switch.d.ts.map +1 -1
- package/dist/widgets/custom/Tag.d.ts +5 -0
- package/dist/widgets/custom/Tag.d.ts.map +1 -0
- package/dist/widgets/custom/Tags.d.ts +3 -3
- package/dist/widgets/custom/Tags.d.ts.map +1 -1
- package/dist/widgets/custom/Timeline.d.ts +3 -3
- package/dist/widgets/custom/Timeline.d.ts.map +1 -1
- package/dist/widgets/modals/ExportModal.d.ts +4 -3
- package/dist/widgets/modals/ExportModal.d.ts.map +1 -1
- package/dist/widgets/modals/FormModal.d.ts +2 -2
- package/dist/widgets/modals/FormModal.d.ts.map +1 -1
- package/dist/widgets/modals/SearchModal.d.ts +2 -2
- package/dist/widgets/modals/SearchModal.d.ts.map +1 -1
- package/dist/widgets/modals/TranslationModal.d.ts +2 -2
- package/dist/widgets/modals/TranslationModal.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardForm.d.ts +2 -2
- package/dist/widgets/views/Dashboard/DashboardForm.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts +2 -2
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts +2 -2
- package/dist/widgets/views/DashboardGrid/DashboardGrid.d.ts.map +1 -1
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts +2 -2
- package/dist/widgets/views/DashboardGrid/DashboardGridItem.d.ts.map +1 -1
- package/dist/widgets/views/Form.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphChart.d.ts +2 -2
- package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphDefaults.d.ts +36 -0
- package/dist/widgets/views/Graph/GraphDefaults.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphIndicator.d.ts +2 -2
- package/dist/widgets/views/Graph/GraphIndicator.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/Tree.d.ts +2 -0
- package/dist/widgets/views/Tree.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/DateRangePicker.d.ts +2 -2
- package/dist/widgets/views/searchFilter/DateRangePicker.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts +2 -2
- package/dist/widgets/views/searchFilter/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/SearchField.d.ts +2 -2
- package/dist/widgets/views/searchFilter/SearchField.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts +3 -2
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
- package/package.json +14 -15
- package/src/__tests__/iconMapper.test.ts +20 -5
- package/src/__tests__/searchFilterHelper.spec.ts +7 -7
- package/src/actionbar/AttachmentsButton.tsx +22 -24
- package/src/actionbar/AttachmentsButtonWrapper.tsx +15 -12
- package/src/actionbar/ButtonWithBadge.tsx +5 -2
- package/src/actionbar/ChangeViewButton.tsx +13 -7
- package/src/actionbar/FormActionBar.tsx +73 -11
- package/src/actionbar/SearchBar.tsx +8 -4
- package/src/actionbar/TreeActionBar.tsx +99 -97
- package/src/common/DatePicker.tsx +18 -13
- package/src/context/ActionViewContext.tsx +7 -4
- package/src/context/ConfigContext.tsx +9 -0
- package/src/context/ContentRootContext.tsx +111 -76
- package/src/context/FormContext.tsx +1 -4
- package/src/helpers/errorHelper.ts +27 -0
- package/src/helpers/filesHelper.ts +2 -3
- package/src/helpers/formHelper.ts +26 -5
- package/src/helpers/iconMapper.ts +141 -108
- package/src/helpers/one2manyHelper.ts +94 -39
- package/src/helpers/searchHelper.ts +8 -7
- package/src/helpers/treeHelper.ts +17 -5
- package/src/hooks/useExport.ts +439 -0
- package/src/index.ts +6 -0
- package/src/locales/ca_ES.tsx +2 -0
- package/src/locales/en_US.tsx +2 -0
- package/src/locales/es_ES.tsx +2 -0
- package/src/stories/Binary.stories.tsx +4 -1
- package/src/stories/Boolean.stories.tsx +4 -1
- package/src/stories/Button.stories.tsx +4 -1
- package/src/stories/Char.stories.tsx +4 -1
- package/src/stories/FiberGrid.stories.tsx +4 -1
- package/src/stories/Float.stories.tsx +4 -1
- package/src/stories/FloatTime.stories.tsx +4 -1
- package/src/stories/Image.stories.tsx +4 -1
- package/src/stories/Integer.stories.tsx +4 -1
- package/src/stories/Label.stories.tsx +11 -9
- package/src/stories/Many2one.stories.tsx +4 -1
- package/src/stories/One2many.stories.tsx +4 -1
- package/src/stories/ProgressBar.stories.tsx +4 -1
- package/src/stories/Reference.stories.tsx +4 -1
- package/src/stories/Selection.stories.tsx +4 -1
- package/src/stories/Separator.stories.tsx +37 -1
- package/src/stories/Text.stories.tsx +4 -1
- package/src/stories/containers/Group.stories.tsx +28 -1
- package/src/stories/containers/NewLine.stories.tsx +4 -1
- package/src/stories/containers/Notebook.stories.tsx +31 -1
- package/src/stories/custom/Avatar.stories.tsx +27 -0
- package/src/stories/custom/ButtonGroup.stories.tsx +4 -1
- package/src/stories/custom/CodeEditor.stories.tsx +4 -1
- package/src/stories/custom/Indicator.stories.tsx +4 -1
- package/src/stories/custom/Markdown.stories.tsx +42 -0
- package/src/stories/custom/MultiCheckbox.stories.tsx +4 -1
- package/src/stories/custom/Radio.stories.tsx +4 -1
- package/src/stories/custom/Steps.stories.tsx +4 -1
- package/src/stories/custom/Switch.stories.tsx +4 -1
- package/src/stories/custom/Tag.stories.tsx +60 -0
- package/src/stories/custom/Tags.stories.tsx +4 -1
- package/src/stories/forms/PreferencesForm.stories.tsx +4 -1
- package/src/stories/mocks/models/company.ts +2 -2
- package/src/stories/mocks/models/crm_case.ts +7 -10
- package/src/stories/ui/ActionBar.stories.tsx +2 -1
- package/src/stories/ui/FavouriteButton.stories.tsx +2 -1
- package/src/stories/ui/GoToResourceModal.stories.tsx +2 -1
- package/src/stories/views/SearchTree.stories.tsx +3 -1
- package/src/stories/views/Tab.stories.tsx +3 -1
- package/src/stories/views/TabsAndContent.stories.tsx +3 -1
- package/src/stories/views/Tree.stories.jsx +20 -6
- package/src/stories/views/searchFilter/DateRangePicker.stories.tsx +3 -1
- package/src/stories/views/searchFilter/DateTimeRangePicker.stories.tsx +4 -1
- package/src/stories/views/searchFilter/PairFields.stories.tsx +4 -1
- package/src/stories/views/searchFilter/SearchFilter.stories.tsx +4 -1
- package/src/stories/views/searchFilter/examples/PartnersSearchFilter.stories.tsx +4 -1
- package/src/types/index.ts +1 -0
- package/src/ui/ActionErrorDialog.tsx +4 -21
- package/src/ui/ErrorAlert.tsx +37 -0
- package/src/ui/FavouriteButton.tsx +20 -9
- package/src/ui/GoToResourceModal.tsx +3 -3
- package/src/ui/TitleHeader.tsx +18 -4
- package/src/views/ActionView.tsx +6 -2
- package/src/views/RootView.tsx +7 -1
- package/src/views/actionViews/GraphActionView.tsx +1 -0
- package/src/views/actionViews/TreeActionView.tsx +10 -1
- package/src/views/tabs/Tab.tsx +12 -6
- package/src/widgets/WidgetFactory.tsx +6 -0
- package/src/widgets/base/Binary.tsx +8 -5
- package/src/widgets/base/Boolean.tsx +8 -7
- package/src/widgets/base/Char.tsx +14 -12
- package/src/widgets/base/Float.tsx +11 -5
- package/src/widgets/base/FloatTime.tsx +9 -5
- package/src/widgets/base/Integer.tsx +10 -5
- package/src/widgets/base/Label.tsx +12 -12
- package/src/widgets/base/LinkInput.tsx +11 -6
- package/src/widgets/base/MultiSelection.tsx +6 -2
- package/src/widgets/base/Reference.tsx +13 -3
- package/src/widgets/base/ReferenceTree.tsx +62 -0
- package/src/widgets/base/Selection.tsx +6 -2
- package/src/widgets/base/Separator.tsx +11 -3
- package/src/widgets/base/Text.tsx +14 -12
- package/src/widgets/base/many2one/Many2one.tsx +27 -33
- package/src/widgets/base/many2one/Many2oneSuffixModal.tsx +3 -3
- package/src/widgets/base/many2one/Many2oneTree.tsx +18 -0
- package/src/widgets/base/one2many/One2manyInput.tsx +82 -28
- package/src/widgets/base/one2many/One2manyTopBar.tsx +10 -1
- package/src/widgets/containers/Group.tsx +7 -4
- package/src/widgets/custom/Avatar.tsx +33 -0
- package/src/widgets/custom/ButtonGroup.tsx +31 -21
- package/src/widgets/custom/FiberGrid.tsx +2 -5
- package/src/widgets/custom/Indicator.tsx +16 -15
- package/src/widgets/custom/Markdown.tsx +22 -0
- package/src/widgets/custom/MultiCheckbox.tsx +1 -0
- package/src/widgets/custom/Tag.tsx +24 -0
- package/src/widgets/custom/Tags.tsx +27 -28
- package/src/widgets/custom/Timeline.tsx +9 -3
- package/src/widgets/modals/ExportModal.tsx +33 -134
- package/src/widgets/modals/FormModal.tsx +3 -3
- package/src/widgets/modals/SearchModal.tsx +29 -31
- package/src/widgets/modals/TranslationModal.tsx +3 -3
- package/src/widgets/views/Dashboard/Dashboard.tsx +15 -4
- package/src/widgets/views/Dashboard/DashboardTree.tsx +1 -0
- package/src/widgets/views/DashboardGrid/DashboardGridItem.tsx +10 -6
- package/src/widgets/views/Form.tsx +41 -39
- package/src/widgets/views/Graph/GraphChart.tsx +6 -1
- package/src/widgets/views/Graph/GraphDefaults.ts +113 -0
- package/src/widgets/views/Graph/GraphIndicator.tsx +19 -7
- package/src/widgets/views/SearchTree.tsx +3 -0
- package/src/widgets/views/Tree.tsx +118 -26
- package/src/widgets/views/searchFilter/SearchField.tsx +9 -23
- package/src/widgets/views/searchFilter/SearchFilter.tsx +17 -8
- package/dist/Config.d.ts +0 -6
- package/dist/Config.d.ts.map +0 -1
- package/dist/helpers/icons/antd_icons.d.ts +0 -4
- package/dist/helpers/icons/antd_icons.d.ts.map +0 -1
- package/dist/helpers/icons/tabler_icons.d.ts +0 -4
- package/dist/helpers/icons/tabler_icons.d.ts.map +0 -1
- package/dist/main.css +0 -1
- package/dist/ui/Fieldset.d.ts +0 -8
- package/dist/ui/Fieldset.d.ts.map +0 -1
- package/src/Config.ts +0 -4
- package/src/helpers/icons/antd_icons.ts +0 -1583
- package/src/helpers/icons/tabler_icons.ts +0 -5367
- package/src/ui/Fieldset.tsx +0 -31
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
ApiOutlined,
|
|
12
12
|
} from "@ant-design/icons";
|
|
13
13
|
import { ViewType } from "@/types";
|
|
14
|
+
import { theme } from "antd";
|
|
15
|
+
const { useToken } = theme;
|
|
14
16
|
|
|
15
17
|
type One2manyTopBarProps = {
|
|
16
18
|
title: string;
|
|
@@ -49,6 +51,7 @@ export const One2manyTopBar = (props: One2manyTopBarProps) => {
|
|
|
49
51
|
showCreateButton,
|
|
50
52
|
showToggleButton,
|
|
51
53
|
} = props;
|
|
54
|
+
const { token } = useToken();
|
|
52
55
|
|
|
53
56
|
function separator() {
|
|
54
57
|
return <div className="inline-block w-3" />;
|
|
@@ -56,7 +59,13 @@ export const One2manyTopBar = (props: One2manyTopBarProps) => {
|
|
|
56
59
|
|
|
57
60
|
function title() {
|
|
58
61
|
return (
|
|
59
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
className="flex flex-grow h-8 text-white"
|
|
64
|
+
style={{
|
|
65
|
+
borderRadius: token.borderRadius,
|
|
66
|
+
backgroundColor: token.colorPrimaryActive,
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
60
69
|
<div className="flex flex-col items-center justify-center h-full">
|
|
61
70
|
<span className="pl-2 font-bold">{titleString}</span>
|
|
62
71
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Group as GroupOoui } from "@gisce/ooui";
|
|
3
3
|
import Container from "./Container";
|
|
4
|
-
import
|
|
4
|
+
import { FieldSet } from "@gisce/react-formiga-components";
|
|
5
|
+
import { Space } from "antd";
|
|
6
|
+
import iconMapper from "@/helpers/iconMapper";
|
|
5
7
|
|
|
6
8
|
type Props = {
|
|
7
9
|
ooui: GroupOoui;
|
|
@@ -11,16 +13,17 @@ type Props = {
|
|
|
11
13
|
|
|
12
14
|
function Group(props: Props): React.ReactElement {
|
|
13
15
|
const { ooui, showLabel = true, responsiveBehaviour } = props;
|
|
16
|
+
const icon: React.ElementType | undefined = iconMapper(ooui.icon || "");
|
|
14
17
|
|
|
15
18
|
return (
|
|
16
19
|
<>
|
|
17
|
-
{ooui.label && showLabel ? (
|
|
18
|
-
<
|
|
20
|
+
{(ooui.label || icon) && showLabel ? (
|
|
21
|
+
<FieldSet label={ooui.label} icon={icon}>
|
|
19
22
|
<Container
|
|
20
23
|
container={ooui!.container}
|
|
21
24
|
responsiveBehaviour={responsiveBehaviour}
|
|
22
25
|
/>
|
|
23
|
-
</
|
|
26
|
+
</FieldSet>
|
|
24
27
|
) : (
|
|
25
28
|
<Container
|
|
26
29
|
container={ooui!.container}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {WidgetProps} from "@/types";
|
|
3
|
+
import { Avatar as AntdAvatar, Tooltip } from "antd";
|
|
4
|
+
import { Avatar as AvatarOoui} from "@gisce/ooui";
|
|
5
|
+
import { colorFromString } from "@/helpers/formHelper";
|
|
6
|
+
|
|
7
|
+
type AvatarProps = WidgetProps & {
|
|
8
|
+
ooui: AvatarOoui
|
|
9
|
+
value?: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Avatar = (props: AvatarProps): React.ReactElement | null => {
|
|
13
|
+
console.log("Avatar Props", props);
|
|
14
|
+
const {ooui, value} = props;
|
|
15
|
+
if (!value) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
let formattedValue = value;
|
|
19
|
+
if (ooui.selectionValues.size) {
|
|
20
|
+
formattedValue = ooui.selectionValues.get(value);
|
|
21
|
+
} else if (Array.isArray(value)) {
|
|
22
|
+
formattedValue = value[1];
|
|
23
|
+
}
|
|
24
|
+
const text = formattedValue.toString().split(" ").filter((word:string) => word.length > 1).slice(0, 3).map((word:string) => word[0].toUpperCase()).join("");
|
|
25
|
+
const backgroundColor = colorFromString(formattedValue);
|
|
26
|
+
return (
|
|
27
|
+
<Tooltip title={formattedValue}>
|
|
28
|
+
<AntdAvatar alt={formattedValue} style={{backgroundColor}}>{text}</AntdAvatar>
|
|
29
|
+
</Tooltip>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default Avatar;
|
|
@@ -2,6 +2,7 @@ import React, { useContext, useState } from "react";
|
|
|
2
2
|
import Field from "@/common/Field";
|
|
3
3
|
import { DownOutlined } from "@ant-design/icons";
|
|
4
4
|
import { Dropdown, Menu } from "antd";
|
|
5
|
+
import { Button } from "@/widgets/base/Button";
|
|
5
6
|
import {
|
|
6
7
|
ButtonGroup as ButtonGroupOoui,
|
|
7
8
|
Button as ButtonOoui,
|
|
@@ -20,6 +21,8 @@ type ButtonGroupProps = {
|
|
|
20
21
|
|
|
21
22
|
type ItemsProps = {
|
|
22
23
|
ooui: ButtonOoui[];
|
|
24
|
+
executeButtonAction: any,
|
|
25
|
+
lang: string
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
export const ButtonGroup = (props: ButtonGroupProps) => {
|
|
@@ -73,27 +76,37 @@ export const ButtonGroup = (props: ButtonGroupProps) => {
|
|
|
73
76
|
|
|
74
77
|
onClick_confirm();
|
|
75
78
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
79
|
+
if (ooui.buttons.length === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
} else if (ooui.buttons.length > 1) {
|
|
82
|
+
return (
|
|
83
|
+
<Field ooui={new FieldOoui({ ...{ ooui } })}>
|
|
84
|
+
<Dropdown.Button
|
|
85
|
+
disabled={!activated || readOnly}
|
|
86
|
+
onClick={onClick}
|
|
87
|
+
icon={<DownOutlined />}
|
|
88
|
+
type={primary ? "primary" : undefined}
|
|
89
|
+
//danger={danger ? true : undefined} This works but typescript
|
|
90
|
+
// doesn't accept
|
|
91
|
+
overlay={<Items ooui={secondaryButtons} executeButtonAction={executeButtonAction} lang={lang} /> }
|
|
92
|
+
>
|
|
93
|
+
{getButtonIcon()}
|
|
94
|
+
{caption}
|
|
95
|
+
</Dropdown.Button>
|
|
96
|
+
</Field>
|
|
97
|
+
);
|
|
98
|
+
} else if (defaultButton) {
|
|
99
|
+
return (
|
|
100
|
+
<Button ooui={defaultButton} />
|
|
101
|
+
)
|
|
102
|
+
}
|
|
93
103
|
};
|
|
94
104
|
|
|
95
105
|
const Items = (props: ItemsProps) => {
|
|
96
|
-
const { ooui } = props;
|
|
106
|
+
const { ooui, executeButtonAction, lang } = props;
|
|
107
|
+
if (!ooui) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
97
110
|
const items = ooui.map((button) => {
|
|
98
111
|
const {
|
|
99
112
|
id,
|
|
@@ -106,10 +119,7 @@ const Items = (props: ItemsProps) => {
|
|
|
106
119
|
readOnly,
|
|
107
120
|
danger,
|
|
108
121
|
} = button;
|
|
109
|
-
const formContext = useContext(FormContext) as FormContextType;
|
|
110
|
-
const { executeButtonAction } = formContext || {};
|
|
111
122
|
const [isRunning, setIsRunning] = useState<boolean>(false);
|
|
112
|
-
const { lang } = useContext(LocaleContext) as LocaleContextType;
|
|
113
123
|
|
|
114
124
|
async function onClick_confirm() {
|
|
115
125
|
setIsRunning(true);
|
|
@@ -2,14 +2,11 @@ import React from "react";
|
|
|
2
2
|
import Field from "@/common/Field";
|
|
3
3
|
import { Char as CharOoui } from "@gisce/ooui";
|
|
4
4
|
import { WidgetProps } from "@/types";
|
|
5
|
-
import
|
|
6
|
-
import { GridUi } from "fiber-diagram";
|
|
5
|
+
import { GridUi } from "@gisce/fiber-diagram";
|
|
7
6
|
|
|
8
7
|
export const FiberGrid = (props: WidgetProps) => {
|
|
9
8
|
const { ooui } = props;
|
|
10
|
-
const {
|
|
11
|
-
// const requiredClass =
|
|
12
|
-
// required && !readOnly ? Config.requiredClass : undefined;
|
|
9
|
+
const { required } = ooui as CharOoui;
|
|
13
10
|
|
|
14
11
|
return (
|
|
15
12
|
<Field required={required} {...props}>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Tooltip } from "antd";
|
|
2
|
+
import { Tooltip, theme } from "antd";
|
|
3
3
|
import { Statistic, Card } from "antd";
|
|
4
4
|
import { Indicator as IndicatorOoui } from "@gisce/ooui";
|
|
5
5
|
import { WidgetProps } from "@/types";
|
|
6
6
|
import Field from "@/common/Field";
|
|
7
|
-
import {QuestionCircleOutlined} from "@ant-design/icons";
|
|
7
|
+
import { QuestionCircleOutlined } from "@ant-design/icons";
|
|
8
8
|
import iconMapper from "@/helpers/iconMapper";
|
|
9
|
+
const { useToken } = theme;
|
|
9
10
|
|
|
10
11
|
type IndicatorProps = WidgetProps & {
|
|
11
|
-
ooui: IndicatorOoui
|
|
12
|
+
ooui: IndicatorOoui;
|
|
12
13
|
value?: number;
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -25,18 +26,22 @@ export const Indicator = (props: IndicatorProps) => {
|
|
|
25
26
|
type IndicatorInputProps = {
|
|
26
27
|
ooui: IndicatorOoui;
|
|
27
28
|
value?: any;
|
|
28
|
-
}
|
|
29
|
+
};
|
|
29
30
|
|
|
30
31
|
const IndicatorInput = (props: IndicatorInputProps) => {
|
|
32
|
+
const { token } = useToken();
|
|
31
33
|
const { ooui, value } = props;
|
|
32
34
|
const title = (
|
|
33
35
|
<>
|
|
34
36
|
<span>{ooui.label} </span>
|
|
35
|
-
{ooui.tooltip &&
|
|
37
|
+
{ooui.tooltip && (
|
|
36
38
|
<Tooltip title={ooui.tooltip}>
|
|
37
|
-
<QuestionCircleOutlined
|
|
39
|
+
<QuestionCircleOutlined
|
|
40
|
+
className="pr-1 text-xs"
|
|
41
|
+
style={{ color: token.colorPrimaryBg }}
|
|
42
|
+
/>
|
|
38
43
|
</Tooltip>
|
|
39
|
-
}
|
|
44
|
+
)}
|
|
40
45
|
</>
|
|
41
46
|
);
|
|
42
47
|
const Icon: React.ElementType = iconMapper(ooui.icon) as any;
|
|
@@ -49,18 +54,14 @@ const IndicatorInput = (props: IndicatorInputProps) => {
|
|
|
49
54
|
const field = (
|
|
50
55
|
<Statistic
|
|
51
56
|
title={title}
|
|
52
|
-
prefix={Icon && <Icon/>}
|
|
57
|
+
prefix={Icon && <Icon />}
|
|
53
58
|
suffix={ooui.suffix}
|
|
54
59
|
value={formattedValue}
|
|
55
60
|
/>
|
|
56
|
-
)
|
|
61
|
+
);
|
|
57
62
|
if (ooui.card) {
|
|
58
|
-
return
|
|
59
|
-
<Card>
|
|
60
|
-
{field}
|
|
61
|
-
</Card>
|
|
62
|
-
);
|
|
63
|
+
return <Card>{field}</Card>;
|
|
63
64
|
} else {
|
|
64
65
|
return field;
|
|
65
66
|
}
|
|
66
|
-
}
|
|
67
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Field from "@/common/Field";
|
|
2
|
+
import ReactMarkdown from "react-markdown";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import {WidgetProps} from "@/types";
|
|
5
|
+
|
|
6
|
+
export const Markdown = (props: WidgetProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<Field {...props}>
|
|
9
|
+
<MarkdownInput {...props} />
|
|
10
|
+
</Field>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const MarkdownInput = (props: any) => {
|
|
15
|
+
const {value, ooui} = props;
|
|
16
|
+
return (
|
|
17
|
+
<div style={{height: ooui.height ? ooui.height + 'px' : '100%', overflow: 'auto'}}>
|
|
18
|
+
<ReactMarkdown children={value} className="ant-typography"/>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -62,6 +62,7 @@ export const MultiCheckboxInput = (props: MultiCheckboxInputProps) => {
|
|
|
62
62
|
fields: formContext?.getFields(),
|
|
63
63
|
values: formContext.getPlainValues(),
|
|
64
64
|
}),
|
|
65
|
+
fields: formContext?.getFields(),
|
|
65
66
|
context: formContext.getContext(),
|
|
66
67
|
});
|
|
67
68
|
params = [...params, ...evaluatedDomain];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Field from "@/common/Field";
|
|
3
|
+
import { WidgetProps } from "@/types";
|
|
4
|
+
import { Tag as AntdTag } from 'antd';
|
|
5
|
+
import { colorFromString } from "@/helpers/formHelper";
|
|
6
|
+
|
|
7
|
+
export const Tag = (props: WidgetProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<Field {...props}>
|
|
10
|
+
<TagInput {...props}/>
|
|
11
|
+
</Field>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const TagInput = (props: any) => {
|
|
16
|
+
const {ooui, value} = props;
|
|
17
|
+
if (!value) {
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
20
|
+
const color = ooui.colors === "auto" ? colorFromString(value) : ooui.colors[value]
|
|
21
|
+
return (
|
|
22
|
+
<AntdTag color={color}>{ooui.selectionValues.get(value)}</AntdTag>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -23,7 +23,7 @@ export const Tags = (props: TagsProps) => {
|
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<Field type={"array"} {...props}>
|
|
26
|
-
<TagsInput ooui={ooui}
|
|
26
|
+
<TagsInput ooui={ooui} />
|
|
27
27
|
</Field>
|
|
28
28
|
);
|
|
29
29
|
};
|
|
@@ -31,16 +31,15 @@ export const Tags = (props: TagsProps) => {
|
|
|
31
31
|
export const TagsInput = (props: TagsInputProps) => {
|
|
32
32
|
const { value, ooui, onChange } = props;
|
|
33
33
|
const { items = [] } = value || {};
|
|
34
|
-
const itemsToShow = items
|
|
35
|
-
(item) => item.operation !== "pendingRemove"
|
|
36
|
-
|
|
34
|
+
const itemsToShow = items
|
|
35
|
+
.filter((item) => item.operation !== "pendingRemove")
|
|
36
|
+
.map((item) => item.id) as number[];
|
|
37
37
|
|
|
38
38
|
const [options, setOptions] = useState<any[]>([]);
|
|
39
39
|
const [error, setError] = useState<string>();
|
|
40
40
|
const [isLoadingOptions, setIsLoadingOptions] = useState<boolean>(false);
|
|
41
41
|
const { relation, context, readOnly, field } = ooui;
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
const formContext = useContext(FormContext) as FormContextType;
|
|
45
44
|
const { getContext } = formContext || {};
|
|
46
45
|
|
|
@@ -62,16 +61,16 @@ export const TagsInput = (props: TagsInputProps) => {
|
|
|
62
61
|
params = [["id", "in", itemsToShow]];
|
|
63
62
|
}
|
|
64
63
|
if (ooui.domain) {
|
|
65
|
-
const evaluatedDomain =
|
|
66
|
-
{
|
|
64
|
+
const evaluatedDomain =
|
|
65
|
+
await ConnectionProvider.getHandler().evalDomain({
|
|
67
66
|
domain: ooui.domain,
|
|
68
67
|
values: transformPlainMany2Ones({
|
|
69
68
|
fields: formContext?.getFields(),
|
|
70
69
|
values: formContext.getPlainValues(),
|
|
71
70
|
}),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
fields: formContext?.getFields(),
|
|
72
|
+
context: formContext.getContext(),
|
|
73
|
+
});
|
|
75
74
|
params = [...params, ...evaluatedDomain];
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -81,18 +80,17 @@ export const TagsInput = (props: TagsInputProps) => {
|
|
|
81
80
|
fields: [field],
|
|
82
81
|
context: { ...getContext?.(), ...context },
|
|
83
82
|
});
|
|
84
|
-
const options = optionsRead.map((item:any) => {
|
|
83
|
+
const options = optionsRead.map((item: any) => {
|
|
85
84
|
const value = item[field];
|
|
86
85
|
let formattedValue = value;
|
|
87
86
|
if (Array.isArray(value)) {
|
|
88
87
|
formattedValue = value[1];
|
|
89
88
|
}
|
|
90
|
-
return {label: formattedValue, value: item.id}
|
|
89
|
+
return { label: formattedValue, value: item.id };
|
|
91
90
|
});
|
|
92
91
|
setOptions(options);
|
|
93
|
-
|
|
94
92
|
} catch (err) {
|
|
95
|
-
setError(err as any)
|
|
93
|
+
setError(err as any);
|
|
96
94
|
} finally {
|
|
97
95
|
setIsLoadingOptions(false);
|
|
98
96
|
}
|
|
@@ -104,19 +102,21 @@ export const TagsInput = (props: TagsInputProps) => {
|
|
|
104
102
|
if (item.operation == "pendingRemove") {
|
|
105
103
|
return {
|
|
106
104
|
...item,
|
|
107
|
-
operation: "pendingLink"
|
|
108
|
-
}
|
|
105
|
+
operation: "pendingLink",
|
|
106
|
+
};
|
|
109
107
|
} else {
|
|
110
|
-
return item
|
|
108
|
+
return item;
|
|
111
109
|
}
|
|
112
110
|
} else {
|
|
113
|
-
return {id: item.id, operation:
|
|
111
|
+
return { id: item.id, operation: "pendingRemove" };
|
|
114
112
|
}
|
|
115
|
-
})
|
|
116
|
-
const currentIds = newItems.map(item => item.id)
|
|
117
|
-
ids.filter(id => !currentIds.includes(id)).map((id) => {
|
|
118
|
-
newItems.push({id, operation: 'pendingLink'});
|
|
119
113
|
});
|
|
114
|
+
const currentIds = newItems.map((item) => item.id);
|
|
115
|
+
ids
|
|
116
|
+
.filter((id) => !currentIds.includes(id))
|
|
117
|
+
.map((id) => {
|
|
118
|
+
newItems.push({ id, operation: "pendingLink" });
|
|
119
|
+
});
|
|
120
120
|
triggerChange(newItems);
|
|
121
121
|
};
|
|
122
122
|
|
|
@@ -130,10 +130,11 @@ export const TagsInput = (props: TagsInputProps) => {
|
|
|
130
130
|
<AntTag
|
|
131
131
|
color={colorFromString(label)}
|
|
132
132
|
onMouseDown={onPreventMouseDown}
|
|
133
|
-
style={{margin:
|
|
133
|
+
style={{ margin: "5px" }}
|
|
134
134
|
closable={closable}
|
|
135
|
-
onClose={onClose}
|
|
136
|
-
|
|
135
|
+
onClose={onClose}
|
|
136
|
+
>
|
|
137
|
+
{label}
|
|
137
138
|
</AntTag>
|
|
138
139
|
);
|
|
139
140
|
};
|
|
@@ -154,10 +155,8 @@ export const TagsInput = (props: TagsInputProps) => {
|
|
|
154
155
|
options={options}
|
|
155
156
|
onChange={onChangeSelected}
|
|
156
157
|
loading={isLoadingOptions}
|
|
157
|
-
|
|
158
|
-
</Select>
|
|
158
|
+
></Select>
|
|
159
159
|
</div>
|
|
160
160
|
</>
|
|
161
161
|
);
|
|
162
|
-
|
|
163
162
|
};
|
|
@@ -105,12 +105,18 @@ export const TimelineInput = (props: TimelineInputProps) => {
|
|
|
105
105
|
setError(undefined);
|
|
106
106
|
|
|
107
107
|
try {
|
|
108
|
-
const itemsWithValues = await readObjectValues({
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const [itemsWithValues] = await readObjectValues({
|
|
109
|
+
treeView: {
|
|
110
|
+
fields: views.get("tree").fields,
|
|
111
|
+
arch: views.get("tree").arch
|
|
112
|
+
},
|
|
113
|
+
formView: {
|
|
114
|
+
fields: views.get("form").fields,
|
|
115
|
+
},
|
|
111
116
|
model: relation,
|
|
112
117
|
items,
|
|
113
118
|
context: { ...getContext?.(), ...context },
|
|
119
|
+
currentView: "form",
|
|
114
120
|
});
|
|
115
121
|
|
|
116
122
|
triggerChange(itemsWithValues);
|
|
@@ -3,22 +3,20 @@ import {
|
|
|
3
3
|
ExportModal as ExportModalFmg,
|
|
4
4
|
Locale,
|
|
5
5
|
} from "@gisce/react-formiga-components";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import showInfo from "@/ui/InfoDialog";
|
|
9
|
-
import { tForLang } from "@/context/LocaleContext";
|
|
10
|
-
import { getMimeType, openBase64InNewTab } from "@/helpers/filesHelper";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { useExport } from "@/hooks/useExport";
|
|
11
8
|
|
|
12
9
|
export type ExportModalProps = {
|
|
13
10
|
visible: boolean;
|
|
14
11
|
locale: string;
|
|
15
12
|
onClose: () => void;
|
|
16
|
-
selectedRegistersToExport?:
|
|
13
|
+
selectedRegistersToExport?: any[];
|
|
17
14
|
totalRegisters: number;
|
|
18
15
|
model: string;
|
|
19
16
|
domain: any[];
|
|
20
17
|
limit?: number;
|
|
21
18
|
context?: any;
|
|
19
|
+
visibleRegisters: number;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
export const ExportModal = (props: ExportModalProps) => {
|
|
@@ -32,145 +30,46 @@ export const ExportModal = (props: ExportModalProps) => {
|
|
|
32
30
|
totalRegisters,
|
|
33
31
|
domain,
|
|
34
32
|
limit,
|
|
33
|
+
visibleRegisters,
|
|
35
34
|
} = props;
|
|
36
|
-
const fields = useRef<any>({});
|
|
37
35
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onClose();
|
|
55
|
-
|
|
56
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
57
|
-
|
|
58
|
-
const fileType: any = await getMimeType(datas);
|
|
59
|
-
openBase64InNewTab(datas, fileType.mime);
|
|
60
|
-
},
|
|
61
|
-
[locale, model, domain, limit, context, onClose]
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const onGetFields = useCallback(async () => {
|
|
65
|
-
const viewData = await ConnectionProvider.getHandler().getFields({
|
|
66
|
-
model,
|
|
67
|
-
context,
|
|
68
|
-
fields: [],
|
|
69
|
-
});
|
|
70
|
-
fields.current["/"] = viewData;
|
|
71
|
-
return convertToExportField({ fields: viewData });
|
|
72
|
-
}, [model, context, fields]);
|
|
73
|
-
|
|
74
|
-
const onGetFieldChilds = useCallback(
|
|
75
|
-
async ({ key, title }: any) => {
|
|
76
|
-
let fieldDefinition;
|
|
77
|
-
|
|
78
|
-
const sanitizedKey =
|
|
79
|
-
key.split("/")[key.split("/").length - 1] === "id"
|
|
80
|
-
? key.split("/").slice(0, -1).join("/")
|
|
81
|
-
: key;
|
|
82
|
-
|
|
83
|
-
if (sanitizedKey.indexOf("/") === -1) {
|
|
84
|
-
fieldDefinition = fields.current["/"];
|
|
85
|
-
} else {
|
|
86
|
-
fieldDefinition = fields.current[getParentKey(sanitizedKey)];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const optsForField = fieldDefinition[getChildKey(sanitizedKey)];
|
|
90
|
-
const relation = optsForField.relation;
|
|
91
|
-
const viewData = await ConnectionProvider.getHandler().getFields({
|
|
92
|
-
model: relation,
|
|
93
|
-
context,
|
|
94
|
-
fields: [],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
fields.current[sanitizedKey] = viewData;
|
|
98
|
-
|
|
99
|
-
return convertToExportField({
|
|
100
|
-
fields: viewData,
|
|
101
|
-
parentTitle: title,
|
|
102
|
-
parentKey: sanitizedKey,
|
|
103
|
-
});
|
|
104
|
-
},
|
|
105
|
-
[fields, model, context]
|
|
106
|
-
);
|
|
36
|
+
const {
|
|
37
|
+
onExport,
|
|
38
|
+
onGetFieldChilds,
|
|
39
|
+
onGetFields,
|
|
40
|
+
onGetPredefinedExports,
|
|
41
|
+
onSavePredefinedExport,
|
|
42
|
+
onRemovePredefinedExport,
|
|
43
|
+
} = useExport({
|
|
44
|
+
model,
|
|
45
|
+
context,
|
|
46
|
+
domain,
|
|
47
|
+
limit,
|
|
48
|
+
selectedRegistersToExport,
|
|
49
|
+
onClose,
|
|
50
|
+
locale,
|
|
51
|
+
});
|
|
107
52
|
|
|
108
53
|
return (
|
|
109
54
|
<ExportModalFmg
|
|
110
55
|
visible={visible}
|
|
111
56
|
locale={locale as Locale}
|
|
112
|
-
onSucceed={
|
|
57
|
+
onSucceed={onExport}
|
|
113
58
|
onCancel={onClose}
|
|
114
|
-
selectedRegistersToExport={
|
|
59
|
+
selectedRegistersToExport={
|
|
60
|
+
selectedRegistersToExport &&
|
|
61
|
+
selectedRegistersToExport.length &&
|
|
62
|
+
selectedRegistersToExport.length > 0
|
|
63
|
+
? selectedRegistersToExport.length
|
|
64
|
+
: undefined
|
|
65
|
+
}
|
|
115
66
|
totalRegisters={totalRegisters}
|
|
116
67
|
onGetFieldChilds={onGetFieldChilds}
|
|
117
68
|
onGetFields={onGetFields}
|
|
69
|
+
visibleRegisters={visibleRegisters}
|
|
70
|
+
onGetPredefinedExports={onGetPredefinedExports}
|
|
71
|
+
onSavePredefinedExport={onSavePredefinedExport}
|
|
72
|
+
onRemovePredefinedExport={onRemovePredefinedExport}
|
|
118
73
|
/>
|
|
119
74
|
);
|
|
120
75
|
};
|
|
121
|
-
|
|
122
|
-
const convertToExportField = ({
|
|
123
|
-
fields,
|
|
124
|
-
parentKey,
|
|
125
|
-
parentTitle,
|
|
126
|
-
}: {
|
|
127
|
-
fields: any;
|
|
128
|
-
parentTitle?: string;
|
|
129
|
-
parentKey?: string;
|
|
130
|
-
}) => {
|
|
131
|
-
const exportFields = [];
|
|
132
|
-
|
|
133
|
-
for (const key of Object.keys(fields)) {
|
|
134
|
-
const valuesForField = fields[key];
|
|
135
|
-
|
|
136
|
-
if (valuesForField.relation && valuesForField.is_function === true) {
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const relationField =
|
|
141
|
-
valuesForField.type === "many2one" ||
|
|
142
|
-
valuesForField.type === "one2many" ||
|
|
143
|
-
valuesForField.type === "many2many";
|
|
144
|
-
|
|
145
|
-
let newKey = `${parentKey ? parentKey + "/" : ""}${key}`;
|
|
146
|
-
|
|
147
|
-
if (relationField) {
|
|
148
|
-
newKey += "/id";
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
exportFields.push({
|
|
152
|
-
key: newKey,
|
|
153
|
-
title: `${parentTitle ? parentTitle + "/" : ""}${valuesForField.string}`,
|
|
154
|
-
tooltip: valuesForField.help,
|
|
155
|
-
required: valuesForField.required,
|
|
156
|
-
isLeaf: !relationField,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return exportFields;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const getParentKey = (key: string) => {
|
|
163
|
-
if (key.indexOf("/") === -1) {
|
|
164
|
-
return key;
|
|
165
|
-
}
|
|
166
|
-
const items = key.split("/");
|
|
167
|
-
return items.slice(0, -1).join("/");
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const getChildKey = (key: string) => {
|
|
171
|
-
if (key.indexOf("/") === -1) {
|
|
172
|
-
return key;
|
|
173
|
-
}
|
|
174
|
-
const items = key.split("/");
|
|
175
|
-
return items[items.length - 1];
|
|
176
|
-
};
|