@opengis/fastify-table 1.1.108 → 1.1.109
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
|
@@ -20,6 +20,7 @@ ALTER TABLE admin.users add column if not exists user_personal_code text;
|
|
|
20
20
|
ALTER TABLE admin.users add column if not exists last_activity_date timestamp without time zone;
|
|
21
21
|
ALTER TABLE admin.users add column if not exists user_type text DEFAULT 'regular'::text;
|
|
22
22
|
ALTER TABLE admin.users add column if not exists user_rnokpp text;
|
|
23
|
+
ALTER TABLE admin.users alter column user_rnokpp drop not null;
|
|
23
24
|
ALTER TABLE admin.users add column if not exists salt text;
|
|
24
25
|
ALTER TABLE admin.users add column if not exists cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
|
|
25
26
|
ALTER TABLE admin.users add column if not exists editor_id text;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { handlebars } from '@opengis/fastify-hb/utils.js';
|
|
2
|
+
|
|
1
3
|
import getTemplate from '../getTemplate.js';
|
|
2
4
|
import getSelectVal from './getSelectVal.js';
|
|
3
5
|
|
|
@@ -7,8 +9,15 @@ export default async function metaFormat({ rows, table }) {
|
|
|
7
9
|
const loadTable = await getTemplate('table', table);
|
|
8
10
|
const selectCols = loadTable?.columns?.filter((e) => e.data);
|
|
9
11
|
const metaCls = Object.keys(loadTable?.meta?.cls || {}).map((el) => ({ name: el, data: loadTable?.meta?.cls[el] }));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
const htmlCols = loadTable?.columns?.filter((e) => e.name && e.format === 'html' && e.html);
|
|
13
|
+
if (!selectCols?.length && !metaCls?.length && !htmlCols?.length) return rows;
|
|
14
|
+
|
|
15
|
+
await Promise.all(htmlCols?.map(async (attr) => {
|
|
16
|
+
await Promise.all(rows.filter(row => row?.[attr.name])?.map(async (row) => {
|
|
17
|
+
const html = await handlebars.compile(attr.html)(row);
|
|
18
|
+
Object.assign(row, { [attr.name]: html?.replaceAll(/<[^>]*>/g, '')?.replace(/\n/g, '')?.trim() });
|
|
19
|
+
}));
|
|
20
|
+
}));
|
|
12
21
|
// cls & select format
|
|
13
22
|
|
|
14
23
|
await Promise.all(selectCols.concat(metaCls)?.map(async (attr) => {
|