ngx-wapp-components 3.5.2 → 3.6.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-wapp-components-schema-form.mjs","sources":["../../../projects/wapp-components/schema-form/src/lib/models/w-schema-form-translations.model.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form-secret-field/w-schema-form-secret-field.component.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form-secret-field/w-schema-form-secret-field.component.html","../../../projects/wapp-components/schema-form/src/lib/w-schema-form/schema-inspection.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form-field-wrapper/w-schema-form-field-wrapper.component.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form-field-wrapper/w-schema-form-field-wrapper.component.html","../../../projects/wapp-components/schema-form/src/lib/w-schema-form/w-schema-form-field-types.module.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form/w-schema-form.component.ts","../../../projects/wapp-components/schema-form/src/lib/w-schema-form/w-schema-form.component.html","../../../projects/wapp-components/schema-form/src/public-api.ts","../../../projects/wapp-components/schema-form/src/ngx-wapp-components-schema-form.ts"],"sourcesContent":["/** Label and help text override for a field identified by JSON Pointer (SFC-D07). */\r\nexport interface WSchemaFormFieldTranslation {\r\n label?: string;\r\n description?: string;\r\n}\r\n\r\nexport interface WSchemaFormTranslations {\r\n configurationError: string;\r\n invalidValues: string;\r\n secretConfigured: string;\r\n secretPending: string;\r\n secretReplaceHint: string;\r\n showSecret: string;\r\n hideSecret: string;\r\n /** Optional overrides of schema `title`/`description`, keyed by JSON Pointer (e.g. `/account/clientId`). */\r\n fields?: Readonly<Record<string, WSchemaFormFieldTranslation>>;\r\n}\r\n\r\n/** Default Spanish texts. Frozen: consumers must pass their own object instead of mutating this one. */\r\nexport const W_SCHEMA_FORM_DEFAULT_TRANSLATIONS: Readonly<WSchemaFormTranslations> = Object.freeze({\r\n configurationError: 'No se puede mostrar el formulario: la configuración o el esquema no son válidos.',\r\n invalidValues: 'Revisa los valores marcados antes de guardar.',\r\n secretConfigured: 'Configurado',\r\n secretPending: 'Pendiente',\r\n secretReplaceHint: 'Déjalo vacío para conservar el valor actual o escribe uno nuevo para sustituirlo.',\r\n showSecret: 'Mostrar valor',\r\n hideSecret: 'Ocultar valor'\r\n});\r\n","import { Component, DestroyRef, OnInit, inject } from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\r\nimport { FieldType, FormlyFieldConfig, FormlyFieldProps } from '@ngx-formly/core';\r\nimport { ButtonModule } from 'primeng/button';\r\nimport { InputTextModule } from 'primeng/inputtext';\r\n\r\n/** Formly type name of the secret field (internal to `w-schema-form`). */\r\nexport const W_SCHEMA_FORM_SECRET_FIELD_TYPE = 'w-schema-form-secret';\r\n\r\n/** Props set by `w-schema-form` on a secret field. The control is never part of the form model. */\r\nexport interface WSchemaFormSecretFieldProps extends FormlyFieldProps {\r\n secretControl: FormControl<string>;\r\n secretStatusText: string;\r\n secretHint?: string;\r\n showSecretLabel: string;\r\n hideSecretLabel: string;\r\n}\r\n\r\n/**\r\n * Password entry for `writeOnly` + `x-wapping-secret` fields (SF-006, SF-008). It starts empty,\r\n * never receives a stored value and uses `autocomplete=\"new-password\"` (SFC-D06).\r\n */\r\n@Component({\r\n selector: 'w-schema-form-secret-field',\r\n standalone: true,\r\n imports: [ReactiveFormsModule, InputTextModule, ButtonModule],\r\n templateUrl: './w-schema-form-secret-field.component.html',\r\n styleUrls: ['./w-schema-form-secret-field.component.scss']\r\n})\r\nexport class WSchemaFormSecretFieldComponent extends FieldType<FormlyFieldConfig<WSchemaFormSecretFieldProps>>\r\n implements OnInit {\r\n private readonly destroyRef = inject(DestroyRef);\r\n control = new FormControl<string>('', { nonNullable: true });\r\n statusText = '';\r\n hint?: string;\r\n visible = false;\r\n inputType: 'password' | 'text' = 'password';\r\n toggleLabel = '';\r\n\r\n get statusId(): string {\r\n return `${this.id}-status`;\r\n }\r\n\r\n get hintId(): string {\r\n return `${this.id}-hint`;\r\n }\r\n\r\n get describedBy(): string {\r\n return this.hint ? `${this.statusId} ${this.hintId}` : this.statusId;\r\n }\r\n\r\n ngOnInit(): void {\r\n this.control = this.props.secretControl;\r\n this.statusText = this.props.secretStatusText;\r\n this.hint = this.props.secretHint;\r\n this.applyVisibility(false);\r\n // When `w-schema-form` discards the typed value (submit, input change, destroy) the entry hides again.\r\n this.control.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {\r\n if (value === '' && this.visible) {\r\n this.applyVisibility(false);\r\n }\r\n });\r\n }\r\n\r\n toggleVisibility(): void {\r\n this.applyVisibility(!this.visible);\r\n }\r\n\r\n private applyVisibility(visible: boolean): void {\r\n this.visible = visible;\r\n this.inputType = visible ? 'text' : 'password';\r\n this.toggleLabel = visible ? this.props.hideSecretLabel : this.props.showSecretLabel;\r\n }\r\n}\r\n","<div class=\"w-schema-form-secret\">\r\n <div class=\"w-schema-form-secret__entry\">\r\n <input\r\n pInputText\r\n class=\"w-schema-form-secret__input\"\r\n [id]=\"id\"\r\n [type]=\"inputType\"\r\n autocomplete=\"new-password\"\r\n spellcheck=\"false\"\r\n [formControl]=\"control\"\r\n [attr.aria-describedby]=\"describedBy\" />\r\n <button\r\n type=\"button\"\r\n pButton\r\n [text]=\"true\"\r\n class=\"w-schema-form-secret__toggle\"\r\n [attr.aria-label]=\"toggleLabel\"\r\n [attr.aria-pressed]=\"visible\"\r\n [attr.aria-controls]=\"id\"\r\n (click)=\"toggleVisibility()\">\r\n <i pButtonIcon class=\"pi\" [class.pi-eye]=\"!visible\" [class.pi-eye-slash]=\"visible\" aria-hidden=\"true\"></i>\r\n </button>\r\n </div>\r\n <small [id]=\"statusId\" class=\"w-schema-form-secret__status\">{{ statusText }}</small>\r\n @if (hint) {\r\n <small [id]=\"hintId\" class=\"w-schema-form-secret__hint\">{{ hint }}</small>\r\n }\r\n</div>\r\n","import { WJsonSchema, WSchemaFormDialect } from '../models/w-json-schema.model';\r\n\r\nexport const DRAFT_07_URI = 'http://json-schema.org/draft-07/schema#';\r\nexport const DRAFT_2020_12_URI = 'https://json-schema.org/draft/2020-12/schema';\r\nexport const SECRET_KEYWORD = 'x-wapping-secret';\r\n/** Internal Formly prop carrying the JSON Pointer of a property field. */\r\nexport const POINTER_PROP = 'wSchemaFormPointer';\r\n\r\nconst ALLOWED_KEYWORDS: ReadonlySet<string> = new Set([\r\n '$schema', '$id', '$comment', 'title', 'description', 'type', 'properties', 'required',\r\n 'additionalProperties', 'enum', 'const', 'default', 'minimum', 'maximum', 'minLength',\r\n 'maxLength', 'pattern', 'items', 'uniqueItems', '$ref', '$defs', 'definitions', 'readOnly',\r\n 'writeOnly', SECRET_KEYWORD\r\n]);\r\nconst SUPPORTED_TYPES: ReadonlySet<string> = new Set(['object', 'string', 'number', 'integer', 'boolean', 'array']);\r\nconst LOCAL_REFERENCE = /^#\\/(\\$defs|definitions)\\/[^/]+$/;\r\n\r\n/** Configuration problem of the schema or of the inputs. Messages never contain values. */\r\nexport class SchemaFormConfigurationError extends Error {}\r\n\r\nexport type JsonRecord = Record<string, unknown>;\r\n\r\nexport function isRecord(value: unknown): value is JsonRecord {\r\n return typeof value === 'object' && value !== null && !Array.isArray(value);\r\n}\r\n\r\nexport function escapePointerSegment(segment: string): string {\r\n return segment.replace(/~/g, '~0').replace(/\\//g, '~1');\r\n}\r\n\r\nexport function pointerSegments(pointer: string): string[] {\r\n return pointer.split('/').slice(1).map(segment => segment.replace(/~1/g, '/').replace(/~0/g, '~'));\r\n}\r\n\r\n/** SF-003: the declared `$schema` and the `dialect` input must agree; without both, draft-07 (SFC-D05). */\r\nexport function resolveDialect(schema: WJsonSchema, dialect: WSchemaFormDialect | undefined): WSchemaFormDialect {\r\n if (dialect !== undefined && dialect !== 'draft-07' && dialect !== '2020-12') {\r\n throw new SchemaFormConfigurationError('Unsupported dialect input.');\r\n }\r\n let declared: WSchemaFormDialect | undefined;\r\n if (schema.$schema !== undefined) {\r\n if (schema.$schema === DRAFT_07_URI) {\r\n declared = 'draft-07';\r\n } else if (schema.$schema === DRAFT_2020_12_URI) {\r\n declared = '2020-12';\r\n } else {\r\n throw new SchemaFormConfigurationError('Unsupported JSON Schema dialect declared in $schema.');\r\n }\r\n }\r\n if (dialect !== undefined && declared !== undefined && dialect !== declared) {\r\n throw new SchemaFormConfigurationError('The dialect input does not match the $schema declared by the schema.');\r\n }\r\n return declared ?? dialect ?? 'draft-07';\r\n}\r\n\r\n/**\r\n * SF-004/SF-005/SF-006: checks the closed list of constructions and returns the JSON Pointers of the\r\n * secret fields (string + writeOnly + x-wapping-secret, only along the `properties` chain).\r\n */\r\nexport function inspectSchema(schema: WJsonSchema): string[] {\r\n if (schema.type !== 'object') {\r\n throw new SchemaFormConfigurationError('The schema root must be an object schema.');\r\n }\r\n const secrets: string[] = [];\r\n visit(schema, '#', '', secrets);\r\n return secrets;\r\n}\r\n\r\nfunction visit(node: unknown, at: string, instancePath: string | null, secrets: string[]): void {\r\n if (!isRecord(node)) {\r\n throw new SchemaFormConfigurationError(`The schema at ${at} must be an object.`);\r\n }\r\n for (const keyword of Object.keys(node)) {\r\n if (!ALLOWED_KEYWORDS.has(keyword)) {\r\n throw new SchemaFormConfigurationError(`Unsupported keyword \"${keyword}\" at ${at}.`);\r\n }\r\n }\r\n const type = node['type'];\r\n if (type !== undefined && (typeof type !== 'string' || !SUPPORTED_TYPES.has(type))) {\r\n throw new SchemaFormConfigurationError(`Unsupported type at ${at}; a single supported type is required.`);\r\n }\r\n if ('additionalProperties' in node && node['additionalProperties'] !== false) {\r\n throw new SchemaFormConfigurationError(`Only additionalProperties false is supported at ${at}.`);\r\n }\r\n if ('$ref' in node) {\r\n const reference = node['$ref'];\r\n if (typeof reference !== 'string' || !LOCAL_REFERENCE.test(reference)) {\r\n throw new SchemaFormConfigurationError(`Only local references to $defs or definitions are supported at ${at}.`);\r\n }\r\n }\r\n if (type === 'array' || 'items' in node || 'uniqueItems' in node) {\r\n const items = node['items'];\r\n if (type !== 'array' || node['uniqueItems'] !== true || !isRecord(items) || !Array.isArray(items['enum'])) {\r\n throw new SchemaFormConfigurationError(`Arrays are supported only with uniqueItems and an items enum at ${at}.`);\r\n }\r\n visit(items, `${at}/items`, null, secrets);\r\n }\r\n if ('properties' in node) {\r\n const properties = node['properties'];\r\n if (!isRecord(properties)) {\r\n throw new SchemaFormConfigurationError(`properties must be an object at ${at}.`);\r\n }\r\n for (const [name, child] of Object.entries(properties)) {\r\n const segment = escapePointerSegment(name);\r\n visit(child, `${at}/properties/${segment}`, instancePath === null ? null : `${instancePath}/${segment}`, secrets);\r\n }\r\n }\r\n for (const definitionsKeyword of ['$defs', 'definitions']) {\r\n if (definitionsKeyword in node) {\r\n const definitions = node[definitionsKeyword];\r\n if (!isRecord(definitions)) {\r\n throw new SchemaFormConfigurationError(`${definitionsKeyword} must be an object at ${at}.`);\r\n }\r\n for (const [name, child] of Object.entries(definitions)) {\r\n visit(child, `${at}/${definitionsKeyword}/${escapePointerSegment(name)}`, null, secrets);\r\n }\r\n }\r\n }\r\n if (SECRET_KEYWORD in node) {\r\n if (!isRecord(node[SECRET_KEYWORD]) || type !== 'string' || node['writeOnly'] !== true ||\r\n instancePath === null || instancePath === '') {\r\n throw new SchemaFormConfigurationError(\r\n `${SECRET_KEYWORD} requires a string property with writeOnly true outside arrays and definitions at ${at}.`);\r\n }\r\n secrets.push(instancePath);\r\n }\r\n}\r\n\r\n/** Reads the property schema at a JSON Pointer following only `properties`. */\r\nexport function readPropertySchema(schema: WJsonSchema, pointer: string): WJsonSchema {\r\n let current: WJsonSchema = schema;\r\n for (const segment of pointerSegments(pointer)) {\r\n const next = current.properties?.[segment];\r\n if (!next) {\r\n throw new SchemaFormConfigurationError('A secret path does not exist in the schema.');\r\n }\r\n current = next;\r\n }\r\n return current;\r\n}\r\n\r\n/** Public schema: secret properties and their `required` entries removed (design, Secretos). */\r\nexport function buildPublicSchema(schema: WJsonSchema, secretPaths: ReadonlyArray<string>): WJsonSchema {\r\n const copy = structuredClone(schema);\r\n for (const path of secretPaths) {\r\n const segments = pointerSegments(path);\r\n const name = segments.pop() as string;\r\n const parent = readPropertySchema(copy, segments.map(s => `/${escapePointerSegment(s)}`).join(''));\r\n if (parent.properties) {\r\n delete parent.properties[name];\r\n }\r\n if (parent.required) {\r\n parent.required = parent.required.filter(required => required !== name);\r\n }\r\n }\r\n return copy;\r\n}\r\n\r\n/**\r\n * Copy for Formly where each property carries its JSON Pointer (labels by pointer and secrets). Properties that\r\n * reference a local object definition (`$ref` to `$defs`/`definitions` with `properties`) are expanded per use\r\n * site, so the nested fields get the pointer of the instance they edit (SF-004, SFC-D07). Validation keeps using\r\n * the original schema; this copy is only rendered.\r\n */\r\nexport function annotatePointers(schema: WJsonSchema): WJsonSchema {\r\n const copy = structuredClone(schema);\r\n annotate(copy, '', schema, []);\r\n return copy;\r\n}\r\n\r\nfunction annotate(node: WJsonSchema, pointer: string, root: WJsonSchema, expanding: ReadonlyArray<string>): void {\r\n const properties = node.properties ?? {};\r\n for (const name of Object.keys(properties)) {\r\n const childPointer = `${pointer}/${escapePointerSegment(name)}`;\r\n let child = properties[name];\r\n let chain = expanding;\r\n const reference = child.$ref;\r\n if (typeof reference === 'string') {\r\n const target = resolveLocalReference(root, reference);\r\n if (isRecord(target) && isRecord(target['properties'])) {\r\n if (expanding.includes(reference)) {\r\n throw new SchemaFormConfigurationError(`Recursive local reference ${reference} is not supported.`);\r\n }\r\n const { $ref: _reference, ...siblings } = child;\r\n child = { ...(structuredClone(target) as WJsonSchema), ...siblings };\r\n properties[name] = child;\r\n chain = [...expanding, reference];\r\n }\r\n }\r\n child['widget'] = { formlyConfig: { props: { [POINTER_PROP]: childPointer } } };\r\n annotate(child, childPointer, root, chain);\r\n }\r\n}\r\n\r\nfunction resolveLocalReference(root: WJsonSchema, reference: string): unknown {\r\n const match = LOCAL_REFERENCE.exec(reference);\r\n if (!match) {\r\n return undefined;\r\n }\r\n const definitions = root[match[1]];\r\n const name = pointerSegments(reference).pop() as string;\r\n return isRecord(definitions) ? definitions[name] : undefined;\r\n}\r\n\r\n/** True when the values contain an own property at the JSON Pointer (any value, including null). */\r\nexport function hasValueAt(values: JsonRecord, pointer: string): boolean {\r\n let current: unknown = values;\r\n for (const segment of pointerSegments(pointer)) {\r\n if (!isRecord(current) || !Object.prototype.hasOwnProperty.call(current, segment)) {\r\n return false;\r\n }\r\n current = current[segment];\r\n }\r\n return true;\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { FieldWrapper, FormlyModule } from '@ngx-formly/core';\r\nimport { TooltipModule } from 'primeng/tooltip';\r\n\r\n/** Formly wrapper name used by every leaf field of `w-schema-form` (internal). */\r\nexport const W_SCHEMA_FORM_FIELD_WRAPPER = 'w-schema-form-field';\r\n\r\n/**\r\n * Label, required marker, validation message and `description` as a help tooltip. It follows the help icon +\r\n * PrimeNG `pTooltip` pattern of the library `w-input-label` (which lives in the primary entry point and is not\r\n * standalone, so it cannot be imported here without coupling the entry points).\r\n */\r\n@Component({\r\n selector: 'w-schema-form-field-wrapper',\r\n standalone: true,\r\n imports: [FormlyModule, TooltipModule],\r\n templateUrl: './w-schema-form-field-wrapper.component.html',\r\n styleUrls: ['./w-schema-form-field-wrapper.component.scss']\r\n})\r\nexport class WSchemaFormFieldWrapperComponent extends FieldWrapper {\r\n get showLabel(): boolean {\r\n return !!this.props.label && this.props['hideLabel'] !== true;\r\n }\r\n\r\n get helpId(): string {\r\n return `${this.id}-help`;\r\n }\r\n}\r\n","<div class=\"w-schema-form-field\">\r\n @if (showLabel || props.description) {\r\n <div class=\"w-schema-form-field__label\">\r\n @if (showLabel) {\r\n <label class=\"w-schema-form-field__label-text\" [for]=\"id\">\r\n {{ props.label }}\r\n @if (props.required && props['hideRequiredMarker'] !== true) {\r\n <span class=\"w-schema-form-field__required\" aria-hidden=\"true\">*</span>\r\n }\r\n </label>\r\n }\r\n @if (props.description) {\r\n <span\r\n class=\"w-schema-form-field__help\"\r\n role=\"img\"\r\n tabindex=\"0\"\r\n [id]=\"helpId\"\r\n [attr.aria-label]=\"props.description\"\r\n [pTooltip]=\"props.description\"\r\n tooltipPosition=\"right\"\r\n tooltipEvent=\"both\">\r\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\r\n <path d=\"M6 0C2.7 0 0 2.7 0 6C0 9.3 2.7 12 6 12C9.3 12 12 9.3 12 6C12 2.7 9.3 0 6 0ZM6 9.75C5.586 9.75 5.25 9.414 5.25 9C5.25 8.586 5.586 8.25 6 8.25C6.414 8.25 6.75 8.586 6.75 9C6.75 9.414 6.414 9.75 6 9.75ZM7.21725 6.069C6.8445 6.38925 6.75 6.49725 6.75 6.75C6.75 7.16475 6.414 7.5 6 7.5C5.586 7.5 5.25 7.16475 5.25 6.75C5.25 5.7795 5.84625 5.268 6.2415 4.92975C6.61425 4.611 6.70875 4.50225 6.70875 4.25025C6.70875 4.113 6.70875 3.75 6.00075 3.75C5.67375 3.768 5.325 3.918 5.05725 4.17075C4.7565 4.45425 4.281 4.44 3.99675 4.14C3.7125 3.8385 3.726 3.36375 4.0275 3.0795C4.554 2.58375 5.24025 2.289 5.96175 2.2515H5.964C7.323 2.2515 8.20875 3.05475 8.20875 4.251C8.20875 5.22075 7.6125 5.73225 7.218 6.06975L7.21725 6.069Z\" />\r\n </svg>\r\n </span>\r\n }\r\n </div>\r\n }\r\n <ng-container #fieldComponent></ng-container>\r\n @if (showError) {\r\n <small class=\"w-schema-form-field__error\">\r\n <formly-validation-message [field]=\"field\"></formly-validation-message>\r\n </small>\r\n }\r\n</div>\r\n","import { NgModule } from '@angular/core';\r\nimport { FormlyModule } from '@ngx-formly/core';\r\nimport {\r\n W_SCHEMA_FORM_FIELD_WRAPPER,\r\n WSchemaFormFieldWrapperComponent\r\n} from '../w-schema-form-field-wrapper/w-schema-form-field-wrapper.component';\r\nimport {\r\n W_SCHEMA_FORM_SECRET_FIELD_TYPE,\r\n WSchemaFormSecretFieldComponent\r\n} from '../w-schema-form-secret-field/w-schema-form-secret-field.component';\r\n\r\n/**\r\n * Registers the internal secret field type and field wrapper with the same mechanism used by\r\n * @ngx-formly/primeng (`FormlyModule.forChild`). Formly adds them to the root `FormlyConfig` of the consumer\r\n * application (see the entry point README); the names are prefixed to avoid collisions.\r\n */\r\n@NgModule({\r\n imports: [\r\n WSchemaFormSecretFieldComponent,\r\n WSchemaFormFieldWrapperComponent,\r\n FormlyModule.forChild({\r\n wrappers: [{ name: W_SCHEMA_FORM_FIELD_WRAPPER, component: WSchemaFormFieldWrapperComponent }],\r\n types: [\r\n {\r\n name: W_SCHEMA_FORM_SECRET_FIELD_TYPE,\r\n component: WSchemaFormSecretFieldComponent,\r\n wrappers: [W_SCHEMA_FORM_FIELD_WRAPPER]\r\n }\r\n ]\r\n })\r\n ]\r\n})\r\nexport class WSchemaFormFieldTypesModule {}\r\n","import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, inject } from '@angular/core';\r\nimport { AbstractControl, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\r\nimport { FormlyFieldConfig, FormlyModule } from '@ngx-formly/core';\r\nimport { FormlyJsonschema } from '@ngx-formly/core/json-schema';\r\nimport { FormlyPrimeNGModule } from '@ngx-formly/primeng';\r\nimport Ajv, { ErrorObject, Options, ValidateFunction } from 'ajv';\r\nimport Ajv2020 from 'ajv/dist/2020';\r\nimport { Subscription } from 'rxjs';\r\nimport { WJsonSchema, WSchemaFormDialect } from '../models/w-json-schema.model';\r\nimport { WSchemaFormSecretState } from '../models/w-schema-form-secret-state.model';\r\nimport { WSchemaFormError, WSchemaFormState } from '../models/w-schema-form-state.model';\r\nimport { WSchemaFormSubmit } from '../models/w-schema-form-submit.model';\r\nimport { W_SCHEMA_FORM_DEFAULT_TRANSLATIONS, WSchemaFormTranslations } from '../models/w-schema-form-translations.model';\r\nimport {\r\n W_SCHEMA_FORM_SECRET_FIELD_TYPE,\r\n WSchemaFormSecretFieldProps\r\n} from '../w-schema-form-secret-field/w-schema-form-secret-field.component';\r\nimport {\r\n POINTER_PROP,\r\n SECRET_KEYWORD,\r\n SchemaFormConfigurationError,\r\n annotatePointers,\r\n buildPublicSchema,\r\n hasValueAt,\r\n inspectSchema,\r\n isRecord,\r\n readPropertySchema,\r\n resolveDialect\r\n} from './schema-inspection';\r\nimport { WSchemaFormFieldTypesModule } from './w-schema-form-field-types.module';\r\nimport { W_SCHEMA_FORM_FIELD_WRAPPER } from '../w-schema-form-field-wrapper/w-schema-form-field-wrapper.component';\r\n\r\ntype FormlySchema = Parameters<FormlyJsonschema['toFieldConfig']>[0];\r\n\r\ninterface SecretEntry {\r\n path: string;\r\n hasValue: boolean;\r\n control: FormControl<string>;\r\n validator: ValidateFunction<string>;\r\n}\r\n\r\n/**\r\n * JSON Schema form (CM-007). Emits the public configuration and the secret replacements separately and\r\n * never preloads, stores or reports secret values (SF-001..SF-009).\r\n */\r\n@Component({\r\n selector: 'w-schema-form',\r\n standalone: true,\r\n imports: [ReactiveFormsModule, FormlyModule, FormlyPrimeNGModule, WSchemaFormFieldTypesModule],\r\n templateUrl: './w-schema-form.component.html',\r\n styleUrls: ['./w-schema-form.component.scss']\r\n})\r\nexport class WSchemaFormComponent implements OnChanges, OnDestroy {\r\n @Input({ required: true }) schema: WJsonSchema | null = null;\r\n @Input({ required: true }) values: Record<string, unknown> | null = null;\r\n @Input() dialect?: WSchemaFormDialect;\r\n @Input() secretStates: ReadonlyArray<WSchemaFormSecretState> | null = [];\r\n @Input() translations: Readonly<WSchemaFormTranslations> | null = W_SCHEMA_FORM_DEFAULT_TRANSLATIONS;\r\n @Output() stateChange = new EventEmitter<WSchemaFormState>();\r\n @Output() validSubmit = new EventEmitter<WSchemaFormSubmit>();\r\n\r\n // Internal rendering state: consumers observe `stateChange` and `validSubmit` only.\r\n protected form = new FormGroup<Record<string, AbstractControl<unknown>>>({});\r\n protected fields: FormlyFieldConfig[] = [];\r\n protected model: Record<string, unknown> = {};\r\n protected state: WSchemaFormState = { status: 'error', errors: [], secrets: [] };\r\n /** Consumer translations merged over the defaults (a null or partial input never breaks the template). */\r\n protected texts: Readonly<WSchemaFormTranslations> = W_SCHEMA_FORM_DEFAULT_TRANSLATIONS;\r\n\r\n private readonly formlyJsonschema = inject(FormlyJsonschema);\r\n private validator?: ValidateFunction<Record<string, unknown>>;\r\n private secrets: SecretEntry[] = [];\r\n private secretSubscriptions = new Subscription();\r\n\r\n ngOnChanges(): void {\r\n this.reset();\r\n this.texts = { ...W_SCHEMA_FORM_DEFAULT_TRANSLATIONS, ...(this.translations ?? {}) };\r\n const secretStates = this.secretStates ?? [];\r\n\r\n if (!this.schema || this.schema.type !== 'object' ||\r\n !this.values || typeof this.values !== 'object' || Array.isArray(this.values)) {\r\n this.fail('An object schema and explicit object values are required.');\r\n return;\r\n }\r\n\r\n try {\r\n const schema = structuredClone(this.schema);\r\n const dialect = resolveDialect(schema, this.dialect);\r\n const secretPaths = inspectSchema(schema);\r\n this.assertSecretInputs(secretPaths, this.values, secretStates);\r\n const ajv = createAjv(dialect);\r\n this.validator = ajv.compile<Record<string, unknown>>(buildPublicSchema(schema, secretPaths));\r\n this.secrets = secretPaths.map(path => ({\r\n path,\r\n hasValue: secretStates.some(state => state.path === path && state.hasValue === true),\r\n control: new FormControl<string>('', { nonNullable: true }),\r\n validator: ajv.compile<string>(structuredClone(readPropertySchema(schema, path)))\r\n }));\r\n this.model = structuredClone(this.values);\r\n const root = this.formlyJsonschema.toFieldConfig(annotatePointers(schema) as FormlySchema, {\r\n ignoreImplicitStringDefaults: true,\r\n map: (field, source) => this.mapField(field, source)\r\n });\r\n this.fields = root.fieldGroup ?? [];\r\n } catch (error: unknown) {\r\n this.reset();\r\n this.fail(error instanceof Error ? error.message : 'The schema could not be prepared.');\r\n return;\r\n }\r\n\r\n for (const secret of this.secrets) {\r\n this.secretSubscriptions.add(secret.control.valueChanges.subscribe(() => this.validate()));\r\n }\r\n this.validate();\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.reset();\r\n }\r\n\r\n protected onModelChange(model: Record<string, unknown>): void {\r\n this.model = model;\r\n this.validate();\r\n }\r\n\r\n submit(): void {\r\n this.form.markAllAsTouched();\r\n this.validate();\r\n if (this.state.status !== 'valid') {\r\n return;\r\n }\r\n const submission: WSchemaFormSubmit = {\r\n configuration: structuredClone(this.model),\r\n secrets: this.secrets\r\n .filter(secret => secret.control.value !== '')\r\n .map(secret => ({ path: secret.path, value: secret.control.value }))\r\n };\r\n // SFC-D06: the typed secret leaves the component memory as soon as it is emitted.\r\n for (const secret of this.secrets) {\r\n secret.control.reset('');\r\n }\r\n this.validSubmit.emit(submission);\r\n }\r\n\r\n private validate(): void {\r\n if (!this.validator) {\r\n return;\r\n }\r\n\r\n const configurationValid = this.validator(this.model);\r\n const errors: WSchemaFormError[] = (this.validator.errors ?? []).map(error => toDiagnostic(error, ''));\r\n let secretsValid = true;\r\n for (const secret of this.secrets) {\r\n if (secret.control.value !== '' && !secret.validator(secret.control.value)) {\r\n secretsValid = false;\r\n errors.push(...(secret.validator.errors ?? []).map(error => toDiagnostic(error, secret.path)));\r\n }\r\n }\r\n this.state = {\r\n status: configurationValid && secretsValid && this.form.valid && !this.form.pending ? 'valid' : 'invalid',\r\n errors,\r\n secrets: this.secrets.map(secret => ({\r\n path: secret.path,\r\n hasValue: secret.hasValue,\r\n replacementPending: secret.control.value !== ''\r\n }))\r\n };\r\n this.stateChange.emit(this.state);\r\n }\r\n\r\n private fail(message: string): void {\r\n this.state = {\r\n status: 'error',\r\n errors: [{ instancePath: '', keyword: 'configuration', message }],\r\n secrets: []\r\n };\r\n this.stateChange.emit(this.state);\r\n }\r\n\r\n /** Discards controls, validators and typed secret values (SF-003, SF-008). */\r\n private reset(): void {\r\n this.secretSubscriptions.unsubscribe();\r\n this.secretSubscriptions = new Subscription();\r\n for (const secret of this.secrets) {\r\n secret.control.reset('');\r\n }\r\n this.secrets = [];\r\n this.form = new FormGroup<Record<string, AbstractControl<unknown>>>({});\r\n this.fields = [];\r\n this.model = {};\r\n this.validator = undefined;\r\n }\r\n\r\n /** SF-006/SF-007: secret states must target declared secrets and values must not carry secrets. */\r\n private assertSecretInputs(\r\n secretPaths: ReadonlyArray<string>,\r\n values: Record<string, unknown>,\r\n secretStates: ReadonlyArray<WSchemaFormSecretState>\r\n ): void {\r\n for (const state of secretStates) {\r\n if (!isRecord(state) || !secretPaths.includes(state.path)) {\r\n throw new SchemaFormConfigurationError('secretStates contains a path that the schema does not mark as secret.');\r\n }\r\n }\r\n for (const path of secretPaths) {\r\n if (hasValueAt(values, path)) {\r\n throw new SchemaFormConfigurationError(`The values contain an entry at the secret path ${path}.`);\r\n }\r\n }\r\n }\r\n\r\n private mapField(field: FormlyFieldConfig, schema: FormlySchema): FormlyFieldConfig {\r\n // Schema defaults must not materialize overrides that the business did not edit.\r\n delete field.defaultValue;\r\n const props = field.props ?? (field.props = {});\r\n const pointer: unknown = props[POINTER_PROP];\r\n delete props[POINTER_PROP];\r\n if (typeof pointer === 'string') {\r\n const override = this.texts.fields?.[pointer];\r\n props.label = override?.label ?? props.label ?? (typeof field.key === 'string' ? field.key : undefined);\r\n props.description = override?.description ?? props.description;\r\n if (schema.type !== 'object' && !(schema.type === undefined && schema.properties)) {\r\n field.wrappers = [W_SCHEMA_FORM_FIELD_WRAPPER];\r\n }\r\n const secret = this.secrets.find(entry => entry.path === pointer);\r\n if (secret) {\r\n return this.mapSecretField(field, secret);\r\n }\r\n }\r\n\r\n if (Object.prototype.hasOwnProperty.call(schema, 'const')) {\r\n // Fixed values are shown but never edited nor materialized.\r\n field.type = 'input';\r\n props.type = 'text';\r\n props.disabled = true;\r\n props.readonly = true;\r\n props.placeholder = typeof schema.const === 'string' ? schema.const : JSON.stringify(schema.const);\r\n field.parsers = [];\r\n return field;\r\n }\r\n\r\n switch (schema.type) {\r\n case 'object':\r\n delete field.type;\r\n break;\r\n case 'string':\r\n case 'number':\r\n case 'integer':\r\n field.type = schema.enum ? 'select' : 'input';\r\n props.type = schema.type === 'string' ? 'text' : 'number';\r\n // Clearing a control is not an implicit request to inherit a missing override.\r\n field.parsers = schema.type === 'string' || schema.enum ? [] : [\r\n (value: unknown, current?: FormlyFieldConfig): unknown => {\r\n if (!current?.formControl?.dirty) {\r\n return typeof current?.key === 'string' ? current.model?.[current.key] : value;\r\n }\r\n if (value === '' || value === undefined || value === null) {\r\n return null;\r\n }\r\n return typeof value === 'string' ? Number(value) : value;\r\n }\r\n ];\r\n break;\r\n case 'boolean':\r\n field.type = 'checkbox';\r\n break;\r\n case 'array':\r\n // inspectSchema only lets through uniqueItems arrays whose items are an enum.\r\n field.type = 'select';\r\n props['multiple'] = true;\r\n field.parsers = [];\r\n break;\r\n case undefined:\r\n if (schema.enum) {\r\n field.type = 'select';\r\n field.parsers = [];\r\n break;\r\n }\r\n if (schema.properties) {\r\n delete field.type;\r\n break;\r\n }\r\n throw new SchemaFormConfigurationError('A field without type must declare enum, const or properties.');\r\n default:\r\n throw new SchemaFormConfigurationError(\r\n 'The schema form supports object, string, number, integer, boolean, enum, const and enum array fields only.');\r\n }\r\n return field;\r\n }\r\n\r\n private mapSecretField(field: FormlyFieldConfig, secret: SecretEntry): FormlyFieldConfig {\r\n // Without key the field has no control in the form nor entry in the model: the value never\r\n // reaches `configuration`, `stateChange` or the diagnostics.\r\n delete field.key;\r\n field.type = W_SCHEMA_FORM_SECRET_FIELD_TYPE;\r\n field.validators = {};\r\n field.parsers = [];\r\n const translations = this.texts;\r\n const secretProps: Partial<WSchemaFormSecretFieldProps> = {\r\n secretControl: secret.control,\r\n secretStatusText: secret.hasValue ? translations.secretConfigured : translations.secretPending,\r\n secretHint: secret.hasValue ? translations.secretReplaceHint : undefined,\r\n showSecretLabel: translations.showSecret,\r\n hideSecretLabel: translations.hideSecret\r\n };\r\n Object.assign(field.props ?? (field.props = {}), secretProps);\r\n return field;\r\n }\r\n}\r\n\r\nfunction createAjv(dialect: WSchemaFormDialect): Ajv | Ajv2020 {\r\n const options: Options = { allErrors: true, ownProperties: true, verbose: false, logger: false };\r\n const ajv = dialect === '2020-12' ? new Ajv2020(options) : new Ajv(options);\r\n // Annotation keyword: strict mode stays enabled for every other unknown keyword.\r\n ajv.addKeyword(SECRET_KEYWORD);\r\n return ajv;\r\n}\r\n\r\nfunction toDiagnostic({ instancePath, keyword, message }: ErrorObject, basePath: string): WSchemaFormError {\r\n return { instancePath: `${basePath}${instancePath}`, keyword, message };\r\n}\r\n","<div class=\"w-schema-form\">\r\n @if (state.status === 'error') {\r\n <p role=\"alert\" class=\"w-error-message w-schema-form__alert\">{{ texts.configurationError }}</p>\r\n } @else {\r\n <formly-form\r\n [form]=\"form\"\r\n [fields]=\"fields\"\r\n [model]=\"model\"\r\n (modelChange)=\"onModelChange($event)\">\r\n </formly-form>\r\n @if (state.status === 'invalid') {\r\n <p role=\"alert\" class=\"w-error-message w-schema-form__alert\">{{ texts.invalidValues }}</p>\r\n }\r\n }\r\n</div>\r\n","/*\r\n * Public API Surface of ngx-wapp-components/schema-form\r\n * Secondary entry point (SFC-D02): requires the optional peers @ngx-formly/core,\r\n * @ngx-formly/primeng and ajv. The primary entry point does not depend on them.\r\n */\r\n\r\nexport * from './lib/models/w-json-schema.model';\r\nexport * from './lib/models/w-schema-form-secret-state.model';\r\nexport * from './lib/models/w-schema-form-state.model';\r\nexport * from './lib/models/w-schema-form-submit.model';\r\nexport * from './lib/models/w-schema-form-translations.model';\r\nexport * from './lib/w-schema-form/w-schema-form.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2","i1"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA;AACO,MAAM,kCAAkC,GAAsC,MAAM,CAAC,MAAM,CAAC;AACjG,IAAA,kBAAkB,EAAE,kFAAkF;AACtG,IAAA,aAAa,EAAE,+CAA+C;AAC9D,IAAA,gBAAgB,EAAE,aAAa;AAC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