@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Divider } from "antd";
|
|
2
|
+
import { Divider, Space } from "antd";
|
|
3
3
|
import { Separator as SeparatorOoui } from "@gisce/ooui";
|
|
4
|
+
import iconMapper from "@/helpers/iconMapper";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
ooui: SeparatorOoui;
|
|
@@ -8,11 +9,18 @@ type Props = {
|
|
|
8
9
|
|
|
9
10
|
export const Separator = (props: Props) => {
|
|
10
11
|
const { ooui } = props;
|
|
11
|
-
const { label } = ooui;
|
|
12
|
+
const { label, icon } = ooui;
|
|
13
|
+
const Icon : React.ElementType | undefined = iconMapper(icon || "");
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
return (
|
|
14
17
|
<Divider orientation="left" className="text-sm">
|
|
15
|
-
{label
|
|
18
|
+
{ (Icon || label) &&
|
|
19
|
+
<Space>
|
|
20
|
+
{Icon ? <Icon /> : null}
|
|
21
|
+
{label}
|
|
22
|
+
</Space>
|
|
23
|
+
}
|
|
16
24
|
</Divider>
|
|
17
25
|
);
|
|
18
26
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React, { useContext, useState } from "react";
|
|
2
|
-
import { Input, Row } from "antd";
|
|
1
|
+
import React, { CSSProperties, useContext, useState } from "react";
|
|
2
|
+
import { Input, Row, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
|
-
import Config from "@/Config";
|
|
5
4
|
import { Text as TextOoui } from "@gisce/ooui";
|
|
6
5
|
import { TranslationModal } from "../modals/TranslationModal";
|
|
7
6
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
@@ -9,6 +8,7 @@ import ButtonWithTooltip from "@/common/ButtonWithTooltip";
|
|
|
9
8
|
import { TranslationOutlined } from "@ant-design/icons";
|
|
10
9
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
11
10
|
import showInfo from "@/ui/InfoDialog";
|
|
11
|
+
const { useToken } = theme;
|
|
12
12
|
|
|
13
13
|
const { TextArea } = Input;
|
|
14
14
|
|
|
@@ -19,8 +19,11 @@ type Props = {
|
|
|
19
19
|
const Text = (props: Props) => {
|
|
20
20
|
const { ooui } = props;
|
|
21
21
|
const { id, readOnly, required, height, translatable } = ooui;
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const { token } = useToken();
|
|
23
|
+
const requiredStyle =
|
|
24
|
+
required && !readOnly
|
|
25
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
26
|
+
: undefined;
|
|
24
27
|
const formContext = useContext(FormContext) as FormContextType;
|
|
25
28
|
const { elementHasLostFocus } = formContext || {};
|
|
26
29
|
|
|
@@ -29,14 +32,13 @@ const Text = (props: Props) => {
|
|
|
29
32
|
{translatable ? (
|
|
30
33
|
<TranslatableText
|
|
31
34
|
field={id}
|
|
32
|
-
requiredClass={requiredClass}
|
|
33
35
|
height={height}
|
|
36
|
+
requiredStyle={requiredStyle}
|
|
34
37
|
/>
|
|
35
38
|
) : (
|
|
36
39
|
<TextArea
|
|
37
40
|
disabled={readOnly || translatable}
|
|
38
|
-
|
|
39
|
-
style={{ height: height ? height + "px" : "100%" }}
|
|
41
|
+
style={{ height: height ? height + "px" : "100%", ...requiredStyle }}
|
|
40
42
|
rows={4}
|
|
41
43
|
onBlur={elementHasLostFocus}
|
|
42
44
|
/>
|
|
@@ -48,13 +50,13 @@ const Text = (props: Props) => {
|
|
|
48
50
|
const TranslatableText = ({
|
|
49
51
|
value,
|
|
50
52
|
field,
|
|
51
|
-
|
|
53
|
+
requiredStyle,
|
|
52
54
|
onChange,
|
|
53
55
|
height,
|
|
54
56
|
}: {
|
|
55
57
|
value?: string;
|
|
56
58
|
field: string;
|
|
57
|
-
|
|
59
|
+
requiredStyle: CSSProperties | undefined;
|
|
58
60
|
height: number | undefined;
|
|
59
61
|
onChange?: (value: string) => void;
|
|
60
62
|
}) => {
|
|
@@ -80,9 +82,9 @@ const TranslatableText = ({
|
|
|
80
82
|
}}
|
|
81
83
|
style={{
|
|
82
84
|
height: height ? height + "px" : "100%",
|
|
85
|
+
...requiredStyle
|
|
83
86
|
}}
|
|
84
87
|
id={field}
|
|
85
|
-
className={requiredClass}
|
|
86
88
|
rows={4}
|
|
87
89
|
onBlur={elementHasLostFocus}
|
|
88
90
|
/>
|
|
@@ -128,10 +130,10 @@ const TranslatableText = ({
|
|
|
128
130
|
style={{
|
|
129
131
|
height: height ? height + "px" : "100%",
|
|
130
132
|
cursor: "pointer",
|
|
133
|
+
...requiredStyle
|
|
131
134
|
}}
|
|
132
135
|
id={field}
|
|
133
136
|
disabled={true}
|
|
134
|
-
className={requiredClass}
|
|
135
137
|
rows={4}
|
|
136
138
|
onBlur={elementHasLostFocus}
|
|
137
139
|
/>
|
|
@@ -6,13 +6,17 @@ import {
|
|
|
6
6
|
LoadingOutlined,
|
|
7
7
|
} from "@ant-design/icons";
|
|
8
8
|
import styled from "styled-components";
|
|
9
|
+
import { theme } from "antd";
|
|
10
|
+
|
|
11
|
+
const { defaultAlgorithm, defaultSeed } = theme;
|
|
12
|
+
|
|
13
|
+
const mapToken = defaultAlgorithm(defaultSeed);
|
|
9
14
|
|
|
10
15
|
import {
|
|
11
16
|
Many2one as Many2oneOoui,
|
|
12
17
|
transformDomainForChildWidget,
|
|
13
18
|
} from "@gisce/ooui";
|
|
14
19
|
import Field from "@/common/Field";
|
|
15
|
-
import Config from "@/Config";
|
|
16
20
|
import { SearchModal } from "@/widgets/modals/SearchModal";
|
|
17
21
|
import { FormModal } from "@/widgets/modals/FormModal";
|
|
18
22
|
import ConnectionProvider from "@/ConnectionProvider";
|
|
@@ -65,8 +69,10 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
65
69
|
id: fieldName,
|
|
66
70
|
domain: widgetDomain,
|
|
67
71
|
} = ooui;
|
|
68
|
-
const
|
|
69
|
-
required && !readOnly
|
|
72
|
+
const requiredStyle =
|
|
73
|
+
required && !readOnly
|
|
74
|
+
? { backgroundColor: mapToken.colorPrimaryBg }
|
|
75
|
+
: undefined;
|
|
70
76
|
const [showSearchModal, setShowSearchModal] = useState<boolean>(false);
|
|
71
77
|
const [showFormModal, setShowFormModal] = useState<boolean>(false);
|
|
72
78
|
const [searching, setSearching] = useState<boolean>(false);
|
|
@@ -75,14 +81,8 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
75
81
|
const [inputText, setInputText] = useState<string>("");
|
|
76
82
|
const inputTextRef = useRef<string>();
|
|
77
83
|
const formContext = useContext(FormContext) as FormContextType;
|
|
78
|
-
const {
|
|
79
|
-
|
|
80
|
-
getValues,
|
|
81
|
-
getFields,
|
|
82
|
-
getContext,
|
|
83
|
-
setOriginalValue,
|
|
84
|
-
elementHasLostFocus,
|
|
85
|
-
} = formContext || {};
|
|
84
|
+
const { domain, getValues, getFields, getContext, elementHasLostFocus } =
|
|
85
|
+
formContext || {};
|
|
86
86
|
const transformedDomain = useRef<any[]>([]);
|
|
87
87
|
const [searchDomain, setSearchDomain] = useState<any>([]);
|
|
88
88
|
|
|
@@ -132,13 +132,12 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
132
132
|
if (transformedDomain.current && transformedDomain.current.length > 0) {
|
|
133
133
|
tryFetchFirstResultOrShowSearch(inputTextRef.current as string);
|
|
134
134
|
} else {
|
|
135
|
-
const results: any[] =
|
|
136
|
-
{
|
|
135
|
+
const results: any[] =
|
|
136
|
+
await ConnectionProvider.getHandler().nameSearch({
|
|
137
137
|
model: relation,
|
|
138
138
|
payload: inputTextRef.current as string,
|
|
139
139
|
context: { ...getContext?.(), ...context },
|
|
140
|
-
}
|
|
141
|
-
);
|
|
140
|
+
});
|
|
142
141
|
|
|
143
142
|
if (results.length === 1) {
|
|
144
143
|
inputTextRef.current = undefined;
|
|
@@ -167,7 +166,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
167
166
|
});
|
|
168
167
|
|
|
169
168
|
if (resultIds.length === 1) {
|
|
170
|
-
fetchNameAndUpdate(resultIds[0]
|
|
169
|
+
fetchNameAndUpdate(resultIds[0]);
|
|
171
170
|
} else {
|
|
172
171
|
setSearchText(text);
|
|
173
172
|
setShowSearchModal(true);
|
|
@@ -179,10 +178,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
179
178
|
setShowSearchModal(true);
|
|
180
179
|
};
|
|
181
180
|
|
|
182
|
-
const fetchNameAndUpdate = async (
|
|
183
|
-
id: number,
|
|
184
|
-
mustUpdateOriginalForm?: boolean
|
|
185
|
-
) => {
|
|
181
|
+
const fetchNameAndUpdate = async (id: number) => {
|
|
186
182
|
setSearching(true);
|
|
187
183
|
|
|
188
184
|
try {
|
|
@@ -194,10 +190,6 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
194
190
|
});
|
|
195
191
|
|
|
196
192
|
triggerChange([id, value[0][1]]);
|
|
197
|
-
|
|
198
|
-
if (mustUpdateOriginalForm) {
|
|
199
|
-
setOriginalValue(ooui.id, [id, value[0][1]]);
|
|
200
|
-
}
|
|
201
193
|
} catch (err) {
|
|
202
194
|
showErrorDialog(err);
|
|
203
195
|
} finally {
|
|
@@ -207,16 +199,16 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
207
199
|
|
|
208
200
|
async function parseDomain() {
|
|
209
201
|
if (widgetDomain) {
|
|
210
|
-
transformedDomain.current =
|
|
211
|
-
{
|
|
202
|
+
transformedDomain.current =
|
|
203
|
+
await ConnectionProvider.getHandler().evalDomain({
|
|
212
204
|
domain: widgetDomain,
|
|
213
205
|
values: transformPlainMany2Ones({
|
|
214
206
|
fields: getFields(),
|
|
215
207
|
values: getValues(),
|
|
216
208
|
}),
|
|
209
|
+
fields: getFields(),
|
|
217
210
|
context: getContext(),
|
|
218
|
-
}
|
|
219
|
-
);
|
|
211
|
+
});
|
|
220
212
|
}
|
|
221
213
|
|
|
222
214
|
if (domain && domain.length > 0) {
|
|
@@ -232,7 +224,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
232
224
|
}
|
|
233
225
|
|
|
234
226
|
async function onKeyDown(event: any) {
|
|
235
|
-
if (event.
|
|
227
|
+
if (event.keyCode === 13) {
|
|
236
228
|
event.preventDefault();
|
|
237
229
|
event.stopPropagation();
|
|
238
230
|
await onElementLostFocus();
|
|
@@ -253,7 +245,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
253
245
|
value={inputText}
|
|
254
246
|
disabled={readOnly}
|
|
255
247
|
onChange={onValueStringChange}
|
|
256
|
-
|
|
248
|
+
style={requiredStyle}
|
|
257
249
|
onBlur={onElementLostFocus}
|
|
258
250
|
onKeyDown={onKeyDown}
|
|
259
251
|
suffix={
|
|
@@ -272,6 +264,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
272
264
|
onClick={() => {
|
|
273
265
|
setShowFormModal(true);
|
|
274
266
|
}}
|
|
267
|
+
style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
|
|
275
268
|
tabIndex={-1}
|
|
276
269
|
/>
|
|
277
270
|
</Col>
|
|
@@ -283,6 +276,7 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
283
276
|
searchButtonTappedRef.current = true;
|
|
284
277
|
tryFetchFirstResultOrShowSearch(text);
|
|
285
278
|
}}
|
|
279
|
+
style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0 }}
|
|
286
280
|
tabIndex={-1}
|
|
287
281
|
/>
|
|
288
282
|
</Col>
|
|
@@ -324,6 +318,6 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
324
318
|
|
|
325
319
|
const RequiredInput = styled(Input)`
|
|
326
320
|
.ant-input {
|
|
327
|
-
background-color: ${
|
|
321
|
+
background-color: ${mapToken.colorPrimaryBg};
|
|
328
322
|
}
|
|
329
323
|
`;
|
|
@@ -14,10 +14,10 @@ export const Many2oneSuffixModal = (props: Props) => {
|
|
|
14
14
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<Modal
|
|
17
|
+
(<Modal
|
|
18
18
|
title={t("selectAction")}
|
|
19
19
|
centered
|
|
20
|
-
|
|
20
|
+
open={visible}
|
|
21
21
|
footer={null}
|
|
22
22
|
destroyOnClose
|
|
23
23
|
onCancel={onCancel}
|
|
@@ -37,6 +37,6 @@ export const Many2oneSuffixModal = (props: Props) => {
|
|
|
37
37
|
);
|
|
38
38
|
})}
|
|
39
39
|
</Space>
|
|
40
|
-
</Modal>
|
|
40
|
+
</Modal>)
|
|
41
41
|
);
|
|
42
42
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Space } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Many2oneSuffix } from "./Many2oneSuffix";
|
|
4
|
+
|
|
5
|
+
export type Many2oneTreeProps = { m2oField: any };
|
|
6
|
+
|
|
7
|
+
export const Many2oneTree = (props: Many2oneTreeProps): React.ReactElement => {
|
|
8
|
+
const { m2oField } = props;
|
|
9
|
+
if (!m2oField) {
|
|
10
|
+
return <></>;
|
|
11
|
+
}
|
|
12
|
+
return (
|
|
13
|
+
<Space>
|
|
14
|
+
<>{m2oField.value}</>
|
|
15
|
+
<Many2oneSuffix id={m2oField.id} model={m2oField.model} />
|
|
16
|
+
</Space>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
useRef,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useCallback,
|
|
7
|
+
} from "react";
|
|
2
8
|
import { One2many as One2manyOoui } from "@gisce/ooui";
|
|
3
9
|
import { Alert, Spin } from "antd";
|
|
4
10
|
import { Form } from "@/index";
|
|
@@ -25,7 +31,7 @@ import { One2manyTopBar } from "@/widgets/base/one2many/One2manyTopBar";
|
|
|
25
31
|
import { readObjectValues, getNextPendingId } from "@/helpers/one2manyHelper";
|
|
26
32
|
import { SearchModal } from "@/widgets/modals/SearchModal";
|
|
27
33
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
28
|
-
import { sortResults } from "@/helpers/treeHelper";
|
|
34
|
+
import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
|
|
29
35
|
import { transformPlainMany2Ones } from "@/helpers/formHelper";
|
|
30
36
|
|
|
31
37
|
type One2manyValue = {
|
|
@@ -83,7 +89,6 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
83
89
|
formContext || {};
|
|
84
90
|
const { lang, t } = useContext(LocaleContext) as LocaleContextType;
|
|
85
91
|
|
|
86
|
-
const formRef = useRef();
|
|
87
92
|
const [formHasChanges, setFormHasChanges] = useState<boolean>(false);
|
|
88
93
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
89
94
|
const [error, setError] = useState<string>();
|
|
@@ -96,6 +101,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
96
101
|
const transformedDomain = useRef<any[]>([]);
|
|
97
102
|
const [sorter, setSorter] = useState<any>();
|
|
98
103
|
const originalSortItemIds = useRef<number[]>();
|
|
104
|
+
const [colorsForResults, setColorsForResults] = useState<any>(undefined);
|
|
99
105
|
|
|
100
106
|
const {
|
|
101
107
|
readOnly,
|
|
@@ -106,14 +112,31 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
106
112
|
const isMany2many = ooui.type === "many2many";
|
|
107
113
|
const { id: fieldName } = ooui;
|
|
108
114
|
const itemsToShow = items.filter(
|
|
109
|
-
(item) =>
|
|
115
|
+
(item) =>
|
|
116
|
+
(item.values || item.treeValues) && item.operation !== "pendingRemove"
|
|
110
117
|
);
|
|
118
|
+
const previousCurrentView = useRef<ViewType>();
|
|
111
119
|
|
|
112
120
|
useEffect(() => {
|
|
113
|
-
if (
|
|
121
|
+
if (previousCurrentView.current !== currentView) {
|
|
122
|
+
previousCurrentView.current = currentView;
|
|
123
|
+
fetchDataIfNeeded();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
fetchDataIfNeeded();
|
|
128
|
+
}, [items, currentView]);
|
|
129
|
+
|
|
130
|
+
const fetchDataIfNeeded = useCallback(() => {
|
|
131
|
+
if (currentView === "form" && items.some((item) => !item.values)) {
|
|
132
|
+
fetchData();
|
|
133
|
+
} else if (
|
|
134
|
+
currentView === "tree" &&
|
|
135
|
+
items.some((item) => !item.treeValues)
|
|
136
|
+
) {
|
|
114
137
|
fetchData();
|
|
115
138
|
}
|
|
116
|
-
}, [items]);
|
|
139
|
+
}, [items, currentView]);
|
|
117
140
|
|
|
118
141
|
useEffect(() => {
|
|
119
142
|
parseDomain();
|
|
@@ -133,25 +156,36 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
133
156
|
}
|
|
134
157
|
};
|
|
135
158
|
|
|
136
|
-
const fetchOriginalItemsFromApi = async () => {
|
|
159
|
+
const fetchOriginalItemsFromApi = async (mode?: ViewType) => {
|
|
137
160
|
setIsLoading(true);
|
|
138
161
|
setFormHasChanges(false);
|
|
139
162
|
setError(undefined);
|
|
140
163
|
|
|
141
164
|
try {
|
|
142
|
-
const itemsWithValues = await readObjectValues({
|
|
143
|
-
|
|
144
|
-
|
|
165
|
+
const [itemsWithValues, evaluatedColorsForTree] = await readObjectValues({
|
|
166
|
+
treeView: {
|
|
167
|
+
arch: views.get("tree")?.arch,
|
|
168
|
+
fields: views.get("tree")?.fields,
|
|
169
|
+
},
|
|
170
|
+
formView: {
|
|
171
|
+
fields: views.get("form")?.fields || {},
|
|
172
|
+
},
|
|
145
173
|
model: relation,
|
|
146
174
|
items,
|
|
147
175
|
context: { ...getContext?.(), ...context },
|
|
176
|
+
currentView: mode || currentView,
|
|
148
177
|
});
|
|
149
178
|
|
|
150
179
|
if (!originalSortItemIds.current) {
|
|
151
180
|
originalSortItemIds.current = itemsWithValues.map((item) => item.id!);
|
|
152
181
|
}
|
|
153
182
|
|
|
183
|
+
if ((currentView || mode) === "tree" && evaluatedColorsForTree) {
|
|
184
|
+
setColorsForResults(evaluatedColorsForTree);
|
|
185
|
+
}
|
|
186
|
+
|
|
154
187
|
triggerChange(itemsWithValues);
|
|
188
|
+
return itemsWithValues;
|
|
155
189
|
} catch (err) {
|
|
156
190
|
setError(err as any);
|
|
157
191
|
} finally {
|
|
@@ -168,6 +202,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
168
202
|
fields: getFields(),
|
|
169
203
|
values: getValues(),
|
|
170
204
|
}),
|
|
205
|
+
fields: getFields(),
|
|
171
206
|
context: getContext(),
|
|
172
207
|
}),
|
|
173
208
|
widgetFieldName: fieldName,
|
|
@@ -437,10 +472,19 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
437
472
|
}
|
|
438
473
|
};
|
|
439
474
|
|
|
440
|
-
const onTreeRowClicked = (record: any) => {
|
|
475
|
+
const onTreeRowClicked = async (record: any) => {
|
|
441
476
|
const { id: itemId } = record;
|
|
477
|
+
|
|
478
|
+
let itemsToLoadFrom: One2manyItem[] | undefined = items;
|
|
479
|
+
|
|
480
|
+
// We should fetch the form data if needed in order to get the form values
|
|
481
|
+
const modalItem = items.find((item) => item.id === itemId);
|
|
482
|
+
if (modalItem?.values === undefined) {
|
|
483
|
+
itemsToLoadFrom = await fetchOriginalItemsFromApi("form");
|
|
484
|
+
}
|
|
485
|
+
|
|
442
486
|
// We show the detail for the clicked item in a Form modal
|
|
443
|
-
setModalItem(
|
|
487
|
+
setModalItem(itemsToLoadFrom!.find((item) => item.id === itemId));
|
|
444
488
|
setContinuousEntryMode(false);
|
|
445
489
|
setShowFormModal(true);
|
|
446
490
|
};
|
|
@@ -506,12 +550,18 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
506
550
|
return t("noCurrentEntries");
|
|
507
551
|
}
|
|
508
552
|
|
|
553
|
+
if (
|
|
554
|
+
currentView !== previousCurrentView.current &&
|
|
555
|
+
items.some((item) => !item.values)
|
|
556
|
+
) {
|
|
557
|
+
return <Spin />;
|
|
558
|
+
}
|
|
559
|
+
|
|
509
560
|
return (
|
|
510
561
|
<Form
|
|
511
562
|
formView={views.get("form")}
|
|
512
563
|
values={itemsToShow[itemIndex]?.values}
|
|
513
564
|
parentContext={{ ...getContext?.(), ...context }}
|
|
514
|
-
ref={formRef}
|
|
515
565
|
model={relation}
|
|
516
566
|
id={itemsToShow[itemIndex]?.id}
|
|
517
567
|
submitMode={"values"}
|
|
@@ -542,16 +592,20 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
542
592
|
);
|
|
543
593
|
}
|
|
544
594
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
595
|
+
let resultsToShow = [];
|
|
596
|
+
|
|
597
|
+
if (itemsToShow.some((item) => item.treeValues)) {
|
|
598
|
+
resultsToShow = sorter
|
|
599
|
+
? sortResults({
|
|
600
|
+
resultsToSort: itemsToShow.map((item) => item.treeValues),
|
|
601
|
+
sorter,
|
|
602
|
+
fields: {
|
|
603
|
+
...views.get("tree").fields,
|
|
604
|
+
...(views.get("form")?.fields || {}),
|
|
605
|
+
},
|
|
606
|
+
})
|
|
607
|
+
: itemsToShow.map((item) => item.treeValues);
|
|
608
|
+
}
|
|
555
609
|
|
|
556
610
|
if (currentView === "tree") {
|
|
557
611
|
return (
|
|
@@ -573,6 +627,8 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
573
627
|
}}
|
|
574
628
|
sorter={sorter}
|
|
575
629
|
onChangeSort={setSorter}
|
|
630
|
+
context={{ ...getContext?.(), ...context }}
|
|
631
|
+
colorsForResults={colorsForResults}
|
|
576
632
|
/>
|
|
577
633
|
);
|
|
578
634
|
}
|
|
@@ -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}
|
|
@@ -83,7 +83,7 @@ export const ButtonGroup = (props: ButtonGroupProps) => {
|
|
|
83
83
|
type={primary ? "primary" : undefined}
|
|
84
84
|
//danger={danger ? true : undefined} This works but typescript
|
|
85
85
|
// doesn't accept
|
|
86
|
-
overlay={
|
|
86
|
+
overlay={Items({ooui: secondaryButtons})}
|
|
87
87
|
>
|
|
88
88
|
{getButtonIcon()}
|
|
89
89
|
{caption}
|
|
@@ -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 Config from "@/Config";
|
|
6
5
|
import { GridUi } from "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
|
+
};
|