@rebasepro/plugin-data-enhancement 0.0.1-canary.f81da60 → 0.1.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.
- package/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
- package/dist/core/src/components/index.d.ts +1 -0
- package/dist/core/src/hooks/index.d.ts +1 -0
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
- package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/index.es.js +8 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +8 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/auth.d.ts +8 -2
- package/dist/types/src/controllers/client.d.ts +13 -0
- package/dist/types/src/controllers/navigation.d.ts +18 -6
- package/dist/types/src/controllers/registry.d.ts +9 -1
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
- package/dist/types/src/rebase_context.d.ts +17 -0
- package/dist/types/src/types/collections.d.ts +20 -1
- package/dist/types/src/types/component_ref.d.ts +47 -0
- package/dist/types/src/types/entity_views.d.ts +2 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/properties.d.ts +15 -3
- package/dist/types/src/types/translations.d.ts +2 -0
- package/dist/ui/src/components/SearchBar.d.ts +5 -1
- package/package.json +7 -7
- package/src/components/FormEnhanceAction.tsx +8 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ComponentRef } from "./component_ref";
|
|
2
2
|
import type { EntityReference, EntityRelation, EntityValues, GeoPoint, Entity } from "./entities";
|
|
3
3
|
import type { Relation, JoinStep, OnAction } from "./relations";
|
|
4
4
|
import type { EntityCollection, FilterValues } from "./collections";
|
|
@@ -104,8 +104,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
104
104
|
disabled?: boolean | PropertyDisabledConfig;
|
|
105
105
|
widthPercentage?: number;
|
|
106
106
|
customProps?: CustomProps;
|
|
107
|
-
Field?:
|
|
108
|
-
Preview?:
|
|
107
|
+
Field?: ComponentRef<any>;
|
|
108
|
+
Preview?: ComponentRef<any>;
|
|
109
109
|
}
|
|
110
110
|
export interface BaseProperty<CustomProps = unknown> {
|
|
111
111
|
ui?: BaseUIConfig<CustomProps>;
|
|
@@ -124,6 +124,18 @@ export interface BaseProperty<CustomProps = unknown> {
|
|
|
124
124
|
* overwritten by the current property config.
|
|
125
125
|
*/
|
|
126
126
|
propertyConfig?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Explicit database column name. When set, this value is used as-is
|
|
129
|
+
* for the SQL column name, bypassing any snake_case conversion of
|
|
130
|
+
* the property key.
|
|
131
|
+
*
|
|
132
|
+
* This is automatically populated by `rebase schema introspect`
|
|
133
|
+
* to guarantee an exact match with the live database schema.
|
|
134
|
+
*
|
|
135
|
+
* For manually-authored collections you can omit this — the framework
|
|
136
|
+
* will derive the column name from the property key via `toSnakeCase()`.
|
|
137
|
+
*/
|
|
138
|
+
columnName?: string;
|
|
127
139
|
/**
|
|
128
140
|
* Rules for validating this property
|
|
129
141
|
*/
|
|
@@ -51,6 +51,8 @@ export interface RebaseTranslations {
|
|
|
51
51
|
all_entries_loaded: string;
|
|
52
52
|
create_your_first_entry: string;
|
|
53
53
|
no_results_filter_sort: string;
|
|
54
|
+
/** Shown when a text search yields no results. Supports `{{search}}` interpolation. */
|
|
55
|
+
no_results_search?: string;
|
|
54
56
|
add: string;
|
|
55
57
|
remove: string;
|
|
56
58
|
copy_id: string;
|
|
@@ -17,6 +17,10 @@ interface SearchBarProps {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
loading?: boolean;
|
|
19
19
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
20
|
+
/**
|
|
21
|
+
* Optional initial value for the search input, e.g. from URL params.
|
|
22
|
+
*/
|
|
23
|
+
initialValue?: string;
|
|
20
24
|
}
|
|
21
|
-
export declare function SearchBar({ onClick, onTextSearch, placeholder, expandable, size, innerClassName, className, autoFocus, disabled, loading, inputRef }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function SearchBar({ onClick, onTextSearch, placeholder, expandable, size, innerClassName, className, autoFocus, disabled, loading, inputRef, initialValue }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
|
22
26
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/plugin-data-enhancement",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"react-compiler-runtime": "1.0.0",
|
|
20
|
-
"@rebasepro/
|
|
21
|
-
"@rebasepro/
|
|
22
|
-
"@rebasepro/
|
|
23
|
-
"@rebasepro/
|
|
24
|
-
"@rebasepro/ui": "0.
|
|
25
|
-
"@rebasepro/
|
|
20
|
+
"@rebasepro/admin": "0.1.0",
|
|
21
|
+
"@rebasepro/types": "0.1.0",
|
|
22
|
+
"@rebasepro/utils": "0.1.0",
|
|
23
|
+
"@rebasepro/common": "0.1.0",
|
|
24
|
+
"@rebasepro/ui": "0.1.0",
|
|
25
|
+
"@rebasepro/core": "0.1.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=19.0.0",
|
|
@@ -31,13 +31,11 @@ export function FormEnhanceAction({
|
|
|
31
31
|
const [samplePrompts, setSamplePrompts] = React.useState<SamplePrompt[] | undefined>(undefined);
|
|
32
32
|
const [instructions, setInstructions] = React.useState<string>("");
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
suggestions,
|
|
36
|
-
getSamplePrompts
|
|
37
|
-
} = dataEnhancementController;
|
|
34
|
+
const getSamplePrompts = dataEnhancementController?.getSamplePrompts;
|
|
38
35
|
|
|
39
36
|
const loadingPrompts = useRef(false);
|
|
40
37
|
const updateSuggestedPrompts = useCallback(async function updateSuggestedPrompts(instructions?: string) {
|
|
38
|
+
if (!getSamplePrompts) return;
|
|
41
39
|
if (loadingPrompts.current) return;
|
|
42
40
|
loadingPrompts.current = true;
|
|
43
41
|
const prompts = status === "new"
|
|
@@ -55,18 +53,20 @@ export function FormEnhanceAction({
|
|
|
55
53
|
// const enoughData = countStringCharacters(deferredValues, collection.properties) > 20;
|
|
56
54
|
|
|
57
55
|
useEffect(() => {
|
|
56
|
+
if (!dataEnhancementController) return;
|
|
58
57
|
if (!samplePrompts) {
|
|
59
58
|
setSamplePrompts(getRecentPromptsFromStorage(storageKey));
|
|
60
59
|
updateSuggestedPrompts().then();
|
|
61
60
|
}
|
|
62
|
-
}, [samplePrompts, storageKey, updateSuggestedPrompts, instructions, status]);
|
|
61
|
+
}, [dataEnhancementController, samplePrompts, storageKey, updateSuggestedPrompts, instructions, status]);
|
|
63
62
|
|
|
64
63
|
useEffect(() => {
|
|
64
|
+
if (!dataEnhancementController) return;
|
|
65
65
|
updateSuggestedPrompts().then();
|
|
66
|
-
}, [status]);
|
|
66
|
+
}, [dataEnhancementController, status]);
|
|
67
67
|
|
|
68
68
|
const enhance = (prompt?: string) => {
|
|
69
|
-
if (!formContext?.values) return;
|
|
69
|
+
if (!dataEnhancementController || !formContext?.values) return;
|
|
70
70
|
setLoading(true);
|
|
71
71
|
if (prompt) {
|
|
72
72
|
addRecentPrompt(storageKey, prompt);
|
|
@@ -88,6 +88,7 @@ export function FormEnhanceAction({
|
|
|
88
88
|
if (!dataEnhancementController?.enabled)
|
|
89
89
|
return null;
|
|
90
90
|
|
|
91
|
+
const suggestions = dataEnhancementController.suggestions;
|
|
91
92
|
const hasSuggestions = Object.values(suggestions).filter(Boolean).length > 0;
|
|
92
93
|
|
|
93
94
|
const disabledSuggestionActions = !hasSuggestions;
|