@rebasepro/plugin-data-enhancement 0.0.1-canary.f81da60 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import React from "react";
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?: React.ComponentType<any>;
108
- Preview?: React.ComponentType<any>;
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.0.1-canary.f81da60",
4
+ "version": "0.1.2",
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/common": "0.0.1-canary.f81da60",
21
- "@rebasepro/admin": "0.0.1-canary.f81da60",
22
- "@rebasepro/core": "0.0.1-canary.f81da60",
23
- "@rebasepro/types": "0.0.1-canary.f81da60",
24
- "@rebasepro/ui": "0.0.1-canary.f81da60",
25
- "@rebasepro/utils": "0.0.1-canary.f81da60"
20
+ "@rebasepro/core": "0.1.2",
21
+ "@rebasepro/admin": "0.1.2",
22
+ "@rebasepro/common": "0.1.2",
23
+ "@rebasepro/types": "0.1.2",
24
+ "@rebasepro/ui": "0.1.2",
25
+ "@rebasepro/utils": "0.1.2"
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;