@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.es.js CHANGED
@@ -2502,7 +2502,7 @@ function PropertyFieldPreview(t0) {
2502
2502
  }
2503
2503
  let t6;
2504
2504
  if ($[9] !== includeName || $[10] !== property.name) {
2505
- t6 = includeName && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Typography, { variant: "body1", component: "span", className: "flex-grow pr-2", children: property.name ? property.name : " " }) });
2505
+ t6 = includeName && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Typography, { variant: "label", component: "span", className: "flex-grow pr-2", children: property.name ? property.name : " " }) });
2506
2506
  $[9] = includeName;
2507
2507
  $[10] = property.name;
2508
2508
  $[11] = t6;
@@ -2619,7 +2619,7 @@ function NonEditablePropertyPreview(t0) {
2619
2619
  }
2620
2620
  let t3;
2621
2621
  if ($[5] !== propertyConfig) {
2622
- t3 = !propertyConfig && /* @__PURE__ */ jsx("div", { className: "h-8 w-8 p-1 rounded-full shadow text-white bg-surface-500", children: /* @__PURE__ */ jsx(FunctionsIcon, { color: "inherit", size: "medium" }) });
2622
+ t3 = !propertyConfig && /* @__PURE__ */ jsx("div", { className: "h-8 w-8 flex items-center justify-center rounded-full shadow text-white bg-surface-500", children: /* @__PURE__ */ jsx(FunctionsIcon, { color: "inherit", size: "small" }) });
2623
2623
  $[5] = propertyConfig;
2624
2624
  $[6] = t3;
2625
2625
  } else {
@@ -3771,7 +3771,7 @@ const CommonPropertyFields = React__default.forwardRef(function CommonPropertyFi
3771
3771
  return t25;
3772
3772
  });
