versao compilada
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-15 17:37:00 +02:00
parent 9a96ee8dfe
commit c13f250b87
935 changed files with 210656 additions and 272 deletions
@@ -31,6 +31,7 @@ export type CanonicalOptions = {
modularProfiles?: Record<string, string>;
historyVersion?: string | null;
schema: Schema;
submissionTextLimits?: Record<string, { minLength?: number; maxLength?: number }>;
definitions: Record<string, Schema>;
contacts: { id: string; full_name: string }[];
contactInvestors?: { id: string; legal_name: string }[];
@@ -315,10 +316,15 @@ function Editor({
schema = options.definitions[schema.$ref.split('/').pop()!] ?? schema;
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
const label = labels[name] ?? name.replaceAll('_', ' ');
const parcelUnit = name === 'area_unit' && path.includes('land_rights.parcels.');
const textLimits = path === 'canonical.demand_statement'
? options.submissionTextLimits?.demand_statement
: undefined;
const descriptions = [errors[path] ? path + '-error' : '', parcelUnit ? path + '-help' : '', textLimits ? path + '-length-help' : ''].filter(Boolean).join(' ');
const props = {
id: path,
'aria-invalid': !!errors[path],
'aria-describedby': errors[path] ? path + '-error' : undefined,
'aria-describedby': descriptions || undefined,
};
let input;
if (name === 'geometry')
@@ -409,7 +415,9 @@ function Editor({
.filter((v) => v !== null)
.map((v) => (
<option key={valueText(v)} value={valueText(v)}>
{valueText(v).replaceAll('_', ' ')}
{name === 'area_unit'
? ({ sqm: 'Metros quadrados (m²)', ha: 'Hectares (ha)', sqkm: 'Quilómetros quadrados (km²)' }[valueText(v) as 'sqm' | 'ha' | 'sqkm'] ?? valueText(v))
: valueText(v).replaceAll('_', ' ')}
</option>
))}
</select>
@@ -553,6 +561,21 @@ function Editor({
{label}
</label>
{input}
{textLimits && (
<p id={path + '-length-help'} className="text-sm text-gray-600">
Descreva a necessidade e a finalidade da oportunidade.
Para submeter: {textLimits.minLength} a {textLimits.maxLength} caracteres.
Texto atual: {Array.from(valueText(value ?? '').trim()).length} caracteres.
Pode guardar o rascunho incompleto.
</p>
)}
{parcelUnit && (
<p id={path + '-help'} className="text-sm text-gray-600">
A unidade deve ser indicada explicitamente. Registos sem
unidade continuam por identificar; escolher outra unidade
não converte o valor da área.
</p>
)}
<FieldErrors path={path} errors={errors} />
</div>
);