@stoker-platform/web-app 0.5.224 → 0.5.226

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @stoker-platform/web-app
2
2
 
3
+ ## 0.5.226
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: apply search to list metrics
8
+
9
+ ## 0.5.225
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @stoker-platform/node-client@0.5.88
15
+ - @stoker-platform/web-client@0.5.94
16
+ - @stoker-platform/utils@0.5.79
17
+
3
18
  ## 0.5.224
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.224",
3
+ "version": "0.5.226",
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.56.0",
54
- "@stoker-platform/node-client": "0.5.87",
55
- "@stoker-platform/utils": "0.5.78",
56
- "@stoker-platform/web-client": "0.5.93",
54
+ "@stoker-platform/node-client": "0.5.88",
55
+ "@stoker-platform/utils": "0.5.79",
56
+ "@stoker-platform/web-client": "0.5.94",
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
@@ -1345,9 +1345,9 @@ export function List({
1345
1345
  if (permissions?.Role && (!metric.roles || metric.roles.includes(permissions?.Role))) {
1346
1346
  if (metric.type === "custom" && metric.formula) {
1347
1347
  // eslint-disable-next-line security/detect-object-injection
1348
- values[index] = metric.formula(list).toString() || ""
1348
+ values[index] = metric.formula(searchList).toString() || ""
1349
1349
  } else if (metric.type === "count") {
1350
- let value = (list?.length || 0).toString()
1350
+ let value = (searchList.length || 0).toString()
1351
1351
  if (metric.prefix) {
1352
1352
  value = `${metric.prefix}${value}`
1353
1353
  }
@@ -1361,7 +1361,7 @@ export function List({
1361
1361
  let value: string
1362
1362
  const field = getField(fields, metric.field)
1363
1363
  const fieldCustomization = getFieldCustomization(field, customization)
1364
- list?.forEach((record: StokerRecord) => {
1364
+ searchList.forEach((record: StokerRecord) => {
1365
1365
  if (!metric.field) return
1366
1366
  const value = record[metric.field]
1367
1367
  if (field.type === "Number" && typeof value === "number") {
@@ -1395,7 +1395,7 @@ export function List({
1395
1395
  let value: string
1396
1396
  const field = getField(fields, metric.field)
1397
1397
  const fieldCustomization = getFieldCustomization(field, customization)
1398
- list?.forEach((record: StokerRecord) => {
1398
+ searchList.forEach((record: StokerRecord) => {
1399
1399
  if (!metric.field) return
1400
1400
  const value = record[metric.field]
1401
1401
  if (field.type === "Number" && typeof value === "number") {
@@ -1406,7 +1406,7 @@ export function List({
1406
1406
  total = newTotal
1407
1407
  }
1408
1408
  })
1409
- const average = total / list?.length || 0
1409
+ const average = total / searchList.length || 0
1410
1410
  const currency = tryFunction(fieldCustomization?.admin?.currency)
1411
1411
  if (currency) {
1412
1412
  value = `${currency}${average.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
@@ -1424,7 +1424,7 @@ export function List({
1424
1424
  } else if (metric.type === "area") {
1425
1425
  if (metric.metricField1) {
1426
1426
  const chartData: MetricValue = []
1427
- list?.forEach((record: StokerRecord) => {
1427
+ searchList.forEach((record: StokerRecord) => {
1428
1428
  if (!record[metric.dateField] || !metric.metricField1) return
1429
1429
  const date = DateTime.fromJSDate((record[metric.dateField] as Timestamp).toDate(), {
1430
1430
  zone: timezone,
@@ -1460,7 +1460,7 @@ export function List({
1460
1460
  const chartData: MetricValue = []
1461
1461
  const dateMap = new Map<string, number>()
1462
1462
 
1463
- list?.forEach((record: StokerRecord) => {
1463
+ searchList.forEach((record: StokerRecord) => {
1464
1464
  if (!record[metric.dateField]) return
1465
1465
  const date = DateTime.fromJSDate((record[metric.dateField] as Timestamp).toDate(), {
1466
1466
  zone: timezone,
@@ -1489,7 +1489,7 @@ export function List({
1489
1489
  }
1490
1490
  })
1491
1491
  return values
1492
- }, [list])
1492
+ }, [list, searchList])
1493
1493
 
1494
1494
  const [timeRange, setTimeRange] = useState<Record<string, string>>({})
1495
1495