@stoker-platform/web-app 0.5.30 → 0.5.32
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 +15 -0
- package/package.json +4 -4
- package/src/List.tsx +6 -2
- package/src/utils/getFormattedFieldValue.tsx +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @stoker-platform/web-app
|
|
2
2
|
|
|
3
|
+
## 0.5.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add custom list metric
|
|
8
|
+
- @stoker-platform/node-client@0.5.20
|
|
9
|
+
- @stoker-platform/utils@0.5.14
|
|
10
|
+
- @stoker-platform/web-client@0.5.15
|
|
11
|
+
|
|
12
|
+
## 0.5.31
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix: treat modified display value as Computed field type
|
|
17
|
+
|
|
3
18
|
## 0.5.30
|
|
4
19
|
|
|
5
20
|
### 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.32",
|
|
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.20",
|
|
55
|
+
"@stoker-platform/utils": "0.5.14",
|
|
56
|
+
"@stoker-platform/web-client": "0.5.15",
|
|
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/List.tsx
CHANGED
|
@@ -1133,7 +1133,10 @@ export function List({
|
|
|
1133
1133
|
const values: Record<string, MetricValue> = {}
|
|
1134
1134
|
metrics?.forEach((metric: Metric | Chart, index: number) => {
|
|
1135
1135
|
if (permissions?.Role && (!metric.roles || metric.roles.includes(permissions?.Role))) {
|
|
1136
|
-
if (metric.type === "
|
|
1136
|
+
if (metric.type === "custom" && metric.formula) {
|
|
1137
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
1138
|
+
values[index] = metric.formula(list).toString() || ""
|
|
1139
|
+
} else if (metric.type === "count") {
|
|
1137
1140
|
let value = (list?.length || 0).toString()
|
|
1138
1141
|
if (metric.prefix) {
|
|
1139
1142
|
value = `${metric.prefix}${value}`
|
|
@@ -1316,7 +1319,8 @@ export function List({
|
|
|
1316
1319
|
if (
|
|
1317
1320
|
metric.type === "sum" ||
|
|
1318
1321
|
metric.type === "average" ||
|
|
1319
|
-
metric.type === "count"
|
|
1322
|
+
metric.type === "count" ||
|
|
1323
|
+
metric.type === "custom"
|
|
1320
1324
|
) {
|
|
1321
1325
|
const metricTitle =
|
|
1322
1326
|
metric.title || `Total ${collectionTitle || labels.collection}`
|
|
@@ -67,7 +67,9 @@ export const getFormattedFieldValue = (
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
let value = record[field.name]
|
|
70
|
+
let modified = false
|
|
70
71
|
if (fieldCustomization?.admin?.modifyDisplayValue) {
|
|
72
|
+
modified = true
|
|
71
73
|
value = tryFunction(fieldCustomization.admin.modifyDisplayValue, [
|
|
72
74
|
record,
|
|
73
75
|
card ? "card" : form ? "form" : "list",
|
|
@@ -134,7 +136,23 @@ export const getFormattedFieldValue = (
|
|
|
134
136
|
)
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
if (
|
|
139
|
+
if (modified) {
|
|
140
|
+
if (value === "tick") {
|
|
141
|
+
return (
|
|
142
|
+
<div className="w-full flex justify-start">
|
|
143
|
+
<Check />
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
} else if (value === "cross") {
|
|
147
|
+
return (
|
|
148
|
+
<div className="w-full flex justify-start">
|
|
149
|
+
<X />
|
|
150
|
+
</div>
|
|
151
|
+
)
|
|
152
|
+
} else {
|
|
153
|
+
return getStandardDisplay()
|
|
154
|
+
}
|
|
155
|
+
} else if (isRelationField(field)) {
|
|
138
156
|
const titleField = field.titleField
|
|
139
157
|
const relationCollection = schema.collections[field.collection]
|
|
140
158
|
if (["OneToOne", "OneToMany"].includes(field.type)) {
|