@overmap-ai/core 1.0.38-component-fields.23 → 1.0.38-component-fields.25

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.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ISchema } from "../../fields";
3
3
  import { Form } from "../../typings";
4
+ import { ButtonProps } from "@overmap-ai/blocks/dist/Buttons/typings";
4
5
  interface FormRendererProps {
5
6
  /** The schema of the form the render */
6
7
  schema: ISchema;
@@ -24,6 +25,7 @@ interface FormRendererProps {
24
25
  */
25
26
  hideTitle?: boolean;
26
27
  className?: string;
28
+ buttonProps?: ButtonProps;
27
29
  }
28
30
  export declare const FormRenderer: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<FormRendererProps & import("react").RefAttributes<HTMLDivElement>>>;
29
31
  export {};
@@ -5763,10 +5763,12 @@ class UserFormSubmissionService extends BaseApiService {
5763
5763
  blocks: [payload.offline_id]
5764
5764
  });
5765
5765
  const attachFilesPromises = this.getAttachFilesPromises(files, payload);
5766
+ const now = (/* @__PURE__ */ new Date()).toISOString();
5766
5767
  const fullOfflineResult = {
5767
5768
  ...payload,
5768
5769
  created_by: state.userReducer.currentUser.id,
5769
- created_at: (/* @__PURE__ */ new Date()).toISOString()
5770
+ created_at: now,
5771
+ updated_at: now
5770
5772
  };
5771
5773
  const offlineResultWithoutFiles = {
5772
5774
  ...fullOfflineResult,
@@ -5789,16 +5791,18 @@ class UserFormSubmissionService extends BaseApiService {
5789
5791
  throw new Error("Expected payloadWithoutFiles to have created_by and created_at fields.");
5790
5792
  }
5791
5793
  const attachFilesPromises = this.getAttachFilesPromises(files, submission);
5792
- store.dispatch(updateOrCreateUserFormSubmission(payloadWithoutFiles));
5794
+ const fullResult = {
5795
+ ...payloadWithoutFiles,
5796
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
5797
+ };
5798
+ store.dispatch(updateOrCreateUserFormSubmission(fullResult));
5793
5799
  const promise = this.enqueueRequest({
5794
5800
  description: "Patch form submission",
5795
5801
  method: HttpMethod.PATCH,
5796
5802
  url: `/forms/submissions/${submission.offline_id}/`,
5797
- payload: payloadWithoutFiles,
5798
- blockers: [payloadWithoutFiles.issue, payloadWithoutFiles.component].filter(
5799
- (x) => x !== void 0
5800
- ),
5801
- blocks: [payloadWithoutFiles.offline_id]
5803
+ payload: fullResult,
5804
+ blockers: [fullResult.issue, fullResult.component].filter((x) => x !== void 0),
5805
+ blocks: [fullResult.offline_id]
5802
5806
  });
5803
5807
  return Promise.all([promise, ...attachFilesPromises]).then(() => promise);
5804
5808
  }
@@ -10345,7 +10349,8 @@ const FormRenderer = memo(
10345
10349
  // if the title isn't provided, hide it by default
10346
10350
  hideTitle = !schema.title,
10347
10351
  hideDescription,
10348
- className
10352
+ className,
10353
+ buttonProps
10349
10354
  } = props;
10350
10355
  const { readonly } = schema.meta;
10351
10356
  const formId2 = useMemo(() => crypto.randomUUID(), []);
@@ -10380,8 +10385,18 @@ const FormRenderer = memo(
10380
10385
  ] }) }),
10381
10386
  inputs,
10382
10387
  !readonly && /* @__PURE__ */ jsxs(Flex, { className: styles$6.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
10383
- cancelText && /* @__PURE__ */ jsx(Button, { type: "button", variant: "solid", severity: "info", onClick: onCancel, children: cancelText }),
10384
- /* @__PURE__ */ jsx(Button, { type: "submit", disabled: !formik.isValid, children: submitText })
10388
+ cancelText && /* @__PURE__ */ jsx(
10389
+ Button,
10390
+ {
10391
+ variant: "solid",
10392
+ severity: "info",
10393
+ ...buttonProps,
10394
+ type: "button",
10395
+ onClick: onCancel,
10396
+ children: cancelText
10397
+ }
10398
+ ),
10399
+ /* @__PURE__ */ jsx(Button, { ...buttonProps, type: "submit", disabled: !formik.isValid, children: submitText })
10385
10400
  ] })
10386
10401
  ] }) }) });
10387
10402
  })