@gisce/react-ooui 1.0.21 → 1.0.22-rc.0
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 +3168 -3164
- 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/widgets/views/SearchTree.d.ts +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/views/ActionView.tsx +3 -0
- package/src/views/RootView.tsx +9 -0
- package/src/widgets/base/many2one/Many2one.tsx +2 -2
- package/src/widgets/views/SearchTree.tsx +19 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsB7D,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,IAAI,CAAC;IAClB,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsB7D,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,IAAI,CAAC;IAClB,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;;AAyZF,wBAAsC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootView.d.ts","sourceRoot":"","sources":["RootView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAaf,aAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;;
|
|
1
|
+
{"version":3,"file":"RootView.d.ts","sourceRoot":"","sources":["RootView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAaf,aAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;;AAwdF,wBAAoC"}
|
|
@@ -7,7 +7,6 @@ declare type OnRowClickedData = {
|
|
|
7
7
|
treeView: TreeView;
|
|
8
8
|
};
|
|
9
9
|
declare type Props = {
|
|
10
|
-
action?: string;
|
|
11
10
|
model?: string;
|
|
12
11
|
formView?: FormView;
|
|
13
12
|
treeView?: TreeView;
|
|
@@ -19,6 +18,7 @@ declare type Props = {
|
|
|
19
18
|
rootTree?: boolean;
|
|
20
19
|
parentContext?: any;
|
|
21
20
|
onChangeSelectedRowKeys?: (selectedRowKeys: any) => void;
|
|
21
|
+
limit?: number;
|
|
22
22
|
};
|
|
23
23
|
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>;
|
|
24
24
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchTree.d.ts","sourceRoot":"","sources":["SearchTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAwBnD,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,
|
|
1
|
+
{"version":3,"file":"SearchTree.d.ts","sourceRoot":"","sources":["SearchTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAwBnD,aAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,aAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,KAAK,IAAI,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;;AA8hBF,wBAAsC"}
|
package/package.json
CHANGED
package/src/views/ActionView.tsx
CHANGED
|
@@ -46,6 +46,7 @@ type Props = {
|
|
|
46
46
|
action_id: number;
|
|
47
47
|
action_type: string;
|
|
48
48
|
treeExpandable?: boolean;
|
|
49
|
+
limit?: number;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export type View = {
|
|
@@ -69,6 +70,7 @@ function ActionView(props: Props, ref: any) {
|
|
|
69
70
|
action_id,
|
|
70
71
|
action_type,
|
|
71
72
|
treeExpandable = false,
|
|
73
|
+
limit
|
|
72
74
|
} = props;
|
|
73
75
|
const [currentView, setCurrentViewInternal] = useState<View>();
|
|
74
76
|
const [availableViews, setAvailableViews] = useState<View[]>([]);
|
|
@@ -341,6 +343,7 @@ function ActionView(props: Props, ref: any) {
|
|
|
341
343
|
ref={searchTreeRef}
|
|
342
344
|
rootTree={true}
|
|
343
345
|
model={model}
|
|
346
|
+
limit={limit}
|
|
344
347
|
parentContext={context}
|
|
345
348
|
nameSearch={searchTreeNameSearch}
|
|
346
349
|
formView={formView}
|
package/src/views/RootView.tsx
CHANGED
|
@@ -122,6 +122,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
122
122
|
name: title,
|
|
123
123
|
target,
|
|
124
124
|
view_type,
|
|
125
|
+
limit,
|
|
125
126
|
} = dataForAction;
|
|
126
127
|
|
|
127
128
|
const treeExpandable = view_type === "tree";
|
|
@@ -174,6 +175,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
174
175
|
forced_values,
|
|
175
176
|
res_id,
|
|
176
177
|
treeExpandable,
|
|
178
|
+
limit,
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
181
|
|
|
@@ -228,6 +230,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
228
230
|
views,
|
|
229
231
|
target,
|
|
230
232
|
string: title,
|
|
233
|
+
limit,
|
|
231
234
|
} = relateData;
|
|
232
235
|
|
|
233
236
|
const [id, type] = views[0];
|
|
@@ -257,6 +260,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
257
260
|
initialView,
|
|
258
261
|
action_id,
|
|
259
262
|
action_type,
|
|
263
|
+
limit,
|
|
260
264
|
});
|
|
261
265
|
}
|
|
262
266
|
|
|
@@ -288,6 +292,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
288
292
|
name: title,
|
|
289
293
|
target,
|
|
290
294
|
view_type,
|
|
295
|
+
limit,
|
|
291
296
|
} = dataForAction;
|
|
292
297
|
const treeExpandable = view_type === "tree";
|
|
293
298
|
|
|
@@ -343,6 +348,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
343
348
|
action_type,
|
|
344
349
|
res_id,
|
|
345
350
|
treeExpandable,
|
|
351
|
+
limit,
|
|
346
352
|
});
|
|
347
353
|
}
|
|
348
354
|
|
|
@@ -388,6 +394,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
388
394
|
values,
|
|
389
395
|
forced_values,
|
|
390
396
|
treeExpandable = false,
|
|
397
|
+
limit,
|
|
391
398
|
}: {
|
|
392
399
|
domain: any;
|
|
393
400
|
context: any;
|
|
@@ -402,6 +409,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
402
409
|
values?: any;
|
|
403
410
|
forced_values?: any;
|
|
404
411
|
treeExpandable?: boolean;
|
|
412
|
+
limit?: number;
|
|
405
413
|
}) {
|
|
406
414
|
const key = uuidv4();
|
|
407
415
|
|
|
@@ -448,6 +456,7 @@ function RootView(props: RootViewProps, ref: any) {
|
|
|
448
456
|
formDefaultValues={values}
|
|
449
457
|
formForcedValues={forced_values}
|
|
450
458
|
treeExpandable={treeExpandable}
|
|
459
|
+
limit={limit}
|
|
451
460
|
/>
|
|
452
461
|
),
|
|
453
462
|
key,
|
|
@@ -86,11 +86,11 @@ export const Many2oneInput: React.FC<Many2oneInputProps> = (
|
|
|
86
86
|
const transformedDomain = useRef<any[]>([]);
|
|
87
87
|
const [searchDomain, setSearchDomain] = useState<any>([]);
|
|
88
88
|
|
|
89
|
-
const id = value && value[0];
|
|
89
|
+
const id = (value && value[0]) || undefined;
|
|
90
90
|
const text = (value && value[1]) || "";
|
|
91
91
|
|
|
92
92
|
useEffect(() => {
|
|
93
|
-
if (!Array.isArray(value) &&
|
|
93
|
+
if (!Array.isArray(value) && value) {
|
|
94
94
|
fetchNameAndUpdate(value as any);
|
|
95
95
|
}
|
|
96
96
|
}, [value]);
|
|
@@ -43,7 +43,6 @@ type OnRowClickedData = {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
type Props = {
|
|
46
|
-
action?: string;
|
|
47
46
|
model?: string;
|
|
48
47
|
formView?: FormView;
|
|
49
48
|
treeView?: TreeView;
|
|
@@ -55,11 +54,11 @@ type Props = {
|
|
|
55
54
|
rootTree?: boolean;
|
|
56
55
|
parentContext?: any;
|
|
57
56
|
onChangeSelectedRowKeys?: (selectedRowKeys: any) => void;
|
|
57
|
+
limit?: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
function SearchTree(props: Props, ref: any) {
|
|
61
61
|
const {
|
|
62
|
-
action,
|
|
63
62
|
model,
|
|
64
63
|
formView: formViewProps,
|
|
65
64
|
treeView: treeViewProps,
|
|
@@ -71,13 +70,14 @@ function SearchTree(props: Props, ref: any) {
|
|
|
71
70
|
rootTree = false,
|
|
72
71
|
parentContext = {},
|
|
73
72
|
onChangeSelectedRowKeys,
|
|
73
|
+
limit: limitFromAction,
|
|
74
74
|
} = props;
|
|
75
75
|
|
|
76
76
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
77
77
|
const [initialFetchDone, setInitialFetchDone] = useState<boolean>(false);
|
|
78
78
|
|
|
79
79
|
const searchNameGetDoneRef = useRef(false);
|
|
80
|
-
const internalLimit = useRef(
|
|
80
|
+
const internalLimit = useRef(limitFromAction || DEFAULT_SEARCH_LIMIT);
|
|
81
81
|
|
|
82
82
|
const [currentModel, setCurrentModel] = useState<string>();
|
|
83
83
|
const [treeView, setTreeView] = useState<TreeView>();
|
|
@@ -85,8 +85,9 @@ function SearchTree(props: Props, ref: any) {
|
|
|
85
85
|
|
|
86
86
|
const [page, setPage] = useState<number>(1);
|
|
87
87
|
const [offset, setOffset] = useState<number>(0);
|
|
88
|
-
const [limit, setLimit] = useState<number>(
|
|
89
|
-
|
|
88
|
+
const [limit, setLimit] = useState<number>(
|
|
89
|
+
limitFromAction || DEFAULT_SEARCH_LIMIT
|
|
90
|
+
);
|
|
90
91
|
|
|
91
92
|
const paramsRef = useRef<Array<any>>([]);
|
|
92
93
|
|
|
@@ -94,9 +95,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
94
95
|
const [resultsInternal, setResultsInternal] = useState<any>([]);
|
|
95
96
|
const [colorsForResults, setColorsForResults] = useState<any>(undefined);
|
|
96
97
|
|
|
97
|
-
const [searchFilterLoading, setSearchFilterLoading] =
|
|
98
|
-
false
|
|
99
|
-
);
|
|
98
|
+
const [searchFilterLoading, setSearchFilterLoading] =
|
|
99
|
+
useState<boolean>(false);
|
|
100
100
|
const [searchError, setSearchError] = useState<string>();
|
|
101
101
|
const [initialError, setInitialError] = useState<string>();
|
|
102
102
|
|
|
@@ -179,8 +179,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
179
179
|
|
|
180
180
|
const { colors } = getTree(treeView!);
|
|
181
181
|
|
|
182
|
-
const resultsWithData =
|
|
183
|
-
{
|
|
182
|
+
const resultsWithData =
|
|
183
|
+
await ConnectionProvider.getHandler().readEvalUiObjects({
|
|
184
184
|
model: currentModel!,
|
|
185
185
|
ids: resultsIds,
|
|
186
186
|
arch: treeView?.arch!,
|
|
@@ -191,8 +191,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
191
191
|
attrs: colors && {
|
|
192
192
|
colors,
|
|
193
193
|
},
|
|
194
|
-
}
|
|
195
|
-
);
|
|
194
|
+
});
|
|
196
195
|
const resultsData = resultsWithData[0];
|
|
197
196
|
|
|
198
197
|
originalResults.current = [...resultsData];
|
|
@@ -359,18 +358,14 @@ function SearchTree(props: Props, ref: any) {
|
|
|
359
358
|
}
|
|
360
359
|
}, [page, limit, offset, initialFetchDone, visible, nameSearch]);
|
|
361
360
|
|
|
362
|
-
const fetchData = async (
|
|
361
|
+
const fetchData = async () => {
|
|
363
362
|
setInitialFetchDone(false);
|
|
364
363
|
setIsLoading(true);
|
|
365
364
|
setInitialError(undefined);
|
|
366
365
|
setTreeIsLoading?.(true);
|
|
367
366
|
|
|
368
367
|
try {
|
|
369
|
-
|
|
370
|
-
await fetchActionData();
|
|
371
|
-
} else {
|
|
372
|
-
await fetchModelData();
|
|
373
|
-
}
|
|
368
|
+
await fetchModelData();
|
|
374
369
|
setInitialFetchDone(true);
|
|
375
370
|
} catch (error) {
|
|
376
371
|
setInitialError(error);
|
|
@@ -380,21 +375,6 @@ function SearchTree(props: Props, ref: any) {
|
|
|
380
375
|
}
|
|
381
376
|
};
|
|
382
377
|
|
|
383
|
-
const fetchActionData = async () => {
|
|
384
|
-
const dataForAction = await ConnectionProvider.getHandler().getViewsForAction(
|
|
385
|
-
{
|
|
386
|
-
action: action!,
|
|
387
|
-
context: parentContext,
|
|
388
|
-
}
|
|
389
|
-
);
|
|
390
|
-
actionDomain.current = dataForAction.domain;
|
|
391
|
-
setFormView(dataForAction.views.get("form"));
|
|
392
|
-
setTreeView(dataForAction.views.get("tree"));
|
|
393
|
-
setCurrentModel(dataForAction.model);
|
|
394
|
-
setLimitFromAction(dataForAction.limit);
|
|
395
|
-
setLimit(dataForAction.limit);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
378
|
const fetchModelData = async () => {
|
|
399
379
|
setCurrentModel(model);
|
|
400
380
|
|
|
@@ -420,17 +400,12 @@ function SearchTree(props: Props, ref: any) {
|
|
|
420
400
|
|
|
421
401
|
setFormView(_formView as FormView);
|
|
422
402
|
setTreeView(_treeView as TreeView);
|
|
423
|
-
|
|
424
|
-
setLimit(DEFAULT_SEARCH_LIMIT);
|
|
403
|
+
setLimit(limitFromAction || DEFAULT_SEARCH_LIMIT);
|
|
425
404
|
};
|
|
426
405
|
|
|
427
406
|
useEffect(() => {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
} else if (model) {
|
|
431
|
-
fetchData("model");
|
|
432
|
-
}
|
|
433
|
-
}, [action, model]);
|
|
407
|
+
fetchData();
|
|
408
|
+
}, [model]);
|
|
434
409
|
|
|
435
410
|
const onClear = () => {
|
|
436
411
|
if (tableRefreshing) return;
|
|
@@ -474,13 +449,12 @@ function SearchTree(props: Props, ref: any) {
|
|
|
474
449
|
const { id } = record;
|
|
475
450
|
|
|
476
451
|
if (!expandableClickActionData.current) {
|
|
477
|
-
expandableClickActionData.current =
|
|
478
|
-
{
|
|
452
|
+
expandableClickActionData.current =
|
|
453
|
+
await ConnectionProvider.getHandler().treeButOpen({
|
|
479
454
|
id: treeView!.view_id,
|
|
480
455
|
model: currentModel!,
|
|
481
456
|
context: parentContext,
|
|
482
|
-
}
|
|
483
|
-
);
|
|
457
|
+
});
|
|
484
458
|
}
|
|
485
459
|
|
|
486
460
|
const actionData: any = expandableClickActionData.current[0][2];
|