@rebasepro/core 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.
- package/README.md +178 -110
- package/dist/components/BootstrapAdminBanner.d.ts +4 -0
- package/dist/components/LoginView/LoginView.d.ts +22 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useCollapsedGroups.d.ts +16 -1
- package/dist/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/index.es.js +214 -42
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +212 -40
- package/dist/index.umd.js.map +1 -1
- package/dist/vitePlugin.d.ts +28 -1
- package/dist/vitePlugin.js +42 -0
- package/package.json +6 -6
- package/src/components/BootstrapAdminBanner.tsx +66 -0
- package/src/components/LoginView/LoginView.tsx +48 -20
- package/src/components/common/useDataTableController.tsx +15 -3
- package/src/components/index.tsx +1 -1
- package/src/core/Rebase.tsx +20 -14
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useCollapsedGroups.ts +48 -6
- package/src/hooks/useRebaseContext.tsx +11 -6
- package/src/hooks/useResolvedComponent.tsx +157 -0
- package/src/locales/de.ts +1 -0
- package/src/locales/en.ts +1 -0
- package/src/locales/es.ts +1 -0
- package/src/locales/fr.ts +1 -0
- package/src/locales/hi.ts +1 -0
- package/src/locales/it.ts +1 -0
- package/src/locales/pt.ts +1 -0
- package/src/util/previews.ts +15 -6
- package/src/vitePlugin.ts +87 -1
package/dist/index.umd.js
CHANGED
|
@@ -367,6 +367,9 @@
|
|
|
367
367
|
const useAuthController = () => {
|
|
368
368
|
return React.useContext(AuthControllerContext);
|
|
369
369
|
};
|
|
370
|
+
function useRebaseClient() {
|
|
371
|
+
return React.useContext(RebaseClientInstanceContext);
|
|
372
|
+
}
|
|
370
373
|
const useStorageSource = (collection) => {
|
|
371
374
|
const defaultStorageSource = React.useContext(StorageSourceContext);
|
|
372
375
|
if (collection?.overrides?.storageSource) {
|
|
@@ -422,6 +425,7 @@
|
|
|
422
425
|
}
|
|
423
426
|
const DatabaseAdminContext = React.createContext(void 0);
|
|
424
427
|
const useRebaseContext = () => {
|
|
428
|
+
const client = useRebaseClient();
|
|
425
429
|
const authController = useAuthController();
|
|
426
430
|
const data = useData();
|
|
427
431
|
const storageSource = useStorageSource();
|
|
@@ -444,7 +448,9 @@
|
|
|
444
448
|
analyticsController,
|
|
445
449
|
userManagement,
|
|
446
450
|
effectiveRoleController,
|
|
447
|
-
databaseAdmin
|
|
451
|
+
databaseAdmin,
|
|
452
|
+
client
|
|
453
|
+
// Client should be provided
|
|
448
454
|
});
|
|
449
455
|
React.useEffect(() => {
|
|
450
456
|
rebaseContextRef.current = {
|
|
@@ -458,9 +464,10 @@
|
|
|
458
464
|
analyticsController,
|
|
459
465
|
userManagement,
|
|
460
466
|
effectiveRoleController,
|
|
461
|
-
databaseAdmin
|
|
467
|
+
databaseAdmin,
|
|
468
|
+
client
|
|
462
469
|
};
|
|
463
|
-
}, [authController, dialogsController, effectiveRoleController,
|
|
470
|
+
}, [authController, data, storageSource, snackbarController, userConfigPersistence, dialogsController, customizationController, analyticsController, userManagement, effectiveRoleController, databaseAdmin, client]);
|
|
464
471
|
return rebaseContextRef.current;
|
|
465
472
|
};
|
|
466
473
|
const CACHE = {};
|
|
@@ -1359,7 +1366,7 @@
|
|
|
1359
1366
|
return window.matchMedia(`(min-width: ${breakpoints[breakpoint] + 1}px)`).matches;
|
|
1360
1367
|
}
|
|
1361
1368
|
const STORAGE_KEY_PREFIX = "rebase-collapsed-groups";
|
|
1362
|
-
function useCollapsedGroups(groupNames, namespace = "default") {
|
|
1369
|
+
function useCollapsedGroups(groupNames, namespace = "default", defaults) {
|
|
1363
1370
|
const storageKey = `${STORAGE_KEY_PREFIX}-${namespace}`;
|
|
1364
1371
|
const [collapsedGroups, setCollapsedGroups] = React.useState(() => {
|
|
1365
1372
|
try {
|
|
@@ -1389,19 +1396,42 @@
|
|
|
1389
1396
|
});
|
|
1390
1397
|
}, [groupNames]);
|
|
1391
1398
|
const isGroupCollapsed = React.useCallback((name) => {
|
|
1392
|
-
|
|
1393
|
-
|
|
1399
|
+
if (name in collapsedGroups) {
|
|
1400
|
+
return collapsedGroups[name];
|
|
1401
|
+
}
|
|
1402
|
+
return defaults?.[name] ?? false;
|
|
1403
|
+
}, [collapsedGroups, defaults]);
|
|
1394
1404
|
const toggleGroupCollapsed = React.useCallback((name_0) => {
|
|
1395
|
-
setCollapsedGroups((prev_0) =>
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1405
|
+
setCollapsedGroups((prev_0) => {
|
|
1406
|
+
const currentlyCollapsed = name_0 in prev_0 ? prev_0[name_0] : defaults?.[name_0] ?? false;
|
|
1407
|
+
return {
|
|
1408
|
+
...prev_0,
|
|
1409
|
+
[name_0]: !currentlyCollapsed
|
|
1410
|
+
};
|
|
1411
|
+
});
|
|
1412
|
+
}, [defaults]);
|
|
1400
1413
|
return React.useMemo(() => ({
|
|
1401
1414
|
isGroupCollapsed,
|
|
1402
1415
|
toggleGroupCollapsed
|
|
1403
1416
|
}), [isGroupCollapsed, toggleGroupCollapsed]);
|
|
1404
1417
|
}
|
|
1418
|
+
function buildCollapsedDefaults(mappings, namespace) {
|
|
1419
|
+
if (!mappings) return {};
|
|
1420
|
+
const result = {};
|
|
1421
|
+
for (const mapping of mappings) {
|
|
1422
|
+
const val = mapping.collapsedByDefault;
|
|
1423
|
+
if (val === void 0) continue;
|
|
1424
|
+
if (typeof val === "boolean") {
|
|
1425
|
+
result[mapping.name] = val;
|
|
1426
|
+
} else {
|
|
1427
|
+
const ns = val[namespace];
|
|
1428
|
+
if (ns !== void 0) {
|
|
1429
|
+
result[mapping.name] = ns;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
return result;
|
|
1434
|
+
}
|
|
1405
1435
|
const rebaseLogo = "data:image/png;base64,iVBORw0K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quiLEocGT7GS7mX/1BCS8fjMF2wmbZaTyUk9tlxOmFfQFJLwcM1JE4wqSgSNddpQjBSiPgD67SWiZsBcn5V8PIzZCkrvSTTPprsxZzsMRkPDCHQsdtcjwhPMJT8BqvHwM8pUaRuiQaCkHWKOBAAchE42APusPI1Bi0gMJTPAgvPk9NDmgGx9GsBVK0NIA1Mg3rdlTCx9z3rYha5zY2NLjMMo/eXMboxWsnv8Br15XnnLWoGsAAAAASUVORK5CYII=";
|
|
1406
1436
|
function useBrowserTitleAndIcon(name, logo) {
|
|
1407
1437
|
const $ = reactCompilerRuntime.c(4);
|
|
@@ -2155,8 +2185,58 @@
|
|
|
2155
2185
|
t1 = t2;
|
|
2156
2186
|
return t1;
|
|
2157
2187
|
}
|
|
2158
|
-
|
|
2159
|
-
|
|
2188
|
+
const lazyCache = /* @__PURE__ */ new WeakMap();
|
|
2189
|
+
function useResolvedComponent(ref) {
|
|
2190
|
+
const $ = reactCompilerRuntime.c(2);
|
|
2191
|
+
let t0;
|
|
2192
|
+
let t1;
|
|
2193
|
+
if ($[0] !== ref) {
|
|
2194
|
+
t1 = resolveComponentRef(ref);
|
|
2195
|
+
$[0] = ref;
|
|
2196
|
+
$[1] = t1;
|
|
2197
|
+
} else {
|
|
2198
|
+
t1 = $[1];
|
|
2199
|
+
}
|
|
2200
|
+
t0 = t1;
|
|
2201
|
+
return t0;
|
|
2202
|
+
}
|
|
2203
|
+
function getOrCreateLazy(key, loader) {
|
|
2204
|
+
const cached = lazyCache.get(key);
|
|
2205
|
+
if (cached) return cached;
|
|
2206
|
+
const LazyComponent = React.lazy(loader);
|
|
2207
|
+
lazyCache.set(key, LazyComponent);
|
|
2208
|
+
return LazyComponent;
|
|
2209
|
+
}
|
|
2210
|
+
function resolveComponentRef(ref) {
|
|
2211
|
+
if (ref == null) return void 0;
|
|
2212
|
+
if (typeof ref === "string") {
|
|
2213
|
+
console.warn(`[Rebase] Encountered a raw string ComponentRef ("${ref}") at runtime. This usually means the Vite transform plugin did not process this file. Ensure the file is inside the configured collectionsDir.`);
|
|
2214
|
+
return void 0;
|
|
2215
|
+
}
|
|
2216
|
+
if (types.isLazyComponentRef(ref)) {
|
|
2217
|
+
return getOrCreateLazy(ref, () => ref.load());
|
|
2218
|
+
}
|
|
2219
|
+
if (typeof ref === "function") {
|
|
2220
|
+
const fn = ref;
|
|
2221
|
+
if (fn.prototype?.isReactComponent) {
|
|
2222
|
+
return ref;
|
|
2223
|
+
}
|
|
2224
|
+
if ("$$typeof" in fn) {
|
|
2225
|
+
return ref;
|
|
2226
|
+
}
|
|
2227
|
+
if (fn.length > 0) {
|
|
2228
|
+
return ref;
|
|
2229
|
+
}
|
|
2230
|
+
const name = fn.name;
|
|
2231
|
+
if (name && /^[A-Z]/.test(name)) {
|
|
2232
|
+
return ref;
|
|
2233
|
+
}
|
|
2234
|
+
return getOrCreateLazy(fn, ref);
|
|
2235
|
+
}
|
|
2236
|
+
if (typeof ref === "object" && "$$typeof" in ref) {
|
|
2237
|
+
return ref;
|
|
2238
|
+
}
|
|
2239
|
+
return void 0;
|
|
2160
2240
|
}
|
|
2161
2241
|
function ErrorTooltip(props) {
|
|
2162
2242
|
const $ = reactCompilerRuntime.c(2);
|
|
@@ -2470,7 +2550,15 @@
|
|
|
2470
2550
|
const fixedFilter = fixedFilterFromProps ?? fixedFilterFromCollection;
|
|
2471
2551
|
const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
|
|
2472
2552
|
const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE;
|
|
2473
|
-
const
|
|
2553
|
+
const location = reactRouterDom.useLocation();
|
|
2554
|
+
const [searchString, setSearchString] = React.useState(() => {
|
|
2555
|
+
if (updateUrl) {
|
|
2556
|
+
const params = new URLSearchParams(location.search);
|
|
2557
|
+
const urlSearch = params.get("search");
|
|
2558
|
+
return urlSearch ? decodeURIComponent(urlSearch) : void 0;
|
|
2559
|
+
}
|
|
2560
|
+
return void 0;
|
|
2561
|
+
});
|
|
2474
2562
|
const checkFilterCombination = React.useCallback((filterValues, sortBy) => {
|
|
2475
2563
|
return true;
|
|
2476
2564
|
}, []);
|
|
@@ -2481,7 +2569,6 @@
|
|
|
2481
2569
|
}
|
|
2482
2570
|
return sort;
|
|
2483
2571
|
}, [sort, fixedFilter]);
|
|
2484
|
-
const location = reactRouterDom.useLocation();
|
|
2485
2572
|
const {
|
|
2486
2573
|
filterValues: filterUrl,
|
|
2487
2574
|
sortBy: sortUrl
|
|
@@ -2508,6 +2595,9 @@
|
|
|
2508
2595
|
} else {
|
|
2509
2596
|
setSortBy(urlSortBy);
|
|
2510
2597
|
}
|
|
2598
|
+
const urlParams = new URLSearchParams(location.search);
|
|
2599
|
+
const urlSearch_0 = urlParams.get("search");
|
|
2600
|
+
setSearchString(urlSearch_0 ? decodeURIComponent(urlSearch_0) : void 0);
|
|
2511
2601
|
}, [location.search, updateUrl, fixedFilter, checkFilterCombination]);
|
|
2512
2602
|
useUpdateUrl(filterValues_0, sortBy_0, searchString, updateUrl);
|
|
2513
2603
|
const collectionScroll = scrollRestoration?.getCollectionScroll(path, filterValues_0);
|
|
@@ -6318,7 +6408,7 @@
|
|
|
6318
6408
|
t4 = $[2];
|
|
6319
6409
|
}
|
|
6320
6410
|
const caps = t4;
|
|
6321
|
-
const isBootstrapMode = needsSetup ?? authController.needsSetup ?? false;
|
|
6411
|
+
const isBootstrapMode = needsSetup ?? ("needsSetup" in authController && !!authController.needsSetup) ?? false;
|
|
6322
6412
|
const canRegister = registrationEnabled ?? caps.registration ?? false;
|
|
6323
6413
|
const hasGoogleLogin = googleEnabled ?? caps.googleLogin ?? false;
|
|
6324
6414
|
const hasPasswordReset = caps.passwordReset ?? !!authController.forgotPassword;
|
|
@@ -6601,7 +6691,11 @@
|
|
|
6601
6691
|
mode === "buttons" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex flex-col gap-3 mt-2", children: [
|
|
6602
6692
|
/* @__PURE__ */ jsxRuntime.jsx(LoginButton, { disabled, text: "Sign in with email", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MailIcon, {}), onClick: () => switchMode("login") }),
|
|
6603
6693
|
hasGoogleLogin && googleClientId && /* @__PURE__ */ jsxRuntime.jsx(GoogleLoginButton, { disabled, googleClientId, authController }),
|
|
6604
|
-
showRegistration && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6694
|
+
showRegistration && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Typography, { variant: "body2", color: "secondary", children: [
|
|
6695
|
+
"Don't have an account?",
|
|
6696
|
+
" ",
|
|
6697
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "font-semibold hover:underline cursor-pointer text-primary-600 dark:text-primary-400", onClick: () => switchMode("register"), children: "Create one" })
|
|
6698
|
+
] }) })
|
|
6605
6699
|
] }),
|
|
6606
6700
|
mode === "login" && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: false, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToRegister: showRegistration ? () => switchMode("register") : void 0 }),
|
|
6607
6701
|
mode === "register" && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: true, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToLogin: () => switchMode("login") }),
|
|
@@ -6740,7 +6834,7 @@
|
|
|
6740
6834
|
googleClientId,
|
|
6741
6835
|
authController
|
|
6742
6836
|
} = t0;
|
|
6743
|
-
const
|
|
6837
|
+
const codeClientRef = React.useRef(null);
|
|
6744
6838
|
let t1;
|
|
6745
6839
|
if ($[0] !== authController.googleLogin || $[1] !== googleClientId) {
|
|
6746
6840
|
t1 = () => {
|
|
@@ -6748,19 +6842,23 @@
|
|
|
6748
6842
|
return;
|
|
6749
6843
|
}
|
|
6750
6844
|
const google = window.google;
|
|
6751
|
-
if (!google ||
|
|
6845
|
+
if (!google || codeClientRef.current) {
|
|
6752
6846
|
return;
|
|
6753
6847
|
}
|
|
6754
|
-
|
|
6848
|
+
codeClientRef.current = google.accounts.oauth2.initCodeClient({
|
|
6755
6849
|
client_id: googleClientId,
|
|
6756
6850
|
scope: "openid email profile",
|
|
6851
|
+
ux_mode: "popup",
|
|
6757
6852
|
callback: async (response) => {
|
|
6758
|
-
if (response.error || !response.
|
|
6853
|
+
if (response.error || !response.code) {
|
|
6759
6854
|
console.error("Google login error:", response.error);
|
|
6760
6855
|
return;
|
|
6761
6856
|
}
|
|
6762
6857
|
try {
|
|
6763
|
-
await authController.googleLogin(
|
|
6858
|
+
await authController.googleLogin({
|
|
6859
|
+
code: response.code,
|
|
6860
|
+
redirectUri: "postmessage"
|
|
6861
|
+
});
|
|
6764
6862
|
} catch (t22) {
|
|
6765
6863
|
const err = t22;
|
|
6766
6864
|
console.error("Google login error:", err);
|
|
@@ -6787,11 +6885,11 @@
|
|
|
6787
6885
|
let t3;
|
|
6788
6886
|
if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
6789
6887
|
t3 = () => {
|
|
6790
|
-
if (!
|
|
6888
|
+
if (!codeClientRef.current) {
|
|
6791
6889
|
console.error("Google Sign-In not loaded");
|
|
6792
6890
|
return;
|
|
6793
6891
|
}
|
|
6794
|
-
|
|
6892
|
+
codeClientRef.current.requestCode();
|
|
6795
6893
|
};
|
|
6796
6894
|
$[6] = t3;
|
|
6797
6895
|
} else {
|
|
@@ -7354,6 +7452,58 @@
|
|
|
7354
7452
|
React.useLayoutEffect(t1, t2);
|
|
7355
7453
|
return null;
|
|
7356
7454
|
}
|
|
7455
|
+
function BootstrapAdminBanner({
|
|
7456
|
+
className
|
|
7457
|
+
}) {
|
|
7458
|
+
const userManagement = useInternalUserManagementController();
|
|
7459
|
+
const {
|
|
7460
|
+
user: loggedInUser
|
|
7461
|
+
} = useAuthController();
|
|
7462
|
+
const {
|
|
7463
|
+
t
|
|
7464
|
+
} = useTranslation();
|
|
7465
|
+
const snackbarController = useSnackbarController();
|
|
7466
|
+
const [bootstrapping, setBootstrapping] = React.useState(false);
|
|
7467
|
+
if (typeof window !== "undefined" && window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1") {
|
|
7468
|
+
return null;
|
|
7469
|
+
}
|
|
7470
|
+
if (!userManagement || !loggedInUser) {
|
|
7471
|
+
return null;
|
|
7472
|
+
}
|
|
7473
|
+
const {
|
|
7474
|
+
users,
|
|
7475
|
+
loading: delegateLoading,
|
|
7476
|
+
bootstrapAdmin,
|
|
7477
|
+
usersError
|
|
7478
|
+
} = userManagement;
|
|
7479
|
+
const hasAdmin = users.some((u) => u.roles?.includes("admin"));
|
|
7480
|
+
if (delegateLoading || hasAdmin || usersError || !bootstrapAdmin) {
|
|
7481
|
+
return null;
|
|
7482
|
+
}
|
|
7483
|
+
const handleBootstrap = async () => {
|
|
7484
|
+
if (!bootstrapAdmin) return;
|
|
7485
|
+
setBootstrapping(true);
|
|
7486
|
+
try {
|
|
7487
|
+
await bootstrapAdmin();
|
|
7488
|
+
snackbarController.open({
|
|
7489
|
+
type: "success",
|
|
7490
|
+
message: t("bootstrap_admin_success") || "Admin successfully created"
|
|
7491
|
+
});
|
|
7492
|
+
window.location.reload();
|
|
7493
|
+
} catch (error) {
|
|
7494
|
+
snackbarController.open({
|
|
7495
|
+
type: "error",
|
|
7496
|
+
message: error instanceof Error ? error.message : t("failed_to_bootstrap_admin") || "Failed to bootstrap admin"
|
|
7497
|
+
});
|
|
7498
|
+
} finally {
|
|
7499
|
+
setBootstrapping(false);
|
|
7500
|
+
}
|
|
7501
|
+
};
|
|
7502
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `bg-yellow-100 dark:bg-yellow-900 border border-yellow-400 dark:border-yellow-700 rounded p-4 flex items-center justify-between ${className || ""}`, children: [
|
|
7503
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", className: "text-yellow-800 dark:text-yellow-200", children: t("no_users_or_roles_defined") || "No admins found. Click to add your user as admin." }) }),
|
|
7504
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: handleBootstrap, disabled: bootstrapping, children: bootstrapping ? /* @__PURE__ */ jsxRuntime.jsx(ui.CircularProgress, { size: "small" }) : t("add_logged_user_as_admin") || "Add logged user as admin" })
|
|
7505
|
+
] });
|
|
7506
|
+
}
|
|
7357
7507
|
const en = {
|
|
7358
7508
|
// ─── Form actions ────────────────────────────────────────────
|
|
7359
7509
|
save: "Save",
|
|
@@ -7394,6 +7544,7 @@
|
|
|
7394
7544
|
all_entries_loaded: "All {{count}} entries loaded",
|
|
7395
7545
|
create_your_first_entry: "Create your first entry",
|
|
7396
7546
|
no_results_filter_sort: "No results with the applied filter/sort",
|
|
7547
|
+
no_results_search: 'No results found for "{{search}}"',
|
|
7397
7548
|
add: "Add",
|
|
7398
7549
|
remove: "Remove",
|
|
7399
7550
|
multiple_entities: "Multiple entities",
|
|
@@ -8266,6 +8417,7 @@
|
|
|
8266
8417
|
all_entries_loaded: "Todas las {{count}} entradas cargadas",
|
|
8267
8418
|
create_your_first_entry: "Crea tu primera entrada",
|
|
8268
8419
|
no_results_filter_sort: "No hay resultados con el filtro/orden aplicado",
|
|
8420
|
+
no_results_search: 'No se encontraron resultados para "{{search}}"',
|
|
8269
8421
|
add: "Añadir",
|
|
8270
8422
|
remove: "Quitar",
|
|
8271
8423
|
multiple_entities: "Múltiples entidades",
|
|
@@ -9111,6 +9263,7 @@
|
|
|
9111
9263
|
all_entries_loaded: "Alle {{count}} Einträge geladen",
|
|
9112
9264
|
create_your_first_entry: "Erstellen Sie Ihren ersten Eintrag",
|
|
9113
9265
|
no_results_filter_sort: "Keine Ergebnisse mit angewendetem Filter/Sortierung",
|
|
9266
|
+
no_results_search: 'Keine Ergebnisse gefunden für "{{search}}"',
|
|
9114
9267
|
add: "Hinzufügen",
|
|
9115
9268
|
remove: "Entfernen",
|
|
9116
9269
|
multiple_entities: "Mehrere Entitäten",
|
|
@@ -9955,6 +10108,7 @@
|
|
|
9955
10108
|
all_entries_loaded: "Toutes les {{count}} entrées chargées",
|
|
9956
10109
|
create_your_first_entry: "Créez votre première entrée",
|
|
9957
10110
|
no_results_filter_sort: "Aucun résultat avec le filtre/tri appliqué",
|
|
10111
|
+
no_results_search: 'Aucun résultat trouvé pour "{{search}}"',
|
|
9958
10112
|
add: "Ajouter",
|
|
9959
10113
|
remove: "Supprimer",
|
|
9960
10114
|
multiple_entities: "Entités multiples",
|
|
@@ -10799,6 +10953,7 @@
|
|
|
10799
10953
|
all_entries_loaded: "Tutte le {{count}} voci caricate",
|
|
10800
10954
|
create_your_first_entry: "Crea la tua prima voce",
|
|
10801
10955
|
no_results_filter_sort: "Nessun risultato con il filtro/ordinamento applicato",
|
|
10956
|
+
no_results_search: 'Nessun risultato trovato per "{{search}}"',
|
|
10802
10957
|
add: "Aggiungi",
|
|
10803
10958
|
remove: "Rimuovi",
|
|
10804
10959
|
multiple_entities: "Entità multiple",
|
|
@@ -11643,6 +11798,7 @@
|
|
|
11643
11798
|
all_entries_loaded: "सभी {{count}} प्रविष्टियाँ लोड हो गईं",
|
|
11644
11799
|
create_your_first_entry: "अपनी पहली प्रविष्टि बनाएं",
|
|
11645
11800
|
no_results_filter_sort: "लागू किए गए फ़िल्टर/सॉर्ट के साथ कोई परिणाम नहीं",
|
|
11801
|
+
no_results_search: '"{{search}}" के लिए कोई परिणाम नहीं मिला',
|
|
11646
11802
|
add: "जोड़ें",
|
|
11647
11803
|
remove: "हटाएं",
|
|
11648
11804
|
multiple_entities: "एकाधिक इकाइयां",
|
|
@@ -12487,6 +12643,7 @@
|
|
|
12487
12643
|
all_entries_loaded: "Todos os {{count}} registos carregados",
|
|
12488
12644
|
create_your_first_entry: "Crie o seu primeiro registo",
|
|
12489
12645
|
no_results_filter_sort: "Sem resultados com o filtro/ordenação aplicado",
|
|
12646
|
+
no_results_search: 'Nenhum resultado encontrado para "{{search}}"',
|
|
12490
12647
|
add: "Adicionar",
|
|
12491
12648
|
remove: "Remover",
|
|
12492
12649
|
multiple_entities: "Múltiplas entidades",
|
|
@@ -13463,18 +13620,19 @@
|
|
|
13463
13620
|
}
|
|
13464
13621
|
const ws = client?.ws;
|
|
13465
13622
|
if (ws && typeof ws.executeSql === "function") {
|
|
13623
|
+
const wsAdmin = ws;
|
|
13466
13624
|
return {
|
|
13467
|
-
executeSql:
|
|
13468
|
-
fetchAvailableDatabases:
|
|
13469
|
-
fetchAvailableRoles:
|
|
13470
|
-
fetchCurrentDatabase:
|
|
13471
|
-
fetchUnmappedTables:
|
|
13472
|
-
fetchTableMetadata:
|
|
13625
|
+
executeSql: wsAdmin.executeSql.bind(wsAdmin),
|
|
13626
|
+
fetchAvailableDatabases: wsAdmin.fetchAvailableDatabases?.bind(wsAdmin),
|
|
13627
|
+
fetchAvailableRoles: wsAdmin.fetchAvailableRoles?.bind(wsAdmin),
|
|
13628
|
+
fetchCurrentDatabase: wsAdmin.fetchCurrentDatabase?.bind(wsAdmin),
|
|
13629
|
+
fetchUnmappedTables: wsAdmin.fetchUnmappedTables?.bind(wsAdmin),
|
|
13630
|
+
fetchTableMetadata: wsAdmin.fetchTableMetadata?.bind(wsAdmin),
|
|
13473
13631
|
// Branch admin capabilities
|
|
13474
|
-
...typeof
|
|
13475
|
-
createBranch:
|
|
13476
|
-
deleteBranch:
|
|
13477
|
-
listBranches:
|
|
13632
|
+
...typeof wsAdmin.createBranch === "function" ? {
|
|
13633
|
+
createBranch: wsAdmin.createBranch.bind(wsAdmin),
|
|
13634
|
+
deleteBranch: wsAdmin.deleteBranch.bind(wsAdmin),
|
|
13635
|
+
listBranches: wsAdmin.listBranches.bind(wsAdmin)
|
|
13478
13636
|
} : {}
|
|
13479
13637
|
};
|
|
13480
13638
|
}
|
|
@@ -13536,7 +13694,9 @@
|
|
|
13536
13694
|
}
|
|
13537
13695
|
const childrenResult = t1;
|
|
13538
13696
|
const plugins = customizationController.plugins;
|
|
13539
|
-
|
|
13697
|
+
const authController = context.authController;
|
|
13698
|
+
const authReady = !loading && !authController.authLoading && (Boolean(authController.user) || authController.loginSkipped);
|
|
13699
|
+
if (authReady && plugins && plugins.length > 0) {
|
|
13540
13700
|
let t2;
|
|
13541
13701
|
if ($[4] !== context) {
|
|
13542
13702
|
t2 = {
|
|
@@ -14288,7 +14448,7 @@
|
|
|
14288
14448
|
if (listProperties && listProperties.length > 0) {
|
|
14289
14449
|
return listProperties;
|
|
14290
14450
|
} else {
|
|
14291
|
-
listProperties = allProperties;
|
|
14451
|
+
listProperties = targetCollection.propertiesOrder || allProperties;
|
|
14292
14452
|
return listProperties.filter((key) => {
|
|
14293
14453
|
const prop = targetCollection.properties[key];
|
|
14294
14454
|
const isIdProp = prop && typeof prop === "object" && "isId" in prop && Boolean(prop.isId);
|
|
@@ -14303,16 +14463,24 @@
|
|
|
14303
14463
|
if (collection.titleProperty) {
|
|
14304
14464
|
return collection.titleProperty;
|
|
14305
14465
|
}
|
|
14306
|
-
|
|
14466
|
+
const orderToSearch = collection.propertiesOrder || Object.keys(collection.properties);
|
|
14467
|
+
let firstStringCandidate;
|
|
14468
|
+
for (const key of orderToSearch) {
|
|
14307
14469
|
const property = collection.properties[key];
|
|
14308
|
-
if (!common.isPropertyBuilder(property)) {
|
|
14470
|
+
if (property && !common.isPropertyBuilder(property)) {
|
|
14309
14471
|
const prop = property;
|
|
14310
14472
|
if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
|
|
14311
|
-
|
|
14473
|
+
if (!firstStringCandidate) {
|
|
14474
|
+
firstStringCandidate = key;
|
|
14475
|
+
}
|
|
14476
|
+
const lowerKey = key.toLowerCase();
|
|
14477
|
+
if (["name", "title", "label", "displayname", "username"].includes(lowerKey)) {
|
|
14478
|
+
return key;
|
|
14479
|
+
}
|
|
14312
14480
|
}
|
|
14313
14481
|
}
|
|
14314
14482
|
}
|
|
14315
|
-
return
|
|
14483
|
+
return firstStringCandidate;
|
|
14316
14484
|
}
|
|
14317
14485
|
function getColorScheme(enumValues, key) {
|
|
14318
14486
|
const labelOrConfig = common.getLabelOrConfigFrom(enumValues, key);
|
|
@@ -14653,6 +14821,7 @@
|
|
|
14653
14821
|
exports2.AnalyticsContext = AnalyticsContext;
|
|
14654
14822
|
exports2.ApiConfigProvider = ApiConfigProvider;
|
|
14655
14823
|
exports2.AuthControllerContext = AuthControllerContext;
|
|
14824
|
+
exports2.BootstrapAdminBanner = BootstrapAdminBanner;
|
|
14656
14825
|
exports2.CONTAINER_FULL_WIDTH = CONTAINER_FULL_WIDTH;
|
|
14657
14826
|
exports2.ConfirmationDialog = ConfirmationDialog;
|
|
14658
14827
|
exports2.CustomizationControllerContext = CustomizationControllerContext;
|
|
@@ -14696,6 +14865,7 @@
|
|
|
14696
14865
|
exports2.UserDisplay = UserDisplay;
|
|
14697
14866
|
exports2.UserSelectPopover = UserSelectPopover;
|
|
14698
14867
|
exports2.UserSettingsView = UserSettingsView;
|
|
14868
|
+
exports2.buildCollapsedDefaults = buildCollapsedDefaults;
|
|
14699
14869
|
exports2.buildEnumLabel = buildEnumLabel;
|
|
14700
14870
|
exports2.clearEntityCache = clearEntityCache;
|
|
14701
14871
|
exports2.createFormexStub = createFormexStub;
|
|
@@ -14721,6 +14891,7 @@
|
|
|
14721
14891
|
exports2.printChanged = printChanged;
|
|
14722
14892
|
exports2.removeEntityFromCache = removeEntityFromCache;
|
|
14723
14893
|
exports2.removeEntityFromMemoryCache = removeEntityFromMemoryCache;
|
|
14894
|
+
exports2.resolveComponentRef = resolveComponentRef;
|
|
14724
14895
|
exports2.saveEntityToCache = saveEntityToCache;
|
|
14725
14896
|
exports2.saveEntityToMemoryCache = saveEntityToMemoryCache;
|
|
14726
14897
|
exports2.saveEntityWithCallbacks = saveEntityWithCallbacks;
|
|
@@ -14756,6 +14927,7 @@
|
|
|
14756
14927
|
exports2.useRebaseRegistry = useRebaseRegistry;
|
|
14757
14928
|
exports2.useRebaseRegistryDispatch = useRebaseRegistryDispatch;
|
|
14758
14929
|
exports2.useRelationSelector = useRelationSelector;
|
|
14930
|
+
exports2.useResolvedComponent = useResolvedComponent;
|
|
14759
14931
|
exports2.useRestoreScroll = useRestoreScroll;
|
|
14760
14932
|
exports2.useScrollRestoration = useScrollRestoration;
|
|
14761
14933
|
exports2.useSlot = useSlot;
|