@rebasepro/admin 0.2.1 → 0.2.3

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.
Files changed (35) hide show
  1. package/dist/{CollectionEditorDialog-BXIh2AXg.js → CollectionEditorDialog-CmGXXSY9.js} +6 -182
  2. package/dist/CollectionEditorDialog-CmGXXSY9.js.map +1 -0
  3. package/dist/{CollectionsStudioView-jR8iz_ja.js → CollectionsStudioView-DcLHT5bU.js} +4 -4
  4. package/dist/{CollectionsStudioView-jR8iz_ja.js.map → CollectionsStudioView-DcLHT5bU.js.map} +1 -1
  5. package/dist/{ContentHomePage-BQZWuOFb.js → ContentHomePage-C7vFqKSe.js} +2 -2
  6. package/dist/{ContentHomePage-BQZWuOFb.js.map → ContentHomePage-C7vFqKSe.js.map} +1 -1
  7. package/dist/{ExportCollectionAction-CMdiiv1L.js → ExportCollectionAction-BfN34eWX.js} +2 -2
  8. package/dist/{ExportCollectionAction-CMdiiv1L.js.map → ExportCollectionAction-BfN34eWX.js.map} +1 -1
  9. package/dist/{ImportCollectionAction-C05lE0IW.js → ImportCollectionAction-SZrInjhx.js} +2 -2
  10. package/dist/{ImportCollectionAction-C05lE0IW.js.map → ImportCollectionAction-SZrInjhx.js.map} +1 -1
  11. package/dist/{PropertyEditView-BB5xjnhZ.js → PropertyEditView-Cvryrb3B.js} +304 -326
  12. package/dist/PropertyEditView-Cvryrb3B.js.map +1 -0
  13. package/dist/{RolesView-CULIHWZ9.js → RolesView-BCb7qwWs.js} +2 -2
  14. package/dist/{RolesView-CULIHWZ9.js.map → RolesView-BCb7qwWs.js.map} +1 -1
  15. package/dist/{UsersView-D7_AtJ44.js → UsersView-Cex24r8H.js} +2 -2
  16. package/dist/{UsersView-D7_AtJ44.js.map → UsersView-Cex24r8H.js.map} +1 -1
  17. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +1 -7
  18. package/dist/collection_editor_ui.js +3 -3
  19. package/dist/{index-D5OQhv-T.js → index-DjduZG1T.js} +3 -3
  20. package/dist/index-DjduZG1T.js.map +1 -0
  21. package/dist/{index-CoSNm3e3.js → index-MKPc70-v.js} +3 -3
  22. package/dist/index-MKPc70-v.js.map +1 -0
  23. package/dist/{index-BAM9KCmM.js → index-PLIQXpTt.js} +2 -2
  24. package/dist/{index-BAM9KCmM.js.map → index-PLIQXpTt.js.map} +1 -1
  25. package/dist/index.js +4 -4
  26. package/dist/{util-DtbWD7LF.js → util-DbWax_sV.js} +95 -15
  27. package/dist/{util-DtbWD7LF.js.map → util-DbWax_sV.js.map} +1 -1
  28. package/package.json +10 -9
  29. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +1 -10
  30. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +37 -57
  31. package/src/collection_editor/validateCollectionJson.ts +88 -1
  32. package/dist/CollectionEditorDialog-BXIh2AXg.js.map +0 -1
  33. package/dist/PropertyEditView-BB5xjnhZ.js.map +0 -1
  34. package/dist/index-CoSNm3e3.js.map +0 -1
  35. package/dist/index-D5OQhv-T.js.map +0 -1
