@firecms/collection_editor 3.0.0-rc.1 → 3.0.0-rc.2

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/index.umd.js CHANGED
@@ -2506,7 +2506,7 @@
2506
2506
  }
2507
2507
  let t6;
2508
2508
  if ($[9] !== includeName || $[10] !== property.name) {
2509
- t6 = includeName && /* @__PURE__ */ jsxRuntime.jsx(core.ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body1", component: "span", className: "flex-grow pr-2", children: property.name ? property.name : " " }) });
2509
+ t6 = includeName && /* @__PURE__ */ jsxRuntime.jsx(core.ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", component: "span", className: "flex-grow pr-2", children: property.name ? property.name : " " }) });
2510
2510
  $[9] = includeName;
2511
2511
  $[10] = property.name;
2512
2512
  $[11] = t6;
@@ -2623,7 +2623,7 @@
2623
2623
  }
2624
2624
  let t3;
2625
2625
  if ($[5] !== propertyConfig) {
2626
- t3 = !propertyConfig && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-8 p-1 rounded-full shadow text-white bg-surface-500", children: /* @__PURE__ */ jsxRuntime.jsx(ui.FunctionsIcon, { color: "inherit", size: "medium" }) });
2626
+ t3 = !propertyConfig && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-8 flex items-center justify-center rounded-full shadow text-white bg-surface-500", children: /* @__PURE__ */ jsxRuntime.jsx(ui.FunctionsIcon, { color: "inherit", size: "small" }) });
2627
2627
  $[5] = propertyConfig;
2628
2628
  $[6] = t3;
2629
2629
  } else {
@@ -3775,7 +3775,7 @@
3775
3775
  return t25;
3776
3776
  });
3777
3777
  function StringPropertyField(t0) {
3778
- const $ = reactCompilerRuntime.c(27);
3778
+ const $ = reactCompilerRuntime.c(32);
3779
3779
  const {
3780
3780
  widgetId,
3781
3781
  disabled,
@@ -3797,7 +3797,7 @@
3797
3797
  }
3798
3798
  let t2;
3799
3799
  if ($[4] !== disabled || $[5] !== showErrors || $[6] !== widgetId) {
3800
- t2 = widgetId === "multiline" && /* @__PURE__ */ jsxRuntime.jsx(StringPropertyValidation, { disabled, length: true, lowercase: true, max: true, min: true, trim: true, uppercase: true, showErrors });
3800
+ t2 = widgetId === "user_select" && /* @__PURE__ */ jsxRuntime.jsx(StringPropertyValidation, { disabled, showErrors });
3801
3801
  $[4] = disabled;
3802
3802
  $[5] = showErrors;
3803
3803
  $[6] = widgetId;
@@ -3807,7 +3807,7 @@
3807
3807
  }
3808
3808
  let t3;
3809
3809
  if ($[8] !== disabled || $[9] !== showErrors || $[10] !== widgetId) {
3810
- t3 = widgetId === "email" && /* @__PURE__ */ jsxRuntime.jsx(StringPropertyValidation, { disabled, max: true, min: true, trim: true, showErrors });
3810
+ t3 = widgetId === "multiline" && /* @__PURE__ */ jsxRuntime.jsx(StringPropertyValidation, { disabled, length: true, lowercase: true, max: true, min: true, trim: true, uppercase: true, showErrors });
3811
3811
  $[8] = disabled;
3812
3812
  $[9] = showErrors;
3813
3813
  $[10] = widgetId;
@@ -3816,60 +3816,72 @@
3816
3816
  t3 = $[11];
3817
3817
  }
3818
3818
  let t4;
3819
- if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
3820
- t4 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsxs(ValidationPanel, { children: [
3821
- t1,
3822
- t2,
3823
- t3
3824
- ] }) });
3825
- $[12] = t1;
3826
- $[13] = t2;
3827
- $[14] = t3;
3819
+ if ($[12] !== disabled || $[13] !== showErrors || $[14] !== widgetId) {
3820
+ t4 = widgetId === "email" && /* @__PURE__ */ jsxRuntime.jsx(StringPropertyValidation, { disabled, max: true, min: true, trim: true, showErrors });
3821
+ $[12] = disabled;
3822
+ $[13] = showErrors;
3823
+ $[14] = widgetId;
3828
3824
  $[15] = t4;
3829
3825
  } else {
3830
3826
  t4 = $[15];
3831
3827
  }
