@rebasepro/admin 0.7.0 → 0.8.0

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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{CollectionEditorDialog-iGgS4rLX.js → CollectionEditorDialog-BO_aQ-Z4.js} +7 -7
  3. package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +1 -0
  4. package/dist/{PropertyEditView-C9yhLyja.js → PropertyEditView-DKzOpMjR.js} +64 -38
  5. package/dist/PropertyEditView-DKzOpMjR.js.map +1 -0
  6. package/dist/{RouterCollectionsStudioView-Dqx27GD8.js → RouterCollectionsStudioView-BQTIExjA.js} +4 -4
  7. package/dist/{RouterCollectionsStudioView-Dqx27GD8.js.map → RouterCollectionsStudioView-BQTIExjA.js.map} +1 -1
  8. package/dist/collection_editor/_cms_internals.d.ts +1 -1
  9. package/dist/collection_editor/api/generateCollectionApi.d.ts +3 -2
  10. package/dist/collection_editor/serializable_types.d.ts +5 -9
  11. package/dist/collection_editor/serializable_utils.d.ts +2 -2
  12. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +1 -2
  13. package/dist/collection_editor_ui.js +4 -4
  14. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  15. package/dist/components/EntityCollectionTable/index.d.ts +1 -1
  16. package/dist/components/RebaseCMS.d.ts +1 -1
  17. package/dist/components/SelectableTable/SelectionStore.d.ts +12 -21
  18. package/dist/components/field_configs.d.ts +1 -1
  19. package/dist/editor/editor.d.ts +0 -6
  20. package/dist/editor.js +1 -3
  21. package/dist/editor.js.map +1 -1
  22. package/dist/form/components/StorageUploadProgress.d.ts +6 -1
  23. package/dist/form/index.d.ts +0 -1
  24. package/dist/{history-ChHgyyvM.js → history-B3cqBzEV.js} +2 -2
  25. package/dist/{history-ChHgyyvM.js.map → history-B3cqBzEV.js.map} +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +2 -2
  28. package/dist/preview/components/StorageThumbnail.d.ts +3 -1
  29. package/dist/{src-DOX2nOyh.js → src-cxV1ODRG.js} +178 -460
  30. package/dist/src-cxV1ODRG.js.map +1 -0
  31. package/dist/types/components/PropertyPreviewProps.d.ts +2 -1
  32. package/dist/types/fields.d.ts +4 -6
  33. package/package.json +18 -18
  34. package/src/collection_editor/_cms_internals.ts +1 -1
  35. package/src/collection_editor/api/generateCollectionApi.ts +3 -2
  36. package/src/collection_editor/pgColumnToProperty.ts +2 -2
  37. package/src/collection_editor/serializable_types.ts +14 -27
  38. package/src/collection_editor/serializable_utils.ts +25 -37
  39. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +2 -2
  40. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +41 -24
  41. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +0 -9
  42. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
  43. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
  44. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
  45. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
  46. package/src/collection_editor/useJsonCollectionsConfigController.tsx +2 -2
  47. package/src/components/DefaultDrawer.tsx +1 -1
  48. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +11 -9
  49. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +2 -1
  50. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +2 -1
  51. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +23 -20
  52. package/src/components/EntityCollectionTable/index.tsx +1 -1
  53. package/src/components/EntityCollectionTable/table_bindings.tsx +24 -44
  54. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +1 -1
  55. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +12 -1
  56. package/src/components/EntityCollectionView/EntityCollectionView.tsx +8 -25
  57. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
  58. package/src/components/EntityCollectionView/useBoardDataController.tsx +12 -40
  59. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +3 -3
  60. package/src/components/EntityDetailView.tsx +2 -2
  61. package/src/components/EntityEditView.tsx +2 -2
  62. package/src/components/EntityEditViewFormActions.tsx +3 -3
  63. package/src/components/HomePage/ContentHomePage.tsx +1 -1
  64. package/src/components/RebaseCMS.tsx +2 -3
  65. package/src/components/RebaseNavigation.tsx +3 -2
  66. package/src/components/RelationSelector.tsx +2 -2
  67. package/src/components/SelectableTable/SelectableTable.tsx +11 -3
  68. package/src/components/SelectableTable/SelectionStore.ts +18 -48
  69. package/src/components/common/default_entity_actions.tsx +15 -4
  70. package/src/components/field_configs.tsx +0 -14
  71. package/src/editor/editor.tsx +4 -7
  72. package/src/form/EntityFormActions.tsx +2 -2
  73. package/src/form/EntityFormBinding.tsx +1 -1
  74. package/src/form/components/StorageUploadProgress.tsx +9 -2
  75. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
  76. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +4 -4
  77. package/src/form/field_bindings/RelationFieldBinding.tsx +5 -7
  78. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
  79. package/src/form/index.tsx +0 -1
  80. package/src/index.ts +1 -1
  81. package/src/preview/PropertyPreview.tsx +1 -16
  82. package/src/preview/components/StorageThumbnail.tsx +24 -7
  83. package/src/types/components/PropertyPreviewProps.tsx +1 -1
  84. package/src/types/fields.tsx +2 -7
  85. package/src/util/previews.ts +20 -0
  86. package/src/util/propertyConfigMapper.ts +3 -3
  87. package/src/util/property_utils.tsx +1 -2
  88. package/dist/CollectionEditorDialog-iGgS4rLX.js.map +0 -1
  89. package/dist/PropertyEditView-C9yhLyja.js.map +0 -1
  90. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
  91. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
  92. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
  93. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
  94. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
  95. package/dist/src-DOX2nOyh.js.map +0 -1
  96. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
  97. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
  98. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
  99. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
  100. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
