@opengis/fastify-table 2.5.50 → 2.5.51
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../../server/helpers/core/badge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../../server/helpers/core/badge.ts"],"names":[],"mappings":"AACA,wBAA8B,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,gBAoBxD"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import getSelectVal from "../../plugins/table/funcs/metaFormat/getSelectVal.js";
|
|
2
2
|
export default async function badge(id, options) {
|
|
3
3
|
if (!id?.toString)
|
|
4
|
-
return
|
|
4
|
+
return "-";
|
|
5
5
|
const data = options.hash?.data;
|
|
6
6
|
if (!data)
|
|
7
7
|
return id;
|
|
8
|
-
const classifier = await
|
|
9
|
-
|
|
8
|
+
const classifier = await getSelectVal({
|
|
9
|
+
name: data,
|
|
10
|
+
values: [id],
|
|
11
|
+
ar: true,
|
|
12
|
+
});
|
|
13
|
+
if (!classifier?.length)
|
|
10
14
|
return id;
|
|
11
|
-
const item = classifier
|
|
15
|
+
const item = classifier.find((el) => el.id?.toString?.() === id.toString());
|
|
12
16
|
if (!item)
|
|
13
17
|
return id;
|
|
14
|
-
return `<span style='color:${item.color ||
|
|
18
|
+
return `<span style='color:${item.color || "#14b8a6"};border-color:${item.color || "#14b8a6"}; overflow:hidden;
|
|
15
19
|
text-overflow:ellipsis; white-space:nowrap;' class="block w-fit py-1.5 px-3 rounded-full text-xs font-medium border border-teal-500 text-teal-500 max-w-[220px] text-nowrap ">${item.text}</span>`;
|
|
16
20
|
}
|