@gisce/react-ooui 1.1.2-rc.0 → 1.1.2-rc.2
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/context/ActionViewContext.d.ts +2 -0
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/context/ContentRootContext.d.ts.map +1 -1
- package/dist/helpers/treeHelper.d.ts +1 -2
- package/dist/helpers/treeHelper.d.ts.map +1 -1
- package/dist/hooks/useSearch.d.ts +0 -1
- package/dist/hooks/useSearch.d.ts.map +1 -1
- package/dist/react-ooui.es.js +4515 -4531
- 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/views/ActionView.d.ts +1 -0
- package/dist/views/ActionView.d.ts.map +1 -1
- package/dist/views/RootView.d.ts.map +1 -1
- package/dist/views/actionViews/GraphActionView.d.ts.map +1 -1
- package/dist/views/actionViews/TreeActionView.d.ts +1 -0
- package/dist/views/actionViews/TreeActionView.d.ts.map +1 -1
- package/dist/widgets/base/Binary.d.ts.map +1 -1
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts +0 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/Tree.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/context/ActionViewContext.tsx +38 -14
- package/src/context/ContentRootContext.tsx +2 -19
- package/src/helpers/treeHelper.ts +0 -17
- package/src/hooks/useSearch.ts +5 -8
- package/src/stories/mocks/models/cups.ts +5 -8
- package/src/views/ActionView.tsx +4 -0
- package/src/views/RootView.tsx +9 -0
- package/src/views/actionViews/GraphActionView.tsx +5 -3
- package/src/views/actionViews/TreeActionView.tsx +2 -0
- package/src/widgets/base/Binary.tsx +2 -1
- package/src/widgets/base/Integer.tsx +1 -1
- package/src/widgets/base/one2many/One2manyInput.tsx +2 -5
- package/src/widgets/views/Dashboard/Dashboard.tsx +1 -0
- package/src/widgets/views/SearchTree.tsx +9 -39
- package/src/widgets/views/Tree.tsx +4 -2
- package/src/.eslintcache +0 -1
|
@@ -34,7 +34,6 @@ type OnRowClickedData = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
type Props = {
|
|
37
|
-
action?: string;
|
|
38
37
|
model?: string;
|
|
39
38
|
formView?: FormView;
|
|
40
39
|
treeView?: TreeView;
|
|
@@ -50,7 +49,6 @@ type Props = {
|
|
|
50
49
|
|
|
51
50
|
function SearchTree(props: Props, ref: any) {
|
|
52
51
|
const {
|
|
53
|
-
action,
|
|
54
52
|
model,
|
|
55
53
|
formView: formViewProps,
|
|
56
54
|
treeView: treeViewProps,
|
|
@@ -68,18 +66,13 @@ function SearchTree(props: Props, ref: any) {
|
|
|
68
66
|
const [initialFetchDone, setInitialFetchDone] = useState<boolean>(false);
|
|
69
67
|
|
|
70
68
|
const searchNameGetDoneRef = useRef(false);
|
|
71
|
-
const internalLimit = useRef(80);
|
|
72
69
|
|
|
73
70
|
const [currentModel, setCurrentModel] = useState<string>();
|
|
74
71
|
const [treeView, setTreeView] = useState<TreeView>();
|
|
75
72
|
const [formView, setFormView] = useState<FormView>();
|
|
76
73
|
|
|
77
|
-
const [limitFromAction, setLimitFromAction] = useState<number>();
|
|
78
|
-
const [limit, setLimit] = useState<number>(DEFAULT_SEARCH_LIMIT);
|
|
79
|
-
|
|
80
74
|
const [initialError, setInitialError] = useState<string>();
|
|
81
75
|
|
|
82
|
-
const actionDomain = useRef<any>([]);
|
|
83
76
|
const [searchFilterHeight, setSearchFilterHeight] = useState<number>(200);
|
|
84
77
|
|
|
85
78
|
const expandableClickActionData = useRef<any>();
|
|
@@ -112,6 +105,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
112
105
|
setTreeIsLoading = undefined,
|
|
113
106
|
searchValues = {},
|
|
114
107
|
setSearchValues = undefined,
|
|
108
|
+
limit = DEFAULT_SEARCH_LIMIT,
|
|
109
|
+
setLimit = undefined,
|
|
115
110
|
} = (rootTree ? actionViewContext : {}) || {};
|
|
116
111
|
|
|
117
112
|
const {
|
|
@@ -151,9 +146,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
151
146
|
domain,
|
|
152
147
|
currentId,
|
|
153
148
|
setActionViewTotalItems,
|
|
154
|
-
limitFromAction,
|
|
155
|
-
setLimit,
|
|
156
149
|
limit,
|
|
150
|
+
setLimit,
|
|
157
151
|
});
|
|
158
152
|
|
|
159
153
|
useImperativeHandle(ref, () => ({
|
|
@@ -172,20 +166,16 @@ function SearchTree(props: Props, ref: any) {
|
|
|
172
166
|
searchNameGetDoneRef.current = false;
|
|
173
167
|
fetchResults();
|
|
174
168
|
}
|
|
175
|
-
}, [page,
|
|
169
|
+
}, [page, offset, initialFetchDone, visible, nameSearch]);
|
|
176
170
|
|
|
177
|
-
const fetchData = async (
|
|
171
|
+
const fetchData = async () => {
|
|
178
172
|
setInitialFetchDone(false);
|
|
179
173
|
setIsLoading(true);
|
|
180
174
|
setInitialError(undefined);
|
|
181
175
|
setTreeIsLoading?.(true);
|
|
182
176
|
|
|
183
177
|
try {
|
|
184
|
-
|
|
185
|
-
await fetchActionData();
|
|
186
|
-
} else {
|
|
187
|
-
await fetchModelData();
|
|
188
|
-
}
|
|
178
|
+
await fetchModelData();
|
|
189
179
|
setInitialFetchDone(true);
|
|
190
180
|
} catch (error) {
|
|
191
181
|
setInitialError(error);
|
|
@@ -195,20 +185,6 @@ function SearchTree(props: Props, ref: any) {
|
|
|
195
185
|
}
|
|
196
186
|
};
|
|
197
187
|
|
|
198
|
-
const fetchActionData = async () => {
|
|
199
|
-
const dataForAction =
|
|
200
|
-
await ConnectionProvider.getHandler().getViewsForAction({
|
|
201
|
-
action: action!,
|
|
202
|
-
context: parentContext,
|
|
203
|
-
});
|
|
204
|
-
actionDomain.current = dataForAction.domain;
|
|
205
|
-
setFormView(dataForAction.views.get("form"));
|
|
206
|
-
setTreeView(dataForAction.views.get("tree"));
|
|
207
|
-
setCurrentModel(dataForAction.model);
|
|
208
|
-
setLimitFromAction(dataForAction.limit);
|
|
209
|
-
setLimit(dataForAction.limit);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
188
|
const fetchModelData = async () => {
|
|
213
189
|
setCurrentModel(model);
|
|
214
190
|
|
|
@@ -234,20 +210,14 @@ function SearchTree(props: Props, ref: any) {
|
|
|
234
210
|
|
|
235
211
|
setFormView(_formView as FormView);
|
|
236
212
|
setTreeView(_treeView as TreeView);
|
|
237
|
-
setLimitFromAction(undefined);
|
|
238
|
-
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
239
213
|
};
|
|
240
214
|
|
|
241
215
|
useEffect(() => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
} else if (model) {
|
|
245
|
-
fetchData("model");
|
|
246
|
-
}
|
|
247
|
-
}, [action, model]);
|
|
216
|
+
fetchData();
|
|
217
|
+
}, [model]);
|
|
248
218
|
|
|
249
219
|
const onSearchTreeLimitChange = (newLimit: number) => {
|
|
250
|
-
|
|
220
|
+
setLimit?.(newLimit);
|
|
251
221
|
};
|
|
252
222
|
|
|
253
223
|
const treeButOpen = async (record: any) => {
|
|
@@ -119,6 +119,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
119
119
|
const treeOoui = useRef<any>(null);
|
|
120
120
|
|
|
121
121
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
122
|
+
const internalLimit = useRef(limit);
|
|
122
123
|
|
|
123
124
|
useEffect(() => {
|
|
124
125
|
treeOoui.current = getTree(treeView);
|
|
@@ -143,9 +144,10 @@ function Tree(props: Props): React.ReactElement {
|
|
|
143
144
|
errorInParseColors.current = false;
|
|
144
145
|
const items = getTableItems(treeOoui.current, results);
|
|
145
146
|
setItems(items);
|
|
147
|
+
internalLimit.current = limit;
|
|
146
148
|
}, [results]);
|
|
147
149
|
|
|
148
|
-
const from = (page - 1) *
|
|
150
|
+
const from = (page - 1) * internalLimit.current + 1;
|
|
149
151
|
const to = from - 1 + items.length;
|
|
150
152
|
const summary =
|
|
151
153
|
total === undefined
|
|
@@ -169,7 +171,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
169
171
|
<Col span={12}>
|
|
170
172
|
<Pagination
|
|
171
173
|
total={total}
|
|
172
|
-
pageSize={
|
|
174
|
+
pageSize={internalLimit.current}
|
|
173
175
|
current={page}
|
|
174
176
|
showSizeChanger={false}
|
|
175
177
|
onChange={onRequestPageChange}
|
package/src/.eslintcache
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"/Users/marc/development/react-ooui/src/stories/Button.stories.js":"1","/Users/marc/development/react-ooui/src/stories/Char.stories.js":"2","/Users/marc/development/react-ooui/src/stories/Selection.stories.js":"3","/Users/marc/development/react-ooui/src/stories/ManyToOne.stories.js":"4","/Users/marc/development/react-ooui/src/stories/Checkbox.stories.js":"5","/Users/marc/development/react-ooui/src/widgets/Checkbox.tsx":"6","/Users/marc/development/react-ooui/src/widgets/ManyToOne.tsx":"7","/Users/marc/development/react-ooui/src/widgets/Selection.tsx":"8","/Users/marc/development/react-ooui/src/widgets/Button.tsx":"9","/Users/marc/development/react-ooui/src/widgets/Char.tsx":"10","/Users/marc/development/react-ooui/src/index.ts":"11","/Users/marc/development/react-ooui/src/helpers/TreeHelper.ts":"12","/Users/marc/development/react-ooui/src/widgets/Tree.tsx":"13","/Users/marc/development/react-ooui/src/stories/Tree.stories.js":"14"},{"size":721,"mtime":1611223665948,"results":"15","hashOfConfig":"16"},{"size":432,"mtime":1611223665949,"results":"17","hashOfConfig":"16"},{"size":539,"mtime":1611223665952,"results":"18","hashOfConfig":"16"},{"size":599,"mtime":1611223665950,"results":"19","hashOfConfig":"16"},{"size":464,"mtime":1611223665949,"results":"20","hashOfConfig":"16"},{"size":671,"mtime":1611223665953,"results":"21","hashOfConfig":"16"},{"size":1308,"mtime":1611223665954,"results":"22","hashOfConfig":"16"},{"size":706,"mtime":1611223665954,"results":"23","hashOfConfig":"16"},{"size":639,"mtime":1611223665953,"results":"24","hashOfConfig":"16"},{"size":741,"mtime":1611223665953,"results":"25","hashOfConfig":"16"},{"size":385,"mtime":1611227468105,"results":"26","hashOfConfig":"16"},{"size":1966,"mtime":1611306565063,"results":"27","hashOfConfig":"16"},{"size":1681,"mtime":1611227447728,"results":"28","hashOfConfig":"16"},{"size":3152,"mtime":1611308351200,"results":"29","hashOfConfig":"16"},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},"i1ix4w",{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"45","messages":"46","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"47","messages":"48","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"49"},{"filePath":"50","messages":"51","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"52","messages":"53","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"54","messages":"55","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"56","messages":"57","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},{"filePath":"58","messages":"59","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"32"},"/Users/marc/development/react-ooui/src/stories/Button.stories.js",[],[],"/Users/marc/development/react-ooui/src/stories/Char.stories.js",[],"/Users/marc/development/react-ooui/src/stories/Selection.stories.js",[],"/Users/marc/development/react-ooui/src/stories/ManyToOne.stories.js",[],"/Users/marc/development/react-ooui/src/stories/Checkbox.stories.js",[],"/Users/marc/development/react-ooui/src/widgets/Checkbox.tsx",[],"/Users/marc/development/react-ooui/src/widgets/ManyToOne.tsx",[],"/Users/marc/development/react-ooui/src/widgets/Selection.tsx",[],"/Users/marc/development/react-ooui/src/widgets/Button.tsx",[],[],"/Users/marc/development/react-ooui/src/widgets/Char.tsx",[],"/Users/marc/development/react-ooui/src/index.ts",[],"/Users/marc/development/react-ooui/src/helpers/TreeHelper.ts",[],"/Users/marc/development/react-ooui/src/widgets/Tree.tsx",[],"/Users/marc/development/react-ooui/src/stories/Tree.stories.js",[]]
|