@gisce/react-ooui 1.2.0-rc.4 → 1.2.0-rc.5
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/TreeActionBar.d.ts.map +1 -1
- package/dist/locales/ca_ES.d.ts +2 -0
- package/dist/locales/ca_ES.d.ts.map +1 -1
- package/dist/locales/en_US.d.ts +2 -0
- package/dist/locales/en_US.d.ts.map +1 -1
- package/dist/locales/es_ES.d.ts +2 -0
- package/dist/locales/es_ES.d.ts.map +1 -1
- package/dist/react-ooui.es.js +3949 -3936
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +19 -18
- package/dist/react-ooui.umd.js.map +1 -1
- package/dist/views/ActionView.d.ts.map +1 -1
- package/dist/widgets/modals/ExportModal.d.ts +0 -1
- package/dist/widgets/modals/ExportModal.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/actionbar/TreeActionBar.tsx +70 -48
- package/src/locales/ca_ES.tsx +2 -0
- package/src/locales/en_US.tsx +2 -0
- package/src/locales/es_ES.tsx +2 -0
- package/src/views/ActionView.tsx +12 -4
- package/src/widgets/modals/ExportModal.tsx +22 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionView.d.ts","sourceRoot":"","sources":["ActionView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,OAAO,EAIL,eAAe,EAGf,QAAQ,EACT,MAAM,eAAe,CAAC;AAkBvB,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,eAAe,CAAC;IAC7B,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;;AAybF,wBAAsC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAWA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"ExportModal.d.ts","sourceRoot":"","sources":["ExportModal.tsx"],"names":[],"mappings":";AAWA,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,gBAAgB,gBAgGlD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.5",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ant-design/plots": "^1.0.9",
|
|
39
39
|
"@gisce/ooui": "^0.17.7",
|
|
40
|
-
"@gisce/react-formiga-components": "^1.0.9-rc.
|
|
40
|
+
"@gisce/react-formiga-components": "^1.0.9-rc.9",
|
|
41
41
|
"@gisce/react-formiga-table": "^0.5.0",
|
|
42
42
|
"@monaco-editor/react": "^4.4.5",
|
|
43
43
|
"@tabler/icons": "^1.96.0",
|
|
@@ -61,7 +61,6 @@ function TreeActionBar(props: Props) {
|
|
|
61
61
|
previousView,
|
|
62
62
|
results,
|
|
63
63
|
limit,
|
|
64
|
-
totalItems,
|
|
65
64
|
} = useContext(ActionViewContext) as ActionViewContextType;
|
|
66
65
|
|
|
67
66
|
const { parentContext = {}, treeExpandable, toolbar } = props;
|
|
@@ -73,6 +72,10 @@ function TreeActionBar(props: Props) {
|
|
|
73
72
|
const { processAction } = contentRootContext || {};
|
|
74
73
|
const [exportModalVisible, setExportModalVisible] = useState(false);
|
|
75
74
|
|
|
75
|
+
const hasNameSearch: boolean =
|
|
76
|
+
searchTreeNameSearch !== undefined &&
|
|
77
|
+
searchTreeNameSearch.trim().length > 0;
|
|
78
|
+
|
|
76
79
|
function tryDelete() {
|
|
77
80
|
showConfirmDialog({
|
|
78
81
|
confirmMessage: t("confirmRemove"),
|
|
@@ -239,6 +242,43 @@ function TreeActionBar(props: Props) {
|
|
|
239
242
|
</>
|
|
240
243
|
)}
|
|
241
244
|
{separator()}
|
|
245
|
+
<DropdownButton
|
|
246
|
+
icon={<ThunderboltOutlined />}
|
|
247
|
+
disabled={
|
|
248
|
+
!(selectedRowItems && selectedRowItems?.length > 0) || treeIsLoading
|
|
249
|
+
}
|
|
250
|
+
tooltip={t("actions")}
|
|
251
|
+
items={toolbar?.action}
|
|
252
|
+
onItemClick={(action: any) => {
|
|
253
|
+
if (!action) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
runAction(action);
|
|
258
|
+
}}
|
|
259
|
+
/>
|
|
260
|
+
<DropdownButton
|
|
261
|
+
icon={<PrinterOutlined />}
|
|
262
|
+
disabled={
|
|
263
|
+
!(selectedRowItems && selectedRowItems?.length > 0) || treeIsLoading
|
|
264
|
+
}
|
|
265
|
+
tooltip={t("reports")}
|
|
266
|
+
items={toolbar?.print}
|
|
267
|
+
onItemClick={(report: any) => {
|
|
268
|
+
if (!report) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
runAction({
|
|
273
|
+
...report,
|
|
274
|
+
datas: {
|
|
275
|
+
...(report.datas || {}),
|
|
276
|
+
ids: selectedRowItems!.map((item) => item.id),
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}}
|
|
280
|
+
/>
|
|
281
|
+
{separator()}
|
|
242
282
|
<DropdownButton
|
|
243
283
|
icon={
|
|
244
284
|
<Icon
|
|
@@ -246,12 +286,12 @@ function TreeActionBar(props: Props) {
|
|
|
246
286
|
<svg
|
|
247
287
|
xmlns="http://www.w3.org/2000/svg"
|
|
248
288
|
className="icon icon-tabler icon-tabler-database-export"
|
|
249
|
-
width="
|
|
250
|
-
height="
|
|
289
|
+
width="1em"
|
|
290
|
+
height="1em"
|
|
251
291
|
viewBox="0 0 24 24"
|
|
252
292
|
stroke-width="1.5"
|
|
253
|
-
stroke="#2c3e50"
|
|
254
293
|
fill="none"
|
|
294
|
+
stroke="currentColor"
|
|
255
295
|
stroke-linecap="round"
|
|
256
296
|
stroke-linejoin="round"
|
|
257
297
|
>
|
|
@@ -267,74 +307,56 @@ function TreeActionBar(props: Props) {
|
|
|
267
307
|
items={[
|
|
268
308
|
{
|
|
269
309
|
id: "print_screen",
|
|
270
|
-
name: "
|
|
310
|
+
name: t("printScreen"),
|
|
271
311
|
},
|
|
272
312
|
{
|
|
273
313
|
id: "export",
|
|
274
|
-
name: "
|
|
314
|
+
name: t("advancedExport"),
|
|
275
315
|
},
|
|
276
316
|
]}
|
|
277
|
-
onItemClick={(
|
|
278
|
-
if (
|
|
279
|
-
|
|
280
|
-
}
|
|
317
|
+
onItemClick={(itemClicked: any) => {
|
|
318
|
+
if (itemClicked.id === "print_screen") {
|
|
319
|
+
let idsToExport = selectedRowItems?.map((item) => item.id) || [];
|
|
281
320
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
321
|
+
if (idsToExport.length === 0) {
|
|
322
|
+
idsToExport = results?.map((item) => item.id) || [];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
runAction({
|
|
326
|
+
id: -1,
|
|
327
|
+
model: currentModel,
|
|
328
|
+
report_name: "printscreen.list",
|
|
329
|
+
type: "ir.actions.report.xml",
|
|
330
|
+
datas: {
|
|
331
|
+
model: currentModel,
|
|
332
|
+
ids: idsToExport,
|
|
333
|
+
},
|
|
334
|
+
});
|
|
296
335
|
return;
|
|
297
336
|
}
|
|
298
337
|
|
|
299
|
-
|
|
338
|
+
setExportModalVisible(true);
|
|
300
339
|
}}
|
|
301
|
-
/>
|
|
302
|
-
<DropdownButton
|
|
303
|
-
icon={<PrinterOutlined />}
|
|
304
340
|
disabled={
|
|
305
|
-
|
|
341
|
+
duplicatingItem || removingItem || treeIsLoading || hasNameSearch
|
|
306
342
|
}
|
|
307
|
-
tooltip={t("reports")}
|
|
308
|
-
items={toolbar?.print}
|
|
309
|
-
onItemClick={(report: any) => {
|
|
310
|
-
if (!report) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
runAction({
|
|
315
|
-
...report,
|
|
316
|
-
datas: {
|
|
317
|
-
...(report.datas || {}),
|
|
318
|
-
ids: selectedRowItems!.map((item) => item.id),
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
}}
|
|
322
343
|
/>
|
|
323
344
|
<ExportModal
|
|
324
345
|
visible={exportModalVisible}
|
|
325
346
|
locale={lang}
|
|
326
347
|
onClose={() => setExportModalVisible(false)}
|
|
327
348
|
model={currentModel!}
|
|
328
|
-
treeFields={searchTreeRef?.current?.getFields()}
|
|
329
349
|
domain={mergeParams(
|
|
330
350
|
searchTreeRef?.current?.getDomain() || [],
|
|
331
351
|
searchParams || []
|
|
332
352
|
)}
|
|
333
353
|
limit={limit}
|
|
334
|
-
totalRegisters={
|
|
354
|
+
totalRegisters={results?.length || 0}
|
|
335
355
|
selectedRegistersToExport={
|
|
336
|
-
|
|
337
|
-
|
|
356
|
+
selectedRowItems &&
|
|
357
|
+
selectedRowItems.length &&
|
|
358
|
+
selectedRowItems.length > 0
|
|
359
|
+
? selectedRowItems.length
|
|
338
360
|
: undefined
|
|
339
361
|
}
|
|
340
362
|
context={parentContext}
|
package/src/locales/ca_ES.tsx
CHANGED
package/src/locales/en_US.tsx
CHANGED
package/src/locales/es_ES.tsx
CHANGED
package/src/views/ActionView.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
29
29
|
import { GoToResourceModal } from "@/ui/GoToResourceModal";
|
|
30
30
|
import showInfo from "@/ui/InfoDialog";
|
|
31
|
+
import showErrorDialog from "@/ui/ActionErrorDialog";
|
|
31
32
|
import { LocaleContext, LocaleContextType } from "@/context/LocaleContext";
|
|
32
33
|
import { GraphActionView } from "@/views/actionViews/GraphActionView";
|
|
33
34
|
import { FormActionView } from "./actionViews/FormActionView";
|
|
@@ -211,18 +212,18 @@ function ActionView(props: Props, ref: any) {
|
|
|
211
212
|
break;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
215
|
+
let currentViewToAssign = undefined;
|
|
214
216
|
|
|
215
217
|
if (!initialView && viewDataRetrieved.find((v) => v.type === "tree")) {
|
|
216
218
|
const treeView: TreeView = viewDataRetrieved.find(
|
|
217
219
|
(v) => v.type === "tree"
|
|
218
220
|
) as TreeView;
|
|
219
|
-
|
|
221
|
+
currentViewToAssign = treeView;
|
|
220
222
|
} else if (!initialView) {
|
|
221
223
|
const formView: TreeView = viewDataRetrieved.find(
|
|
222
224
|
(v) => v.type === "form"
|
|
223
225
|
) as TreeView;
|
|
224
|
-
|
|
225
|
-
setCurrentView(formView);
|
|
226
|
+
currentViewToAssign = formView;
|
|
226
227
|
} else {
|
|
227
228
|
const view = viewDataRetrieved.find((v) => {
|
|
228
229
|
if (!initialView.id) {
|
|
@@ -231,9 +232,16 @@ function ActionView(props: Props, ref: any) {
|
|
|
231
232
|
return v.type === initialView.type && v.view_id === initialView.id;
|
|
232
233
|
}
|
|
233
234
|
});
|
|
234
|
-
|
|
235
|
+
currentViewToAssign = view;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!currentViewToAssign) {
|
|
239
|
+
showErrorDialog(
|
|
240
|
+
"Error determining the first view to show.\nPlease, make sure the view ids on the fields_view_get responses are the same as the ones defined in the action"
|
|
241
|
+
);
|
|
235
242
|
}
|
|
236
243
|
|
|
244
|
+
setCurrentView(currentViewToAssign);
|
|
237
245
|
setAvailableViews(viewDataRetrieved);
|
|
238
246
|
setIsLoading(false);
|
|
239
247
|
};
|
|
@@ -18,7 +18,6 @@ export type ExportModalProps = {
|
|
|
18
18
|
model: string;
|
|
19
19
|
domain: any[];
|
|
20
20
|
limit?: number;
|
|
21
|
-
treeFields?: any;
|
|
22
21
|
context?: any;
|
|
23
22
|
};
|
|
24
23
|
|
|
@@ -29,7 +28,6 @@ export const ExportModal = (props: ExportModalProps) => {
|
|
|
29
28
|
onClose,
|
|
30
29
|
model,
|
|
31
30
|
context,
|
|
32
|
-
treeFields,
|
|
33
31
|
selectedRegistersToExport,
|
|
34
32
|
totalRegisters,
|
|
35
33
|
domain,
|
|
@@ -77,13 +75,18 @@ export const ExportModal = (props: ExportModalProps) => {
|
|
|
77
75
|
async ({ key, title }: any) => {
|
|
78
76
|
let fieldDefinition;
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
const sanitizedKey =
|
|
79
|
+
key.split("/")[key.split("/").length - 1] === "id"
|
|
80
|
+
? key.split("/").slice(0, -1).join("/")
|
|
81
|
+
: key;
|
|
82
|
+
|
|
83
|
+
if (sanitizedKey.indexOf("/") === -1) {
|
|
81
84
|
fieldDefinition = fields.current["/"];
|
|
82
85
|
} else {
|
|
83
|
-
fieldDefinition = fields.current[getParentKey(
|
|
86
|
+
fieldDefinition = fields.current[getParentKey(sanitizedKey)];
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
const optsForField = fieldDefinition[getChildKey(
|
|
89
|
+
const optsForField = fieldDefinition[getChildKey(sanitizedKey)];
|
|
87
90
|
const relation = optsForField.relation;
|
|
88
91
|
const viewData = await ConnectionProvider.getHandler().getFields({
|
|
89
92
|
model: relation,
|
|
@@ -91,12 +94,12 @@ export const ExportModal = (props: ExportModalProps) => {
|
|
|
91
94
|
fields: [],
|
|
92
95
|
});
|
|
93
96
|
|
|
94
|
-
fields.current[
|
|
97
|
+
fields.current[sanitizedKey] = viewData;
|
|
95
98
|
|
|
96
99
|
return convertToExportField({
|
|
97
100
|
fields: viewData,
|
|
98
101
|
parentTitle: title,
|
|
99
|
-
parentKey:
|
|
102
|
+
parentKey: sanitizedKey,
|
|
100
103
|
});
|
|
101
104
|
},
|
|
102
105
|
[fields, model, context]
|
|
@@ -112,7 +115,6 @@ export const ExportModal = (props: ExportModalProps) => {
|
|
|
112
115
|
totalRegisters={totalRegisters}
|
|
113
116
|
onGetFieldChilds={onGetFieldChilds}
|
|
114
117
|
onGetFields={onGetFields}
|
|
115
|
-
selectedKeys={treeFields ? Object.keys(treeFields) : undefined}
|
|
116
118
|
/>
|
|
117
119
|
);
|
|
118
120
|
};
|
|
@@ -130,13 +132,24 @@ const convertToExportField = ({
|
|
|
130
132
|
|
|
131
133
|
for (const key of Object.keys(fields)) {
|
|
132
134
|
const valuesForField = fields[key];
|
|
135
|
+
|
|
136
|
+
if (valuesForField.relation && valuesForField.is_function === true) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
|
|
133
140
|
const relationField =
|
|
134
141
|
valuesForField.type === "many2one" ||
|
|
135
142
|
valuesForField.type === "one2many" ||
|
|
136
143
|
valuesForField.type === "many2many";
|
|
137
144
|
|
|
145
|
+
let newKey = `${parentKey ? parentKey + "/" : ""}${key}`;
|
|
146
|
+
|
|
147
|
+
if (relationField) {
|
|
148
|
+
newKey += "/id";
|
|
149
|
+
}
|
|
150
|
+
|
|
138
151
|
exportFields.push({
|
|
139
|
-
key:
|
|
152
|
+
key: newKey,
|
|
140
153
|
title: `${parentTitle ? parentTitle + "/" : ""}${valuesForField.string}`,
|
|
141
154
|
tooltip: valuesForField.help,
|
|
142
155
|
required: valuesForField.required,
|