3832
3828
  let t5;
3833
- if ($[16] !== setFieldValue) {
3834
- t5 = (e) => {
3835
- setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
3836
- };
3837
- $[16] = setFieldValue;
3838
- $[17] = t5;
3829
+ if ($[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4) {
3830
+ t5 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsxs(ValidationPanel, { children: [
3831
+ t1,
3832
+ t2,
3833
+ t3,
3834
+ t4
3835
+ ] }) });
3836
+ $[16] = t1;
3837
+ $[17] = t2;
3838
+ $[18] = t3;
3839
+ $[19] = t4;
3840
+ $[20] = t5;
3839
3841
  } else {
3840
- t5 = $[17];
3842
+ t5 = $[20];
3841
3843
  }
3842
3844
  let t6;
3843
- if ($[18] !== values) {
3844
- t6 = formex.getIn(values, "defaultValue") ?? "";
3845
- $[18] = values;
3846
- $[19] = t6;
3845
+ if ($[21] !== setFieldValue) {
3846
+ t6 = (e) => {
3847
+ setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
3848
+ };
3849
+ $[21] = setFieldValue;
3850
+ $[22] = t6;
3847
3851
  } else {
3848
- t6 = $[19];
3852
+ t6 = $[22];
3849
3853
  }
3850
3854
  let t7;
3851
- if ($[20] !== disabled || $[21] !== t5 || $[22] !== t6) {
3852
- t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "defaultValue", disabled, onChange: t5, label: "Default value", value: t6 }) });
3853
- $[20] = disabled;
3854
- $[21] = t5;
3855
- $[22] = t6;
3856
- $[23] = t7;
3855
+ if ($[23] !== values) {
3856
+ t7 = formex.getIn(values, "defaultValue") ?? "";
3857
+ $[23] = values;
3858
+ $[24] = t7;
3857
3859
  } else {
3858
- t7 = $[23];
3860
+ t7 = $[24];
3859
3861
  }
3860
3862
  let t8;
3861
- if ($[24] !== t4 || $[25] !== t7) {
3862
- t8 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3863
- t4,
3864
- t7
3863
+ if ($[25] !== disabled || $[26] !== t6 || $[27] !== t7) {
3864
+ t8 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "defaultValue", disabled, onChange: t6, label: "Default value", value: t7 }) });
3865
+ $[25] = disabled;
3866
+ $[26] = t6;
3867
+ $[27] = t7;
3868
+ $[28] = t8;
3869
+ } else {
3870
+ t8 = $[28];
3871
+ }
3872
+ let t9;
3873
+ if ($[29] !== t5 || $[30] !== t8) {
3874
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3875
+ t5,
3876
+ t8
3865
3877
  ] });
3866
- $[24] = t4;
3867
- $[25] = t7;
3868
- $[26] = t8;
3878
+ $[29] = t5;
3879
+ $[30] = t8;
3880
+ $[31] = t9;
3869
3881
  } else {
3870
- t8 = $[26];
3882
+ t9 = $[31];
3871
3883
  }
3872
- return t8;
3884
+ return t9;
3873
3885
  }
