@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.
package/dist/index.es.js CHANGED
@@ -3,7 +3,7 @@ import { Alert, AlertCircleIcon, AlertTriangleIcon, AppWindow, ArrowLeftIcon, Av
3
3
  import { DEFAULT_DATA_SOURCE_KEY, DEFAULT_STORAGE_SOURCE_KEY, EntityReference, EntityRelation, GeoPoint, RebaseApiError, Vector, isLazyComponentRef } from "@rebasepro/types";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
6
- import { buildRebaseData, canCreateEntity, canDeleteEntity, canEditEntity, canReadCollection, getLabelOrConfigFrom, getSubcollections, isPropertyBuilder, removeInitialAndTrailingSlashes, resolveStorageFilenameString, resolveStoragePathString, resolveStorageSource, stripCollectionPath, wrapAsEntityData, wrapAsSdkData } from "@rebasepro/common";
6
+ import { buildRebaseData, canCreateEntity, canDeleteEntity, canEditEntity, canReadCollection, getLabelOrConfigFrom, getSubcollections, getTitlePropertyKey, isPropertyBuilder, removeInitialAndTrailingSlashes, resolveStorageFilenameString, resolveStoragePathString, resolveStorageSource, stripCollectionPath, wrapAsEntityData, wrapAsSdkData } from "@rebasepro/common";
7
7
  import { Link, RouterProvider, Routes, createBrowserRouter, useBlocker, useLocation } from "react-router-dom";
8
8
  import { hashString, isObject, isPlainObject, mergeDeep, randomString, slugify } from "@rebasepro/utils";
9
9
  import { I18nextProvider, initReactI18next, useTranslation as useTranslation$1 } from "react-i18next";
@@ -472,29 +472,13 @@ function getRelationIncludeParams(collection) {
472
472
  if (!collection.properties) return void 0;
473
473
  return Object.values(collection.properties).some((property) => property && !isPropertyBuilder(property) && (isRelationProperty(property) || isReferenceProperty(property))) ? INCLUDE_ALL_RELATIONS : void 0;
474
474
  }
475
+ /**
476
+ * The property that fills the title slot for a collection. Ranking lives in
477
+ * `@rebasepro/common`, shared with the admin package so both agree on what an
478
+ * entity is called.
479
+ */
475
480
  function getEntityTitlePropertyKey(collection, propertyConfigs) {
476
- if (collection.titleProperty) return collection.titleProperty;
477
- const orderToSearch = collection.propertiesOrder || Object.keys(collection.properties);
478
- let firstStringCandidate;
479
- for (const key of orderToSearch) {
480
- const property = collection.properties[key];
481
- if (property && !isPropertyBuilder(property)) {
482
- const prop = property;
483
- if (isHiddenProperty(prop)) continue;
484
- if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
485
- if (!firstStringCandidate) firstStringCandidate = key;
486
- const lowerKey = key.toLowerCase();
487
- if ([
488
- "name",
489
- "title",
490
- "label",
491
- "displayname",
492
- "username"
493
- ].includes(lowerKey)) return key;
494
- }
495
- }
496
- }
497
- return firstStringCandidate;
481
+ return getTitlePropertyKey(collection);
498
482
  }
499
483
  //#endregion
500
484
  //#region src/hooks/data/useCollection.tsx