@@ -1,12 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { Bt as getFieldId, Ft as PropertyConfigBadge, Gn as useCollectionRegistryController, It as DEFAULT_FIELD_CONFIGS, _ as toSerializableProperty, a as namespaceToPropertiesPath, h as toSerializableCollection, i as namespaceToPropertiesOrderPath, n as getFullIdPath, nn as ArrayContainer, pn as FieldCaption, r as idToPropertiesPath, t as getFullId, zt as getFieldConfig } from "./src-DOX2nOyh.js";
2
+ import { Bt as getFieldId, Ft as PropertyConfigBadge, It as DEFAULT_FIELD_CONFIGS, Wn as useCollectionRegistryController, _ as toSerializableProperty, a as namespaceToPropertiesPath, fn as FieldCaption, h as toSerializableCollection, i as namespaceToPropertiesOrderPath, n as getFullIdPath, r as idToPropertiesPath, t as getFullId, tn as ArrayContainer, zt as getFieldConfig } from "./src-cxV1ODRG.js";
3
3
  import React, { createContext, useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { deepEqual } from "fast-equals";
5
5
  import { AlertTriangleIcon, ArrowDownToLineIcon, ArrowUpToLineIcon, Badge, BooleanSwitchWithLabel, Button, Card, CheckSquareIcon, CircularProgress, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, FileSearchIcon, FunctionSquareIcon, IconButton, InfoLabel, ListIcon, Menu, MenuItem, MinusCircleIcon, MoreVerticalIcon, MultiSelect, MultiSelectItem, Paper, PlusIcon, RefreshCcwIcon, Select, SelectItem, SettingsIcon, TextField, Tooltip, Trash2Icon, Typography, UploadCloudIcon, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
6
6
  import { isPropertyBuilder, resolveEnumValues } from "@rebasepro/common";
7
- import { AIModifiedIndicator, ConfirmationDialog, IconForView, useCustomizationController, useSnackbarController, useTranslation } from "@rebasepro/core";
7
+ import { AIModifiedIndicator, ConfirmationDialog, IconForView, useCustomizationController, useSnackbarController, useStorageSources, useTranslation } from "@rebasepro/core";
8
8
  import { Field, Formex, getIn, useCreateFormex, useFormex } from "@rebasepro/formex";
9
9
  import { isValidRegExp, mergeDeep, prettifyIdentifier, serializeRegExp, toSnakeCase } from "@rebasepro/utils";
10
+ import { DEFAULT_STORAGE_SOURCE_KEY } from "@rebasepro/types";
10
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
12
  import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
12
13
  import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
@@ -569,8 +570,10 @@ var fileTypes = {
569
570
  function StoragePropertyField({ multiple, existing, disabled }) {
570
571
  const { values, setFieldValue } = useFormex();
571
572
  const { t } = useTranslation();
573
+ const storageSources = useStorageSources();
572
574
  const baseStoragePath = multiple ? "of.storage" : "storage";
573
575
  const acceptedFiles = `${baseStoragePath}.acceptedFiles`;
576
+ const storageSource = `${baseStoragePath}.storageSource`;
574
577
  `${baseStoragePath}`;
575
578
  const fileName = `${baseStoragePath}.fileName`;
576
579
  const maxSize = `${baseStoragePath}.maxSize`;
@@ -594,6 +597,8 @@ function StoragePropertyField({ multiple, existing, disabled }) {
594
597
  const storedValue = getIn(values, acceptedFiles);
595
598
  const fileTypesValue = Array.isArray(storedValue) ? storedValue : void 0;
596
599
  const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;
600
+ const sourceKeys = Object.keys(storageSources.sources).filter((key) => key !== DEFAULT_STORAGE_SOURCE_KEY);
601
+ const storageSourceValue = getIn(values, storageSource) ?? DEFAULT_STORAGE_SOURCE_KEY;
597
602
  const handleTypesChange = (value) => {
598
603
  if (!value) setFieldValue(acceptedFiles, void 0);
599
604
  else setFieldValue(acceptedFiles, value);
@@ -614,6 +619,27 @@ function StoragePropertyField({ multiple, existing, disabled }) {
614
619
  children: /* @__PURE__ */ jsxs("div", {
615
620
  className: "grid grid-cols-12 gap-2 p-4",
616
621
  children: [
622
+ sourceKeys.length > 0 && /* @__PURE__ */ jsx("div", {
623
+ className: "col-span-12",
624
+ children: /* @__PURE__ */ jsxs(Select, {
625
+ className: "w-full",
626
+ disabled,
627
+ name: storageSource,
628
+ value: storageSourceValue,
629
+ onValueChange: (value) => setFieldValue(storageSource, !value || value === DEFAULT_STORAGE_SOURCE_KEY ? void 0 : value),
630
+ label: "Storage backend",
631
+ renderValue: (key) => {
632
+ return storageSources.registry[key]?.label ?? (key === DEFAULT_STORAGE_SOURCE_KEY ? "Default" : key);
633
+ },
634
+ children: [/* @__PURE__ */ jsx(SelectItem, {
635
+ value: DEFAULT_STORAGE_SOURCE_KEY,
636
+ children: "Default"
637
+ }), sourceKeys.map((key) => /* @__PURE__ */ jsx(SelectItem, {
638
+ value: key,
639
+ children: storageSources.registry[key]?.label ?? key
640
+ }, key))]
641
+ })
642
+ }),
617
643
  /* @__PURE__ */ jsx("div", {
618
644
  className: "col-span-12",
619
645
  children: /* @__PURE__ */ jsx(MultiSelect, {
@@ -2731,10 +2757,12 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2731
2757
  type: "string",
2732
2758
  propertyConfig: "text_field",
2733
2759
  storage: void 0,
2734
- multiline: void 0,
2735
- markdown: void 0,
2760
+ ui: {
2761
+ multiline: void 0,
2762
+ markdown: void 0,
2763
+ url: void 0
2764
+ },
2736
2765
  email: void 0,
2737
- url: void 0,
2738
2766
  enum: void 0,
2739
2767
  userSelect: void 0
2740
2768
  });
@@ -2742,21 +2770,25 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2742
2770
  type: "string",
2743
2771
  propertyConfig: "user_select",
2744
2772
  storage: void 0,
2745
- multiline: void 0,
2746
- markdown: void 0,
2773
+ ui: {
2774
+ multiline: void 0,
2775
+ markdown: void 0,
2776
+ url: void 0
2777
+ },
2747
2778
  email: void 0,
2748
- url: void 0,
2749
2779
  enum: void 0,
2750
2780
  userSelect: true
2751
2781
  });
2752
2782
  else if (selectedWidgetId === "multiline") updatedProperty = mergeDeep(propertyData, {
2753
2783
  type: "string",
2754
2784
  propertyConfig: "multiline",
2755
- multiline: true,
2785
+ ui: {
2786
+ multiline: true,
2787
+ markdown: void 0,
2788
+ url: void 0
2789
+ },
2756
2790
  storage: void 0,
2757
- markdown: void 0,
2758
2791
  email: void 0,
2759
- url: void 0,
2760
2792
  enum: void 0,
2761
2793
  userSelect: void 0
2762
2794
  });
@@ -2764,20 +2796,24 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2764
2796
  type: "string",
2765
2797
  propertyConfig: "markdown",
2766
2798
  storage: void 0,
2767
- multiline: void 0,
2768
- markdown: true,
2799
+ ui: {
2800
+ multiline: void 0,
2801
+ markdown: true,
2802
+ url: void 0
2803
+ },
2769
2804
  email: void 0,
2770
- url: void 0,
2771
2805
  userSelect: void 0
2772
2806
  });
2773
2807
  else if (selectedWidgetId === "url") updatedProperty = mergeDeep(propertyData, {
2774
2808
  type: "string",
2775
2809
  propertyConfig: "url",
2776
2810
  storage: void 0,
2777
- multiline: void 0,
2778
- markdown: void 0,
2811
+ ui: {
2812
+ multiline: void 0,
2813
+ markdown: void 0,
2814
+ url: true
2815
+ },
2779
2816
  email: void 0,
2780
- url: true,
2781
2817
  enum: void 0,
2782
2818
  userSelect: void 0
2783
2819
  });
@@ -2785,10 +2821,12 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2785
2821
  type: "string",
2786
2822
  propertyConfig: "email",
2787
2823
  storage: void 0,
2788
- multiline: void 0,
2789
- markdown: void 0,
2824
+ ui: {
2825
+ multiline: void 0,
2826
+ markdown: void 0,
2827
+ url: void 0
2828
+ },
2790
2829
  email: true,
2791
- url: void 0,
2792
2830
  enum: void 0,
2793
2831
  userSelect: void 0
2794
2832
  });
@@ -2796,10 +2834,12 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2796
2834
  type: "string",
2797
2835
  propertyConfig: "select",
2798
2836
  storage: void 0,
2799
- multiline: void 0,
2800
- markdown: void 0,
2837
+ ui: {
2838
+ multiline: void 0,
2839
+ markdown: void 0,
2840
+ url: void 0
2841
+ },
2801
2842
  email: void 0,
2802
- url: void 0,
2803
2843
  enum: propertyData.enum ?? [],
2804
2844
  userSelect: void 0
2805
2845
  });
@@ -2858,10 +2898,6 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
2858
2898
  type: "reference",
2859
2899
  propertyConfig: "reference"
2860
2900
  });
2861
- else if (selectedWidgetId === "reference_as_string") updatedProperty = mergeDeep(propertyData, {
2862
- type: "string",
2863
- propertyConfig: "reference_as_string"
2864
- });
2865
2901
  else if (selectedWidgetId === "multi_references") updatedProperty = mergeDeep(propertyData, {
2866
2902
  type: "array",
2867
2903
  propertyConfig: "multi_references",
@@ -2983,7 +3019,6 @@ var supportedFieldsIds = [
2983
3019
  "file_upload",
2984
3020
  "multi_file_upload",
2985
3021
  "reference",
2986
- "reference_as_string",
2987
3022
  "multi_references",
2988
3023
  "relation",
2989
3024
  "switch",
@@ -3448,13 +3483,6 @@ function PropertyEditFormFields({ values, errors, setValues, existing, autoUpdat
3448
3483
  multiple: false,
3449
3484
  disabled
3450
3485
  });
3451
- else if (selectedFieldConfigId === "reference_as_string") childComponent = /* @__PURE__ */ jsx(ReferencePropertyField, {
3452
- showErrors,
3453
- existing,
3454
- asString: true,
3455
- multiple: false,
3456
- disabled
3457
- });
3458
3486
  else if (selectedFieldConfigId === "date_time") childComponent = /* @__PURE__ */ jsx(DateTimePropertyField, { disabled });
3459
3487
  else if (selectedFieldConfigId === "multi_references") childComponent = /* @__PURE__ */ jsx(ReferencePropertyField, {
3460
3488
  showErrors,
@@ -3599,7 +3627,6 @@ var WIDGET_TYPE_MAP = {
3599
3627
  multi_file_upload: "File",
3600
3628
  relation: "Relation",
3601
3629
  reference: "Reference",
3602
- reference_as_string: "Text",
3603
3630
  multi_references: "Reference",
3604
3631
  date_time: "Date",
3605
3632
  group: "Group",
@@ -3619,7 +3646,6 @@ var WIDGET_BASE_TYPE_MAP = {
3619
3646
  multi_select: "string",
3620
3647
  file_upload: "string",
3621
3648
  multi_file_upload: "string",
3622
- reference_as_string: "string",
3623
3649
  user_select: "string",
3624
3650
  number_input: "number",
3625
3651
  number_select: "number",
@@ -3771,4 +3797,4 @@ function WidgetSelectViewItem({ onClick, initialProperty, propertyConfig, existi
3771
3797
  //#endregion
3772
3798
  export { updatePropertyFromWidget as a, useAIModifiedPaths as c, supportedFields as i, useSafeSnackbarController as l, PropertyForm as n, PropertyTree as o, PropertyFormDialog as r, AIModifiedPathsProvider as s, PropertyEditView_exports as t };
3773
3799
 
3774
- //# sourceMappingURL=PropertyEditView-C9yhLyja.js.map
3800
+ //# sourceMappingURL=PropertyEditView-DKzOpMjR.js.map