3874
3886
  function BooleanPropertyField(t0) {
3875
3887
  const $ = reactCompilerRuntime.c(10);
@@ -4891,7 +4903,21 @@
4891
4903
  markdown: void 0,
4892
4904
  email: void 0,
4893
4905
  url: void 0,
4894
- enumValues: void 0
4906
+ enumValues: void 0,
4907
+ userSelect: void 0
4908
+ });
4909
+ } else if (selectedWidgetId === "user_select") {
4910
+ updatedProperty = core.mergeDeep(propertyData, {
4911
+ dataType: "string",
4912
+ propertyConfig: "user_select",
4913
+ editable: propertyData.editable !== void 0 ? propertyData.editable : true,
4914
+ storage: void 0,
4915
+ multiline: void 0,
4916
+ markdown: void 0,
4917
+ email: void 0,
4918
+ url: void 0,
4919
+ enumValues: void 0,
4920
+ userSelect: true
4895
4921
  });
4896
4922
  } else if (selectedWidgetId === "multiline") {
4897
4923
  updatedProperty = core.mergeDeep(propertyData, {
@@ -4903,7 +4929,8 @@
4903
4929
  markdown: void 0,
4904
4930
  email: void 0,
4905
4931
  url: void 0,
4906
- enumValues: void 0
4932
+ enumValues: void 0,
4933
+ userSelect: void 0
4907
4934
  });
4908
4935
  } else if (selectedWidgetId === "markdown") {
4909
4936
  updatedProperty = core.mergeDeep(propertyData, {
@@ -4914,7 +4941,8 @@
4914
4941
  multiline: void 0,
4915
4942
  markdown: true,
4916
4943
  email: void 0,
4917
- url: void 0
4944
+ url: void 0,
4945
+ userSelect: void 0
4918
4946
  });
4919
4947
  } else if (selectedWidgetId === "url") {
4920
4948
  updatedProperty = core.mergeDeep(propertyData, {
@@ -4926,7 +4954,8 @@
4926
4954
  markdown: void 0,
4927
4955
  email: void 0,
4928
4956
  url: true,
4929
- enumValues: void 0
4957
+ enumValues: void 0,
4958
+ userSelect: void 0
4930
4959
  });
4931
4960
  } else if (selectedWidgetId === "email") {
4932
4961
  updatedProperty = core.mergeDeep(propertyData, {
@@ -4938,7 +4967,8 @@
4938
4967
  markdown: void 0,
4939
4968
  email: true,
4940
4969
  url: void 0,
4941
- enumValues: void 0
4970
+ enumValues: void 0,
4971
+ userSelect: void 0
4942
4972
  });
4943
4973
  } else if (selectedWidgetId === "select") {
4944
4974
  updatedProperty = core.mergeDeep(propertyData, {
@@ -4950,7 +4980,8 @@
4950
4980
  markdown: void 0,
4951
4981
  email: void 0,
4952
4982
  url: void 0,
4953
- enumValues: propertyData.enumValues ?? []
4983
+ enumValues: propertyData.enumValues ?? [],
4984
+ userSelect: void 0
4954
4985
  });
4955
4986
  } else if (selectedWidgetId === "multi_select") {
4956
4987
  updatedProperty = core.mergeDeep(propertyData, {
@@ -5217,7 +5248,7 @@
5217
5248
  }
5218
5249
  }
5219
5250
  }
