@gisce/react-ooui 1.1.46 → 1.1.47
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/helpers/one2manyHelper.d.ts +8 -3
- package/dist/helpers/one2manyHelper.d.ts.map +1 -1
- package/dist/react-ooui.es.js +2730 -2693
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +15 -15
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
- package/dist/widgets/custom/Timeline.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/Dashboard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/helpers/one2manyHelper.ts +42 -15
- package/src/widgets/base/one2many/One2manyInput.tsx +15 -4
- package/src/widgets/custom/Timeline.tsx +8 -3
- package/src/widgets/views/Dashboard/Dashboard.tsx +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"One2manyInput.d.ts","sourceRoot":"","sources":["One2manyInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AAWvD,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAkB1C,aAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CAC5B,CAAC;AAQF,aAAK,YAAY,GAAG;IAClB,SAAS,CAAC,EACN,UAAU,GACV,eAAe,GACf,eAAe,GACf,eAAe,GACf,aAAa,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,UAAU,kBAAkB;IAC1B,IAAI,EAAE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eline.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAgB,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAO1C,aAAK,aAAa,GAAG;IACnB,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,aAAK,kBAAkB,GAAG,aAAa,GAAG;IACxC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,aAAa,gBAsD5C,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["Timeline.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAgB,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAO1C,aAAK,aAAa,GAAG;IACnB,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,aAAK,kBAAkB,GAAG,aAAa,GAAG;IACxC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,aAAa,gBAsD5C,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,kBAAkB,gBAqHtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;;
|
|
1
|
+
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;;AA6WnD,wBAAqC"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { One2manyItem } from "@/widgets/base/one2many/One2manyInput";
|
|
2
2
|
import ConnectionProvider from "@/ConnectionProvider";
|
|
3
|
-
import { ViewType } from "@/types";
|
|
3
|
+
import { TreeView, View, ViewType } from "@/types";
|
|
4
|
+
import { getColorMap, getTree } from "./treeHelper";
|
|
4
5
|
|
|
5
6
|
type ReadObjectValuesOptions = {
|
|
6
7
|
items: One2manyItem[];
|
|
7
8
|
model: string;
|
|
8
|
-
treeFields: any;
|
|
9
|
-
formFields: any;
|
|
10
9
|
context?: any;
|
|
11
10
|
currentView: ViewType;
|
|
11
|
+
formView: {
|
|
12
|
+
fields: any;
|
|
13
|
+
};
|
|
14
|
+
treeView: {
|
|
15
|
+
arch?: string;
|
|
16
|
+
fields: any;
|
|
17
|
+
};
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
const readObjectValues = async (
|
|
15
21
|
options: ReadObjectValuesOptions
|
|
16
|
-
): Promise<One2manyItem[]> => {
|
|
22
|
+
): Promise<[One2manyItem[], any]> => {
|
|
17
23
|
const {
|
|
18
24
|
items,
|
|
19
25
|
model,
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
formView,
|
|
27
|
+
treeView,
|
|
22
28
|
context,
|
|
23
29
|
currentView = {},
|
|
24
30
|
} = options;
|
|
@@ -33,16 +39,34 @@ const readObjectValues = async (
|
|
|
33
39
|
.map((item) => item.id) as number[];
|
|
34
40
|
|
|
35
41
|
const fieldsToRetrieve: { [key: string]: any } = {
|
|
36
|
-
form:
|
|
37
|
-
tree:
|
|
42
|
+
form: formView.fields,
|
|
43
|
+
tree: treeView.fields,
|
|
38
44
|
};
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
let values = [],
|
|
47
|
+
evaluatedColorsForTree;
|
|
48
|
+
|
|
49
|
+
if (currentView === "tree" && treeView?.arch) {
|
|
50
|
+
const results = await ConnectionProvider.getHandler().readEvalUiObjects({
|
|
51
|
+
model,
|
|
52
|
+
ids: idsToFetch,
|
|
53
|
+
arch: treeView?.arch!,
|
|
54
|
+
fields: treeView!.fields,
|
|
55
|
+
context,
|
|
56
|
+
attrs: {
|
|
57
|
+
colors: getTree(treeView as TreeView)?.colors,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
values = results[0];
|
|
61
|
+
evaluatedColorsForTree = getColorMap(results[1]);
|
|
62
|
+
} else {
|
|
63
|
+
values = await ConnectionProvider.getHandler().readObjects({
|
|
64
|
+
model,
|
|
65
|
+
ids: idsToFetch,
|
|
66
|
+
fields: fieldsToRetrieve[currentView as string],
|
|
67
|
+
context,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
46
70
|
|
|
47
71
|
const filteredValues = values.map((result: any) => {
|
|
48
72
|
const resultFormValues: any = {};
|
|
@@ -75,7 +99,10 @@ const readObjectValues = async (
|
|
|
75
99
|
return itemWithFetchedValues;
|
|
76
100
|
});
|
|
77
101
|
|
|
78
|
-
return
|
|
102
|
+
return [
|
|
103
|
+
originalItemsWithFetchedValues.concat(temporalItems),
|
|
104
|
+
evaluatedColorsForTree,
|
|
105
|
+
];
|
|
79
106
|
};
|
|
80
107
|
|
|
81
108
|
type RemoveItemOptions = {
|
|
@@ -31,7 +31,7 @@ import { One2manyTopBar } from "@/widgets/base/one2many/One2manyTopBar";
|
|
|
31
31
|
import { readObjectValues, getNextPendingId } from "@/helpers/one2manyHelper";
|
|
32
32
|
import { SearchModal } from "@/widgets/modals/SearchModal";
|
|
33
33
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
34
|
-
import { sortResults } from "@/helpers/treeHelper";
|
|
34
|
+
import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
|
|
35
35
|
import { transformPlainMany2Ones } from "@/helpers/formHelper";
|
|
36
36
|
|
|
37
37
|
type One2manyValue = {
|
|
@@ -101,6 +101,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
101
101
|
const transformedDomain = useRef<any[]>([]);
|
|
102
102
|
const [sorter, setSorter] = useState<any>();
|
|
103
103
|
const originalSortItemIds = useRef<number[]>();
|
|
104
|
+
const [colorsForResults, setColorsForResults] = useState<any>(undefined);
|
|
104
105
|
|
|
105
106
|
const {
|
|
106
107
|
readOnly,
|
|
@@ -161,9 +162,14 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
161
162
|
setError(undefined);
|
|
162
163
|
|
|
163
164
|
try {
|
|
164
|
-
const itemsWithValues = await readObjectValues({
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
const [itemsWithValues, evaluatedColorsForTree] = await readObjectValues({
|
|
166
|
+
treeView: {
|
|
167
|
+
arch: views.get("tree")?.arch,
|
|
168
|
+
fields: views.get("tree")?.fields,
|
|
169
|
+
},
|
|
170
|
+
formView: {
|
|
171
|
+
fields: views.get("form")?.fields || {},
|
|
172
|
+
},
|
|
167
173
|
model: relation,
|
|
168
174
|
items,
|
|
169
175
|
context: { ...getContext?.(), ...context },
|
|
@@ -174,6 +180,10 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
174
180
|
originalSortItemIds.current = itemsWithValues.map((item) => item.id!);
|
|
175
181
|
}
|
|
176
182
|
|
|
183
|
+
if ((currentView || mode) === "tree" && evaluatedColorsForTree) {
|
|
184
|
+
setColorsForResults(evaluatedColorsForTree);
|
|
185
|
+
}
|
|
186
|
+
|
|
177
187
|
triggerChange(itemsWithValues);
|
|
178
188
|
return itemsWithValues;
|
|
179
189
|
} catch (err) {
|
|
@@ -618,6 +628,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
618
628
|
sorter={sorter}
|
|
619
629
|
onChangeSort={setSorter}
|
|
620
630
|
context={{ ...getContext?.(), ...context }}
|
|
631
|
+
colorsForResults={colorsForResults}
|
|
621
632
|
/>
|
|
622
633
|
);
|
|
623
634
|
}
|
|
@@ -105,9 +105,14 @@ export const TimelineInput = (props: TimelineInputProps) => {
|
|
|
105
105
|
setError(undefined);
|
|
106
106
|
|
|
107
107
|
try {
|
|
108
|
-
const itemsWithValues = await readObjectValues({
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const [itemsWithValues] = await readObjectValues({
|
|
109
|
+
treeView: {
|
|
110
|
+
fields: views.get("tree").fields,
|
|
111
|
+
arch: views.get("tree").arch
|
|
112
|
+
},
|
|
113
|
+
formView: {
|
|
114
|
+
fields: views.get("form").fields,
|
|
115
|
+
},
|
|
111
116
|
model: relation,
|
|
112
117
|
items,
|
|
113
118
|
context: { ...getContext?.(), ...context },
|
|
@@ -105,14 +105,19 @@ function Dashboard(props: DashboardProps, ref: any) {
|
|
|
105
105
|
})) as FormView
|
|
106
106
|
).fields;
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const [results] = await readObjectValues({
|
|
109
|
+
treeView: {
|
|
110
|
+
fields: itemsFields.current,
|
|
111
|
+
},
|
|
112
|
+
formView: {
|
|
113
|
+
fields: itemsFields.current,
|
|
114
|
+
},
|
|
111
115
|
model,
|
|
112
116
|
items,
|
|
113
117
|
context,
|
|
114
118
|
currentView: "form",
|
|
115
119
|
});
|
|
120
|
+
return results;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
async function fetchValues(view: FormView) {
|