mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-08 19:28:18 +00:00
feat: add document requirements and form schema management for license types
- Implement DocumentRequirementsTab for managing document upload requirements. - Create FieldEditorDrawer and SectionEditorDrawer for editing fields and sections in the form schema. - Develop FormSchemaTab to handle sections and fields for a license type's form schema. - Introduce CertificateRequirementsPage to serve as the main interface for configuring license type requirements. - Add hooks for requirement actions to streamline mutation handling and notifications. - Implement condition handling for fields and sections to manage visibility based on user input. - Create schema-paths configuration to facilitate condition target collection.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { FormFieldConfig, FormSectionConfig } from '@ema-platform/api';
|
||||
|
||||
/** One field reachable by a condition's dot path, with enough of its config
|
||||
* to drive the value picker (SELECT offers its options; everything else is
|
||||
* free text/number/boolean). */
|
||||
export interface ConditionTarget {
|
||||
/** `${sectionKey}.${fieldKey}` — what `FieldCondition.field` expects. */
|
||||
path: string;
|
||||
field: FormFieldConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every field in the schema a condition could point at.
|
||||
*
|
||||
* Drives the condition builder's autocomplete and its options-aware value
|
||||
* picker — typing `certificate.` suggests `certificate.rank` because that
|
||||
* section/field exists in this licence type's own schema, not because the
|
||||
* rank list is known anywhere in the frontend.
|
||||
*/
|
||||
export function collectConditionTargets(sections: FormSectionConfig[]): ConditionTarget[] {
|
||||
const targets: ConditionTarget[] = [];
|
||||
for (const section of sections) {
|
||||
for (const field of section.fields ?? []) {
|
||||
targets.push({ path: `${section.key}.${field.key}`, field });
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
Reference in New Issue
Block a user