@stoker-platform/web-app 0.2.11 → 0.3.0
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/CHANGELOG.md +19 -0
- package/package.json +4 -4
- package/src/Calendar.tsx +3 -0
- package/src/Cards.tsx +1 -0
- package/src/Collection.tsx +5 -0
- package/src/Files.tsx +3 -1
- package/src/Filters.tsx +2 -0
- package/src/Form.tsx +7 -1
- package/src/Images.tsx +1 -0
- package/src/PermissionPicker.tsx +3 -0
- package/src/utils/getData.ts +2 -0
- package/vite.config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat!: restructure projects / tenants
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @stoker-platform/web-client@0.3.0
|
|
13
|
+
- @stoker-platform/utils@0.3.0
|
|
14
|
+
- @stoker-platform/node-client@0.3.1
|
|
15
|
+
|
|
16
|
+
## 0.2.12
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- feat: add FullCalendar license key env var
|
|
21
|
+
|
|
3
22
|
## 0.2.11
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"scripts": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
52
|
"@react-google-maps/api": "^2.20.7",
|
|
53
53
|
"@sentry/react": "^10.29.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.
|
|
55
|
-
"@stoker-platform/utils": "0.
|
|
56
|
-
"@stoker-platform/web-client": "0.
|
|
54
|
+
"@stoker-platform/node-client": "0.3.1",
|
|
55
|
+
"@stoker-platform/utils": "0.3.0",
|
|
56
|
+
"@stoker-platform/web-client": "0.3.0",
|
|
57
57
|
"@tanstack/react-table": "^8.21.3",
|
|
58
58
|
"@types/react": "18.3.13",
|
|
59
59
|
"@types/react-dom": "18.3.1",
|
package/src/Calendar.tsx
CHANGED
|
@@ -486,6 +486,7 @@ export function Calendar({
|
|
|
486
486
|
) {
|
|
487
487
|
const subscribe = async () => {
|
|
488
488
|
const constraints = constraintsWithoutRangeFilter(filters)
|
|
489
|
+
// TODO: subcollection support
|
|
489
490
|
const result = await subscribeMany(
|
|
490
491
|
[labels.collection],
|
|
491
492
|
[...(constraints as QueryConstraint[]), where(calendarConfig.startField, "==", null)],
|
|
@@ -1004,6 +1005,7 @@ export function Calendar({
|
|
|
1004
1005
|
<CardContent className="p-4 h-full">
|
|
1005
1006
|
{currentViewLarge && (
|
|
1006
1007
|
<FullCalendar
|
|
1008
|
+
schedulerLicenseKey={import.meta.env.STOKER_FULLCALENDAR_KEY}
|
|
1007
1009
|
initialDate={currentDateLarge}
|
|
1008
1010
|
initialView={currentViewLarge}
|
|
1009
1011
|
headerToolbar={{
|
|
@@ -1035,6 +1037,7 @@ export function Calendar({
|
|
|
1035
1037
|
<CardContent className="p-4 h-full">
|
|
1036
1038
|
{currentViewSmall && (
|
|
1037
1039
|
<FullCalendar
|
|
1040
|
+
schedulerLicenseKey={import.meta.env.STOKER_FULLCALENDAR_KEY}
|
|
1038
1041
|
initialDate={currentDateSmall}
|
|
1039
1042
|
initialView={currentViewSmall}
|
|
1040
1043
|
headerToolbar={{
|
package/src/Cards.tsx
CHANGED
package/src/Collection.tsx
CHANGED
|
@@ -555,6 +555,7 @@ function Collection({
|
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
// TODO: subcollection support
|
|
558
559
|
const result = await subscribeMany(
|
|
559
560
|
[labels.collection],
|
|
560
561
|
[
|
|
@@ -604,6 +605,7 @@ function Collection({
|
|
|
604
605
|
const getServerData = async () => {
|
|
605
606
|
const options = cloneDeep(query.queries[0].options)
|
|
606
607
|
delete options.pagination
|
|
608
|
+
// TODO: subcollection support
|
|
607
609
|
const data = await getSome(
|
|
608
610
|
[labels.collection],
|
|
609
611
|
[
|
|
@@ -668,6 +670,7 @@ function Collection({
|
|
|
668
670
|
|
|
669
671
|
const getSingleton = async () => {
|
|
670
672
|
if (collection.singleton) {
|
|
673
|
+
// TODO: subcollection support
|
|
671
674
|
const records = await getSome([labels.collection])
|
|
672
675
|
|
|
673
676
|
if (records.docs.length > 0) {
|
|
@@ -1254,6 +1257,7 @@ function Collection({
|
|
|
1254
1257
|
) || []),
|
|
1255
1258
|
]
|
|
1256
1259
|
}
|
|
1260
|
+
// TODO: subcollection support
|
|
1257
1261
|
const serverData = await getSome(
|
|
1258
1262
|
[labels.collection],
|
|
1259
1263
|
finalConstraints,
|
|
@@ -1407,6 +1411,7 @@ function Collection({
|
|
|
1407
1411
|
}
|
|
1408
1412
|
}
|
|
1409
1413
|
|
|
1414
|
+
// TODO: subcollection support
|
|
1410
1415
|
const data = await getSome(
|
|
1411
1416
|
[labels.collection],
|
|
1412
1417
|
(isServerReadOnly ? serverConstraints : webConstraints) as
|
package/src/Files.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
deleteFolder,
|
|
16
16
|
getCurrentUserPermissions,
|
|
17
17
|
getGlobalConfigModule,
|
|
18
|
+
getTenant,
|
|
18
19
|
} from "@stoker-platform/web-client"
|
|
19
20
|
import {
|
|
20
21
|
getStorage,
|
|
@@ -74,6 +75,7 @@ interface FilesProps {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
export const RecordFiles = ({ collection, record }: FilesProps) => {
|
|
78
|
+
const tenantId = getTenant()
|
|
77
79
|
const { labels } = collection
|
|
78
80
|
const customization = getCollectionConfigModule(labels.collection)
|
|
79
81
|
const { toast } = useToast()
|
|
@@ -127,7 +129,7 @@ export const RecordFiles = ({ collection, record }: FilesProps) => {
|
|
|
127
129
|
}, 150)
|
|
128
130
|
}, [])
|
|
129
131
|
|
|
130
|
-
const basePath = record ? `${record.Collection_Path.join("/")}/${record.id}` : ""
|
|
132
|
+
const basePath = record ? `${tenantId}/${record.Collection_Path.join("/")}/${record.id}` : ""
|
|
131
133
|
|
|
132
134
|
const totalPages = Math.ceil(items.length / itemsPerPage)
|
|
133
135
|
const startIndex = (currentPage - 1) * itemsPerPage
|
package/src/Filters.tsx
CHANGED
|
@@ -126,6 +126,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
126
126
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
127
127
|
[filter.field]: filter.value!,
|
|
128
128
|
}))
|
|
129
|
+
// TODO: subcollection support
|
|
129
130
|
getOne([field.collection], filter.value).then((record) => {
|
|
130
131
|
setDisplay((prev) => ({
|
|
131
132
|
...prev,
|
|
@@ -282,6 +283,7 @@ export function Filters({ collection, excluded, relationList }: FiltersProps) {
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
// TODO: subcollection support
|
|
285
287
|
getSome([collection], newConstraints as QueryConstraint[] | [string, WhereFilterOp, unknown][], {
|
|
286
288
|
only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
|
|
287
289
|
pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
|
package/src/Form.tsx
CHANGED
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
removeTimezone,
|
|
55
55
|
serializeTimestamps,
|
|
56
56
|
getFiles,
|
|
57
|
+
getTenant,
|
|
57
58
|
} from "@stoker-platform/web-client"
|
|
58
59
|
import { createElement, forwardRef, startTransition, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
59
60
|
import { useNavigate, useParams } from "react-router"
|
|
@@ -1753,6 +1754,7 @@ function RelationField({
|
|
|
1753
1754
|
}
|
|
1754
1755
|
}
|
|
1755
1756
|
|
|
1757
|
+
// TODO: subcollection support
|
|
1756
1758
|
getSome([labels.collection], newConstraints, {
|
|
1757
1759
|
only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
|
|
1758
1760
|
pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
|
|
@@ -1813,6 +1815,7 @@ function RelationField({
|
|
|
1813
1815
|
if (["ManyToOne", "ManyToMany"].includes(field.type)) {
|
|
1814
1816
|
let relation = data?.find((record) => record.id === inputValue)
|
|
1815
1817
|
if (!relation) {
|
|
1818
|
+
// TODO: subcollection support
|
|
1816
1819
|
relation = await getOne([relationCollection.labels.collection], inputValue, {
|
|
1817
1820
|
noEmbeddingFields: true,
|
|
1818
1821
|
})
|
|
@@ -2997,6 +3000,7 @@ function RecordForm({
|
|
|
2997
3000
|
return
|
|
2998
3001
|
}
|
|
2999
3002
|
const relationFields = getRelationFields(collection)
|
|
3003
|
+
// TODO: subcollection support
|
|
3000
3004
|
const record = await getOne([collection.labels.collection], entity, {
|
|
3001
3005
|
noEmbeddingFields: true,
|
|
3002
3006
|
relations: { fields: relationFields, depth: 1 },
|
|
@@ -3056,6 +3060,7 @@ function RecordForm({
|
|
|
3056
3060
|
const relationCollection =
|
|
3057
3061
|
schema.collections[collectionField.collection]
|
|
3058
3062
|
const relationFields = getRelationFields(relationCollection)
|
|
3063
|
+
// TODO: subcollection support
|
|
3059
3064
|
const record = await getOne([collectionField.collection], entity, {
|
|
3060
3065
|
noEmbeddingFields: true,
|
|
3061
3066
|
relations: { fields: relationFields, depth: 1 },
|
|
@@ -3718,7 +3723,8 @@ function RecordForm({
|
|
|
3718
3723
|
|
|
3719
3724
|
if (operation === "create") {
|
|
3720
3725
|
const serverWrite = isServerCreate(collection, userData)
|
|
3721
|
-
const
|
|
3726
|
+
const tenantId = getTenant()
|
|
3727
|
+
const docId = doc(dbCollection(db, "tenants", tenantId, labels.collection)).id
|
|
3722
3728
|
|
|
3723
3729
|
setGlobalLoading("+", docId, serverWrite, !(serverWrite || isServerReadOnly))
|
|
3724
3730
|
if (isServerReadOnly) {
|
package/src/Images.tsx
CHANGED
|
@@ -500,6 +500,7 @@ export const Images = memo(
|
|
|
500
500
|
const removedIds = Array.from(prevIds.difference(newIds))
|
|
501
501
|
removedIds.forEach((id) => {
|
|
502
502
|
let unsubscribeOne: () => void
|
|
503
|
+
// TODO: subcollection support
|
|
503
504
|
subscribeOne([labels.collection], id, (record) => {
|
|
504
505
|
if (
|
|
505
506
|
record &&
|
package/src/PermissionPicker.tsx
CHANGED
|
@@ -123,6 +123,7 @@ export const PermissionPicker = ({
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// TODO: subcollection support
|
|
126
127
|
getSome([labels.collection], newConstraints, {
|
|
127
128
|
only: isCollectionPreloadCacheEnabled ? "cache" : undefined,
|
|
128
129
|
pagination: isCollectionPreloadCacheEnabled ? undefined : { number: 10 },
|
|
@@ -168,6 +169,7 @@ export const PermissionPicker = ({
|
|
|
168
169
|
const handleChange = useCallback(async () => {
|
|
169
170
|
let relation = data?.find((record) => record.id === inputValue)
|
|
170
171
|
if (!relation) {
|
|
172
|
+
// TODO: subcollection support
|
|
171
173
|
relation = await getOne([labels.collection], inputValue, { noEmbeddingFields: true })
|
|
172
174
|
}
|
|
173
175
|
form.setValue(`accessible-${mainCollection.labels.collection}-${collection.labels.collection}`, {
|
|
@@ -190,6 +192,7 @@ export const PermissionPicker = ({
|
|
|
190
192
|
|
|
191
193
|
let relation = data?.find((record) => record.id === inputValue)
|
|
192
194
|
if (!relation) {
|
|
195
|
+
// TODO: subcollection support
|
|
193
196
|
relation = await getOne([labels.collection], inputValue, { noEmbeddingFields: true })
|
|
194
197
|
}
|
|
195
198
|
|
package/src/utils/getData.ts
CHANGED
|
@@ -48,6 +48,7 @@ export const getData = async (
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// TODO: subcollection support
|
|
51
52
|
const result = await subscribeMany(
|
|
52
53
|
[labels.collection],
|
|
53
54
|
currentQuery.constraints as QueryConstraint[],
|
|
@@ -80,6 +81,7 @@ export const getData = async (
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
const getServerData = async () => {
|
|
84
|
+
// TODO: subcollection support
|
|
83
85
|
const data = await getSome(
|
|
84
86
|
[labels.collection],
|
|
85
87
|
query.queries[0].constraints as [string, WhereFilterOp, unknown][],
|