@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
|
@@ -2,7 +2,11 @@ import TreeActionBar from "@/actionbar/TreeActionBar";
|
|
|
2
2
|
import { FormView, TreeView, View } from "@/types";
|
|
3
3
|
import TitleHeader from "@/ui/TitleHeader";
|
|
4
4
|
import SearchTree from "@/widgets/views/SearchTree";
|
|
5
|
-
import React from "react";
|
|
5
|
+
import React, { useContext } from "react";
|
|
6
|
+
import {
|
|
7
|
+
ActionViewContext,
|
|
8
|
+
ActionViewContextType,
|
|
9
|
+
} from "@/context/ActionViewContext";
|
|
6
10
|
|
|
7
11
|
export type TreeActionViewProps = {
|
|
8
12
|
formView?: FormView;
|
|
@@ -38,6 +42,10 @@ export const TreeActionView = (props: TreeActionViewProps) => {
|
|
|
38
42
|
searchTreeNameSearch,
|
|
39
43
|
} = props;
|
|
40
44
|
|
|
45
|
+
const { currentView, setPreviousView } = useContext(
|
|
46
|
+
ActionViewContext
|
|
47
|
+
) as ActionViewContextType;
|
|
48
|
+
|
|
41
49
|
if (!visible) {
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
@@ -66,6 +74,7 @@ export const TreeActionView = (props: TreeActionViewProps) => {
|
|
|
66
74
|
const itemIndex = results.findIndex((item: any) => {
|
|
67
75
|
return item.id === id;
|
|
68
76
|
});
|
|
77
|
+
setPreviousView?.(currentView);
|
|
69
78
|
setCurrentItemIndex(itemIndex);
|
|
70
79
|
const formView = availableViews.find(
|
|
71
80
|
(v) => v.type === "form"
|
package/src/views/tabs/Tab.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CloseOutlined } from "@ant-design/icons";
|
|
3
|
+
import { theme } from "antd";
|
|
4
|
+
const { useToken } = theme;
|
|
3
5
|
|
|
4
6
|
type TabProps = {
|
|
5
7
|
tabKey: string;
|
|
@@ -11,8 +13,8 @@ type TabProps = {
|
|
|
11
13
|
|
|
12
14
|
function Tab(props: TabProps) {
|
|
13
15
|
const { label, onClose, tabKey, isActive, onSelected } = props;
|
|
14
|
-
|
|
15
|
-
const bgColor = isActive ?
|
|
16
|
+
const { token } = useToken();
|
|
17
|
+
const bgColor = isActive ? token.colorBgContainer : token.colorPrimaryBg;
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
20
|
<div
|
|
@@ -32,14 +34,14 @@ function Tab(props: TabProps) {
|
|
|
32
34
|
flexDirection: "row",
|
|
33
35
|
alignItems: "center",
|
|
34
36
|
justifyContent: "center",
|
|
35
|
-
borderTopLeftRadius:
|
|
36
|
-
borderTopRightRadius:
|
|
37
|
+
borderTopLeftRadius: token.borderRadius,
|
|
38
|
+
borderTopRightRadius: token.borderRadius,
|
|
37
39
|
marginLeft: 2,
|
|
38
40
|
}}
|
|
39
41
|
>
|
|
40
42
|
<div
|
|
41
43
|
style={{
|
|
42
|
-
color: isActive ?
|
|
44
|
+
color: isActive ? token.colorPrimaryActive : token.colorPrimaryBorder,
|
|
43
45
|
userSelect: "none",
|
|
44
46
|
height: 40,
|
|
45
47
|
display: "flex",
|
|
@@ -63,7 +65,11 @@ function Tab(props: TabProps) {
|
|
|
63
65
|
}}
|
|
64
66
|
>
|
|
65
67
|
<CloseOutlined
|
|
66
|
-
style={{
|
|
68
|
+
style={{
|
|
69
|
+
color: isActive
|
|
70
|
+
? token.colorPrimaryActive
|
|
71
|
+
: token.colorPrimaryBorder,
|
|
72
|
+
}}
|
|
67
73
|
onClick={(e) => {
|
|
68
74
|
e.stopPropagation();
|
|
69
75
|
onClose(tabKey);
|
|
@@ -26,9 +26,11 @@ import {
|
|
|
26
26
|
FloatTime,
|
|
27
27
|
ProgressBar,
|
|
28
28
|
MultiCheckbox,
|
|
29
|
+
Markdown,
|
|
29
30
|
Radio,
|
|
30
31
|
Switch,
|
|
31
32
|
Steps,
|
|
33
|
+
Tag,
|
|
32
34
|
CodeEditor,
|
|
33
35
|
} from "@/index";
|
|
34
36
|
import { Image } from "./base/Image";
|
|
@@ -99,8 +101,12 @@ const getWidgetType = (type: string) => {
|
|
|
99
101
|
return Indicator;
|
|
100
102
|
case "tags":
|
|
101
103
|
return Tags;
|
|
104
|
+
case "tag":
|
|
105
|
+
return Tag;
|
|
102
106
|
case "multicheckbox":
|
|
103
107
|
return MultiCheckbox;
|
|
108
|
+
case "markdown":
|
|
109
|
+
return Markdown;
|
|
104
110
|
case "radio":
|
|
105
111
|
return Radio;
|
|
106
112
|
case "switch":
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useRef, useContext } from "react";
|
|
2
|
-
import { Row, Col, Button, Input, Space } from "antd";
|
|
2
|
+
import { Row, Col, Button, Input, Space, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
4
|
import { Binary as BinaryOoui } from "@gisce/ooui";
|
|
5
|
-
|
|
5
|
+
const { useToken } = theme;
|
|
6
6
|
import ButtonWithTooltip from "@/common/ButtonWithTooltip";
|
|
7
7
|
import {
|
|
8
8
|
FolderOpenOutlined,
|
|
@@ -44,8 +44,11 @@ interface BinaryInputProps {
|
|
|
44
44
|
export const BinaryInput = (props: BinaryInputProps) => {
|
|
45
45
|
const { ooui, value, onChange } = props;
|
|
46
46
|
const { readOnly, required, filenameField } = ooui as BinaryOoui;
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const { token } = useToken();
|
|
48
|
+
const requiredStyle =
|
|
49
|
+
required && !readOnly
|
|
50
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
51
|
+
: undefined;
|
|
49
52
|
const inputFile = useRef(null);
|
|
50
53
|
const { setFieldValue, getFieldValue } =
|
|
51
54
|
(useContext(FormContext) as FormContextType) || {};
|
|
@@ -104,7 +107,7 @@ export const BinaryInput = (props: BinaryInputProps) => {
|
|
|
104
107
|
<Input
|
|
105
108
|
type="text"
|
|
106
109
|
disabled={true}
|
|
107
|
-
|
|
110
|
+
style={requiredStyle}
|
|
108
111
|
value={filesize}
|
|
109
112
|
/>
|
|
110
113
|
</Col>
|
|
@@ -4,17 +4,18 @@ import styled from "styled-components";
|
|
|
4
4
|
|
|
5
5
|
import Field from "@/common/Field";
|
|
6
6
|
import { WidgetProps } from "@/types";
|
|
7
|
-
import
|
|
7
|
+
import { theme } from "antd";
|
|
8
|
+
|
|
9
|
+
const { defaultAlgorithm, defaultSeed } = theme;
|
|
10
|
+
|
|
11
|
+
const mapToken = defaultAlgorithm(defaultSeed);
|
|
8
12
|
|
|
9
13
|
export const Boolean = (props: WidgetProps) => {
|
|
10
14
|
const { ooui } = props;
|
|
11
15
|
const { id, readOnly, required } = ooui;
|
|
12
16
|
|
|
13
17
|
return (
|
|
14
|
-
<Field
|
|
15
|
-
{...props}
|
|
16
|
-
valuePropName="checked"
|
|
17
|
-
>
|
|
18
|
+
<Field {...props} valuePropName="checked">
|
|
18
19
|
<BooleanInput id={id} readOnly={readOnly} required={required} />
|
|
19
20
|
</Field>
|
|
20
21
|
);
|
|
@@ -35,10 +36,10 @@ const BooleanInput = (props: any) => {
|
|
|
35
36
|
|
|
36
37
|
const RequiredCheckbox = styled(AntCheckbox)`
|
|
37
38
|
.ant-checkbox-inner {
|
|
38
|
-
background-color: ${
|
|
39
|
+
background-color: ${mapToken.colorPrimaryBg};
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.ant-checkbox-checked .ant-checkbox-inner {
|
|
42
|
-
background-color:
|
|
43
|
+
background-color: ${mapToken.colorPrimary};
|
|
43
44
|
}
|
|
44
45
|
`;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, { useContext, useState } from "react";
|
|
2
|
-
import { Col, Input, Row } from "antd";
|
|
1
|
+
import React, { CSSProperties, useContext, useState } from "react";
|
|
2
|
+
import { Col, Input, Row, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
4
|
import { Char as CharOoui } from "@gisce/ooui";
|
|
5
5
|
import { WidgetProps } from "@/types";
|
|
6
|
-
import Config from "@/Config";
|
|
7
6
|
import { TranslationModal } from "../modals/TranslationModal";
|
|
8
7
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
9
8
|
import ButtonWithTooltip from "@/common/ButtonWithTooltip";
|
|
10
9
|
import { TranslationOutlined } from "@ant-design/icons";
|
|
11
10
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
12
11
|
import showInfo from "@/ui/InfoDialog";
|
|
12
|
+
const { useToken } = theme;
|
|
13
13
|
|
|
14
14
|
type CharProps = WidgetProps & {
|
|
15
15
|
isSearchField?: boolean;
|
|
@@ -18,8 +18,11 @@ type CharProps = WidgetProps & {
|
|
|
18
18
|
export const Char = (props: CharProps) => {
|
|
19
19
|
const { ooui, isSearchField = false } = props;
|
|
20
20
|
const { id, readOnly, isPassword, required, translatable } = ooui as CharOoui;
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const { token } = useToken();
|
|
22
|
+
const requiredStyle =
|
|
23
|
+
required && !readOnly
|
|
24
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
25
|
+
: undefined;
|
|
23
26
|
const formContext = useContext(FormContext) as FormContextType;
|
|
24
27
|
const { elementHasLostFocus } = formContext || {};
|
|
25
28
|
|
|
@@ -27,7 +30,7 @@ export const Char = (props: CharProps) => {
|
|
|
27
30
|
<Input
|
|
28
31
|
disabled={readOnly || (translatable && !isSearchField)}
|
|
29
32
|
id={id}
|
|
30
|
-
|
|
33
|
+
style={requiredStyle}
|
|
31
34
|
maxLength={(ooui as CharOoui).size}
|
|
32
35
|
onBlur={elementHasLostFocus}
|
|
33
36
|
/>
|
|
@@ -44,7 +47,7 @@ export const Char = (props: CharProps) => {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
if (translatable && !readOnly && !isSearchField) {
|
|
47
|
-
input = <TranslatableChar field={id}
|
|
50
|
+
input = <TranslatableChar field={id} requiredStyle={requiredStyle} />;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
return (
|
|
@@ -57,12 +60,12 @@ export const Char = (props: CharProps) => {
|
|
|
57
60
|
const TranslatableChar = ({
|
|
58
61
|
value,
|
|
59
62
|
field,
|
|
60
|
-
|
|
63
|
+
requiredStyle,
|
|
61
64
|
onChange,
|
|
62
65
|
}: {
|
|
63
66
|
value?: string;
|
|
64
67
|
field: string;
|
|
65
|
-
|
|
68
|
+
requiredStyle: CSSProperties | undefined;
|
|
66
69
|
onChange?: (value: string) => void;
|
|
67
70
|
}) => {
|
|
68
71
|
const formContext = useContext(FormContext) as FormContextType;
|
|
@@ -84,7 +87,7 @@ const TranslatableChar = ({
|
|
|
84
87
|
<Input
|
|
85
88
|
value={value}
|
|
86
89
|
id={field}
|
|
87
|
-
|
|
90
|
+
style={requiredStyle}
|
|
88
91
|
onChange={(event: any) => {
|
|
89
92
|
onChange?.(event.target.value);
|
|
90
93
|
}}
|
|
@@ -129,12 +132,11 @@ const TranslatableChar = ({
|
|
|
129
132
|
value={value}
|
|
130
133
|
disabled={true}
|
|
131
134
|
id={field}
|
|
132
|
-
className={requiredClass}
|
|
133
135
|
onChange={(event: any) => {
|
|
134
136
|
onChange?.(event.target.value);
|
|
135
137
|
}}
|
|
136
138
|
onBlur={elementHasLostFocus}
|
|
137
|
-
style={{ cursor: "pointer" }}
|
|
139
|
+
style={{ cursor: "pointer", ...requiredStyle }}
|
|
138
140
|
/>
|
|
139
141
|
</div>
|
|
140
142
|
<TranslationModal
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import { InputNumber } from "antd";
|
|
2
|
+
import { InputNumber, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
4
|
import { Float as FloatOoui } from "@gisce/ooui";
|
|
5
5
|
import { WidgetProps } from "@/types";
|
|
6
|
-
|
|
6
|
+
const { useToken } = theme;
|
|
7
|
+
|
|
7
8
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
8
9
|
|
|
9
10
|
export const Float = (props: WidgetProps) => {
|
|
10
11
|
const { ooui } = props;
|
|
11
12
|
const { id, decimalDigits, readOnly, required } = ooui as FloatOoui;
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const { token } = useToken();
|
|
14
|
+
|
|
15
|
+
const requiredStyle =
|
|
16
|
+
required && !readOnly
|
|
17
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
18
|
+
: undefined;
|
|
14
19
|
const formContext = useContext(FormContext) as FormContextType;
|
|
15
20
|
const { elementHasLostFocus } = formContext || {};
|
|
16
21
|
|
|
@@ -18,7 +23,8 @@ export const Float = (props: WidgetProps) => {
|
|
|
18
23
|
<Field required={required} type={"number"} {...props}>
|
|
19
24
|
<InputNumber
|
|
20
25
|
disabled={readOnly}
|
|
21
|
-
className={"w-full
|
|
26
|
+
className={"w-full"}
|
|
27
|
+
style={requiredStyle}
|
|
22
28
|
id={id}
|
|
23
29
|
precision={decimalDigits}
|
|
24
30
|
formatter={(value) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Input } from "antd";
|
|
2
|
+
import { Input, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
4
|
import { Float as FloatOoui } from "@gisce/ooui";
|
|
5
5
|
import { WidgetProps } from "@/types";
|
|
6
|
-
import Config from "@/Config";
|
|
7
6
|
import { parseFloatToString, parseStringToFloat } from "@/helpers/timeHelper";
|
|
8
7
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
8
|
+
const { useToken } = theme;
|
|
9
9
|
|
|
10
10
|
export const FloatTime = (props: WidgetProps) => {
|
|
11
11
|
const { ooui } = props;
|
|
@@ -29,8 +29,11 @@ export const FloatTimeInput: React.FC<FloatTimeInputProps> = (
|
|
|
29
29
|
) => {
|
|
30
30
|
const { ooui, value, onChange } = props;
|
|
31
31
|
const { id, readOnly, required } = ooui as FloatOoui;
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const { token } = useToken();
|
|
33
|
+
const requiredStyle =
|
|
34
|
+
required && !readOnly
|
|
35
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
36
|
+
: undefined;
|
|
34
37
|
const inputTextRef = useRef<string>();
|
|
35
38
|
const [inputText, setInputText] = useState<string>();
|
|
36
39
|
const formContext = useContext(FormContext) as FormContextType;
|
|
@@ -59,7 +62,8 @@ export const FloatTimeInput: React.FC<FloatTimeInputProps> = (
|
|
|
59
62
|
<Input
|
|
60
63
|
value={inputText}
|
|
61
64
|
disabled={readOnly}
|
|
62
|
-
className={"w-full
|
|
65
|
+
className={"w-full"}
|
|
66
|
+
style={requiredStyle}
|
|
63
67
|
id={id}
|
|
64
68
|
placeholder={"00:00"}
|
|
65
69
|
onChange={onValueStringChange}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
|
-
import { InputNumber } from "antd";
|
|
2
|
+
import { InputNumber, theme } from "antd";
|
|
3
3
|
import Field from "@/common/Field";
|
|
4
4
|
import { WidgetProps } from "@/types";
|
|
5
|
-
import Config from "@/Config";
|
|
6
5
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
6
|
+
const { useToken } = theme;
|
|
7
7
|
|
|
8
8
|
type IntegerProps = WidgetProps & {
|
|
9
9
|
onChange?: (newValue: number) => void;
|
|
@@ -12,8 +12,11 @@ type IntegerProps = WidgetProps & {
|
|
|
12
12
|
export const Integer = (props: IntegerProps) => {
|
|
13
13
|
const { ooui, onChange } = props;
|
|
14
14
|
const { id, readOnly, required } = ooui;
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const { token } = useToken();
|
|
16
|
+
const requiredStyle =
|
|
17
|
+
required && !readOnly
|
|
18
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
19
|
+
: undefined;
|
|
17
20
|
const formContext = useContext(FormContext) as FormContextType;
|
|
18
21
|
const { elementHasLostFocus } = formContext || {};
|
|
19
22
|
|
|
@@ -21,7 +24,7 @@ export const Integer = (props: IntegerProps) => {
|
|
|
21
24
|
<Field required={required} type={"number"} {...props}>
|
|
22
25
|
<InputNumber
|
|
23
26
|
id={id}
|
|
24
|
-
className={"w-full "
|
|
27
|
+
className={"w-full "}
|
|
25
28
|
disabled={readOnly}
|
|
26
29
|
formatter={(value) => {
|
|
27
30
|
return `${value}`.replace(/[^0-9\-]+/g, "");
|
|
@@ -32,6 +35,8 @@ export const Integer = (props: IntegerProps) => {
|
|
|
32
35
|
}}
|
|
33
36
|
defaultValue={0}
|
|
34
37
|
onBlur={elementHasLostFocus}
|
|
38
|
+
precision={0}
|
|
39
|
+
style={requiredStyle}
|
|
35
40
|
/>
|
|
36
41
|
</Field>
|
|
37
42
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Tooltip, Typography } from "antd";
|
|
2
|
+
import { Tooltip, Typography, theme } from "antd";
|
|
3
3
|
import { WidgetProps } from "@/types";
|
|
4
4
|
import { QuestionCircleOutlined } from "@ant-design/icons";
|
|
5
5
|
import { Label as LabelOoui } from "@gisce/ooui";
|
|
6
|
+
import { Interweave } from "interweave";
|
|
6
7
|
const { Text, Title } = Typography;
|
|
8
|
+
const { useToken } = theme;
|
|
7
9
|
|
|
8
10
|
type Props = WidgetProps & {
|
|
9
11
|
align?: "left" | "center" | "right";
|
|
@@ -18,19 +20,15 @@ const alignClass = {
|
|
|
18
20
|
|
|
19
21
|
const Label = (props: Props) => {
|
|
20
22
|
const { ooui, align, responsiveBehaviour } = props;
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
tooltip,
|
|
24
|
-
fieldForLabel,
|
|
25
|
-
labelSize,
|
|
26
|
-
labelType,
|
|
27
|
-
} = ooui as LabelOoui;
|
|
23
|
+
const { label, tooltip, fieldForLabel, labelSize, labelType } =
|
|
24
|
+
ooui as LabelOoui;
|
|
28
25
|
const addColon = fieldForLabel !== null ? true : false;
|
|
29
26
|
const labelText = addColon && label.length > 1 ? label + " :" : label;
|
|
30
27
|
const responsiveAlign = responsiveBehaviour ? "left" : "right";
|
|
31
28
|
const labelAlgin = align ? align : fieldForLabel ? responsiveAlign : "left";
|
|
29
|
+
const { token } = useToken();
|
|
32
30
|
|
|
33
|
-
const TextType = labelSize ===
|
|
31
|
+
const TextType = labelSize === undefined ? Text : Title;
|
|
34
32
|
|
|
35
33
|
return (
|
|
36
34
|
<div
|
|
@@ -38,15 +36,17 @@ const Label = (props: Props) => {
|
|
|
38
36
|
>
|
|
39
37
|
{tooltip && (
|
|
40
38
|
<Tooltip title={tooltip}>
|
|
41
|
-
<QuestionCircleOutlined className="pr-1 text-xs
|
|
39
|
+
<QuestionCircleOutlined className="pr-1 text-xs" style={{
|
|
40
|
+
color: token.colorPrimary
|
|
41
|
+
}} />
|
|
42
42
|
</Tooltip>
|
|
43
43
|
)}
|
|
44
44
|
<span className="pr-2">
|
|
45
45
|
<TextType
|
|
46
|
-
level={labelSize
|
|
46
|
+
level={labelSize}
|
|
47
47
|
type={labelType as any}
|
|
48
48
|
>
|
|
49
|
-
{labelText}
|
|
49
|
+
<Interweave content={labelText} />
|
|
50
50
|
</TextType>
|
|
51
51
|
</span>
|
|
52
52
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState } from "react";
|
|
2
|
-
import { Input, Button, Row, Col } from "antd";
|
|
2
|
+
import { Input, Button, Row, Col, theme } from "antd";
|
|
3
3
|
import { Char as CharOoui } from "@gisce/ooui";
|
|
4
|
-
import Config from "@/Config";
|
|
5
4
|
import { EditOutlined, CheckOutlined } from "@ant-design/icons";
|
|
6
5
|
import { FormContext, FormContextType } from "@/context/FormContext";
|
|
6
|
+
const { useToken } = theme;
|
|
7
7
|
|
|
8
8
|
interface LinkInputProps {
|
|
9
9
|
ooui: CharOoui;
|
|
@@ -16,8 +16,11 @@ interface LinkInputProps {
|
|
|
16
16
|
export const LinkInput = (props: LinkInputProps) => {
|
|
17
17
|
const { ooui, value, onChange, valueValidator, linkPrefix = "" } = props;
|
|
18
18
|
const { id, readOnly, required } = ooui as CharOoui;
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const { token } = useToken();
|
|
20
|
+
const requiredStyle =
|
|
21
|
+
required && !readOnly
|
|
22
|
+
? { backgroundColor: token.colorPrimaryBg }
|
|
23
|
+
: undefined;
|
|
21
24
|
const formContext = useContext(FormContext) as FormContextType;
|
|
22
25
|
const { elementHasLostFocus } = formContext || {};
|
|
23
26
|
|
|
@@ -52,6 +55,7 @@ export const LinkInput = (props: LinkInputProps) => {
|
|
|
52
55
|
setShowInput(false);
|
|
53
56
|
}
|
|
54
57
|
}}
|
|
58
|
+
style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
|
|
55
59
|
tabIndex={-1}
|
|
56
60
|
/>
|
|
57
61
|
) : (
|
|
@@ -61,6 +65,7 @@ export const LinkInput = (props: LinkInputProps) => {
|
|
|
61
65
|
setEditMode(true);
|
|
62
66
|
setShowInput(true);
|
|
63
67
|
}}
|
|
68
|
+
style={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
|
|
64
69
|
tabIndex={-1}
|
|
65
70
|
/>
|
|
66
71
|
)}
|
|
@@ -69,9 +74,9 @@ export const LinkInput = (props: LinkInputProps) => {
|
|
|
69
74
|
<Col flex="auto">
|
|
70
75
|
{showInput ? (
|
|
71
76
|
<Input
|
|
77
|
+
style={{ borderTopLeftRadius: 0, borderBottomLeftRadius: 0, ...requiredStyle }}
|
|
72
78
|
id={id}
|
|
73
79
|
onChange={onValueStringChange}
|
|
74
|
-
className={requiredClass}
|
|
75
80
|
value={value}
|
|
76
81
|
onBlur={() => {
|
|
77
82
|
if (valueValidator(value)) {
|
|
@@ -84,7 +89,7 @@ export const LinkInput = (props: LinkInputProps) => {
|
|
|
84
89
|
) : (
|
|
85
90
|
<a
|
|
86
91
|
href={`${linkPrefix}${value}`}
|
|
87
|
-
style={{ color:
|
|
92
|
+
style={{ color: token.colorPrimary, paddingRight: 15 }}
|
|
88
93
|
target="_blank"
|
|
89
94
|
>
|
|
90
95
|
{value}
|
|
@@ -5,7 +5,11 @@ import styled from "styled-components";
|
|
|
5
5
|
import Field from "@/common/Field";
|
|
6
6
|
import { Selection as SelectionOoui } from "@gisce/ooui";
|
|
7
7
|
import { WidgetProps } from "@/types";
|
|
8
|
-
import
|
|
8
|
+
import { theme } from "antd";
|
|
9
|
+
|
|
10
|
+
const { defaultAlgorithm, defaultSeed } = theme;
|
|
11
|
+
|
|
12
|
+
const mapToken = defaultAlgorithm(defaultSeed);
|
|
9
13
|
|
|
10
14
|
const { Option } = Select;
|
|
11
15
|
|
|
@@ -82,6 +86,6 @@ export const MultiSelectionInput = (props: SelectionInputProps) => {
|
|
|
82
86
|
|
|
83
87
|
const RequiredSelect = styled(Select)`
|
|
84
88
|
&.ant-select:not(.ant-select-customize-input) .ant-select-selector {
|
|
85
|
-
background-color: ${
|
|
89
|
+
background-color: ${mapToken.colorPrimaryBg};
|
|
86
90
|
}
|
|
87
91
|
`;
|
|
@@ -49,6 +49,8 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
if (!value) {
|
|
52
|
+
setSelectionValue(undefined);
|
|
53
|
+
setMany2oneValue([]);
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -73,8 +75,16 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
73
75
|
}
|
|
74
76
|
onChange={(changedValue: string) => {
|
|
75
77
|
setSelectionValue(changedValue);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
let m2oValue = many2oneValue[0] || 0;
|
|
79
|
+
if (changedValue !== selectionValue) {
|
|
80
|
+
setMany2oneValue([]);
|
|
81
|
+
m2oValue = 0;
|
|
82
|
+
}
|
|
83
|
+
const referenceValue = `${changedValue},${m2oValue}`;
|
|
84
|
+
if (referenceValue === value) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
onChange?.(referenceValue);
|
|
78
88
|
}}
|
|
79
89
|
value={selectionValue}
|
|
80
90
|
/>
|
|
@@ -92,7 +102,7 @@ export const ReferenceInput: React.FC<ReferenceInputProps> = (
|
|
|
92
102
|
value={many2oneValue}
|
|
93
103
|
onChange={(changedValue: any[]) => {
|
|
94
104
|
setMany2oneValue(changedValue);
|
|
95
|
-
const referenceValue = `${selectionValue},${changedValue[0]}`;
|
|
105
|
+
const referenceValue = `${selectionValue},${changedValue[0] || 0}`;
|
|
96
106
|
if (referenceValue === value) {
|
|
97
107
|
return;
|
|
98
108
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ConnectionProvider from "@/ConnectionProvider";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { Many2oneSuffix } from "./many2one/Many2oneSuffix";
|
|
5
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
6
|
+
|
|
7
|
+
export type ReferenceTreeProps = {
|
|
8
|
+
value: string;
|
|
9
|
+
context?: any;
|
|
10
|
+
selectionValues?: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ReferenceTree = (
|
|
14
|
+
props: ReferenceTreeProps
|
|
15
|
+
): React.ReactElement => {
|
|
16
|
+
const { value, context, selectionValues } = props;
|
|
17
|
+
const [name, setName] = useState();
|
|
18
|
+
const [loading, setLoading] = useState(false);
|
|
19
|
+
|
|
20
|
+
const [model, id] = value ? value.split(",") : [];
|
|
21
|
+
const intId = parseInt(id);
|
|
22
|
+
|
|
23
|
+
const fetchName = useCallback(async () => {
|
|
24
|
+
if (!value) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (value && name) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setLoading(true);
|
|
31
|
+
const nameResponse = await ConnectionProvider.getHandler().execute({
|
|
32
|
+
action: "name_get",
|
|
33
|
+
payload: [intId],
|
|
34
|
+
model,
|
|
35
|
+
context,
|
|
36
|
+
});
|
|
37
|
+
setName(nameResponse[0][1]);
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}, [value, name]);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
fetchName();
|
|
43
|
+
}, [value]);
|
|
44
|
+
|
|
45
|
+
if (!value && !loading) {
|
|
46
|
+
return <></>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (loading) {
|
|
50
|
+
return <LoadingOutlined />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const selectionDescription = selectionValues.get(model);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Space>
|
|
57
|
+
<>{`${selectionDescription}:`}</>
|
|
58
|
+
<>{name}</>
|
|
59
|
+
<Many2oneSuffix id={intId} model={model} />
|
|
60
|
+
</Space>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -5,7 +5,11 @@ import styled from "styled-components";
|
|
|
5
5
|
import Field from "@/common/Field";
|
|
6
6
|
import { Selection as SelectionOoui } from "@gisce/ooui";
|
|
7
7
|
import { WidgetProps } from "@/types";
|
|
8
|
-
import
|
|
8
|
+
import { theme } from "antd";
|
|
9
|
+
|
|
10
|
+
const { defaultAlgorithm, defaultSeed } = theme;
|
|
11
|
+
|
|
12
|
+
const mapToken = defaultAlgorithm(defaultSeed);
|
|
9
13
|
|
|
10
14
|
const { Option } = Select;
|
|
11
15
|
|
|
@@ -56,6 +60,6 @@ export const SelectionInput = (props: SelectionInputProps) => {
|
|
|
56
60
|
|
|
57
61
|
const RequiredSelect = styled(Select)`
|
|
58
62
|
&.ant-select:not(.ant-select-customize-input) .ant-select-selector {
|
|
59
|
-
background-color: ${
|
|
63
|
+
background-color: ${mapToken.colorPrimaryBg};
|
|
60
64
|
}
|
|
61
65
|
`;
|