5220
- const supportedFieldsIds = ["text_field", "multiline", "markdown", "url", "email", "select", "multi_select", "number_input", "number_select", "multi_number_select", "file_upload", "multi_file_upload", "reference", "reference_as_string", "multi_references", "switch", "date_time", "group", "key_value", "repeat", "block"];
5251
+ const supportedFieldsIds = ["text_field", "multiline", "markdown", "url", "email", "user_select", "select", "multi_select", "number_input", "number_select", "multi_number_select", "file_upload", "multi_file_upload", "reference", "reference_as_string", "multi_references", "switch", "date_time", "group", "key_value", "repeat", "block"];
5221
5252
  const supportedFields = Object.entries(core.DEFAULT_FIELD_CONFIGS).filter(([id]) => supportedFieldsIds.includes(id)).map(([id, config]) => ({
5222
5253
  [id]: config
5223
5254
  })).reduce((a, b) => ({
@@ -5605,7 +5636,6 @@
5605
5636
  let t7;
5606
5637
  if ($[13] !== doOnPropertyChanged || $[14] !== existingProperty) {
5607
5638
  t7 = (newPropertyWithId, controller) => {
5608
- console.debug("onSubmit", newPropertyWithId);
5609
5639
  const {
5610
5640
  id: id_0,
5611
5641
  ...property_1
@@ -6024,7 +6054,7 @@
6024
6054
  }
6025
6055
  const onWidgetSelectChanged = t9;
6026
6056
  let childComponent;
6027
- if (selectedFieldConfigId === "text_field" || selectedFieldConfigId === "multiline" || selectedFieldConfigId === "email") {
6057
+ if (selectedFieldConfigId === "text_field" || selectedFieldConfigId === "multiline" || selectedFieldConfigId === "user_select" || selectedFieldConfigId === "email") {
6028
6058
  let t102;
6029
6059
  if ($[27] !== disabled || $[28] !== selectedFieldConfigId || $[29] !== showErrors) {
6030
6060
  t102 = /* @__PURE__ */ jsxRuntime.jsx(StringPropertyField, { widgetId: selectedFieldConfigId, disabled, showErrors });
@@ -6457,6 +6487,7 @@
6457
6487
  url: "Text",
6458
6488
  email: "Text",
6459
6489
  switch: "Boolean",
6490
+ user_select: "Users",
6460
6491
  select: "Select",
6461
6492
  multi_select: "Select",
6462
6493
  number_input: "Number",
@@ -6732,7 +6763,7 @@
6732
6763
  const t4 = shouldWarnChangingDataType ? "secondary" : void 0;
6733
6764
  let t5;
6734
6765
  if ($[6] !== propertyConfig.name || $[7] !== t4) {
6735
- t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { color: t4, children: propertyConfig.name });
6766
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", color: t4, children: propertyConfig.name });
6736
6767
  $[6] = propertyConfig.name;
6737
6768
  $[7] = t4;
6738
6769
  $[8] = t5;
@@ -8984,104 +9015,106 @@
8984
9015
  return t9;
8985
9016
  }
8986
9017
  function CollectionEditorImportDataPreview(t0) {
8987
- const $ = reactCompilerRuntime.c(19);
9018
+ const $ = reactCompilerRuntime.c(20);
8988
9019
  const {
8989
9020
  importConfig,
8990
9021
  properties,
8991
9022
  propertiesOrder
8992
9023
  } = t0;
8993
9024
  const authController = core.useAuthController();
9025
+ const navigation = core.useNavigationController();
8994
9026
  const [loading, setLoading] = React.useState(false);
8995
9027
  let t1;
8996
- if ($[0] !== authController || $[1] !== importConfig || $[2] !== properties) {
9028
+ if ($[0] !== authController || $[1] !== importConfig || $[2] !== navigation || $[3] !== properties) {
8997
9029
  t1 = async function loadEntities2() {
8998
- const mappedData = importConfig.importData.map((d) => data_import.convertDataToEntity(authController, d, importConfig.idColumn, importConfig.headersMapping, properties, "TEMP_PATH", importConfig.defaultValues));
9030
+ const mappedData = importConfig.importData.map((d) => data_import.convertDataToEntity(authController, navigation, d, importConfig.idColumn, importConfig.headersMapping, properties, "TEMP_PATH", importConfig.defaultValues));
8999
9031
  importConfig.setEntities(mappedData);
9000
9032
  };
9001
9033
  $[0] = authController;
9002
9034
  $[1] = importConfig;
9003
- $[2] = properties;
9004
- $[3] = t1;
9035
+ $[2] = navigation;
9036
+ $[3] = properties;
9037
+ $[4] = t1;
9005
9038
  } else {
9006
- t1 = $[3];
9039
+ t1 = $[4];
9007
9040
  }
9008
9041
  const loadEntities = t1;
9009
9042
  let t2;
9010
- if ($[4] !== loadEntities) {
9043
+ if ($[5] !== loadEntities) {
9011
9044
  t2 = () => {
9012
9045
  loadEntities().finally(() => setLoading(false));
9013
9046
  };
9014
- $[4] = loadEntities;
9015
- $[5] = t2;
9047
+ $[5] = loadEntities;
9048
+ $[6] = t2;
9016
9049
  } else {
9017
- t2 = $[5];
9050
+ t2 = $[6];
9018
9051
  }
9019
9052
  let t3;
9020
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
9053
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
9021
9054
  t3 = [];
9022
- $[6] = t3;
9055
+ $[7] = t3;
9023
9056
  } else {
9024
- t3 = $[6];
9057
+ t3 = $[7];
9025
9058
  }
9026
9059
  React.useEffect(t2, t3);
9027
9060
  const selectionController = core.useSelectionController();
9028
9061
  if (loading) {
9029
9062
  let t42;
9030
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
9063
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
9031
9064
  t42 = /* @__PURE__ */ jsxRuntime.jsx(core.CircularProgressCenter, {});
9032
- $[7] = t42;
9065
+ $[8] = t42;
9033
9066
  } else {
9034
- t42 = $[7];
9067
+ t42 = $[8];
9035
9068
  }
9036
9069
  return t42;
9037
9070
  }
9038
9071
  let t4;
9039
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
9072
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
9040
9073
  t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9041
9074
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: "Imported data preview" }),
9042
9075
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", children: "Entities with the same id will be overwritten" })
9043
9076
  ] });
9044
- $[8] = t4;
9077
+ $[9] = t4;
9045
9078
  } else {
9046
- t4 = $[8];
9079
+ t4 = $[9];
9047
9080
  }
9048
9081
  let t5;
9049
- if ($[9] !== importConfig.entities) {
9082
+ if ($[10] !== importConfig.entities) {
9050
9083
  t5 = {
9051
9084
  data: importConfig.entities,
9052
9085
  dataLoading: false,
9053
9086
  noMoreToLoad: false
9054
9087
  };
9055
- $[9] = importConfig.entities;
9056
- $[10] = t5;
9088
+ $[10] = importConfig.entities;
9089
+ $[11] = t5;
9057
9090
  } else {
9058
- t5 = $[10];
9091
+ t5 = $[11];
9059
9092
  }
9060
9093
  let t6;
9061
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
9094
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
9062
9095
  t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12" });
9063
- $[11] = t6;
9096
+ $[12] = t6;
9064
9097
  } else {
9065
- t6 = $[11];
9098
+ t6 = $[12];
9066
9099
  }
9067
9100
  let t7;
9068
- if ($[12] !== propertiesOrder) {
9101
+ if ($[13] !== propertiesOrder) {
9069
9102
  t7 = propertiesOrder.map(_temp$2);
9070
- $[12] = propertiesOrder;
9071
- $[13] = t7;
9103
+ $[13] = propertiesOrder;
9104
+ $[14] = t7;
9072
9105
  } else {
9073
- t7 = $[13];
9106
+ t7 = $[14];
9074
9107
  }
9075
9108
  let t8;
9076
- if ($[14] !== properties || $[15] !== selectionController || $[16] !== t5 || $[17] !== t7) {
9109
+ if ($[15] !== properties || $[16] !== selectionController || $[17] !== t5 || $[18] !== t7) {
9077
9110
  t8 = /* @__PURE__ */ jsxRuntime.jsx(core.EntityCollectionTable, { title: t4, tableController: t5, endAdornment: t6, filterable: false, sortable: false, selectionController, displayedColumnIds: t7, openEntityMode: "side_panel", properties, enablePopupIcon: false });
9078
- $[14] = properties;
9079
- $[15] = selectionController;
9080
- $[16] = t5;
9081
- $[17] = t7;
9082
- $[18] = t8;
9111
+ $[15] = properties;
9112
+ $[16] = selectionController;
9113
+ $[17] = t5;
9114
+ $[18] = t7;
9115
+ $[19] = t8;
9083
9116
  } else {
9084
- t8 = $[18];
9117
+ t8 = $[19];
9085
9118
  }
9086
9119
  return t8;
9087
9120
  }
@@ -9728,7 +9761,7 @@
9728
9761
  };
9729
9762
  const doCollectionInference = collectionInference ? (collection_0) => {
9730
9763
  if (!collectionInference) return void 0;
9731
- return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? []);
9764
+ return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? [], collection_0.databaseId);
9732
9765
  } : void 0;
9733
9766
  const inferCollectionFromData = async (newCollection) => {
9734
9767
  try {