@opengis/gis 0.1.59 → 0.1.61

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/gis",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "main": "dist/import-file.js",
@@ -1,9 +1,19 @@
1
1
  import { getSelectVal } from '@opengis/fastify-table/utils.js';
2
2
 
3
- export async function attachClassifiers(rowOrRows, classifiers) {
3
+ export async function attachClassifiers(rowOrRows, classifiers = []) {
4
4
  const rows = Array.isArray(rowOrRows) ? rowOrRows : [rowOrRows];
5
5
 
6
- for (const row of rows) {
6
+ await Promise.all(rows.map(async row => {
7
+ classifiers.filter(item => item.classifier && item.name && row[item.name]).map(async ({ name, classifier }) => {
8
+ const arr = await getSelectVal({ name: classifier, values: [row[name]], ar: true });
9
+ const val = arr?.find?.(el => el.id === row[name]);
10
+ if (val?.text) { row[`${name}_data`] = val; }
11
+ row[name] = val?.text || val || row[name]; // for frontend
12
+ row[`${name}_text`] = val?.text || val || row[name]; // legacy?
13
+ });
14
+ }));
15
+
16
+ /* for (const row of rows) {
7
17
  for (const { name, classifier } of classifiers) {
8
18
  const value = row[name];
9
19
  if (value != null && classifier) {
@@ -18,9 +28,10 @@ export async function attachClassifiers(rowOrRows, classifiers) {
18
28
  ) {
19
29
  row[`${name}_text`] = matchVal;
20
30
  };
31
+
21
32
  }
22
33
  }
23
- }
34
+ } */
24
35
 
25
36
  return rowOrRows;
26
37
  }
@@ -84,7 +84,7 @@ export default async function mapTiles({ pg = pgClients.client, params = {}, que
84
84
  if (!columns?.length) return null;
85
85
 
86
86
  const pk = pg.pk?.[table] || loadTable?.key;
87
- const fData = filter ? await getFilterSQL({ pg, table: source, filterList: filter }) : {};
87
+ const fData = filter ? await getFilterSQL({ pg, table: source, filterList: loadTemplate.widgets?.find?.(el => el.id === 'filters')?.config?.filters, filter }) : {};
88
88
 
89
89
  const geomCol = parseInt(z, 10) < parseInt(pointZoom || '0', 10) || (style?.centroid && gt === 'point')
90
90
  ? `ST_Centroid(${geom})`