@gisce/react-ooui 1.2.0-rc.8 → 1.2.0-rc.82
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/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 +25826 -27484
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +180 -215
- package/dist/react-ooui.umd.js.map +1 -1
- 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/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 +11 -13
- 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/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 +123 -81
- package/src/context/FormContext.tsx +1 -4
- package/src/helpers/errorHelper.ts +27 -0
- 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/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 +9 -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 +25 -31
- 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 +79 -23
- package/src/widgets/base/one2many/One2manyTopBar.tsx +10 -1
- package/src/widgets/containers/Group.tsx +7 -4
- package/src/widgets/custom/ButtonGroup.tsx +1 -1
- package/src/widgets/custom/FiberGrid.tsx +1 -4
- 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 +112 -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/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
- /package/dist/{main.css → style.css} +0 -0
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
Row,
|
|
16
16
|
Alert,
|
|
17
17
|
Spin,
|
|
18
|
+
message,
|
|
18
19
|
} from "antd";
|
|
19
20
|
import Measure from "react-measure";
|
|
20
21
|
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
@@ -54,6 +55,8 @@ import {
|
|
|
54
55
|
ContentRootContextType,
|
|
55
56
|
} from "@/context/ContentRootContext";
|
|
56
57
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
58
|
+
import { convertToPlain2ManyValues } from "@/helpers/one2manyHelper";
|
|
59
|
+
import { ErrorAlert } from "@/ui/ErrorAlert";
|
|
57
60
|
|
|
58
61
|
export type FormProps = {
|
|
59
62
|
model: string;
|
|
@@ -105,7 +108,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
105
108
|
defaultValues,
|
|
106
109
|
forcedValues = {},
|
|
107
110
|
} = props;
|
|
108
|
-
const { lang } = useContext(LocaleContext) as LocaleContextType;
|
|
111
|
+
const { t, lang } = useContext(LocaleContext) as LocaleContextType;
|
|
109
112
|
|
|
110
113
|
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
|
111
114
|
const [error, setError] = useState<string>();
|
|
@@ -126,7 +129,8 @@ function Form(props: FormProps, ref: any) {
|
|
|
126
129
|
const responsiveBehaviour = containerWidth < WIDTH_BREAKPOINT;
|
|
127
130
|
|
|
128
131
|
const formContext = useContext(FormContext) as FormContextType;
|
|
129
|
-
const { activeId: parentId } =
|
|
132
|
+
const { activeId: parentId, getPlainValues: getParentPlainValues } =
|
|
133
|
+
formContext || {};
|
|
130
134
|
|
|
131
135
|
const actionViewContext = useContext(
|
|
132
136
|
ActionViewContext
|
|
@@ -137,6 +141,8 @@ function Form(props: FormProps, ref: any) {
|
|
|
137
141
|
setCurrentId = undefined,
|
|
138
142
|
setFormIsLoading = undefined,
|
|
139
143
|
setAttachments = undefined,
|
|
144
|
+
title = undefined,
|
|
145
|
+
setTitle = undefined,
|
|
140
146
|
} = (rootForm ? actionViewContext : {}) || {};
|
|
141
147
|
|
|
142
148
|
const contentRootContext = useContext(
|
|
@@ -342,6 +348,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
342
348
|
await antForm.validateFields();
|
|
343
349
|
return false;
|
|
344
350
|
} catch (verror) {
|
|
351
|
+
message.error(t("fillRequiredFields"));
|
|
345
352
|
return true;
|
|
346
353
|
}
|
|
347
354
|
}
|
|
@@ -398,13 +405,11 @@ function Form(props: FormProps, ref: any) {
|
|
|
398
405
|
if (valuesProps) {
|
|
399
406
|
values = valuesProps;
|
|
400
407
|
} else {
|
|
401
|
-
({
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
arch: _arch!,
|
|
407
|
-
}));
|
|
408
|
+
({ values, defaultGetCalled: hasDefaultGetCalled } =
|
|
409
|
+
await fetchValuesFromApi({
|
|
410
|
+
fields: _fields,
|
|
411
|
+
arch: _arch!,
|
|
412
|
+
}));
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
if (actionDomain) {
|
|
@@ -428,11 +433,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
428
433
|
}
|
|
429
434
|
};
|
|
430
435
|
|
|
431
|
-
function setOriginalValue(field: string, value: any) {
|
|
432
|
-
originalFormValues.current[field] = value;
|
|
433
|
-
setFormHasChanges?.(formHasChanges());
|
|
434
|
-
}
|
|
435
|
-
|
|
436
436
|
const cancelUnsavedChanges = async () => {
|
|
437
437
|
return new Promise(async (resolve) => {
|
|
438
438
|
if (formHasChanges()) {
|
|
@@ -455,15 +455,13 @@ function Form(props: FormProps, ref: any) {
|
|
|
455
455
|
|
|
456
456
|
const getFormView = async (): Promise<FormView> => {
|
|
457
457
|
if (getDataFromAction) {
|
|
458
|
-
const action =
|
|
459
|
-
model
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
{
|
|
458
|
+
const action =
|
|
459
|
+
await ConnectionProvider.getHandler().getActionStringForModel(model);
|
|
460
|
+
const viewsForAction =
|
|
461
|
+
await ConnectionProvider.getHandler().getViewsForAction({
|
|
463
462
|
action,
|
|
464
463
|
context: parentContext,
|
|
465
|
-
}
|
|
466
|
-
);
|
|
464
|
+
});
|
|
467
465
|
return viewsForAction.views.get("form");
|
|
468
466
|
}
|
|
469
467
|
|
|
@@ -609,13 +607,13 @@ function Form(props: FormProps, ref: any) {
|
|
|
609
607
|
formSubmitting.current = false;
|
|
610
608
|
setFormHasChanges?.(false);
|
|
611
609
|
onCancel?.();
|
|
612
|
-
return true;
|
|
610
|
+
return { succeed: true, id: getCurrentId()! };
|
|
613
611
|
}
|
|
614
612
|
|
|
615
613
|
if (await checkIfFormHasErrors()) {
|
|
616
614
|
formSubmitting.current = false;
|
|
617
615
|
formErrorsDialog(lang);
|
|
618
|
-
return false;
|
|
616
|
+
return { succeed: false, id: getCurrentId()! };
|
|
619
617
|
}
|
|
620
618
|
|
|
621
619
|
setIsSubmitting(true);
|
|
@@ -635,11 +633,13 @@ function Form(props: FormProps, ref: any) {
|
|
|
635
633
|
|
|
636
634
|
await fetchValues();
|
|
637
635
|
submitSucceed = true;
|
|
636
|
+
message.success(t("savedRegisters"));
|
|
638
637
|
} catch (err) {
|
|
639
638
|
formSubmitting.current = false;
|
|
640
639
|
setIsSubmitting(false);
|
|
641
640
|
setFormIsSaving?.(false);
|
|
642
641
|
onSubmitError?.(err);
|
|
642
|
+
message.error(t("errorWhileSavingForm"));
|
|
643
643
|
setError(err?.message ? err.message : err);
|
|
644
644
|
} finally {
|
|
645
645
|
formSubmitting.current = false;
|
|
@@ -647,7 +647,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
647
647
|
setIsSubmitting(false);
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
return submitSucceed;
|
|
650
|
+
return { succeed: submitSucceed, id: getCurrentId()! };
|
|
651
651
|
};
|
|
652
652
|
|
|
653
653
|
const parseForm = ({
|
|
@@ -663,13 +663,20 @@ function Form(props: FormProps, ref: any) {
|
|
|
663
663
|
// TODO: Here we must inject `values` to the ooui parser in order to evaluate arch+values and get the new form container
|
|
664
664
|
ooui.parse(arch, {
|
|
665
665
|
readOnly,
|
|
666
|
-
values:
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
666
|
+
values: convertToPlain2ManyValues(
|
|
667
|
+
{
|
|
668
|
+
...values,
|
|
669
|
+
...getAdditionalValues(),
|
|
670
|
+
},
|
|
671
|
+
fields
|
|
672
|
+
),
|
|
670
673
|
});
|
|
671
674
|
setFormOoui(ooui);
|
|
672
675
|
|
|
676
|
+
if (ooui.string && ooui.string !== title) {
|
|
677
|
+
setTitle?.(ooui.string);
|
|
678
|
+
}
|
|
679
|
+
|
|
673
680
|
if (formModalContext && ooui.string)
|
|
674
681
|
formModalContext.setTitle?.(ooui.string);
|
|
675
682
|
};
|
|
@@ -695,7 +702,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
695
702
|
if (
|
|
696
703
|
checkFieldsType({
|
|
697
704
|
changedFields,
|
|
698
|
-
|
|
705
|
+
formOoui: formOoui!,
|
|
699
706
|
types: [
|
|
700
707
|
"text",
|
|
701
708
|
"codeeditor",
|
|
@@ -756,6 +763,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
756
763
|
...formOoui?.context,
|
|
757
764
|
},
|
|
758
765
|
},
|
|
766
|
+
parentValues: getParentPlainValues?.(),
|
|
759
767
|
onChangeFieldActionArgs: onChangeFieldAction.args,
|
|
760
768
|
});
|
|
761
769
|
|
|
@@ -943,7 +951,9 @@ function Form(props: FormProps, ref: any) {
|
|
|
943
951
|
}
|
|
944
952
|
|
|
945
953
|
try {
|
|
946
|
-
|
|
954
|
+
if (formHasChanges() || getCurrentId() === undefined) {
|
|
955
|
+
await submitForm({ callOnSubmitSucceed: false });
|
|
956
|
+
}
|
|
947
957
|
|
|
948
958
|
if (type === "object") {
|
|
949
959
|
await runObjectButton({ action, context });
|
|
@@ -983,7 +993,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
983
993
|
getFieldValue={getFieldValue}
|
|
984
994
|
executeButtonAction={executeButtonAction}
|
|
985
995
|
getContext={getContext}
|
|
986
|
-
setOriginalValue={setOriginalValue}
|
|
987
996
|
submitForm={submitForm}
|
|
988
997
|
fetchValues={fetchValues}
|
|
989
998
|
formHasChanges={formHasChanges}
|
|
@@ -1053,14 +1062,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
1053
1062
|
>
|
|
1054
1063
|
{({ measureRef }) => (
|
|
1055
1064
|
<div className="pb-2" ref={measureRef}>
|
|
1056
|
-
{error &&
|
|
1057
|
-
<Alert
|
|
1058
|
-
className="mt-10 mb-20"
|
|
1059
|
-
message={JSON.stringify(error)}
|
|
1060
|
-
type="error"
|
|
1061
|
-
banner
|
|
1062
|
-
/>
|
|
1063
|
-
)}
|
|
1065
|
+
{error && <ErrorAlert className="mt-10 mb-20" error={error} />}
|
|
1064
1066
|
{content()}
|
|
1065
1067
|
{showFooter && footer()}
|
|
1066
1068
|
</div>
|
|
@@ -57,7 +57,12 @@ export const GraphChart = (props: GraphChartProps) => {
|
|
|
57
57
|
return (
|
|
58
58
|
<div style={{ padding: "1rem" }}>
|
|
59
59
|
<p style={{ textAlign: "right" }}>
|
|
60
|
-
{`${t("totalRegisters")} ${evaluatedEntries?.length
|
|
60
|
+
{`${t("totalRegisters")} ${evaluatedEntries?.length?.toLocaleString(
|
|
61
|
+
"es-ES",
|
|
62
|
+
{
|
|
63
|
+
useGrouping: true,
|
|
64
|
+
}
|
|
65
|
+
)}`}
|
|
61
66
|
</p>
|
|
62
67
|
<Chart
|
|
63
68
|
{...getGraphProps({
|
|
@@ -1,13 +1,67 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
|
|
3
|
+
const formatter = (graphType: "pie" | "default" | "barGrouped") => {
|
|
4
|
+
return (object: any) => {
|
|
5
|
+
const formattedValue = object.value.toLocaleString("es-ES", {
|
|
6
|
+
useGrouping: true,
|
|
7
|
+
});
|
|
8
|
+
const name = graphType === "pie" ? object.x : object.type;
|
|
9
|
+
return { name, value: formattedValue };
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const axisFormatter = (value: any) => {
|
|
14
|
+
if (typeof value === "string" && stringIsValidNumeric(value)) {
|
|
15
|
+
return parseFloat(value).toLocaleString("es-ES", {
|
|
16
|
+
useGrouping: true,
|
|
17
|
+
});
|
|
18
|
+
} else if (isNumber(value)) {
|
|
19
|
+
return value.toLocaleString("es-ES", {
|
|
20
|
+
useGrouping: true,
|
|
21
|
+
});
|
|
22
|
+
} else if (isValidDateString(value)) {
|
|
23
|
+
const dateType = getDateType(value);
|
|
24
|
+
if (dateType === null) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
return dayjs(value, (dateFormats.input as any)[dateType]).format(
|
|
28
|
+
(dateFormats.output as any)[dateType]
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const stringIsValidNumeric = (value: string) => {
|
|
36
|
+
const regex = /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;
|
|
37
|
+
return regex.test(value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const isNumber = (value: any) => {
|
|
41
|
+
return typeof value === "number" && !isNaN(value);
|
|
42
|
+
};
|
|
43
|
+
|
|
1
44
|
const DefaultGraphOptions = {
|
|
2
45
|
default: {
|
|
3
46
|
padding: "auto",
|
|
4
47
|
xAxis: {
|
|
5
48
|
tickCount: 5,
|
|
49
|
+
label: {
|
|
50
|
+
formatter: axisFormatter,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
yAxis: {
|
|
54
|
+
label: {
|
|
55
|
+
formatter: axisFormatter,
|
|
56
|
+
},
|
|
6
57
|
},
|
|
7
58
|
legend: {
|
|
8
59
|
maxWidthRatio: 0.5,
|
|
9
60
|
maxItemWidth: 1000,
|
|
10
61
|
},
|
|
62
|
+
tooltip: {
|
|
63
|
+
formatter: formatter("default"),
|
|
64
|
+
},
|
|
11
65
|
},
|
|
12
66
|
pie: {
|
|
13
67
|
appendPadding: 10,
|
|
@@ -25,6 +79,9 @@ const DefaultGraphOptions = {
|
|
|
25
79
|
maxWidthRatio: 0.5,
|
|
26
80
|
maxItemWidth: 1000,
|
|
27
81
|
},
|
|
82
|
+
tooltip: {
|
|
83
|
+
formatter: formatter("pie"),
|
|
84
|
+
},
|
|
28
85
|
interactions: [
|
|
29
86
|
{
|
|
30
87
|
type: "element-active",
|
|
@@ -37,6 +94,19 @@ const DefaultGraphOptions = {
|
|
|
37
94
|
maxWidthRatio: 0.5,
|
|
38
95
|
maxItemWidth: 1000,
|
|
39
96
|
},
|
|
97
|
+
tooltip: {
|
|
98
|
+
formatter: formatter("barGrouped"),
|
|
99
|
+
},
|
|
100
|
+
xAxis: {
|
|
101
|
+
label: {
|
|
102
|
+
formatter: axisFormatter,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
yAxis: {
|
|
106
|
+
label: {
|
|
107
|
+
formatter: axisFormatter,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
40
110
|
label: {
|
|
41
111
|
position: "middle",
|
|
42
112
|
layout: [
|
|
@@ -54,4 +124,47 @@ const DefaultGraphOptions = {
|
|
|
54
124
|
},
|
|
55
125
|
};
|
|
56
126
|
|
|
127
|
+
function isValidDateString(variable: any): boolean {
|
|
128
|
+
// Check if the variable is defined and is a string
|
|
129
|
+
if (typeof variable !== "string" || variable === undefined) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Check if the string is a valid date
|
|
134
|
+
const date = new Date(variable);
|
|
135
|
+
return date.toString() !== "Invalid Date";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const dateFormats = {
|
|
139
|
+
input: {
|
|
140
|
+
hours: "YYYY-MM-DD HH:mm",
|
|
141
|
+
days: "YYYY-MM-DD",
|
|
142
|
+
weeks: "YYYY-[W]WW",
|
|
143
|
+
months: "YYYY-MM",
|
|
144
|
+
years: "YYYY",
|
|
145
|
+
},
|
|
146
|
+
output: {
|
|
147
|
+
hours: "DD/MM/YYYY HH:mm",
|
|
148
|
+
days: "DD/MM/YYYY",
|
|
149
|
+
weeks: "[W]WW/YYYY",
|
|
150
|
+
months: "MM/YYYY",
|
|
151
|
+
years: "YYYY",
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
function getDateType(dateString: string): string | null {
|
|
156
|
+
for (const format in dateFormats.input) {
|
|
157
|
+
const isValidFormat = dayjs(
|
|
158
|
+
dateString,
|
|
159
|
+
(dateFormats.input as any)[format],
|
|
160
|
+
true
|
|
161
|
+
).isValid();
|
|
162
|
+
if (isValidFormat) {
|
|
163
|
+
return format;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
57
170
|
export default DefaultGraphOptions;
|
|
@@ -273,7 +273,11 @@ function CommonIndicator({
|
|
|
273
273
|
? minFontSize
|
|
274
274
|
: height * fontGrowFactor;
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
const localeValue = value?.toLocaleString("es-ES", {
|
|
277
|
+
useGrouping: true,
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
let finalValue = total ? `${localeValue}/${total}` : `${localeValue}`;
|
|
277
281
|
|
|
278
282
|
if (suffix) {
|
|
279
283
|
finalValue += " " + suffix;
|
|
@@ -342,13 +346,23 @@ function PercentageIndicator({
|
|
|
342
346
|
? minFontSize
|
|
343
347
|
: twoLinesHeight * fontGrowFactor;
|
|
344
348
|
|
|
345
|
-
|
|
349
|
+
const localeValue = value?.toLocaleString("es-ES", {
|
|
350
|
+
useGrouping: true,
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
let finalValue = total
|
|
354
|
+
? `${localeValue}/${total?.toLocaleString("es-ES", {
|
|
355
|
+
useGrouping: true,
|
|
356
|
+
})}`
|
|
357
|
+
: `${localeValue}`;
|
|
346
358
|
|
|
347
359
|
if (suffix) {
|
|
348
360
|
finalValue += " " + suffix;
|
|
349
361
|
}
|
|
350
362
|
|
|
351
|
-
const percentValue = `${percent
|
|
363
|
+
const percentValue = `${percent?.toLocaleString("es-ES", {
|
|
364
|
+
useGrouping: true,
|
|
365
|
+
})}%`;
|
|
352
366
|
|
|
353
367
|
let tw = getTextWidth(
|
|
354
368
|
percentValue,
|
|
@@ -382,10 +396,8 @@ function PercentageIndicator({
|
|
|
382
396
|
>
|
|
383
397
|
<Row align={"middle"}>
|
|
384
398
|
{IconElement && (
|
|
385
|
-
<Col>
|
|
386
|
-
<IconElement
|
|
387
|
-
style={{ fontSize: fontSize * 1, color, paddingRight: "10px" }}
|
|
388
|
-
/>
|
|
399
|
+
<Col style={{ fontSize: fontSize * 1, color, paddingRight: "10px" }}>
|
|
400
|
+
<IconElement />
|
|
389
401
|
</Col>
|
|
390
402
|
)}
|
|
391
403
|
<Col>
|
|
@@ -295,6 +295,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
295
295
|
formView.search_fields,
|
|
296
296
|
treeView.search_fields,
|
|
297
297
|
])}
|
|
298
|
+
formXml={formView.arch}
|
|
298
299
|
onClear={clear}
|
|
299
300
|
limit={limit}
|
|
300
301
|
offset={offset}
|
|
@@ -307,6 +308,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
307
308
|
searchValues={searchValues}
|
|
308
309
|
/>
|
|
309
310
|
<Tree
|
|
311
|
+
context={parentContext}
|
|
310
312
|
total={totalItems}
|
|
311
313
|
limit={limit}
|
|
312
314
|
page={page}
|
|
@@ -327,6 +329,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
327
329
|
treeView.isExpandable ? fetchChildrenForRecord : undefined
|
|
328
330
|
}
|
|
329
331
|
childField={treeView.field_parent}
|
|
332
|
+
rootTree={rootTree}
|
|
330
333
|
/>
|
|
331
334
|
</>
|
|
332
335
|
);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Pagination, Checkbox, Space, Row, Col, Spin } from "antd";
|
|
2
|
+
import { Pagination, Checkbox, Space, Row, Col, Spin, Tag } from "antd";
|
|
3
3
|
import { getTree, getTableColumns, getTableItems } from "@/helpers/treeHelper";
|
|
4
4
|
import { Tree as TreeOoui } from "@gisce/ooui";
|
|
5
5
|
|
|
6
6
|
import { TreeView, Column } from "@/types";
|
|
7
7
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
8
|
-
import { Many2oneSuffix } from "../base/many2one/Many2oneSuffix";
|
|
9
8
|
import { calculateColumnsWidth } from "@/helpers/dynamicColumnsHelper";
|
|
10
9
|
import { parseFloatToString } from "@/helpers/timeHelper";
|
|
11
10
|
import { ProgressBarInput } from "../base/ProgressBar";
|
|
@@ -16,6 +15,15 @@ import {
|
|
|
16
15
|
LoadingOutlined,
|
|
17
16
|
} from "@ant-design/icons";
|
|
18
17
|
import { One2manyValue } from "../base/one2many/One2manyInput";
|
|
18
|
+
import { Interweave } from "interweave";
|
|
19
|
+
import {
|
|
20
|
+
ActionViewContext,
|
|
21
|
+
ActionViewContextType,
|
|
22
|
+
} from "@/context/ActionViewContext";
|
|
23
|
+
import { Many2oneTree } from "../base/many2one/Many2oneTree";
|
|
24
|
+
import { ReferenceTree } from "../base/ReferenceTree";
|
|
25
|
+
import dayjs from "dayjs";
|
|
26
|
+
import { DatePickerConfig } from "@/common/DatePicker";
|
|
19
27
|
|
|
20
28
|
type Props = {
|
|
21
29
|
total?: number;
|
|
@@ -34,6 +42,8 @@ type Props = {
|
|
|
34
42
|
sorter?: any;
|
|
35
43
|
onFetchChildrenForRecord?: (item: any) => Promise<any[]>;
|
|
36
44
|
childField?: string;
|
|
45
|
+
rootTree?: boolean;
|
|
46
|
+
context?: any;
|
|
37
47
|
};
|
|
38
48
|
|
|
39
49
|
const booleanComponentFn = (value: boolean): React.ReactElement => {
|
|
@@ -51,18 +61,30 @@ const booleanComponentFn = (value: boolean): React.ReactElement => {
|
|
|
51
61
|
};
|
|
52
62
|
|
|
53
63
|
const many2OneComponentFn = (m2oField: any): React.ReactElement => {
|
|
54
|
-
|
|
55
|
-
return <></>;
|
|
56
|
-
}
|
|
57
|
-
return (
|
|
58
|
-
<Space>
|
|
59
|
-
<>{m2oField.value}</>
|
|
60
|
-
<Many2oneSuffix id={m2oField.id} model={m2oField.model} />
|
|
61
|
-
</Space>
|
|
62
|
-
);
|
|
64
|
+
return <Many2oneTree m2oField={m2oField} />;
|
|
63
65
|
};
|
|
66
|
+
|
|
64
67
|
const textComponentFn = (value: any): React.ReactElement => {
|
|
65
|
-
return <
|
|
68
|
+
return <Interweave content={value?.replace(/(?:\r\n|\r|\n)/g, "<br>")} />;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const dateComponentFn = (value: any): React.ReactElement => {
|
|
72
|
+
if (!value || (value && value.length === 0)) return <></>;
|
|
73
|
+
|
|
74
|
+
const formattedValue = dayjs(
|
|
75
|
+
value,
|
|
76
|
+
DatePickerConfig.date.dateInternalFormat
|
|
77
|
+
).format(DatePickerConfig.date.dateDisplayFormat);
|
|
78
|
+
return <>{formattedValue}</>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const dateTimeComponentFn = (value: any): React.ReactElement => {
|
|
82
|
+
if (!value || (value && value.length === 0)) return <></>;
|
|
83
|
+
const formattedValue = dayjs(
|
|
84
|
+
value,
|
|
85
|
+
DatePickerConfig.time.dateInternalFormat
|
|
86
|
+
).format(DatePickerConfig.time.dateDisplayFormat);
|
|
87
|
+
return <>{formattedValue}</>;
|
|
66
88
|
};
|
|
67
89
|
|
|
68
90
|
const one2ManyComponentFn = (value: One2manyValue): React.ReactElement => {
|
|
@@ -91,6 +113,47 @@ const imageComponent = (value: string): React.ReactElement => {
|
|
|
91
113
|
);
|
|
92
114
|
};
|
|
93
115
|
|
|
116
|
+
const TagComponent = (
|
|
117
|
+
value: any,
|
|
118
|
+
key: string,
|
|
119
|
+
ooui: any,
|
|
120
|
+
context: any
|
|
121
|
+
): React.ReactElement => {
|
|
122
|
+
return (
|
|
123
|
+
<>
|
|
124
|
+
{value ? <Tag color={ooui.colors[value]}>{ooui.selectionValues.get(value)}</Tag> : null}
|
|
125
|
+
</>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const SelectionComponent = (
|
|
130
|
+
value: any,
|
|
131
|
+
key: string,
|
|
132
|
+
ooui: any,
|
|
133
|
+
context: any
|
|
134
|
+
): React.ReactElement => {
|
|
135
|
+
return (
|
|
136
|
+
<>{ooui.selectionValues.get(value)}</>
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const referenceComponent = (
|
|
141
|
+
value: any,
|
|
142
|
+
key: string,
|
|
143
|
+
ooui: any,
|
|
144
|
+
context: any
|
|
145
|
+
): React.ReactElement => {
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<ReferenceTree
|
|
149
|
+
value={value}
|
|
150
|
+
selectionValues={ooui.selectionValues}
|
|
151
|
+
context={context}
|
|
152
|
+
/>
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
94
157
|
function Tree(props: Props): React.ReactElement {
|
|
95
158
|
const {
|
|
96
159
|
page = 1,
|
|
@@ -109,6 +172,8 @@ function Tree(props: Props): React.ReactElement {
|
|
|
109
172
|
sorter,
|
|
110
173
|
onFetchChildrenForRecord,
|
|
111
174
|
childField,
|
|
175
|
+
rootTree = false,
|
|
176
|
+
context,
|
|
112
177
|
} = props;
|
|
113
178
|
|
|
114
179
|
const [items, setItems] = useState<Array<any>>([]);
|
|
@@ -121,23 +186,42 @@ function Tree(props: Props): React.ReactElement {
|
|
|
121
186
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
122
187
|
const internalLimit = useRef(limit);
|
|
123
188
|
|
|
189
|
+
const actionViewContext = useContext(
|
|
190
|
+
ActionViewContext
|
|
191
|
+
) as ActionViewContextType;
|
|
192
|
+
const { title = undefined, setTitle = undefined } =
|
|
193
|
+
(rootTree ? actionViewContext : {}) || {};
|
|
194
|
+
|
|
124
195
|
useEffect(() => {
|
|
125
196
|
treeOoui.current = getTree(treeView);
|
|
126
197
|
|
|
127
|
-
const columns = getTableColumns(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
198
|
+
const columns = getTableColumns(
|
|
199
|
+
treeOoui.current,
|
|
200
|
+
{
|
|
201
|
+
boolean: booleanComponentFn,
|
|
202
|
+
many2one: many2OneComponentFn,
|
|
203
|
+
text: textComponentFn,
|
|
204
|
+
one2many: one2ManyComponentFn,
|
|
205
|
+
many2many: one2ManyComponentFn,
|
|
206
|
+
progressbar: progressBarComponentFn,
|
|
207
|
+
float_time: floatTimeComponent,
|
|
208
|
+
image: imageComponent,
|
|
209
|
+
integer: numberComponent,
|
|
210
|
+
float: numberComponent,
|
|
211
|
+
reference: referenceComponent,
|
|
212
|
+
tag: TagComponent,
|
|
213
|
+
selection: SelectionComponent,
|
|
214
|
+
date: dateComponentFn,
|
|
215
|
+
datetime: dateTimeComponentFn,
|
|
216
|
+
},
|
|
217
|
+
context
|
|
218
|
+
);
|
|
139
219
|
|
|
140
220
|
setColumns(columns);
|
|
221
|
+
|
|
222
|
+
if (treeOoui.current.string && title !== treeOoui.current.string) {
|
|
223
|
+
setTitle?.(treeOoui.current.string);
|
|
224
|
+
}
|
|
141
225
|
}, [treeView]);
|
|
142
226
|
|
|
143
227
|
useEffect(() => {
|
|
@@ -171,7 +255,9 @@ function Tree(props: Props): React.ReactElement {
|
|
|
171
255
|
<Col span={12}>
|
|
172
256
|
<Pagination
|
|
173
257
|
total={total}
|
|
174
|
-
pageSize={
|
|
258
|
+
pageSize={
|
|
259
|
+
internalLimit.current === 0 ? total : internalLimit.current
|
|
260
|
+
}
|
|
175
261
|
current={page}
|
|
176
262
|
showSizeChanger={false}
|
|
177
263
|
onChange={onRequestPageChange}
|
|
@@ -216,7 +302,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
216
302
|
});
|
|
217
303
|
|
|
218
304
|
return (
|
|
219
|
-
<div className="p-1 pb-0 pl-2 mt-2
|
|
305
|
+
<div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>
|
|
220
306
|
);
|
|
221
307
|
}
|
|
222
308
|
|