@rebasepro/admin 0.6.1 → 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 (187) hide show
  1. package/dist/{CollectionEditorDialog-HNXGxXdO.js → CollectionEditorDialog-BO_aQ-Z4.js} +236 -155
  2. package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +1 -0
  3. package/dist/{PropertyEditView-C2wp8kQ9.js → PropertyEditView-DKzOpMjR.js} +190 -50
  4. package/dist/PropertyEditView-DKzOpMjR.js.map +1 -0
  5. package/dist/{CollectionsStudioView-B1mN33GB.js → RouterCollectionsStudioView-BQTIExjA.js} +61 -39
  6. package/dist/RouterCollectionsStudioView-BQTIExjA.js.map +1 -0
  7. package/dist/collection_editor/_cms_internals.d.ts +1 -1
  8. package/dist/collection_editor/api/generateCollectionApi.d.ts +3 -2
  9. package/dist/collection_editor/extensibility_types.d.ts +135 -0
  10. package/dist/collection_editor/index.d.ts +6 -0
  11. package/dist/collection_editor/serializable_types.d.ts +370 -0
  12. package/dist/collection_editor/serializable_utils.d.ts +50 -0
  13. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +3 -3
  14. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +12 -1
  15. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +13 -1
  16. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +24 -2
  17. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +2 -1
  18. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +4 -1
  19. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +12 -1
  20. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
  21. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
  22. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
  23. package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
  24. package/dist/collection_editor_ui.d.ts +4 -0
  25. package/dist/collection_editor_ui.js +33 -4
  26. package/dist/collection_editor_ui.js.map +1 -0
  27. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  28. package/dist/components/EntityCollectionTable/index.d.ts +1 -1
  29. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +3 -3
  30. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +3 -3
  31. package/dist/components/EntityEditView.d.ts +3 -2
  32. package/dist/components/RebaseCMS.d.ts +1 -1
  33. package/dist/components/SelectableTable/SelectionStore.d.ts +12 -21
  34. package/dist/components/field_configs.d.ts +1 -1
  35. package/dist/editor/editor.d.ts +0 -6
  36. package/dist/editor.js +1 -3
  37. package/dist/editor.js.map +1 -1
  38. package/dist/form/EntityForm.d.ts +10 -9
  39. package/dist/form/EntityFormBinding.d.ts +27 -0
  40. package/dist/form/components/StorageUploadProgress.d.ts +6 -1
  41. package/dist/form/form_utils.d.ts +8 -0
  42. package/dist/form/index.d.ts +5 -2
  43. package/dist/{history-BO6VT85a.js → history-B3cqBzEV.js} +2 -2
  44. package/dist/{history-BO6VT85a.js.map → history-B3cqBzEV.js.map} +1 -1
  45. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
  46. package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
  47. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
  48. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
  49. package/dist/hooks/navigation/utils.d.ts +1 -1
  50. package/dist/index.d.ts +3 -1
  51. package/dist/index.js +2 -2
  52. package/dist/preview/components/StorageThumbnail.d.ts +3 -1
  53. package/dist/routes/CustomViewRoute.d.ts +2 -1
  54. package/dist/{src-BYniefVu.js → src-cxV1ODRG.js} +1731 -1710
  55. package/dist/src-cxV1ODRG.js.map +1 -0
  56. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  57. package/dist/types/components/EntityFormProps.d.ts +59 -0
  58. package/dist/types/components/PropertyPreviewProps.d.ts +2 -1
  59. package/dist/types/fields.d.ts +10 -7
  60. package/dist/util/dataControllerAdapter.d.ts +30 -0
  61. package/dist/util/navigation_utils.d.ts +1 -1
  62. package/dist/util/propertyConfigMapper.d.ts +17 -0
  63. package/package.json +8 -8
  64. package/src/collection_editor/_cms_internals.ts +1 -1
  65. package/src/collection_editor/api/generateCollectionApi.ts +3 -2
  66. package/src/collection_editor/extensibility_types.ts +168 -0
  67. package/src/collection_editor/index.ts +46 -0
  68. package/src/collection_editor/pgColumnToProperty.ts +2 -2
  69. package/src/collection_editor/serializable_types.ts +474 -0
  70. package/src/collection_editor/serializable_utils.ts +576 -0
  71. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +6 -6
  72. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +170 -89
  73. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +95 -78
  74. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +23 -20
  75. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +79 -27
  76. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +9 -7
  77. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +22 -5
  78. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +3 -3
  79. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +154 -18
  80. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
  81. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -0
  82. package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
  83. package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
  84. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +4 -3
  85. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
  86. package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
  87. package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
  88. package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
  89. package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
  90. package/src/collection_editor/useSafeSnackbarController.ts +9 -0
  91. package/src/collection_editor_ui.ts +6 -0
  92. package/src/components/DefaultDrawer.tsx +14 -4
  93. package/src/components/DrawerNavigationGroup.tsx +2 -2
  94. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +11 -9
  95. package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +2 -1
  96. package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +2 -1
  97. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +23 -20
  98. package/src/components/EntityCollectionTable/index.tsx +1 -1
  99. package/src/components/EntityCollectionTable/table_bindings.tsx +24 -44
  100. package/src/components/EntityCollectionView/EntityBoardCard.tsx +6 -6
  101. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +13 -12
  102. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +40 -190
  103. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +66 -184
  104. package/src/components/EntityCollectionView/EntityCollectionView.tsx +8 -25
  105. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
  106. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +6 -6
  107. package/src/components/EntityCollectionView/useBoardDataController.tsx +12 -40
  108. package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +3 -3
  109. package/src/components/EntityDetailView.tsx +2 -2
  110. package/src/components/EntityEditView.tsx +7 -6
  111. package/src/components/EntityEditViewFormActions.tsx +35 -29
  112. package/src/components/HomePage/ContentHomePage.tsx +14 -5
  113. package/src/components/RebaseCMS.tsx +3 -3
  114. package/src/components/RebaseNavigation.tsx +74 -9
  115. package/src/components/RelationSelector.tsx +2 -2
  116. package/src/components/SelectableTable/SelectableTable.tsx +13 -5
  117. package/src/components/SelectableTable/SelectionStore.ts +18 -48
  118. package/src/components/SideDialogs.tsx +0 -7
  119. package/src/components/common/default_entity_actions.tsx +22 -11
  120. package/src/components/field_configs.tsx +0 -14
  121. package/src/contexts/BreacrumbsContext.tsx +15 -6
  122. package/src/editor/editor.tsx +4 -7
  123. package/src/editor/selectors/ai-selector.tsx +0 -1
  124. package/src/form/EntityForm.tsx +191 -428
  125. package/src/form/EntityFormActions.tsx +35 -49
  126. package/src/form/EntityFormBinding.tsx +323 -0
  127. package/src/form/components/FormLayout.tsx +1 -1
  128. package/src/form/components/StorageUploadProgress.tsx +9 -2
  129. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
  130. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +4 -4
  131. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +7 -2
  132. package/src/form/field_bindings/RelationFieldBinding.tsx +5 -7
  133. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
  134. package/src/form/form_utils.ts +163 -0
  135. package/src/form/index.tsx +14 -6
  136. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
  137. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
  138. package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
  139. package/src/hooks/navigation/useAsyncResolver.ts +100 -0
  140. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +15 -8
  141. package/src/hooks/navigation/useBuildNavigationStateController.tsx +12 -8
  142. package/src/hooks/navigation/useNavigationResolution.ts +33 -0
  143. package/src/hooks/navigation/useResolvedCollections.ts +29 -71
  144. package/src/hooks/navigation/useResolvedViews.tsx +40 -70
  145. package/src/hooks/navigation/useTopLevelNavigation.ts +20 -16
  146. package/src/hooks/navigation/utils.ts +7 -4
  147. package/src/index.ts +6 -1
  148. package/src/preview/PropertyPreview.tsx +1 -16
  149. package/src/preview/components/StorageThumbnail.tsx +24 -7
  150. package/src/routes/CustomViewRoute.tsx +14 -6
  151. package/src/types/components/EntityFormActionsProps.tsx +1 -1
  152. package/src/types/components/EntityFormProps.tsx +68 -0
  153. package/src/types/components/PropertyPreviewProps.tsx +1 -1
  154. package/src/types/fields.tsx +9 -8
  155. package/src/util/dataControllerAdapter.ts +93 -0
  156. package/src/util/navigation_utils.ts +1 -1
  157. package/src/util/previews.ts +20 -0
  158. package/src/util/propertyConfigMapper.ts +134 -0
  159. package/src/util/property_utils.tsx +1 -2
  160. package/dist/CollectionEditorDialog-HNXGxXdO.js.map +0 -1
  161. package/dist/CollectionsStudioView-B1mN33GB.js.map +0 -1
  162. package/dist/PropertyEditView-C2wp8kQ9.js.map +0 -1
  163. package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
  164. package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
  165. package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
  166. package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
  167. package/dist/components/EntityCollectionView/Board.d.ts +0 -3
  168. package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
  169. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
  170. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
  171. package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
  172. package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
  173. package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -12
  174. package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
  175. package/dist/src-BYniefVu.js.map +0 -1
  176. package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
  177. package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
  178. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
  179. package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
  180. package/src/components/EntityCollectionView/Board.tsx +0 -475
  181. package/src/components/EntityCollectionView/BoardColumn.tsx +0 -165
  182. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -46
  183. package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
  184. package/src/components/EntityCollectionView/board_types.ts +0 -113
  185. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
  186. package/src/hooks/navigation/useNavigationRegistry.ts +0 -164
  187. package/src/hooks/navigation/useNavigationURLs.ts +0 -56
