@gisce/react-ooui 1.2.0-rc.38 → 1.2.0-rc.39
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/FormActionBar.d.ts.map +1 -1
- package/dist/context/ActionViewContext.d.ts +1 -1
- package/dist/context/ActionViewContext.d.ts.map +1 -1
- package/dist/react-ooui.es.js +473 -469
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/react-ooui.umd.js +16 -16
- package/dist/react-ooui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/actionbar/FormActionBar.tsx +39 -5
- package/src/context/ActionViewContext.tsx +3 -3
package/package.json
CHANGED
|
@@ -339,10 +339,15 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
339
339
|
disabled={mustDisableButtons}
|
|
340
340
|
tooltip={t("actions")}
|
|
341
341
|
items={toolbar?.action}
|
|
342
|
-
onItemClick={(action: any) => {
|
|
342
|
+
onItemClick={async (action: any) => {
|
|
343
343
|
if (!action) {
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
+
const savedSucceed = await onFormSave?.();
|
|
347
|
+
|
|
348
|
+
if (!savedSucceed) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
346
351
|
|
|
347
352
|
runAction(action);
|
|
348
353
|
}}
|
|
@@ -352,10 +357,15 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
352
357
|
disabled={mustDisableButtons}
|
|
353
358
|
tooltip={t("reports")}
|
|
354
359
|
items={toolbar?.print}
|
|
355
|
-
onItemClick={(report: any) => {
|
|
360
|
+
onItemClick={async (report: any) => {
|
|
356
361
|
if (!report) {
|
|
357
362
|
return;
|
|
358
363
|
}
|
|
364
|
+
const savedSucceed = await onFormSave?.();
|
|
365
|
+
|
|
366
|
+
if (!savedSucceed) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
359
369
|
|
|
360
370
|
runAction({
|
|
361
371
|
...report,
|
|
@@ -373,6 +383,12 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
373
383
|
return;
|
|
374
384
|
}
|
|
375
385
|
|
|
386
|
+
const savedSucceed = await onFormSave?.();
|
|
387
|
+
|
|
388
|
+
if (!savedSucceed) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
|
|
376
392
|
openRelate({
|
|
377
393
|
relateData: relate,
|
|
378
394
|
values: (formRef.current as any).getValues(),
|
|
@@ -385,7 +401,13 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
385
401
|
<AttachmentsButton
|
|
386
402
|
disabled={mustDisableButtons}
|
|
387
403
|
attachments={attachments}
|
|
388
|
-
onAddNewAttachment={() => {
|
|
404
|
+
onAddNewAttachment={async () => {
|
|
405
|
+
const savedSucceed = await onFormSave?.();
|
|
406
|
+
|
|
407
|
+
if (!savedSucceed) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
|
|
389
411
|
const res_id = currentId as number;
|
|
390
412
|
const res_model = currentModel as string;
|
|
391
413
|
openDefaultActionForModel({
|
|
@@ -400,7 +422,13 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
400
422
|
initialViewType: "form",
|
|
401
423
|
});
|
|
402
424
|
}}
|
|
403
|
-
onListAllAttachments={() => {
|
|
425
|
+
onListAllAttachments={async () => {
|
|
426
|
+
const savedSucceed = await onFormSave?.();
|
|
427
|
+
|
|
428
|
+
if (!savedSucceed) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
|
|
404
432
|
const res_id = currentId as number;
|
|
405
433
|
const res_model = currentModel as string;
|
|
406
434
|
openDefaultActionForModel({
|
|
@@ -412,7 +440,13 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
|
|
|
412
440
|
initialViewType: "tree",
|
|
413
441
|
});
|
|
414
442
|
}}
|
|
415
|
-
onViewAttachmentDetails={(attachment: Attachment) => {
|
|
443
|
+
onViewAttachmentDetails={async (attachment: Attachment) => {
|
|
444
|
+
const savedSucceed = await onFormSave?.();
|
|
445
|
+
|
|
446
|
+
if (!savedSucceed) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
|
|
416
450
|
openDefaultActionForModel({
|
|
417
451
|
model: "ir.attachment",
|
|
418
452
|
res_id: attachment.id,
|
|
@@ -11,7 +11,7 @@ export type ActionViewContextType = {
|
|
|
11
11
|
setFormIsSaving?: (value: boolean) => void;
|
|
12
12
|
formHasChanges?: boolean;
|
|
13
13
|
setFormHasChanges?: (value: boolean) => void;
|
|
14
|
-
onFormSave?: () => void
|
|
14
|
+
onFormSave?: () => Promise<void>;
|
|
15
15
|
formRef?: any;
|
|
16
16
|
searchTreeRef?: any;
|
|
17
17
|
onNewClicked: () => void;
|
|
@@ -141,8 +141,8 @@ const ActionViewProvider = (props: ActionViewProviderProps): any => {
|
|
|
141
141
|
}
|
|
142
142
|
}, [currentView]);
|
|
143
143
|
|
|
144
|
-
const callOnFormSave = () => {
|
|
145
|
-
(formRef.current as any)?.submitForm();
|
|
144
|
+
const callOnFormSave = async () => {
|
|
145
|
+
await (formRef.current as any)?.submitForm();
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
return (
|