3773
3773
  function StringPropertyField(t0) {
3774
- const $ = c(27);
3774
+ const $ = c(32);
3775
3775
  const {
3776
3776
  widgetId,
3777
3777
  disabled,
@@ -3793,7 +3793,7 @@ function StringPropertyField(t0) {
3793
3793
  }
3794
3794
  let t2;
3795
3795
  if ($[4] !== disabled || $[5] !== showErrors || $[6] !== widgetId) {
3796
- t2 = widgetId === "multiline" && /* @__PURE__ */ jsx(StringPropertyValidation, { disabled, length: true, lowercase: true, max: true, min: true, trim: true, uppercase: true, showErrors });
3796
+ t2 = widgetId === "user_select" && /* @__PURE__ */ jsx(StringPropertyValidation, { disabled, showErrors });
3797
3797
  $[4] = disabled;
3798
3798
  $[5] = showErrors;
3799
3799
  $[6] = widgetId;
@@ -3803,7 +3803,7 @@ function StringPropertyField(t0) {
3803
3803
  }
3804
3804
  let t3;
3805
3805
  if ($[8] !== disabled || $[9] !== showErrors || $[10] !== widgetId) {
3806
- t3 = widgetId === "email" && /* @__PURE__ */ jsx(StringPropertyValidation, { disabled, max: true, min: true, trim: true, showErrors });
3806
+ t3 = widgetId === "multiline" && /* @__PURE__ */ jsx(StringPropertyValidation, { disabled, length: true, lowercase: true, max: true, min: true, trim: true, uppercase: true, showErrors });
3807
3807
  $[8] = disabled;
3808
3808
  $[9] = showErrors;
3809
3809
  $[10] = widgetId;
@@ -3812,60 +3812,72 @@ function StringPropertyField(t0) {
3812
3812
  t3 = $[11];
3813
3813
  }
3814
3814
  let t4;
3815
- if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
3816
- t4 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(ValidationPanel, { children: [
3817
- t1,
3818
- t2,
3819
- t3
3820
- ] }) });
3821
- $[12] = t1;
3822
- $[13] = t2;
3823
- $[14] = t3;
3815
+ if ($[12] !== disabled || $[13] !== showErrors || $[14] !== widgetId) {
3816
+ t4 = widgetId === "email" && /* @__PURE__ */ jsx(StringPropertyValidation, { disabled, max: true, min: true, trim: true, showErrors });
3817
+ $[12] = disabled;
3818
+ $[13] = showErrors;
3819
+ $[14] = widgetId;
3824
3820
  $[15] = t4;
3825
3821
  } else {
3826
3822
  t4 = $[15];
3827
3823
  }
3828
3824
  let t5;
3829
- if ($[16] !== setFieldValue) {
3830
- t5 = (e) => {
3831
- setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
3832
- };
3833
- $[16] = setFieldValue;
3834
- $[17] = t5;
3825
+ if ($[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4) {
3826
+ t5 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(ValidationPanel, { children: [
3827
+ t1,
3828
+ t2,
3829
+ t3,
3830
+ t4
3831
+ ] }) });
3832
+ $[16] = t1;
3833
+ $[17] = t2;
3834
+ $[18] = t3;
3835
+ $[19] = t4;
3836
+ $[20] = t5;
3835
3837
  } else {
3836
- t5 = $[17];
3838
+ t5 = $[20];
3837
3839
  }
3838
3840
  let t6;
3839
- if ($[18] !== values) {
3840
- t6 = getIn(values, "defaultValue") ?? "";
3841
- $[18] = values;
3842
- $[19] = t6;
3841
+ if ($[21] !== setFieldValue) {
3842
+ t6 = (e) => {
3843
+ setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
3844
+ };
3845
+ $[21] = setFieldValue;
3846
+ $[22] = t6;
3843
3847
  } else {
3844
- t6 = $[19];
3848
+ t6 = $[22];
3845
3849
  }
3846
3850
  let t7;
3847
- if ($[20] !== disabled || $[21] !== t5 || $[22] !== t6) {
3848
- t7 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(TextField, { name: "defaultValue", disabled, onChange: t5, label: "Default value", value: t6 }) });
3849
- $[20] = disabled;
3850
- $[21] = t5;
3851
- $[22] = t6;
3852
- $[23] = t7;
3851
+ if ($[23] !== values) {
3852
+ t7 = getIn(values, "defaultValue") ?? "";
3853
+ $[23] = values;
3854
+ $[24] = t7;
3853
3855
  } else {
3854
- t7 = $[23];
3856
+ t7 = $[24];
3855
3857
  }
3856
3858
  let t8;
3857
- if ($[24] !== t4 || $[25] !== t7) {
3858
- t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
3859
- t4,
3860
- t7
3859
+ if ($[25] !== disabled || $[26] !== t6 || $[27] !== t7) {
3860
+ t8 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(TextField, { name: "defaultValue", disabled, onChange: t6, label: "Default value", value: t7 }) });
3861
+ $[25] = disabled;
3862
+ $[26] = t6;
3863
+ $[27] = t7;
3864
+ $[28] = t8;
3865
+ } else {
3866
+ t8 = $[28];
3867
+ }
3868
+ let t9;
3869
+ if ($[29] !== t5 || $[30] !== t8) {
3870
+ t9 = /* @__PURE__ */ jsxs(Fragment, { children: [
3871
+ t5,
3872
+ t8
3861
3873
  ] });
3862
- $[24] = t4;
3863
- $[25] = t7;
3864
- $[26] = t8;
3874
+ $[29] = t5;
3875
+ $[30] = t8;
3876
+ $[31] = t9;
3865
3877
  } else {
3866
- t8 = $[26];
3878
+ t9 = $[31];
3867
3879
  }
3868
- return t8;
3880
+ return t9;
3869
3881
  }
