@stoker-platform/web-app 0.5.36 → 0.5.38
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 +17 -0
- package/package.json +4 -4
- package/src/Collection.tsx +4 -0
- package/src/Form.tsx +5 -1
- package/src/utils/getRelationFields.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @stoker-platform/node-client@0.5.23
|
|
8
|
+
- @stoker-platform/utils@0.5.17
|
|
9
|
+
- @stoker-platform/web-client@0.5.19
|
|
10
|
+
|
|
11
|
+
## 0.5.37
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- feat: provide parent record to onFormOpen hook
|
|
16
|
+
- @stoker-platform/node-client@0.5.22
|
|
17
|
+
- @stoker-platform/utils@0.5.16
|
|
18
|
+
- @stoker-platform/web-client@0.5.18
|
|
19
|
+
|
|
3
20
|
## 0.5.36
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/web-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.38",
|
|
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.8",
|
|
53
53
|
"@sentry/react": "^10.38.0",
|
|
54
|
-
"@stoker-platform/node-client": "0.5.
|
|
55
|
-
"@stoker-platform/utils": "0.5.
|
|
56
|
-
"@stoker-platform/web-client": "0.5.
|
|
54
|
+
"@stoker-platform/node-client": "0.5.23",
|
|
55
|
+
"@stoker-platform/utils": "0.5.17",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.19",
|
|
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/Collection.tsx
CHANGED
|
@@ -2088,6 +2088,10 @@ function Collection({
|
|
|
2088
2088
|
path={[labels.collection]}
|
|
2089
2089
|
record={createPrePopulatedRecord()}
|
|
2090
2090
|
draft={true}
|
|
2091
|
+
parentCollection={
|
|
2092
|
+
relationCollection?.labels.collection
|
|
2093
|
+
}
|
|
2094
|
+
parentRecord={relationParent}
|
|
2091
2095
|
onSuccess={() => {
|
|
2092
2096
|
setIsCreateDialogOpen(false)
|
|
2093
2097
|
setSelectedDateRange(null)
|
package/src/Form.tsx
CHANGED
|
@@ -223,6 +223,8 @@ interface FormProps {
|
|
|
223
223
|
onSaveRecord?: () => void
|
|
224
224
|
rowSelection?: StokerRecord[]
|
|
225
225
|
fromRelationList?: string
|
|
226
|
+
parentCollection?: string
|
|
227
|
+
parentRecord?: StokerRecord
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
interface FieldProps {
|
|
@@ -2164,6 +2166,8 @@ function RecordForm({
|
|
|
2164
2166
|
onSaveRecord,
|
|
2165
2167
|
rowSelection,
|
|
2166
2168
|
fromRelationList,
|
|
2169
|
+
parentCollection,
|
|
2170
|
+
parentRecord,
|
|
2167
2171
|
}: FormProps) {
|
|
2168
2172
|
const { labels, access, fields, auth, recordTitleField, softDelete, relationLists } = collection
|
|
2169
2173
|
const tenantId = getTenant()
|
|
@@ -3382,7 +3386,7 @@ function RecordForm({
|
|
|
3382
3386
|
if (!onFormOpenCalledRef.current && operation === "create" && customization.admin?.onFormOpen) {
|
|
3383
3387
|
record ||= {} as StokerRecord
|
|
3384
3388
|
const recordClone = cloneDeep(record)
|
|
3385
|
-
await customization.admin?.onFormOpen("create", record)
|
|
3389
|
+
await customization.admin?.onFormOpen("create", record, parentCollection, parentRecord)
|
|
3386
3390
|
const recordKeys = Object.keys(record) as Array<keyof typeof record>
|
|
3387
3391
|
for (const key of recordKeys) {
|
|
3388
3392
|
// eslint-disable-next-line security/detect-object-injection
|
|
@@ -18,6 +18,7 @@ export const getRelationFields = (collection: CollectionSchema) => {
|
|
|
18
18
|
for (const field of fields) {
|
|
19
19
|
const fieldCustomization = getFieldCustomization(field, customization)
|
|
20
20
|
if (!isRelationField(field)) continue
|
|
21
|
+
const queryFullRecord = tryFunction(fieldCustomization.admin?.queryFullRecord)
|
|
21
22
|
const condition = tryFunction(fieldCustomization.admin?.condition?.form, ["update"])
|
|
22
23
|
const roleGroup = getRoleGroup(permissions.Role, collectionSchema, schema)
|
|
23
24
|
if (!roleGroup) throw new Error("PERMISSION_DENIED")
|
|
@@ -27,7 +28,7 @@ export const getRelationFields = (collection: CollectionSchema) => {
|
|
|
27
28
|
const titleField = field.titleField
|
|
28
29
|
if (
|
|
29
30
|
(!fieldCustomization.admin?.condition?.form || condition) &&
|
|
30
|
-
!(titleField && field.includeFields?.includes(titleField))
|
|
31
|
+
(!(titleField && field.includeFields?.includes(titleField)) || queryFullRecord)
|
|
31
32
|
) {
|
|
32
33
|
relationFields.push(field.name)
|
|
33
34
|
}
|