@opengis/fastify-table 1.0.12 → 1.0.14
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
|
@@ -12,7 +12,7 @@ export default async function metaFormat({ name, values }) {
|
|
|
12
12
|
? await pg.client.query(`with c(id,text) as (${cls.sql}) select * from c where id = any('{${values.filter(el => !cache[el])}}')`).then(el => el.rows)
|
|
13
13
|
: []);
|
|
14
14
|
|
|
15
|
-
const clsAr = { ...cache, ...data.reduce((p, el) => ({ ...p, [el.id.toString()]: el.text }), {}) };
|
|
15
|
+
const clsAr = { ...cache, ...data.reduce((p, el) => ({ ...p, [el.id.toString()]: el.color ? el : el.text }), {}) };
|
|
16
16
|
if (!cls.arr && data.length) {
|
|
17
17
|
redis.hmset(key, clsAr);
|
|
18
18
|
}
|
|
@@ -15,7 +15,8 @@ export default async function metaFormat({ rows, table }) {
|
|
|
15
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
|
-
|
|
18
|
+
if (!val) return;
|
|
19
|
+
Object.assign(el, { [val?.color ? `${attr.name}_data` : `${attr.name}_text`]: (val.color ? val : val.text || val) });
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
return null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "1",
|
|
4
|
+
"text": "Добрий",
|
|
5
|
+
"en": "Good",
|
|
6
|
+
"color": "#006400"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "2",
|
|
10
|
+
"text": "Задовільний",
|
|
11
|
+
"en": "Satisfying",
|
|
12
|
+
"color": "#ffd700"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "3",
|
|
16
|
+
"text": "Незадовільний",
|
|
17
|
+
"en": "Dissatisfying",
|
|
18
|
+
"color": "#b22222"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "3",
|
|
4
|
+
"text": "Заміна",
|
|
5
|
+
"en": "Replacement",
|
|
6
|
+
"color": "#B8860B"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "2",
|
|
10
|
+
"text": "Видалення",
|
|
11
|
+
"en": "Removal",
|
|
12
|
+
"color": "#8B0000"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "1",
|
|
16
|
+
"text": "Обрізка",
|
|
17
|
+
"en": "Cutting",
|
|
18
|
+
"color": "#DEB887"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "4",
|
|
22
|
+
"text": "Відсутні",
|
|
23
|
+
"en": "None",
|
|
24
|
+
"color": "#2E8B57"
|
|
25
|
+
}
|
|
26
|
+
]
|