@@ -4,7 +4,7 @@ import React__default, { useEffect, useMemo, useContext, createContext, useState
4
4
  import { deepEqual } from "fast-equals";
5
5
  import { useFormex, getIn, Field, useCreateFormex, Formex } from "@rebasepro/formex";
6
6
  import { useTranslation, useSnackbarController, useCustomizationController, AIModifiedIndicator, IconForView, ConfirmationDialog } from "@rebasepro/core";
7
- import { a as ArrayContainer, J as FieldCaption, aL as getFieldConfig, $ as PropertyConfigBadge, aO as getFullIdPath, aN as getFullId, aV as idToPropertiesPath, aZ as namespaceToPropertiesOrderPath, a_ as namespaceToPropertiesPath, bh as useCollectionRegistryController, o as DEFAULT_FIELD_CONFIGS, aM as getFieldId } from "./util-DtbWD7LF.js";
7
+ import { a as ArrayContainer, J as FieldCaption, aL as getFieldConfig, $ as PropertyConfigBadge, aO as getFullIdPath, aN as getFullId, aV as idToPropertiesPath, aZ as namespaceToPropertiesOrderPath, a_ as namespaceToPropertiesPath, bh as useCollectionRegistryController, o as DEFAULT_FIELD_CONFIGS, aM as getFieldId } from "./util-DbWax_sV.js";
8
8
  import { resolveEnumValues, isPropertyBuilder } from "@rebasepro/common";
9
9
  import { RefreshCcwIcon, iconSize, Badge, IconButton, SettingsIcon, Typography, DebouncedTextField, ListIcon, Button, CircularProgress, Paper, DialogTitle, DialogContent, DialogActions, Dialog, BooleanSwitchWithLabel, Tooltip, CheckSquareIcon, ExpandablePanel, Select, SelectItem, MultiSelectItem, UploadCloudIcon, MultiSelect, cls, ErrorBoundary, FunctionSquareIcon, MinusCircleIcon, FileSearchIcon, Trash2Icon, MoreVerticalIcon, ArrowUpToLineIcon, ArrowDownToLineIcon, defaultBorderMixin, MenuItem, Menu, PlusIcon, TextField, InfoLabel, AlertTriangleIcon, Card } from "@rebasepro/ui";
10
10
  import "zod";
@@ -5575,8 +5575,22 @@ function KeyValuePropertyField(t0) {
5575
5575
  return t1;
5576
5576
  }
5577
5577
  const ON_ACTION_OPTIONS = ["cascade", "restrict", "no action", "set null", "set default"];
5578
+ function getTargetSlug(target) {
5579
+ if (!target) return "";
5580
+ if (typeof target === "string") return target;
5581
+ try {
5582
+ const resolved = target();
5583
+ if (typeof resolved === "string") return resolved;
5584
+ if (resolved && typeof resolved === "object" && "slug" in resolved && typeof resolved.slug === "string") {
5585
+ return resolved.slug;
5586
+ }
5587
+ return "";
5588
+ } catch {
5589
+ return "";
5590
+ }
5591
+ }
5578
5592
  function RelationPropertyField(t0) {
5579
- const $ = c(112);
5593
+ const $ = c(107);
5580
5594
  const {
5581
5595
  disabled,
5582
5596
  showErrors
@@ -5588,341 +5602,309 @@ function RelationPropertyField(t0) {
5588
5602
  const collectionRegistry = useCollectionRegistryController();
5589
5603
  const relationName = values.relationName ?? "";
5590
5604
  let t1;
5591
- if ($[0] !== values._relationConfig) {
5592
- t1 = values._relationConfig ?? {};
5593
- $[0] = values._relationConfig;
5605
+ if ($[0] !== values.target) {
5606
+ t1 = getTargetSlug(values.target);
5607
+ $[0] = values.target;
5594
5608
  $[1] = t1;
5595
5609
  } else {
5596
5610
  t1 = $[1];
5597
5611
  }
5598
- const relationConfig = t1;
5599
- const targetSlug = relationConfig._targetSlug ?? "";
5600
- const cardinality = relationConfig.cardinality ?? "one";
5601
- const direction = relationConfig.direction ?? "owning";
5602
- const localKey = relationConfig.localKey ?? "";
5603
- const foreignKeyOnTarget = relationConfig.foreignKeyOnTarget ?? "";
5604
- const through = relationConfig.through;
5612
+ const targetSlug = t1;
5613
+ const cardinality = values.cardinality ?? "one";
5614
+ const direction = values.direction ?? "owning";
5615
+ const localKey = values.localKey ?? "";
5616
+ const foreignKeyOnTarget = values.foreignKeyOnTarget ?? "";
5617
+ const through = values.through;
5605
5618
  const throughTable = through?.table ?? "";
5606
5619
  const throughSourceColumn = through?.sourceColumn ?? "";
5607
5620
  const throughTargetColumn = through?.targetColumn ?? "";
5608
- const onUpdate = relationConfig.onUpdate ?? "no action";
5609
- const onDelete = relationConfig.onDelete ?? "no action";
5621
+ const onUpdate = values.onUpdate ?? "no action";
5622
+ const onDelete = values.onDelete ?? "no action";
5610
5623
  const showThrough = cardinality === "many" && direction === "owning";
5611
5624
  const showLocalKey = direction === "owning" && cardinality === "one";
5612
5625
  const showForeignKey = direction === "inverse";
5613
5626
  let t2;
5614
- if ($[2] !== setFieldValue || $[3] !== values._relationConfig) {
5627
+ if ($[2] !== setFieldValue || $[3] !== values.through) {
5615
5628
  t2 = (patch) => {
5616
- const current = values._relationConfig ?? {};
5617
- setFieldValue("_relationConfig", {
5618
- ...current,
5629
+ const currentThrough = values.through ?? {
5630
+ table: "",
5631
+ sourceColumn: "",
5632
+ targetColumn: ""
5633
+ };
5634
+ setFieldValue("through", {
5635
+ ...currentThrough,
5619
5636
  ...patch
5620
5637
  });
5621
5638
  };
5622
5639
  $[2] = setFieldValue;
5623
- $[3] = values._relationConfig;
5640
+ $[3] = values.through;
5624
5641
  $[4] = t2;
5625
5642
  } else {
5626
5643
  t2 = $[4];
5627
5644
  }
5628
- const updateRelationConfig = t2;
5645
+ const updateThrough = t2;
5629
5646
  let t3;
5630
- if ($[5] !== setFieldValue || $[6] !== values._relationConfig) {
5631
- t3 = (patch_0) => {
5632
- const current_0 = values._relationConfig ?? {};
5633
- const currentThrough = current_0.through ?? {};
5634
- setFieldValue("_relationConfig", {
5635
- ...current_0,
5636
- through: {
5637
- ...currentThrough,
5638
- ...patch_0
5639
- }
5640
- });
5641
- };
5642
- $[5] = setFieldValue;
5643
- $[6] = values._relationConfig;
5644
- $[7] = t3;
5645
- } else {
5646
- t3 = $[7];
5647
- }
5648
- const updateThrough = t3;
5649
5647
  let t4;
5650
- if ($[8] !== relationName || $[9] !== setFieldValue || $[10] !== targetSlug) {
5651
- t4 = () => {
5648
+ if ($[5] !== relationName || $[6] !== setFieldValue || $[7] !== targetSlug) {
5649
+ t3 = () => {
5652
5650
  if (targetSlug && !relationName) {
5653
5651
  setFieldValue("relationName", targetSlug);
5654
5652
  }
5655
5653
  };
5656
- $[8] = relationName;
5657
- $[9] = setFieldValue;
5658
- $[10] = targetSlug;
5659
- $[11] = t4;
5654
+ t4 = [targetSlug, relationName, setFieldValue];
5655
+ $[5] = relationName;
5656
+ $[6] = setFieldValue;
5657
+ $[7] = targetSlug;
5658
+ $[8] = t3;
5659
+ $[9] = t4;
5660
5660
  } else {
5661
- t4 = $[11];
5661
+ t3 = $[8];
5662
+ t4 = $[9];
5662
5663
  }
5664
+ useEffect(t3, t4);
5665
+ collectionRegistry?.collections ?? [];
5663
5666
  let t5;
5664
- if ($[12] !== targetSlug) {
5665
- t5 = [targetSlug];
5667
+ if ($[10] !== relationName || $[11] !== setFieldValue || $[12] !== targetSlug) {
5668
+ t5 = (_, value) => {
5669
+ setFieldValue("target", value);
5670
+ if (!relationName || relationName === targetSlug) {
5671
+ setFieldValue("relationName", value);
5672
+ }
5673
+ };
5674
+ $[10] = relationName;
5675
+ $[11] = setFieldValue;
5666
5676
  $[12] = targetSlug;
5667
5677
  $[13] = t5;
5668
5678
  } else {
5669
5679
  t5 = $[13];
5670
5680
  }
5671
- useEffect(t4, t5);
5672
- collectionRegistry?.collections ?? [];
5673
- let t6;
5674
- if ($[14] !== relationName || $[15] !== setFieldValue || $[16] !== targetSlug || $[17] !== updateRelationConfig) {
5675
- t6 = (_, value) => {
5676
- updateRelationConfig({
5677
- _targetSlug: value
5678
- });
5679
- if (!relationName || relationName === targetSlug) {
5680
- setFieldValue("relationName", value);
5681
- }
5682
- };
5683
- $[14] = relationName;
5684
- $[15] = setFieldValue;
5685
- $[16] = targetSlug;
5686
- $[17] = updateRelationConfig;
5687
- $[18] = t6;
5681
+ const t6 = showErrors && !targetSlug ? "You must select a target collection" : void 0;
5682
+ let t7;
5683
+ if ($[14] !== disabled || $[15] !== t5 || $[16] !== t6 || $[17] !== targetSlug) {
5684
+ t7 = /* @__PURE__ */ jsx(CollectionsSelect, { disabled, pathPath: "target", value: targetSlug, setFieldValue: t5, error: t6 });
5685
+ $[14] = disabled;
5686
+ $[15] = t5;
5687
+ $[16] = t6;
5688
+ $[17] = targetSlug;
5689
+ $[18] = t7;
5688
5690
  } else {
5689
- t6 = $[18];
5691
+ t7 = $[18];
5690
5692
  }
5691
- const t7 = showErrors && !targetSlug ? "You must select a target collection" : void 0;
5692
- let t8;
5693
- if ($[19] !== disabled || $[20] !== t6 || $[21] !== t7 || $[22] !== targetSlug) {
5694
- t8 = /* @__PURE__ */ jsx(CollectionsSelect, { disabled, pathPath: "_relationConfig._targetSlug", value: targetSlug, setFieldValue: t6, error: t7 });
5695
- $[19] = disabled;
5696
- $[20] = t6;
5697
- $[21] = t7;
5698
- $[22] = targetSlug;
5699
- $[23] = t8;
5693
+ const t8 = showErrors && !targetSlug;
5694
+ const t9 = showErrors && !targetSlug ? "You must select a target collection" : "The collection this relation points to";
5695
+ let t10;
5696
+ if ($[19] !== t8 || $[20] !== t9) {
5697
+ t10 = /* @__PURE__ */ jsx(FieldCaption, { error: t8, children: t9 });
5698
+ $[19] = t8;
5699
+ $[20] = t9;
5700
+ $[21] = t10;
5700
5701
  } else {
5701
- t8 = $[23];
5702
+ t10 = $[21];
5702
5703
  }
5703
- const t9 = showErrors && !targetSlug;
5704
- const t10 = showErrors && !targetSlug ? "You must select a target collection" : "The collection this relation points to";
5705
5704
  let t11;
5706
- if ($[24] !== t10 || $[25] !== t9) {
5707
- t11 = /* @__PURE__ */ jsx(FieldCaption, { error: t9, children: t10 });
5708
- $[24] = t10;
5709
- $[25] = t9;
5710
- $[26] = t11;
5705
+ if ($[22] !== t10 || $[23] !== t7) {
5706
+ t11 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5707
+ t7,
5708
+ t10
5709
+ ] });
5710
+ $[22] = t10;
5711
+ $[23] = t7;
5712
+ $[24] = t11;
5711
5713
  } else {
5712
- t11 = $[26];
5714
+ t11 = $[24];
5713
5715
  }
5714
5716
  let t12;
5715
- if ($[27] !== t11 || $[28] !== t8) {
5716
- t12 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5717
- t8,
5718
- t11
5719
- ] });
5720
- $[27] = t11;
5721
- $[28] = t8;
5722
- $[29] = t12;
5717
+ if ($[25] !== setFieldValue) {
5718
+ t12 = (e) => setFieldValue("relationName", e.target.value);
5719
+ $[25] = setFieldValue;
5720
+ $[26] = t12;
5723
5721
  } else {
5724
- t12 = $[29];
5722
+ t12 = $[26];
5725
5723
  }
5726
- let t13;
5727
- if ($[30] !== setFieldValue) {
5728
- t13 = (e) => setFieldValue("relationName", e.target.value);
5729
- $[30] = setFieldValue;
5730
- $[31] = t13;
5724
+ const t13 = showErrors && !relationName;
5725
+ let t14;
5726
+ if ($[27] !== disabled || $[28] !== relationName || $[29] !== t12 || $[30] !== t13) {
5727
+ t14 = /* @__PURE__ */ jsx(TextField, { value: relationName, onChange: t12, label: "Relation name", disabled, error: t13 });
5728
+ $[27] = disabled;
5729
+ $[28] = relationName;
5730
+ $[29] = t12;
5731
+ $[30] = t13;
5732
+ $[31] = t14;
5731
5733
  } else {
5732
- t13 = $[31];
5734
+ t14 = $[31];
5733
5735
  }
5734
- const t14 = showErrors && !relationName;
5735
- let t15;
5736
- if ($[32] !== disabled || $[33] !== relationName || $[34] !== t13 || $[35] !== t14) {
5737
- t15 = /* @__PURE__ */ jsx(TextField, { value: relationName, onChange: t13, label: "Relation name", disabled, error: t14 });
5738
- $[32] = disabled;
5739
- $[33] = relationName;
5740
- $[34] = t13;
5741
- $[35] = t14;
5742
- $[36] = t15;
5736
+ const t15 = showErrors && !relationName;
5737
+ const t16 = showErrors && !relationName ? "Required" : "Identifier for this relation (used to link the property to the relation config)";
5738
+ let t17;
5739
+ if ($[32] !== t15 || $[33] !== t16) {
5740
+ t17 = /* @__PURE__ */ jsx(FieldCaption, { error: t15, children: t16 });
5741
+ $[32] = t15;
5742
+ $[33] = t16;
5743
+ $[34] = t17;
5743
5744
  } else {
5744
- t15 = $[36];
5745
+ t17 = $[34];
5745
5746
  }
5746
- const t16 = showErrors && !relationName;
5747
- const t17 = showErrors && !relationName ? "Required" : "Identifier for this relation (used to link the property to the relation config)";
5748
5747
  let t18;
5749
- if ($[37] !== t16 || $[38] !== t17) {
5750
- t18 = /* @__PURE__ */ jsx(FieldCaption, { error: t16, children: t17 });
5751
- $[37] = t16;
5752
- $[38] = t17;
5753
- $[39] = t18;
5748
+ if ($[35] !== t14 || $[36] !== t17) {
5749
+ t18 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5750
+ t14,
5751
+ t17
5752
+ ] });
5753
+ $[35] = t14;
5754
+ $[36] = t17;
5755
+ $[37] = t18;
5754
5756
  } else {
5755
- t18 = $[39];
5757
+ t18 = $[37];
5756
5758
  }
5757
5759
  let t19;
5758
- if ($[40] !== t15 || $[41] !== t18) {
5759
- t19 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5760
- t15,
5761
- t18
5762
- ] });
5763
- $[40] = t15;
5764
- $[41] = t18;
5765
- $[42] = t19;
5760
+ if ($[38] !== setFieldValue) {
5761
+ t19 = (v) => setFieldValue("cardinality", v);
5762
+ $[38] = setFieldValue;
5763
+ $[39] = t19;
5766
5764
  } else {
5767
- t19 = $[42];
5765
+ t19 = $[39];
5768
5766
  }
5769
5767
  let t20;
5770
- if ($[43] !== updateRelationConfig) {
5771
- t20 = (v) => updateRelationConfig({
5772
- cardinality: v
5773
- });
5774
- $[43] = updateRelationConfig;
5775
- $[44] = t20;
5776
- } else {
5777
- t20 = $[44];
5778
- }
5779
- let t21;
5780
- if ($[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5781
- t21 = /* @__PURE__ */ jsx(SelectItem, { value: "one", children: /* @__PURE__ */ jsxs("div", { children: [
5768
+ if ($[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5769
+ t20 = /* @__PURE__ */ jsx(SelectItem, { value: "one", children: /* @__PURE__ */ jsxs("div", { children: [
5782
5770
  /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "One (has-one)" }),
5783
5771
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "This property references a single record" })
5784
5772
  ] }) });
5785
- $[45] = t21;
5773
+ $[40] = t20;
5786
5774
  } else {
5787
- t21 = $[45];
5775
+ t20 = $[40];
5788
5776
  }
5789
- let t22;
5790
- if ($[46] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5791
- t22 = /* @__PURE__ */ jsx(SelectItem, { value: "many", children: /* @__PURE__ */ jsxs("div", { children: [
5777
+ let t21;
5778
+ if ($[41] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5779
+ t21 = /* @__PURE__ */ jsx(SelectItem, { value: "many", children: /* @__PURE__ */ jsxs("div", { children: [
5792
5780
  /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Many (has-many)" }),
5793
5781
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "This property references multiple records" })
5794
5782
  ] }) });
5795
- $[46] = t22;
5783
+ $[41] = t21;
5796
5784
  } else {
5797
- t22 = $[46];
5785
+ t21 = $[41];
5798
5786
  }
5799
- let t23;
5800
- if ($[47] !== cardinality || $[48] !== disabled || $[49] !== t20) {
5801
- t23 = /* @__PURE__ */ jsxs(Select, { value: cardinality, onValueChange: t20, label: "Cardinality", disabled, fullWidth: true, renderValue: _temp$2, children: [
5802
- t21,
5803
- t22
5787
+ let t22;
5788
+ if ($[42] !== cardinality || $[43] !== disabled || $[44] !== t19) {
5789
+ t22 = /* @__PURE__ */ jsxs(Select, { value: cardinality, onValueChange: t19, label: "Cardinality", disabled, fullWidth: true, renderValue: _temp$2, children: [
5790
+ t20,
5791
+ t21
5804
5792
  ] });
5805
- $[47] = cardinality;
5806
- $[48] = disabled;
5807
- $[49] = t20;
5808
- $[50] = t23;
5793
+ $[42] = cardinality;
5794
+ $[43] = disabled;
5795
+ $[44] = t19;
5796
+ $[45] = t22;
5809
5797
  } else {
5810
- t23 = $[50];
5798
+ t22 = $[45];
5811
5799
  }
5812
- let t24;
5813
- if ($[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5814
- t24 = /* @__PURE__ */ jsx(FieldCaption, { children: "Whether the relation returns one or multiple records" });
5815
- $[51] = t24;
5800
+ let t23;
5801
+ if ($[46] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5802
+ t23 = /* @__PURE__ */ jsx(FieldCaption, { children: "Whether the relation returns one or multiple records" });
5803
+ $[46] = t23;
5816
5804
  } else {
5817
- t24 = $[51];
5805
+ t23 = $[46];
5818
5806
  }
5819
- let t25;
5820
- if ($[52] !== t23) {
5821
- t25 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5822
- t23,
5823
- t24
5807
+ let t24;
5808
+ if ($[47] !== t22) {
5809
+ t24 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5810
+ t22,
5811
+ t23
5824
5812
  ] });
5825
- $[52] = t23;
5826
- $[53] = t25;
5813
+ $[47] = t22;
5814
+ $[48] = t24;
5827
5815
  } else {
5828
- t25 = $[53];
5816
+ t24 = $[48];
5829
5817
  }
5830
- let t26;
5831
- if ($[54] !== updateRelationConfig) {
5832
- t26 = (v_1) => updateRelationConfig({
5833
- direction: v_1
5834
- });
5835
- $[54] = updateRelationConfig;
5836
- $[55] = t26;
5818
+ let t25;
5819
+ if ($[49] !== setFieldValue) {
5820
+ t25 = (v_1) => setFieldValue("direction", v_1);
5821
+ $[49] = setFieldValue;
5822
+ $[50] = t25;
5837
5823
  } else {
5838
- t26 = $[55];
5824
+ t25 = $[50];
5839
5825
  }
5840
- let t27;
5841
- if ($[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5842
- t27 = /* @__PURE__ */ jsx(SelectItem, { value: "owning", children: /* @__PURE__ */ jsxs("div", { children: [
5826
+ let t26;
5827
+ if ($[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5828
+ t26 = /* @__PURE__ */ jsx(SelectItem, { value: "owning", children: /* @__PURE__ */ jsxs("div", { children: [
5843
5829
  /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Owning" }),
5844
5830
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "This table stores the foreign key (or owns the junction table)" })
5845
5831
  ] }) });
5846
- $[56] = t27;
5832
+ $[51] = t26;
5847
5833
  } else {
5848
- t27 = $[56];
5834
+ t26 = $[51];
5849
5835
  }
5850
- let t28;
5851
- if ($[57] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5852
- t28 = /* @__PURE__ */ jsx(SelectItem, { value: "inverse", children: /* @__PURE__ */ jsxs("div", { children: [
5836
+ let t27;
5837
+ if ($[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5838
+ t27 = /* @__PURE__ */ jsx(SelectItem, { value: "inverse", children: /* @__PURE__ */ jsxs("div", { children: [
5853
5839
  /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Inverse" }),
5854
5840
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "The target table stores the foreign key pointing back here" })
5855
5841
  ] }) });
5856
- $[57] = t28;
5842
+ $[52] = t27;
5857
5843
  } else {
5858
- t28 = $[57];
5844
+ t27 = $[52];
5859
5845
  }
5860
- let t29;
5861
- if ($[58] !== direction || $[59] !== disabled || $[60] !== t26) {
5862
- t29 = /* @__PURE__ */ jsxs(Select, { value: direction, onValueChange: t26, label: "Direction", disabled, fullWidth: true, renderValue: _temp2$1, children: [
5863
- t27,
5864
- t28
5846
+ let t28;
5847
+ if ($[53] !== direction || $[54] !== disabled || $[55] !== t25) {
5848
+ t28 = /* @__PURE__ */ jsxs(Select, { value: direction, onValueChange: t25, label: "Direction", disabled, fullWidth: true, renderValue: _temp2$1, children: [
5849
+ t26,
5850
+ t27
5865
5851
  ] });
5866
- $[58] = direction;
5867
- $[59] = disabled;
5868
- $[60] = t26;
5869
- $[61] = t29;
5852
+ $[53] = direction;
5853
+ $[54] = disabled;
5854
+ $[55] = t25;
5855
+ $[56] = t28;
5856
+ } else {
5857
+ t28 = $[56];
5858
+ }
5859
+ let t29;
5860
+ if ($[57] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5861
+ t29 = /* @__PURE__ */ jsx(FieldCaption, { children: "Which side of the relation owns the persistence" });
5862
+ $[57] = t29;
5870
5863
  } else {
5871
- t29 = $[61];
5864
+ t29 = $[57];
5872
5865
  }
5873
5866
  let t30;
5874
- if ($[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5875
- t30 = /* @__PURE__ */ jsx(FieldCaption, { children: "Which side of the relation owns the persistence" });
5876
- $[62] = t30;
5867
+ if ($[58] !== t28) {
5868
+ t30 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5869
+ t28,
5870
+ t29
5871
+ ] });
5872
+ $[58] = t28;
5873
+ $[59] = t30;
5877
5874
  } else {
5878
- t30 = $[62];
5875
+ t30 = $[59];
5879
5876
  }
5880
5877
  let t31;
5881
- if ($[63] !== t29) {
5882
- t31 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5883
- t29,
5884
- t30
5878
+ if ($[60] !== disabled || $[61] !== localKey || $[62] !== setFieldValue || $[63] !== showLocalKey) {
5879
+ t31 = showLocalKey && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5880
+ /* @__PURE__ */ jsx(TextField, { value: localKey, onChange: (e_0) => setFieldValue("localKey", e_0.target.value), label: "Local key (foreign key column on this table)", disabled, placeholder: "e.g. author_id" }),
5881
+ /* @__PURE__ */ jsx(FieldCaption, { children: "Column on this table that references the target's primary key" })
5885
5882
  ] });
5886
- $[63] = t29;
5883
+ $[60] = disabled;
5884
+ $[61] = localKey;
5885
+ $[62] = setFieldValue;
5886
+ $[63] = showLocalKey;
5887
5887
  $[64] = t31;
5888
5888
  } else {
5889
5889
  t31 = $[64];
5890
5890
  }
5891
5891
  let t32;
5892
- if ($[65] !== disabled || $[66] !== localKey || $[67] !== showLocalKey || $[68] !== updateRelationConfig) {
5893
- t32 = showLocalKey && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5894
- /* @__PURE__ */ jsx(TextField, { value: localKey, onChange: (e_0) => updateRelationConfig({
5895
- localKey: e_0.target.value
5896
- }), label: "Local key (foreign key column on this table)", disabled, placeholder: "e.g. author_id" }),
5897
- /* @__PURE__ */ jsx(FieldCaption, { children: "Column on this table that references the target's primary key" })
5892
+ if ($[65] !== disabled || $[66] !== foreignKeyOnTarget || $[67] !== setFieldValue || $[68] !== showForeignKey) {
5893
+ t32 = showForeignKey && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5894
+ /* @__PURE__ */ jsx(TextField, { value: foreignKeyOnTarget, onChange: (e_1) => setFieldValue("foreignKeyOnTarget", e_1.target.value), label: "Foreign key on target table", disabled, placeholder: "e.g. post_id" }),
5895
+ /* @__PURE__ */ jsx(FieldCaption, { children: "Column on the target table that references this table's primary key" })
5898
5896
  ] });
5899
5897
  $[65] = disabled;
5900
- $[66] = localKey;
5901
- $[67] = showLocalKey;
5902
- $[68] = updateRelationConfig;
5898
+ $[66] = foreignKeyOnTarget;
5899
+ $[67] = setFieldValue;
5900
+ $[68] = showForeignKey;
5903
5901
  $[69] = t32;
5904
5902
  } else {
5905
5903
  t32 = $[69];
5906
5904
  }
5907
5905
  let t33;
5908
- if ($[70] !== disabled || $[71] !== foreignKeyOnTarget || $[72] !== showForeignKey || $[73] !== updateRelationConfig) {
5909
- t33 = showForeignKey && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5910
- /* @__PURE__ */ jsx(TextField, { value: foreignKeyOnTarget, onChange: (e_1) => updateRelationConfig({
5911
- foreignKeyOnTarget: e_1.target.value
5912
- }), label: "Foreign key on target table", disabled, placeholder: "e.g. post_id" }),
5913
- /* @__PURE__ */ jsx(FieldCaption, { children: "Column on the target table that references this table's primary key" })
5914
- ] });
5915
- $[70] = disabled;
5916
- $[71] = foreignKeyOnTarget;
5917
- $[72] = showForeignKey;
5918
- $[73] = updateRelationConfig;
5919
- $[74] = t33;
5920
- } else {
5921
- t33 = $[74];
5922
- }
5923
- let t34;
5924
- if ($[75] !== disabled || $[76] !== showThrough || $[77] !== throughSourceColumn || $[78] !== throughTable || $[79] !== throughTargetColumn || $[80] !== updateThrough) {
5925
- t34 = showThrough && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5906
+ if ($[70] !== disabled || $[71] !== showThrough || $[72] !== throughSourceColumn || $[73] !== throughTable || $[74] !== throughTargetColumn || $[75] !== updateThrough) {
5907
+ t33 = showThrough && /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
5926
5908
  /* @__PURE__ */ jsx(Typography, { variant: "label", className: "mb-2", children: "Junction table (many-to-many)" }),
5927
5909
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
5928
5910
  /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
@@ -5945,133 +5927,129 @@ function RelationPropertyField(t0) {
5945
5927
  ] })
5946
5928
  ] })
5947
5929
  ] });
5948
- $[75] = disabled;
5949
- $[76] = showThrough;
5950
- $[77] = throughSourceColumn;
5951
- $[78] = throughTable;
5952
- $[79] = throughTargetColumn;
5953
- $[80] = updateThrough;
5954
- $[81] = t34;
5930
+ $[70] = disabled;
5931
+ $[71] = showThrough;
5932
+ $[72] = throughSourceColumn;
5933
+ $[73] = throughTable;
5934
+ $[74] = throughTargetColumn;
5935
+ $[75] = updateThrough;
5936
+ $[76] = t33;
5937
+ } else {
5938
+ t33 = $[76];
5939
+ }
5940
+ let t34;
5941
+ if ($[77] !== setFieldValue) {
5942
+ t34 = (v_3) => setFieldValue("onUpdate", v_3);
5943
+ $[77] = setFieldValue;
5944
+ $[78] = t34;
5955
5945
  } else {
5956
- t34 = $[81];
5946
+ t34 = $[78];
5957
5947
  }
5958
5948
  let t35;
5959
- if ($[82] !== updateRelationConfig) {
5960
- t35 = (v_3) => updateRelationConfig({
5961
- onUpdate: v_3
5962
- });
5963
- $[82] = updateRelationConfig;
5964
- $[83] = t35;
5949
+ if ($[79] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5950
+ t35 = ON_ACTION_OPTIONS.map(_temp4$1);
5951
+ $[79] = t35;
5965
5952
  } else {
5966
- t35 = $[83];
5953
+ t35 = $[79];
5967
5954
  }
5968
5955
  let t36;
5969
- if ($[84] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5970
- t36 = ON_ACTION_OPTIONS.map(_temp4$1);
5971
- $[84] = t36;
5956
+ if ($[80] !== disabled || $[81] !== onUpdate || $[82] !== t34) {
5957
+ t36 = /* @__PURE__ */ jsx(Select, { value: onUpdate, onValueChange: t34, label: "On update", disabled, fullWidth: true, renderValue: _temp3$1, children: t35 });
5958
+ $[80] = disabled;
5959
+ $[81] = onUpdate;
5960
+ $[82] = t34;
5961
+ $[83] = t36;
5972
5962
  } else {
5973
- t36 = $[84];
5963
+ t36 = $[83];
5974
5964
  }
5975
5965
  let t37;
5976
- if ($[85] !== disabled || $[86] !== onUpdate || $[87] !== t35) {
5977
- t37 = /* @__PURE__ */ jsx(Select, { value: onUpdate, onValueChange: t35, label: "On update", disabled, fullWidth: true, renderValue: _temp3$1, children: t36 });
5978
- $[85] = disabled;
5979
- $[86] = onUpdate;
5980
- $[87] = t35;
5981
- $[88] = t37;
5966
+ if ($[84] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5967
+ t37 = /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is updated" });
5968
+ $[84] = t37;
5982
5969
  } else {
5983
- t37 = $[88];
5970
+ t37 = $[84];
5984
5971
  }
5985
5972
  let t38;
5986
- if ($[89] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5987
- t38 = /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is updated" });
5988
- $[89] = t38;
5973
+ if ($[85] !== t36) {
5974
+ t38 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5975
+ t36,
5976
+ t37
5977
+ ] });
5978
+ $[85] = t36;
5979
+ $[86] = t38;
5989
5980
  } else {
5990
- t38 = $[89];
5981
+ t38 = $[86];
5991
5982
  }
5992
5983
  let t39;
5993
- if ($[90] !== t37) {
5994
- t39 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
5995
- t37,
5996
- t38
5997
- ] });
5998
- $[90] = t37;
5999
- $[91] = t39;
5984
+ if ($[87] !== setFieldValue) {
5985
+ t39 = (v_5) => setFieldValue("onDelete", v_5);
5986
+ $[87] = setFieldValue;
5987
+ $[88] = t39;
6000
5988
  } else {
6001
- t39 = $[91];
5989
+ t39 = $[88];
6002
5990
  }
6003
5991
  let t40;
6004
- if ($[92] !== updateRelationConfig) {
6005
- t40 = (v_5) => updateRelationConfig({
6006
- onDelete: v_5
6007
- });
6008
- $[92] = updateRelationConfig;
6009
- $[93] = t40;
5992
+ if ($[89] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
5993
+ t40 = ON_ACTION_OPTIONS.map(_temp6);
5994
+ $[89] = t40;
6010
5995
  } else {
6011
- t40 = $[93];
5996
+ t40 = $[89];
6012
5997
  }
6013
5998
  let t41;
6014
- if ($[94] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6015
- t41 = ON_ACTION_OPTIONS.map(_temp6);
6016
- $[94] = t41;
5999
+ if ($[90] !== disabled || $[91] !== onDelete || $[92] !== t39) {
6000
+ t41 = /* @__PURE__ */ jsx(Select, { value: onDelete, onValueChange: t39, label: "On delete", disabled, fullWidth: true, renderValue: _temp5, children: t40 });
6001
+ $[90] = disabled;
6002
+ $[91] = onDelete;
6003
+ $[92] = t39;
6004
+ $[93] = t41;
6017
6005
  } else {
6018
- t41 = $[94];
6006
+ t41 = $[93];
6019
6007
  }
6020
6008
  let t42;
6021
- if ($[95] !== disabled || $[96] !== onDelete || $[97] !== t40) {
6022
- t42 = /* @__PURE__ */ jsx(Select, { value: onDelete, onValueChange: t40, label: "On delete", disabled, fullWidth: true, renderValue: _temp5, children: t41 });
6023
- $[95] = disabled;
6024
- $[96] = onDelete;
6025
- $[97] = t40;
6026
- $[98] = t42;
6009
+ if ($[94] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6010
+ t42 = /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is deleted" });
6011
+ $[94] = t42;
6027
6012
  } else {
6028
- t42 = $[98];
6013
+ t42 = $[94];
6029
6014
  }
6030
6015
  let t43;
6031
- if ($[99] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6032
- t43 = /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is deleted" });
6033
- $[99] = t43;
6034
- } else {
6035
- t43 = $[99];
6036
- }
6037
- let t44;
6038
- if ($[100] !== t42) {
6039
- t44 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
6040
- t42,
6041
- t43
6016
+ if ($[95] !== t41) {
6017
+ t43 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-6", children: [
6018
+ t41,
6019
+ t42
6042
6020
  ] });
6043
- $[100] = t42;
6044
- $[101] = t44;
6021
+ $[95] = t41;
6022
+ $[96] = t43;
6045
6023
  } else {
6046
- t44 = $[101];
6024
+ t43 = $[96];
6047
6025
  }
6048
- let t45;
6049
- if ($[102] !== t12 || $[103] !== t19 || $[104] !== t25 || $[105] !== t31 || $[106] !== t32 || $[107] !== t33 || $[108] !== t34 || $[109] !== t39 || $[110] !== t44) {
6050
- t45 = /* @__PURE__ */ jsxs(Fragment, { children: [
6051
- t12,
6052
- t19,
6053
- t25,
6026
+ let t44;
6027
+ if ($[97] !== t11 || $[98] !== t18 || $[99] !== t24 || $[100] !== t30 || $[101] !== t31 || $[102] !== t32 || $[103] !== t33 || $[104] !== t38 || $[105] !== t43) {
6028
+ t44 = /* @__PURE__ */ jsxs(Fragment, { children: [
6029
+ t11,
6030
+ t18,
6031
+ t24,
6032
+ t30,
6054
6033
  t31,
6055
6034
  t32,
6056
6035
  t33,
6057
- t34,
6058
- t39,
6059
- t44
6036
+ t38,
6037
+ t43
6060
6038
  ] });
6061
- $[102] = t12;
6062
- $[103] = t19;
6063
- $[104] = t25;
6064
- $[105] = t31;
6065
- $[106] = t32;
6066
- $[107] = t33;
6067
- $[108] = t34;
6068
- $[109] = t39;
6069
- $[110] = t44;
6070
- $[111] = t45;
6071
- } else {
6072
- t45 = $[111];
6073
- }
6074
- return t45;
6039
+ $[97] = t11;
6040
+ $[98] = t18;
6041
+ $[99] = t24;
6042
+ $[100] = t30;
6043
+ $[101] = t31;
6044
+ $[102] = t32;
6045
+ $[103] = t33;
6046
+ $[104] = t38;
6047
+ $[105] = t43;
6048
+ $[106] = t44;
6049
+ } else {
6050
+ t44 = $[106];
6051
+ }
6052
+ return t44;
6075
6053
  }
6076
6054
  function _temp6(action_0) {
6077
6055
  return /* @__PURE__ */ jsx(SelectItem, { value: action_0, children: action_0 }, action_0);
@@ -8209,4 +8187,4 @@ export {
8209
8187
  supportedFields as s,
8210
8188
  updatePropertyFromWidget as u
8211
8189
  };
8212
- //# sourceMappingURL=PropertyEditView-BB5xjnhZ.js.map
8190
+ //# sourceMappingURL=PropertyEditView-Cvryrb3B.js.map