@vectoriahq/quac 0.6.0 → 0.7.0-next.1
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/dist/generate/normalizedProject.d.ts +5 -3
- package/dist/generate/normalizedProject.js +17 -5
- package/dist/generate/stacCatalogue.js +11 -2
- package/dist/generate/wmsStacCatalogue.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/model/QgsProject.d.ts +8 -0
- package/dist/model/Stac.d.ts +4 -5
- package/dist/model/WmsProject.d.ts +6 -1
- package/dist/parse/parseLayers.js +38 -0
- package/package.json +1 -1
- package/src/schema/quac.schema.json +4 -0
|
@@ -301,8 +301,10 @@ export declare function readCatalogueInitialView(catalog: StacCatalog): Normaliz
|
|
|
301
301
|
*/
|
|
302
302
|
/** The field the source nominates as the layer's title attribute. */
|
|
303
303
|
export declare function readCollectionDisplayField(collection: StacCollection): string | null;
|
|
304
|
-
/**
|
|
304
|
+
/** Each field's alias, its column's `title`. A column with a blank or no `title` is absent. */
|
|
305
305
|
export declare function readCollectionFieldAliases(collection: StacCollection): Record<string, string>;
|
|
306
|
+
/** Each field's comment, its column's `description`, trimmed. A column with a blank or no `description` is absent. */
|
|
307
|
+
export declare function readCollectionFieldComments(collection: StacCollection): Record<string, string>;
|
|
306
308
|
/**
|
|
307
309
|
* Every field name a Collection declares, in the order it declares them.
|
|
308
310
|
* Empty for a Collection with no `table:columns`. Read from the catalogue
|
|
@@ -373,8 +375,8 @@ export declare function readCollectionFieldAttachments(collection: StacCollectio
|
|
|
373
375
|
*
|
|
374
376
|
* Only `quac:editable: false` makes a field read-only, only
|
|
375
377
|
* `quac:searchable: false` keeps it out of a search, and only
|
|
376
|
-
* `quac:hidden: true`, `quac:reuse_last_value: true
|
|
377
|
-
* set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
378
|
+
* `quac:hidden: true`, `quac:reuse_last_value: true`, `quac:color: true` and
|
|
379
|
+
* `quac:label_on_top: true` set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
378
380
|
* is a `quac:control` other than `buttons` or `dropdown`.
|
|
379
381
|
* A default of an unrecognised `kind`, or a `fixed` one without a `value`, is
|
|
380
382
|
* left out; a `uuid` one of an omitted or unrecognised `format` reads as
|
|
@@ -387,16 +387,26 @@ function* declaredColumns(collection) {
|
|
|
387
387
|
yield [name, candidate];
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
/**
|
|
390
|
+
/** Each field's alias, its column's `title`. A column with a blank or no `title` is absent. */
|
|
391
391
|
export function readCollectionFieldAliases(collection) {
|
|
392
392
|
const aliases = {};
|
|
393
393
|
for (const [name, column] of declaredColumns(collection)) {
|
|
394
|
-
const alias = readNonBlank(column.title)
|
|
394
|
+
const alias = readNonBlank(column.title);
|
|
395
395
|
if (alias)
|
|
396
396
|
aliases[name] = alias;
|
|
397
397
|
}
|
|
398
398
|
return aliases;
|
|
399
399
|
}
|
|
400
|
+
/** Each field's comment, its column's `description`, trimmed. A column with a blank or no `description` is absent. */
|
|
401
|
+
export function readCollectionFieldComments(collection) {
|
|
402
|
+
const comments = {};
|
|
403
|
+
for (const [name, column] of declaredColumns(collection)) {
|
|
404
|
+
const comment = readNonBlank(column.description);
|
|
405
|
+
if (comment)
|
|
406
|
+
comments[name] = comment;
|
|
407
|
+
}
|
|
408
|
+
return comments;
|
|
409
|
+
}
|
|
400
410
|
/**
|
|
401
411
|
* Every field name a Collection declares, in the order it declares them.
|
|
402
412
|
* Empty for a Collection with no `table:columns`. Read from the catalogue
|
|
@@ -584,8 +594,8 @@ export function readCollectionFieldAttachments(collection) {
|
|
|
584
594
|
*
|
|
585
595
|
* Only `quac:editable: false` makes a field read-only, only
|
|
586
596
|
* `quac:searchable: false` keeps it out of a search, and only
|
|
587
|
-
* `quac:hidden: true`, `quac:reuse_last_value: true
|
|
588
|
-
* set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
597
|
+
* `quac:hidden: true`, `quac:reuse_last_value: true`, `quac:color: true` and
|
|
598
|
+
* `quac:label_on_top: true` set theirs. A `quac:icon` that is not an `https://` address is left out, as
|
|
589
599
|
* is a `quac:control` other than `buttons` or `dropdown`.
|
|
590
600
|
* A default of an unrecognised `kind`, or a `fixed` one without a `value`, is
|
|
591
601
|
* left out; a `uuid` one of an omitted or unrecognised `format` reads as
|
|
@@ -616,11 +626,12 @@ export function readCollectionFieldEditRules(collection) {
|
|
|
616
626
|
const notSearchable = candidate['quac:searchable'] === false;
|
|
617
627
|
const icon = readHttpsAddress(candidate['quac:icon']);
|
|
618
628
|
const control = candidate['quac:control'] === 'buttons' || candidate['quac:control'] === 'dropdown' ? candidate['quac:control'] : null;
|
|
629
|
+
const labelOnTop = candidate['quac:label_on_top'] === true;
|
|
619
630
|
const defaultExpression = readDefaultExpression(candidate['quac:default']);
|
|
620
631
|
const relation = relations[name];
|
|
621
632
|
// A field storing several keys gets no list, so no rule about its blank choice.
|
|
622
633
|
const valueRelation = relation && relation.allow_multi !== true ? { allowNull: relation.allow_null === true, relation } : null;
|
|
623
|
-
if (valueRelation || readOnly || defaultValue || defaultExpression || notNull || unique || constraintExpression || hidden || reuseLastValue || duplicatePolicy || checkbox || range || dateFormat || colour || notSearchable || icon || control) {
|
|
634
|
+
if (valueRelation || readOnly || defaultValue || defaultExpression || notNull || unique || constraintExpression || hidden || reuseLastValue || duplicatePolicy || checkbox || range || dateFormat || colour || notSearchable || icon || control || labelOnTop) {
|
|
624
635
|
rules[name] = {
|
|
625
636
|
readOnly, defaultValue, notNull, unique, hidden, reuseLastValue, duplicatePolicy,
|
|
626
637
|
...(constraintExpression ? { constraintExpression } : {}),
|
|
@@ -632,6 +643,7 @@ export function readCollectionFieldEditRules(collection) {
|
|
|
632
643
|
...(notSearchable ? { notSearchable } : {}),
|
|
633
644
|
...(icon ? { icon } : {}),
|
|
634
645
|
...(control ? { control } : {}),
|
|
646
|
+
...(labelOnTop ? { labelOnTop } : {}),
|
|
635
647
|
...(valueRelation ? { valueRelation } : {})
|
|
636
648
|
};
|
|
637
649
|
}
|
|
@@ -357,7 +357,7 @@ function qgsLayerToNormalized(layer, context, geometryFilter = geometryFilterOf(
|
|
|
357
357
|
geometryType: layer.geometryType,
|
|
358
358
|
wkbTypes: layer.wkbType ? [layer.wkbType] : [],
|
|
359
359
|
qgisServerNames: qgisServerNamesOf(layer, context),
|
|
360
|
-
tableColumns: deriveTableColumns(geojson, layer.fieldNames, layer.fieldAliases, layer.fieldValueMaps, layer.fieldAttachments, layer.fieldEditRules, valueRelations, layer.formLayout ?? null, layer.fieldIcons, layer.fieldControls),
|
|
360
|
+
tableColumns: deriveTableColumns(geojson, layer.fieldNames, layer.fieldAliases, layer.fieldValueMaps, layer.fieldAttachments, layer.fieldEditRules, valueRelations, layer.formLayout ?? null, layer.fieldIcons, layer.fieldControls, layer.fieldComments),
|
|
361
361
|
formOrder: layer.formLayout?.fields.map((field) => field.name),
|
|
362
362
|
assets: buildLayerAssets(layer, projectPath, geometryFilter),
|
|
363
363
|
keywords: metadata.keywords.length > 0 ? metadata.keywords : undefined,
|
|
@@ -683,6 +683,7 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
683
683
|
* GeoJSON properties or alias keys, so callers that
|
|
684
684
|
* haven't parsed fieldConfiguration still get something)
|
|
685
685
|
* - **title** from QGIS field aliases when set (non-empty)
|
|
686
|
+
* - **description** from the field's custom comment in QGIS's Attributes Form
|
|
686
687
|
* - **type** inferred from every GeoJSON property value when data
|
|
687
688
|
* is available; omitted otherwise (QGIS doesn't declare
|
|
688
689
|
* field types in the .qgs for WFS layers — the type
|
|
@@ -717,12 +718,15 @@ function unionExtent(layers, layerWgs84Extents) {
|
|
|
717
718
|
* from the layer's `quac_icon_<field>` variable
|
|
718
719
|
* - **quac:control** the control the edit form draws the field's choices
|
|
719
720
|
* with, from the layer's `quac_control_<field>` variable
|
|
721
|
+
* - **quac:label_on_top**
|
|
722
|
+
* that the form puts the field's name above its value,
|
|
723
|
+
* from QGIS's Label on top in the Attributes Form
|
|
720
724
|
*
|
|
721
725
|
* The QGS fieldConfiguration is the source of truth for "what fields
|
|
722
726
|
* exist": this means a hidden WFS layer's schema is fully visible to the
|
|
723
727
|
* dev panel and to STAC clients before any data is fetched.
|
|
724
728
|
*/
|
|
725
|
-
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = {}, fieldAttachments = {}, fieldEditRules = {}, fieldValueRelations = {}, formLayout = null, fieldIcons = {}, fieldControls = {}) {
|
|
729
|
+
function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps = {}, fieldAttachments = {}, fieldEditRules = {}, fieldValueRelations = {}, formLayout = null, fieldIcons = {}, fieldControls = {}, fieldComments = {}) {
|
|
726
730
|
const observedTypes = new Map();
|
|
727
731
|
const orderedFieldNames = [];
|
|
728
732
|
const seen = new Set();
|
|
@@ -763,6 +767,9 @@ function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
|
763
767
|
const alias = fieldAliases[name];
|
|
764
768
|
if (alias)
|
|
765
769
|
column.title = alias;
|
|
770
|
+
const comment = fieldComments[name];
|
|
771
|
+
if (comment)
|
|
772
|
+
column.description = comment;
|
|
766
773
|
const values = fieldValueMaps[name];
|
|
767
774
|
if (values)
|
|
768
775
|
column['quac:values'] = values;
|
|
@@ -817,6 +824,8 @@ function deriveTableColumns(geojson, fieldNames, fieldAliases, fieldValueMaps =
|
|
|
817
824
|
const control = fieldControls[name];
|
|
818
825
|
if (control)
|
|
819
826
|
column['quac:control'] = control;
|
|
827
|
+
if (editRule?.labelOnTop)
|
|
828
|
+
column['quac:label_on_top'] = true;
|
|
820
829
|
if (formLayout) {
|
|
821
830
|
const placed = placedFields.get(name);
|
|
822
831
|
if (!placed)
|
|
@@ -169,6 +169,9 @@ function deriveTableColumnsFromAttributes(attributes) {
|
|
|
169
169
|
const column = { name: attr.name };
|
|
170
170
|
if (attr.alias)
|
|
171
171
|
column.title = attr.alias;
|
|
172
|
+
const comment = attr.comment.trim();
|
|
173
|
+
if (comment)
|
|
174
|
+
column.description = comment;
|
|
172
175
|
const stacType = mapQtTypeToStacTableType(attr.type, attr.typeName);
|
|
173
176
|
if (stacType)
|
|
174
177
|
column.type = stacType;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionR
|
|
|
28
28
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from './model/stacPmtiles.ts';
|
|
29
29
|
export type { StacPmtilesSource } from './model/stacPmtiles.ts';
|
|
30
30
|
export type { StacCompanionData } from './generate/stacCatalogue.ts';
|
|
31
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
31
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from './generate/normalizedProject.ts';
|
|
32
32
|
export type { CollectionFilter, CollectionFormLayout, CollectionRelation, CollectionRelationField } from './generate/normalizedProject.ts';
|
|
33
33
|
export { generateStacCatalogueFromWfsCapabilities } from './generate/wfsStacCatalogue.ts';
|
|
34
34
|
export type { WfsStacCatalogueOptions } from './generate/wfsStacCatalogue.ts';
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { DATA_ROLE, findAssetByRole, readDataAsset } from "./model/stacAssetRole
|
|
|
20
20
|
export { THUMBNAIL_ROLE, readCollectionAttribution, readCollectionDeprecation, readCollectionSelfHref, readCollectionThumbnail } from "./model/stacCollectionNotes.js";
|
|
21
21
|
export { FILE_EXTENSION, FILE_SIZE_FIELD, TABLE_ROW_COUNT_FIELD, readCollectionRowCount, readDataAssetFileSize } from "./model/stacSizeAndCount.js";
|
|
22
22
|
export { PMTILES_MEDIA_TYPE, VISUAL_ROLE, readCollectionPmtiles } from "./model/stacPmtiles.js";
|
|
23
|
-
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
23
|
+
export { QUAC_ACTIVE_COLLECTION_FIELD, QUAC_FILTERS_FIELD, QUAC_FORM_ORDER_FIELD, QUAC_LOCKS_FIELD, QUAC_MUTUALLY_EXCLUSIVE_FIELD, QUAC_PRIVATE_FIELD, readCatalogueActiveCollection, readCatalogueInitialView, readCollectionDisplayField, readCollectionEditable, readCollectionFieldAliases, readCollectionFieldComments, readCollectionFieldAttachments, readCollectionFieldEditRules, readCollectionFieldNames, readCollectionFieldTypes, readCollectionFieldValueRelations, readCollectionFieldValues, readCollectionFormLayout, readCollectionGeometryType, readCollectionIdentifiable, readCollectionMeasurement, readCollectionOpacity, readCollectionIcon, readCollectionLegendImage, readCollectionFilters, readCollectionLocks, readCollectionPrivate, readCollectionRelatedTo, readCollectionScaleRange, readCollectionVisibility, statedOpacity } from "./generate/normalizedProject.js";
|
|
24
24
|
export { generateStacCatalogueFromWfsCapabilities } from "./generate/wfsStacCatalogue.js";
|
|
25
25
|
export { generateStacCatalogueFromFolder } from "./generate/folderStacCatalogue.js";
|
|
26
26
|
export { generateCollectionForDroppedFile, generateCollectionForLinkedFile } from "./generate/fileLayerCollection.js";
|
|
@@ -224,6 +224,12 @@ export interface LayerEntry {
|
|
|
224
224
|
* Phase 5 to populate the `title` field on STAC `table:columns`.
|
|
225
225
|
*/
|
|
226
226
|
fieldAliases: Record<string, string>;
|
|
227
|
+
/**
|
|
228
|
+
* Each field's comment from the Attributes Form's Comment, a custom comment
|
|
229
|
+
* QGIS 4.2 and later saves in the project as `<customComments>`. Fields with
|
|
230
|
+
* none, or a blank one, are absent.
|
|
231
|
+
*/
|
|
232
|
+
fieldComments?: Record<string, string>;
|
|
227
233
|
/**
|
|
228
234
|
* The fields QGIS Server leaves out of WMS (GetProjectSettings, GetFeatureInfo)
|
|
229
235
|
* and of WFS (DescribeFeatureType, GetFeature): the **WMS** and **WFS**
|
|
@@ -527,6 +533,8 @@ export interface FieldEditRule {
|
|
|
527
533
|
icon?: string | null;
|
|
528
534
|
/** The control the edit form draws the field's choices with. Null or absent where the source asks for none. */
|
|
529
535
|
control?: FieldControl | null;
|
|
536
|
+
/** True where the source's form puts the field's name above its value: QGIS's Label on top. */
|
|
537
|
+
labelOnTop?: boolean;
|
|
530
538
|
}
|
|
531
539
|
/** How the edit form draws a field's list of choices: a row of `buttons`, or a `dropdown`. */
|
|
532
540
|
export type FieldControl = 'buttons' | 'dropdown';
|
package/dist/model/Stac.d.ts
CHANGED
|
@@ -131,16 +131,13 @@ export interface StacLink {
|
|
|
131
131
|
/** Table extension column descriptor (`table:columns`), at the version `TABLE_EXTENSION` names. */
|
|
132
132
|
export interface TableColumn {
|
|
133
133
|
name: string;
|
|
134
|
-
/**
|
|
135
|
-
* Human-readable field label declared by the source. Readers treat either
|
|
136
|
-
* `title` or `description` as the display label, with `title` taking
|
|
137
|
-
* precedence when both are present.
|
|
138
|
-
*/
|
|
134
|
+
/** The field's alias: the name the source shows for it in place of `name`. */
|
|
139
135
|
title?: string;
|
|
140
136
|
/** The column's type: the `TableColumnType` an adapter maps the source's type to, or, for a QGIS Server type this package does not map, its lowercased type name. */
|
|
141
137
|
type?: string;
|
|
142
138
|
/** The column's type as a STAC common metadata data type, written beside a `type` that maps to one. */
|
|
143
139
|
data_type?: TableColumnDataType;
|
|
140
|
+
/** The field's comment: a note on what the field holds, which the source's form shows beside the field's name. */
|
|
144
141
|
description?: string;
|
|
145
142
|
/** The values the source restricts the field to: a QGIS ValueMap widget or an ArcGIS coded-value domain. */
|
|
146
143
|
'quac:values'?: TableColumnValue[];
|
|
@@ -195,6 +192,8 @@ export interface TableColumn {
|
|
|
195
192
|
'quac:icon'?: string;
|
|
196
193
|
/** The control the source asks the edit form to draw the column's choices with. */
|
|
197
194
|
'quac:control'?: 'buttons' | 'dropdown';
|
|
195
|
+
/** Written only as `true`: the source's form puts the column's name above its value. */
|
|
196
|
+
'quac:label_on_top'?: true;
|
|
198
197
|
}
|
|
199
198
|
/**
|
|
200
199
|
* A column whose choices come from another Collection's records: `key` is the
|
|
@@ -100,6 +100,11 @@ export interface WmsAttribute {
|
|
|
100
100
|
precision: number;
|
|
101
101
|
/** Editor widget hint from QGIS (e.g. "TextEdit", "Range", "DateTime", "CheckBox"). */
|
|
102
102
|
editType: string;
|
|
103
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* The comment the field's data gives, such as a PostgreSQL column comment:
|
|
105
|
+
* QGIS Server writes `QgsField::comment()`, not the custom comment a project
|
|
106
|
+
* sets (`qgswmsgetcapabilities.cpp`, `qgis/QGIS@master`, read 2026-11-19).
|
|
107
|
+
* Empty where there is none.
|
|
108
|
+
*/
|
|
104
109
|
comment: string;
|
|
105
110
|
}
|
|
@@ -104,6 +104,7 @@ function parseMapLayer(maplayer, notes) {
|
|
|
104
104
|
editable: maplayer.getAttribute('readOnly') !== '1',
|
|
105
105
|
fieldNames,
|
|
106
106
|
fieldAliases,
|
|
107
|
+
fieldComments: parseFieldComments(maplayer),
|
|
107
108
|
...serverHiddenFieldsOf(maplayer),
|
|
108
109
|
styles,
|
|
109
110
|
activeStyleIndex: activeIndex,
|
|
@@ -622,6 +623,15 @@ function parseFieldEditRules(maplayer, note) {
|
|
|
622
623
|
if (reuse)
|
|
623
624
|
ruleFor(name).reuseLastValue = true;
|
|
624
625
|
}
|
|
626
|
+
// QGIS reads the flag as a number, any non-zero one setting it
|
|
627
|
+
// (`QgsEditFormConfig::readXml`, `src/core/editform/qgseditformconfig.cpp`,
|
|
628
|
+
// `qgis/QGIS@master`, read 2026-11-19).
|
|
629
|
+
for (const node of directChild(maplayer, 'labelOnTop')?.querySelectorAll(':scope > field') ?? []) {
|
|
630
|
+
const name = node.getAttribute('name');
|
|
631
|
+
const flag = Number(node.getAttribute('labelOnTop'));
|
|
632
|
+
if (name && Number.isInteger(flag) && flag !== 0)
|
|
633
|
+
ruleFor(name).labelOnTop = true;
|
|
634
|
+
}
|
|
625
635
|
return result;
|
|
626
636
|
}
|
|
627
637
|
/**
|
|
@@ -912,6 +922,34 @@ function parseFieldAliases(maplayer) {
|
|
|
912
922
|
}
|
|
913
923
|
return out;
|
|
914
924
|
}
|
|
925
|
+
/**
|
|
926
|
+
* Each field's custom comment, from the Attributes Form's Comment, which QGIS
|
|
927
|
+
* 4.2 and later saves as a direct child of `<maplayer>`:
|
|
928
|
+
*
|
|
929
|
+
* <customComments>
|
|
930
|
+
* <customComment field="species" value="As on the tree register"/>
|
|
931
|
+
* </customComments>
|
|
932
|
+
*
|
|
933
|
+
* (`QgsVectorLayer::readSymbology` and `writeSymbology`,
|
|
934
|
+
* `src/core/vector/qgsvectorlayer.cpp`, `qgis/QGIS@master`, read 2026-11-19).
|
|
935
|
+
* A blank comment, which QGIS saves to hide the comment the field's data gives,
|
|
936
|
+
* is left out: a project file does not carry the data's own comment. Where two
|
|
937
|
+
* entries name a field, the later stands, as QGIS's map of them keeps it.
|
|
938
|
+
*/
|
|
939
|
+
function parseFieldComments(maplayer) {
|
|
940
|
+
const out = {};
|
|
941
|
+
for (const node of directChild(maplayer, 'customComments')?.querySelectorAll(':scope > customComment') ?? []) {
|
|
942
|
+
const field = node.getAttribute('field');
|
|
943
|
+
if (!field)
|
|
944
|
+
continue;
|
|
945
|
+
const comment = node.getAttribute('value')?.trim();
|
|
946
|
+
if (comment)
|
|
947
|
+
out[field] = comment;
|
|
948
|
+
else
|
|
949
|
+
delete out[field];
|
|
950
|
+
}
|
|
951
|
+
return out;
|
|
952
|
+
}
|
|
915
953
|
/** The start of the name of a layer variable that sets a field's icon: `quac_icon_species`. */
|
|
916
954
|
const FIELD_ICON_VARIABLE_PREFIX = 'quac_icon_';
|
|
917
955
|
/**
|
package/package.json
CHANGED
|
@@ -578,6 +578,10 @@
|
|
|
578
578
|
"dropdown"
|
|
579
579
|
]
|
|
580
580
|
},
|
|
581
|
+
"quac:label_on_top": {
|
|
582
|
+
"description": "The form puts the field's name above its value, across the form's width. Written from QGIS's Label on top in the Attributes Form.",
|
|
583
|
+
"const": true
|
|
584
|
+
},
|
|
581
585
|
"quac:values": {
|
|
582
586
|
"description": "The values the field takes, each with the label a form shows for it, in the source's order. Written from a QGIS Value Map widget or an ArcGIS coded-value domain.",
|
|
583
587
|
"type": "array",
|