@gisce/react-ooui 2.0.0-alpha.61 → 2.0.0-alpha.63
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/dist/react-ooui.es.js +5 -2
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/widgets/views/Tree/treeComponents.d.ts.map +1 -1
- package/package.json +6 -8
- package/src/ConnectionProvider.ts +0 -16
- package/src/__tests__/iconMapper.test.ts +0 -30
- package/src/__tests__/searchFilterHelper.spec.ts +0 -386
- package/src/actionbar/ActionButton.tsx +0 -40
- package/src/actionbar/AttachmentsButton.tsx +0 -132
- package/src/actionbar/AttachmentsButtonWrapper.tsx +0 -157
- package/src/actionbar/ButtonWithBadge.tsx +0 -44
- package/src/actionbar/ChangeViewButton.tsx +0 -137
- package/src/actionbar/DashboardActionBar.tsx +0 -63
- package/src/actionbar/DropdownButton.tsx +0 -124
- package/src/actionbar/FormActionBar.tsx +0 -491
- package/src/actionbar/GraphActionBar.tsx +0 -67
- package/src/actionbar/NewButton.tsx +0 -46
- package/src/actionbar/SearchBar.tsx +0 -73
- package/src/actionbar/TreeActionBar.tsx +0 -383
- package/src/common/ButtonWithTooltip.tsx +0 -18
- package/src/common/DatePicker.tsx +0 -98
- package/src/common/Field.tsx +0 -93
- package/src/common/SelectAllRecordsRow.tsx +0 -94
- package/src/common/TimePicker.tsx +0 -38
- package/src/context/ActionViewContext.tsx +0 -213
- package/src/context/ConfigContext.tsx +0 -28
- package/src/context/ContentRootContext.tsx +0 -461
- package/src/context/DashboardActionContext.tsx +0 -44
- package/src/context/FormContext.tsx +0 -79
- package/src/context/FormModalContext.tsx +0 -28
- package/src/context/LocaleContext.tsx +0 -50
- package/src/context/One2manyContext.tsx +0 -45
- package/src/context/TabManagerContext.tsx +0 -117
- package/src/helpers/containerHelper.ts +0 -145
- package/src/helpers/dayjs.ts +0 -21
- package/src/helpers/dynamicColumnsHelper.ts +0 -73
- package/src/helpers/errorHelper.ts +0 -27
- package/src/helpers/filesHelper.ts +0 -41
- package/src/helpers/formHelper.ts +0 -301
- package/src/helpers/iconMapper.ts +0 -164
- package/src/helpers/logInfoHelper.tsx +0 -30
- package/src/helpers/one2manyHelper.ts +0 -194
- package/src/helpers/searchHelper.ts +0 -196
- package/src/helpers/timeHelper.ts +0 -58
- package/src/helpers/treeHelper.tsx +0 -226
- package/src/helpers/viewHelper.ts +0 -23
- package/src/hooks/useEffectDebugger.ts +0 -43
- package/src/hooks/useExport.ts +0 -439
- package/src/hooks/useFetchViews.ts +0 -0
- package/src/hooks/useSearch.ts +0 -434
- package/src/hooks/useWindowDimensions.ts +0 -33
- package/src/index.ts +0 -168
- package/src/locales/ca_ES.tsx +0 -99
- package/src/locales/en_US.tsx +0 -96
- package/src/locales/es_ES.tsx +0 -101
- package/src/stories/Binary.stories.tsx +0 -23
- package/src/stories/Boolean.stories.tsx +0 -22
- package/src/stories/Button.stories.tsx +0 -130
- package/src/stories/Char.stories.tsx +0 -76
- package/src/stories/FiberGrid.stories.tsx +0 -109
- package/src/stories/Float.stories.tsx +0 -22
- package/src/stories/FloatTime.stories.tsx +0 -32
- package/src/stories/Image.stories.tsx +0 -25
- package/src/stories/Integer.stories.tsx +0 -22
- package/src/stories/Label.stories.tsx +0 -100
- package/src/stories/Many2one.stories.tsx +0 -31
- package/src/stories/One2many.stories.tsx +0 -288
- package/src/stories/ProgressBar.stories.tsx +0 -22
- package/src/stories/Reference.stories.tsx +0 -43
- package/src/stories/Selection.stories.tsx +0 -34
- package/src/stories/Separator.stories.tsx +0 -53
- package/src/stories/Text.stories.tsx +0 -35
- package/src/stories/Time.stories.tsx +0 -31
- package/src/stories/Utils.stories.tsx +0 -14
- package/src/stories/containers/Group.stories.tsx +0 -84
- package/src/stories/containers/NewLine.stories.tsx +0 -52
- package/src/stories/containers/Notebook.stories.tsx +0 -188
- package/src/stories/custom/Avatar.stories.tsx +0 -22
- package/src/stories/custom/ButtonGroup.stories.tsx +0 -74
- package/src/stories/custom/CodeEditor.stories.tsx +0 -25
- package/src/stories/custom/Comments.stories.tsx +0 -197
- package/src/stories/custom/Indicator.stories.tsx +0 -36
- package/src/stories/custom/Markdown.stories.tsx +0 -38
- package/src/stories/custom/MultiCheckbox.stories.tsx +0 -60
- package/src/stories/custom/Radio.stories.tsx +0 -68
- package/src/stories/custom/Steps.stories.tsx +0 -43
- package/src/stories/custom/Switch.stories.tsx +0 -23
- package/src/stories/custom/Tag.stories.tsx +0 -66
- package/src/stories/custom/Tags.stories.tsx +0 -74
- package/src/stories/dashboard/Dashboard.stories.tsx +0 -23
- package/src/stories/dashboard/DashboardGrid.stories.tsx +0 -43
- package/src/stories/forms/ActivacioContracteForm.stories.tsx +0 -25
- package/src/stories/forms/Attachment.stories.tsx +0 -24
- package/src/stories/forms/CUPSForm.stories.tsx +0 -25
- package/src/stories/forms/Company.stories.tsx +0 -25
- package/src/stories/forms/CrmCaseForm.stories.tsx +0 -25
- package/src/stories/forms/Documents.stories.tsx +0 -25
- package/src/stories/forms/FormWithGridFiber.stories.tsx +0 -25
- package/src/stories/forms/FormWithLinks.stories.tsx +0 -30
- package/src/stories/forms/Lead.stories.tsx +0 -25
- package/src/stories/forms/ModContractForm.stories.tsx +0 -26
- package/src/stories/forms/PartnersForm.stories.tsx +0 -25
- package/src/stories/forms/PolissaForm.stories.tsx +0 -25
- package/src/stories/forms/PreferencesForm.stories.tsx +0 -691
- package/src/stories/forms/Signatures.stories.tsx +0 -25
- package/src/stories/forms/Switching.stories.tsx +0 -25
- package/src/stories/graphs/GraphIndicator.stories.tsx +0 -20
- package/src/stories/graphs/PieGraph.stories.tsx +0 -78
- package/src/stories/mocks/index.ts +0 -46
- package/src/stories/mocks/mockProvider.ts +0 -189
- package/src/stories/mocks/models/activacioContracte.ts +0 -112
- package/src/stories/mocks/models/attachment.ts +0 -1326
- package/src/stories/mocks/models/butlleti.ts +0 -296
- package/src/stories/mocks/models/company.ts +0 -135
- package/src/stories/mocks/models/crm_case.ts +0 -595
- package/src/stories/mocks/models/cups.ts +0 -937
- package/src/stories/mocks/models/document.ts +0 -223
- package/src/stories/mocks/models/factura.ts +0 -2713
- package/src/stories/mocks/models/form_with_gridfiber.ts +0 -141
- package/src/stories/mocks/models/hist_autoconsum.ts +0 -146
- package/src/stories/mocks/models/lead.ts +0 -2101
- package/src/stories/mocks/models/modcontractual.ts +0 -952
- package/src/stories/mocks/models/partner.ts +0 -1340
- package/src/stories/mocks/models/polissa.ts +0 -3127
- package/src/stories/mocks/models/res_partner_category.ts +0 -15
- package/src/stories/mocks/models/signatura.ts +0 -558
- package/src/stories/mocks/models/switching.ts +0 -767
- package/src/stories/modals/FormModal.stories.tsx +0 -36
- package/src/stories/modals/SearchModal.stories.tsx +0 -37
- package/src/stories/trees/FacturesTree.stories.tsx +0 -16
- package/src/stories/ui/ActionBar.stories.tsx +0 -21
- package/src/stories/ui/FavouriteButton.stories.tsx +0 -16
- package/src/stories/ui/GoToResourceModal.stories.tsx +0 -25
- package/src/stories/views/ActionView.stories.tsx +0 -28
- package/src/stories/views/SearchTree.stories.tsx +0 -1064
- package/src/stories/views/Tab.stories.tsx +0 -93
- package/src/stories/views/TabsAndContent.stories.tsx +0 -88
- package/src/stories/views/Tree.stories.jsx +0 -178
- package/src/stories/views/searchFilter/DateRangePicker.stories.tsx +0 -22
- package/src/stories/views/searchFilter/DateTimeRangePicker.stories.tsx +0 -23
- package/src/stories/views/searchFilter/PairFields.stories.tsx +0 -23
- package/src/stories/views/searchFilter/SearchFilter.stories.tsx +0 -165
- package/src/stories/views/searchFilter/examples/PartnersSearchFilter.stories.tsx +0 -409
- package/src/types/index.ts +0 -392
- package/src/ui/ActionErrorDialog.tsx +0 -24
- package/src/ui/ConfirmDialog.tsx +0 -28
- package/src/ui/ErrorAlert.tsx +0 -37
- package/src/ui/FavouriteButton.tsx +0 -271
- package/src/ui/FormErrorsDialog.tsx +0 -17
- package/src/ui/GenericErrorDialog.tsx +0 -16
- package/src/ui/GoToResourceModal.tsx +0 -76
- package/src/ui/InfoDialog.tsx +0 -13
- package/src/ui/RefreshItemDialog.tsx +0 -29
- package/src/ui/RemoveItemDialog.tsx +0 -20
- package/src/ui/TitleHeader.tsx +0 -117
- package/src/ui/UnlinkItemDialog.tsx +0 -20
- package/src/ui/UnsavedChangesDialog.tsx +0 -29
- package/src/ui/WarningDialog.tsx +0 -17
- package/src/views/ActionView.tsx +0 -526
- package/src/views/CurrentTabContent.tsx +0 -21
- package/src/views/RootView.tsx +0 -509
- package/src/views/TabContent.tsx +0 -31
- package/src/views/TabSelector.tsx +0 -31
- package/src/views/Welcome.tsx +0 -18
- package/src/views/actionViews/DashboardActionView.tsx +0 -52
- package/src/views/actionViews/FormActionView.tsx +0 -70
- package/src/views/actionViews/GraphActionView.tsx +0 -152
- package/src/views/actionViews/TreeActionView.tsx +0 -87
- package/src/views/tabs/Tab.tsx +0 -82
- package/src/widgets/WidgetFactory.tsx +0 -142
- package/src/widgets/base/Binary.tsx +0 -145
- package/src/widgets/base/Boolean.tsx +0 -44
- package/src/widgets/base/Button.tsx +0 -77
- package/src/widgets/base/Char.tsx +0 -157
- package/src/widgets/base/Date.tsx +0 -12
- package/src/widgets/base/DateTime.tsx +0 -12
- package/src/widgets/base/Email.tsx +0 -27
- package/src/widgets/base/Float.tsx +0 -38
- package/src/widgets/base/FloatTime.tsx +0 -73
- package/src/widgets/base/Image.tsx +0 -120
- package/src/widgets/base/Integer.tsx +0 -55
- package/src/widgets/base/Label.tsx +0 -56
- package/src/widgets/base/LinkInput.tsx +0 -106
- package/src/widgets/base/MultiSelection.tsx +0 -90
- package/src/widgets/base/ProgressBar.tsx +0 -38
- package/src/widgets/base/Reference.tsx +0 -115
- package/src/widgets/base/ReferenceTree.tsx +0 -62
- package/src/widgets/base/Selection.tsx +0 -71
- package/src/widgets/base/Separator.tsx +0 -25
- package/src/widgets/base/Text.tsx +0 -162
- package/src/widgets/base/Time.tsx +0 -40
- package/src/widgets/base/Url.tsx +0 -26
- package/src/widgets/base/many2one/Many2one.tsx +0 -322
- package/src/widgets/base/many2one/Many2oneSuffix.tsx +0 -232
- package/src/widgets/base/many2one/Many2oneSuffixModal.tsx +0 -42
- package/src/widgets/base/many2one/Many2oneTree.tsx +0 -18
- package/src/widgets/base/one2many/One2many.tsx +0 -100
- package/src/widgets/base/one2many/One2manyInput.tsx +0 -724
- package/src/widgets/base/one2many/One2manyTopBar.tsx +0 -158
- package/src/widgets/containers/Container.tsx +0 -99
- package/src/widgets/containers/Group.tsx +0 -37
- package/src/widgets/containers/Notebook.tsx +0 -52
- package/src/widgets/custom/Avatar.tsx +0 -40
- package/src/widgets/custom/ButtonGroup.tsx +0 -169
- package/src/widgets/custom/CodeEditor.tsx +0 -32
- package/src/widgets/custom/Comments.tsx +0 -147
- package/src/widgets/custom/FiberGrid.tsx +0 -48
- package/src/widgets/custom/Indicator.tsx +0 -66
- package/src/widgets/custom/Markdown.tsx +0 -32
- package/src/widgets/custom/MultiCheckbox.tsx +0 -165
- package/src/widgets/custom/Radio.tsx +0 -47
- package/src/widgets/custom/Steps.tsx +0 -56
- package/src/widgets/custom/Switch.tsx +0 -26
- package/src/widgets/custom/Tag.tsx +0 -53
- package/src/widgets/custom/Tags.tsx +0 -164
- package/src/widgets/custom/Timeline.tsx +0 -196
- package/src/widgets/modals/ExportModal.tsx +0 -75
- package/src/widgets/modals/FormModal.tsx +0 -125
- package/src/widgets/modals/SearchModal.tsx +0 -130
- package/src/widgets/modals/TranslationModal.tsx +0 -202
- package/src/widgets/views/Dashboard/Dashboard.tsx +0 -381
- package/src/widgets/views/Dashboard/DashboardForm.tsx +0 -30
- package/src/widgets/views/Dashboard/DashboardTree.tsx +0 -238
- package/src/widgets/views/Dashboard/dashboardHelper.ts +0 -79
- package/src/widgets/views/DashboardGrid/DashboardGrid.tsx +0 -53
- package/src/widgets/views/DashboardGrid/DashboardGrid.types.ts +0 -4
- package/src/widgets/views/DashboardGrid/DashboardGridItem.tsx +0 -62
- package/src/widgets/views/DashboardGrid/DashboardGridItem.types.ts +0 -10
- package/src/widgets/views/DashboardGrid/index.ts +0 -4
- package/src/widgets/views/Form.tsx +0 -1152
- package/src/widgets/views/Graph/Graph.tsx +0 -145
- package/src/widgets/views/Graph/GraphChart.tsx +0 -113
- package/src/widgets/views/Graph/GraphDefaults.ts +0 -170
- package/src/widgets/views/Graph/GraphIndicator.tsx +0 -421
- package/src/widgets/views/Graph/useGraphData.tsx +0 -176
- package/src/widgets/views/SearchTree.tsx +0 -367
- package/src/widgets/views/Tree/Tree.tsx +0 -295
- package/src/widgets/views/Tree/index.ts +0 -1
- package/src/widgets/views/Tree/treeComponents.tsx +0 -276
- package/src/widgets/views/searchFilter/DateRangePicker.tsx +0 -16
- package/src/widgets/views/searchFilter/DateTimeRangePicker.tsx +0 -87
- package/src/widgets/views/searchFilter/PairFields.tsx +0 -56
- package/src/widgets/views/searchFilter/SearchBottomBar.tsx +0 -54
- package/src/widgets/views/searchFilter/SearchField.tsx +0 -63
- package/src/widgets/views/searchFilter/SearchFilter.tsx +0 -160
- package/src/widgets/views/searchFilter/SearchParams.tsx +0 -35
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useState } from "react";
|
|
2
|
-
import { Space, Spin } from "antd";
|
|
3
|
-
import ChangeViewButton from "./ChangeViewButton";
|
|
4
|
-
import {
|
|
5
|
-
ActionViewContext,
|
|
6
|
-
ActionViewContextType,
|
|
7
|
-
} from "@/context/ActionViewContext";
|
|
8
|
-
import NewButton from "./NewButton";
|
|
9
|
-
import ActionButton from "./ActionButton";
|
|
10
|
-
import Icon, {
|
|
11
|
-
DeleteOutlined,
|
|
12
|
-
PrinterOutlined,
|
|
13
|
-
ThunderboltOutlined,
|
|
14
|
-
CopyOutlined,
|
|
15
|
-
ReloadOutlined,
|
|
16
|
-
InfoCircleOutlined,
|
|
17
|
-
FilterOutlined,
|
|
18
|
-
} from "@ant-design/icons";
|
|
19
|
-
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
20
|
-
import showConfirmDialog from "@/ui/ConfirmDialog";
|
|
21
|
-
import ConnectionProvider from "@/ConnectionProvider";
|
|
22
|
-
import showErrorDialog from "@/ui/ActionErrorDialog";
|
|
23
|
-
import DropdownButton from "./DropdownButton";
|
|
24
|
-
import {
|
|
25
|
-
ContentRootContext,
|
|
26
|
-
ContentRootContextType,
|
|
27
|
-
} from "@/context/ContentRootContext";
|
|
28
|
-
import ButtonWithBadge from "./ButtonWithBadge";
|
|
29
|
-
import { showLogInfo } from "@/helpers/logInfoHelper";
|
|
30
|
-
import SearchBar from "./SearchBar";
|
|
31
|
-
import { ExportModal } from "..";
|
|
32
|
-
import { mergeParams } from "@/helpers/searchHelper";
|
|
33
|
-
import { ErpFeatureKeys, useFeatureIsEnabled } from "@/context/ConfigContext";
|
|
34
|
-
|
|
35
|
-
type Props = {
|
|
36
|
-
parentContext?: any;
|
|
37
|
-
treeExpandable: boolean;
|
|
38
|
-
toolbar: any;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function TreeActionBar(props: Props) {
|
|
42
|
-
const {
|
|
43
|
-
availableViews,
|
|
44
|
-
currentView,
|
|
45
|
-
setCurrentView,
|
|
46
|
-
selectedRowItems,
|
|
47
|
-
setRemovingItem,
|
|
48
|
-
removingItem,
|
|
49
|
-
duplicatingItem,
|
|
50
|
-
setDuplicatingItem,
|
|
51
|
-
currentModel,
|
|
52
|
-
searchTreeRef,
|
|
53
|
-
setCurrentId,
|
|
54
|
-
setCurrentItemIndex,
|
|
55
|
-
searchParams,
|
|
56
|
-
searchVisible,
|
|
57
|
-
setSearchVisible,
|
|
58
|
-
setSearchTreeNameSearch,
|
|
59
|
-
searchTreeNameSearch,
|
|
60
|
-
treeIsLoading,
|
|
61
|
-
setPreviousView,
|
|
62
|
-
previousView,
|
|
63
|
-
results,
|
|
64
|
-
limit,
|
|
65
|
-
totalItems,
|
|
66
|
-
} = useContext(ActionViewContext) as ActionViewContextType;
|
|
67
|
-
|
|
68
|
-
const { parentContext = {}, treeExpandable, toolbar } = props;
|
|
69
|
-
const advancedExportEnabled = useFeatureIsEnabled(
|
|
70
|
-
ErpFeatureKeys.FEATURE_ADVANCED_EXPORT,
|
|
71
|
-
);
|
|
72
|
-
const { t, lang } = useContext(LocaleContext) as LocaleContextType;
|
|
73
|
-
const contentRootContext = useContext(
|
|
74
|
-
ContentRootContext,
|
|
75
|
-
) as ContentRootContextType;
|
|
76
|
-
const { processAction } = contentRootContext || {};
|
|
77
|
-
const [exportModalVisible, setExportModalVisible] = useState(false);
|
|
78
|
-
|
|
79
|
-
const hasNameSearch: boolean =
|
|
80
|
-
searchTreeNameSearch !== undefined &&
|
|
81
|
-
searchTreeNameSearch.trim().length > 0;
|
|
82
|
-
|
|
83
|
-
function tryDelete() {
|
|
84
|
-
showConfirmDialog({
|
|
85
|
-
confirmMessage: t("confirmRemove"),
|
|
86
|
-
lang,
|
|
87
|
-
onOk: () => {
|
|
88
|
-
remove();
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async function remove() {
|
|
94
|
-
try {
|
|
95
|
-
setRemovingItem?.(true);
|
|
96
|
-
|
|
97
|
-
await ConnectionProvider.getHandler().deleteObjects({
|
|
98
|
-
model: currentModel!,
|
|
99
|
-
ids: selectedRowItems!.map((item) => item.id),
|
|
100
|
-
context: { ...parentContext },
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
setCurrentId?.(undefined);
|
|
104
|
-
setCurrentItemIndex?.(undefined);
|
|
105
|
-
|
|
106
|
-
searchTreeRef?.current?.refreshResults();
|
|
107
|
-
} catch (e) {
|
|
108
|
-
showErrorDialog(e);
|
|
109
|
-
} finally {
|
|
110
|
-
setRemovingItem?.(false);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
async function duplicate() {
|
|
115
|
-
try {
|
|
116
|
-
setDuplicatingItem?.(true);
|
|
117
|
-
|
|
118
|
-
const currentId = selectedRowItems![0].id;
|
|
119
|
-
|
|
120
|
-
const newId = await ConnectionProvider.getHandler().duplicate({
|
|
121
|
-
id: currentId,
|
|
122
|
-
model: currentModel!,
|
|
123
|
-
context: { ...parentContext },
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (newId) {
|
|
127
|
-
searchTreeRef?.current?.refreshResults();
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
130
|
-
showErrorDialog(e);
|
|
131
|
-
} finally {
|
|
132
|
-
setDuplicatingItem?.(false);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function runAction(actionData: any) {
|
|
137
|
-
processAction?.({
|
|
138
|
-
actionData,
|
|
139
|
-
values: {
|
|
140
|
-
active_id: selectedRowItems?.map((item) => item.id)[0],
|
|
141
|
-
active_ids: selectedRowItems?.map((item) => item.id),
|
|
142
|
-
},
|
|
143
|
-
fields: {},
|
|
144
|
-
context: {
|
|
145
|
-
...parentContext,
|
|
146
|
-
active_id: selectedRowItems?.map((item) => item.id)[0],
|
|
147
|
-
active_ids: selectedRowItems?.map((item) => item.id),
|
|
148
|
-
},
|
|
149
|
-
onRefreshParentValues: () => {
|
|
150
|
-
searchTreeRef?.current?.refreshResults();
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<Space wrap={true}>
|
|
157
|
-
{treeIsLoading && (
|
|
158
|
-
<>
|
|
159
|
-
<Spin />
|
|
160
|
-
{separator()}
|
|
161
|
-
{separator()}
|
|
162
|
-
</>
|
|
163
|
-
)}
|
|
164
|
-
{treeExpandable ? null : (
|
|
165
|
-
<>
|
|
166
|
-
<SearchBar
|
|
167
|
-
disabled={duplicatingItem || removingItem || treeIsLoading}
|
|
168
|
-
searchText={searchTreeNameSearch}
|
|
169
|
-
onSearch={(searchString?: string) => {
|
|
170
|
-
if (searchString && searchString.trim().length > 0) {
|
|
171
|
-
setSearchTreeNameSearch?.(searchString);
|
|
172
|
-
} else {
|
|
173
|
-
setSearchTreeNameSearch?.(undefined);
|
|
174
|
-
}
|
|
175
|
-
}}
|
|
176
|
-
/>
|
|
177
|
-
{!treeExpandable && (
|
|
178
|
-
<ButtonWithBadge
|
|
179
|
-
icon={
|
|
180
|
-
<FilterOutlined
|
|
181
|
-
style={{ color: searchVisible ? "white" : undefined }}
|
|
182
|
-
/>
|
|
183
|
-
}
|
|
184
|
-
tooltip={t("advanced_search")}
|
|
185
|
-
type={searchVisible ? "primary" : "default"}
|
|
186
|
-
onClick={() => {
|
|
187
|
-
setSearchVisible?.(!searchVisible);
|
|
188
|
-
}}
|
|
189
|
-
disabled={duplicatingItem || removingItem || treeIsLoading}
|
|
190
|
-
badgeNumber={searchParams?.length}
|
|
191
|
-
/>
|
|
192
|
-
)}
|
|
193
|
-
{separator()}
|
|
194
|
-
<NewButton disabled={treeIsLoading} />
|
|
195
|
-
<ActionButton
|
|
196
|
-
icon={<CopyOutlined />}
|
|
197
|
-
tooltip={t("duplicate")}
|
|
198
|
-
disabled={
|
|
199
|
-
!selectedRowItems ||
|
|
200
|
-
selectedRowItems?.length !== 1 ||
|
|
201
|
-
duplicatingItem ||
|
|
202
|
-
treeIsLoading
|
|
203
|
-
}
|
|
204
|
-
loading={duplicatingItem}
|
|
205
|
-
onClick={duplicate}
|
|
206
|
-
/>
|
|
207
|
-
<ActionButton
|
|
208
|
-
icon={<DeleteOutlined />}
|
|
209
|
-
tooltip={t("delete")}
|
|
210
|
-
disabled={
|
|
211
|
-
!(selectedRowItems && selectedRowItems?.length > 0) ||
|
|
212
|
-
treeIsLoading
|
|
213
|
-
}
|
|
214
|
-
loading={removingItem}
|
|
215
|
-
onClick={tryDelete}
|
|
216
|
-
/>
|
|
217
|
-
{separator()}
|
|
218
|
-
</>
|
|
219
|
-
)}
|
|
220
|
-
<ActionButton
|
|
221
|
-
icon={<InfoCircleOutlined />}
|
|
222
|
-
tooltip={t("showLogs")}
|
|
223
|
-
disabled={
|
|
224
|
-
!(selectedRowItems && selectedRowItems?.length > 0) || treeIsLoading
|
|
225
|
-
}
|
|
226
|
-
loading={false}
|
|
227
|
-
onClick={() => {
|
|
228
|
-
showLogInfo(currentModel!, selectedRowItems![0].id, t);
|
|
229
|
-
}}
|
|
230
|
-
/>
|
|
231
|
-
<ActionButton
|
|
232
|
-
icon={<ReloadOutlined />}
|
|
233
|
-
tooltip={t("refresh")}
|
|
234
|
-
disabled={duplicatingItem || removingItem || treeIsLoading}
|
|
235
|
-
loading={false}
|
|
236
|
-
onClick={() => {
|
|
237
|
-
searchTreeRef?.current?.refreshResults();
|
|
238
|
-
}}
|
|
239
|
-
/>
|
|
240
|
-
{!treeExpandable && (
|
|
241
|
-
<>
|
|
242
|
-
{separator()}
|
|
243
|
-
<ChangeViewButton
|
|
244
|
-
currentView={currentView}
|
|
245
|
-
availableViews={availableViews}
|
|
246
|
-
onChangeView={(newView) => {
|
|
247
|
-
setPreviousView?.(currentView);
|
|
248
|
-
setCurrentView?.(newView);
|
|
249
|
-
}}
|
|
250
|
-
previousView={previousView}
|
|
251
|
-
disabled={treeIsLoading}
|
|
252
|
-
/>
|
|
253
|
-
</>
|
|
254
|
-
)}
|
|
255
|
-
{separator()}
|
|
256
|
-
<DropdownButton
|
|
257
|
-
icon={<ThunderboltOutlined />}
|
|
258
|
-
disabled={
|
|
259
|
-
!(selectedRowItems && selectedRowItems?.length > 0) || treeIsLoading
|
|
260
|
-
}
|
|
261
|
-
tooltip={t("actions")}
|
|
262
|
-
items={toolbar?.action}
|
|
263
|
-
onItemClick={(action: any) => {
|
|
264
|
-
if (!action) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
runAction(action);
|
|
269
|
-
}}
|
|
270
|
-
/>
|
|
271
|
-
<DropdownButton
|
|
272
|
-
icon={<PrinterOutlined />}
|
|
273
|
-
disabled={
|
|
274
|
-
!(selectedRowItems && selectedRowItems?.length > 0) || treeIsLoading
|
|
275
|
-
}
|
|
276
|
-
tooltip={t("reports")}
|
|
277
|
-
items={toolbar?.print}
|
|
278
|
-
onItemClick={(report: any) => {
|
|
279
|
-
if (!report) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
runAction({
|
|
284
|
-
...report,
|
|
285
|
-
datas: {
|
|
286
|
-
...(report.datas || {}),
|
|
287
|
-
ids: selectedRowItems!.map((item) => item.id),
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
}}
|
|
291
|
-
/>
|
|
292
|
-
{advancedExportEnabled && (
|
|
293
|
-
<>
|
|
294
|
-
{separator()}
|
|
295
|
-
<DropdownButton
|
|
296
|
-
icon={
|
|
297
|
-
<Icon
|
|
298
|
-
component={() => (
|
|
299
|
-
<svg
|
|
300
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
301
|
-
className="icon icon-tabler icon-tabler-database-export"
|
|
302
|
-
width="1em"
|
|
303
|
-
height="1em"
|
|
304
|
-
viewBox="0 0 24 24"
|
|
305
|
-
strokeWidth="1.5"
|
|
306
|
-
fill="none"
|
|
307
|
-
stroke="currentColor"
|
|
308
|
-
strokeLinecap="round"
|
|
309
|
-
strokeLinejoin="round"
|
|
310
|
-
>
|
|
311
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
312
|
-
<ellipse cx="12" cy="6" rx="8" ry="3" />
|
|
313
|
-
<path d="M4 6v6c0 1.657 3.582 3 8 3a19.84 19.84 0 0 0 3.302 -.267m4.698 -2.733v-6" />
|
|
314
|
-
<path d="M4 12v6c0 1.599 3.335 2.905 7.538 2.995m8.462 -6.995v-2m-6 7h7m-3 -3l3 3l-3 3" />
|
|
315
|
-
</svg>
|
|
316
|
-
)}
|
|
317
|
-
/>
|
|
318
|
-
}
|
|
319
|
-
tooltip={t("export")}
|
|
320
|
-
items={[
|
|
321
|
-
{
|
|
322
|
-
id: "print_screen",
|
|
323
|
-
name: t("printScreen"),
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
id: "export",
|
|
327
|
-
name: t("advancedExport"),
|
|
328
|
-
},
|
|
329
|
-
]}
|
|
330
|
-
onItemClick={(itemClicked: any) => {
|
|
331
|
-
if (itemClicked.id === "print_screen") {
|
|
332
|
-
let idsToExport =
|
|
333
|
-
selectedRowItems?.map((item) => item.id) || [];
|
|
334
|
-
|
|
335
|
-
if (idsToExport.length === 0) {
|
|
336
|
-
idsToExport = results?.map((item) => item.id) || [];
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
runAction({
|
|
340
|
-
id: -1,
|
|
341
|
-
model: currentModel,
|
|
342
|
-
report_name: "printscreen.list",
|
|
343
|
-
type: "ir.actions.report.xml",
|
|
344
|
-
datas: {
|
|
345
|
-
model: currentModel,
|
|
346
|
-
ids: idsToExport,
|
|
347
|
-
},
|
|
348
|
-
});
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
setExportModalVisible(true);
|
|
353
|
-
}}
|
|
354
|
-
disabled={
|
|
355
|
-
duplicatingItem || removingItem || treeIsLoading || hasNameSearch
|
|
356
|
-
}
|
|
357
|
-
/>
|
|
358
|
-
<ExportModal
|
|
359
|
-
visible={exportModalVisible}
|
|
360
|
-
locale={lang}
|
|
361
|
-
onClose={() => setExportModalVisible(false)}
|
|
362
|
-
model={currentModel!}
|
|
363
|
-
domain={mergeParams(
|
|
364
|
-
searchTreeRef?.current?.getDomain() || [],
|
|
365
|
-
searchParams || [],
|
|
366
|
-
)}
|
|
367
|
-
limit={limit}
|
|
368
|
-
totalRegisters={totalItems || 0}
|
|
369
|
-
selectedRegistersToExport={selectedRowItems}
|
|
370
|
-
visibleRegisters={results?.length || 0}
|
|
371
|
-
context={parentContext}
|
|
372
|
-
/>
|
|
373
|
-
</>
|
|
374
|
-
)}
|
|
375
|
-
</Space>
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
function separator() {
|
|
380
|
-
return <div className="inline-block w-2" />;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
export default TreeActionBar;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Button, Tooltip, ButtonProps } from "antd";
|
|
3
|
-
|
|
4
|
-
export type Props = ButtonProps & {
|
|
5
|
-
tooltip: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
function ButtonWithTooltip(props: Props) {
|
|
9
|
-
const { tooltip, ...restProps } = props;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Tooltip title={tooltip}>
|
|
13
|
-
<Button {...restProps} />
|
|
14
|
-
</Tooltip>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default ButtonWithTooltip;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { DatePicker as AntDatePicker, theme } from "antd";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import Field from "@/common/Field";
|
|
5
|
-
import { WidgetProps } from "@/types";
|
|
6
|
-
import { Date as DateOoui } from "@gisce/ooui";
|
|
7
|
-
import dayjs from "@/helpers/dayjs";
|
|
8
|
-
const { useToken } = theme;
|
|
9
|
-
|
|
10
|
-
type DatePickerProps = WidgetProps & {
|
|
11
|
-
showTime?: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const DatePickerConfig = {
|
|
15
|
-
date: {
|
|
16
|
-
placeholder: "__/__/____",
|
|
17
|
-
dateDisplayFormat: "DD/MM/YYYY",
|
|
18
|
-
dateInternalFormat: "YYYY-MM-DD",
|
|
19
|
-
},
|
|
20
|
-
time: {
|
|
21
|
-
placeholder: "__/__/____ __:__:__",
|
|
22
|
-
dateDisplayFormat: "DD/MM/YYYY HH:mm:ss",
|
|
23
|
-
dateInternalFormat: "YYYY-MM-DD HH:mm:ss",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const DatePicker = (props: DatePickerProps) => {
|
|
28
|
-
const { ooui, showTime = false } = props;
|
|
29
|
-
const { required } = ooui;
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Field required={required} {...props}>
|
|
33
|
-
<DatePickerInput ooui={ooui} showTime={showTime} />
|
|
34
|
-
</Field>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
interface DatePickerInputProps {
|
|
39
|
-
ooui: DateOoui;
|
|
40
|
-
value?: undefined | string;
|
|
41
|
-
onChange?: (value: undefined | string) => void;
|
|
42
|
-
showTime?: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const DatePickerInput: React.FC<DatePickerInputProps> = (
|
|
46
|
-
props: DatePickerInputProps,
|
|
47
|
-
) => {
|
|
48
|
-
const { value, onChange, ooui, showTime } = props;
|
|
49
|
-
const { id, readOnly, required } = ooui as DateOoui;
|
|
50
|
-
const { token } = useToken();
|
|
51
|
-
|
|
52
|
-
const requiredStyle =
|
|
53
|
-
required && !readOnly
|
|
54
|
-
? { backgroundColor: token.colorPrimaryBg }
|
|
55
|
-
: undefined;
|
|
56
|
-
|
|
57
|
-
const mode = showTime ? "time" : "date";
|
|
58
|
-
|
|
59
|
-
const triggerChange = (changedValue: undefined | string) => {
|
|
60
|
-
onChange?.(changedValue);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const onValueStringChange = (momentDate: any) => {
|
|
64
|
-
if (momentDate === null) {
|
|
65
|
-
triggerChange(undefined);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
triggerChange(momentDate.format(DatePickerConfig[mode].dateInternalFormat));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const dateValue = value
|
|
73
|
-
? dayjs(value, DatePickerConfig[mode].dateInternalFormat)
|
|
74
|
-
: undefined;
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<AntDatePicker
|
|
78
|
-
style={{ width: "100%", ...requiredStyle }}
|
|
79
|
-
placeholder={
|
|
80
|
-
showTime
|
|
81
|
-
? DatePickerConfig.time.placeholder
|
|
82
|
-
: DatePickerConfig.date.placeholder
|
|
83
|
-
}
|
|
84
|
-
disabled={readOnly}
|
|
85
|
-
id={id}
|
|
86
|
-
picker={"date"}
|
|
87
|
-
showTime={showTime}
|
|
88
|
-
format={DatePickerConfig[mode].dateDisplayFormat}
|
|
89
|
-
value={dateValue}
|
|
90
|
-
onChange={onValueStringChange}
|
|
91
|
-
showNow={false}
|
|
92
|
-
showToday={false}
|
|
93
|
-
changeOnBlur={true}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default DatePicker;
|
package/src/common/Field.tsx
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { Form, Row, Col } from "antd";
|
|
3
|
-
import { Field as FieldOoui, Label as LabelOoui } from "@gisce/ooui";
|
|
4
|
-
import Label from "@/widgets/base/Label";
|
|
5
|
-
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
6
|
-
|
|
7
|
-
export default function Field({
|
|
8
|
-
ooui,
|
|
9
|
-
children,
|
|
10
|
-
layout = "horizontal",
|
|
11
|
-
valuePropName,
|
|
12
|
-
showLabel = false,
|
|
13
|
-
alignLabel = "left",
|
|
14
|
-
required = false,
|
|
15
|
-
type,
|
|
16
|
-
validator,
|
|
17
|
-
}: {
|
|
18
|
-
ooui: FieldOoui;
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
layout?: "horizontal" | "vertical";
|
|
21
|
-
valuePropName?: string;
|
|
22
|
-
showLabel?: boolean;
|
|
23
|
-
alignLabel?: "left" | "center" | "right";
|
|
24
|
-
required?: boolean;
|
|
25
|
-
type?: any;
|
|
26
|
-
validator?: any;
|
|
27
|
-
}) {
|
|
28
|
-
const { id, label, tooltip } = ooui;
|
|
29
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
30
|
-
|
|
31
|
-
const rules = required
|
|
32
|
-
? [
|
|
33
|
-
{
|
|
34
|
-
required: true,
|
|
35
|
-
message: t("fillRequiredField"),
|
|
36
|
-
type,
|
|
37
|
-
validator,
|
|
38
|
-
},
|
|
39
|
-
]
|
|
40
|
-
: undefined;
|
|
41
|
-
|
|
42
|
-
const formItem = () => (
|
|
43
|
-
<Form.Item
|
|
44
|
-
className="mb-0"
|
|
45
|
-
name={id}
|
|
46
|
-
valuePropName={valuePropName}
|
|
47
|
-
rules={rules}
|
|
48
|
-
help={ooui.tooltipInline ? ooui.tooltip : null}
|
|
49
|
-
>
|
|
50
|
-
{children}
|
|
51
|
-
</Form.Item>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
if (!showLabel) {
|
|
55
|
-
return formItem();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const labelWidget = (
|
|
59
|
-
<Label
|
|
60
|
-
ooui={
|
|
61
|
-
new LabelOoui({
|
|
62
|
-
name: id + "_label",
|
|
63
|
-
string: label,
|
|
64
|
-
help: ooui.tooltipInline ? false : tooltip,
|
|
65
|
-
fieldForLabel: id,
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
align={alignLabel}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const horizontalMode = () => {
|
|
73
|
-
return (
|
|
74
|
-
<Row align="middle" className="pb-1 pt-1">
|
|
75
|
-
<Col className="ml-2" flex="7rem">
|
|
76
|
-
<div className="flex flex-col items-end">{labelWidget}</div>
|
|
77
|
-
</Col>
|
|
78
|
-
<Col flex="auto">{formItem()}</Col>
|
|
79
|
-
</Row>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const verticalMode = () => {
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
{labelWidget}
|
|
87
|
-
{formItem()}
|
|
88
|
-
</>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return layout === "horizontal" ? horizontalMode() : verticalMode();
|
|
93
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import React, { useContext, useState } from "react";
|
|
3
|
-
import { Spin } from "antd";
|
|
4
|
-
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
5
|
-
import Link from "antd/es/typography/Link";
|
|
6
|
-
|
|
7
|
-
export const Container = styled.div`
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
export const SelectAllRecordsRow = ({
|
|
14
|
-
numberOfVisibleSelectedRows,
|
|
15
|
-
totalRecords,
|
|
16
|
-
numberOfTotalRows,
|
|
17
|
-
onSelectAllRecords,
|
|
18
|
-
numberOfRealSelectedRows,
|
|
19
|
-
}: {
|
|
20
|
-
numberOfVisibleSelectedRows: number;
|
|
21
|
-
totalRecords: number;
|
|
22
|
-
numberOfTotalRows: number;
|
|
23
|
-
numberOfRealSelectedRows: number;
|
|
24
|
-
onSelectAllRecords: () => Promise<void>;
|
|
25
|
-
}) => {
|
|
26
|
-
const [loading, setLoading] = useState(false);
|
|
27
|
-
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
28
|
-
|
|
29
|
-
const translations = {
|
|
30
|
-
recordsSelected: t("recordsSelected"),
|
|
31
|
-
selectAllRecords: t("selectAllRecords"),
|
|
32
|
-
allRecordsSelected: t("allRecordsSelected"),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (numberOfTotalRows === 0) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
numberOfVisibleSelectedRows < numberOfTotalRows &&
|
|
41
|
-
numberOfRealSelectedRows <= numberOfTotalRows
|
|
42
|
-
) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (totalRecords === numberOfVisibleSelectedRows) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const handleClick = async (event: any) => {
|
|
51
|
-
event.preventDefault(); // prevent the default action (navigation) from happening
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
setLoading(true);
|
|
54
|
-
await onSelectAllRecords();
|
|
55
|
-
setLoading(false);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const selectRowsComponent = (
|
|
59
|
-
<span>
|
|
60
|
-
{translations.recordsSelected.replace(
|
|
61
|
-
"{numberOfSelectedRows}",
|
|
62
|
-
numberOfVisibleSelectedRows.toString(),
|
|
63
|
-
) + " "}
|
|
64
|
-
|
|
65
|
-
{loading ? (
|
|
66
|
-
<Spin />
|
|
67
|
-
) : (
|
|
68
|
-
<Link onClick={handleClick} style={{ fontWeight: 600 }}>
|
|
69
|
-
{translations.selectAllRecords.replace(
|
|
70
|
-
"{totalRecords}",
|
|
71
|
-
totalRecords.toString(),
|
|
72
|
-
)}
|
|
73
|
-
</Link>
|
|
74
|
-
)}
|
|
75
|
-
</span>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const allRowsAreSelected = (
|
|
79
|
-
<span style={{ fontWeight: 600 }}>
|
|
80
|
-
{translations.allRecordsSelected.replace(
|
|
81
|
-
"{totalRecords}",
|
|
82
|
-
numberOfRealSelectedRows.toString(),
|
|
83
|
-
) + " "}
|
|
84
|
-
</span>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<Container>
|
|
89
|
-
{numberOfRealSelectedRows > numberOfTotalRows
|
|
90
|
-
? allRowsAreSelected
|
|
91
|
-
: selectRowsComponent}
|
|
92
|
-
</Container>
|
|
93
|
-
);
|
|
94
|
-
};
|