@firecms/core 3.0.0-canary.120 → 3.0.0-canary.121

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.
@@ -6,4 +6,4 @@ import { EnumType, FieldProps } from "../../types";
6
6
  * and tables to the specified properties.
7
7
  * @group Form fields
8
8
  */
9
- export declare function MultiSelectBinding({ propertyKey, value, setValue, error, showError, disabled, property, includeDescription, size, autoFocus }: FieldProps<EnumType[], any, any>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function MultiSelectFieldBinding({ propertyKey, value, setValue, error, showError, disabled, property, includeDescription, size, autoFocus }: FieldProps<EnumType[], any, any>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { SelectFieldBinding } from "./field_bindings/SelectFieldBinding";
2
- import { MultiSelectBinding } from "./field_bindings/MultiSelectBinding";
2
+ import { MultiSelectFieldBinding } from "./field_bindings/MultiSelectFieldBinding";
3
3
  import { ArrayOfReferencesFieldBinding } from "./field_bindings/ArrayOfReferencesFieldBinding";
4
4
  import { StorageUploadFieldBinding } from "./field_bindings/StorageUploadFieldBinding";
5
5
  import { TextFieldBinding } from "./field_bindings/TextFieldBinding";
@@ -13,7 +13,7 @@ import { BlockFieldBinding } from "./field_bindings/BlockFieldBinding";
13
13
  import { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding";
14
14
  import { MarkdownEditorFieldBinding } from "./field_bindings/MarkdownEditorFieldBinding";
15
15
  import { ArrayCustomShapedFieldBinding } from "./field_bindings/ArrayCustomShapedFieldBinding";
16
- export { ArrayCustomShapedFieldBinding, RepeatFieldBinding, MultiSelectBinding, ArrayOfReferencesFieldBinding, BlockFieldBinding, DateTimeFieldBinding, ReadOnlyFieldBinding, MapFieldBinding, KeyValueFieldBinding, ReferenceFieldBinding, SelectFieldBinding, StorageUploadFieldBinding, SwitchFieldBinding, MarkdownEditorFieldBinding, TextFieldBinding };
16
+ export { ArrayCustomShapedFieldBinding, RepeatFieldBinding, MultiSelectFieldBinding, ArrayOfReferencesFieldBinding, BlockFieldBinding, DateTimeFieldBinding, ReadOnlyFieldBinding, MapFieldBinding, KeyValueFieldBinding, ReferenceFieldBinding, SelectFieldBinding, StorageUploadFieldBinding, SwitchFieldBinding, MarkdownEditorFieldBinding, TextFieldBinding };
17
17
  export * from "./components";
18
18
  export { PropertyFieldBinding } from "./PropertyFieldBinding";
19
19
  export * from "./useClearRestoreValue";
package/dist/index.es.js CHANGED
@@ -6321,9 +6321,7 @@ function VirtualTableInput(props) {
6321
6321
  }
6322
6322
  function VirtualTableSelect(props) {
6323
6323
  const {
6324
- name,
6325
6324
  enumValues,
6326
- error,
6327
6325
  internalValue,
6328
6326
  disabled,
6329
6327
  small,
@@ -6340,6 +6338,7 @@ function VirtualTableSelect(props) {
6340
6338
  }
6341
6339
  }, [focused, ref]);
6342
6340
  const onChange = useCallback((updatedValue) => {
6341
+ console.trace("onChange");
6343
6342
  if (valueType === "number") {
6344
6343
  if (multiple) {
6345
6344
  const newValue = updatedValue.map((v) => parseFloat(v));
@@ -6356,41 +6355,28 @@ function VirtualTableSelect(props) {
6356
6355
  throw Error("Missing mapping in TableSelect");
6357
6356
  }
6358
6357
  }, [multiple, updateValue, valueType]);
6359
- const renderValue = (enumKey, index) => {
6360
- if (multiple && Array.isArray(enumKey)) {
6361
- return /* @__PURE__ */ jsx(
6362
- ArrayEnumPreview,
6363
- {
6364
- value: enumKey,
6365
- name,
6366
- enumValues,
6367
- size: small ? "small" : "medium"
6368
- },
6369
- `${enumKey}-${index}`
6370
- );
6371
- } else {
6372
- return /* @__PURE__ */ jsx(
6373
- EnumValuesChip,
6374
- {
6375
- enumKey,
6376
- enumValues,
6377
- size: small ? "small" : "medium"
6378
- },
6379
- `${enumKey}-${index}`
6380
- );
6381
- }
6358
+ const renderValue = (enumKey) => {
6359
+ return /* @__PURE__ */ jsx(
6360
+ EnumValuesChip,
6361
+ {
6362
+ enumKey: String(enumKey),
6363
+ enumValues,
6364
+ size: small ? "small" : "medium"
6365
+ },
6366
+ `${enumKey}`
6367
+ );
6382
6368
  };
6383
6369
  return multiple ? /* @__PURE__ */ jsx(
6384
6370
  MultiSelect,
6385
6371
  {
6386
6372
  inputRef: ref,
6387
- containerClassName: "w-full h-full",
6388
6373
  className: "w-full h-full p-0 bg-transparent",
6389
6374
  position: "item-aligned",
6390
6375
  disabled,
6376
+ includeClear: false,
6377
+ useChips: false,
6391
6378
  value: validValue ? internalValue.map((v) => v.toString()) : [],
6392
- onMultiValueChange: onChange,
6393
- renderValue,
6379
+ onValueChange: onChange,
6394
6380
  children: enumValues?.map((enumConfig) => /* @__PURE__ */ jsx(
6395
6381
  MultiSelectItem,
6396
6382
  {
@@ -6414,12 +6400,9 @@ function VirtualTableSelect(props) {
6414
6400
  className: "w-full h-full p-0 bg-transparent",
6415
6401
  position: "item-aligned",
6416
6402
  disabled,
6417
- multiple,
6418
6403
  padding: false,
6419
- includeFocusOutline: false,
6420
- value: validValue ? multiple ? internalValue.map((v) => v.toString()) : internalValue?.toString() : multiple ? [] : "",
6404
+ value: validValue ? internalValue?.toString() : "",
6421
6405
  onValueChange: onChange,
6422
- onMultiValueChange: onChange,
6423
6406
  renderValue,
6424
6407
  children: enumValues?.map((enumConfig) => /* @__PURE__ */ jsx(
6425
6408
  SelectItem,
@@ -7734,8 +7717,9 @@ const EntityTableCell = React__default.memo(
7734
7717
  }
7735
7718
  }, [ref, onSelect, selected, disabled]);
7736
7719
  const onFocus = useCallback((event) => {
7737
- onSelectCallback();
7738
7720
  event.stopPropagation();
7721
+ event.preventDefault();
7722
+ onSelectCallback();
7739
7723
  }, [onSelectCallback]);
7740
7724
  const isOverflowing = useMemo(() => {
7741
7725
  if (bounds) {
@@ -9618,6 +9602,7 @@ function StringNumberFilterField({
9618
9602
  }
9619
9603
  }
9620
9604
  const multiple = multipleSelectOperations$1.includes(operation);
9605
+ console.log("internalValue", { internalValue });
9621
9606
  return /* @__PURE__ */ jsxs("div", { className: "flex w-[440px]", children: [
9622
9607
  /* @__PURE__ */ jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsx(
9623
9608
  Select,
@@ -9650,16 +9635,15 @@ function StringNumberFilterField({
9650
9635
  )
9651
9636
  }
9652
9637
  ),
9653
- enumValues && /* @__PURE__ */ jsx(
9638
+ enumValues && !multiple && /* @__PURE__ */ jsx(
9654
9639
  Select,
9655
9640
  {
9656
9641
  position: "item-aligned",
9657
- value: internalValue !== void 0 ? Array.isArray(internalValue) ? internalValue.map((e) => String(e)) : String(internalValue) : isArray ? [] : "",
9642
+ value: typeof internalValue === "string" ? internalValue : "",
9658
9643
  onValueChange: (value2) => {
9659
9644
  if (value2 !== "")
9660
9645
  updateFilter(operation, dataType === "number" ? parseInt(value2) : value2);
9661
9646
  },
9662
- multiple,
9663
9647
  endAdornment: internalValue && /* @__PURE__ */ jsx(
9664
9648
  IconButton,
9665
9649
  {
@@ -9671,6 +9655,8 @@ function StringNumberFilterField({
9671
9655
  renderValue: (enumKey) => {
9672
9656
  if (enumKey === null)
9673
9657
  return "Filter for null values";
9658
+ if (enumKey === void 0)
9659
+ return null;
9674
9660
  return /* @__PURE__ */ jsx(
9675
9661
  EnumValuesChip,
9676
9662
  {
@@ -9694,6 +9680,40 @@ function StringNumberFilterField({
9694
9680
  }
9695
9681
  )
9696
9682
  },
9683
+ `select_item_${name}_${enumConfig.id}`
9684
+ ))
9685
+ }
9686
+ ),
9687
+ enumValues && multiple && /* @__PURE__ */ jsx(
9688
+ MultiSelect,
9689
+ {
9690
+ position: "item-aligned",
9691
+ value: Array.isArray(internalValue) ? internalValue.map((e) => String(e)) : [],
9692
+ onValueChange: (value2) => {
9693
+ updateFilter(operation, dataType === "number" ? value2.map((v) => parseInt(v)) : value2);
9694
+ },
9695
+ multiple,
9696
+ endAdornment: internalValue && /* @__PURE__ */ jsx(
9697
+ IconButton,
9698
+ {
9699
+ className: "absolute right-2 top-3",
9700
+ onClick: (e) => updateFilter(operation, void 0),
9701
+ children: /* @__PURE__ */ jsx(ClearIcon, {})
9702
+ }
9703
+ ),
9704
+ children: enumValues.map((enumConfig) => /* @__PURE__ */ jsx(
9705
+ MultiSelectItem,
9706
+ {
9707
+ value: String(enumConfig.id),
9708
+ children: /* @__PURE__ */ jsx(
9709
+ EnumValuesChip,
9710
+ {
9711
+ enumKey: String(enumConfig.id),
9712
+ enumValues,
9713
+ size: "small"
9714
+ }
9715
+ )
9716
+ },
9697
9717
  `select_value_${name}_${enumConfig.id}`
9698
9718
  ))
9699
9719
  }
@@ -13977,7 +13997,7 @@ function SelectFieldBinding({
13977
13997
  )
13978
13998
  ] });
13979
13999
  }
13980
- function MultiSelectBinding({
14000
+ function MultiSelectFieldBinding({
13981
14001
  propertyKey,
13982
14002
  value,
13983
14003
  setValue,
@@ -14041,13 +14061,15 @@ function MultiSelectBinding({
14041
14061
  enumKey
14042
14062
  );
14043
14063
  }, [enumValues, setValue, value]);
14044
- return /* @__PURE__ */ jsxs("div", { className: "mt-0.5 ml-0.5 mt-2", children: [
14064
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
14045
14065
  /* @__PURE__ */ jsx(
14046
14066
  MultiSelect,
14047
14067
  {
14068
+ className: "w-full mt-2",
14048
14069
  size: size === "medium" ? "medium" : "small",
14049
14070
  value: validValue ? value.map((v) => v.toString()) : [],
14050
14071
  disabled,
14072
+ modalPopover: true,
14051
14073
  label: /* @__PURE__ */ jsx(
14052
14074
  LabelWithIconAndTooltip,
14053
14075
  {
@@ -14058,8 +14080,7 @@ function MultiSelectBinding({
14058
14080
  className: "text-text-secondary dark:text-text-secondary-dark ml-3.5"
14059
14081
  }
14060
14082
  ),
14061
- renderValue: useCallback((v) => renderValue(v, false), [renderValue]),
14062
- onMultiValueChange: (updatedValue) => {
14083
+ onValueChange: (updatedValue) => {
14063
14084
  let newValue;
14064
14085
  if (of && of?.dataType === "number") {
14065
14086
  newValue = updatedValue ? updatedValue.map((e) => parseFloat(e)) : [];
@@ -16560,7 +16581,7 @@ const DEFAULT_FIELD_CONFIGS = {
16560
16581
  dataType: "string",
16561
16582
  enumValues: []
16562
16583
  },
16563
- Field: MultiSelectBinding
16584
+ Field: MultiSelectFieldBinding
16564
16585
  }
16565
16586
  },
16566
16587
  number_input: {
@@ -16598,7 +16619,7 @@ const DEFAULT_FIELD_CONFIGS = {
16598
16619
  dataType: "number",
16599
16620
  enumValues: []
16600
16621
  },
16601
- Field: MultiSelectBinding
16622
+ Field: MultiSelectFieldBinding
16602
16623
  }
16603
16624
  },
16604
16625
  file_upload: {
@@ -18879,14 +18900,6 @@ function useBuildDataSource({
18879
18900
  }) => {
18880
18901
  const collection = collectionProp ?? navigationController.getCollection(path);
18881
18902
  const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
18882
- console.log("useBuildDatasource save", {
18883
- path,
18884
- entityId,
18885
- values,
18886
- collectionProp,
18887
- collection,
18888
- status
18889
- });
18890
18903
  const resolvedCollection = collection ? resolveCollection({
18891
18904
  collection,
18892
18905
  path,
@@ -18931,7 +18944,10 @@ function useBuildDataSource({
18931
18944
  collection
18932
18945
  }) => {
18933
18946
  const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
18934
- return usedDelegate.deleteEntity({ entity, collection });
18947
+ return usedDelegate.deleteEntity({
18948
+ entity,
18949
+ collection
18950
+ });
18935
18951
  }, [delegate.deleteEntity]),
18936
18952
  /**
18937
18953
  * Check if the given property is unique in the given collection
@@ -19768,7 +19784,7 @@ export {
19768
19784
  MarkdownEditorFieldBinding,
19769
19785
  ModeControllerContext,
19770
19786
  ModeControllerProvider,
19771
- MultiSelectBinding,
19787
+ MultiSelectFieldBinding,
19772
19788
  NavigationCard,
19773
19789
  NavigationCardBinding,
19774
19790
  NavigationGroup,