@firecms/core 3.0.0-canary.84 → 3.0.0-canary.86
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/VirtualTable/VirtualTableProps.d.ts +10 -6
- package/dist/hooks/useProjectLog.d.ts +2 -2
- package/dist/index.es.js +53 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +53 -20
- package/dist/index.umd.js.map +1 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/datasource.d.ts +13 -6
- package/package.json +13 -13
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -0
- package/src/components/EntityPreview.tsx +1 -0
- package/src/components/SelectableTable/SelectableTable.tsx +0 -1
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
- package/src/components/VirtualTable/VirtualTable.tsx +33 -9
- package/src/components/VirtualTable/VirtualTableProps.tsx +12 -8
- package/src/core/FireCMS.tsx +1 -1
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +1 -1
- package/src/hooks/useProjectLog.tsx +18 -7
- package/src/internal/useBuildDataSource.ts +2 -2
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +1 -1
- package/src/types/datasource.ts +17 -7
package/dist/index.umd.js
CHANGED
|
@@ -5173,6 +5173,7 @@
|
|
|
5173
5173
|
},
|
|
5174
5174
|
className: ui.cls(
|
|
5175
5175
|
"bg-white dark:bg-gray-900",
|
|
5176
|
+
"min-h-[42px]",
|
|
5176
5177
|
fullwidth ? "w-full" : "",
|
|
5177
5178
|
"items-center",
|
|
5178
5179
|
hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
|
|
@@ -7145,6 +7146,7 @@
|
|
|
7145
7146
|
updateValue(entity ? getReferenceFrom(entity) : null);
|
|
7146
7147
|
}, [updateValue]);
|
|
7147
7148
|
const onMultipleEntitiesSelected = React.useCallback((entities) => {
|
|
7149
|
+
console.log("onMultipleEntitiesSelected", entities);
|
|
7148
7150
|
updateValue(entities.map((e) => getReferenceFrom(e)));
|
|
7149
7151
|
}, [updateValue]);
|
|
7150
7152
|
const selectedEntityIds = internalValue ? Array.isArray(internalValue) ? internalValue.map((ref) => ref.id) : internalValue.id ? [internalValue.id] : [] : [];
|
|
@@ -9054,6 +9056,7 @@
|
|
|
9054
9056
|
data,
|
|
9055
9057
|
onResetPagination,
|
|
9056
9058
|
onEndReached,
|
|
9059
|
+
endOffset = 600,
|
|
9057
9060
|
rowHeight = 54,
|
|
9058
9061
|
columns: columnsProp,
|
|
9059
9062
|
onRowClick,
|
|
@@ -9073,7 +9076,8 @@
|
|
|
9073
9076
|
style,
|
|
9074
9077
|
className,
|
|
9075
9078
|
endAdornment,
|
|
9076
|
-
AddColumnComponent
|
|
9079
|
+
AddColumnComponent,
|
|
9080
|
+
debug
|
|
9077
9081
|
}) {
|
|
9078
9082
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
9079
9083
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
@@ -9085,9 +9089,13 @@
|
|
|
9085
9089
|
}, [columnsProp]);
|
|
9086
9090
|
const [measureRef, bounds] = useMeasure();
|
|
9087
9091
|
const onColumnResizeInternal = React.useCallback((params) => {
|
|
9092
|
+
if (debug)
|
|
9093
|
+
console.log("onColumnResizeInternal", params);
|
|
9088
9094
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
9089
9095
|
}, [columns]);
|
|
9090
9096
|
const onColumnResizeEndInternal = React.useCallback((params) => {
|
|
9097
|
+
if (debug)
|
|
9098
|
+
console.log("onColumnResizeEndInternal", params);
|
|
9091
9099
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
9092
9100
|
if (onColumnResize) {
|
|
9093
9101
|
onColumnResize(params);
|
|
@@ -9095,15 +9103,21 @@
|
|
|
9095
9103
|
}, [columns, onColumnResize]);
|
|
9096
9104
|
const filterRef = React.useRef();
|
|
9097
9105
|
React.useEffect(() => {
|
|
9106
|
+
if (debug)
|
|
9107
|
+
console.log("Filter updated", filterInput);
|
|
9098
9108
|
filterRef.current = filterInput;
|
|
9099
9109
|
}, [filterInput]);
|
|
9100
9110
|
const scrollToTop = React.useCallback(() => {
|
|
9111
|
+
if (debug)
|
|
9112
|
+
console.log("scrollToTop");
|
|
9101
9113
|
endReachCallbackThreshold.current = 0;
|
|
9102
9114
|
if (tableRef.current) {
|
|
9103
9115
|
tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
|
|
9104
9116
|
}
|
|
9105
9117
|
}, []);
|
|
9106
9118
|
const onColumnSort = React.useCallback((key) => {
|
|
9119
|
+
if (debug)
|
|
9120
|
+
console.log("onColumnSort", key);
|
|
9107
9121
|
const isDesc = sortByProperty === key && currentSort === "desc";
|
|
9108
9122
|
const isAsc = sortByProperty === key && currentSort === "asc";
|
|
9109
9123
|
const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
|
|
@@ -9124,26 +9138,34 @@
|
|
|
9124
9138
|
}
|
|
9125
9139
|
scrollToTop();
|
|
9126
9140
|
}, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
|
|
9127
|
-
React.useCallback(() => {
|
|
9128
|
-
endReachCallbackThreshold.current = 0;
|
|
9129
|
-
if (onSortByUpdate)
|
|
9130
|
-
onSortByUpdate(void 0);
|
|
9131
|
-
}, [onSortByUpdate]);
|
|
9132
9141
|
const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
|
|
9142
|
+
if (debug)
|
|
9143
|
+
console.log("maxScroll", maxScroll);
|
|
9133
9144
|
const onEndReachedInternal = React.useCallback((scrollOffset) => {
|
|
9134
|
-
if (
|
|
9145
|
+
if (debug)
|
|
9146
|
+
console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
|
|
9147
|
+
if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
|
|
9135
9148
|
endReachCallbackThreshold.current = scrollOffset;
|
|
9136
9149
|
onEndReached();
|
|
9137
9150
|
}
|
|
9138
9151
|
}, [data?.length, onEndReached]);
|
|
9139
9152
|
const onScroll = React.useCallback(({
|
|
9153
|
+
scrollDirection,
|
|
9140
9154
|
scrollOffset,
|
|
9141
9155
|
scrollUpdateWasRequested
|
|
9142
9156
|
}) => {
|
|
9143
|
-
if (
|
|
9157
|
+
if (debug)
|
|
9158
|
+
console.log("onScroll", {
|
|
9159
|
+
scrollDirection,
|
|
9160
|
+
scrollOffset,
|
|
9161
|
+
scrollUpdateWasRequested
|
|
9162
|
+
});
|
|
9163
|
+
if (!scrollUpdateWasRequested && scrollOffset >= maxScroll - endOffset)
|
|
9144
9164
|
onEndReachedInternal(scrollOffset);
|
|
9145
9165
|
}, [maxScroll, onEndReachedInternal]);
|
|
9146
9166
|
const onFilterUpdateInternal = React.useCallback((column, filterForProperty) => {
|
|
9167
|
+
if (debug)
|
|
9168
|
+
console.log("onFilterUpdateInternal", column, filterForProperty);
|
|
9147
9169
|
endReachCallbackThreshold.current = 0;
|
|
9148
9170
|
const filter = filterRef.current;
|
|
9149
9171
|
let newFilterValue = filter ? { ...filter } : {};
|
|
@@ -9205,6 +9227,8 @@
|
|
|
9205
9227
|
endAdornment,
|
|
9206
9228
|
AddColumnComponent
|
|
9207
9229
|
};
|
|
9230
|
+
if (debug)
|
|
9231
|
+
console.log("VirtualTable render", virtualListController);
|
|
9208
9232
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9209
9233
|
"div",
|
|
9210
9234
|
{
|
|
@@ -9865,7 +9889,6 @@
|
|
|
9865
9889
|
onEndReached: loadNextPage,
|
|
9866
9890
|
onResetPagination: resetPagination,
|
|
9867
9891
|
error: dataLoadingError,
|
|
9868
|
-
paginationEnabled,
|
|
9869
9892
|
onColumnResize,
|
|
9870
9893
|
rowHeight: getRowHeight(size),
|
|
9871
9894
|
loading: dataLoading,
|
|
@@ -14632,7 +14655,7 @@
|
|
|
14632
14655
|
ui.DateTimeField,
|
|
14633
14656
|
{
|
|
14634
14657
|
value: internalValue,
|
|
14635
|
-
onChange: (dateValue) => setValue(dateValue
|
|
14658
|
+
onChange: (dateValue) => setValue(dateValue),
|
|
14636
14659
|
size: "medium",
|
|
14637
14660
|
mode: property.mode,
|
|
14638
14661
|
clearable: property.clearable,
|
|
@@ -19171,7 +19194,7 @@
|
|
|
19171
19194
|
inputValues: firestoreValues,
|
|
19172
19195
|
properties,
|
|
19173
19196
|
status,
|
|
19174
|
-
timestampNowValue: delegate.currentTime(),
|
|
19197
|
+
timestampNowValue: delegate.currentTime?.() ?? /* @__PURE__ */ new Date(),
|
|
19175
19198
|
setDateToMidnight: delegate.setDateToMidnight
|
|
19176
19199
|
}
|
|
19177
19200
|
) : firestoreValues;
|
|
@@ -19227,7 +19250,7 @@
|
|
|
19227
19250
|
filter,
|
|
19228
19251
|
orderBy,
|
|
19229
19252
|
order,
|
|
19230
|
-
isCollectionGroup: Boolean(collection.collectionGroup)
|
|
19253
|
+
isCollectionGroup: Boolean(collection.collectionGroup)
|
|
19231
19254
|
});
|
|
19232
19255
|
} : void 0,
|
|
19233
19256
|
isFilterCombinationValid: React.useCallback(({
|
|
@@ -19253,8 +19276,13 @@
|
|
|
19253
19276
|
};
|
|
19254
19277
|
}
|
|
19255
19278
|
const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
|
|
19256
|
-
async function makeRequest(authController, pluginKeys) {
|
|
19257
|
-
|
|
19279
|
+
async function makeRequest(authController, dataSourceKey, pluginKeys) {
|
|
19280
|
+
let idToken;
|
|
19281
|
+
try {
|
|
19282
|
+
idToken = await authController.getAuthToken();
|
|
19283
|
+
} catch (e) {
|
|
19284
|
+
idToken = null;
|
|
19285
|
+
}
|
|
19258
19286
|
return fetch(
|
|
19259
19287
|
DEFAULT_SERVER + "/access_log",
|
|
19260
19288
|
{
|
|
@@ -19262,24 +19290,29 @@
|
|
|
19262
19290
|
method: "POST",
|
|
19263
19291
|
headers: {
|
|
19264
19292
|
"Content-Type": "application/json",
|
|
19265
|
-
Authorization: `Basic ${
|
|
19293
|
+
Authorization: `Basic ${idToken}`
|
|
19266
19294
|
},
|
|
19267
|
-
body: JSON.stringify({
|
|
19295
|
+
body: JSON.stringify({
|
|
19296
|
+
email: authController.user?.email ?? null,
|
|
19297
|
+
datasource: dataSourceKey,
|
|
19298
|
+
plugins: pluginKeys
|
|
19299
|
+
})
|
|
19268
19300
|
}
|
|
19269
19301
|
).then(async (res) => {
|
|
19270
19302
|
return res.json();
|
|
19271
19303
|
});
|
|
19272
19304
|
}
|
|
19273
|
-
function useProjectLog(authController, plugins) {
|
|
19305
|
+
function useProjectLog(authController, dataSourceDelegate, plugins) {
|
|
19274
19306
|
const [accessResponse, setAccessResponse] = React.useState(null);
|
|
19275
19307
|
const accessedUserRef = React.useRef(null);
|
|
19308
|
+
const dataSourceKey = dataSourceDelegate.key;
|
|
19276
19309
|
const pluginKeys = plugins?.map((plugin) => plugin.key);
|
|
19277
19310
|
React.useEffect(() => {
|
|
19278
19311
|
if (authController.user && authController.user.uid !== accessedUserRef.current && !authController.initialLoading) {
|
|
19279
|
-
makeRequest(authController, pluginKeys).then(setAccessResponse);
|
|
19312
|
+
makeRequest(authController, dataSourceKey, pluginKeys).then(setAccessResponse);
|
|
19280
19313
|
accessedUserRef.current = authController.user.uid;
|
|
19281
19314
|
}
|
|
19282
|
-
}, [authController, pluginKeys]);
|
|
19315
|
+
}, [authController, dataSourceKey, pluginKeys]);
|
|
19283
19316
|
return accessResponse;
|
|
19284
19317
|
}
|
|
19285
19318
|
function FireCMS(props) {
|
|
@@ -19321,7 +19354,7 @@
|
|
|
19321
19354
|
const analyticsController = React.useMemo(() => ({
|
|
19322
19355
|
onAnalyticsEvent
|
|
19323
19356
|
}), []);
|
|
19324
|
-
const accessResponse = useProjectLog(authController, plugins);
|
|
19357
|
+
const accessResponse = useProjectLog(authController, dataSourceDelegate, plugins);
|
|
19325
19358
|
if (navigationController.navigationLoadingError) {
|
|
19326
19359
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.CenteredView, { maxWidth: "md", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19327
19360
|
ErrorView,
|