@rebasepro/app 0.10.0 → 0.10.1-canary.14e53ae

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.
@@ -10,4 +10,9 @@ export declare function getEntityPreviewKeys(authController: AuthController, tar
10
10
  * realtime-less deployment rendering the same cells as a realtime one.
11
11
  */
12
12
  export declare function getRelationIncludeParams(collection: CollectionConfig<any>): string[] | undefined;
13
+ /**
14
+ * The property that fills the title slot for a collection. Ranking lives in
15
+ * `@rebasepro/common`, shared with the admin package so both agree on what an
16
+ * entity is called.
17
+ */
13
18
  export declare function getEntityTitlePropertyKey<M extends Record<string, any>>(collection: CollectionConfig<M>, propertyConfigs: Record<string, PropertyConfig>): string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/app",
3
3
  "type": "module",
4
- "version": "0.10.0",
4
+ "version": "0.10.1-canary.14e53ae",
5
5
  "description": "Rebase core — framework-agnostic runtime for data-driven admin panels",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/rebaseco"
@@ -52,11 +52,11 @@
52
52
  "magic-string": "^0.30.0",
53
53
  "notistack": "^3.0.2",
54
54
  "react-i18next": "^17.0.8",
55
- "@rebasepro/common": "0.10.0",
56
- "@rebasepro/types": "0.10.0",
57
- "@rebasepro/forms": "0.10.0",
58
- "@rebasepro/ui": "0.10.0",
59
- "@rebasepro/utils": "0.10.0"
55
+ "@rebasepro/forms": "0.10.1-canary.14e53ae",
56
+ "@rebasepro/common": "0.10.1-canary.14e53ae",
57
+ "@rebasepro/types": "0.10.1-canary.14e53ae",
58
+ "@rebasepro/utils": "0.10.1-canary.14e53ae",
59
+ "@rebasepro/ui": "0.10.1-canary.14e53ae"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": ">=19.0.0",
@@ -1,6 +1,6 @@
1
1
  import type { CollectionConfig, Property, PropertyConfig } from "@rebasepro/types";
2
2
  import { AuthController } from "@rebasepro/types";
3
- import { isPropertyBuilder } from "@rebasepro/common";
3
+ import { getTitlePropertyKey, isPropertyBuilder } from "@rebasepro/common";
4
4
 
5
5
  function isReferenceProperty(property: Property) {
6
6
  if (!property) return null;
@@ -94,32 +94,12 @@ export function getRelationIncludeParams(collection: CollectionConfig<any>): str
94
94
  return hasRelations ? INCLUDE_ALL_RELATIONS : undefined;
95
95
  }
96
96
 
97
+ /**
98
+ * The property that fills the title slot for a collection. Ranking lives in
99
+ * `@rebasepro/common`, shared with the admin package so both agree on what an
100
+ * entity is called.
101
+ */
97
102
  export function getEntityTitlePropertyKey<M extends Record<string, any>>(collection: CollectionConfig<M>, propertyConfigs: Record<string, PropertyConfig>): string | undefined {
98
- if (collection.titleProperty) {
99
- return collection.titleProperty as string;
100
- }
101
-
102
- const orderToSearch = (collection.propertiesOrder as string[]) || Object.keys(collection.properties);
103
- let firstStringCandidate: string | undefined;
104
-
105
- for (const key of orderToSearch) {
106
- const property = collection.properties[key];
107
- if (property && !isPropertyBuilder(property)) {
108
- const prop = property as Property;
109
- if (isHiddenProperty(prop)) {
110
- continue;
111
- }
112
- if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
113
- if (!firstStringCandidate) {
114
- firstStringCandidate = key;
115
- }
116
- const lowerKey = key.toLowerCase();
117
- if (["name", "title", "label", "displayname", "username"].includes(lowerKey)) {
118
- return key; // Immediate return if it's a strong title candidate
119
- }
120
- }
121
- }
122
- }
123
- return firstStringCandidate;
103
+ return getTitlePropertyKey(collection as CollectionConfig<Record<string, unknown>>);
124
104
  }
125
105