@rebasepro/app 0.9.1-canary.fd3754b → 0.9.1-canary.ff338b5
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/auth/index.d.ts +6 -5
- package/dist/contexts/CollectionResolverContext.d.ts +23 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/index.es.js +152 -102
- package/dist/index.es.js.map +1 -1
- package/dist/util/previews.d.ts +9 -0
- package/package.json +14 -21
- package/src/auth/index.ts +6 -5
- package/src/components/LoginView/LoginView.tsx +7 -2
- package/src/components/common/useDataTableController.tsx +8 -2
- package/src/contexts/CollectionResolverContext.tsx +24 -0
- package/src/contexts/index.ts +1 -0
- package/src/core/Rebase.tsx +20 -5
- package/src/hooks/data/useCollection.tsx +2 -4
- package/src/hooks/data/useRelationSelector.tsx +10 -3
- package/src/util/previews.ts +20 -0
- package/dist/index.umd.js +0 -17021
- package/dist/index.umd.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Authentication controller for Rebase frontends.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* for communicating with a Rebase backend's JWT auth endpoints.
|
|
4
|
+
* Provides the `useRebaseAuthController` hook and API utilities for
|
|
5
|
+
* communicating with a Rebase backend's JWT auth endpoints.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* The generic LoginView and RebaseAuth components that render on top of this
|
|
8
|
+
* controller are in `../components`. Both are re-exported from the package
|
|
9
|
+
* root, which is where applications should import them from.
|
|
9
10
|
*/
|
|
10
11
|
export type { RebaseAuthController, RebaseAuthControllerProps, AuthTokens, DeviceSession, UserInfo, AuthResponse, RefreshResponse } from "./types";
|
|
11
12
|
export { useRebaseAuthController } from "./useRebaseAuthController";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Look up a collection's config by slug.
|
|
4
|
+
*/
|
|
5
|
+
export type CollectionResolver = (slug: string) => {
|
|
6
|
+
properties?: Record<string, unknown>;
|
|
7
|
+
} | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Lets the layer that owns the collections hand a resolver *up* to the data
|
|
10
|
+
* layer, which needs a collection's primary keys to give its rows an address.
|
|
11
|
+
*
|
|
12
|
+
* The inversion is forced by the composition: `<Rebase client>` builds the data
|
|
13
|
+
* layer, and `<RebaseAdmin collections>` sits inside it — so the collections are
|
|
14
|
+
* not in scope where the data is created, and `Rebase` cannot take them as a
|
|
15
|
+
* prop without giving every headless BaaS app a collections argument it has no
|
|
16
|
+
* use for.
|
|
17
|
+
*
|
|
18
|
+
* Registration is a ref write, so it is safe to call during render — and it has
|
|
19
|
+
* to be. The views that fetch rows are *below* the registrar, and child effects
|
|
20
|
+
* run before parent effects, so registering in an effect would bind after the
|
|
21
|
+
* first page of rows had already been converted.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CollectionResolverRegistrationContext: React.Context<(resolver: CollectionResolver | undefined) => void>;
|
package/dist/contexts/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -296,6 +296,24 @@ function CollectionScopeProvider({ collection, children }) {
|
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
//#endregion
|
|
299
|
+
//#region src/contexts/CollectionResolverContext.tsx
|
|
300
|
+
/**
|
|
301
|
+
* Lets the layer that owns the collections hand a resolver *up* to the data
|
|
302
|
+
* layer, which needs a collection's primary keys to give its rows an address.
|
|
303
|
+
*
|
|
304
|
+
* The inversion is forced by the composition: `<Rebase client>` builds the data
|
|
305
|
+
* layer, and `<RebaseAdmin collections>` sits inside it — so the collections are
|
|
306
|
+
* not in scope where the data is created, and `Rebase` cannot take them as a
|
|
307
|
+
* prop without giving every headless BaaS app a collections argument it has no
|
|
308
|
+
* use for.
|
|
309
|
+
*
|
|
310
|
+
* Registration is a ref write, so it is safe to call during render — and it has
|
|
311
|
+
* to be. The views that fetch rows are *below* the registrar, and child effects
|
|
312
|
+
* run before parent effects, so registering in an effect would bind after the
|
|
313
|
+
* first page of rows had already been converted.
|
|
314
|
+
*/
|
|
315
|
+
var CollectionResolverRegistrationContext = React.createContext(() => void 0);
|
|
316
|
+
//#endregion
|
|
299
317
|
//#region src/hooks/data/useData.tsx
|
|
300
318
|
/**
|
|
301
319
|
* Use this hook to access the unified data API.
|
|
@@ -391,6 +409,94 @@ function SchemaDriftBanner({ className }) {
|
|
|
391
409
|
});
|
|
392
410
|
}
|
|
393
411
|
//#endregion
|
|
412
|
+
//#region src/util/previews.ts
|
|
413
|
+
function isReferenceProperty(property) {
|
|
414
|
+
if (!property) return null;
|
|
415
|
+
if (property.type === "reference") return true;
|
|
416
|
+
if (property.type === "array") if (Array.isArray(property.of)) return false;
|
|
417
|
+
else return property.of?.type === "reference";
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
function isRelationProperty(property) {
|
|
421
|
+
if (!property) return null;
|
|
422
|
+
if (property.type === "relation") return true;
|
|
423
|
+
if (property.type === "array") if (Array.isArray(property.of)) return false;
|
|
424
|
+
else return property.of?.type === "relation";
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
function isHiddenProperty(property) {
|
|
428
|
+
if (!property) return false;
|
|
429
|
+
return Boolean(property.ui?.hideFromCollection);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Returns true when the property holds file-storage content (single image,
|
|
433
|
+
* array of images, generic upload, …). These properties are rendered by the
|
|
434
|
+
* dedicated image-slot and should NOT appear as regular preview columns.
|
|
435
|
+
*/
|
|
436
|
+
function isStorageProperty(property) {
|
|
437
|
+
if (!property) return false;
|
|
438
|
+
if (property.type === "string" && property.storage) return true;
|
|
439
|
+
if (property.type === "string" && property.ui?.url === "image") return true;
|
|
440
|
+
if (property.type === "array" && property.of && !Array.isArray(property.of)) {
|
|
441
|
+
const inner = property.of;
|
|
442
|
+
if (inner.type === "string" && (inner.storage || inner.ui?.url === "image")) return true;
|
|
443
|
+
}
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
function getEntityPreviewKeys(authController, targetCollection, fields, previewProperties, limit = 3) {
|
|
447
|
+
const allProperties = Object.keys(targetCollection.properties);
|
|
448
|
+
let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
|
|
449
|
+
if (!listProperties && targetCollection.previewProperties) listProperties = targetCollection.previewProperties?.filter((p) => allProperties.includes(p));
|
|
450
|
+
if (listProperties && listProperties.length > 0) return listProperties;
|
|
451
|
+
else {
|
|
452
|
+
listProperties = targetCollection.propertiesOrder || allProperties;
|
|
453
|
+
return listProperties.filter((key) => {
|
|
454
|
+
const prop = targetCollection.properties[key];
|
|
455
|
+
return !(prop && typeof prop === "object" && "isId" in prop && Boolean(prop.isId)) && key !== "id";
|
|
456
|
+
}).filter((key) => {
|
|
457
|
+
const property = targetCollection.properties[key];
|
|
458
|
+
return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property) && !isStorageProperty(property);
|
|
459
|
+
}).slice(0, limit);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
var INCLUDE_ALL_RELATIONS = ["*"];
|
|
463
|
+
/**
|
|
464
|
+
* The `include` params that eager-load a collection's relations in the same
|
|
465
|
+
* request as its rows, so previews never fetch once per relation cell.
|
|
466
|
+
*
|
|
467
|
+
* Only the REST transport reads `include`; the realtime transport embeds
|
|
468
|
+
* relation data unconditionally and ignores it. Passing it either way keeps a
|
|
469
|
+
* realtime-less deployment rendering the same cells as a realtime one.
|
|
470
|
+
*/
|
|
471
|
+
function getRelationIncludeParams(collection) {
|
|
472
|
+
if (!collection.properties) return void 0;
|
|
473
|
+
return Object.values(collection.properties).some((property) => property && !isPropertyBuilder(property) && (isRelationProperty(property) || isReferenceProperty(property))) ? INCLUDE_ALL_RELATIONS : void 0;
|
|
474
|
+
}
|
|
475
|
+
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;
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
394
500
|
//#region src/hooks/data/useCollection.tsx
|
|
395
501
|
/**
|
|
396
502
|
* This hook is used to fetch collections using a given collection
|
|
@@ -435,7 +541,7 @@ function useCollection({ path, collection, filterValues, sortBy, itemCount, offs
|
|
|
435
541
|
if (isSchemaDriftError(error)) reportSchemaDrift(error.message);
|
|
436
542
|
};
|
|
437
543
|
const accessor = dataClient.collection(path);
|
|
438
|
-
const includeParams =
|
|
544
|
+
const includeParams = getRelationIncludeParams(collection);
|
|
439
545
|
if (accessor.listen) return accessor.listen({
|
|
440
546
|
where: whereParams,
|
|
441
547
|
limit: itemCount,
|
|
@@ -810,6 +916,7 @@ function useRelationSelector({ path, collection, fixedFilter, pageSize = DEFAULT
|
|
|
810
916
|
unsubscribeRef.current = null;
|
|
811
917
|
}
|
|
812
918
|
}, []);
|
|
919
|
+
const includeParams = getRelationIncludeParams(collection);
|
|
813
920
|
const fetchData = useCallback(() => {
|
|
814
921
|
cleanupSubscription();
|
|
815
922
|
setError(void 0);
|
|
@@ -831,7 +938,8 @@ function useRelationSelector({ path, collection, fixedFilter, pageSize = DEFAULT
|
|
|
831
938
|
where: whereParams,
|
|
832
939
|
limit,
|
|
833
940
|
orderBy: void 0,
|
|
834
|
-
searchString: currentSearch
|
|
941
|
+
searchString: currentSearch,
|
|
942
|
+
include: includeParams
|
|
835
943
|
}, (res) => onEntitiesUpdate({
|
|
836
944
|
data: res.data,
|
|
837
945
|
meta: res.meta
|
|
@@ -842,7 +950,8 @@ function useRelationSelector({ path, collection, fixedFilter, pageSize = DEFAULT
|
|
|
842
950
|
limit,
|
|
843
951
|
offset: 0,
|
|
844
952
|
orderBy: void 0,
|
|
845
|
-
searchString: currentSearch
|
|
953
|
+
searchString: currentSearch,
|
|
954
|
+
include: includeParams
|
|
846
955
|
}).then((res) => onEntitiesUpdate({
|
|
847
956
|
data: res.data,
|
|
848
957
|
meta: res.meta
|
|
@@ -858,7 +967,8 @@ function useRelationSelector({ path, collection, fixedFilter, pageSize = DEFAULT
|
|
|
858
967
|
currentSearch,
|
|
859
968
|
entityToRelationItem,
|
|
860
969
|
cleanupSubscription,
|
|
861
|
-
setLoading
|
|
970
|
+
setLoading,
|
|
971
|
+
includeParams
|
|
862
972
|
]);
|
|
863
973
|
const search = useCallback((searchString) => {
|
|
864
974
|
if (searchTimeoutRef.current) clearTimeout(searchTimeoutRef.current);
|
|
@@ -2347,18 +2457,21 @@ function useDataTableController({ path, collection, scrollRestoration, entitiesD
|
|
|
2347
2457
|
const whereParams = filterValues && Object.keys(filterValues).length > 0 ? filterValues : void 0;
|
|
2348
2458
|
const orderByParams = sortBy ? [String(sortBy[0]), sortBy[1]] : void 0;
|
|
2349
2459
|
let unsubscribe;
|
|
2460
|
+
const includeParams = getRelationIncludeParams(collection);
|
|
2350
2461
|
if (accessor.listen) unsubscribe = accessor.listen({
|
|
2351
2462
|
where: whereParams,
|
|
2352
2463
|
limit: itemCount,
|
|
2353
2464
|
orderBy: orderByParams,
|
|
2354
|
-
searchString
|
|
2465
|
+
searchString,
|
|
2466
|
+
include: includeParams
|
|
2355
2467
|
}, (res) => onEntitiesUpdate(res.data), onError);
|
|
2356
2468
|
else {
|
|
2357
2469
|
accessor.find({
|
|
2358
2470
|
where: whereParams,
|
|
2359
2471
|
limit: itemCount,
|
|
2360
2472
|
orderBy: orderByParams,
|
|
2361
|
-
searchString
|
|
2473
|
+
searchString,
|
|
2474
|
+
include: includeParams
|
|
2362
2475
|
}).then((res) => onEntitiesUpdate(res.data)).catch(onError);
|
|
2363
2476
|
unsubscribe = () => void 0;
|
|
2364
2477
|
}
|
|
@@ -9080,10 +9193,10 @@ function LoginForm({ onClose, onForgotPassword, authController, registrationMode
|
|
|
9080
9193
|
};
|
|
9081
9194
|
}, [onClose]);
|
|
9082
9195
|
function handleEnterPassword() {
|
|
9083
|
-
if (email && password && authController.emailPasswordLogin) authController.emailPasswordLogin(email, password);
|
|
9196
|
+
if (email && password && authController.emailPasswordLogin) Promise.resolve(authController.emailPasswordLogin(email, password)).catch(() => void 0);
|
|
9084
9197
|
}
|
|
9085
9198
|
function handleRegistration() {
|
|
9086
|
-
if (email && password && authController.register) authController.register(email, password, displayName);
|
|
9199
|
+
if (email && password && authController.register) Promise.resolve(authController.register(email, password, displayName)).catch(() => void 0);
|
|
9087
9200
|
}
|
|
9088
9201
|
const handleSubmit = (event) => {
|
|
9089
9202
|
event.preventDefault();
|
|
@@ -15337,6 +15450,11 @@ function Rebase(props) {
|
|
|
15337
15450
|
const normalizedDataSources = useMemo(() => {
|
|
15338
15451
|
return dataSourcesProp ?? [];
|
|
15339
15452
|
}, [dataSourcesProp]);
|
|
15453
|
+
const collectionResolverRef = useRef(void 0);
|
|
15454
|
+
const registerCollectionResolver = React.useCallback((resolver) => {
|
|
15455
|
+
collectionResolverRef.current = resolver;
|
|
15456
|
+
}, []);
|
|
15457
|
+
const entityDataOptions = useMemo(() => ({ resolveCollection: (slug) => collectionResolverRef.current?.(slug) }), []);
|
|
15340
15458
|
const dataSourcesRef = useRef(null);
|
|
15341
15459
|
const dataSourcesValue = useMemo(() => {
|
|
15342
15460
|
const sig = normalizedDataSources.map((d) => ({
|
|
@@ -15355,7 +15473,7 @@ function Rebase(props) {
|
|
|
15355
15473
|
...definition,
|
|
15356
15474
|
transport: ds.transport ?? (driver ? "direct" : "server")
|
|
15357
15475
|
};
|
|
15358
|
-
if (driver) sources[ds.key] = buildRebaseData(driver);
|
|
15476
|
+
if (driver) sources[ds.key] = buildRebaseData(driver, entityDataOptions);
|
|
15359
15477
|
}
|
|
15360
15478
|
const value = {
|
|
15361
15479
|
registry,
|
|
@@ -15366,16 +15484,20 @@ function Rebase(props) {
|
|
|
15366
15484
|
value
|
|
15367
15485
|
};
|
|
15368
15486
|
return value;
|
|
15369
|
-
}, [normalizedDataSources]);
|
|
15487
|
+
}, [normalizedDataSources, entityDataOptions]);
|
|
15370
15488
|
const resolvedData = useMemo(() => {
|
|
15371
15489
|
const registeredDefault = dataSourcesValue.sources[DEFAULT_DATA_SOURCE_KEY];
|
|
15372
15490
|
if (registeredDefault) return registeredDefault;
|
|
15373
|
-
if (client?.data) return wrapAsEntityData(client.data);
|
|
15491
|
+
if (client?.data) return wrapAsEntityData(client.data, entityDataOptions);
|
|
15374
15492
|
const built = Object.values(dataSourcesValue.sources);
|
|
15375
15493
|
if (built.length === 1) return built[0];
|
|
15376
15494
|
if (built.length > 1) throw new Error("[Rebase] Several data sources are registered but none is the default. Pass a `client`, or key one `dataSources` entry \"(default)\".");
|
|
15377
15495
|
throw new Error("Rebase requires either `client` or a `dataSources` entry with a driver to be provided");
|
|
15378
|
-
}, [
|
|
15496
|
+
}, [
|
|
15497
|
+
client,
|
|
15498
|
+
dataSourcesValue,
|
|
15499
|
+
entityDataOptions
|
|
15500
|
+
]);
|
|
15379
15501
|
const resolvedStorage = storageSourceProp ?? client?.storage;
|
|
15380
15502
|
const [remoteStorageSources, setRemoteStorageSources] = useState([]);
|
|
15381
15503
|
const authUser = authController.user;
|
|
@@ -15520,20 +15642,23 @@ function Rebase(props) {
|
|
|
15520
15642
|
value: storageSourcesValue,
|
|
15521
15643
|
children: /* @__PURE__ */ jsx(StorageSourceContext.Provider, {
|
|
15522
15644
|
value: resolvedStorage,
|
|
15523
|
-
children: /* @__PURE__ */ jsx(
|
|
15524
|
-
value:
|
|
15525
|
-
children: /* @__PURE__ */ jsx(
|
|
15526
|
-
value:
|
|
15527
|
-
children: /* @__PURE__ */ jsx(
|
|
15528
|
-
value:
|
|
15529
|
-
children: /* @__PURE__ */ jsx(
|
|
15530
|
-
value:
|
|
15531
|
-
children: /* @__PURE__ */ jsx(
|
|
15532
|
-
value:
|
|
15533
|
-
children: /* @__PURE__ */ jsx(
|
|
15534
|
-
|
|
15535
|
-
children
|
|
15536
|
-
|
|
15645
|
+
children: /* @__PURE__ */ jsx(CollectionResolverRegistrationContext.Provider, {
|
|
15646
|
+
value: registerCollectionResolver,
|
|
15647
|
+
children: /* @__PURE__ */ jsx(DataSourcesContext.Provider, {
|
|
15648
|
+
value: dataSourcesValue,
|
|
15649
|
+
children: /* @__PURE__ */ jsx(RebaseDataContext.Provider, {
|
|
15650
|
+
value: resolvedData,
|
|
15651
|
+
children: /* @__PURE__ */ jsx(DatabaseAdminContext.Provider, {
|
|
15652
|
+
value: resolvedDatabaseAdmin,
|
|
15653
|
+
children: /* @__PURE__ */ jsx(AuthControllerContext.Provider, {
|
|
15654
|
+
value: authController,
|
|
15655
|
+
children: /* @__PURE__ */ jsx(EffectiveRoleControllerContext.Provider, {
|
|
15656
|
+
value: activeEffectiveRoleController,
|
|
15657
|
+
children: /* @__PURE__ */ jsx(DialogsProvider, { children: /* @__PURE__ */ jsx(SchemaDriftProvider, { children: /* @__PURE__ */ jsx(RebaseRegistryProvider, { children: /* @__PURE__ */ jsx(RebaseInternal, {
|
|
15658
|
+
loading,
|
|
15659
|
+
children
|
|
15660
|
+
}) }) }) })
|
|
15661
|
+
})
|
|
15537
15662
|
})
|
|
15538
15663
|
})
|
|
15539
15664
|
})
|
|
@@ -16470,81 +16595,6 @@ async function resizeImage(file, imageResize) {
|
|
|
16470
16595
|
});
|
|
16471
16596
|
}
|
|
16472
16597
|
//#endregion
|
|
16473
|
-
//#region src/util/previews.ts
|
|
16474
|
-
function isReferenceProperty(property) {
|
|
16475
|
-
if (!property) return null;
|
|
16476
|
-
if (property.type === "reference") return true;
|
|
16477
|
-
if (property.type === "array") if (Array.isArray(property.of)) return false;
|
|
16478
|
-
else return property.of?.type === "reference";
|
|
16479
|
-
return false;
|
|
16480
|
-
}
|
|
16481
|
-
function isRelationProperty(property) {
|
|
16482
|
-
if (!property) return null;
|
|
16483
|
-
if (property.type === "relation") return true;
|
|
16484
|
-
if (property.type === "array") if (Array.isArray(property.of)) return false;
|
|
16485
|
-
else return property.of?.type === "relation";
|
|
16486
|
-
return false;
|
|
16487
|
-
}
|
|
16488
|
-
function isHiddenProperty(property) {
|
|
16489
|
-
if (!property) return false;
|
|
16490
|
-
return Boolean(property.ui?.hideFromCollection);
|
|
16491
|
-
}
|
|
16492
|
-
/**
|
|
16493
|
-
* Returns true when the property holds file-storage content (single image,
|
|
16494
|
-
* array of images, generic upload, …). These properties are rendered by the
|
|
16495
|
-
* dedicated image-slot and should NOT appear as regular preview columns.
|
|
16496
|
-
*/
|
|
16497
|
-
function isStorageProperty(property) {
|
|
16498
|
-
if (!property) return false;
|
|
16499
|
-
if (property.type === "string" && property.storage) return true;
|
|
16500
|
-
if (property.type === "string" && property.ui?.url === "image") return true;
|
|
16501
|
-
if (property.type === "array" && property.of && !Array.isArray(property.of)) {
|
|
16502
|
-
const inner = property.of;
|
|
16503
|
-
if (inner.type === "string" && (inner.storage || inner.ui?.url === "image")) return true;
|
|
16504
|
-
}
|
|
16505
|
-
return false;
|
|
16506
|
-
}
|
|
16507
|
-
function getEntityPreviewKeys(authController, targetCollection, fields, previewProperties, limit = 3) {
|
|
16508
|
-
const allProperties = Object.keys(targetCollection.properties);
|
|
16509
|
-
let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
|
|
16510
|
-
if (!listProperties && targetCollection.previewProperties) listProperties = targetCollection.previewProperties?.filter((p) => allProperties.includes(p));
|
|
16511
|
-
if (listProperties && listProperties.length > 0) return listProperties;
|
|
16512
|
-
else {
|
|
16513
|
-
listProperties = targetCollection.propertiesOrder || allProperties;
|
|
16514
|
-
return listProperties.filter((key) => {
|
|
16515
|
-
const prop = targetCollection.properties[key];
|
|
16516
|
-
return !(prop && typeof prop === "object" && "isId" in prop && Boolean(prop.isId)) && key !== "id";
|
|
16517
|
-
}).filter((key) => {
|
|
16518
|
-
const property = targetCollection.properties[key];
|
|
16519
|
-
return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property) && !isStorageProperty(property);
|
|
16520
|
-
}).slice(0, limit);
|
|
16521
|
-
}
|
|
16522
|
-
}
|
|
16523
|
-
function getEntityTitlePropertyKey(collection, propertyConfigs) {
|
|
16524
|
-
if (collection.titleProperty) return collection.titleProperty;
|
|
16525
|
-
const orderToSearch = collection.propertiesOrder || Object.keys(collection.properties);
|
|
16526
|
-
let firstStringCandidate;
|
|
16527
|
-
for (const key of orderToSearch) {
|
|
16528
|
-
const property = collection.properties[key];
|
|
16529
|
-
if (property && !isPropertyBuilder(property)) {
|
|
16530
|
-
const prop = property;
|
|
16531
|
-
if (isHiddenProperty(prop)) continue;
|
|
16532
|
-
if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
|
|
16533
|
-
if (!firstStringCandidate) firstStringCandidate = key;
|
|
16534
|
-
const lowerKey = key.toLowerCase();
|
|
16535
|
-
if ([
|
|
16536
|
-
"name",
|
|
16537
|
-
"title",
|
|
16538
|
-
"label",
|
|
16539
|
-
"displayname",
|
|
16540
|
-
"username"
|
|
16541
|
-
].includes(lowerKey)) return key;
|
|
16542
|
-
}
|
|
16543
|
-
}
|
|
16544
|
-
}
|
|
16545
|
-
return firstStringCandidate;
|
|
16546
|
-
}
|
|
16547
|
-
//#endregion
|
|
16548
16598
|
//#region src/util/enums.ts
|
|
16549
16599
|
function getColorScheme(enumValues, key) {
|
|
16550
16600
|
const labelOrConfig = getLabelOrConfigFrom(enumValues, key);
|
|
@@ -16838,6 +16888,6 @@ function useBridgeRegistration(key, value) {
|
|
|
16838
16888
|
]);
|
|
16839
16889
|
}
|
|
16840
16890
|
//#endregion
|
|
16841
|
-
export { ADDITIONAL_TAB_WIDTH, AIIcon, AIModifiedIndicator, AdminModeControllerContext, AdminModeControllerProvider, AnalyticsContext, ApiConfigProvider, AuthApiError, AuthControllerContext, CONTAINER_FULL_WIDTH, CollectionComponentOverrideProvider, CollectionScopeContext, CollectionScopeProvider, ComponentOverrideContext, ConfirmationDialog, CrmDashboardDemo, CustomizationControllerContext, DEFAULT_PAGE_SIZE, DataDriverContext, DataSourcesContext, DialogsControllerContext, DialogsProvider, EffectiveRoleControllerContext, EffectiveRoleControllerProvider, ErrorTooltip, ErrorView, FORM_CONTAINER_WIDTH, GlobalComponentOverrideProvider, IconForView, LanguageToggle, LoginView, ModeControllerContext, ModeControllerProvider, NotFoundPage, PluginProviderStack, REBASE_LOCALE_STORAGE_KEY, Rebase, RebaseAuth, RebaseClientInstanceContext, RebaseDataContext, RebaseI18nProvider, RebaseLogo, RebaseRegistryProvider, RebaseRouter, RebaseRoutes, STUDIO_NAVIGATION_GROUPS, SchemaDriftBanner, SchemaDriftProvider, SnackbarProvider, StorageSourceContext, StorageSourcesContext, StudioBridgeContext, StudioBridgeProvider, StudioBridgeRegistryContext, StudioBridgeRegistryProvider, UIReferenceView, UIStyleGuide, UnsavedChangesDialog, UserConfigurationPersistenceContext, UserDisplay, UserSelectPopover, UserSettingsView, buildCollapsedDefaults, buildEnumLabel, clearAuthConfigCache, clearFetchCache, createAuthConfigCache, createFormexStub, deleteEntityWithCallbacks, en, es, fetchAuthConfig, flattenKeys, getColorScheme, getColumnKeysForProperty, getEntityFromCache, getEntityFromMemoryCache, getEntityPreviewKeys, getEntityTitlePropertyKey, getFormFieldKeys, getIcon, getRowHeight, getSubcollectionColumnId, iconsSearch, isEnumValueDisabled, isSchemaDriftError, populateFetchCache, removeEntityFromCache, removeEntityFromMemoryCache, resolveComponentRef, saveEntityToCache, saveEntityToMemoryCache, saveEntityWithCallbacks, useAdminModeController, useAnalyticsController, useApiConfig, useAuthController, useAuthSubscription, useBackendStorageSource, useBridgeRegistration, useBrowserTitleAndIcon, useBuildAdminModeController, useBuildEffectiveRoleController, useBuildLocalConfigurationPersistence, useBuildModeController, useClipboard, useCollapsedGroups, useCollection, useCollectionScope, useColumnIds, useComponentOverride, useCustomizationController, useData, useDataSources, useDataTableController, useDebouncedData, useDialogsController, useEffectiveRoleController, useFetch, useLargeLayout, useModeController, usePermissions, useRebaseAuthController, useRebaseClient, useRebaseContext, useRebaseRegistry, useRebaseRegistryDispatch, useRelationSelector, useResolvedComponent, useRestoreScroll, useSchemaDriftContext, useScrollRestoration, useSlot, useSnackbarController, useStorageSource, useStorageSources, useStorageUploadController, useStudioBreadcrumbs, useStudioCollectionRegistry, useStudioNavigationState, useStudioSidePanelController, useStudioUrlController, useTranslation, useUnsavedChangesDialog, useUserConfigurationPersistence };
|
|
16891
|
+
export { ADDITIONAL_TAB_WIDTH, AIIcon, AIModifiedIndicator, AdminModeControllerContext, AdminModeControllerProvider, AnalyticsContext, ApiConfigProvider, AuthApiError, AuthControllerContext, CONTAINER_FULL_WIDTH, CollectionComponentOverrideProvider, CollectionResolverRegistrationContext, CollectionScopeContext, CollectionScopeProvider, ComponentOverrideContext, ConfirmationDialog, CrmDashboardDemo, CustomizationControllerContext, DEFAULT_PAGE_SIZE, DataDriverContext, DataSourcesContext, DialogsControllerContext, DialogsProvider, EffectiveRoleControllerContext, EffectiveRoleControllerProvider, ErrorTooltip, ErrorView, FORM_CONTAINER_WIDTH, GlobalComponentOverrideProvider, IconForView, LanguageToggle, LoginView, ModeControllerContext, ModeControllerProvider, NotFoundPage, PluginProviderStack, REBASE_LOCALE_STORAGE_KEY, Rebase, RebaseAuth, RebaseClientInstanceContext, RebaseDataContext, RebaseI18nProvider, RebaseLogo, RebaseRegistryProvider, RebaseRouter, RebaseRoutes, STUDIO_NAVIGATION_GROUPS, SchemaDriftBanner, SchemaDriftProvider, SnackbarProvider, StorageSourceContext, StorageSourcesContext, StudioBridgeContext, StudioBridgeProvider, StudioBridgeRegistryContext, StudioBridgeRegistryProvider, UIReferenceView, UIStyleGuide, UnsavedChangesDialog, UserConfigurationPersistenceContext, UserDisplay, UserSelectPopover, UserSettingsView, buildCollapsedDefaults, buildEnumLabel, clearAuthConfigCache, clearFetchCache, createAuthConfigCache, createFormexStub, deleteEntityWithCallbacks, en, es, fetchAuthConfig, flattenKeys, getColorScheme, getColumnKeysForProperty, getEntityFromCache, getEntityFromMemoryCache, getEntityPreviewKeys, getEntityTitlePropertyKey, getFormFieldKeys, getIcon, getRelationIncludeParams, getRowHeight, getSubcollectionColumnId, iconsSearch, isEnumValueDisabled, isSchemaDriftError, populateFetchCache, removeEntityFromCache, removeEntityFromMemoryCache, resolveComponentRef, saveEntityToCache, saveEntityToMemoryCache, saveEntityWithCallbacks, useAdminModeController, useAnalyticsController, useApiConfig, useAuthController, useAuthSubscription, useBackendStorageSource, useBridgeRegistration, useBrowserTitleAndIcon, useBuildAdminModeController, useBuildEffectiveRoleController, useBuildLocalConfigurationPersistence, useBuildModeController, useClipboard, useCollapsedGroups, useCollection, useCollectionScope, useColumnIds, useComponentOverride, useCustomizationController, useData, useDataSources, useDataTableController, useDebouncedData, useDialogsController, useEffectiveRoleController, useFetch, useLargeLayout, useModeController, usePermissions, useRebaseAuthController, useRebaseClient, useRebaseContext, useRebaseRegistry, useRebaseRegistryDispatch, useRelationSelector, useResolvedComponent, useRestoreScroll, useSchemaDriftContext, useScrollRestoration, useSlot, useSnackbarController, useStorageSource, useStorageSources, useStorageUploadController, useStudioBreadcrumbs, useStudioCollectionRegistry, useStudioNavigationState, useStudioSidePanelController, useStudioUrlController, useTranslation, useUnsavedChangesDialog, useUserConfigurationPersistence };
|
|
16842
16892
|
|
|
16843
16893
|
//# sourceMappingURL=index.es.js.map
|