@overmap-ai/core 1.0.38-component-fields.7 → 1.0.38-component-fields.9

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.
@@ -3265,6 +3265,28 @@ var __publicField = (obj, key, value) => {
3265
3265
  }
3266
3266
  )
3267
3267
  );
3268
+ const selectLatestRevisionsFromComponentTypeIds = restructureCreateSelectorWithArgs(
3269
+ toolkit.createSelector(
3270
+ [
3271
+ selectUserFormMapping,
3272
+ selectRevisionMapping,
3273
+ (_state, componentTypeIds) => componentTypeIds
3274
+ ],
3275
+ (userForms, revisions, componentTypeIds) => {
3276
+ const componentTypeIdsSet = new Set(componentTypeIds);
3277
+ const ret = {};
3278
+ for (const form of Object.values(userForms)) {
3279
+ if (form.component_type && componentTypeIdsSet.has(form.component_type)) {
3280
+ if (!ret[form.component_type]) {
3281
+ ret[form.component_type] = [];
3282
+ }
3283
+ ret[form.component_type].push(_selectLatestFormRevision(revisions, form.offline_id));
3284
+ }
3285
+ }
3286
+ return ret;
3287
+ }
3288
+ )
3289
+ );
3268
3290
  const selectLatestRevisionByFormId = toolkit.createSelector([selectRevisionMapping], (revisions) => {
3269
3291
  const latestRevisions = {};
3270
3292
  for (const revision of Object.values(revisions)) {
@@ -11211,7 +11233,7 @@ var __publicField = (obj, key, value) => {
11211
11233
  FieldWithActions.displayName = "FieldWithActions";
11212
11234
  const FieldSectionWithActions = React.memo((props) => {
11213
11235
  var _a2;
11214
- const { field, index: sectionIndex, dropState } = props;
11236
+ const { field, index: sectionIndex, dropState, fieldsOnly } = props;
11215
11237
  const isDropDisabled = (_a2 = dropState[field.identifier]) == null ? void 0 : _a2.disabled;
11216
11238
  const { setFieldValue, values } = formik.useFormikContext();
11217
11239
  const alertDialog = blocks.useAlertDialog();
@@ -11351,7 +11373,7 @@ var __publicField = (obj, key, value) => {
11351
11373
  mb: "4",
11352
11374
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { gap: "3", justify: "between", align: "center", children: [
11353
11375
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", grow: "1", children: [
11354
- /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { ...editSectionProps }),
11376
+ !fieldsOnly && /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { ...editSectionProps }),
11355
11377
  /* @__PURE__ */ jsxRuntime.jsx(
11356
11378
  dnd.Droppable,
11357
11379
  {
@@ -11395,7 +11417,7 @@ var __publicField = (obj, key, value) => {
11395
11417
  }
11396
11418
  )
11397
11419
  ] }),
11398
- /* @__PURE__ */ jsxRuntime.jsx(
11420
+ !fieldsOnly && /* @__PURE__ */ jsxRuntime.jsx(
11399
11421
  FieldActions,
11400
11422
  {
11401
11423
  index: sectionIndex,
@@ -11472,7 +11494,8 @@ var __publicField = (obj, key, value) => {
11472
11494
  return [section, i];
11473
11495
  }
11474
11496
  };
11475
- const FieldsEditor = React.memo(() => {
11497
+ const FieldsEditor = React.memo((props) => {
11498
+ const { fieldsOnly } = props;
11476
11499
  const { values, setFieldValue } = formik.useFormikContext();
11477
11500
  const [dropState, dispatch] = React.useReducer(reducer, values.fields, initializer);
11478
11501
  const { reorderSection, reorderField } = useFieldReordering();
@@ -11525,8 +11548,16 @@ var __publicField = (obj, key, value) => {
11525
11548
  gap: "0",
11526
11549
  children: [
11527
11550
  values.fields.map((field, index2) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
11528
- /* @__PURE__ */ jsxRuntime.jsx(FieldSectionWithActions, { field, index: index2, dropState }),
11529
- /* @__PURE__ */ jsxRuntime.jsxs(
11551
+ /* @__PURE__ */ jsxRuntime.jsx(
11552
+ FieldSectionWithActions,
11553
+ {
11554
+ field,
11555
+ index: index2,
11556
+ dropState,
11557
+ fieldsOnly
11558
+ }
11559
+ ),
11560
+ !fieldsOnly && /* @__PURE__ */ jsxRuntime.jsxs(
11530
11561
  blocks.Button,
11531
11562
  {
11532
11563
  className: styles$1.addSectionButton,
@@ -11554,7 +11585,16 @@ var __publicField = (obj, key, value) => {
11554
11585
  };
11555
11586
  const FormBuilder = React.memo(
11556
11587
  React.forwardRef((props, ref) => {
11557
- const { onCancel, onSave, revision, initialTitle, showExplainerText = true, showSectionsOnly = false } = props;
11588
+ const {
11589
+ onCancel,
11590
+ onSave,
11591
+ revision,
11592
+ initialTitle,
11593
+ showExplainerText = true,
11594
+ showFormTitle = true,
11595
+ fieldsOnly = false,
11596
+ showTabs = true
11597
+ } = props;
11558
11598
  const { showError } = blocks.useToast();
11559
11599
  const validate = React.useCallback(
11560
11600
  (form) => {
@@ -11617,7 +11657,7 @@ var __publicField = (obj, key, value) => {
11617
11657
  });
11618
11658
  const previewSchema = React.useMemo(() => formRevisionToSchema(formik$1.values), [formik$1.values]);
11619
11659
  return /* @__PURE__ */ jsxRuntime.jsx(Tabs.Root, { ref, defaultValue: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
11620
- /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: styles$7.tabsList, children: [
11660
+ showTabs && /* @__PURE__ */ jsxRuntime.jsxs(Tabs.List, { className: styles$7.tabsList, children: [
11621
11661
  /* @__PURE__ */ jsxRuntime.jsx(Tabs.Trigger, { className: styles$7.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "2", children: [
11622
11662
  /* @__PURE__ */ jsxRuntime.jsx(Pencil1Icon, {}),
11623
11663
  "Edit"
@@ -11638,7 +11678,7 @@ var __publicField = (obj, key, value) => {
11638
11678
  ] }),
11639
11679
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { asChild: true, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ jsxRuntime.jsxs("form", { id: formId, onSubmit: formik$1.handleSubmit, children: [
11640
11680
  /* @__PURE__ */ jsxRuntime.jsxs(formik.FormikProvider, { value: formik$1, children: [
11641
- !showSectionsOnly && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11681
+ showFormTitle && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11642
11682
  /* @__PURE__ */ jsxRuntime.jsx(
11643
11683
  PatchField,
11644
11684
  {
@@ -11684,7 +11724,7 @@ var __publicField = (obj, key, value) => {
11684
11724
  }
11685
11725
  )
11686
11726
  ] }),
11687
- /* @__PURE__ */ jsxRuntime.jsx(FieldsEditor, {}),
11727
+ /* @__PURE__ */ jsxRuntime.jsx(FieldsEditor, { fieldsOnly }),
11688
11728
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { severity: "danger", size: "1", children: typeof formik$1.errors.fields === "string" && formik$1.errors.fields })
11689
11729
  ] }),
11690
11730
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { className: styles$7.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
@@ -11693,7 +11733,7 @@ var __publicField = (obj, key, value) => {
11693
11733
  ] })
11694
11734
  ] }) })
11695
11735
  ] }),
11696
- /* @__PURE__ */ jsxRuntime.jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsxRuntime.jsx(FormRenderer, { schema: previewSchema, onSubmit: previewSubmit, hideTitle: showSectionsOnly }) })
11736
+ /* @__PURE__ */ jsxRuntime.jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsxRuntime.jsx(FormRenderer, { schema: previewSchema, onSubmit: previewSubmit, hideTitle: !showFormTitle }) })
11697
11737
  ] }) });
11698
11738
  })
11699
11739
  );
@@ -12058,6 +12098,7 @@ var __publicField = (obj, key, value) => {
12058
12098
  exports2.selectLatestRetryTime = selectLatestRetryTime;
12059
12099
  exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
12060
12100
  exports2.selectLatestRevisionsForComponentTypeForms = selectLatestRevisionsForComponentTypeForms;
12101
+ exports2.selectLatestRevisionsFromComponentTypeIds = selectLatestRevisionsFromComponentTypeIds;
12061
12102
  exports2.selectMainWorkspace = selectMainWorkspace;
12062
12103
  exports2.selectMapStyle = selectMapStyle;
12063
12104
  exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;