@rebasepro/core 0.2.4 → 0.2.5
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/components/LoginView/LoginView.d.ts +9 -1
- package/dist/hooks/data/useCollectionFetch.d.ts +12 -1
- package/dist/index.es.js +118 -88
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +118 -88
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/components/LoginView/LoginView.tsx +27 -5
- package/src/hooks/data/useCollectionFetch.tsx +27 -4
- package/src/hooks/data/useUserSelector.tsx +1 -1
- package/src/util/previews.ts +9 -1
package/dist/index.umd.js
CHANGED
|
@@ -258,13 +258,15 @@
|
|
|
258
258
|
return React.useContext(RebaseDataContext);
|
|
259
259
|
};
|
|
260
260
|
function useCollectionFetch(t0) {
|
|
261
|
-
const $ = reactCompilerRuntime.c(
|
|
261
|
+
const $ = reactCompilerRuntime.c(30);
|
|
262
262
|
const {
|
|
263
263
|
path,
|
|
264
264
|
collection,
|
|
265
265
|
filterValues,
|
|
266
266
|
sortBy,
|
|
267
267
|
itemCount,
|
|
268
|
+
offset,
|
|
269
|
+
page,
|
|
268
270
|
searchString
|
|
269
271
|
} = t0;
|
|
270
272
|
const dataClient = useData();
|
|
@@ -308,8 +310,9 @@
|
|
|
308
310
|
const [dataLoading, setDataLoading] = React.useState(false);
|
|
309
311
|
const [dataLoadingError, setDataLoadingError] = React.useState();
|
|
310
312
|
const [noMoreToLoad, setNoMoreToLoad] = React.useState(false);
|
|
313
|
+
const [totalCount, setTotalCount] = React.useState();
|
|
311
314
|
let t3;
|
|
312
|
-
if ($[3] !== collection.properties || $[4] !== dataClient || $[5] !== itemCount || $[6] !==
|
|
315
|
+
if ($[3] !== collection.properties || $[4] !== dataClient || $[5] !== itemCount || $[6] !== offset || $[7] !== orderByParams || $[8] !== page || $[9] !== path || $[10] !== searchString || $[11] !== whereParams) {
|
|
313
316
|
t3 = () => {
|
|
314
317
|
setDataLoading(true);
|
|
315
318
|
const onEntitiesUpdate = async (res) => {
|
|
@@ -318,12 +321,14 @@
|
|
|
318
321
|
setDataLoadingError(void 0);
|
|
319
322
|
setData(entities.map(_temp$7));
|
|
320
323
|
setNoMoreToLoad(!res.meta.hasMore);
|
|
324
|
+
setTotalCount(res.meta.total);
|
|
321
325
|
};
|
|
322
326
|
const onError = (error) => {
|
|
323
327
|
console.error("ERROR", error);
|
|
324
328
|
setDataLoading(false);
|
|
325
329
|
setData([]);
|
|
326
330
|
setDataLoadingError(error);
|
|
331
|
+
setTotalCount(void 0);
|
|
327
332
|
};
|
|
328
333
|
const accessor = dataClient.collection(path);
|
|
329
334
|
const hasRelations = collection.properties && Object.values(collection.properties).some(_temp2$4);
|
|
@@ -332,6 +337,8 @@
|
|
|
332
337
|
return accessor.listen({
|
|
333
338
|
where: whereParams,
|
|
334
339
|
limit: itemCount,
|
|
340
|
+
offset,
|
|
341
|
+
page,
|
|
335
342
|
orderBy: orderByParams,
|
|
336
343
|
searchString,
|
|
337
344
|
include: includeParams
|
|
@@ -343,6 +350,8 @@
|
|
|
343
350
|
accessor.find({
|
|
344
351
|
where: whereParams,
|
|
345
352
|
limit: itemCount,
|
|
353
|
+
offset,
|
|
354
|
+
page,
|
|
346
355
|
orderBy: orderByParams,
|
|
347
356
|
searchString,
|
|
348
357
|
include: includeParams
|
|
@@ -356,46 +365,52 @@
|
|
|
356
365
|
$[3] = collection.properties;
|
|
357
366
|
$[4] = dataClient;
|
|
358
367
|
$[5] = itemCount;
|
|
359
|
-
$[6] =
|
|
360
|
-
$[7] =
|
|
361
|
-
$[8] =
|
|
362
|
-
$[9] =
|
|
363
|
-
$[10] =
|
|
368
|
+
$[6] = offset;
|
|
369
|
+
$[7] = orderByParams;
|
|
370
|
+
$[8] = page;
|
|
371
|
+
$[9] = path;
|
|
372
|
+
$[10] = searchString;
|
|
373
|
+
$[11] = whereParams;
|
|
374
|
+
$[12] = t3;
|
|
364
375
|
} else {
|
|
365
|
-
t3 = $[
|
|
376
|
+
t3 = $[12];
|
|
366
377
|
}
|
|
367
378
|
let t4;
|
|
368
|
-
if ($[
|
|
369
|
-
t4 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString, dataClient, collection];
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
$[
|
|
375
|
-
$[
|
|
376
|
-
$[
|
|
377
|
-
$[
|
|
378
|
-
$[
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
if ($[13] !== collection || $[14] !== currentSort || $[15] !== dataClient || $[16] !== filterValues || $[17] !== itemCount || $[18] !== offset || $[19] !== page || $[20] !== path || $[21] !== searchString || $[22] !== sortByProperty) {
|
|
380
|
+
t4 = [path, itemCount, offset, page, currentSort, sortByProperty, filterValues, searchString, dataClient, collection];
|
|
381
|
+
$[13] = collection;
|
|
382
|
+
$[14] = currentSort;
|
|
383
|
+
$[15] = dataClient;
|
|
384
|
+
$[16] = filterValues;
|
|
385
|
+
$[17] = itemCount;
|
|
386
|
+
$[18] = offset;
|
|
387
|
+
$[19] = page;
|
|
388
|
+
$[20] = path;
|
|
389
|
+
$[21] = searchString;
|
|
390
|
+
$[22] = sortByProperty;
|
|
391
|
+
$[23] = t4;
|
|
392
|
+
} else {
|
|
393
|
+
t4 = $[23];
|
|
381
394
|
}
|
|
382
395
|
React.useEffect(t3, t4);
|
|
383
396
|
let t5;
|
|
384
397
|
let t6;
|
|
385
|
-
if ($[
|
|
398
|
+
if ($[24] !== data || $[25] !== dataLoading || $[26] !== dataLoadingError || $[27] !== noMoreToLoad || $[28] !== totalCount) {
|
|
386
399
|
t6 = {
|
|
387
400
|
data,
|
|
388
401
|
dataLoading,
|
|
389
402
|
dataLoadingError,
|
|
390
|
-
noMoreToLoad
|
|
403
|
+
noMoreToLoad,
|
|
404
|
+
totalCount
|
|
391
405
|
};
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
406
|
+
$[24] = data;
|
|
407
|
+
$[25] = dataLoading;
|
|
408
|
+
$[26] = dataLoadingError;
|
|
409
|
+
$[27] = noMoreToLoad;
|
|
410
|
+
$[28] = totalCount;
|
|
411
|
+
$[29] = t6;
|
|
397
412
|
} else {
|
|
398
|
-
t6 = $[
|
|
413
|
+
t6 = $[29];
|
|
399
414
|
}
|
|
400
415
|
t5 = t6;
|
|
401
416
|
return t5;
|
|
@@ -873,7 +888,7 @@
|
|
|
873
888
|
};
|
|
874
889
|
}, []);
|
|
875
890
|
const getUser = React.useCallback((uid) => {
|
|
876
|
-
return userManagement?.getUser(uid) ?? null;
|
|
891
|
+
return userManagement?.getUser?.(uid) ?? null;
|
|
877
892
|
}, [userManagement]);
|
|
878
893
|
return React.useMemo(() => ({
|
|
879
894
|
items,
|
|
@@ -6345,7 +6360,7 @@
|
|
|
6345
6360
|
return t8;
|
|
6346
6361
|
}
|
|
6347
6362
|
function LoginView(t0) {
|
|
6348
|
-
const $ = reactCompilerRuntime.c(
|
|
6363
|
+
const $ = reactCompilerRuntime.c(111);
|
|
6349
6364
|
const {
|
|
6350
6365
|
logo,
|
|
6351
6366
|
authController,
|
|
@@ -6360,7 +6375,9 @@
|
|
|
6360
6375
|
subtitle,
|
|
6361
6376
|
needsSetup,
|
|
6362
6377
|
registrationEnabled,
|
|
6363
|
-
additionalComponent
|
|
6378
|
+
additionalComponent,
|
|
6379
|
+
defaultEmail,
|
|
6380
|
+
defaultPassword
|
|
6364
6381
|
} = t0;
|
|
6365
6382
|
const disableSignupScreen = t1 === void 0 ? false : t1;
|
|
6366
6383
|
const disabled = t2 === void 0 ? false : t2;
|
|
@@ -6737,17 +6754,19 @@
|
|
|
6737
6754
|
t36 = $[69];
|
|
6738
6755
|
}
|
|
6739
6756
|
let t37;
|
|
6740
|
-
if ($[70] !== authController || $[71] !==
|
|
6741
|
-
t37 = isBootstrapMode && !authController.user && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: true, onClose: _temp, onForgotPassword: _temp2, noUserComponent, disableSignupScreen: false, bootstrapMode: true });
|
|
6757
|
+
if ($[70] !== authController || $[71] !== defaultEmail || $[72] !== defaultPassword || $[73] !== isBootstrapMode || $[74] !== noUserComponent) {
|
|
6758
|
+
t37 = isBootstrapMode && !authController.user && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: true, onClose: _temp, onForgotPassword: _temp2, noUserComponent, disableSignupScreen: false, bootstrapMode: true, defaultEmail, defaultPassword });
|
|
6742
6759
|
$[70] = authController;
|
|
6743
|
-
$[71] =
|
|
6744
|
-
$[72] =
|
|
6745
|
-
$[73] =
|
|
6760
|
+
$[71] = defaultEmail;
|
|
6761
|
+
$[72] = defaultPassword;
|
|
6762
|
+
$[73] = isBootstrapMode;
|
|
6763
|
+
$[74] = noUserComponent;
|
|
6764
|
+
$[75] = t37;
|
|
6746
6765
|
} else {
|
|
6747
|
-
t37 = $[
|
|
6766
|
+
t37 = $[75];
|
|
6748
6767
|
}
|
|
6749
6768
|
let t38;
|
|
6750
|
-
if ($[
|
|
6769
|
+
if ($[76] !== authController || $[77] !== defaultEmail || $[78] !== defaultPassword || $[79] !== disableSignupScreen || $[80] !== disabled || $[81] !== githubClientId || $[82] !== googleClientId || $[83] !== hasGitHubLogin || $[84] !== hasGoogleLogin || $[85] !== hasLinkedinLogin || $[86] !== hasPasswordReset || $[87] !== isBootstrapMode || $[88] !== linkedinClientId || $[89] !== mode || $[90] !== noUserComponent || $[91] !== showRegistration || $[92] !== subtitle || $[93] !== title) {
|
|
6751
6770
|
t38 = !isBootstrapMode && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6752
6771
|
mode === "buttons" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex flex-col gap-3 mt-2", children: [
|
|
6753
6772
|
(title || subtitle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-2", children: [
|
|
@@ -6764,53 +6783,55 @@
|
|
|
6764
6783
|
/* @__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" })
|
|
6765
6784
|
] }) })
|
|
6766
6785
|
] }),
|
|
6767
|
-
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 }),
|
|
6768
|
-
mode === "register" && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: true, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToLogin: () => switchMode("login") }),
|
|
6786
|
+
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, defaultEmail, defaultPassword }),
|
|
6787
|
+
mode === "register" && /* @__PURE__ */ jsxRuntime.jsx(LoginForm, { authController, registrationMode: true, onClose: () => switchMode("buttons"), onForgotPassword: hasPasswordReset ? () => switchMode("forgot") : void 0, noUserComponent, disableSignupScreen, switchToLogin: () => switchMode("login"), defaultEmail, defaultPassword }),
|
|
6769
6788
|
mode === "forgot" && authController.forgotPassword && /* @__PURE__ */ jsxRuntime.jsx(ForgotPasswordForm, { authController, onClose: () => switchMode("login") })
|
|
6770
6789
|
] });
|
|
6771
|
-
$[
|
|
6772
|
-
$[
|
|
6773
|
-
$[
|
|
6774
|
-
$[
|
|
6775
|
-
$[
|
|
6776
|
-
$[
|
|
6777
|
-
$[
|
|
6778
|
-
$[
|
|
6779
|
-
$[
|
|
6780
|
-
$[
|
|
6781
|
-
$[
|
|
6782
|
-
$[
|
|
6783
|
-
$[
|
|
6784
|
-
$[
|
|
6785
|
-
$[
|
|
6786
|
-
$[
|
|
6787
|
-
$[
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
+
$[76] = authController;
|
|
6791
|
+
$[77] = defaultEmail;
|
|
6792
|
+
$[78] = defaultPassword;
|
|
6793
|
+
$[79] = disableSignupScreen;
|
|
6794
|
+
$[80] = disabled;
|
|
6795
|
+
$[81] = githubClientId;
|
|
6796
|
+
$[82] = googleClientId;
|
|
6797
|
+
$[83] = hasGitHubLogin;
|
|
6798
|
+
$[84] = hasGoogleLogin;
|
|
6799
|
+
$[85] = hasLinkedinLogin;
|
|
6800
|
+
$[86] = hasPasswordReset;
|
|
6801
|
+
$[87] = isBootstrapMode;
|
|
6802
|
+
$[88] = linkedinClientId;
|
|
6803
|
+
$[89] = mode;
|
|
6804
|
+
$[90] = noUserComponent;
|
|
6805
|
+
$[91] = showRegistration;
|
|
6806
|
+
$[92] = subtitle;
|
|
6807
|
+
$[93] = title;
|
|
6808
|
+
$[94] = t38;
|
|
6809
|
+
} else {
|
|
6810
|
+
t38 = $[94];
|
|
6790
6811
|
}
|
|
6791
6812
|
let t39;
|
|
6792
|
-
if ($[
|
|
6813
|
+
if ($[95] !== t36 || $[96] !== t37 || $[97] !== t38) {
|
|
6793
6814
|
t39 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t36, children: [
|
|
6794
6815
|
t37,
|
|
6795
6816
|
t38
|
|
6796
6817
|
] });
|
|
6797
|
-
$[
|
|
6798
|
-
$[
|
|
6799
|
-
$[
|
|
6800
|
-
$[
|
|
6818
|
+
$[95] = t36;
|
|
6819
|
+
$[96] = t37;
|
|
6820
|
+
$[97] = t38;
|
|
6821
|
+
$[98] = t39;
|
|
6801
6822
|
} else {
|
|
6802
|
-
t39 = $[
|
|
6823
|
+
t39 = $[98];
|
|
6803
6824
|
}
|
|
6804
6825
|
let t40;
|
|
6805
|
-
if ($[
|
|
6826
|
+
if ($[99] !== additionalComponent) {
|
|
6806
6827
|
t40 = additionalComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: additionalComponent });
|
|
6807
|
-
$[
|
|
6808
|
-
$[
|
|
6828
|
+
$[99] = additionalComponent;
|
|
6829
|
+
$[100] = t40;
|
|
6809
6830
|
} else {
|
|
6810
|
-
t40 = $[
|
|
6831
|
+
t40 = $[100];
|
|
6811
6832
|
}
|
|
6812
6833
|
let t41;
|
|
6813
|
-
if ($[
|
|
6834
|
+
if ($[101] !== t32 || $[102] !== t33 || $[103] !== t34 || $[104] !== t39 || $[105] !== t40) {
|
|
6814
6835
|
t41 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center w-[440px] max-w-full p-8 sm:p-10 bg-white/70 dark:bg-surface-900/60 backdrop-blur-xl border border-surface-200/50 dark:border-surface-800/50 rounded-2xl shadow-2xl z-10 transition-all duration-300 hover:shadow-primary-500/5", children: [
|
|
6815
6836
|
t32,
|
|
6816
6837
|
t33,
|
|
@@ -6818,29 +6839,29 @@
|
|
|
6818
6839
|
t39,
|
|
6819
6840
|
t40
|
|
6820
6841
|
] });
|
|
6821
|
-
$[
|
|
6822
|
-
$[
|
|
6823
|
-
$[
|
|
6824
|
-
$[
|
|
6825
|
-
$[
|
|
6826
|
-
$[
|
|
6842
|
+
$[101] = t32;
|
|
6843
|
+
$[102] = t33;
|
|
6844
|
+
$[103] = t34;
|
|
6845
|
+
$[104] = t39;
|
|
6846
|
+
$[105] = t40;
|
|
6847
|
+
$[106] = t41;
|
|
6827
6848
|
} else {
|
|
6828
|
-
t41 = $[
|
|
6849
|
+
t41 = $[106];
|
|
6829
6850
|
}
|
|
6830
6851
|
let t42;
|
|
6831
|
-
if ($[
|
|
6852
|
+
if ($[107] !== t14 || $[108] !== t31 || $[109] !== t41) {
|
|
6832
6853
|
t42 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t14, children: [
|
|
6833
6854
|
t15,
|
|
6834
6855
|
t16,
|
|
6835
6856
|
t31,
|
|
6836
6857
|
t41
|
|
6837
6858
|
] });
|
|
6838
|
-
$[
|
|
6839
|
-
$[
|
|
6840
|
-
$[
|
|
6841
|
-
$[
|
|
6859
|
+
$[107] = t14;
|
|
6860
|
+
$[108] = t31;
|
|
6861
|
+
$[109] = t41;
|
|
6862
|
+
$[110] = t42;
|
|
6842
6863
|
} else {
|
|
6843
|
-
t42 = $[
|
|
6864
|
+
t42 = $[110];
|
|
6844
6865
|
}
|
|
6845
6866
|
return t42;
|
|
6846
6867
|
}
|
|
@@ -7104,12 +7125,14 @@
|
|
|
7104
7125
|
noUserComponent,
|
|
7105
7126
|
bootstrapMode: t1,
|
|
7106
7127
|
switchToRegister,
|
|
7107
|
-
switchToLogin
|
|
7128
|
+
switchToLogin,
|
|
7129
|
+
defaultEmail,
|
|
7130
|
+
defaultPassword
|
|
7108
7131
|
} = t0;
|
|
7109
7132
|
const bootstrapMode = t1 === void 0 ? false : t1;
|
|
7110
7133
|
const passwordRef = React.useRef(null);
|
|
7111
|
-
const [email, setEmail] = React.useState();
|
|
7112
|
-
const [password, setPassword] = React.useState();
|
|
7134
|
+
const [email, setEmail] = React.useState(defaultEmail);
|
|
7135
|
+
const [password, setPassword] = React.useState(defaultPassword);
|
|
7113
7136
|
const [displayName, setDisplayName] = React.useState();
|
|
7114
7137
|
let t2;
|
|
7115
7138
|
let t3;
|
|
@@ -14604,6 +14627,10 @@
|
|
|
14604
14627
|
}
|
|
14605
14628
|
return false;
|
|
14606
14629
|
}
|
|
14630
|
+
function isHiddenProperty(property) {
|
|
14631
|
+
if (!property) return false;
|
|
14632
|
+
return Boolean(property.ui?.hideFromCollection);
|
|
14633
|
+
}
|
|
14607
14634
|
function getEntityPreviewKeys(authController, targetCollection, fields, previewProperties, limit = 3) {
|
|
14608
14635
|
const allProperties = Object.keys(targetCollection.properties);
|
|
14609
14636
|
let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
|
|
@@ -14620,7 +14647,7 @@
|
|
|
14620
14647
|
return !isIdProp && key !== "id";
|
|
14621
14648
|
}).filter((key) => {
|
|
14622
14649
|
const property = targetCollection.properties[key];
|
|
14623
|
-
return property && !common.isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property);
|
|
14650
|
+
return property && !common.isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property);
|
|
14624
14651
|
}).slice(0, limit);
|
|
14625
14652
|
}
|
|
14626
14653
|
}
|
|
@@ -14634,6 +14661,9 @@
|
|
|
14634
14661
|
const property = collection.properties[key];
|
|
14635
14662
|
if (property && !common.isPropertyBuilder(property)) {
|
|
14636
14663
|
const prop = property;
|
|
14664
|
+
if (isHiddenProperty(prop)) {
|
|
14665
|
+
continue;
|
|
14666
|
+
}
|
|
14637
14667
|
if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
|
|
14638
14668
|
if (!firstStringCandidate) {
|
|
14639
14669
|
firstStringCandidate = key;
|