@gisce/react-ooui 1.0.20 → 1.1.1
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/actionbar/ChangeViewButton.d.ts +3 -2
- package/dist/actionbar/ChangeViewButton.d.ts.map +1 -1
- package/dist/actionbar/FormActionBar.d.ts +3 -1
- package/dist/actionbar/FormActionBar.d.ts.map +1 -1
- package/dist/actionbar/GraphActionBar.d.ts +6 -0
- package/dist/actionbar/GraphActionBar.d.ts.map +1 -0
- package/dist/actionbar/TreeActionBar.d.ts +2 -1
- package/dist/actionbar/TreeActionBar.d.ts.map +1 -1
- package/dist/context/ActionViewContext.d.ts +7 -3
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/context/One2manyContext.d.ts +4 -4
- package/dist/context/One2manyContext.d.ts.map +1 -1
- package/dist/context/TabManagerContext.d.ts +2 -3
- package/dist/context/TabManagerContext.d.ts.map +1 -1
- package/dist/helpers/searchHelper.d.ts +6 -0
- package/dist/helpers/searchHelper.d.ts.map +1 -0
- package/dist/hooks/useSearch.d.ts +52 -0
- package/dist/hooks/useSearch.d.ts.map +1 -0
- package/dist/locales/ca_ES.d.ts +1 -0
- package/dist/locales/ca_ES.d.ts.map +1 -1
- package/dist/locales/en_US.d.ts +1 -0
- package/dist/locales/en_US.d.ts.map +1 -1
- package/dist/locales/es_ES.d.ts +1 -0
- package/dist/locales/es_ES.d.ts.map +1 -1
- package/dist/react-ooui.es.js +4915 -4469
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +14 -14
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/types/index.d.ts +29 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/TitleHeader.d.ts +1 -0
- package/dist/ui/TitleHeader.d.ts.map +1 -1
- package/dist/views/ActionView.d.ts +3 -7
- package/dist/views/ActionView.d.ts.map +1 -1
- package/dist/views/RootView.d.ts.map +1 -1
- package/dist/views/actionViews/DashboardActionView.d.ts +7 -0
- package/dist/views/actionViews/DashboardActionView.d.ts.map +1 -0
- package/dist/views/actionViews/FormActionView.d.ts +18 -0
- package/dist/views/actionViews/FormActionView.d.ts.map +1 -0
- package/dist/views/actionViews/GraphActionView.d.ts +13 -0
- package/dist/views/actionViews/GraphActionView.d.ts.map +1 -0
- package/dist/views/actionViews/TreeActionView.d.ts +19 -0
- package/dist/views/actionViews/TreeActionView.d.ts.map +1 -0
- package/dist/widgets/base/one2many/One2many.d.ts +0 -1
- 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/Container.d.ts.map +1 -1
- package/dist/widgets/custom/ButtonGroup.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/Form.d.ts.map +1 -1
- package/dist/widgets/views/Graph/Graph.d.ts +3 -3
- package/dist/widgets/views/Graph/Graph.d.ts.map +1 -1
- package/dist/widgets/views/Graph/GraphChart.d.ts +1 -1
- package/dist/widgets/views/Graph/GraphChart.d.ts.map +1 -1
- package/dist/widgets/views/Graph/useGraphData.d.ts +1 -1
- package/dist/widgets/views/Graph/useGraphData.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts +4 -0
- package/dist/widgets/views/searchFilter/SearchFilter.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/actionbar/ChangeViewButton.tsx +34 -39
- package/src/actionbar/FormActionBar.tsx +6 -6
- package/src/actionbar/GraphActionBar.tsx +67 -0
- package/src/actionbar/TreeActionBar.tsx +10 -11
- package/src/context/ActionViewContext.tsx +27 -8
- package/src/context/One2manyContext.tsx +5 -5
- package/src/context/TabManagerContext.tsx +2 -3
- package/src/helpers/{searchFilterHelper.ts → searchHelper.ts} +32 -7
- package/src/hooks/useFetchViews.ts +0 -0
- package/src/hooks/useSearch.ts +404 -0
- package/src/locales/ca_ES.tsx +1 -0
- package/src/locales/en_US.tsx +1 -0
- package/src/locales/es_ES.tsx +1 -0
- package/src/stories/forms/ActivacioContracteForm.stories.tsx +25 -0
- package/src/stories/mocks/index.ts +2 -0
- package/src/stories/mocks/models/activacioContracte.ts +112 -0
- package/src/types/index.ts +37 -3
- package/src/ui/FavouriteButton.tsx +2 -2
- package/src/ui/TitleHeader.tsx +4 -3
- package/src/views/ActionView.tsx +185 -171
- package/src/views/RootView.tsx +5 -6
- package/src/views/actionViews/DashboardActionView.tsx +47 -0
- package/src/views/actionViews/FormActionView.tsx +70 -0
- package/src/views/actionViews/GraphActionView.tsx +136 -0
- package/src/views/actionViews/TreeActionView.tsx +77 -0
- package/src/widgets/base/Button.tsx +1 -1
- package/src/widgets/base/Image.tsx +1 -1
- package/src/widgets/base/many2one/Many2oneSuffix.tsx +1 -1
- package/src/widgets/base/one2many/One2many.tsx +5 -7
- package/src/widgets/base/one2many/One2manyInput.tsx +5 -7
- package/src/widgets/base/one2many/One2manyTopBar.tsx +5 -5
- package/src/widgets/containers/Container.tsx +2 -4
- package/src/widgets/containers/Notebook.tsx +1 -1
- package/src/widgets/custom/ButtonGroup.tsx +15 -14
- package/src/widgets/custom/Indicator.tsx +2 -2
- package/src/widgets/views/Dashboard/Dashboard.tsx +4 -5
- package/src/widgets/views/Dashboard/DashboardTree.tsx +15 -18
- package/src/widgets/views/Form.tsx +0 -1
- package/src/widgets/views/Graph/Graph.tsx +40 -6
- package/src/widgets/views/Graph/GraphChart.tsx +1 -1
- package/src/widgets/views/Graph/useGraphData.tsx +2 -2
- package/src/widgets/views/SearchTree.tsx +81 -331
- package/src/widgets/views/searchFilter/SearchFilter.tsx +58 -23
- package/dist/helpers/searchFilterHelper.d.ts +0 -5
- package/dist/helpers/searchFilterHelper.d.ts.map +0 -1
- package/dist/widgets/views/Dashboard/Dashboard.types.d.ts +0 -8
- package/dist/widgets/views/Dashboard/Dashboard.types.d.ts.map +0 -1
- package/src/widgets/views/Dashboard/Dashboard.types.ts +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Form, Row, Col } from "antd";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Form, Row, Col, Alert } from "antd";
|
|
3
3
|
import useDeepCompareEffect from "use-deep-compare-effect";
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -13,7 +13,8 @@ import { SearchBottomBar } from "./SearchBottomBar";
|
|
|
13
13
|
import { SearchFields } from "@/types";
|
|
14
14
|
import { SearchParams } from "./SearchParams";
|
|
15
15
|
|
|
16
|
-
import { getParamsForFields } from "@/helpers/
|
|
16
|
+
import { getParamsForFields } from "@/helpers/searchHelper";
|
|
17
|
+
import Measure from "react-measure";
|
|
17
18
|
|
|
18
19
|
type Props = {
|
|
19
20
|
fields: any;
|
|
@@ -24,6 +25,10 @@ type Props = {
|
|
|
24
25
|
limit: number;
|
|
25
26
|
offset: number;
|
|
26
27
|
onLimitChange?: (limit: number) => void;
|
|
28
|
+
searchVisible?: boolean;
|
|
29
|
+
setSearchFilterHeight?: (height: number) => void;
|
|
30
|
+
searchError?: string;
|
|
31
|
+
searchValues?: any;
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
function SearchFilter(props: Props) {
|
|
@@ -36,6 +41,10 @@ function SearchFilter(props: Props) {
|
|
|
36
41
|
offset,
|
|
37
42
|
limit,
|
|
38
43
|
onLimitChange,
|
|
44
|
+
searchVisible,
|
|
45
|
+
setSearchFilterHeight,
|
|
46
|
+
searchError,
|
|
47
|
+
searchValues,
|
|
39
48
|
} = props;
|
|
40
49
|
|
|
41
50
|
const [simpleSearchFields, setSimpleSearchFields] = useState<Container>();
|
|
@@ -44,6 +53,10 @@ function SearchFilter(props: Props) {
|
|
|
44
53
|
|
|
45
54
|
const [form] = Form.useForm();
|
|
46
55
|
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
form.setFieldsValue(searchValues);
|
|
58
|
+
}, [searchValues]);
|
|
59
|
+
|
|
47
60
|
const getRowsAndCols = () => {
|
|
48
61
|
if (!advancedSearchFields) {
|
|
49
62
|
return;
|
|
@@ -83,30 +96,52 @@ function SearchFilter(props: Props) {
|
|
|
83
96
|
delete values.limit;
|
|
84
97
|
const newParams = getParamsForFields(values, fields);
|
|
85
98
|
|
|
86
|
-
onSubmit({ params: newParams, offset, limit });
|
|
99
|
+
onSubmit({ params: newParams, offset, limit, searchValues: values });
|
|
87
100
|
};
|
|
88
101
|
|
|
89
102
|
return (
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
<Measure
|
|
104
|
+
bounds
|
|
105
|
+
onResize={(contentRect) => {
|
|
106
|
+
setSearchFilterHeight?.(contentRect.bounds?.height!);
|
|
107
|
+
}}
|
|
95
108
|
>
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
{({ measureRef }) => (
|
|
110
|
+
<div ref={measureRef}>
|
|
111
|
+
<div style={{ display: searchVisible ? "block" : "none" }}>
|
|
112
|
+
<Form
|
|
113
|
+
className="p-3 rounded shadow-md bg-gray-50"
|
|
114
|
+
form={form}
|
|
115
|
+
onFinish={onFinish}
|
|
116
|
+
initialValues={{ offset, limit }}
|
|
117
|
+
>
|
|
118
|
+
{rows}
|
|
119
|
+
{advancedFilter && <SearchParams onLimitChange={onLimitChange} />}
|
|
120
|
+
<SearchBottomBar
|
|
121
|
+
advancedFilter={advancedFilter}
|
|
122
|
+
onAdvancedFilterToggle={() => {
|
|
123
|
+
setAdvancedFilter(!advancedFilter);
|
|
124
|
+
}}
|
|
125
|
+
onClear={() => {
|
|
126
|
+
form.resetFields();
|
|
127
|
+
onClear();
|
|
128
|
+
}}
|
|
129
|
+
isSearching={isSearching}
|
|
130
|
+
/>
|
|
131
|
+
</Form>
|
|
132
|
+
{searchError && (
|
|
133
|
+
<Alert
|
|
134
|
+
className="mt-10"
|
|
135
|
+
message={searchError}
|
|
136
|
+
type="error"
|
|
137
|
+
banner
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
<div className="pb-5" />
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</Measure>
|
|
110
145
|
);
|
|
111
146
|
}
|
|
112
147
|
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const getParamsForFields: (values: any, fields: any) => any[];
|
|
2
|
-
declare const groupDateTimeValuesIfNeeded: (values: any) => any;
|
|
3
|
-
declare const removeUndefinedFields: (values: any) => any;
|
|
4
|
-
export { removeUndefinedFields, groupDateTimeValuesIfNeeded, getParamsForFields, };
|
|
5
|
-
//# sourceMappingURL=searchFilterHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchFilterHelper.d.ts","sourceRoot":"","sources":["searchFilterHelper.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,kBAAkB,WAAY,GAAG,UAAU,GAAG,UAoBnD,CAAC;AA+DF,QAAA,MAAM,2BAA2B,WAAY,GAAG,QAqC/C,CAAC;AAuBF,QAAA,MAAM,qBAAqB,WAAY,GAAG,QAUzC,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,GACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.types.d.ts","sourceRoot":"","sources":["Dashboard.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,oBAAY,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B,CAAC"}
|