@gisce/react-ooui 1.1.35-rc.1 → 1.1.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/react-ooui",
3
- "version": "1.1.35-rc.1",
3
+ "version": "1.1.35",
4
4
  "files": [
5
5
  "dist",
6
6
  "src",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ant-design/plots": "^1.0.9",
39
- "@gisce/ooui": "^0.17.14-rc.0",
39
+ "@gisce/ooui": "^0.17.13",
40
40
  "@gisce/react-formiga-table": "^0.5.0",
41
41
  "@monaco-editor/react": "^4.4.5",
42
42
  "@tabler/icons-react": "^2.11.0",
@@ -344,9 +344,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
344
344
  return;
345
345
  }
346
346
 
347
- const result = await saveNewDocumentIfNeeded({
347
+ const result = await saveDocument({
348
348
  onFormSave,
349
- currentId,
350
349
  });
351
350
 
352
351
  if (!result.succeed) {
@@ -365,9 +364,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
365
364
  if (!report) {
366
365
  return;
367
366
  }
368
- const result = await saveNewDocumentIfNeeded({
367
+ const result = await saveDocument({
369
368
  onFormSave,
370
- currentId,
371
369
  });
372
370
 
373
371
  if (!result.succeed) {
@@ -393,9 +391,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
393
391
  return;
394
392
  }
395
393
 
396
- const result = await saveNewDocumentIfNeeded({
394
+ const result = await saveDocument({
397
395
  onFormSave,
398
- currentId,
399
396
  });
400
397
 
401
398
  if (!result.succeed) {
@@ -415,9 +412,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
415
412
  disabled={mustDisableButtons}
416
413
  attachments={attachments}
417
414
  onAddNewAttachment={async () => {
418
- const result = await saveNewDocumentIfNeeded({
415
+ const result = await saveDocument({
419
416
  onFormSave,
420
- currentId,
421
417
  });
422
418
 
423
419
  if (!result.succeed) {
@@ -439,9 +435,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
439
435
  });
440
436
  }}
441
437
  onListAllAttachments={async () => {
442
- const result = await saveNewDocumentIfNeeded({
438
+ const result = await saveDocument({
443
439
  onFormSave,
444
- currentId,
445
440
  });
446
441
 
447
442
  if (!result.succeed) {
@@ -460,9 +455,8 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
460
455
  });
461
456
  }}
462
457
  onViewAttachmentDetails={async (attachment: Attachment) => {
463
- const result = await saveNewDocumentIfNeeded({
458
+ const result = await saveDocument({
464
459
  onFormSave,
465
- currentId,
466
460
  });
467
461
 
468
462
  if (!result.succeed) {
@@ -484,18 +478,12 @@ function separator() {
484
478
  return <div className="inline-block w-2" />;
485
479
  }
486
480
 
487
- async function saveNewDocumentIfNeeded({
481
+ async function saveDocument({
488
482
  onFormSave,
489
- currentId,
490
483
  }: {
491
484
  onFormSave?: () => Promise<{ succeed: boolean; id: number }>;
492
- currentId: number | undefined;
493
485
  }): Promise<{ succeed: boolean; currentId?: number }> {
494
- if (currentId !== undefined) {
495
- return { succeed: true, currentId: currentId };
496
- }
497
486
  const result = await onFormSave?.();
498
-
499
487
  if (result?.succeed) {
500
488
  return { succeed: true, currentId: result.id };
501
489
  } else {