@@ -1,39 +0,0 @@
1
- import React from "react";
2
- import { cls, DateTimeField, focusedDisabled } from "@rebasepro/ui";
3
- import { useCustomizationController } from "@rebasepro/core";
4
-
5
- export function VirtualTableDateField(props: {
6
- name: string;
7
- error: Error | undefined;
8
- mode?: "date" | "date_time";
9
- timezone?: string;
10
- internalValue: Date | undefined | null;
11
- updateValue: (newValue: (Date | null)) => void;
12
- focused: boolean;
13
- disabled: boolean;
14
- onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
15
- }) {
16
-
17
- const { locale } = useCustomizationController();
18
- const {
19
- disabled,
20
- error,
21
- mode,
22
- timezone,
23
- internalValue,
24
- updateValue
25
- } = props;
26
-
27
- return (
28
- <DateTimeField
29
- value={internalValue ?? undefined}
30
- onChange={(dateValue) => updateValue(dateValue ?? null)}
31
- invisible={true}
32
- inputClassName={cls("w-full h-full", focusedDisabled)}
33
- className={cls("w-full h-full", focusedDisabled)}
34
- mode={mode}
35
- timezone={timezone}
36
- locale={locale}
37
- />
38
- );
39
- }
@@ -1,90 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
-
3
- import { useDebouncedCallback, focusedDisabled, TextareaAutosize } from "@rebasepro/ui";
4
-
5
- export function VirtualTableInput(props: {
6
- error: Error | undefined;
7
- value: string;
8
- multiline: boolean;
9
- focused: boolean;
10
- disabled: boolean;
11
- updateValue: (newValue: (string | null)) => void;
12
- onBlur?: () => void;
13
- }) {
14
-
15
- const ref = React.useRef<HTMLTextAreaElement>(null);
16
-
17
- const {
18
- disabled,
19
- value,
20
- multiline,
21
- updateValue,
22
- focused
23
- } = props;
24
-
25
- const prevValue = useRef<string | null>(value);
26
-
27
- const [internalValue, setInternalValue] = useState<typeof value>(value);
28
- const focusedState = useRef<boolean>(false);
29
-
30
- useEffect(() => {
31
- if (prevValue.current !== value && value !== internalValue)
32
- setInternalValue(value);
33
- prevValue.current = value;
34
- }, [value]);
35
-
36
- const doUpdate = React.useCallback(() => {
37
- const emptyInitialValue = !value;
38
- if (emptyInitialValue && !internalValue)
39
- return;
40
- if (internalValue !== value && internalValue !== prevValue.current) {
41
- prevValue.current = internalValue;
42
- updateValue(internalValue);
43
- }
44
- }, [internalValue, updateValue, value]);
45
- useDebouncedCallback(internalValue, doUpdate, !focused, 400);
46
- useEffect(() => {
47
- if (ref.current && focused && !focusedState.current) {
48
- focusedState.current = true;
49
- ref.current.focus({ preventScroll: true });
50
- ref.current.selectionStart = ref.current.value.length;
51
- ref.current.selectionEnd = ref.current.value.length;
52
- } else {
53
- focusedState.current = focused;
54
- }
55
- }, [focused, ref]);
56
-
57
- return (
58
- <TextareaAutosize
59
- className={focusedDisabled}
60
- ref={ref}
61
- style={{
62
- padding: 0,
63
- margin: 0,
64
- width: "100%",
65
- color: "unset",
66
- fontWeight: "unset",
67
- fontSize: "unset",
68
- fontFamily: "unset",
69
- background: "unset",
70
- border: "unset",
71
- resize: "none",
72
- outline: "none"
73
- }}
74
- value={internalValue ?? ""}
75
- onChange={(evt) => {
76
- const newValue = evt.target.value as string;
77
- if (multiline || !newValue.endsWith("\n"))
78
- setInternalValue(newValue);
79
- }}
80
- onFocus={() => {
81
- focusedState.current = true;
82
- }}
83
- onBlur={() => {
84
- focusedState.current = false;
85
- doUpdate();
86
- if (props.onBlur) props.onBlur();
87
- }}
88
- />
89
- );
90
- }
@@ -1,83 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
- import { useDebouncedCallback, cls, focusedDisabled, TextField } from "@rebasepro/ui";
3
-
4
- export function VirtualTableNumberInput(props: {
5
- error: Error | undefined;
6
- value: number;
7
- align: "right" | "left" | "center";
8
- updateValue: (newValue: (number | null)) => void;
9
- focused: boolean;
10
- disabled: boolean;
11
- }) {
12
-
13
- const {
14
- align,
15
- value,
16
- updateValue,
17
- focused
18
- } = props;
19
- const propStringValue = (value && typeof value === "number") ? value.toString() : "";
20
- const [internalValue, setInternalValue] = useState<string | null>(propStringValue);
21
-
22
- const prevValue = useRef<number | null>(value);
23
-
24
- useEffect(() => {
25
- if (prevValue.current !== value && String(value) !== internalValue)
26
- setInternalValue(value ? value.toString() : null);
27
- prevValue.current = value;
28
- }, [value]);
29
-
30
- const doUpdate = React.useCallback(() => {
31
- if (internalValue !== propStringValue) {
32
- if (internalValue !== undefined && internalValue !== null) {
33
- const numberValue = parseFloat(internalValue);
34
- if (isNaN(numberValue))
35
- return;
36
- if (numberValue !== undefined && numberValue !== null)
37
- updateValue(numberValue);
38
- } else {
39
- updateValue(null);
40
- }
41
- }
42
-
43
- }, [internalValue, value]);
44
- useDebouncedCallback(internalValue, doUpdate, !focused, 400);
45
- useEffect(
46
- () => {
47
- if (!focused && propStringValue !== internalValue)
48
- setInternalValue(value !== undefined && value !== null ? value.toString() : null);
49
- },
50
- [value, focused]
51
- );
52
-
53
- const inputRef = React.useRef<HTMLInputElement>(null);
54
-
55
- useEffect(() => {
56
- if (inputRef.current && focused) {
57
- inputRef.current.focus({ preventScroll: true });
58
- }
59
- }, [focused, inputRef]);
60
-
61
- const regexp = /^-?[0-9]+[,.]?[0-9]*$/;
62
-
63
- return (
64
- <TextField
65
- inputRef={inputRef}
66
- invisible={true}
67
- size="small"
68
- className="w-full"
69
- inputClassName={cls("p-0 m-0 bg-transparent border-none outline-hidden font-normal leading-normal text-unset", focusedDisabled)}
70
- inputStyle={{
71
- textAlign: align
72
- }}
73
- value={internalValue ?? ""}
74
- onChange={(evt) => {
75
- const newValue = evt.target.value.replace(",", ".");
76
- if (newValue.length === 0)
77
- setInternalValue(null);
78
- if (regexp.test(newValue) || newValue.startsWith("-"))
79
- setInternalValue(newValue);
80
- }}
81
- />
82
- );
83
- }
@@ -1,32 +0,0 @@
1
- import React, { useEffect } from "react";
2
- import { BooleanSwitch } from "@rebasepro/ui";
3
-
4
- export function VirtualTableSwitch(props: {
5
- error: Error | undefined;
6
- internalValue?: boolean;
7
- focused: boolean;
8
- disabled: boolean;
9
- updateValue: (newValue: (boolean | null)) => void;
10
- }) {
11
- const {
12
- internalValue,
13
- updateValue,
14
- focused
15
- } = props;
16
- const ref = React.useRef<HTMLButtonElement>(null);
17
-
18
- useEffect(() => {
19
- if (ref.current && focused) {
20
- ref.current.focus({ preventScroll: true });
21
- }
22
- }, [focused, ref]);
23
-
24
- return (
25
- <BooleanSwitch
26
- ref={ref}
27
- size={"small"}
28
- value={Boolean(internalValue)}
29
- onValueChange={updateValue}
30
- />
31
- );
32
- }