@opengis/fastify-table 1.0.11 → 1.0.12
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/package.json
CHANGED
|
@@ -8,13 +8,14 @@ export default async function metaFormat({ rows, table }) {
|
|
|
8
8
|
// cls & select format
|
|
9
9
|
|
|
10
10
|
await Promise.all(selectCols?.map(async (attr) => {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
11
|
+
const values = [...new Set(rows?.map((el) => el[attr.name]).flat())].filter((el) => el);
|
|
12
|
+
if (!values.length) return null;
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
14
|
+
const cls = await getSelectVal({ name: attr.data, values });
|
|
15
|
+
if (!cls) return null;
|
|
16
16
|
rows.forEach(el => {
|
|
17
|
-
|
|
17
|
+
const val = el[attr.name]?.map?.(c => cls[c] || c) || cls[el[attr.name]] || el[attr.name];
|
|
18
|
+
Object.assign(el, { [`${attr.name}_text`]: val });
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
return null;
|