@stoker-platform/web-app 0.5.43 → 0.5.44
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 +9 -0
- package/package.json +4 -4
- package/src/Calendar.tsx +39 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add additionalFields option to calendar
|
|
8
|
+
- @stoker-platform/node-client@0.5.28
|
|
9
|
+
- @stoker-platform/utils@0.5.22
|
|
10
|
+
- @stoker-platform/web-client@0.5.24
|
|
11
|
+
|
|
3
12
|
## 0.5.43
|
|
4
13
|
|
|
5
14
|
### 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.44",
|
|
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.28",
|
|
55
|
+
"@stoker-platform/utils": "0.5.22",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.24",
|
|
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
|
@@ -28,7 +28,14 @@ import { ScrollArea } from "./components/ui/scroll-area"
|
|
|
28
28
|
import { useOptimistic } from "./providers/OptimisticProvider"
|
|
29
29
|
import { isServerUpdate } from "./utils/isServerWrite"
|
|
30
30
|
import { isOfflineDisabled as isOfflineDisabledSync } from "./utils/isOfflineDisabled"
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
canUpdateField,
|
|
33
|
+
getField,
|
|
34
|
+
getFieldCustomization,
|
|
35
|
+
getSystemFieldsSchema,
|
|
36
|
+
isRelationField,
|
|
37
|
+
tryFunction,
|
|
38
|
+
} from "@stoker-platform/utils"
|
|
32
39
|
import cloneDeep from "lodash/cloneDeep.js"
|
|
33
40
|
import { useGlobalLoading } from "./providers/LoadingProvider"
|
|
34
41
|
import { useToast } from "./hooks/use-toast"
|
|
@@ -622,7 +629,7 @@ export function Calendar({
|
|
|
622
629
|
updatedList.push(optimisticRecord)
|
|
623
630
|
}
|
|
624
631
|
})
|
|
625
|
-
|
|
632
|
+
const mainEvents = updatedList
|
|
626
633
|
.filter((record) => record[calendarConfig.startField])
|
|
627
634
|
.map((record) => {
|
|
628
635
|
const isPendingServer = isGlobalLoading.get(record.id)?.server
|
|
@@ -663,6 +670,35 @@ export function Calendar({
|
|
|
663
670
|
}
|
|
664
671
|
return event
|
|
665
672
|
})
|
|
673
|
+
|
|
674
|
+
const additionalEvents: EventInput[] = []
|
|
675
|
+
if (calendarConfig?.additionalFields) {
|
|
676
|
+
calendarConfig.additionalFields.forEach((additionalField) => {
|
|
677
|
+
updatedList
|
|
678
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
679
|
+
.filter((record) => record[additionalField])
|
|
680
|
+
.forEach((record) => {
|
|
681
|
+
const additionalFieldSchema = getField(fields, additionalField)
|
|
682
|
+
const additionalFieldCustomization = getFieldCustomization(additionalFieldSchema, customization)
|
|
683
|
+
const label = tryFunction(additionalFieldCustomization.admin?.label) || additionalField
|
|
684
|
+
const title =
|
|
685
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
686
|
+
tryFunction(calendarConfig.eventTitle, [record]) || record[recordTitleField] || record.id
|
|
687
|
+
|
|
688
|
+
const event: EventInput = {
|
|
689
|
+
id: `${record.id}-${additionalField}`,
|
|
690
|
+
title: `${label}- ${title}`,
|
|
691
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
692
|
+
start: record[additionalField].toDate(),
|
|
693
|
+
editable: false,
|
|
694
|
+
allDay: true,
|
|
695
|
+
color: "#6b7280",
|
|
696
|
+
}
|
|
697
|
+
additionalEvents.push(event)
|
|
698
|
+
})
|
|
699
|
+
})
|
|
700
|
+
}
|
|
701
|
+
return mainEvents.concat(additionalEvents)
|
|
666
702
|
}, [
|
|
667
703
|
calendarConfig,
|
|
668
704
|
list,
|
|
@@ -956,7 +992,7 @@ export function Calendar({
|
|
|
956
992
|
selectable: canAddRecords && !isCreateDisabled && !!calendarConfig?.endField,
|
|
957
993
|
droppable: hasStartUpdateAccess,
|
|
958
994
|
eventClick(info: EventClickArg) {
|
|
959
|
-
const record = list?.find((record) => record.id === info.event.id) as StokerRecord
|
|
995
|
+
const record = list?.find((record) => record.id === info.event.id.split("-")[0]) as StokerRecord
|
|
960
996
|
goToRecord(collection, record)
|
|
961
997
|
},
|
|
962
998
|
eventDrop(info: EventDropArg) {
|