3870
3882
  function BooleanPropertyField(t0) {
3871
3883
  const $ = c(10);
@@ -4887,7 +4899,21 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4887
4899
  markdown: void 0,
4888
4900
  email: void 0,
4889
4901
  url: void 0,
4890
- enumValues: void 0
4902
+ enumValues: void 0,
4903
+ userSelect: void 0
4904
+ });
4905
+ } else if (selectedWidgetId === "user_select") {
4906
+ updatedProperty = mergeDeep(propertyData, {
4907
+ dataType: "string",
4908
+ propertyConfig: "user_select",
4909
+ editable: propertyData.editable !== void 0 ? propertyData.editable : true,
4910
+ storage: void 0,
4911
+ multiline: void 0,
4912
+ markdown: void 0,
4913
+ email: void 0,
4914
+ url: void 0,
4915
+ enumValues: void 0,
4916
+ userSelect: true
4891
4917
  });
4892
4918
  } else if (selectedWidgetId === "multiline") {
4893
4919
  updatedProperty = mergeDeep(propertyData, {
@@ -4899,7 +4925,8 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4899
4925
  markdown: void 0,
4900
4926
  email: void 0,
4901
4927
  url: void 0,
4902
- enumValues: void 0
4928
+ enumValues: void 0,
4929
+ userSelect: void 0
4903
4930
  });
4904
4931
  } else if (selectedWidgetId === "markdown") {
4905
4932
  updatedProperty = mergeDeep(propertyData, {
@@ -4910,7 +4937,8 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4910
4937
  multiline: void 0,
4911
4938
  markdown: true,
4912
4939
  email: void 0,
4913
- url: void 0
4940
+ url: void 0,
4941
+ userSelect: void 0
4914
4942
  });
4915
4943
  } else if (selectedWidgetId === "url") {
4916
4944
  updatedProperty = mergeDeep(propertyData, {
@@ -4922,7 +4950,8 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4922
4950
  markdown: void 0,
4923
4951
  email: void 0,
4924
4952
  url: true,
4925
- enumValues: void 0
4953
+ enumValues: void 0,
4954
+ userSelect: void 0
4926
4955
  });
4927
4956
  } else if (selectedWidgetId === "email") {
4928
4957
  updatedProperty = mergeDeep(propertyData, {
@@ -4934,7 +4963,8 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4934
4963
  markdown: void 0,
4935
4964
  email: true,
4936
4965
  url: void 0,
4937
- enumValues: void 0
4966
+ enumValues: void 0,
4967
+ userSelect: void 0
4938
4968
  });
4939
4969
  } else if (selectedWidgetId === "select") {
4940
4970
  updatedProperty = mergeDeep(propertyData, {
@@ -4946,7 +4976,8 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4946
4976
  markdown: void 0,
4947
4977
  email: void 0,
4948
4978
  url: void 0,
4949
- enumValues: propertyData.enumValues ?? []
4979
+ enumValues: propertyData.enumValues ?? [],
4980
+ userSelect: void 0
4950
4981
  });
4951
4982
  } else if (selectedWidgetId === "multi_select") {
4952
4983
  updatedProperty = mergeDeep(propertyData, {
@@ -5213,7 +5244,7 @@ function _temp$7(value_0) {
5213
5244
  }
5214
5245
  }
5215
5246
  }
5216
- 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"];
5247
+ 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"];
5217
5248
  const supportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).filter(([id]) => supportedFieldsIds.includes(id)).map(([id, config]) => ({
5218
5249
  [id]: config
5219
5250
  })).reduce((a, b) => ({
@@ -5601,7 +5632,6 @@ const PropertyForm = React__default.memo(function PropertyForm2(props) {
5601
5632
  let t7;
5602
5633
  if ($[13] !== doOnPropertyChanged || $[14] !== existingProperty) {
5603
5634
  t7 = (newPropertyWithId, controller) => {
5604
- console.debug("onSubmit", newPropertyWithId);
5605
5635
  const {
5606
5636
  id: id_0,
5607
5637
  ...property_1
@@ -6020,7 +6050,7 @@ function PropertyEditFormFields(t0) {
6020
6050
  }
6021
6051
  const onWidgetSelectChanged = t9;
6022
6052
  let childComponent;
6023
- if (selectedFieldConfigId === "text_field" || selectedFieldConfigId === "multiline" || selectedFieldConfigId === "email") {
6053
+ if (selectedFieldConfigId === "text_field" || selectedFieldConfigId === "multiline" || selectedFieldConfigId === "user_select" || selectedFieldConfigId === "email") {
6024
6054
  let t102;
6025
6055
  if ($[27] !== disabled || $[28] !== selectedFieldConfigId || $[29] !== showErrors) {
6026
6056
  t102 = /* @__PURE__ */ jsx(StringPropertyField, { widgetId: selectedFieldConfigId, disabled, showErrors });
@@ -6453,6 +6483,7 @@ const WIDGET_TYPE_MAP = {
6453
6483
  url: "Text",
6454
6484
  email: "Text",
6455
6485
  switch: "Boolean",
6486
+ user_select: "Users",
6456
6487
  select: "Select",
6457
6488
  multi_select: "Select",
6458
6489
  number_input: "Number",
@@ -6728,7 +6759,7 @@ function WidgetSelectViewItem(t0) {
6728
6759
  const t4 = shouldWarnChangingDataType ? "secondary" : void 0;
6729
6760
  let t5;
6730
6761
  if ($[6] !== propertyConfig.name || $[7] !== t4) {
6731
- t5 = /* @__PURE__ */ jsx(Typography, { color: t4, children: propertyConfig.name });
6762
+ t5 = /* @__PURE__ */ jsx(Typography, { variant: "label", color: t4, children: propertyConfig.name });
6732
6763
  $[6] = propertyConfig.name;
6733
6764
  $[7] = t4;
6734
6765
  $[8] = t5;
@@ -8980,104 +9011,106 @@ function PropertySelectItem(t0) {
8980
9011
  return t9;
8981
9012
  }
8982
9013
  function CollectionEditorImportDataPreview(t0) {
8983
- const $ = c(19);
9014
+ const $ = c(20);
8984
9015
  const {
8985
9016
  importConfig,
8986
9017
  properties,
8987
9018
  propertiesOrder
8988
9019
  } = t0;
8989
9020
  const authController = useAuthController();
9021
+ const navigation = useNavigationController();
8990
9022
  const [loading, setLoading] = useState(false);
8991
9023
  let t1;
8992
- if ($[0] !== authController || $[1] !== importConfig || $[2] !== properties) {
9024
+ if ($[0] !== authController || $[1] !== importConfig || $[2] !== navigation || $[3] !== properties) {
8993
9025
  t1 = async function loadEntities2() {
8994
- const mappedData = importConfig.importData.map((d) => convertDataToEntity(authController, d, importConfig.idColumn, importConfig.headersMapping, properties, "TEMP_PATH", importConfig.defaultValues));
9026
+ const mappedData = importConfig.importData.map((d) => convertDataToEntity(authController, navigation, d, importConfig.idColumn, importConfig.headersMapping, properties, "TEMP_PATH", importConfig.defaultValues));
8995
9027
  importConfig.setEntities(mappedData);
8996
9028
  };
8997
9029
  $[0] = authController;
8998
9030
  $[1] = importConfig;
8999
- $[2] = properties;
9000
- $[3] = t1;
9031
+ $[2] = navigation;
9032
+ $[3] = properties;
9033
+ $[4] = t1;
9001
9034
  } else {
9002
- t1 = $[3];
9035
+ t1 = $[4];
9003
9036
  }
9004
9037
  const loadEntities = t1;
9005
9038
  let t2;
9006
- if ($[4] !== loadEntities) {
9039
+ if ($[5] !== loadEntities) {
9007
9040
  t2 = () => {
9008
9041
  loadEntities().finally(() => setLoading(false));
9009
9042
  };
9010
- $[4] = loadEntities;
9011
- $[5] = t2;
9043
+ $[5] = loadEntities;
9044
+ $[6] = t2;
9012
9045
  } else {
9013
- t2 = $[5];
9046
+ t2 = $[6];
9014
9047
  }
9015
9048
  let t3;
9016
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
9049
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
9017
9050
  t3 = [];
9018
- $[6] = t3;
9051
+ $[7] = t3;
9019
9052
  } else {
9020
- t3 = $[6];
9053
+ t3 = $[7];
9021
9054
  }
9022
9055
  useEffect(t2, t3);
9023
9056
  const selectionController = useSelectionController();
9024
9057
  if (loading) {
9025
9058
  let t42;
9026
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
9059
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
9027
9060
  t42 = /* @__PURE__ */ jsx(CircularProgressCenter, {});
9028
- $[7] = t42;
9061
+ $[8] = t42;
9029
9062
  } else {
9030
- t42 = $[7];
9063
+ t42 = $[8];
9031
9064
  }
9032
9065
  return t42;
9033
9066
  }
9034
9067
  let t4;
9035
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
9068
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
9036
9069
  t4 = /* @__PURE__ */ jsxs("div", { children: [
9037
9070
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "Imported data preview" }),
9038
9071
  /* @__PURE__ */ jsx(Typography, { variant: "caption", children: "Entities with the same id will be overwritten" })
9039
9072
  ] });
9040
- $[8] = t4;
9073
+ $[9] = t4;
9041
9074
  } else {
9042
- t4 = $[8];
9075
+ t4 = $[9];
9043
9076
  }
9044
9077
  let t5;
9045
- if ($[9] !== importConfig.entities) {
9078
+ if ($[10] !== importConfig.entities) {
9046
9079
  t5 = {
9047
9080
  data: importConfig.entities,
9048
9081
  dataLoading: false,
9049
9082
  noMoreToLoad: false
9050
9083
  };
9051
- $[9] = importConfig.entities;
9052
- $[10] = t5;
9084
+ $[10] = importConfig.entities;
9085
+ $[11] = t5;
9053
9086
  } else {
9054
- t5 = $[10];
9087
+ t5 = $[11];
9055
9088
  }
9056
9089
  let t6;
9057
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
9090
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
9058
9091
  t6 = /* @__PURE__ */ jsx("div", { className: "h-12" });
9059
- $[11] = t6;
9092
+ $[12] = t6;
9060
9093
  } else {
9061
- t6 = $[11];
9094
+ t6 = $[12];
9062
9095
  }
9063
9096
  let t7;
9064
- if ($[12] !== propertiesOrder) {
9097
+ if ($[13] !== propertiesOrder) {
9065
9098
  t7 = propertiesOrder.map(_temp$2);
9066
- $[12] = propertiesOrder;
9067
- $[13] = t7;
9099
+ $[13] = propertiesOrder;
9100
+ $[14] = t7;
9068
9101
  } else {
9069
- t7 = $[13];
9102
+ t7 = $[14];
9070
9103
  }
9071
9104
  let t8;
9072
- if ($[14] !== properties || $[15] !== selectionController || $[16] !== t5 || $[17] !== t7) {
9105
+ if ($[15] !== properties || $[16] !== selectionController || $[17] !== t5 || $[18] !== t7) {
9073
9106
  t8 = /* @__PURE__ */ jsx(EntityCollectionTable, { title: t4, tableController: t5, endAdornment: t6, filterable: false, sortable: false, selectionController, displayedColumnIds: t7, openEntityMode: "side_panel", properties, enablePopupIcon: false });
9074
- $[14] = properties;
9075
- $[15] = selectionController;
9076
- $[16] = t5;
9077
- $[17] = t7;
9078
- $[18] = t8;
9107
+ $[15] = properties;
9108
+ $[16] = selectionController;
9109
+ $[17] = t5;
9110
+ $[18] = t7;
9111
+ $[19] = t8;
9079
9112
  } else {
9080
- t8 = $[18];
9113
+ t8 = $[19];
9081
9114
  }
9082
9115
  return t8;
9083
9116
  }
@@ -9724,7 +9757,7 @@ function CollectionEditorInternal({
9724
9757
  };
9725
9758
  const doCollectionInference = collectionInference ? (collection_0) => {
9726
9759
  if (!collectionInference) return void 0;
9727
- return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? []);
9760
+ return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? [], collection_0.databaseId);
9728
9761
  } : void 0;
9729
9762
  const inferCollectionFromData = async (newCollection) => {
9730
9763
  try {