@dynamicforms/vue-forms 0.6.1 → 0.11.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicforms-vue-forms.umd.cjs","sources":["../src/display-mode.ts","../src/actions/field-action-base.ts","../src/field.interface.ts","../src/actions/value-changed-action.ts","../src/config.ts","../src/validators/validation-error.ts","../src/validators/error-message-builder.ts","../src/validators/validator.ts","../src/actions/actions-map.ts","../src/actions/conditional/conditional-statement-action.ts","../src/actions/conditional/operator.ts","../src/actions/enabled-actions.ts","../src/actions/valid-changed-action.ts","../src/actions/visibility-actions.ts","../src/field-base.ts","../src/actions/conditional/statement.ts","../src/actions/execute-action.ts","../src/actions/list-item-added-action.ts","../src/actions/list-item-removed-action.ts","../src/field.ts","../src/action.ts","../src/components/messages-widget.vue","../src/group.ts","../src/list.ts","../src/validators/validator-compare-to.ts","../src/validators/validator-in-allowed-values.ts","../src/validators/validator-required.ts","../src/validators/validator-min-max-range.ts","../src/validators/validator-min-max-range-length.ts","../src/validators/validator-pattern.ts"],"sourcesContent":["/**\n * DisplayMode enum provides an enumeration for supported ways of rendering a particular object in the DOM\n */\nenum DisplayMode {\n // This enum is actually declared in dynamicforms.mixins.field_render.py\n SUPPRESS = 1, // Field will be entirely suppressed. it will not render (not even to JSON) and will not parse for PUT\n HIDDEN = 5, // Field will render as <input type=\"hidden\"> or <tr data-field_name>\n INVISIBLE = 8, // Field will render completely, but with display: none. Equal to setting its style = {display: none}\n FULL = 10, // Field will render completely\n}\n\nexport const defaultDisplayMode = DisplayMode.FULL;\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, no-redeclare\nnamespace DisplayMode {\n export function fromString(mode: string): DisplayMode {\n if (mode.toUpperCase() === 'SUPPRESS') return DisplayMode.SUPPRESS;\n if (mode.toUpperCase() === 'HIDDEN') return DisplayMode.HIDDEN;\n if (mode.toUpperCase() === 'INVISIBLE') return DisplayMode.INVISIBLE;\n return defaultDisplayMode;\n }\n\n export function fromAny(mode: any): DisplayMode {\n const input = typeof mode === 'number' ? mode : DisplayMode.fromString(mode as string);\n if (Object.values(DisplayMode).includes(input)) return input;\n return defaultDisplayMode;\n }\n\n export function isDefined(mode: number | string): boolean {\n const check = typeof mode === 'number' ? mode : DisplayMode.fromString(mode as string);\n return Object.values(DisplayMode).includes(check);\n }\n}\n\nObject.freeze(DisplayMode);\n\nexport default DisplayMode;\n","import type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\ntype ActionExecutor = (field: FieldBase, supr: FieldActionExecute, ...params: any[]) => any;\n\nexport default abstract class FieldActionBase {\n public static get classIdentifier(): symbol {\n throw new Error('classIdentifier must be declared');\n }\n\n public get classIdentifier(): symbol {\n return (<any>this.constructor).classIdentifier;\n }\n\n private readonly executorFn: ActionExecutor;\n\n constructor(executorFn: ActionExecutor) {\n this.executorFn = executorFn;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, ...params: any[]): any {\n return this.executorFn(field, supr, ...params);\n }\n\n get eager() {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n boundToField(field: FieldBase) {}\n\n unregister() {}\n}\n","import type FieldActionBase from './actions/field-action-base';\nimport type DisplayMode from './display-mode';\nimport type { FieldBase } from './field-base';\nimport { type ValidationError } from './validators/validation-error';\n\nexport interface IFieldConstructorActionsList {\n actions?: FieldActionBase[];\n validators?: FieldActionBase[];\n}\n\n/**\n * Parameters accepted by field constructors and by clone overrides.\n *\n * Only writable members are listed. valid, validating, fullValue and isChanged are getter-only, so assigning\n * them throws a TypeError. parent and fieldName are set by the container: until a Group or List installs them\n * as non-configurable accessors, assigning them is silently accepted, which is why the type rejects them.\n */\nexport type IFieldConstructorParams<T = any> = {\n value: T;\n originalValue: T;\n enabled: boolean;\n visibility: DisplayMode;\n touched: boolean;\n errors: ValidationError[];\n} & IFieldConstructorActionsList;\n\nexport class AbortEventHandlingException extends Error {}\n\nexport type FieldActionExecute<T = any> = (field: FieldBase<T>, ...params: any[]) => any;\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nexport const ValueChangedActionClassIdentifier = Symbol('ValueChangedAction');\n\nexport class ValueChangedAction<T = any> extends FieldActionBase {\n constructor(executorFn: (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ValueChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","// Global configuration for @dynamicforms/vue-forms\nexport interface FormsConfig {\n useMarkdownInValidators: boolean;\n}\n\n// Default configuration\nconst config: FormsConfig = { useMarkdownInValidators: true };\n\n// Function to access config\nexport function getConfig(): FormsConfig {\n return config;\n}\n\n// Function to update config\nexport function setConfig(newConfig: Partial<FormsConfig>): void {\n Object.assign(config, newConfig);\n}\n\n// Vue plugin installation\nexport default {\n install(app: any, options?: Partial<FormsConfig>) {\n if (options) {\n setConfig(options);\n }\n },\n};\n","import { computed, ComputedRef, Ref, unref } from 'vue';\n\n/**\n * Marks content for markdown rendering\n */\nexport class MdString extends String {\n plugins?: any[];\n options?: any;\n\n constructor(value: string, options?: any, plugins?: any[]) {\n super(value);\n this.plugins = plugins;\n this.options = options;\n }\n}\n\n/**\n * Interface for custom component content definition\n */\nexport interface SimpleComponentDef {\n componentName: string;\n componentProps?: Record<any, any>;\n componentVHtml?: string;\n}\n\nexport type ClassType = string | string[] | Record<string, boolean>;\nexport type ClassTypes = ClassType | ClassType[];\n\nexport type RenderContentNonCallable = string | MdString | SimpleComponentDef;\nexport type RenderContentCallable = () => RenderContentNonCallable;\n/**\n * Type for different renderable content formats: plain string, markdown, or custom component\n */\nexport type RenderContent = RenderContentNonCallable | RenderContentCallable;\n/**\n * Type for different renderable content formats (supporting references): plain string, markdown, or custom component\n */\nexport type RenderContentRef = RenderContent | Ref<RenderContent>;\n\n/**\n * Type guard to check if content is a custom component definition\n * @param msg - Content to check\n * @returns True if content is a custom component definition\n */\nexport function isSimpleComponentDef(msg?: RenderContentRef): msg is SimpleComponentDef {\n const uMsg = unref(msg);\n return typeof uMsg === 'object' && 'componentName' in uMsg;\n}\n\nexport function isCallableFunction(msg?: RenderContentRef): msg is RenderContentCallable {\n return typeof unref(msg) === 'function';\n}\n\n/**\n * Base validation error class with component rendering capabilities\n */\n\nexport class ValidationError {\n get componentName() {\n return 'Comment';\n }\n\n get componentBindings() {\n return {};\n }\n\n get componentBody() {\n return '';\n }\n\n get extraClasses(): ClassTypes {\n return '';\n }\n}\n\n/**\n * Simple text-only ValidationError\n */\nexport class ValidationErrorText extends ValidationError {\n constructor(\n public text: string,\n public classes: ClassTypes = '',\n ) {\n super();\n }\n\n get componentName() {\n return 'template';\n }\n\n get componentBody() {\n return this.text;\n }\n\n get extraClasses() {\n return this.classes;\n }\n}\n\n/**\n * Validation error that supports multiple content types (plain text, markdown, component)\n */\nexport class ValidationErrorRenderContent extends ValidationError {\n private text: RenderContent | Ref<RenderContent>;\n\n private textType: ComputedRef<'string' | 'md' | 'component'>;\n\n constructor(\n text: RenderContentRef,\n public classes: ClassTypes = '',\n ) {\n super();\n this.text = text;\n this.textType = computed(() => this.getTextType);\n }\n\n get resolvedText() {\n const text = unref(this.text);\n return isCallableFunction(text) ? text() : text;\n }\n\n get getTextType() {\n const msg = this.resolvedText;\n\n if (!msg) return 'string';\n if (msg instanceof MdString) return 'md';\n if (isSimpleComponentDef(msg)) return 'component';\n return 'string';\n }\n\n get componentName() {\n switch (unref(this.textType)) {\n case 'string':\n return 'template';\n case 'md':\n return 'vue-markdown';\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentName;\n default:\n return 'template';\n }\n }\n\n get componentBindings() {\n switch (unref(this.textType)) {\n case 'string':\n return {};\n case 'md': {\n const text = this.resolvedText as MdString;\n return { source: text.toString(), options: text.options, plugins: text.plugins };\n }\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentProps || {};\n default:\n return {};\n }\n }\n\n get componentBody() {\n switch (unref(this.textType)) {\n case 'string':\n return this.resolvedText as string;\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentVHtml || '';\n default:\n return '';\n }\n }\n\n get extraClasses() {\n return this.classes;\n }\n}\n\n/**\n * A value, renderable three different ways (plain text, markdown, component) - alias for ValidationErrorRenderContent\n */\nexport class RenderableValue extends ValidationErrorRenderContent {}\n\n/** ********************************************************************************************************************\n *\n at some point there will be classes here that will support links or action buttons or something even more complex\n *\n ******************************************************************************************************************** */\n","import { getConfig } from '../config';\n\nimport { MdString } from './validation-error';\n\n/**\n * Depending on the useMarkdownInValidators setting, return either markdown or a plain string error message\n * @param mdErrorString markdown source to optionally be stripped\n * @return MdString or string\n */\n\nexport function buildErrorMessage(mdErrorString: string): string | MdString {\n const useMarkdownInValidators = getConfig().useMarkdownInValidators;\n if (useMarkdownInValidators) return new MdString(mdErrorString);\n\n return mdErrorString\n .replace(/[*_~`]/g, '') // remove basic markdown (italic, bold, strike, code)\n .replace(/!\\[(.*?)\\]\\(.*?\\)/g, '$1') // remove images, keep alt only\n .replace(/\\[(.*?)\\]\\((.*?)\\)/g, '$1') // remove links, keep name only\n .replace(/#+\\s?/g, '') // Remove heading markers (#, ##, ###)\n .replace(/>\\s?/g, '') // remove quotes\n .replace(/(\\*|-|\\d+\\.)\\s+/g, '') // remove lists (bullet points and numbered lists)\n .replace(/`{3}[\\s\\S]*?`{3}/g, '') // remove code blocks\n .replace(/`([^`]+)`/g, '$1') // remove inline code markers\n .replace(/\\n{2,}/g, '\\n'); // removes excessive empty lines\n}\n","import { isEqual } from 'lodash-es';\nimport { isRef, unref } from 'vue';\n\nimport { ValueChangedAction } from '../actions/value-changed-action';\nimport { type FieldBase } from '../field-base';\nimport { FieldActionExecute } from '../field.interface';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport {\n isCallableFunction,\n isSimpleComponentDef,\n MdString,\n RenderContentNonCallable,\n RenderContentRef,\n ValidationError,\n ValidationErrorRenderContent,\n} from './validation-error';\n\nexport type ValidationFunctionResult = ValidationError[] | null;\nexport type ValidationFunction<T = any> = (\n newValue: T,\n oldValue: T,\n field: FieldBase<T>,\n) => ValidationFunctionResult | Promise<ValidationFunctionResult>;\n\ninterface SourceProp {\n source: symbol;\n}\n\nconst ValidatorClassIdentifier = Symbol('Validator');\n\n/**\n * Message shown when a validation run rejects. It is built per rejection because the markdown setting it reads is\n * a runtime configuration value.\n */\nconst validationFailedMessage = (): RenderContentRef => buildErrorMessage('Validation could not be completed');\n\n/**\n * Validator is a specialized action that performs validation when a field's value changes.\n * It automatically adds/removes validation errors from the field's errors array.\n */\nexport class Validator<T = any> extends ValueChangedAction {\n private readonly source: symbol;\n\n /**\n * Sequence number of the newest run of this validator, per field. Every execution takes the next number, and a\n * result is applied only while its number is still the newest one, so a slow run cannot overwrite the verdict of\n * a faster one that started after it. The key is the field because one validator instance may be registered on\n * several fields, each with a sequence of its own.\n */\n private readonly runs = new WeakMap<FieldBase<any>, number>();\n\n /**\n * Creates a new validator\n * @param validationFn Function that validates the field value and returns errors or null\n */\n constructor(validationFn: ValidationFunction<T>) {\n const executor = (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => {\n const run = (this.runs.get(field) ?? 0) + 1;\n this.runs.set(field, run);\n const epoch = field.validationEpoch;\n // a result counts only while nothing newer has been decided for this field and the field still holds the\n // validators it held when the run started\n const isCurrent = () => this.runs.get(field) === run && field.validationEpoch === epoch;\n\n const errors = validationFn(newValue, oldValue, field) || [];\n\n const processErrors = (err: ValidationFunctionResult) => {\n const mine = err?.map((e) => this.claim(e)) ?? [];\n for (let i = field.errors.length - 1; i >= 0; i--) {\n const error = field.errors[i] as ValidationError & SourceProp;\n if (error.source === this.source) {\n const idx = mine.findIndex((e) => isEqual(e, error));\n if (idx >= 0) mine.splice(idx, 1);\n else field.errors.splice(i, 1);\n }\n }\n\n if (mine.length > 0) field.errors.push(...mine);\n field.validate(); // Update the field's valid state\n };\n\n if (errors instanceof Promise) {\n field.beginValidating();\n errors\n .then(\n (err) => {\n if (isCurrent()) processErrors(err);\n },\n (reason) => {\n // a rejection reaches no verdict, and no verdict may not read as a pass: this validator's errors are\n // replaced by the single failure error, so the field is invalid while the value is unchecked and the\n // form cannot be submitted on it. The error carries this validator's own source stamp, so the next\n // successful run of the same validator withdraws it like any other error of its own. The reason never\n // reaches the user, whose message says only that the check did not complete, so it is logged.\n if (isCurrent()) {\n processErrors([new ValidationErrorRenderContent(validationFailedMessage())]);\n console.error('Validation failed', reason);\n }\n },\n )\n .finally(() => field.endValidating())\n // applying a verdict fires ValidChangedAction, so a handler that throws would leave this chain\n // rejected with nowhere to report it\n .catch((error) => console.error('Validation failed', error));\n } else processErrors(errors);\n return supr(field, newValue, oldValue); // Continue the action chain\n };\n\n super(executor);\n\n // Create a unique symbol for this validator instance\n this.source = Symbol(this.constructor.name);\n }\n\n /**\n * Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no\n * ownership stamp or already carries this validator's, a copy of it when it belongs to another validator. The\n * stamp is not configurable, so an instance one validator owns can never be reassigned to another; the copy is\n * what makes an error instance shareable between validators, and it keeps the prototype and every own property,\n * including the non-enumerable ones, so it renders exactly like the instance it was made from.\n */\n private claim(error: ValidationError): ValidationError {\n const owner = (error as ValidationError & Partial<SourceProp>).source;\n if (owner === this.source) return error;\n\n const stamp: PropertyDescriptor = { value: this.source, enumerable: false, configurable: false };\n if (owner === undefined) {\n Object.defineProperty(error, 'source', stamp);\n return error;\n }\n const descriptors = Object.getOwnPropertyDescriptors(error) as Record<string, PropertyDescriptor>;\n return Object.create(Object.getPrototypeOf(error), { ...descriptors, source: stamp });\n }\n\n static get classIdentifier() {\n return ValidatorClassIdentifier;\n }\n\n get eager() {\n return true;\n }\n\n protected replacePlaceholdersFunction(text: RenderContentRef, replace: Record<string, any>): RenderContentRef {\n return () => {\n let ret = unref(text);\n while (isCallableFunction(ret)) {\n ret = unref(this.replacePlaceholders(ret(), replace));\n }\n return ret;\n };\n }\n\n protected replacePlaceholders(text: RenderContentRef, replace: Record<string, any>): RenderContentRef {\n if (isCallableFunction(text)) return this.replacePlaceholdersFunction(text, replace);\n\n if (isSimpleComponentDef(text)) return text;\n // a Ref is resolved on read, not here: substituting once would freeze the message at the value the reference\n // held during validation, and a translated message would stay in the language that was active back then\n if (isRef(text)) {\n return this.replacePlaceholdersFunction(() => unref(text) as RenderContentNonCallable, replace);\n }\n let ret = unref(text) as string | MdString;\n Object.keys(replace).forEach((key) => {\n ret = ret.replaceAll(`{${key}}`, replace[key]);\n });\n return text instanceof MdString ? new MdString(ret.toString(), text.options, text.plugins) : ret;\n }\n}\n","import { type FieldBase } from '../field-base';\nimport { type FieldActionExecute, AbortEventHandlingException } from '../field.interface';\nimport { Validator } from '../validators/validator';\n\nimport FieldActionBase from './field-action-base';\nimport { ValueChangedActionClassIdentifier } from './value-changed-action';\n\nexport default class ActionsMap extends Map<symbol, FieldActionExecute> {\n private readonly eagerActions = new Set<symbol>();\n\n private readonly registeredActions: FieldActionBase[] = [];\n\n register(action: FieldActionBase) {\n if (!(action instanceof FieldActionBase)) throw new Error('Invalid action type');\n this.registeredActions.push(action);\n\n const actionType = action.classIdentifier;\n const existingExecute = this.get(actionType) || (() => null);\n\n function ex(field: FieldBase, ...params: any[]) {\n return action.execute(field, existingExecute, ...params);\n }\n this.set(actionType, ex);\n if (action.eager) this.eagerActions.add(action.classIdentifier);\n }\n\n trigger<T extends FieldActionBase>(\n ActionClass: (abstract new (...args: any[]) => T) & { classIdentifier: symbol },\n field: FieldBase,\n ...params: any[]\n ): any {\n const identifier = ActionClass.classIdentifier;\n if (identifier === ValueChangedActionClassIdentifier) this.triggerEager(field, ...params);\n const execute = this.get(identifier);\n try {\n if (execute) return execute(field, ...params);\n } catch (error) {\n if (!(error instanceof AbortEventHandlingException)) throw error;\n }\n return null;\n }\n\n triggerEager(field: FieldBase, ...params: any[]): any {\n for (const identifier of this.eagerActions) {\n const execute = this.get(identifier);\n try {\n if (execute) execute(field, ...params);\n } catch (error) {\n if (!(error instanceof AbortEventHandlingException)) throw error;\n }\n }\n }\n\n clone(): ActionsMap {\n const newActions = new ActionsMap();\n this.registeredActions.forEach((action) => newActions.register(action));\n return newActions;\n }\n\n cloneWithoutValidators(): ActionsMap {\n const newActions = new ActionsMap();\n this.registeredActions.forEach((action) => {\n if (action instanceof Validator) action.unregister();\n else newActions.register(action);\n });\n return newActions;\n }\n}\n","import DisplayMode from '../../display-mode';\nimport { type FieldBase } from '../../field-base';\nimport { FieldActionExecute } from '../../field.interface';\nimport { ValueChangedAction } from '../value-changed-action';\n\nimport { Statement } from './statement';\n\nconst ConditionalStatementActionClassIdentifier = Symbol('ConditionalStatementAction');\n\ntype ConditionalExecutorFn = (field: FieldBase, currentResult: boolean, previousResult: boolean | undefined) => void;\n\nexport class ConditionalStatementAction extends ValueChangedAction {\n private lastResult: boolean | undefined = undefined;\n\n // boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the\n // ValueChangedAction fields that will call the actionExecutor\n private readonly boundFields: Set<FieldBase> = new Set<FieldBase>();\n\n constructor(statement: Statement, executorFn: ConditionalExecutorFn) {\n // Create ValueChangedAction executor that will evaluate statement and track changes\n const actionExecutor = (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => {\n const currentResult = statement.evaluate();\n\n if (currentResult !== this.lastResult) {\n for (const fld of this.boundFields) {\n executorFn(fld, currentResult, this.lastResult);\n }\n this.lastResult = currentResult;\n }\n\n // Continue action chain\n return supr(field, newValue, oldValue);\n };\n\n super(actionExecutor);\n statement.collectFields().forEach((field) => field.registerAction(new ValueChangedAction(actionExecutor)));\n }\n\n static get classIdentifier() {\n return ConditionalStatementActionClassIdentifier;\n }\n\n get eager() {\n return true;\n }\n\n boundToField(field: FieldBase) {\n this.boundFields.add(field);\n }\n}\n\n// Derived classes for visibility, enabled, and value changes\n\nexport class ConditionalVisibilityAction extends ConditionalStatementAction {\n constructor(statement: Statement) {\n super(statement, (field: FieldBase, currentResult) => {\n field.visibility = currentResult ? DisplayMode.FULL : DisplayMode.SUPPRESS;\n });\n }\n}\n\nexport class ConditionalEnabledAction extends ConditionalStatementAction {\n constructor(statement: Statement) {\n super(statement, (field, currentResult) => {\n field.enabled = currentResult;\n });\n }\n}\n\nexport class ConditionalValueAction<T> extends ConditionalStatementAction {\n constructor(statement: Statement, trueValue: T) {\n super(statement, (field, currentResult) => {\n if (currentResult) field.value = trueValue;\n });\n }\n}\n","/**\n * Operators provides us a functionality for backend to send us complex condition upon which we send\n * dynamic visibility prop for form input fields\n */\nenum Operator {\n // Logic Operators\n NOT = 0,\n OR = 1,\n AND = 2,\n XOR = 3,\n NAND = 4,\n NOR = 5,\n\n // Comparators (comparison operators)\n EQUALS = -1,\n NOT_EQUALS = -2,\n GT = -3,\n LT = -4,\n GE = -5,\n LE = -6,\n IN = -7,\n NOT_IN = -8,\n INCLUDES = -9,\n NOT_INCLUDES = -10,\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, no-redeclare\nnamespace Operator {\n export function fromString(operator: string): Operator {\n const op = operator.toLowerCase();\n if (op === 'not') return Operator.NOT;\n if (op === 'or') return Operator.OR;\n if (op === 'and') return Operator.AND;\n if (op === 'xor') return Operator.XOR;\n if (op === 'nand') return Operator.NAND;\n if (op === 'nor') return Operator.NOR;\n\n if (op === 'equals') return Operator.EQUALS;\n if (['not_equals', 'not-equals', 'not equals'].includes(op)) return Operator.NOT_EQUALS;\n if (op === 'gt') return Operator.GT;\n if (op === 'lt') return Operator.LT;\n if (op === 'ge') return Operator.GE;\n if (op === 'le') return Operator.LE;\n if (op === 'in') return Operator.IN;\n if (['not_in', 'not-in', 'not in'].includes(op)) return Operator.NOT_IN;\n if (op === 'includes') return Operator.INCLUDES;\n if (['not_includes', 'not-includes', 'not includes'].includes(op)) return Operator.NOT_INCLUDES;\n throw new Error(`Unrecognised operator ${op}`);\n }\n\n export function fromAny(mode: any): Operator {\n const input = typeof mode === 'number' ? mode : Operator.fromString(mode as string);\n if (Object.values(Operator).includes(input)) return input;\n throw new Error(`Unrecognised operator ${mode}`);\n }\n\n export function isDefined(operator: number | string): boolean {\n const check = typeof operator === 'number' ? operator : Operator.fromString(operator as string);\n return Object.values(Operator).includes(check);\n }\n\n // c8 bug: it doesn't matter what there is in the next line (e.g. console.log()).\n // it will always be a branch with one branch not covered\n export function isLogicOperator(operator: Operator): boolean {\n return operator >= 0;\n }\n}\n\nObject.freeze(Operator);\n\nexport default Operator;\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst EnabledChangingActionClassIdentifier = Symbol('EnabledChangingAction');\n\nexport class EnabledChangingAction extends FieldActionBase {\n constructor(\n executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => boolean,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return EnabledChangingActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): boolean {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n\nconst EnabledChangedActionClassIdentifier = Symbol('EnabledChangedAction');\n\nexport class EnabledChangedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return EnabledChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ValidChangedActionClassIdentifier = Symbol('ValidChangedAction');\n\nexport class ValidChangedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ValidChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport DisplayMode from '@/display-mode';\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst VisibilityChangingActionClassIdentifier = Symbol('VisibilityChangingAction');\n\nexport class VisibilityChangingAction extends FieldActionBase {\n constructor(\n executorFn: (\n field: FieldBase,\n supr: FieldActionExecute,\n newValue: DisplayMode,\n oldValue: DisplayMode,\n ) => DisplayMode,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return VisibilityChangingActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): DisplayMode {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n\nconst VisibilityChangedActionClassIdentifier = Symbol('VisibilityChangedAction');\n\nexport class VisibilityChangedAction extends FieldActionBase {\n constructor(\n executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => void,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return VisibilityChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import { isBoolean, isEqual } from 'lodash-es';\nimport { reactive } from 'vue';\n\nimport ActionsMap from './actions/actions-map';\nimport { EnabledChangedAction, EnabledChangingAction } from './actions/enabled-actions';\nimport FieldActionBase from './actions/field-action-base';\nimport { ValidChangedAction } from './actions/valid-changed-action';\nimport { VisibilityChangedAction, VisibilityChangingAction } from './actions/visibility-actions';\nimport DisplayMode from './display-mode';\nimport { IFieldConstructorParams } from './field.interface';\nimport { type Group } from './group';\nimport { ValidationError } from './validators/validation-error';\n\nexport abstract class FieldBase<T = any> {\n /**\n * A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a\n * derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and\n * method sees the proxy. Consequence: plain `field.property = value` is tracked, with no wrapper in between.\n */\n constructor() {\n return reactive(this) as this;\n }\n\n abstract get value(): T;\n abstract set value(newValue: T);\n\n abstract get touched(): boolean;\n abstract set touched(touched: boolean);\n\n abstract clone(overrides?: Partial<IFieldConstructorParams<T>>): FieldBase<T>;\n\n declare originalValue: T; // contains original field value as was provided at creation\n\n private validatingCount = 0;\n\n /** true while at least one asynchronous validator is still running for this field */\n get validating(): boolean {\n return this.validatingCount > 0;\n }\n\n /** announces the start of one asynchronous validation run; validators pair it with endValidating */\n beginValidating(): void {\n this.validatingCount++;\n }\n\n /** announces the end of one asynchronous validation run */\n endValidating(): void {\n this.validatingCount = Math.max(0, this.validatingCount - 1);\n }\n\n protected _valid: boolean = true; // is current value valid as per FE and BE validators?\n\n errors: ValidationError[] = []; // list of errors\n\n declare parent?: Group; // when member of a Group, parent will specify that group\n\n declare fieldName?: string; // when member of a Group, fieldName specifies the name of this field\n\n protected actions: ActionsMap = new ActionsMap();\n\n // default property handlers\n private _visibility: DisplayMode = DisplayMode.FULL;\n\n get visibility(): DisplayMode {\n return this._visibility;\n }\n\n set visibility(newValue: DisplayMode) {\n const oldValue = this._visibility;\n const alteredValue = this.actions.trigger(VisibilityChangingAction, this, newValue, oldValue);\n if (!DisplayMode.isDefined(alteredValue ?? newValue)) throw new Error('visibility must be a DisplayMode constant');\n this._visibility = DisplayMode.fromAny(alteredValue ?? newValue);\n this.actions.trigger(VisibilityChangedAction, this, this._visibility, oldValue);\n }\n\n private _enabled: boolean = true;\n\n get enabled(): boolean {\n return this._enabled;\n }\n\n set enabled(newValue: boolean) {\n const oldValue = this._enabled;\n const alteredValue = this.actions.trigger(EnabledChangingAction, this, newValue, oldValue);\n if (!isBoolean(alteredValue ?? newValue)) throw new Error('Enabled value must be boolean');\n this._enabled = alteredValue ?? newValue;\n this.actions.trigger(EnabledChangedAction, this, this._enabled, oldValue);\n }\n\n /**\n * While true, validate() on this field does nothing at all: it neither recomputes _valid nor emits\n * ValidChangedAction, and nothing climbs to the parent. A container that walks its members one by one - assigning\n * them a value, or revalidating them - sets it for the duration of the walk, so a member's upward climb cannot\n * announce the verdict of a half-applied value or of a half-revalidated set, and clears it in a finally block\n * followed by its own validate(). That call recomputes over the finished state and emits the net transition, so\n * the deferral cannot swallow a real change.\n */\n protected suppressValidation: boolean = false;\n\n /**\n * While true, a validity change is still recomputed and still announced on this field, but it is not passed up to\n * the parent: the climb is only remembered and carried out by flushParentValidityClimb(). A setter that notifies\n * the parent of the new value itself holds it over the notifying region, so the parent forms its verdict once,\n * over the finished value, instead of once over the value being replaced and once over the value replacing it.\n */\n protected suppressParentValidityClimb: boolean = false;\n\n private parentValidityClimbPending: boolean = false;\n\n /** Carries out the climb that a validity change made while suppressParentValidityClimb was held, if there was one. */\n protected flushParentValidityClimb(): void {\n if (!this.parentValidityClimbPending) return;\n this.parentValidityClimbPending = false;\n this.parent?.validate();\n }\n\n validate(revalidate: boolean = false) {\n if (this.suppressValidation) return;\n if (revalidate) this.actions.triggerEager(this, this.value, this.value);\n const oldValid = this._valid;\n this._valid = this.valid;\n if (this._valid !== oldValid) {\n this.actions.trigger(ValidChangedAction, this, this.valid, oldValid);\n // a container's validity is composed of its members', so a member that changes it without a value change\n // (asynchronous validator, externally pushed error) has to make the container re-evaluate. The call passes\n // no revalidate, so it only recomputes, and it climbs no further than the first ancestor whose own\n // validity stays the same.\n if (this.suppressParentValidityClimb) this.parentValidityClimbPending = true;\n else this.parent?.validate();\n }\n }\n\n get valid() {\n return this.errors.length === 0;\n }\n\n get fullValue(): any {\n return this.value;\n }\n\n get isChanged(): boolean {\n return !isEqual(this.value, this.originalValue);\n }\n\n /**\n * Registers the actions a constructor received in its parameters: registration without the eager trigger,\n * because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an\n * eager action registered here would otherwise also run once per registration, over a half-built field.\n */\n protected registerInitialActions(actions: FieldActionBase[]): void {\n actions.forEach((action) => {\n this.actions.register(action);\n action.boundToField(this);\n });\n }\n\n registerAction(action: FieldActionBase): this {\n this.actions.register(action);\n action.boundToField(this);\n if (action.eager) {\n // When adding eager actions, execute them immediately\n this.actions.trigger(Object.getPrototypeOf(action).constructor, this, this.value, this.originalValue);\n }\n return this;\n }\n\n triggerAction<T2 extends FieldActionBase>(\n actionClass: (abstract new (...args: any[]) => T2) & { classIdentifier: symbol },\n ...params: any[]\n ): any {\n return this.actions.trigger(actionClass, this, ...params);\n }\n\n private _validationEpoch: number = 0;\n\n /**\n * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops\n * a result whose epoch no longer matches, so a validation still in flight when clearValidators() is called\n * cannot push an error onto a field that no longer has the validator that produced it.\n */\n get validationEpoch(): number {\n return this._validationEpoch;\n }\n\n clearValidators(): void {\n this._validationEpoch++;\n this.actions = this.actions.cloneWithoutValidators();\n this.errors = [];\n // the errors are gone before the recomputation, so validate() sees the cleared state and routes the validity\n // transition through the usual path: the ValidChangedAction fires and the parent re-evaluates\n this.validate();\n }\n}\n","import { isString } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport { FieldBase } from '../../field-base';\n\nimport Operator from './operator';\n\n// An operand is a nested Statement, a field whose current value is compared, or a literal of any type. The\n// union with `any` collapses to `any` for the type checker, so the alias documents intent rather than\n// constraining callers.\nexport type OperandType = any | Statement | FieldBase;\n\nfunction XOR(value1: boolean, value2: boolean): boolean {\n return value1 ? !value2 : value2;\n}\n\nexport class Statement {\n private readonly operand1: OperandType;\n\n private readonly operator: Operator;\n\n private readonly operand2: OperandType;\n\n constructor(operand1: OperandType, operator: Operator, operand2: OperandType) {\n this.operand1 = operand1;\n this.operator = operator;\n this.operand2 = operand2;\n }\n\n get operand1Value() {\n if (this.operand1 instanceof Statement) return this.operand1.evaluate();\n if (this.operand1 instanceof FieldBase) return unref(this.operand1.value);\n return this.operand1; // any\n }\n\n get operand2Value() {\n if (this.operand2 instanceof Statement) return this.operand2.evaluate();\n if (this.operand2 instanceof FieldBase) return unref(this.operand2.value);\n return this.operand2; // any\n }\n\n evaluate(): boolean {\n const operand1 = this.operand1Value;\n const operand2 = this.operand2Value;\n\n switch (this.operator) {\n // logical operators\n // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the\n // coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the\n // signature promises a boolean, and consumers comparing results with !== would see a change where the\n // logical value stayed the same.\n case Operator.AND:\n return Boolean(operand1 && operand2);\n case Operator.OR:\n return Boolean(operand1 || operand2);\n case Operator.NAND:\n return !(operand1 && operand2);\n case Operator.NOR:\n return !(operand1 || operand2);\n case Operator.XOR:\n return XOR(Boolean(operand1), Boolean(operand2));\n case Operator.NOT:\n return !operand1;\n\n // comparison operators\n case Operator.EQUALS:\n return operand1 == operand2;\n case Operator.NOT_EQUALS:\n return operand1 != operand2;\n case Operator.LT:\n return operand1 < operand2;\n case Operator.LE:\n return operand1 <= operand2;\n case Operator.GE:\n return operand1 >= operand2;\n case Operator.GT:\n return operand1 > operand2;\n case Operator.IN:\n // `includes` is called on an operand of any type, so its return value is not guaranteed to be a\n // boolean; a missing or non-callable `includes` yields undefined and therefore false. NOT_IN negates\n // exactly this, so a right operand that reports no membership at all is IN false and NOT_IN true.\n return Boolean(operand2?.includes?.(operand1));\n case Operator.NOT_IN:\n return !operand2?.includes?.(operand1);\n case Operator.INCLUDES:\n return isString(operand1) && isString(operand2) && operand1.indexOf(operand2) >= 0;\n case Operator.NOT_INCLUDES:\n return !(isString(operand1) && isString(operand2) && operand1.indexOf(operand2) >= 0);\n\n default:\n throw new Error(`Operator not implemented ${this.operator}`);\n }\n }\n\n /**\n * Recursively collects all fields used in this statement and its nested statements\n * @returns A set of all fields used in this statement\n */\n collectFields(): Set<FieldBase> {\n const fields = new Set<FieldBase>();\n\n function processOperand(op: OperandType) {\n if (op instanceof FieldBase) {\n fields.add(op);\n } else if (op instanceof Statement) {\n // For nested statements, merge their fields with our collection\n const nestedFields = op.collectFields();\n nestedFields.forEach((field) => fields.add(field));\n }\n }\n processOperand(this.operand1);\n processOperand(this.operand2);\n\n return fields;\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ExecuteActionClassIdentifier = Symbol('ExecuteAction');\n\nexport class ExecuteAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, params: any) => any) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ExecuteActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, params: any): any {\n return super.execute(field, supr, params);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ListItemAddedActionClassIdentifier = Symbol('ListItemAddedAction');\n\nexport class ListItemAddedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ListItemAddedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void {\n return super.execute(field, supr, item, index);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ListItemRemovedActionClassIdentifier = Symbol('ListItemRemovedAction');\n\nexport class ListItemRemovedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ListItemRemovedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void {\n return super.execute(field, supr, item, index);\n }\n}\n","import { ValueChangedAction } from './actions';\nimport { FieldBase } from './field-base';\nimport { IFieldConstructorParams } from './field.interface';\n\nclass Field<T = any> extends FieldBase<T> {\n protected _value: T = undefined!;\n\n protected _touched: boolean = false;\n\n constructor(params?: Partial<IFieldConstructorParams<T>>) {\n super();\n this.init(params);\n }\n\n /**\n * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling\n * overrides one method instead of redeclaring the constructor - Action does exactly that.\n *\n * It is called from this constructor, so it runs before a subclass's own class field initializers, which\n * only run once super() returns. An override must therefore work off its parameters alone: members the\n * subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten\n * the moment the initializer runs.\n */\n protected init(params?: Partial<IFieldConstructorParams<T>>) {\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n Object.assign(this, otherParams);\n // an absent value falls back to originalValue, an explicit null does not: null is a value a caller means\n this._value = paramValue !== undefined ? paramValue : this.originalValue;\n if (this.originalValue === undefined) this.originalValue = this._value;\n }\n this.actions.triggerEager(this, this.value, this.originalValue);\n this.validate();\n }\n\n get value() {\n return this._value;\n }\n\n set value(newValue: T) {\n const oldValue = this._value;\n if (!this.enabled || oldValue === newValue) return; // a disabled field does not allow changing value\n this._value = newValue;\n // the parent learns of the new value from notifyValueChanged() and validates itself from there, over the whole\n // value; a validator running on this field must therefore not send it a verdict of its own in the meantime\n const outerClimb = this.suppressParentValidityClimb;\n this.suppressParentValidityClimb = true;\n try {\n this.actions.trigger(ValueChangedAction, this, this._value, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n } finally {\n this.suppressParentValidityClimb = outerClimb;\n this.validate();\n // a parent whose own value did not change by this assignment returns from notifyValueChanged() without\n // validating, so a validity change held back above still has to reach it. Both run even when a handler\n // threw, or the parent would keep a verdict the members no longer support.\n this.flushParentValidityClimb();\n }\n }\n\n get touched(): boolean {\n return this._touched;\n }\n\n set touched(touched: boolean) {\n this._touched = touched;\n }\n\n clone(overrides?: Partial<IFieldConstructorParams<T>>): this {\n // construction goes through this.constructor so that a subclass clones into its own type\n const Ctor = this.constructor as new (params?: Partial<IFieldConstructorParams<T>>) => this;\n const res = new Ctor({\n // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears\n value: overrides?.value !== undefined ? (overrides.value as T) : this.value,\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n });\n res.actions = this.actions.clone();\n res.actions.triggerEager(res, res.value, res.originalValue);\n return res;\n }\n}\n\nexport { Field };\n\nexport type NullableField<T = any> = Field<T> | null;\n\nexport const EmptyField = new Field({ value: 'EmptyField' }).registerAction(\n new ValueChangedAction(() => {\n console.warn('Working with EmptyField! This should not happen');\n }),\n);\n","import { ExecuteAction } from './actions';\nimport { Field } from './field';\nimport { IFieldConstructorParams } from './field.interface';\n\nexport interface ActionValue {\n label?: string;\n icon?: string;\n}\n\nfunction isValEmpty(val: ActionValue | undefined, defaultIfTrue: ActionValue): ActionValue {\n if (val?.label == null && val?.icon == null) return defaultIfTrue;\n return val;\n}\n\nexport class Action<T extends ActionValue = ActionValue> extends Field<T> {\n protected init(params?: Partial<IFieldConstructorParams<T>>) {\n // an Action's value is always a shaped object, so the empty value is the pair of undefined members and not\n // undefined itself - both this hook and isValEmpty below rely on that\n this._value = { label: undefined, icon: undefined } as T;\n if (params) {\n const { value: paramValue, originalValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n Object.assign(this, otherParams);\n const val = isValEmpty(paramValue, this._value);\n const orgVal = Object.freeze({ label: originalValue?.label, icon: originalValue?.icon } as ActionValue);\n // the fallback is a copy of the baseline, never the frozen baseline itself: label and icon stay\n // assignable on an action constructed without a value. A value that was given is kept by identity,\n // so a reactive object passed in stays linked to the action.\n this._value = isValEmpty(val, { ...orgVal }) as T;\n this.originalValue = isValEmpty(orgVal, val) as T;\n }\n this.actions.triggerEager(this, this.value, this.originalValue);\n this.validate();\n }\n\n get icon(): string | undefined {\n return this.value.icon;\n }\n\n set icon(newValue: string | undefined) {\n this.value.icon = newValue;\n }\n\n get label(): string | undefined {\n return this.value.label;\n }\n\n set label(newValue: string | undefined) {\n this.value.label = newValue;\n }\n\n execute(params: any) {\n this.actions.trigger(ExecuteAction, this, params);\n }\n}\n\nexport type NullableAction = Action | null;\n","<template>\n <render />\n</template>\n\n<script setup lang=\"ts\">\nimport { h, resolveComponent } from 'vue';\n\nimport { ClassTypes, ValidationError } from '../validators';\n\ninterface Props {\n message: string | ValidationError[];\n classes?: ClassTypes;\n}\n\nconst props = defineProps<Props>();\nconst md = resolveComponent('vue-markdown');\nconst htmlElements = new Set([\n 'div',\n 'span',\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'section',\n 'article',\n 'aside',\n 'nav',\n 'header',\n 'footer',\n 'main',\n 'figure',\n 'figcaption',\n 'blockquote',\n 'pre',\n 'code',\n 'em',\n 'strong',\n 'small',\n 'mark',\n 'del',\n 'ins',\n 'sub',\n 'sup',\n 'i',\n 'b',\n 'u',\n 's',\n 'a',\n 'img',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'label',\n 'form',\n 'table',\n 'tr',\n 'td',\n 'th',\n 'thead',\n 'tbody',\n 'tfoot',\n 'ul',\n 'ol',\n 'li',\n 'dl',\n 'dt',\n 'dd',\n]);\n\nconst render = () => {\n if (typeof props.message === 'string') return h('span', { class: props.classes }, props.message);\n const res: ReturnType<typeof h>[] = [];\n props.message.forEach((msg) => {\n switch (msg.componentName) {\n case 'template':\n res.push(h('div', { class: [props.classes, msg.extraClasses] }, msg.componentBody));\n break;\n case 'vue-markdown':\n if (typeof md === 'string') {\n console.warn(\n \"You are using markdown for messages-widget, but you haven't registered a vue-markdown component\",\n );\n res.push(h('div', { class: [props.classes, msg.extraClasses] }, (<any>msg.componentBindings).source));\n } else {\n const componentBindings = <any>msg.componentBindings;\n res.push(\n h(md, {\n class: [props.classes, msg.extraClasses, 'df-messages-widget-markdown'],\n source: componentBindings.source,\n options: componentBindings.options,\n plugins: componentBindings.plugins,\n }),\n );\n }\n break;\n default:\n res.push(\n h(\n htmlElements.has(msg.componentName.toLowerCase()) // only resolve if it's not a common html element\n ? msg.componentName\n : resolveComponent(msg.componentName),\n {\n class: [props.classes, msg.extraClasses],\n ...msg.componentBindings,\n ...(msg.componentBody ? { innerHTML: msg.componentBody } : {}),\n },\n ),\n );\n break;\n }\n });\n return res;\n};\n</script>\n\n<style>\n/* we would like there to be no margins for markdown at the very top and very bottom. the rest of it is fine */\n.df-messages-widget-markdown > :first-child,\n.df-messages-widget-markdown > :last-child {\n margin-top: 0 !important;\n padding-top: 0 !important;\n margin-bottom: 0 !important;\n padding-bottom: 0 !important;\n line-height: 1.35em !important; /* inspired by vitepress' aggressive settings */\n}\n</style>\n","import { isEmpty, isEqual } from 'lodash-es';\n\nimport { ValueChangedAction } from './actions';\nimport { Field } from './field';\nimport { FieldBase } from './field-base';\nimport { IFieldConstructorParams } from './field.interface';\n\nexport type GenericFieldsInterface = Record<string, FieldBase>;\n// Utility type converting a field structure into the matching value structure.\n// The indexed access reads each field's value getter, so a nested Group contributes its own value structure and\n// a List contributes its row array. Inferring from FieldBase<infer U> instead would pick up the value setter,\n// which is deliberately wider than the getter on Group.\nexport type FieldsToValues<T extends GenericFieldsInterface> = {\n [K in keyof T]: T[K]['value'];\n};\n\n/** what Group.value reads back: the full field map, or null when no field serializes */\nexport type GroupValue<T extends GenericFieldsInterface> = FieldsToValues<T> | null;\n/** what Group.value and the Group constructor accept: keys left out are simply not assigned */\nexport type GroupValueInput<T extends GenericFieldsInterface> = Partial<FieldsToValues<T>> | null;\n\nexport class Group<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<GroupValue<T>> {\n private readonly _fields: T;\n\n private _value: GroupValue<T> = null;\n\n private suppressNotifyValueChanged: boolean = false;\n\n constructor(fields: T, params?: Partial<IFieldConstructorParams<GroupValueInput<T>>>) {\n super();\n\n if (!Group.isValidFields(fields)) throw new Error('Invalid fields object provided');\n // the backing map has no prototype: a field may be named after an Object.prototype member, and on an\n // ordinary object a `__proto__` key would go to the inherited setter instead of becoming a field\n this._fields = Object.create(null) as T;\n Object.entries(fields).forEach(([name, field]) => this.addField(name, field));\n\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n Object.assign(this, otherParams);\n // an assignment is made only for a value the caller actually supplied, and undefined is not one: spreading\n // an optional property yields an undefined value, and assigning it would push null into every member and\n // then baseline that emptied state as the original, so the group would report itself unchanged over values\n // its members never held. An explicit null is a supplied value and does clear the members.\n if (paramValue !== undefined) this.assignMembers(paramValue as GroupValueInput<T>);\n else if (this.originalValue !== undefined) this.assignMembers(this.originalValue);\n }\n\n if (this.originalValue === undefined) this.originalValue = this.value;\n\n // the cache the ValueChangedAction reads as the old value starts at the constructed value, so the first change\n // of a member reports what the group held before it instead of null\n this._value = this.value;\n\n // if (Object.keys(this._fields).length) console.log('group created', this, Error().stack);\n this.actions.triggerEager(this, this.value, this.originalValue);\n this.validate();\n }\n\n private addField(fieldName: string, field: FieldBase) {\n // note: not sure if I should expose this (make it public).\n // breaks types, neglects events (originalValue, valueChanged), etc.\n if (Object.hasOwn(this._fields, fieldName)) {\n throw new Error(`Field ${fieldName} is already in this form`);\n }\n // parent and fieldName must stay non-enumerable: Group.value iterates its fields, and lodash isEqual and\n // JSON.stringify walk own enumerable properties, so an enumerable back-reference makes all three recurse\n // into the parent. defineProperty has no trap on a reactive proxy, so it reaches the underlying object.\n Object.defineProperty(field, 'parent', { get: () => this, configurable: false, enumerable: false });\n Object.defineProperty(field, 'fieldName', { get: () => fieldName, configurable: false, enumerable: false });\n // the entry is a non-configurable getter, so the map cannot be rewritten behind the group's back:\n // a field assigned straight into `fields` would never receive parent, fieldName or change notifications\n Object.defineProperty(this._fields, fieldName, { get: () => field, configurable: false, enumerable: true });\n }\n\n private static isValidFields(flds: unknown): flds is Record<string, FieldBase> {\n function isFieldAll(field: unknown): field is FieldBase {\n return field instanceof FieldBase;\n }\n\n return typeof flds === 'object' && flds !== null && Object.entries(flds).every(([, field]) => isFieldAll(field));\n }\n\n static createFromFormData(data: Record<string, any> | null): Group {\n if (data instanceof FieldBase) {\n throw new Error('data is already a Form structure, should be a simple object');\n }\n return new Group(\n data == null ? {} : Object.fromEntries(Object.entries(data).map(([key, value]) => [key, new Field({ value })])),\n );\n }\n\n field<K extends keyof T>(fieldName: K): T[K] | null {\n return this._fields[fieldName] ?? null;\n }\n\n get fields(): T {\n return this._fields;\n }\n\n get value(): GroupValue<T> {\n // accumulate without a prototype so a field named `__proto__` is stored instead of reassigning the\n // accumulator's prototype; the spread on return hands back an ordinary object\n const val = Object.create(null) as Record<string, any>;\n Object.entries(this._fields).forEach(([name, field]) => {\n const fieldValue = field.value;\n if (field.enabled) {\n // readOnly fields do not serialize\n val[name] = fieldValue;\n } else if (field instanceof Group && !isEmpty(fieldValue)) {\n // readOnly group only serializes if it is non-empty (some of its fields are not readOnly)\n val[name] = fieldValue;\n }\n });\n return isEmpty(val) ? null : ({ ...val } as FieldsToValues<T>);\n }\n\n /**\n * Writes the members that the given value carries, without letting any single member announce the state in\n * between: the group's own value notification and its own validation are both held back for the duration, so\n * neither a ValueChangedAction nor a ValidChangedAction reports a verdict over a half-applied value. The\n * caller decides what to announce once the whole value is in place. Both flags are restored to what they were,\n * so a caller that is itself holding the group back stays in charge.\n */\n private assignMembers(newValue: GroupValueInput<T>) {\n const outerNotify = this.suppressNotifyValueChanged;\n const outerValidation = this.suppressValidation;\n this.suppressNotifyValueChanged = true;\n this.suppressValidation = true;\n try {\n Object.entries(this._fields).forEach(([name, field]) => {\n if (newValue == null || Object.hasOwn(newValue, name)) {\n field.value = newValue == null ? null : newValue[name];\n }\n });\n } finally {\n this.suppressNotifyValueChanged = outerNotify;\n this.suppressValidation = outerValidation;\n }\n }\n\n set value(newValue: GroupValueInput<T>) {\n this.assignMembers(newValue);\n this.notifyValueChanged();\n this.validate();\n }\n\n get touched(): boolean {\n return Object.values(this._fields).some((field) => field.touched);\n }\n\n set touched(touched: boolean) {\n Object.values(this._fields).forEach((field) => {\n field.touched = touched;\n });\n }\n\n get fullValue(): Record<string, any> {\n const value = Object.create(null) as Record<string, any>;\n Object.entries(this._fields).forEach(([name, field]) => {\n value[name] = field.fullValue;\n });\n return { ...value };\n }\n\n notifyValueChanged() {\n if (this.suppressNotifyValueChanged) return;\n const newValue = this.value;\n if (!isEqual(newValue, this._value)) {\n const oldValue = this._value;\n this._value = newValue;\n // the parent learns of the new value below and validates itself from there, over the whole value; a\n // validator running on this group must therefore not send it a verdict of its own in the meantime\n const outerClimb = this.suppressParentValidityClimb;\n this.suppressParentValidityClimb = true;\n try {\n this.actions.trigger(ValueChangedAction, this, newValue, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n } finally {\n this.suppressParentValidityClimb = outerClimb;\n this.validate();\n // a parent whose own value did not change by this one returns from notifyValueChanged() without\n // validating, so a validity change held back above still has to reach it. Both run even when a handler\n // threw, or the parent would keep a verdict the members no longer support.\n this.flushParentValidityClimb();\n }\n }\n }\n\n get valid() {\n return super.valid && Object.values(this._fields).every((field) => field.valid);\n }\n\n validate(revalidate: boolean = false) {\n if (revalidate) {\n // the members are revalidated with the group held back, so a member that turns valid while a later one is\n // still to be checked cannot make the group announce a verdict over a half-revalidated set. The group forms\n // its own verdict below, once, over the finished set.\n const outerValidation = this.suppressValidation;\n this.suppressValidation = true;\n try {\n Object.values(this._fields).forEach((field) => field.validate(true));\n } finally {\n this.suppressValidation = outerValidation;\n }\n }\n super.validate(revalidate);\n }\n\n clone(overrides?: Partial<IFieldConstructorParams<GroupValueInput<T>>>): Group<T> {\n const newFields = Object.create(null) as T;\n Object.entries(this._fields).forEach(([name, field]) => {\n newFields[name as keyof T] = field.clone() as any;\n });\n const res = new Group(newFields, {\n // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears\n value: overrides?.value !== undefined ? overrides.value : this.value,\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n });\n res.actions = this.actions.clone();\n res.actions.triggerEager(res, res.value, res.originalValue);\n return res;\n }\n}\n\nexport type NullableGroup = Group | null;\n","import { isEmpty, isEqual } from 'lodash-es';\n\nimport { ListItemAddedAction, ListItemRemovedAction, ValueChangedAction } from './actions';\nimport { FieldBase } from './field-base';\nimport { IFieldConstructorParams } from './field.interface';\nimport { GenericFieldsInterface, Group } from './group';\n\n/** what List.value reads back: one plain object per item, or null when the list is empty */\nexport type ListValue = Record<string, any>[] | null;\n\nexport class List<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<ListValue> {\n private _value: Group<T>[] | null = null;\n\n private _itemTemplate?: Group<T>;\n\n private _previousValue: ListValue;\n\n constructor(itemTemplate?: Group<T>, params?: Partial<IFieldConstructorParams<ListValue>>) {\n super();\n\n this._itemTemplate = itemTemplate;\n\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n Object.assign(this, otherParams);\n\n // the items are installed directly, so nothing is announced over a list that is only partly built; a value\n // that is undefined or null leaves the list empty, which is the state it starts in\n if (paramValue != null) this.setValueInternal(paramValue);\n }\n\n if (this.originalValue === undefined) this.originalValue = this.value;\n this._previousValue = this.value;\n // if (Object.keys(this._fields).length) console.log('formGroup created', this, Error().stack);\n this.actions.triggerEager(this, this.value, this.originalValue);\n this.validate();\n }\n\n private processSetValueItem(item: any): Group<T> {\n let res: Group<T>;\n // If item is already a Group, use it\n if (item instanceof Group) res = item;\n // Otherwise create a Group from item\n else if (this._itemTemplate) res = this._itemTemplate.clone({ value: item });\n else res = Group.createFromFormData(item) as Group<T>;\n\n Object.defineProperty(res, 'parent', { get: () => this, configurable: false, enumerable: false });\n\n return res;\n }\n\n /**\n * Builds the item that fills a gap left by an insert beyond the end of the list: a copy of the item template with\n * the template's own values, or an empty group when the list has no template.\n */\n private createPaddingItem(): Group<T> {\n return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.clone() : null);\n }\n\n private setValueInternal(newValue: any[]) {\n // null is the value that clears, the same one Group.value = null writes into every member; without this a\n // list nested in a group would keep its rows while every sibling field was emptied\n if (newValue == null) this._value = null;\n else if (Array.isArray(newValue)) {\n this._value = newValue.map((item: any) => this.processSetValueItem(item));\n }\n }\n\n get value(): ListValue {\n const value = this._value?.map((item) => item.value);\n return isEmpty(value) ? null : <Record<string, any>[]>value;\n }\n\n set value(newValue: Record<string, any>[]) {\n const oldValue = this._previousValue;\n this.setValueInternal(newValue);\n const currentValue = this.value;\n // the cache is refreshed before the event, exactly as notifyValueChanged() does it: an item that reports a\n // change while the handlers run must compare against the value just assigned, not against the one replaced\n this._previousValue = currentValue;\n // the parent learns of the new value below and validates itself from there, over the whole value; a validator\n // running on this list must therefore not send it a verdict of its own in the meantime\n const outerClimb = this.suppressParentValidityClimb;\n this.suppressParentValidityClimb = true;\n try {\n this.actions.trigger(ValueChangedAction, this, currentValue, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n } finally {\n this.suppressParentValidityClimb = outerClimb;\n this.validate();\n // a parent whose own value did not change by this one returns from notifyValueChanged() without validating,\n // so a validity change held back above still has to reach it. Both run even when a handler threw, or the\n // parent would keep a verdict the members no longer support.\n this.flushParentValidityClimb();\n }\n }\n\n get touched(): boolean {\n return this._value?.some((item) => item.touched) || false;\n }\n\n set touched(touched: boolean) {\n this._value?.forEach((item) => {\n item.touched = touched;\n });\n }\n\n clone(overrides?: Partial<IFieldConstructorParams<ListValue>>): List<T> {\n const res = new List(this._itemTemplate?.clone(), {\n // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears\n value: [...((overrides?.value !== undefined ? overrides.value : this.value) ?? [])],\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n });\n res.actions = this.actions.clone();\n res.actions.triggerEager(res, res.value, res.originalValue);\n return res;\n }\n\n notifyValueChanged() {\n const newValue = this.value;\n if (!isEqual(newValue, this._previousValue)) {\n const oldValue = this._previousValue;\n this._previousValue = newValue;\n const outerClimb = this.suppressParentValidityClimb;\n this.suppressParentValidityClimb = true;\n try {\n this.actions.trigger(ValueChangedAction, this, newValue, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n } finally {\n this.suppressParentValidityClimb = outerClimb;\n this.validate();\n this.flushParentValidityClimb();\n }\n }\n }\n\n get valid() {\n return super.valid && (this._value?.every((item) => item.valid) ?? true);\n }\n\n validate(revalidate: boolean = false) {\n if (revalidate) {\n // the items are revalidated with the list held back, so an item that turns valid while a later one is still\n // to be checked cannot make the list announce a verdict over a half-revalidated set. The list forms its own\n // verdict below, once, over the finished set.\n const outerValidation = this.suppressValidation;\n this.suppressValidation = true;\n try {\n this._value?.forEach((item) => item.validate(true));\n } finally {\n this.suppressValidation = outerValidation;\n }\n }\n super.validate(revalidate);\n }\n\n get(index: number): Group<T> | undefined {\n return this._value != null ? this._value[index] : undefined;\n }\n\n push(item: any): number {\n return this.insert(item, this._value?.length ?? 0) + 1;\n }\n\n pop(): Group<T> | undefined {\n return this.remove((this._value?.length ?? 0) - 1);\n }\n\n remove(index: number): Group<T> | undefined {\n if (this._value == null || index < 0 || this._value.length <= index) return undefined;\n\n let removedItem = this._value.splice(index, 1)?.[0];\n\n if (removedItem) {\n // Remove parent reference\n removedItem = removedItem.clone();\n\n // Trigger events\n this.actions.trigger(ListItemRemovedAction, this, removedItem, index);\n this.notifyValueChanged();\n }\n\n return removedItem;\n }\n\n insert(item: any, index: number): number {\n if (this._value == null) this._value = [];\n // a negative index counts back from the end and stops at the start, the way splice reads it, so the\n // position announced and returned is the one the item actually occupies\n const position = index < 0 ? Math.max(this._value.length + index, 0) : index;\n while (this._value.length < position) {\n // if the index is too large for current array size, we add as many as necessary\n const itm = this.createPaddingItem();\n // push returns the new length, while the event carries the index of the item that was added\n const idx = this._value.push(itm) - 1;\n this.actions.trigger(ListItemAddedAction, this, itm, idx);\n }\n const itm = this.processSetValueItem(item);\n this._value.splice(position, 0, itm);\n\n this.actions.trigger(ListItemAddedAction, this, itm, position);\n this.notifyValueChanged();\n\n return position;\n }\n\n clear() {\n this._value = null;\n this.notifyValueChanged();\n }\n}\n\nexport type NullableList = List | null;\n","import { unref } from 'vue';\n\nimport { ValueChangedAction } from '../actions';\nimport type { FieldBase } from '../field-base';\n\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport default class CompareTo<T = any> extends Validator {\n private unregistered = false;\n\n constructor(\n private otherField: FieldBase,\n private isValidComparison: (myValue: T, otherValue: T) => boolean,\n message: RenderContentRef,\n ) {\n let listenerSet = false;\n let nVal: T;\n let oVal: T;\n\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n nVal = newValue;\n oVal = oldValue;\n if (!listenerSet) {\n listenerSet = true;\n this.otherField.registerAction(\n new ValueChangedAction((oField, supr, oNewValue, oOldValue) => {\n supr(oField, oNewValue, oOldValue);\n // somewhat hackish: we just need to execute this one validator, not anything before, not anything after...\n if (!this.unregistered) this.execute(field, () => null, nVal, oVal);\n }),\n );\n }\n if (!this.isValidComparison(unref(newValue), unref(this.otherField.value))) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(message, { newValue, oldValue, field, otherField: this.otherField }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n\n unregister() {\n this.unregistered = true;\n }\n}\n","import { truncate } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport default class InAllowedValues<T = any> extends Validator {\n constructor(allowedValues: T[], message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Must be one of [**{allowedAsText}**]');\n let allowedAsText = allowedValues.join(', ');\n if (allowedAsText.length > 60) {\n allowedAsText = truncate(allowedAsText, {\n length: 40,\n separator: ', ',\n omission: `... (${allowedValues.length} items total)`,\n });\n }\n\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (!allowedValues.includes(unref(newValue))) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, allowedValues, allowedAsText }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { isArray, isObject, isString } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nfunction toLength(a: any): number {\n if (a == null) return 0;\n if (isArray(a)) return a.length;\n if (isString(a)) return a.length;\n if (isObject(a) && Object.getPrototypeOf(a) === Object.prototype) return Object.keys(a).length;\n return String(a).length;\n}\n\nexport default class Required<T = any> extends Validator {\n constructor(message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Please enter a value');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(unref(newValue)) === 0) {\n return [new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field }))];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport class MinValue<T = any> extends Validator {\n constructor(minValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be larger or equal to **{minValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue < minValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, minValue })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class MaxValue<T = any> extends Validator {\n constructor(maxValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be less than or equal to **{maxValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue > maxValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, maxValue })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class ValueInRange<T = any> extends Validator {\n constructor(minValue: T, maxValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be between **{minValue}** and **{maxValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue < minValue || newValue > maxValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, minValue, maxValue }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { isArray, isObject, isString } from 'lodash-es';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nfunction toLength(a: any): number {\n if (a == null) return 0;\n if (isArray(a)) return a.length;\n if (isString(a)) return a.length;\n if (isObject(a) && Object.getPrototypeOf(a) === Object.prototype) return Object.keys(a).length;\n return String(a).length;\n}\n\nexport class MinLength<T = any> extends Validator {\n constructor(minLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be larger or equal to **{minLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(newValue) < minLength) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, minLength })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class MaxLength<T = any> extends Validator {\n constructor(maxLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be less than or equal to **{maxLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(newValue) > maxLength) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, maxLength })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class LengthInRange<T = any> extends Validator {\n constructor(minLength: number, maxLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be between **{minLength}** and **{maxLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n const len = toLength(newValue);\n if (len < minLength || len > maxLength) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, minLength, maxLength }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport default class Pattern<T = any> extends Validator {\n constructor(pattern: RegExp, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must match pattern \"**{pattern}**\"');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (!pattern.test(String(unref(newValue)))) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, pattern })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n"],"names":["DisplayMode","defaultDisplayMode","fromString","mode","fromAny","input","isDefined","check","FieldActionBase","executorFn","__publicField","field","supr","params","AbortEventHandlingException","ValueChangedActionClassIdentifier","ValueChangedAction","newValue","oldValue","config","getConfig","setConfig","newConfig","config_default","app","options","MdString","value","plugins","isSimpleComponentDef","msg","uMsg","unref","isCallableFunction","ValidationError","ValidationErrorText","text","classes","ValidationErrorRenderContent","computed","RenderableValue","buildErrorMessage","mdErrorString","ValidatorClassIdentifier","validationFailedMessage","Validator","validationFn","run","_a","epoch","isCurrent","errors","processErrors","err","mine","e","i","error","idx","isEqual","reason","owner","stamp","descriptors","__spreadProps","__spreadValues","replace","ret","isRef","key","ActionsMap","action","actionType","existingExecute","ex","ActionClass","identifier","execute","newActions","ConditionalStatementActionClassIdentifier","ConditionalStatementAction","statement","actionExecutor","currentResult","fld","ConditionalVisibilityAction","ConditionalEnabledAction","ConditionalValueAction","trueValue","Operator","operator","op","isLogicOperator","EnabledChangingActionClassIdentifier","EnabledChangingAction","EnabledChangedActionClassIdentifier","EnabledChangedAction","ValidChangedActionClassIdentifier","ValidChangedAction","VisibilityChangingActionClassIdentifier","VisibilityChangingAction","VisibilityChangedActionClassIdentifier","VisibilityChangedAction","FieldBase","reactive","alteredValue","isBoolean","revalidate","oldValid","actions","actionClass","XOR","value1","value2","Statement","operand1","operand2","_b","isString","fields","processOperand","ExecuteActionClassIdentifier","ExecuteAction","ListItemAddedActionClassIdentifier","ListItemAddedAction","item","index","ListItemRemovedActionClassIdentifier","ListItemRemovedAction","Field","paramValue","validators","otherParams","__objRest","outerClimb","touched","overrides","Ctor","res","EmptyField","isValEmpty","val","defaultIfTrue","Action","originalValue","orgVal","props","__props","md","resolveComponent","htmlElements","render","h","componentBindings","_createBlock","Group","name","fieldName","flds","isFieldAll","data","fieldValue","isEmpty","outerNotify","outerValidation","newFields","List","itemTemplate","currentValue","_c","_d","removedItem","position","itm","CompareTo","otherField","isValidComparison","message","listenerSet","nVal","oVal","oField","oNewValue","oOldValue","InAllowedValues","allowedValues","allowedAsText","truncate","toLength","a","isArray","isObject","Required","MinValue","minValue","MaxValue","max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src/actions/field-action-base.ts","../src/field.interface.ts","../src/actions/value-changed-action.ts","../src/transaction.ts","../src/config.ts","../src/validators/validation-error.ts","../src/validators/error-message-builder.ts","../src/validators/validator.ts","../src/actions/actions-map.ts","../src/binding/resolve.ts","../src/actions/conditional/conditional-statement-action.ts","../src/actions/conditional/operator.ts","../src/actions/enabled-actions.ts","../src/actions/valid-changed-action.ts","../src/actions/visibility-actions.ts","../src/field-base.ts","../src/actions/conditional/statement.ts","../src/actions/execute-action.ts","../src/actions/list-item-added-action.ts","../src/actions/list-item-removed-action.ts","../src/element-state.ts","../src/field.ts","../src/action.ts","../src/components/messages-widget.vue","../src/group.ts","../src/list.ts","../src/validators/validator-compare-to.ts","../src/validators/validator-in-allowed-values.ts","../src/validators/validator-required.ts","../src/validators/validator-min-max-range.ts","../src/validators/validator-min-max-range-length.ts","../src/validators/validator-pattern.ts"],"sourcesContent":["/**\n * DisplayMode enum provides an enumeration for supported ways of rendering a particular object in the DOM\n */\nenum DisplayMode {\n // This enum is actually declared in dynamicforms.mixins.field_render.py\n SUPPRESS = 1, // Field will be entirely suppressed. it will not render (not even to JSON) and will not parse for PUT\n HIDDEN = 5, // Field will render as <input type=\"hidden\"> or <tr data-field_name>\n INVISIBLE = 8, // Field will render completely, but with display: none. Equal to setting its style = {display: none}\n FULL = 10, // Field will render completely\n}\n\nexport const defaultDisplayMode = DisplayMode.FULL;\n\n// The reverse mapping of a numeric enum puts both the names and the numbers in Object.values, and both fromAny and\n// isDefined only ever test a number, so the numbers are all that has to be kept. Built once: the alternative is two\n// array allocations on every write to visibility.\nconst displayModeValues: ReadonlySet<number> = new Set(\n Object.values(DisplayMode).filter((entry): entry is number => typeof entry === 'number'),\n);\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, no-redeclare\nnamespace DisplayMode {\n export function fromString(mode: string): DisplayMode {\n if (mode.toUpperCase() === 'SUPPRESS') return DisplayMode.SUPPRESS;\n if (mode.toUpperCase() === 'HIDDEN') return DisplayMode.HIDDEN;\n if (mode.toUpperCase() === 'INVISIBLE') return DisplayMode.INVISIBLE;\n return defaultDisplayMode;\n }\n\n export function fromAny(mode: any): DisplayMode {\n const input = typeof mode === 'number' ? mode : DisplayMode.fromString(mode as string);\n if (displayModeValues.has(input)) return input;\n return defaultDisplayMode;\n }\n\n export function isDefined(mode: number | string): boolean {\n const check = typeof mode === 'number' ? mode : DisplayMode.fromString(mode as string);\n return displayModeValues.has(check);\n }\n}\n\nObject.freeze(DisplayMode);\n\nexport default DisplayMode;\n","import type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\ntype ActionExecutor = (field: FieldBase, supr: FieldActionExecute, ...params: any[]) => any;\n\nexport default abstract class FieldActionBase {\n public static get classIdentifier(): symbol {\n throw new Error('classIdentifier must be declared');\n }\n\n public get classIdentifier(): symbol {\n return (<any>this.constructor).classIdentifier;\n }\n\n private readonly executorFn: ActionExecutor;\n\n /**\n * What this action remembers about one of the elements it serves. An action instance is shared - a `List` row\n * carries the instances the item template carries - so anything an action holds about the element it last ran\n * over belongs to that element rather than to the action: a verdict, a sequence number, a listener it installed.\n * The keys are weak, so what an action remembers about a row is released with the row.\n */\n private readonly states = new WeakMap<object, any>();\n\n constructor(executorFn: ActionExecutor) {\n this.executorFn = executorFn;\n }\n\n /**\n * This action's state for `key`, created by `init` the first time it is asked for. The key is the element the\n * action is running over, or the record that element belongs to where what is remembered is a fact about the\n * whole record.\n */\n protected state<S>(key: object, init: () => S): S {\n if (!this.states.has(key)) this.states.set(key, init());\n return this.states.get(key) as S;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, ...params: any[]): any {\n return this.executorFn(field, supr, ...params);\n }\n\n get eager() {\n return false;\n }\n\n /**\n * Announces that this action now serves `binding`. It runs once per element the action is registered on, the\n * copies of that element included: a copy takes on the instances it was copied from and each is told about the\n * copy as it does.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n boundToBinding(binding: FieldBase) {}\n\n /**\n * Announces that `binding` no longer holds this action. It names one element rather than the action as a whole,\n * because the instance goes on serving every other element it was registered on.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unregisterFrom(binding: FieldBase) {}\n}\n","import type FieldActionBase from './actions/field-action-base';\nimport type DisplayMode from './display-mode';\nimport type { FieldBase } from './field-base';\nimport { type ValidationError } from './validators/validation-error';\n\nexport interface IFieldConstructorActionsList {\n actions?: FieldActionBase[];\n validators?: FieldActionBase[];\n}\n\n/**\n * Parameters accepted by field constructors and by bind overrides.\n *\n * Only writable members are listed. valid, validating, fullValue and isChanged are getter-only, so assigning\n * them throws a TypeError. So are parent and fieldName: a container writes the slots behind them when it takes\n * an element, and nobody else can, which is why the type rejects them.\n */\nexport type IFieldConstructorParams<T = any> = {\n value: T;\n originalValue: T;\n enabled: boolean;\n visibility: DisplayMode;\n touched: boolean;\n errors: ValidationError[];\n} & IFieldConstructorActionsList;\n\n/**\n * What an element's constructor accepts: the parameters the element answers for itself, together with the\n * extended properties its X parameter declares.\n *\n * X is left out of inference, so an element built without a type argument carries no extended properties and a\n * parameter object naming one is rejected as an excess property. A caller that wants them states them:\n * `new Field<string, { label: string }>({ value: 'a', label: 'Name' })`.\n *\n * The two halves are made partial separately. `Partial<A & X>` is a mapped type over an intersection, which is\n * what T is inferred through, and inference through it answers with one constituent of a union rather than the\n * union: `new Field({ value: someStringOrNumber })` would be a Field<string>.\n */\nexport type IFieldParams<T = any, X extends object = {}> = Partial<IFieldConstructorParams<T>> & Partial<NoInfer<X>>;\n\n/**\n * What bind() accepts beside the data it binds: everything a constructor takes except the value, which the data\n * argument states. Of the members named here, bind() reads `originalValue`, `enabled` and `visibility`;\n * `validators` and `actions` state what to register and are carried by the binding from its declaration, and the\n * rest are the element's to establish.\n */\nexport type IBindParams<T = any, X extends object = {}> = Partial<Omit<IFieldConstructorParams<T>, 'value'>> &\n Partial<NoInfer<X>>;\n\nexport class AbortEventHandlingException extends Error {}\n\nexport type FieldActionExecute<T = any> = (field: FieldBase<T>, ...params: any[]) => any;\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nexport const ValueChangedActionClassIdentifier = Symbol('ValueChangedAction');\n\nexport class ValueChangedAction<T = any> extends FieldActionBase {\n constructor(executorFn: (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ValueChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import type FieldActionBase from './actions/field-action-base';\nimport type { FieldBase } from './field-base';\n\n/**\n * A transaction is the unit an observer sees a change in. Every mutating operation runs inside one: where the\n * caller opens none, the operation is the transaction, so a single write is atomic without anything having to be\n * remembered at the call site.\n *\n * Writes land in the element straight away and only the announcement waits. At commit the net transitions are\n * measured against the state the elements last announced and each is announced once, so a value that goes A -> B\n * -> A within one transaction says nothing. Validators run while the transaction is open, because the verdict\n * they reach is what the commit announces; every other action fires at commit.\n *\n * A transaction may not cross an await: transaction() throws when the callback returns a thenable. Two\n * overlapping transactions therefore cannot exist, and an asynchronous validator settling later opens one of its\n * own at that moment.\n */\n\n/** the slots of one element as they stood when the transaction first modified it */\nexport type TxSnapshot = Record<string, any>;\n\n/** a ListItemAddedAction or ListItemRemovedAction waiting for the commit that will emit it */\nexport interface TxStructuralEvent {\n actionClass: (abstract new (...args: any[]) => FieldActionBase) & { classIdentifier: symbol };\n item: any;\n index: number;\n}\n\n/**\n * The protocol a transaction drives its participants through. The four members are symbol-keyed so that they\n * carry no name a consumer could reach or collide with, and they live on the prototype, so no walker over an\n * element's own keys sees them either.\n */\nexport const TxCapture = Symbol('Transaction.capture');\nexport const TxRestore = Symbol('Transaction.restore');\nexport const TxAnnounceValue = Symbol('Transaction.announceValue');\nexport const TxSettleValidity = Symbol('Transaction.settleValidity');\n\ninterface TxParticipantElement {\n readonly parent: FieldBase | undefined;\n [TxCapture](): TxSnapshot;\n [TxRestore](snapshot: TxSnapshot): void;\n [TxAnnounceValue](tx: Transaction, dirty: boolean, force: boolean, structural?: TxStructuralEvent[]): void;\n [TxSettleValidity](tx: Transaction): void;\n}\n\n/** FieldBase declares the four members above as protected, which is what keeps them off the documented surface */\nfunction hooks(element: FieldBase): TxParticipantElement {\n return element as unknown as TxParticipantElement;\n}\n\ninterface Participant {\n element: FieldBase;\n /** the element's state as the transaction found it, taken the first time the transaction modified the element */\n snapshot?: TxSnapshot;\n /** the commit has to work out whether this element's value changed and announce it where it did */\n valueDirty: boolean;\n /** the caller already knows the value changed, so the commit announces it without comparing */\n forceValue: boolean;\n /** the commit has to re-form this element's verdict and announce a transition of it */\n validityDirty: boolean;\n structural?: TxStructuralEvent[];\n}\n\n/** how many containers stand above an element; the commit announces the deepest first */\nfunction depthOf(element: FieldBase): number {\n let depth = 0;\n let ancestor = element.parent;\n while (ancestor) {\n depth++;\n ancestor = ancestor.parent;\n }\n return depth;\n}\n\nexport class Transaction {\n private readonly participants = new Map<FieldBase, Participant>();\n\n /** work that stands only where the transaction commits; a rollback simply never does it */\n private readonly deferred: (() => void)[] = [];\n\n /** what a rollback has to put back beyond the state slots, newest last */\n private readonly undo: (() => void)[] = [];\n\n /** true once the transaction has been unwound, which is what tells a run started inside it to say nothing */\n private unwound = false;\n\n /** the depth the announcement in progress is working at, -1 while none is */\n private passDepth = -1;\n\n /** set while a pass is running and an element it has already passed the depth of gets enrolled */\n private restartPass = false;\n\n /** true for a transaction that was rolled back rather than committed */\n get rolledBack(): boolean {\n return this.unwound;\n }\n\n private participant(element: FieldBase): Participant {\n let entry = this.participants.get(element);\n if (!entry) {\n entry = { element, valueDirty: false, forceValue: false, validityDirty: false };\n this.participants.set(element, entry);\n }\n return entry;\n }\n\n /**\n * Records the state of an element the first time the transaction modifies it. The whole of the mutable state\n * goes into the snapshot rather than the part being written: a rollback that restored some of it would leave\n * the element in a state the form never held.\n */\n touch(element: FieldBase): void {\n const entry = this.participant(element);\n if (!entry.snapshot) entry.snapshot = hooks(element)[TxCapture]();\n }\n\n /** Enrols an element as one whose value the commit has to announce. `force` skips the comparison. */\n markValueChanged(element: FieldBase, force: boolean): void {\n const entry = this.participant(element);\n entry.valueDirty = true;\n if (force) entry.forceValue = true;\n this.noteDepth(element);\n }\n\n /** Enrols an element as one whose verdict the commit has to re-form. */\n markValidityDirty(element: FieldBase): void {\n this.participant(element).validityDirty = true;\n this.noteDepth(element);\n }\n\n /**\n * Queues an event that states an operation rather than a state. Added and removed items have no net over a\n * transaction, so they are neither compared nor coalesced: the commit emits them in the order they happened.\n */\n recordStructural(element: FieldBase, event: TxStructuralEvent): void {\n const entry = this.participant(element);\n (entry.structural ??= []).push(event);\n this.noteDepth(element);\n }\n\n /** True where the commit still owes this element a value announcement. */\n willAnnounceValue(element: FieldBase): boolean {\n return this.participants.get(element)?.valueDirty ?? false;\n }\n\n /**\n * Registers work the commit does once everything has been announced. It is for what a rollback could not take\n * back: releasing a listener, dropping a registration. Held until the commit, it is simply never done where the\n * transaction unwinds instead.\n */\n whenCommitted(work: () => void): void {\n this.deferred.push(work);\n }\n\n /**\n * Registers what a rollback has to put back beyond the element's state slots. The snapshot covers the slots,\n * which is everything an ordinary write touches; an operation that replaces something else the element carries\n * hands its own undo in here rather than making every snapshot carry the thing.\n */\n whenRolledBack(work: () => void): void {\n this.undo.push(work);\n }\n\n /**\n * Notes that an element at or below the depth the pass in progress is working at has been enrolled. The pass\n * then gives up the rest of its batch and is started again over what is now owed, so the newcomer is reached\n * before the containers above it: an element a handler writes must still be announced before the container\n * whose composed value carries that write. The depth is only measured while a pass is running - outside one\n * there is nothing the answer would change.\n */\n private noteDepth(element: FieldBase): void {\n if (this.passDepth < 0) return;\n if (depthOf(element) >= this.passDepth) this.restartPass = true;\n }\n\n /**\n * Puts every element the transaction modified back as it found it. Nothing is announced: from an observer's\n * point of view the transaction never happened. What a rollback cannot take back are side effects - a handler\n * that called a server during the transaction already did.\n */\n rollback(): void {\n this.unwound = true;\n const entries = [...this.participants.values()].reverse();\n entries.forEach((entry) => {\n if (entry.snapshot) hooks(entry.element)[TxRestore](entry.snapshot);\n });\n this.participants.clear();\n // newest first, so an element written twice ends up as the earlier of the two writes found it\n for (let index = this.undo.length - 1; index >= 0; index--) this.undo[index]();\n this.undo.length = 0;\n this.deferred.length = 0;\n }\n\n /**\n * Announces what the transaction did. Values first and verdicts after, because a container's validators run\n * with its value announcement and the verdict they reach is what the validity pass then reports. Both passes\n * run deepest first - field, then row, then list - which is the order the change travelled in.\n *\n * A handler may write while the commit runs; its writes join this transaction, so both passes repeat until\n * nothing is left dirty.\n */\n commit(): void {\n for (;;) {\n if (this.announceValues()) continue;\n if (this.settleValidity()) continue;\n break;\n }\n const work = this.deferred.splice(0);\n work.forEach((fn) => fn());\n }\n\n /**\n * The dirty participants a pass has to visit, one bucket per nesting depth; ties keep the order they were\n * enrolled in. A nesting depth is a small integer, so the elements go into buckets rather than through a\n * comparison sort: a whole-list assignment enrols one participant per field, and ordering those by comparison\n * would cost more than the announcement it orders.\n */\n private buckets(pick: (entry: Participant) => boolean): (Participant[] | undefined)[] {\n const buckets: (Participant[] | undefined)[] = [];\n this.participants.forEach((entry) => {\n if (!pick(entry)) return;\n const depth = depthOf(entry.element);\n (buckets[depth] ??= []).push(entry);\n });\n return buckets;\n }\n\n /**\n * Runs one pass over the dirty participants, deepest bucket first; the caller repeats it until it answers\n * false. The buckets are taken once, and the pass gives up as soon as a handler enrols an element at or below\n * the depth being drained: that element is not in the bucket being walked, and going on would reach the\n * containers above it first. The caller's next pass takes fresh buckets and finds it at its own depth.\n */\n private pass(pick: (entry: Participant) => boolean, visit: (entry: Participant) => void): boolean {\n const buckets = this.buckets(pick);\n if (!buckets.length) return false;\n for (let depth = buckets.length - 1; depth >= 0; depth--) {\n const bucket = buckets[depth];\n if (!bucket) continue;\n this.passDepth = depth;\n this.restartPass = false;\n try {\n for (let index = 0; index < bucket.length; index++) {\n if (this.restartPass) return true;\n const entry = bucket[index];\n // a handler that ran earlier in this pass may have taken the entry off the list of what is owed\n if (pick(entry)) visit(entry);\n }\n } finally {\n this.passDepth = -1;\n }\n if (this.restartPass) return true;\n }\n return true;\n }\n\n private announceValues(): boolean {\n return this.pass(\n (entry) => entry.valueDirty || entry.structural !== undefined,\n (entry) => {\n const { structural } = entry;\n const dirty = entry.valueDirty;\n const force = entry.forceValue;\n entry.structural = undefined;\n entry.valueDirty = false;\n entry.forceValue = false;\n hooks(entry.element)[TxAnnounceValue](this, dirty, force, structural);\n },\n );\n }\n\n private settleValidity(): boolean {\n return this.pass(\n (entry) => entry.validityDirty,\n (entry) => {\n entry.validityDirty = false;\n hooks(entry.element)[TxSettleValidity](this);\n },\n );\n }\n}\n\n/** the transaction every mutating operation currently joins, absent while none is open */\nlet current: Transaction | undefined;\n\n/** the handle of the open transaction, which a nested call joining it receives too */\nlet currentHandle: TransactionHandle | undefined;\n\n/** The open transaction, for the bookkeeping an element does only where one is running. */\nexport function currentTransaction(): Transaction | undefined {\n return current;\n}\n\n/**\n * Unwinds the transaction from wherever it is called. It is a signal rather than an error: transaction()\n * catches it, rolls back and returns undefined, and nothing is reported as a failure.\n */\nclass RollbackSignal {}\n\nexport interface TransactionControl {\n /**\n * Undoes everything the transaction has done and ends it, announcing nothing. It unwinds from the point of\n * the call, so nothing after it runs. There are no savepoints: a nested call rolls back the whole transaction\n * it joined, not its own part of it.\n *\n * @throws TypeError where the transaction the handle belongs to has already closed.\n */\n rollback(): never;\n}\n\n/**\n * The handle one transaction hands the callbacks that take part in it. It is spent the moment the transaction\n * closes: a handle kept beyond that call names a transaction that no longer exists, and letting it unwind\n * whatever transaction happened to be open instead would roll back an unrelated operation.\n */\nclass TransactionHandle implements TransactionControl {\n private open = true;\n\n rollback(): never {\n if (!this.open) {\n throw new TypeError(\n 'this transaction handle is spent: the transaction that handed it out has closed. A handle is only ' +\n 'usable inside the call that received it.',\n );\n }\n throw new RollbackSignal();\n }\n\n close(): void {\n this.open = false;\n }\n}\n\nfunction rejectThenable(result: unknown): void {\n if (result != null && typeof (result as PromiseLike<unknown>).then === 'function') {\n throw new TypeError(\n 'a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open ' +\n 'a transaction for each synchronous part.',\n );\n }\n}\n\n/**\n * Runs `fn` as one atomic change. The writes it makes land in the elements as they are made and the events they\n * produce are announced once, at the end, over the net result.\n *\n * A call made while a transaction is already open joins it: nothing is committed until the outermost call\n * returns. A throw out of `fn` rolls the whole transaction back and rethrows, and `tx.rollback()` rolls it back\n * without an error, in which case the call answers undefined.\n *\n * The handle `fn` receives is usable only for the duration of that call; calling it afterwards throws a TypeError.\n *\n * @throws TypeError immediately if `fn` returns a thenable - a transaction cannot cross an await.\n */\nexport function transaction<R>(fn: (tx: TransactionControl) => R): R | undefined {\n if (current) {\n const joined = fn(currentHandle!);\n rejectThenable(joined);\n return joined;\n }\n\n const tx = new Transaction();\n const handle = new TransactionHandle();\n current = tx;\n currentHandle = handle;\n try {\n const result = fn(handle);\n rejectThenable(result);\n tx.commit();\n return result;\n } catch (error) {\n // the commit may have announced part of the change before the throw; the state goes back all the same, and\n // what a handler did with the events it already received is a side effect no snapshot reaches\n tx.rollback();\n if (error instanceof RollbackSignal) return undefined;\n throw error;\n } finally {\n current = undefined;\n currentHandle = undefined;\n handle.close();\n }\n}\n\n/**\n * Runs a mutating operation inside the open transaction, opening one for the operation where none is. It is how\n * an element reaches the transaction it takes part in: everything the library mutates goes through here.\n */\nexport function transactional<R>(fn: (tx: Transaction) => R): R {\n if (current) return fn(current);\n return transaction(() => fn(current!)) as R;\n}\n","// Global configuration for @dynamicforms/vue-forms\nexport interface FormsConfig {\n useMarkdownInValidators: boolean;\n}\n\n// Default configuration\nconst config: FormsConfig = { useMarkdownInValidators: true };\n\n// Function to access config\nexport function getConfig(): FormsConfig {\n return config;\n}\n\n// Function to update config\nexport function setConfig(newConfig: Partial<FormsConfig>): void {\n Object.assign(config, newConfig);\n}\n\n// Vue plugin installation\nexport default {\n install(app: any, options?: Partial<FormsConfig>) {\n if (options) {\n setConfig(options);\n }\n },\n};\n","import { computed, ComputedRef, Ref, unref } from 'vue';\n\n/**\n * Marks content for markdown rendering\n */\nexport class MdString extends String {\n plugins?: any[];\n options?: any;\n\n constructor(value: string, options?: any, plugins?: any[]) {\n super(value);\n this.plugins = plugins;\n this.options = options;\n }\n}\n\n/**\n * Interface for custom component content definition\n */\nexport interface SimpleComponentDef {\n componentName: string;\n componentProps?: Record<any, any>;\n componentVHtml?: string;\n}\n\nexport type ClassType = string | string[] | Record<string, boolean>;\nexport type ClassTypes = ClassType | ClassType[];\n\nexport type RenderContentNonCallable = string | MdString | SimpleComponentDef;\nexport type RenderContentCallable = () => RenderContentNonCallable;\n/**\n * Type for different renderable content formats: plain string, markdown, or custom component\n */\nexport type RenderContent = RenderContentNonCallable | RenderContentCallable;\n/**\n * Type for different renderable content formats (supporting references): plain string, markdown, or custom component\n */\nexport type RenderContentRef = RenderContent | Ref<RenderContent>;\n\n/**\n * Type guard to check if content is a custom component definition\n * @param msg - Content to check\n * @returns True if content is a custom component definition\n */\nexport function isSimpleComponentDef(msg?: RenderContentRef): msg is SimpleComponentDef {\n const uMsg = unref(msg);\n return typeof uMsg === 'object' && 'componentName' in uMsg;\n}\n\nexport function isCallableFunction(msg?: RenderContentRef): msg is RenderContentCallable {\n return typeof unref(msg) === 'function';\n}\n\n/**\n * Base validation error class with component rendering capabilities\n */\n\nexport class ValidationError {\n get componentName() {\n return 'Comment';\n }\n\n get componentBindings() {\n return {};\n }\n\n get componentBody() {\n return '';\n }\n\n get extraClasses(): ClassTypes {\n return '';\n }\n}\n\n/**\n * Simple text-only ValidationError\n */\nexport class ValidationErrorText extends ValidationError {\n constructor(\n public text: string,\n public classes: ClassTypes = '',\n ) {\n super();\n }\n\n get componentName() {\n return 'template';\n }\n\n get componentBody() {\n return this.text;\n }\n\n get extraClasses() {\n return this.classes;\n }\n}\n\n/**\n * Validation error that supports multiple content types (plain text, markdown, component)\n */\nexport class ValidationErrorRenderContent extends ValidationError {\n private text: RenderContent | Ref<RenderContent>;\n\n private textType: ComputedRef<'string' | 'md' | 'component'>;\n\n constructor(\n text: RenderContentRef,\n public classes: ClassTypes = '',\n ) {\n super();\n this.text = text;\n this.textType = computed(() => this.getTextType);\n }\n\n get resolvedText() {\n const text = unref(this.text);\n return isCallableFunction(text) ? text() : text;\n }\n\n get getTextType() {\n const msg = this.resolvedText;\n\n if (!msg) return 'string';\n if (msg instanceof MdString) return 'md';\n if (isSimpleComponentDef(msg)) return 'component';\n return 'string';\n }\n\n get componentName() {\n switch (unref(this.textType)) {\n case 'string':\n return 'template';\n case 'md':\n return 'vue-markdown';\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentName;\n default:\n return 'template';\n }\n }\n\n get componentBindings() {\n switch (unref(this.textType)) {\n case 'string':\n return {};\n case 'md': {\n const text = this.resolvedText as MdString;\n return { source: text.toString(), options: text.options, plugins: text.plugins };\n }\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentProps || {};\n default:\n return {};\n }\n }\n\n get componentBody() {\n switch (unref(this.textType)) {\n case 'string':\n return this.resolvedText as string;\n case 'component':\n return (this.resolvedText as SimpleComponentDef).componentVHtml || '';\n default:\n return '';\n }\n }\n\n get extraClasses() {\n return this.classes;\n }\n}\n\n/**\n * A value, renderable three different ways (plain text, markdown, component) - alias for ValidationErrorRenderContent\n */\nexport class RenderableValue extends ValidationErrorRenderContent {}\n\n/** ********************************************************************************************************************\n *\n at some point there will be classes here that will support links or action buttons or something even more complex\n *\n ******************************************************************************************************************** */\n","import { getConfig } from '../config';\n\nimport { MdString } from './validation-error';\n\n/**\n * Depending on the useMarkdownInValidators setting, return either markdown or a plain string error message\n * @param mdErrorString markdown source to optionally be stripped\n * @return MdString or string\n */\n\nexport function buildErrorMessage(mdErrorString: string): string | MdString {\n const useMarkdownInValidators = getConfig().useMarkdownInValidators;\n if (useMarkdownInValidators) return new MdString(mdErrorString);\n\n return mdErrorString\n .replace(/[*_~`]/g, '') // remove basic markdown (italic, bold, strike, code)\n .replace(/!\\[(.*?)\\]\\(.*?\\)/g, '$1') // remove images, keep alt only\n .replace(/\\[(.*?)\\]\\((.*?)\\)/g, '$1') // remove links, keep name only\n .replace(/#+\\s?/g, '') // Remove heading markers (#, ##, ###)\n .replace(/>\\s?/g, '') // remove quotes\n .replace(/(\\*|-|\\d+\\.)\\s+/g, '') // remove lists (bullet points and numbered lists)\n .replace(/`{3}[\\s\\S]*?`{3}/g, '') // remove code blocks\n .replace(/`([^`]+)`/g, '$1') // remove inline code markers\n .replace(/\\n{2,}/g, '\\n'); // removes excessive empty lines\n}\n","import { isEqual } from 'lodash-es';\nimport { isRef, unref } from 'vue';\n\nimport { ValueChangedAction } from '../actions/value-changed-action';\nimport { type FieldBase } from '../field-base';\nimport { FieldActionExecute } from '../field.interface';\nimport { currentTransaction, transaction } from '../transaction';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport {\n isCallableFunction,\n isSimpleComponentDef,\n MdString,\n RenderContentNonCallable,\n RenderContentRef,\n ValidationError,\n ValidationErrorRenderContent,\n} from './validation-error';\n\nexport type ValidationFunctionResult = ValidationError[] | null;\nexport type ValidationFunction<T = any> = (\n newValue: T,\n oldValue: T,\n field: FieldBase<T>,\n) => ValidationFunctionResult | Promise<ValidationFunctionResult>;\n\ninterface SourceProp {\n source: symbol;\n}\n\n/** What a validator remembers about one field it is registered on; a subclass widens it. */\nexport interface ValidatorBindingState {\n run: number;\n}\n\nconst ValidatorClassIdentifier = Symbol('Validator');\n\n/**\n * Message shown when a validation run rejects. It is built per rejection because the markdown setting it reads is\n * a runtime configuration value.\n */\nconst validationFailedMessage = (): RenderContentRef => buildErrorMessage('Validation could not be completed');\n\n/**\n * Validator is a specialized action that performs validation when a field's value changes.\n * It automatically adds/removes validation errors from the field's errors array.\n */\nexport class Validator<T = any> extends ValueChangedAction {\n private readonly source: symbol;\n\n /**\n * Creates a new validator\n * @param validationFn Function that validates the field value and returns errors or null\n */\n constructor(validationFn: ValidationFunction<T>) {\n const executor = (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => {\n const runs = this.bindingState(field);\n const run = ++runs.run;\n const epoch = field.validationEpoch;\n // the transaction this run started in, so that a run reaching its verdict after that transaction was\n // unwound says nothing: the value it examined is one the form never went on to hold\n const startedIn = currentTransaction();\n // a result counts only while nothing newer has been decided for this field, the field still holds the\n // validators it held when the run started, and the change that prompted it still stands\n const isCurrent = () => runs.run === run && field.validationEpoch === epoch && !startedIn?.rolledBack;\n\n const errors = validationFn(newValue, oldValue, field) || [];\n\n // the swap of this validator's errors and the verdict that follows from it are one change: a run that\n // settles after the operation that started it opens a transaction of its own here, and one that settles\n // during it joins the transaction already open\n const processErrors = (err: ValidationFunctionResult) =>\n transaction(() => {\n const mine = err?.map((e) => this.claim(e)) ?? [];\n for (let i = field.errors.length - 1; i >= 0; i--) {\n const error = field.errors[i] as ValidationError & SourceProp;\n if (error.source === this.source) {\n const idx = mine.findIndex((e) => isEqual(e, error));\n if (idx >= 0) mine.splice(idx, 1);\n else field.errors.splice(i, 1);\n }\n }\n\n if (mine.length > 0) field.errors.push(...mine);\n field.validate(); // Update the field's valid state\n });\n\n if (errors instanceof Promise) {\n field.beginValidating();\n errors\n .then(\n (err) => {\n if (isCurrent()) processErrors(err);\n },\n (reason) => {\n // a rejection reaches no verdict, and no verdict may not read as a pass: this validator's errors are\n // replaced by the single failure error, so the field is invalid while the value is unchecked and the\n // form cannot be submitted on it. The error carries this validator's own source stamp, so the next\n // successful run of the same validator withdraws it like any other error of its own. The reason never\n // reaches the user, whose message says only that the check did not complete, so it is logged.\n if (isCurrent()) {\n processErrors([new ValidationErrorRenderContent(validationFailedMessage())]);\n console.error('Validation failed', reason);\n }\n },\n )\n .finally(() => field.endValidating())\n // applying a verdict fires ValidChangedAction, so a handler that throws would leave this chain\n // rejected with nowhere to report it\n .catch((error) => console.error('Validation failed', error));\n } else processErrors(errors);\n return supr(field, newValue, oldValue); // Continue the action chain\n };\n\n super(executor);\n\n // Create a unique symbol for this validator instance\n this.source = Symbol(this.constructor.name);\n }\n\n /**\n * Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no\n * ownership stamp or already carries this validator's, a copy of it when it belongs to another validator. The\n * stamp is not configurable, so an instance one validator owns can never be reassigned to another; the copy is\n * what makes an error instance shareable between validators, and it keeps the prototype and every own property,\n * including the non-enumerable ones, so it renders exactly like the instance it was made from.\n */\n private claim(error: ValidationError): ValidationError {\n const owner = (error as ValidationError & Partial<SourceProp>).source;\n if (owner === this.source) return error;\n\n const stamp: PropertyDescriptor = { value: this.source, enumerable: false, configurable: false };\n if (owner === undefined) {\n Object.defineProperty(error, 'source', stamp);\n return error;\n }\n const descriptors = Object.getOwnPropertyDescriptors(error) as Record<string, PropertyDescriptor>;\n return Object.create(Object.getPrototypeOf(error), { ...descriptors, source: stamp });\n }\n\n static get classIdentifier() {\n return ValidatorClassIdentifier;\n }\n\n get eager() {\n return true;\n }\n\n /**\n * What this validator remembers about one of the fields it validates. One instance may be registered on several\n * fields - every row of a list carries the instances the item template carries - so each field has a record of\n * its own. A subclass that remembers more widens the record by overriding `newBindingState`.\n */\n protected bindingState(field: FieldBase<any>): ValidatorBindingState {\n return this.state(field, () => this.newBindingState());\n }\n\n /**\n * The record a field starts with. `run` is the sequence number of the newest run over that field: every\n * execution takes the next one and a result is applied only while its number is still the newest, so a slow run\n * cannot overwrite the verdict of a faster one that started after it.\n */\n protected newBindingState(): ValidatorBindingState {\n return { run: 0 };\n }\n\n protected replacePlaceholdersFunction(text: RenderContentRef, replace: Record<string, any>): RenderContentRef {\n return () => {\n let ret = unref(text);\n while (isCallableFunction(ret)) {\n ret = unref(this.replacePlaceholders(ret(), replace));\n }\n return ret;\n };\n }\n\n protected replacePlaceholders(text: RenderContentRef, replace: Record<string, any>): RenderContentRef {\n if (isCallableFunction(text)) return this.replacePlaceholdersFunction(text, replace);\n\n if (isSimpleComponentDef(text)) return text;\n // a Ref is resolved on read, not here: substituting once would freeze the message at the value the reference\n // held during validation, and a translated message would stay in the language that was active back then\n if (isRef(text)) {\n return this.replacePlaceholdersFunction(() => unref(text) as RenderContentNonCallable, replace);\n }\n let ret = unref(text) as string | MdString;\n Object.keys(replace).forEach((key) => {\n ret = ret.replaceAll(`{${key}}`, replace[key]);\n });\n return text instanceof MdString ? new MdString(ret.toString(), text.options, text.plugins) : ret;\n }\n}\n","import { type FieldBase } from '../field-base';\nimport { type FieldActionExecute, AbortEventHandlingException } from '../field.interface';\nimport { Validator } from '../validators/validator';\n\nimport FieldActionBase from './field-action-base';\nimport { ValueChangedActionClassIdentifier } from './value-changed-action';\n\nexport default class ActionsMap extends Map<symbol, FieldActionExecute> {\n private readonly eagerActions = new Set<symbol>();\n\n private readonly registeredActions: FieldActionBase[] = [];\n\n register(action: FieldActionBase) {\n if (!(action instanceof FieldActionBase)) throw new Error('Invalid action type');\n this.registeredActions.push(action);\n\n const actionType = action.classIdentifier;\n const existingExecute = this.get(actionType) || (() => null);\n\n function ex(field: FieldBase, ...params: any[]) {\n return action.execute(field, existingExecute, ...params);\n }\n this.set(actionType, ex);\n if (action.eager) this.eagerActions.add(action.classIdentifier);\n }\n\n /**\n * True when triggering this action would run something: a handler registered under the identifier, or - on the\n * value change identifier, which trigger() answers with an eager pass as well - any eager action at all. A\n * caller that has to build the parameters before it can trigger asks this first and skips building them when\n * there is nothing to receive them.\n */\n willTrigger(identifier: symbol): boolean {\n if (this.has(identifier)) return true;\n return identifier === ValueChangedActionClassIdentifier && this.eagerActions.size > 0;\n }\n\n trigger<T extends FieldActionBase>(\n ActionClass: (abstract new (...args: any[]) => T) & { classIdentifier: symbol },\n field: FieldBase,\n ...params: any[]\n ): any {\n const identifier = ActionClass.classIdentifier;\n if (identifier === ValueChangedActionClassIdentifier) this.triggerEager(field, ...params);\n return this.triggerChain(identifier, field, ...params);\n }\n\n /**\n * Runs the chain registered under one identifier and nothing else. A caller that has already run the eager\n * pass - a transaction runs it at the write, so that the validators have decided before it commits - reaches\n * the handlers through here, so the eager actions are not run a second time at the announcement.\n */\n triggerChain(identifier: symbol, field: FieldBase, ...params: any[]): any {\n const execute = this.get(identifier);\n try {\n if (execute) return execute(field, ...params);\n } catch (error) {\n if (!(error instanceof AbortEventHandlingException)) throw error;\n }\n return null;\n }\n\n triggerEager(field: FieldBase, ...params: any[]): any {\n for (const identifier of this.eagerActions) {\n const execute = this.get(identifier);\n try {\n if (execute) execute(field, ...params);\n } catch (error) {\n if (!(error instanceof AbortEventHandlingException)) throw error;\n }\n }\n }\n\n /** the validators registered in this map, in registration order */\n get validators(): Validator[] {\n return this.registeredActions.filter((action): action is Validator => action instanceof Validator);\n }\n\n clone(): ActionsMap {\n const newActions = new ActionsMap();\n this.registeredActions.forEach((action) => newActions.register(action));\n return newActions;\n }\n\n /**\n * Tells every action in this map that it serves `owner`. A copied map holds the instances the original holds, so\n * the element that took the copy on is announced to them here, the way registering an action announces the\n * element it was registered on.\n */\n bindTo(owner: FieldBase): void {\n this.registeredActions.forEach((action) => action.boundToBinding(owner));\n }\n\n /**\n * A copy of this map carrying everything but the validators. It only leaves them out: releasing what a\n * validator installed elsewhere is the caller's to do, and only once the transaction that dropped them has\n * committed, because a rollback puts this map back with its validators in it.\n */\n cloneWithoutValidators(): ActionsMap {\n const newActions = new ActionsMap();\n this.registeredActions.forEach((action) => {\n if (!(action instanceof Validator)) newActions.register(action);\n });\n return newActions;\n }\n}\n","import type { FieldBase } from '../field-base';\nimport type { Group } from '../group';\n\n/**\n * Resolution of one element against another element's record.\n *\n * An action instance is shared: every row a `List` builds from an item template carries the instances the template\n * carries, and what differs per row is the data. An action that reads a second element - a statement comparing two\n * fields, a validator comparing a password with its confirmation - therefore has to be told which second element it\n * means for the row it is running over, and the structure is what tells it: the element the action was declared\n * against, and the record it is running in, name it between them.\n */\n\n/**\n * The record an element belongs to: the `List` row that holds it, or the top of its container chain where no row\n * does. A container holds a row without a name and a `Group` names every member, so the element whose container\n * gave it no name is where a record begins.\n */\nexport function scopeOf(element: FieldBase): FieldBase {\n let current = element;\n while (current.fieldName !== undefined && current.parent) current = current.parent;\n return current;\n}\n\n/** The names leading from an element's record down to the element itself. */\nfunction pathOf(element: FieldBase): string[] {\n const path: string[] = [];\n let current = element;\n while (current.fieldName !== undefined && current.parent) {\n path.unshift(current.fieldName);\n current = current.parent;\n }\n return path;\n}\n\n/**\n * The element `declaration` stands for within `scope`. It is the member `scope` holds at the same position, where\n * that member was declared as `declaration`; `declaration` itself, where it belongs to a record other than\n * `scope`'s and is therefore the one element every record reads - a form field above a list, or a field of another\n * row named on purpose; and `undefined`, where `scope` is a record of the same kind that has yet to be built,\n * which says that the question has to be asked again once it is.\n */\nexport function resolveInScope(declaration: FieldBase, scope: FieldBase): FieldBase | undefined {\n let resolved: FieldBase | undefined = scope;\n for (const name of pathOf(declaration)) {\n resolved = (resolved as Group).field?.(name) ?? undefined;\n if (!resolved) break;\n }\n if (resolved?.declaration === declaration) return resolved;\n // the record holds no member declared as this element. Either it belongs elsewhere and is read where it stands,\n // or the record is one of the same family and is still being assembled\n return scopeOf(declaration) === scopeOf(scope.declaration) ? undefined : declaration;\n}\n\n/**\n * Every element `declaration` stands for when something changes in `scope`. It is the one member of that record\n * where the record holds one; where the element belongs to a record above - a form field the rows of a list read -\n * it is each of its bindings inside `scope`, because a change there speaks for every one of them; and where\n * `scope` reaches no binding at all, it is the element itself, which is the answer for a form that has no records\n * below it.\n * A record still being assembled reaches none of these and answers with nothing, so the assignment that finishes\n * it asks again.\n */\nexport function bindingsIn(declaration: FieldBase, scope: FieldBase): FieldBase[] {\n const resolved = resolveInScope(declaration, scope);\n if (!resolved) return [];\n if (resolved !== declaration) return [resolved];\n const found = scope.bindingsOf(declaration);\n return found.length > 0 ? found : [declaration];\n}\n\n/**\n * The element named `name` in the nearest container above `element` that holds one, and `undefined` where no\n * container does. A row is searched before the form the list sits in, so a rule written against a name reads the\n * row it is running over.\n */\nexport function resolveByName(name: string, element: FieldBase): FieldBase | undefined {\n let container = element.parent;\n while (container) {\n const member = (container as Group).field?.(name);\n if (member) return member;\n container = container.parent;\n }\n return undefined;\n}\n","import { bindingsIn, scopeOf } from '../../binding/resolve';\nimport DisplayMode from '../../display-mode';\nimport { type FieldBase } from '../../field-base';\nimport { FieldActionExecute } from '../../field.interface';\nimport { ValueChangedAction } from '../value-changed-action';\n\nimport { Statement } from './statement';\n\nconst ConditionalStatementActionClassIdentifier = Symbol('ConditionalStatementAction');\n\ntype ConditionalExecutorFn = (field: FieldBase, currentResult: boolean, previousResult: boolean | undefined) => void;\n\n/** What the action remembers about one record: the result the record's fields last produced. */\ninterface ConditionalRecordState {\n lastResult: boolean | undefined;\n}\n\nexport class ConditionalStatementAction extends ValueChangedAction {\n private readonly statement: Statement;\n\n private readonly conditionalExecutor: ConditionalExecutorFn;\n\n /**\n * What the elements this action was registered on were declared as. It holds declarations rather than the\n * elements themselves, so one entry stands for every row of a list, and the element a result is applied to is\n * the one that declaration names within the record the change happened in.\n */\n private readonly declarations = new Set<FieldBase>();\n\n /**\n * The elements this action was registered on. Registration reaches one element at a time - the rows of a list\n * take the action on one by one, as they are built from the item template that carries it - so this is what\n * says which of the elements a declaration stands for the action actually drives.\n */\n private readonly registrations = new WeakSet<FieldBase>();\n\n constructor(statement: Statement, executorFn: ConditionalExecutorFn) {\n // the element the action fires for names the record: an eager pass over one row's field re-evaluates that\n // row's fields and reaches that row's targets. A pass that reaches none of them is running over an element\n // whose record is still being built, and the container that finishes it runs the pass again\n super((field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => {\n if (!this.applyIn(scopeOf(field))) field.markRecordIncomplete();\n return supr(field, newValue, oldValue);\n });\n\n this.statement = statement;\n this.conditionalExecutor = executorFn;\n\n // one listener per field the statement reads, however many records that field ends up having: the listener\n // receives the field that changed, which is what says which record to re-evaluate. Registering per record\n // instead would grow the field's handler chain by one link for every row a list holds.\n const relay = new ValueChangedAction((source: FieldBase, supr: FieldActionExecute, ...params: any[]) => {\n this.applyFrom(source);\n return supr(source, ...params);\n });\n statement.collectFields().forEach((field) => field.registerAction(relay));\n }\n\n static get classIdentifier() {\n return ConditionalStatementActionClassIdentifier;\n }\n\n get eager() {\n return true;\n }\n\n boundToBinding(binding: FieldBase) {\n this.declarations.add(binding.declaration);\n this.registrations.add(binding);\n }\n\n /**\n * The elements of `scope` this action controls: what each declaration it serves names within that record, and of\n * those the ones that took the action on. A row of a list that never took it on is not one this action drives.\n */\n private targetsIn(scope: FieldBase): FieldBase[] {\n const targets: FieldBase[] = [];\n this.declarations.forEach((declaration) =>\n bindingsIn(declaration, scope).forEach((target) => {\n if (this.registrations.has(target)) targets.push(target);\n }),\n );\n return targets;\n }\n\n /**\n * Re-evaluates the statement over one record and applies the result where it changed. The result is recorded\n * before the executor runs, because an executor that writes a value re-enters through that value's eager pass\n * and what it has to find there is the result being applied. It answers whether the record held anything for\n * this action to drive, which is how a caller learns that the record is not assembled yet.\n */\n private applyIn(scope: FieldBase): boolean {\n const targets = this.targetsIn(scope);\n if (targets.length === 0) return false;\n const state = this.state(scope, (): ConditionalRecordState => ({ lastResult: undefined }));\n const currentResult = this.statement.evaluate(scope);\n if (currentResult === state.lastResult) return true;\n const previousResult = state.lastResult;\n state.lastResult = currentResult;\n targets.forEach((target) => this.conditionalExecutor(target, currentResult, previousResult));\n return true;\n }\n\n /**\n * Re-evaluates the records a change of `source` speaks for. A field of the record the targets live in speaks for\n * that record alone, which is what keeps one row of a list from answering for another; a field above them - a\n * form field every row reads - speaks for every record below it, and for the record the action was declared in\n * where the change reaches none.\n */\n private applyFrom(source: FieldBase): void {\n const scopes = new Set<FieldBase>();\n this.targetsIn(scopeOf(source)).forEach((target) => scopes.add(scopeOf(target)));\n scopes.forEach((scope) => this.applyIn(scope));\n }\n}\n\n// Derived classes for visibility, enabled, and value changes\n\nexport class ConditionalVisibilityAction extends ConditionalStatementAction {\n constructor(statement: Statement) {\n super(statement, (field: FieldBase, currentResult) => {\n field.visibility = currentResult ? DisplayMode.FULL : DisplayMode.SUPPRESS;\n });\n }\n}\n\nexport class ConditionalEnabledAction extends ConditionalStatementAction {\n constructor(statement: Statement) {\n super(statement, (field, currentResult) => {\n field.enabled = currentResult;\n });\n }\n}\n\nexport class ConditionalValueAction<T> extends ConditionalStatementAction {\n constructor(statement: Statement, trueValue: T) {\n super(statement, (field, currentResult) => {\n if (currentResult) field.value = trueValue;\n });\n }\n}\n","/**\n * Operators provides us a functionality for backend to send us complex condition upon which we send\n * dynamic visibility prop for form input fields\n */\nenum Operator {\n // Logic Operators\n NOT = 0,\n OR = 1,\n AND = 2,\n XOR = 3,\n NAND = 4,\n NOR = 5,\n\n // Comparators (comparison operators)\n EQUALS = -1,\n NOT_EQUALS = -2,\n GT = -3,\n LT = -4,\n GE = -5,\n LE = -6,\n IN = -7,\n NOT_IN = -8,\n INCLUDES = -9,\n NOT_INCLUDES = -10,\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace, no-redeclare\nnamespace Operator {\n export function fromString(operator: string): Operator {\n const op = operator.toLowerCase();\n if (op === 'not') return Operator.NOT;\n if (op === 'or') return Operator.OR;\n if (op === 'and') return Operator.AND;\n if (op === 'xor') return Operator.XOR;\n if (op === 'nand') return Operator.NAND;\n if (op === 'nor') return Operator.NOR;\n\n if (op === 'equals') return Operator.EQUALS;\n if (['not_equals', 'not-equals', 'not equals'].includes(op)) return Operator.NOT_EQUALS;\n if (op === 'gt') return Operator.GT;\n if (op === 'lt') return Operator.LT;\n if (op === 'ge') return Operator.GE;\n if (op === 'le') return Operator.LE;\n if (op === 'in') return Operator.IN;\n if (['not_in', 'not-in', 'not in'].includes(op)) return Operator.NOT_IN;\n if (op === 'includes') return Operator.INCLUDES;\n if (['not_includes', 'not-includes', 'not includes'].includes(op)) return Operator.NOT_INCLUDES;\n throw new Error(`Unrecognised operator ${op}`);\n }\n\n export function fromAny(mode: any): Operator {\n const input = typeof mode === 'number' ? mode : Operator.fromString(mode as string);\n if (Object.values(Operator).includes(input)) return input;\n throw new Error(`Unrecognised operator ${mode}`);\n }\n\n export function isDefined(operator: number | string): boolean {\n const check = typeof operator === 'number' ? operator : Operator.fromString(operator as string);\n return Object.values(Operator).includes(check);\n }\n\n // c8 bug: it doesn't matter what there is in the next line (e.g. console.log()).\n // it will always be a branch with one branch not covered\n export function isLogicOperator(operator: Operator): boolean {\n return operator >= 0;\n }\n}\n\nObject.freeze(Operator);\n\nexport default Operator;\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst EnabledChangingActionClassIdentifier = Symbol('EnabledChangingAction');\n\nexport class EnabledChangingAction extends FieldActionBase {\n constructor(\n executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => boolean,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return EnabledChangingActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): boolean {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n\nconst EnabledChangedActionClassIdentifier = Symbol('EnabledChangedAction');\n\nexport class EnabledChangedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return EnabledChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ValidChangedActionClassIdentifier = Symbol('ValidChangedAction');\n\nexport class ValidChangedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ValidChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport DisplayMode from '@/display-mode';\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst VisibilityChangingActionClassIdentifier = Symbol('VisibilityChangingAction');\n\nexport class VisibilityChangingAction extends FieldActionBase {\n constructor(\n executorFn: (\n field: FieldBase,\n supr: FieldActionExecute,\n newValue: DisplayMode,\n oldValue: DisplayMode,\n ) => DisplayMode,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return VisibilityChangingActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): DisplayMode {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n\nconst VisibilityChangedActionClassIdentifier = Symbol('VisibilityChangedAction');\n\nexport class VisibilityChangedAction extends FieldActionBase {\n constructor(\n executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => void,\n ) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return VisibilityChangedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): void {\n return super.execute(field, supr, newValue, oldValue);\n }\n}\n","import { isBoolean, isEmpty, isEqual } from 'lodash-es';\nimport { computed, reactive, type ComputedRef } from 'vue';\n\nimport ActionsMap from './actions/actions-map';\nimport { EnabledChangedAction, EnabledChangingAction } from './actions/enabled-actions';\nimport FieldActionBase from './actions/field-action-base';\nimport { ValidChangedAction } from './actions/valid-changed-action';\nimport { ValueChangedAction, ValueChangedActionClassIdentifier } from './actions/value-changed-action';\nimport { VisibilityChangedAction, VisibilityChangingAction } from './actions/visibility-actions';\nimport DisplayMode from './display-mode';\nimport { type ElementSlots } from './element-state';\nimport { IBindParams } from './field.interface';\nimport { type Group } from './group';\nimport {\n currentTransaction,\n type Transaction,\n TxAnnounceValue,\n TxCapture,\n TxRestore,\n TxSettleValidity,\n type TxSnapshot,\n type TxStructuralEvent,\n transactional,\n} from './transaction';\nimport { ValidationError } from './validators/validation-error';\n\n/**\n * The computed behind a container's `valid`, held outside the element it belongs to. A computed refers back to\n * itself through its dependency record, and JSON.stringify and lodash isEqual both walk own enumerable\n * properties, so an element carrying one as a property would be a cycle to either of them.\n */\nconst validReads = new WeakMap<object, ComputedRef<boolean>>();\n\n/**\n * The parameter keys that name what to register on an element rather than what it holds. The constructor that\n * receives them registers them and applies the rest, and `bind()` hands its overrides over whole, so they are\n * named here to keep them out of both the element's members and its extended properties.\n */\nconst registrationParams: ReadonlySet<string> = new Set(['validators', 'actions']);\n\n/**\n * How many elements are waiting for the record they belong to. A container that completes a record asks this\n * before it walks anything, so a form built out of elements that answer for themselves alone pays nothing for\n * the mechanism.\n */\nlet incompleteRecords = 0;\n\nexport abstract class FieldBase<T = any, X extends object = {}> {\n /**\n * Vue's getTargetType answers INVALID for an object that carries __v_skip, so reactive() hands an element back\n * unwrapped and no element is ever behind a proxy of its own. isReactive() reads the second flag, and it stays\n * true because what carries an element's reactivity - its state - is a reactive object.\n *\n * Two consequences for a consumer, both silent. watch(field, cb) with a bare element as the source registers\n * no dependency, because the deep traversal Vue starts for a reactive source stops on __v_skip; the supported\n * form is watch(() => field.value, cb). And readonly(field) hands the element straight back, so the value it\n * returns is the element itself and a write through it reaches the field; what a caller hands out instead is\n * the value, which is frozen, or a computed over it.\n */\n get __v_skip(): boolean {\n return true;\n }\n\n get __v_isReactive(): boolean {\n return true;\n }\n\n /**\n * The element's mutable state, in an object beside the element. `#state` is the tracked view of it: a slot read\n * through it inside an effect subscribes the effect to that slot, and a write to the slot re-runs the effect.\n * `#raw` is the same object without the proxy, for the bookkeeping nothing renders from.\n *\n * They are private class fields, so no reflection over the element reaches the state or the parent link it\n * carries, and a subclass reads its own slot type through the accessors below.\n */\n readonly #state: ElementSlots<T>;\n\n readonly #raw: ElementSlots<T>;\n\n constructor(slots: ElementSlots<T>) {\n this.#raw = slots;\n this.#state = reactive(slots) as ElementSlots<T>;\n }\n\n /** the tracked view of this element's state; a subclass narrows the return type to its own slots */\n protected get state(): ElementSlots<T> {\n return this.#state;\n }\n\n /** the untracked view of this element's state; a subclass narrows the return type to its own slots */\n protected get raw(): ElementSlots<T> {\n return this.#raw;\n }\n\n abstract get value(): T;\n abstract set value(newValue: T);\n\n abstract get touched(): boolean;\n abstract set touched(touched: boolean);\n\n /**\n * A new element of this one's class over `data`: same class, same registered actions, same extended properties,\n * and the change history starting over. It is how a declaration is put to work over a record - every row a\n * `List` builds is its item template bound to that row's data - and the element it is called on is what the new\n * one answers `declaration` with.\n *\n * `data` of `undefined` is no data supplied and the new element carries what this one holds; an explicit `null`\n * is data and clears. `overrides` states the rest: `originalValue` is read by key presence, `enabled` and\n * `visibility` fall back to this element's, and extended properties it names are written over the ones carried\n * over. The new element is detached - no `parent`, no `fieldName` - so it is free to be taken by a container.\n */\n abstract bind(data?: T, overrides?: IBindParams<T, X>): FieldBase<T, X>;\n\n /**\n * Exchanges the data this element holds for `data`, in place. The element is the same instance afterwards - its\n * identity, its actions, its extended properties and its place in whatever container holds it all stand - and it\n * ends up in the state `bind(data)` would have produced: the values are written, the change history starts over\n * and the validators run. It is what recycles one element across records, which is what a virtualised renderer\n * does with the rows it keeps.\n *\n * The element makes no statement of its own about the exchange: no `ValueChangedAction` fires for it, the way\n * none fires for an element that was just built. Its members do announce theirs, and a verdict that moves is\n * announced as always - a rebound element that is invalid says so to the container holding it. A change an\n * open transaction is already owed an announcement for stands: the commit reports the pair measured from\n * where the element was when the transaction opened.\n *\n * The data is measured against the element's `declaration`, so a key a record leaves out is taken from the\n * declaration rather than left as the previous record had it.\n */\n rebind(data: T): this {\n transactional((tx) => {\n tx.touch(this);\n // the baseline of a change the transaction has yet to announce stays where it is: the element is already\n // enrolled to report that change, and moving the baseline to the record it ends up over would erase the\n // report. Both are read before the reset, which enrols the element itself and, on a container, writes the\n // baseline of its own.\n const owed = tx.willAnnounceValue(this);\n const baseline = this.#raw.announcedValue;\n this.resetTo(this.declaration, data);\n // with nothing owed, what the element now holds is recorded as announced, so the commit reports no change\n // of value for it\n this.#raw.announcedValue = owed ? baseline : this.value;\n });\n return this;\n }\n\n /** contains original field value as was provided at creation */\n get originalValue(): T {\n return this.#state.originalValue;\n }\n\n set originalValue(newValue: T) {\n this.touchState();\n this.#state.originalValue = newValue;\n }\n\n /**\n * The extended properties this element carries: what a consumer attached to it beyond the members the class\n * declares, such as the label, hint or css class a UI layer binds to the input it renders the element with.\n * The read is tracked, so a template rendering off `field.extra.label` re-renders when the property is written.\n *\n * Every property is optional here, whatever `X` states: a parameter object need not carry one and\n * setExtendedValues writes as few as a caller likes, so a property `X` declares as required is present only\n * once something has written it.\n *\n * The object is frozen and setExtendedValues is the way to change it: it is the object a transaction captured,\n * and one written in place would leave a rollback with nothing to put back.\n */\n get extra(): Readonly<Partial<X>> {\n return this.#state.extra as Readonly<Partial<X>>;\n }\n\n /**\n * Writes extended properties. The values given are merged over the ones the element carries, so a write of one\n * property leaves the others standing, and the merged set replaces the object the element held.\n */\n setExtendedValues(values: Partial<X>): void {\n this.touchState();\n this.#state.extra = Object.freeze({ ...this.#raw.extra, ...values });\n }\n\n /**\n * The extended properties a parameter object carries: every key the element does not answer for itself. A key\n * the element answers for at the time the parameters are applied - `value`, `enabled`, an accessor a subclass\n * adds - is the element's own; a key that only Object.prototype answers for is nobody's declaration and counts\n * as extended, and `validators` and `actions` are neither, since they state what to register on the element.\n *\n * A member a subclass declares as a class field is not among the keys the element answers for: class fields are\n * defined on the instance after the base constructor returns, and the parameters are applied inside it. A\n * subclass that wants a parameter of its own name assigned to it declares that member as an accessor.\n */\n protected extendedOf(params: object): Partial<X> {\n // the accumulator carries no prototype, so a params key of `__proto__` - which is what a parameter object\n // parsed out of JSON can carry - becomes an own property of it instead of reaching the setter Object.prototype\n // holds and replacing the accumulator's prototype, which would make the ownership test below answer for keys\n // nothing put there\n const extended: Record<string, any> = Object.create(null);\n Object.entries(params).forEach(([key, value]) => {\n if (registrationParams.has(key)) return;\n if (!(key in this) || Object.hasOwn(Object.prototype, key)) extended[key] = value;\n });\n return extended as Partial<X>;\n }\n\n /**\n * Applies a parameter object: the members the element answers for are assigned to the element and the rest\n * become its extended properties. Assigning a getter-only member throws a TypeError, which is what a caller\n * naming `valid` or `parent` past the type system gets.\n */\n protected assignParams(params: object): void {\n const extended = this.extendedOf(params);\n Object.entries(params).forEach(([key, value]) => {\n if (Object.hasOwn(extended, key) || registrationParams.has(key)) return;\n (this as any)[key] = value;\n });\n if (!isEmpty(extended)) this.setExtendedValues(extended);\n }\n\n /**\n * Takes this element into the record of the open transaction, where one is open. A write of a single slot that\n * announces nothing calls it instead of opening a transaction of its own: on its own such a write is already\n * atomic, and inside a transaction it has to be part of what a rollback puts back.\n */\n protected touchState(): void {\n currentTransaction()?.touch(this);\n }\n\n /**\n * Records the whole of this element's mutable state, so that a rolled-back transaction can put it back exactly\n * as it found it. The errors array is copied because a validator writes into the array it is handed rather than\n * replacing it, and a subclass copies whatever else it holds by reference the same way.\n *\n * What is not in the snapshot is the action map, which no write touches: an operation that replaces it hands\n * the transaction its own undo instead, so this stays the one shape every element captures.\n */\n protected [TxCapture](): TxSnapshot {\n return { ...this.#raw, errors: [...this.#raw.errors] };\n }\n\n /**\n * Puts a captured state back. It writes through the tracked view, so an effect that ran on the state the\n * transaction produced runs again on the state it is being returned to, and only for the slots that differ.\n *\n * validatingCount is the one slot the element keeps: it counts runs that are in flight, and a rollback cannot\n * un-start one. Put back, the count would no longer match the endValidating calls still to come.\n */\n protected [TxRestore](snapshot: TxSnapshot): void {\n const validating = this.#raw.validatingCount;\n Object.assign(this.#state, snapshot);\n this.#state.validatingCount = validating;\n }\n\n /** true while at least one asynchronous validator is still running for this field */\n get validating(): boolean {\n return this.#state.validatingCount > 0;\n }\n\n /** announces the start of one asynchronous validation run; validators pair it with endValidating */\n beginValidating(): void {\n this.#state.validatingCount++;\n }\n\n /** announces the end of one asynchronous validation run */\n endValidating(): void {\n this.#state.validatingCount = Math.max(0, this.#state.validatingCount - 1);\n }\n\n /**\n * List of errors. The array handed out is the one the element holds, and a validator writes into it in place,\n * so a transaction that is open takes the element into its record here: a rollback that put back everything\n * except the errors would leave a state the form never held.\n */\n get errors(): ValidationError[] {\n this.touchState();\n return this.#state.errors;\n }\n\n set errors(newValue: ValidationError[]) {\n this.touchState();\n this.#state.errors = newValue;\n }\n\n /**\n * The container that holds this element: the Group it is a member of, or the List whose row it is, and\n * undefined while no container holds it. The container writes it; everyone else reads it. The read is tracked,\n * so an effect rendering off the link - `v-if=\"field.parent\"` - re-runs when a container takes the element or\n * releases it.\n */\n get parent(): Group | undefined {\n return this.#state.parent as Group | undefined;\n }\n\n /** when member of a Group, fieldName specifies the name of this field. Written by the group, read-only after */\n get fieldName(): string | undefined {\n return this.#state.fieldName;\n }\n\n /**\n * The element this one was declared as: itself for an element built from parameters, and the element it was\n * bound from for a binding - transitively, so a binding of a binding names the same one. Every row a `List`\n * builds from an item template is a binding of it, so a row's member and the template's member it stands for\n * answer with the same element, and an action registered on the template can tell the two apart.\n */\n get declaration(): FieldBase {\n return this.#raw.declaration ?? this;\n }\n\n /** The elements this one holds: a Group's members, a List's rows, none for a leaf. */\n protected get members(): FieldBase[] {\n return [];\n }\n\n /**\n * Every element in this element's subtree, this element included, that was declared as `declaration`. It answers\n * the question a shared action asks when the record it changed in is not the record its targets live in - a form\n * field that every row of a list reacts to - and it costs the subtree, so it is the path taken only when the\n * cheaper one, resolving within a single record, does not apply.\n */\n bindingsOf(declaration: FieldBase): FieldBase[] {\n const canonical = declaration.declaration;\n const found: FieldBase[] = [];\n const visit = (element: FieldBase) => {\n if (element.declaration === canonical) found.push(element);\n element.members.forEach(visit);\n };\n visit(this);\n return found;\n }\n\n /** set while an eager pass over this element is waiting for the record the element belongs to */\n declare protected _recordPending?: boolean;\n\n /**\n * States that an eager pass over this element reached an element it needs and did not find it, because the\n * record this element belongs to was not assembled at the time: a `List` row is built member by member and its\n * members are bound before any of them holds the row, so a validator comparing two of them runs before the\n * row exists. The container that finishes the record runs the pass again, and a pass that still reaches\n * nothing says so again, so the next container above answers for it.\n */\n markRecordIncomplete(): void {\n if (this._recordPending) return;\n this._recordPending = true;\n incompleteRecords++;\n }\n\n /**\n * Runs the eager passes outstanding in `element`'s subtree, now that the record it belongs to is assembled. A\n * container calls it where it has just made a record complete: a Group that has written its members, and a\n * List that has taken a row, which is what gives the row's fields the form above it.\n */\n protected completeRecords(element: FieldBase = this): void {\n if (incompleteRecords === 0) return;\n transactional(() => {\n const visit = (current: FieldBase) => {\n if (current._recordPending) {\n current._recordPending = false;\n incompleteRecords--;\n current.rerunEagerActions();\n }\n current.members.forEach(visit);\n };\n visit(element);\n });\n }\n\n /** Runs this element's eager actions over the value it holds and re-forms the verdict they reach. */\n private rerunEagerActions(): void {\n transactional((tx) => {\n this._actions?.triggerEager(this, this.value, this.value);\n tx.markValidityDirty(this);\n });\n }\n\n /**\n * The map this element registers its actions in, absent while it has registered none. Code that only triggers\n * reads this slot rather than `actions`, so an element with nothing registered stays free of a map: `actions`\n * allocates one for whoever asks, and a trigger over an empty map does nothing anyway.\n */\n declare protected _actions?: ActionsMap;\n\n protected get actions(): ActionsMap {\n if (!this._actions) this._actions = new ActionsMap();\n return this._actions;\n }\n\n protected set actions(newValue: ActionsMap) {\n this._actions = newValue;\n }\n\n /**\n * Counts the writes that have changed the value of this element or of anything below it. A container reads it\n * before answering from its value cache, and the read is an ordinary tracked one, so an effect that took a\n * cached value still re-runs when a descendant is written.\n */\n protected get valueVersion(): number {\n return this.#state.valueVersion;\n }\n\n /**\n * Marks the value of this element and of every ancestor as superseded. It walks the parent chain, so it costs\n * the nesting depth: an ancestor rebuilds its value the next time one is asked of it, instead of being walked\n * here for a reader that may never come. The walk also brings each element into the open transaction, so a\n * rollback puts the versions back and no reader is left holding a cache the tree no longer supports.\n */\n protected bumpValueVersion(): void {\n transactional((tx) => {\n tx.touch(this);\n this.#state.valueVersion++;\n let ancestor: FieldBase | undefined = this.parent;\n while (ancestor) {\n tx.touch(ancestor);\n ancestor.#state.valueVersion++;\n ancestor = ancestor.parent;\n }\n });\n }\n\n /**\n * States that this element's value changed and that every container above it therefore holds a different value\n * too. Nothing is announced here: the transaction works out at commit which of the elements enrolled actually\n * ends up holding a different value, and announces those once each.\n *\n * `force` states that the caller already knows this element's value changed - one item more or fewer is a\n * different list whatever the items compare as - so the commit announces it without composing a comparison.\n */\n protected propagateValueChanged(force: boolean = false): void {\n transactional((tx) => {\n tx.markValueChanged(this, force);\n tx.markValidityDirty(this);\n this.parent?.notifyValueChanged();\n });\n }\n\n /**\n * Re-reads the value that the next ValueChangedAction will report as the one it replaces. A leaf records what\n * it announced at every announcement, so its copy is always current and there is nothing to re-read; a\n * container that skipped composing a value nobody was listening for overrides this.\n */\n protected refreshPreviousValue(): void {}\n\n /**\n * The verdict validate() records and announces: this element's own errors plus the tally of children that\n * reported themselves invalid, so a container forms it without walking its members. `valid` is the read path\n * and answers over the live errors arrays instead; the two differ only for an error written into a member\n * without a validate() call, which is the documented cost of pushing errors by hand.\n */\n protected get countedValid(): boolean {\n return this.#raw.errors.length === 0 && this.#raw.invalidChildren === 0;\n }\n\n /**\n * Makes this element the container of `child`: it installs the back-reference, records the name a Group holds\n * the child under, and takes the child into the invalid tally. An element belongs to one container at a time,\n * so a child that already carries the link is refused; releaseChild() takes the link away again, and an element\n * released that way can be handed on. The child's state is unreachable from outside FieldBase, so a container\n * writes the two slots through here rather than on the child.\n */\n protected takeChild(child: FieldBase, fieldName?: string): void {\n transactional((tx) => {\n if (child.parent) throw new TypeError('This element already belongs to a container - pass a bind() of it');\n tx.touch(child);\n child.#state.fieldName = fieldName;\n child.#state.parent = this;\n this.adoptChild(child);\n });\n }\n\n /** Takes a child into this element's invalid tally; a container calls it once the child's parent link exists. */\n protected adoptChild(child: FieldBase): void {\n transactional((tx) => {\n tx.touch(this);\n if (!child.#raw.valid) this.#raw.invalidChildren++;\n // the tally moved, so the verdict this element carries may no longer be the one its members support\n tx.markValidityDirty(this);\n });\n }\n\n /**\n * Drops a child out of this element's invalid tally and takes its back-reference away. An element keeps no link\n * to a container that no longer holds it: it would go on moving that container's tally, and the link is what\n * stands in the way of the element being taken by another container.\n */\n protected releaseChild(child: FieldBase): void {\n transactional((tx) => {\n tx.touch(this);\n tx.touch(child);\n if (!child.#raw.valid) this.#raw.invalidChildren--;\n child.#state.parent = undefined;\n tx.markValidityDirty(this);\n });\n }\n\n /**\n * Brings this element to the state a fresh binding of `source` carrying `value` would be in: `value` is written\n * where the caller supplied one and `source`'s own value where it did not, the change history - originalValue,\n * touched - starts over and the errors are dropped and re-established by the validators. A container that reuses\n * an element at a position it already holds calls it, so the element is indistinguishable from one built for\n * that position.\n */\n protected resetTo(source: FieldBase, value: any): void {\n transactional(() => {\n const target = value === undefined ? source.value : value;\n const dropped = this.errors.length > 0;\n if (dropped) this.errors = [];\n this.touched = false;\n const assigned = this.enabled && this.value !== target;\n this.value = target;\n this.originalValue = this.value;\n // an assignment that went through ran the validators over the new value. Where it was a no-op they run here\n // if there were errors to drop, and otherwise not at all: the verdict they reached over the value the field\n // still holds is the one that stands.\n this.validate(!assigned && dropped);\n });\n }\n\n /** Resets a member. It is what lets a container reach the reset of a child whose class it does not know. */\n protected resetChild(child: FieldBase, source: FieldBase, value: any): void {\n child.resetTo(source, value);\n }\n\n /**\n * Records a child's new verdict in this element's tally. The child reports it as it settles, and the commit\n * settles the deepest element first, so the tally a container reads when its own turn comes is finished.\n */\n protected childValidityChanged(nowValid: boolean): void {\n this.#raw.invalidChildren += nowValid ? -1 : 1;\n }\n\n /**\n * The composed verdict a container answers `valid` with, memoised by Vue. The walk over the members is what\n * makes an error pushed into one of them visible without a validate() call, and the computed keeps that walk\n * from repeating while nothing it read has moved.\n */\n protected get validRead(): boolean {\n let read = validReads.get(this);\n if (!read) {\n read = computed(() => this.composeValid());\n validReads.set(this, read);\n }\n return read.value;\n }\n\n /** What validRead computes. A leaf answers over its own errors; a container adds its members. */\n protected composeValid(): boolean {\n return this.#state.errors.length === 0;\n }\n\n // default property handlers\n get visibility(): DisplayMode {\n return this.#state.visibility;\n }\n\n set visibility(newValue: DisplayMode) {\n transactional((tx) => {\n const oldValue = this.#state.visibility;\n const alteredValue = this._actions?.trigger(VisibilityChangingAction, this, newValue, oldValue);\n if (!DisplayMode.isDefined(alteredValue ?? newValue)) {\n throw new Error('visibility must be a DisplayMode constant');\n }\n tx.touch(this);\n this.#state.visibility = DisplayMode.fromAny(alteredValue ?? newValue);\n this._actions?.trigger(VisibilityChangedAction, this, this.#state.visibility, oldValue);\n });\n }\n\n get enabled(): boolean {\n return this.#state.enabled;\n }\n\n set enabled(newValue: boolean) {\n transactional((tx) => {\n const oldValue = this.#state.enabled;\n const alteredValue = this._actions?.trigger(EnabledChangingAction, this, newValue, oldValue);\n if (!isBoolean(alteredValue ?? newValue)) throw new Error('Enabled value must be boolean');\n tx.touch(this);\n this.#state.enabled = alteredValue ?? newValue;\n // a disabled field is left out of the value its group serializes, so the switch changes the value of every\n // container above it just as a write to the value itself would\n if (this.#state.enabled !== oldValue) this.bumpValueVersion();\n this._actions?.trigger(EnabledChangedAction, this, this.#state.enabled, oldValue);\n });\n }\n\n /**\n * True for an element whose value is composed of its members'. The commit builds such a value only where\n * something receives it, compares it by content rather than by identity, and runs the element's own validators\n * with the announcement: a container's validators read the composed value, which exists only once the members\n * have been written. A leaf's validators have run at the write instead, so its announcement carries no eager\n * pass of its own.\n */\n protected get composesValue(): boolean {\n return false;\n }\n\n /**\n * Announces what this element's value became over the transaction. The pair carried is (value now, value at the\n * last announcement), so a value that went A -> B -> A within the transaction says nothing, and the events an\n * operation states rather than an element's state - an item added, an item removed - are emitted first, in the\n * order the operations happened.\n */\n protected [TxAnnounceValue](tx: Transaction, dirty: boolean, force: boolean, structural?: TxStructuralEvent[]): void {\n structural?.forEach((event) => this._actions?.trigger(event.actionClass, this, event.item, event.index));\n if (!dirty) return;\n const actions = this._actions;\n // the pair a container carries is only composed where something receives it: with no ValueChangedAction and\n // no eager action riding along, walking the members would produce an object nobody reads\n if (this.composesValue && !actions?.willTrigger(ValueChangedActionClassIdentifier)) return;\n const newValue = this.value;\n const oldValue = this.#raw.announcedValue;\n if (!force && (this.composesValue ? isEqual(newValue, oldValue) : newValue === oldValue)) return;\n tx.touch(this);\n // the record of what was announced is written before the event: a handler that changes something while it\n // runs opens a change of its own, and that one is measured against this announcement\n this.#raw.announcedValue = newValue;\n if (this.composesValue) actions?.trigger(ValueChangedAction, this, newValue, oldValue);\n else actions?.triggerChain(ValueChangedActionClassIdentifier, this, newValue, oldValue);\n }\n\n /**\n * Forms the verdict this element ends the transaction with and announces a transition of it. The container is\n * told first, so a handler reads a tally that already includes this verdict, and it is enrolled in the same\n * transaction: its own verdict is composed of its members', so a member that moves without a value change - an\n * asynchronous validator, an error pushed in by hand - is what makes the container re-form its own. The\n * transaction settles the deepest element first, so a container is reached only once its members have decided.\n */\n protected [TxSettleValidity](tx: Transaction): void {\n const oldValid = this.#raw.valid;\n const newValid = this.countedValid;\n if (newValid === oldValid) return;\n tx.touch(this);\n this.#raw.valid = newValid;\n // the verdict goes to the container that holds this element, and a container that released it holds it no\n // longer: the link is gone with the release, so a dropped row moves no tally\n const container = this.parent;\n if (container) {\n tx.touch(container);\n container.childValidityChanged(newValid);\n tx.markValidityDirty(container);\n }\n this._actions?.trigger(ValidChangedAction, this, newValid, oldValid);\n }\n\n validate(revalidate: boolean = false) {\n transactional((tx) => {\n if (revalidate) this._actions?.triggerEager(this, this.value, this.value);\n tx.markValidityDirty(this);\n });\n }\n\n get valid() {\n // the slot is read rather than the errors getter, which takes the element into an open transaction: reading a\n // verdict changes nothing, and there is nothing for a rollback to put back\n return this.#state.errors.length === 0;\n }\n\n get fullValue(): any {\n return this.value;\n }\n\n get isChanged(): boolean {\n return !isEqual(this.value, this.originalValue);\n }\n\n /**\n * Brings a fresh element into the state a binding of `source` is in: it records what it was declared as, takes\n * on the extended properties and the actions `source` carries, and runs the eager ones over the value it was\n * built with. The extended properties `overrides` states are written over the ones `source` carries, and they\n * are in place before the eager pass, so an action reading one sees what the binding ends up carrying. The\n * actions are the very instances `source` holds - what a binding takes on is data, not behaviour - and each is\n * told about this element as it is taken on, so an action serving several bindings knows all of them.\n */\n protected boundFrom(source: FieldBase<any, X>, newValue: any, oldValue: any, overrides?: object): void {\n this.#raw.declaration = source.declaration;\n const extended: Partial<X> = { ...source.extra, ...(overrides && this.extendedOf(overrides)) };\n if (!isEmpty(extended)) this.setExtendedValues(extended);\n const actions = source._actions;\n if (!actions) return;\n this._actions = actions.clone();\n this._actions.bindTo(this);\n this._actions.triggerEager(this, newValue, oldValue);\n }\n\n /**\n * Registers the actions a constructor received in its parameters: registration without the eager trigger,\n * because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an\n * eager action registered here would otherwise also run once per registration, over a half-built field.\n */\n protected registerInitialActions(actions: FieldActionBase[]): void {\n actions.forEach((action) => {\n this.actions.register(action);\n action.boundToBinding(this);\n });\n }\n\n registerAction(action: FieldActionBase): this {\n transactional((tx) => {\n // the baseline of a change the transaction has yet to announce stays where it is: the element is already\n // enrolled to report that change, and moving the baseline to the value it now holds would erase the report\n if (!tx.willAnnounceValue(this)) this.refreshPreviousValue();\n this.actions.register(action);\n action.boundToBinding(this);\n if (action.eager) {\n // When adding eager actions, execute them immediately\n this.actions.trigger(Object.getPrototypeOf(action).constructor, this, this.value, this.originalValue);\n }\n });\n return this;\n }\n\n triggerAction<T2 extends FieldActionBase>(\n actionClass: (abstract new (...args: any[]) => T2) & { classIdentifier: symbol },\n ...params: any[]\n ): any {\n // an element with no map has nothing registered, and ActionsMap.trigger answers null for exactly that case\n return this._actions ? this._actions.trigger(actionClass, this, ...params) : null;\n }\n\n /**\n * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops\n * a result whose epoch no longer matches, so a validation still in flight when clearValidators() is called\n * cannot push an error onto a field that no longer has the validator that produced it.\n */\n get validationEpoch(): number {\n return this.#state.validationEpoch;\n }\n\n clearValidators(): void {\n transactional((tx) => {\n tx.touch(this);\n this.#state.validationEpoch++;\n if (this._actions) {\n const previous = this._actions;\n const dropped = previous.validators;\n // the map is replaced rather than written, so the snapshot does not reach it: a rollback that put back\n // every slot but this would leave the element without the validators the verdict it reports was reached\n // with\n tx.whenRolledBack(() => {\n this._actions = previous;\n });\n this.actions = previous.cloneWithoutValidators();\n // releasing a validator's listeners is what a rollback could not take back, so it waits for the commit:\n // until then the map the element carried is still the one a rollback puts back, validators and all. The\n // release names this element, because the same validator instance goes on serving every other element it\n // was registered on\n tx.whenCommitted(() => dropped.forEach((validator) => validator.unregisterFrom(this)));\n }\n this.errors = [];\n // the errors are gone before the recomputation, so the commit forms the verdict over the cleared state and\n // routes the validity transition through the usual path: the ValidChangedAction fires and the parent\n // re-evaluates\n this.validate();\n });\n }\n}\n","import { isString } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport { resolveInScope } from '../../binding/resolve';\nimport { FieldBase } from '../../field-base';\n\nimport Operator from './operator';\n\n// An operand is a nested Statement, a field whose current value is compared, or a literal of any type. The\n// union with `any` collapses to `any` for the type checker, so the alias documents intent rather than\n// constraining callers.\nexport type OperandType = any | Statement | FieldBase;\n\nfunction XOR(value1: boolean, value2: boolean): boolean {\n return value1 ? !value2 : value2;\n}\n\nexport class Statement {\n private readonly operand1: OperandType;\n\n private readonly operator: Operator;\n\n private readonly operand2: OperandType;\n\n constructor(operand1: OperandType, operator: Operator, operand2: OperandType) {\n this.operand1 = operand1;\n this.operator = operator;\n this.operand2 = operand2;\n }\n\n /**\n * The value an operand contributes. A field operand names a field of the record the statement is evaluated in:\n * the same statement over a `List` reads row 3's field while row 3 is the record, and a field belonging to no\n * record of the statement's own - a form field above the list - is read where it stands. A record that does not\n * hold the field yet contributes undefined, which is what a half-built row answers with.\n */\n private static valueOf(operand: OperandType, scope?: FieldBase) {\n if (operand instanceof Statement) return operand.evaluate(scope);\n if (operand instanceof FieldBase) {\n const field = scope ? resolveInScope(operand, scope) : operand;\n return field ? unref(field.value) : undefined;\n }\n return operand; // any\n }\n\n get operand1Value() {\n return Statement.valueOf(this.operand1);\n }\n\n get operand2Value() {\n return Statement.valueOf(this.operand2);\n }\n\n /**\n * The result of the statement, over the record `scope` belongs to where one is given and over the fields the\n * statement was built from where it is not.\n */\n evaluate(scope?: FieldBase): boolean {\n const operand1 = Statement.valueOf(this.operand1, scope);\n const operand2 = Statement.valueOf(this.operand2, scope);\n\n switch (this.operator) {\n // logical operators\n // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the\n // coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the\n // signature promises a boolean, and consumers comparing results with !== would see a change where the\n // logical value stayed the same.\n case Operator.AND:\n return Boolean(operand1 && operand2);\n case Operator.OR:\n return Boolean(operand1 || operand2);\n case Operator.NAND:\n return !(operand1 && operand2);\n case Operator.NOR:\n return !(operand1 || operand2);\n case Operator.XOR:\n return XOR(Boolean(operand1), Boolean(operand2));\n case Operator.NOT:\n return !operand1;\n\n // comparison operators\n case Operator.EQUALS:\n return operand1 == operand2;\n case Operator.NOT_EQUALS:\n return operand1 != operand2;\n case Operator.LT:\n return operand1 < operand2;\n case Operator.LE:\n return operand1 <= operand2;\n case Operator.GE:\n return operand1 >= operand2;\n case Operator.GT:\n return operand1 > operand2;\n case Operator.IN:\n // `includes` is called on an operand of any type, so its return value is not guaranteed to be a\n // boolean; a missing or non-callable `includes` yields undefined and therefore false. NOT_IN negates\n // exactly this, so a right operand that reports no membership at all is IN false and NOT_IN true.\n return Boolean(operand2?.includes?.(operand1));\n case Operator.NOT_IN:\n return !operand2?.includes?.(operand1);\n case Operator.INCLUDES:\n return isString(operand1) && isString(operand2) && operand1.indexOf(operand2) >= 0;\n case Operator.NOT_INCLUDES:\n return !(isString(operand1) && isString(operand2) && operand1.indexOf(operand2) >= 0);\n\n default:\n throw new Error(`Operator not implemented ${this.operator}`);\n }\n }\n\n /**\n * Recursively collects all fields used in this statement and its nested statements\n * @returns A set of all fields used in this statement\n */\n collectFields(): Set<FieldBase> {\n const fields = new Set<FieldBase>();\n\n function processOperand(op: OperandType) {\n if (op instanceof FieldBase) {\n fields.add(op);\n } else if (op instanceof Statement) {\n // For nested statements, merge their fields with our collection\n const nestedFields = op.collectFields();\n nestedFields.forEach((field) => fields.add(field));\n }\n }\n processOperand(this.operand1);\n processOperand(this.operand2);\n\n return fields;\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ExecuteActionClassIdentifier = Symbol('ExecuteAction');\n\nexport class ExecuteAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, params: any) => any) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ExecuteActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, params: any): any {\n return super.execute(field, supr, params);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ListItemAddedActionClassIdentifier = Symbol('ListItemAddedAction');\n\nexport class ListItemAddedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ListItemAddedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void {\n return super.execute(field, supr, item, index);\n }\n}\n","import FieldActionBase from './field-action-base';\n\nimport type { FieldBase } from '@/field-base';\nimport { FieldActionExecute } from '@/field.interface';\n\nconst ListItemRemovedActionClassIdentifier = Symbol('ListItemRemovedAction');\n\nexport class ListItemRemovedAction extends FieldActionBase {\n constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void) {\n super(executorFn);\n }\n\n static get classIdentifier() {\n return ListItemRemovedActionClassIdentifier;\n }\n\n execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void {\n return super.execute(field, supr, item, index);\n }\n}\n","import DisplayMode from './display-mode';\nimport type { FieldBase } from './field-base';\nimport type { GenericFieldsInterface, Group } from './group';\nimport type { ListValue } from './list';\nimport { ValidationError } from './validators/validation-error';\n\n/**\n * The mutable state of one element, held in an object of its own beside the element rather than in the element's\n * own properties.\n *\n * An element reaches it through two views of that one object, both in private class fields of `FieldBase`:\n * `this.state` is `reactive(slots)` and `this.raw` is the object itself. A slot read through `state` inside a\n * render effect or a computed subscribes that effect to the slot, and a write to the slot re-runs it. The\n * bookkeeping an element does for itself goes through `raw`, which neither records a read nor announces a write.\n * The value cache of a container goes through `raw` in particular: its getter writes the cache while it runs, and\n * a tracked write there costs the reading effect one extra evaluation, and one extra render on mount, for a value\n * it has already built.\n *\n * Being private class fields is what puts the two views out of reach of everything outside `FieldBase`: a private\n * field is absent from `Object.keys`, `JSON.stringify`, `Object.getOwnPropertySymbols` and lodash `getAllKeys` by\n * construction, and needs no per-instance property definition to be. Both `JSON.stringify` and lodash `isEqual`\n * walk their way down a structure over own keys, enumerable symbols included, and the `parent` slot is in the\n * state: reachable, it would take either walker back into the container the element came from.\n *\n * What they do reach on an element is `_actions` once something is registered, `_fields` on a `Group` and\n * `_itemTemplate` on a `List`. All three lead downwards only.\n */\nexport interface ElementSlots<T = any> {\n /** the value the element was given at construction; isChanged compares against it */\n originalValue: T;\n /** the value the last ValueChangedAction reported; the next transaction measures its net change against it */\n announcedValue: T;\n errors: ValidationError[];\n visibility: DisplayMode;\n enabled: boolean;\n /** counts the writes that changed the value of the element or of anything below it */\n valueVersion: number;\n /** how many asynchronous validation runs are in flight on this element */\n validatingCount: number;\n /** the container that holds this element, absent while none does; takeChild writes it, releaseChild clears it */\n parent: FieldBase | undefined;\n /** the name the containing Group holds this element under; a List row carries none */\n fieldName: string | undefined;\n /** generation of the validators attached to the element; clearValidators() raises it */\n validationEpoch: number;\n /**\n * The extended properties the element carries, typed by the element's own X parameter. A write replaces the\n * object rather than writing into it, so an effect that read the slot re-runs on the write, and the object a\n * transaction captured is the one a rollback puts back.\n */\n extra: object;\n /**\n * The element this one was bound from, absent on an element that was declared rather than bound. It is what lets\n * an action shared by every binding work out which binding of a second element it means: `declaration` is the\n * canonical one, so a binding of a binding names the element the whole family was declared as.\n */\n declaration: FieldBase | undefined;\n\n // the slots below are the element's own bookkeeping - nothing reads them inside an effect, and they are\n // therefore reached through raw\n\n /** the verdict the last commit announced, which is what a change of validity is measured against */\n valid: boolean;\n /** number of direct children whose last announced verdict was invalid */\n invalidChildren: number;\n}\n\n/** what an element's extended properties start as: one frozen object for all of them, since a write replaces it */\nconst noExtra = Object.freeze({});\n\nexport function elementSlots<T = any>(): ElementSlots<T> {\n return {\n originalValue: undefined!,\n announcedValue: undefined!,\n errors: [],\n visibility: DisplayMode.FULL,\n enabled: true,\n valueVersion: 0,\n validatingCount: 0,\n parent: undefined,\n fieldName: undefined,\n validationEpoch: 0,\n declaration: undefined,\n extra: noExtra,\n valid: true,\n invalidChildren: 0,\n };\n}\n\n/** what a Field holds beyond the common slots: the value itself, and whether it has been touched */\nexport interface FieldSlots<T = any> extends ElementSlots<T> {\n value: T;\n touched: boolean;\n}\n\nexport function fieldSlots<T = any>(): FieldSlots<T> {\n return { ...elementSlots<T>(), value: undefined!, touched: false };\n}\n\n/**\n * What a container holds beyond the common slots: the object the value getter last built, together with the\n * version of the tree it was built from.\n */\nexport interface ContainerSlots<T = any> extends ElementSlots<T> {\n cachedValue: T;\n cachedValueVersion: number;\n}\n\nexport function containerSlots<T = any>(): ContainerSlots<T> {\n return {\n ...elementSlots<T>(),\n announcedValue: null,\n cachedValue: null,\n cachedValueVersion: -1,\n } as ContainerSlots<T>;\n}\n\n/** what a List holds beyond the container slots: the rows themselves */\nexport interface ListSlots<\n T extends GenericFieldsInterface = GenericFieldsInterface,\n> extends ContainerSlots<ListValue> {\n rows: Group<T>[] | null;\n}\n\nexport function listSlots<T extends GenericFieldsInterface = GenericFieldsInterface>(): ListSlots<T> {\n return { ...containerSlots<ListValue>(), rows: null };\n}\n","import { ValueChangedAction } from './actions';\nimport { type FieldSlots, fieldSlots } from './element-state';\nimport { FieldBase } from './field-base';\nimport { IBindParams, IFieldParams } from './field.interface';\nimport { transactional } from './transaction';\n\nclass Field<T = any, X extends object = {}> extends FieldBase<T, X> {\n protected get state(): FieldSlots<T> {\n return super.state as FieldSlots<T>;\n }\n\n protected get raw(): FieldSlots<T> {\n return super.raw as FieldSlots<T>;\n }\n\n /** the value slot itself, without the notifications the value setter carries around a write */\n protected get _value(): T {\n return this.state.value;\n }\n\n protected set _value(newValue: T) {\n this.state.value = newValue;\n }\n\n constructor(params?: IFieldParams<T, X>) {\n super(fieldSlots<T>());\n this.init(params);\n }\n\n /**\n * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling\n * overrides one method instead of redeclaring the constructor - Action does exactly that.\n *\n * It is called from this constructor, so it runs before a subclass's own class field initializers, which\n * only run once super() returns. An override must therefore work off its parameters alone: members the\n * subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten\n * the moment the initializer runs.\n */\n protected init(params?: IFieldParams<T, X>) {\n transactional(() => {\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n this.assignParams(otherParams);\n // an absent value falls back to originalValue, an explicit null does not: null is a value a caller means\n this._value = paramValue !== undefined ? paramValue : this.originalValue;\n if (this.originalValue === undefined) this.originalValue = this._value;\n }\n // the value a construction ends on is the field's first statement about itself rather than a change of one,\n // so it is recorded as announced and the commit that follows says nothing about it\n this.raw.announcedValue = this._value;\n this._actions?.triggerEager(this, this.value, this.originalValue);\n this.validate();\n });\n }\n\n get value() {\n return this._value;\n }\n\n set value(newValue: T) {\n const oldValue = this._value;\n if (!this.enabled || oldValue === newValue) return; // a disabled field does not allow changing value\n transactional((tx) => {\n tx.touch(this);\n this._value = newValue;\n this.bumpValueVersion();\n // the validators run here rather than at the announcement, because the verdict they reach is what the\n // commit announces, and because they read the value that is being written and the one it replaces\n this._actions?.triggerEager(this, newValue, oldValue);\n // the handlers hear about the change once the transaction closes, over the value the field ends up holding\n this.propagateValueChanged();\n });\n }\n\n get touched(): boolean {\n return this.state.touched;\n }\n\n set touched(touched: boolean) {\n this.touchState();\n this.state.touched = touched;\n }\n\n bind(data?: T, overrides?: IBindParams<T, X>): this {\n // construction goes through this.constructor so that a subclass binds into its own type\n const Ctor = this.constructor as new (params?: IFieldParams<T, X>) => this;\n const res = new Ctor({\n // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears\n value: data !== undefined ? data : this.value,\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n } as IFieldParams<T, X>);\n res.boundFrom(this, res.value, res.originalValue, overrides);\n return res;\n }\n}\n\nexport { Field };\n\nexport type NullableField<T = any> = Field<T> | null;\n\nexport const EmptyField = new Field({ value: 'EmptyField' }).registerAction(\n new ValueChangedAction(() => {\n console.warn('Working with EmptyField! This should not happen');\n }),\n);\n","import { ref, type Ref } from 'vue';\n\nimport { ExecuteAction } from './actions';\nimport { Field } from './field';\nimport { IFieldParams } from './field.interface';\nimport { transactional } from './transaction';\n\nexport interface ActionValue {\n label?: string;\n icon?: string;\n}\n\n/**\n * How many executions of an action have yet to settle, held outside the action it belongs to and allocated for\n * an action the first time one is asked of it. An action nobody executes and nobody reads `busy` on carries no\n * counter at all, and the ones that do carry a Vue ref: a button rendering off `busy` re-renders when the count\n * moves away from zero and back.\n */\nconst busyCounters = new WeakMap<object, Ref<number>>();\n\nfunction isValEmpty(val: ActionValue | undefined, defaultIfTrue: ActionValue): ActionValue {\n if (val?.label == null && val?.icon == null) return defaultIfTrue;\n return val;\n}\n\nexport class Action<T extends ActionValue = ActionValue, X extends object = {}> extends Field<T, X> {\n protected init(params?: IFieldParams<T, X>) {\n transactional(() => {\n // an Action's value is always a shaped object, so the empty value is the pair of undefined members and not\n // undefined itself - both this hook and isValEmpty below rely on that\n this._value = { label: undefined, icon: undefined } as T;\n if (params) {\n const { value: paramValue, originalValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n this.assignParams(otherParams);\n const val = isValEmpty(paramValue, this._value);\n const orgVal = Object.freeze({ label: originalValue?.label, icon: originalValue?.icon } as ActionValue);\n // the fallback is a copy of the baseline, never the frozen baseline itself: label and icon stay\n // assignable on an action constructed without a value. A value that was given is kept by identity,\n // so a reactive object passed in stays linked to the action.\n this._value = isValEmpty(val, { ...orgVal }) as T;\n this.originalValue = isValEmpty(orgVal, val) as T;\n }\n // the value a construction ends on is the action's first statement about itself rather than a change of one\n this.raw.announcedValue = this._value;\n this._actions?.triggerEager(this, this.value, this.originalValue);\n this.validate();\n });\n }\n\n /**\n * A copy of the value this action holds, carrying one member rewritten. A member handed undefined is dropped\n * from the copy rather than written into it: an own key holding undefined is invisible to a reader and to\n * JSON, but lodash isEqual compares own-key sets, so writing one would leave the action permanently changed\n * against a baseline that never carried the key.\n */\n private valueWith(member: keyof ActionValue, newValue: string | undefined): T {\n const res: ActionValue = { ...this.value };\n if (newValue === undefined) delete res[member];\n else res[member] = newValue;\n return res as T;\n }\n\n get icon(): string | undefined {\n return this.value.icon;\n }\n\n set icon(newValue: string | undefined) {\n if (this.value.icon === newValue) return;\n this.value = this.valueWith('icon', newValue);\n }\n\n get label(): string | undefined {\n return this.value.label;\n }\n\n /**\n * The two setters hand the value setter a new object rather than writing into the one the action holds, so each\n * is an ordinary value change: the handlers fire, isChanged answers over it, and a disabled action refuses it.\n * The new object is built only for a member that differs from the one held - the value setter compares by\n * identity and every copy is a new object, so without the comparison here a write of the value already held\n * would announce a change and invalidate the value cache of every container above.\n */\n set label(newValue: string | undefined) {\n if (this.value.label === newValue) return;\n this.value = this.valueWith('label', newValue);\n }\n\n /** the counter behind `busy`, allocated for this action the first time it is asked for */\n private get busyRuns(): Ref<number> {\n let runs = busyCounters.get(this);\n if (!runs) {\n runs = ref(0);\n busyCounters.set(this, runs);\n }\n return runs;\n }\n\n /** true from the moment execute() is called until the handler it ran has settled, however it settles */\n get busy(): boolean {\n return this.busyRuns.value > 0;\n }\n\n /**\n * Runs the ExecuteAction chain registered on this action and answers what the chain returned. `busy` stands for\n * the length of the run: the chain is entered synchronously, and the flag is cleared once the value it produced\n * has settled - a handler that returns a promise holds it for as long as that promise takes, and one that\n * rejects clears it as it rejects.\n *\n * The answer is a promise whatever the handler returns, so a handler that throws rejects it rather than throwing\n * out of this call: a caller that does not await the answer and does not attach a catch handler leaves that\n * rejection unhandled.\n */\n async execute(params?: any): Promise<any> {\n const runs = this.busyRuns;\n runs.value++;\n try {\n return await this.triggerAction(ExecuteAction, params);\n } finally {\n runs.value--;\n }\n }\n}\n\nexport type NullableAction = Action | null;\n","<template>\n <render />\n</template>\n\n<script setup lang=\"ts\">\nimport { h, resolveComponent } from 'vue';\n\nimport { ClassTypes, ValidationError } from '../validators';\n\ninterface Props {\n message: string | ValidationError[];\n classes?: ClassTypes;\n}\n\nconst props = defineProps<Props>();\nconst md = resolveComponent('vue-markdown');\nconst htmlElements = new Set([\n 'div',\n 'span',\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'section',\n 'article',\n 'aside',\n 'nav',\n 'header',\n 'footer',\n 'main',\n 'figure',\n 'figcaption',\n 'blockquote',\n 'pre',\n 'code',\n 'em',\n 'strong',\n 'small',\n 'mark',\n 'del',\n 'ins',\n 'sub',\n 'sup',\n 'i',\n 'b',\n 'u',\n 's',\n 'a',\n 'img',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'label',\n 'form',\n 'table',\n 'tr',\n 'td',\n 'th',\n 'thead',\n 'tbody',\n 'tfoot',\n 'ul',\n 'ol',\n 'li',\n 'dl',\n 'dt',\n 'dd',\n]);\n\nconst render = () => {\n if (typeof props.message === 'string') return h('span', { class: props.classes }, props.message);\n const res: ReturnType<typeof h>[] = [];\n props.message.forEach((msg) => {\n switch (msg.componentName) {\n case 'template':\n res.push(h('div', { class: [props.classes, msg.extraClasses] }, msg.componentBody));\n break;\n case 'vue-markdown':\n if (typeof md === 'string') {\n console.warn(\n \"You are using markdown for messages-widget, but you haven't registered a vue-markdown component\",\n );\n res.push(h('div', { class: [props.classes, msg.extraClasses] }, (<any>msg.componentBindings).source));\n } else {\n const componentBindings = <any>msg.componentBindings;\n res.push(\n h(md, {\n class: [props.classes, msg.extraClasses, 'df-messages-widget-markdown'],\n source: componentBindings.source,\n options: componentBindings.options,\n plugins: componentBindings.plugins,\n }),\n );\n }\n break;\n default:\n res.push(\n h(\n htmlElements.has(msg.componentName.toLowerCase()) // only resolve if it's not a common html element\n ? msg.componentName\n : resolveComponent(msg.componentName),\n {\n class: [props.classes, msg.extraClasses],\n ...msg.componentBindings,\n ...(msg.componentBody ? { innerHTML: msg.componentBody } : {}),\n },\n ),\n );\n break;\n }\n });\n return res;\n};\n</script>\n\n<style>\n/* we would like there to be no margins for markdown at the very top and very bottom. the rest of it is fine */\n.df-messages-widget-markdown > :first-child,\n.df-messages-widget-markdown > :last-child {\n margin-top: 0 !important;\n padding-top: 0 !important;\n margin-bottom: 0 !important;\n padding-bottom: 0 !important;\n line-height: 1.35em !important; /* inspired by vitepress' aggressive settings */\n}\n</style>\n","import { isEmpty } from 'lodash-es';\n\nimport { type ContainerSlots, containerSlots } from './element-state';\nimport { Field } from './field';\nimport { FieldBase } from './field-base';\nimport { IBindParams, IFieldParams } from './field.interface';\nimport { transactional } from './transaction';\n\nexport type GenericFieldsInterface = Record<string, FieldBase>;\n// Utility type converting a field structure into the matching value structure.\n// The indexed access reads each field's value getter, so a nested Group contributes its own value structure and\n// a List contributes its row array. Inferring from FieldBase<infer U> instead would pick up the value setter,\n// which is deliberately wider than the getter on Group.\nexport type FieldsToValues<T extends GenericFieldsInterface> = {\n [K in keyof T]: T[K]['value'];\n};\n\n/** what Group.value reads back: the full field map, or null when no field serializes */\nexport type GroupValue<T extends GenericFieldsInterface> = FieldsToValues<T> | null;\n/** what Group.value and the Group constructor accept: keys left out are simply not assigned */\nexport type GroupValueInput<T extends GenericFieldsInterface> = Partial<FieldsToValues<T>> | null;\n\nexport class Group<T extends GenericFieldsInterface = GenericFieldsInterface, X extends object = {}> extends FieldBase<\n GroupValue<T>,\n X\n> {\n protected get state(): ContainerSlots<GroupValue<T>> {\n return super.state as ContainerSlots<GroupValue<T>>;\n }\n\n protected get raw(): ContainerSlots<GroupValue<T>> {\n return super.raw as ContainerSlots<GroupValue<T>>;\n }\n\n private readonly _fields: T;\n\n constructor(fields: T, params?: IFieldParams<GroupValueInput<T>, X>) {\n super(containerSlots<GroupValue<T>>());\n\n if (!Group.isValidFields(fields)) throw new Error('Invalid fields object provided');\n // the backing map has no prototype: a field may be named after an Object.prototype member, and on an\n // ordinary object a `__proto__` key would go to the inherited setter instead of becoming a field\n this._fields = Object.create(null) as T;\n\n // construction is one transaction: the members are taken and written before anything is announced, and a\n // member that refuses to be taken - one another container already holds - leaves behind no half-built group\n transactional(() => {\n Object.entries(fields).forEach(([name, field]) => this.addField(name, field));\n\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n this.assignParams(otherParams);\n // an assignment is made only for a value the caller actually supplied, and undefined is not one: spreading\n // an optional property yields an undefined value, and assigning it would push null into every member and\n // then baseline that emptied state as the original, so the group would report itself unchanged over values\n // its members never held. An explicit null is a supplied value and does clear the members.\n if (paramValue !== undefined) this.assignMembers(paramValue as GroupValueInput<T>);\n else if (this.originalValue !== undefined) this.assignMembers(this.originalValue);\n }\n\n // the members are in place and hold their values, so this is the record they were promised: a member whose\n // eager pass ran before the group existed - every member of a bound group - gets it here\n this.completeRecords();\n\n // reading value walks every member and builds an object, so it is read once here and the result serves\n // every reader below\n const constructedValue = this.value;\n if (this.originalValue === undefined) this.originalValue = Group.baseline(constructedValue);\n\n // the value a construction ends on is the group's first statement about itself rather than a change of one:\n // recording it as announced is what keeps the commit from reporting the members' assignment as a change of\n // the group, and it is what the first later change of a member is reported against\n this.raw.announcedValue = constructedValue;\n\n this._actions?.triggerEager(this, constructedValue, this.originalValue);\n this.validate();\n });\n }\n\n /**\n * The copy of a built value that serves as a baseline. The value getter hands out one object per version, and\n * a baseline holding that same object would report every value as its own original.\n */\n private static baseline<V extends GenericFieldsInterface>(value: GroupValue<V>): GroupValue<V> {\n return value == null ? value : ({ ...value } as FieldsToValues<V>);\n }\n\n private addField(fieldName: string, field: FieldBase) {\n // note: not sure if I should expose this (make it public).\n // breaks types, neglects events (originalValue, valueChanged), etc.\n if (Object.hasOwn(this._fields, fieldName)) {\n throw new Error(`Field ${fieldName} is already in this form`);\n }\n // takeChild refuses a field that another group or list already holds, and installs the back-reference and the\n // name together. A group never releases a field, so the name stands for the lifetime of the field.\n this.takeChild(field, fieldName);\n // the entry is a non-configurable getter, so the map cannot be rewritten behind the group's back:\n // a field assigned straight into `fields` would never receive parent, fieldName or change notifications\n Object.defineProperty(this._fields, fieldName, { get: () => field, configurable: false, enumerable: true });\n }\n\n private static isValidFields(flds: unknown): flds is Record<string, FieldBase> {\n function isFieldAll(field: unknown): field is FieldBase {\n return field instanceof FieldBase;\n }\n\n return typeof flds === 'object' && flds !== null && Object.entries(flds).every(([, field]) => isFieldAll(field));\n }\n\n static createFromFormData(data: Record<string, any> | null): Group {\n if (data instanceof FieldBase) {\n throw new Error('data is already a Form structure, should be a simple object');\n }\n return new Group(\n data == null ? {} : Object.fromEntries(Object.entries(data).map(([key, value]) => [key, new Field({ value })])),\n );\n }\n\n field<K extends keyof T>(fieldName: K): T[K] | null {\n return this._fields[fieldName] ?? null;\n }\n\n get fields(): T {\n return this._fields;\n }\n\n protected get members(): FieldBase[] {\n return Object.values(this._fields);\n }\n\n get value(): GroupValue<T> {\n // the version is a tracked read and the cache is not, so a reader that is answered from the cache still\n // depends on every write below this group without the walk being repeated for it\n const version = this.valueVersion;\n if (this.raw.cachedValueVersion === version) return this.raw.cachedValue;\n\n // accumulate without a prototype so a field named `__proto__` is stored instead of reassigning the\n // accumulator's prototype; the spread on return hands back an ordinary object\n const val = Object.create(null) as Record<string, any>;\n Object.entries(this._fields).forEach(([name, field]) => {\n const fieldValue = field.value;\n if (field.enabled) {\n // readOnly fields do not serialize\n val[name] = fieldValue;\n } else if (field instanceof Group && !isEmpty(fieldValue)) {\n // readOnly group only serializes if it is non-empty (some of its fields are not readOnly)\n val[name] = fieldValue;\n }\n });\n // the object outlives the read that built it - the next reader is answered with the very same one - so it is\n // frozen: a caller writing into it would change what the group reports without any member holding that value\n const built = isEmpty(val) ? null : (Object.freeze({ ...val }) as FieldsToValues<T>);\n this.raw.cachedValue = built;\n this.raw.cachedValueVersion = version;\n return built;\n }\n\n /**\n * Writes the members that the given value carries. The members are written one by one and the group says\n * nothing in between: the transaction the assignment runs in measures the group's own value and its own verdict\n * once, over the finished set, and announces each at most once.\n */\n private assignMembers(newValue: GroupValueInput<T>) {\n transactional(() => {\n Object.entries(this._fields).forEach(([name, field]) => {\n if (newValue == null || Object.hasOwn(newValue, name)) {\n field.value = newValue == null ? null : newValue[name];\n }\n });\n });\n }\n\n set value(newValue: GroupValueInput<T>) {\n transactional((tx) => {\n this.assignMembers(newValue);\n tx.markValidityDirty(this);\n });\n }\n\n /**\n * Members are reset one by one rather than assigned as a whole value: the value setter writes only the keys the\n * value carries, while a member the value leaves out has to end up holding what the template gives it. `source`\n * supplies that per member, so a group reset from the template it was bound from matches a fresh binding of it.\n */\n protected resetTo(source: FieldBase, value: any): void {\n const template = source as Group<T>;\n transactional((tx) => {\n tx.touch(this);\n if (this.errors.length) this.errors = [];\n Object.entries(this._fields).forEach(([name, field]) => {\n // a key the value does not carry leaves the member to the template; a null value clears every member,\n // the same way assigning null does\n let memberValue: any;\n if (value === null) memberValue = null;\n else if (value !== undefined && Object.hasOwn(value, name)) memberValue = value[name];\n this.resetChild(field, template.field(name) ?? field, memberValue);\n });\n const built = this.value;\n // a group brought to the state a fresh one would be in makes no statement of its own about the change: the\n // container that reset it announces the whole of it\n this.raw.announcedValue = built;\n this.originalValue = Group.baseline(built);\n super.validate(true);\n });\n }\n\n get touched(): boolean {\n return Object.values(this._fields).some((field) => field.touched);\n }\n\n set touched(touched: boolean) {\n transactional(() => {\n Object.values(this._fields).forEach((field) => {\n field.touched = touched;\n });\n });\n }\n\n get fullValue(): Record<string, any> {\n const value = Object.create(null) as Record<string, any>;\n Object.entries(this._fields).forEach(([name, field]) => {\n value[name] = field.fullValue;\n });\n return { ...value };\n }\n\n /**\n * Records that a member changed its value, so that the transaction in progress works out at commit what this\n * group's own value became and announces it once. A mutation method calls it itself; you rarely need to.\n */\n notifyValueChanged() {\n this.propagateValueChanged();\n }\n\n protected get composesValue(): boolean {\n return true;\n }\n\n /**\n * A group with nothing listening for its value does not compose one at all, so the copy it holds is from before\n * the changes nobody received. A registration that adds a listener brings it up to date here, and what the\n * listener is then told about is the change that follows it.\n */\n protected refreshPreviousValue(): void {\n this.raw.announcedValue = this.value;\n }\n\n get valid() {\n return this.validRead;\n }\n\n protected composeValid(): boolean {\n return this.state.errors.length === 0 && Object.values(this._fields).every((field) => field.valid);\n }\n\n validate(revalidate: boolean = false) {\n transactional(() => {\n // the members are revalidated first and the group forms its own verdict afterwards, over the finished set:\n // a member that turns valid while a later one is still to be checked announces nothing until the\n // transaction closes, so the group never reports a verdict over a half-revalidated set\n if (revalidate) Object.values(this._fields).forEach((field) => field.validate(true));\n super.validate(revalidate);\n });\n }\n\n bind(data?: GroupValueInput<T>, overrides?: IBindParams<GroupValueInput<T>, X>): Group<T, X> {\n const newFields = Object.create(null) as T;\n Object.entries(this._fields).forEach(([name, field]) => {\n newFields[name as keyof T] = field.bind() as any;\n });\n const res = new Group<T, X>(newFields, {\n // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears\n value: data !== undefined ? data : this.value,\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n } as IFieldParams<GroupValueInput<T>, X>);\n // the constructor primed announcedValue with the value the members ended up holding, and nothing has run since\n res.boundFrom(this, res.raw.announcedValue, res.originalValue, overrides);\n return res;\n }\n\n /**\n * A record need not name every member: a key it leaves out is taken from the declaration, the same way a member\n * the constructor is given no value for takes the one it was declared with.\n */\n rebind(data: GroupValueInput<T>): this {\n return super.rebind(data as GroupValue<T>);\n }\n}\n\nexport type NullableGroup = Group | null;\n","import { isEmpty } from 'lodash-es';\n\nimport { ListItemAddedAction, ListItemRemovedAction } from './actions';\nimport { type ListSlots, listSlots } from './element-state';\nimport { FieldBase } from './field-base';\nimport { IBindParams, IFieldParams } from './field.interface';\nimport { GenericFieldsInterface, Group } from './group';\nimport { transactional, TxCapture, type TxSnapshot } from './transaction';\n\n/** what List.value reads back: one plain object per item, or null when the list is empty */\nexport type ListValue = Record<string, any>[] | null;\n\nexport class List<T extends GenericFieldsInterface = GenericFieldsInterface, X extends object = {}> extends FieldBase<\n ListValue,\n X\n> {\n protected get state(): ListSlots<T> {\n return super.state as ListSlots<T>;\n }\n\n protected get raw(): ListSlots<T> {\n return super.raw as ListSlots<T>;\n }\n\n private _itemTemplate?: Group<T>;\n\n constructor(itemTemplate?: Group<T>, params?: IFieldParams<ListValue, X>) {\n super(listSlots<T>());\n\n this._itemTemplate = itemTemplate;\n\n // construction is one transaction, so the rows are all in place before anything is announced\n transactional(() => {\n if (params) {\n const { value: paramValue, validators, actions, ...otherParams } = params;\n // registration precedes the assignment of the remaining parameters, so a *Changing* action supplied here\n // guards them too\n this.registerInitialActions([...(validators || []), ...(actions || [])]);\n this.assignParams(otherParams);\n\n // a value that is undefined or null leaves the list empty, which is the state it starts in\n if (paramValue != null) this.setValueInternal(paramValue);\n }\n\n if (this.originalValue === undefined) this.originalValue = List.baseline(this.value);\n // the set a construction ends on is the list's first statement about itself rather than a change of one, so\n // the commit that closes the construction says nothing about it\n this.raw.announcedValue = this.value;\n this._actions?.triggerEager(this, this.value, this.originalValue);\n this.validate();\n });\n }\n\n /** The row array is copied as well: a rollback puts back the set the list held, not the array it went on to hold. */\n protected [TxCapture](): TxSnapshot {\n const captured = super[TxCapture]();\n captured.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows;\n return captured;\n }\n\n /**\n * The copy of a built value that serves as a baseline. The value getter hands out one array per version, and a\n * baseline holding that same array would report every value as its own original.\n */\n private static baseline(value: ListValue): ListValue {\n return value == null ? value : [...value];\n }\n\n private processSetValueItem(item: any): Group<T> {\n let res: Group<T>;\n // If item is already a Group, use it\n if (item instanceof Group) res = item;\n // Otherwise create a Group from item\n else if (this._itemTemplate) res = this._itemTemplate.bind(item);\n else res = Group.createFromFormData(item) as Group<T>;\n\n // an item that already belongs to a container is refused here; one this list released earlier carries no\n // link any more and is taken like any other\n this.takeChild(res);\n // the row now reaches the form this list stands in, so a rule of its own that names a field up there - one no\n // record below could answer - is run over it here\n this.completeRecords(res);\n\n return res;\n }\n\n /**\n * Builds the item that fills a gap left by an insert beyond the end of the list: the item template bound to its\n * own values, or an empty group when the list has no template.\n */\n private createPaddingItem(): Group<T> {\n return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.bind() : null);\n }\n\n private setValueInternal(newValue: any[]) {\n transactional((tx) => {\n tx.touch(this);\n // null is the value that clears, the same one Group.value = null writes into every member; without this a\n // list nested in a group would keep its rows while every sibling field was emptied\n if (newValue == null) {\n this.releaseRows();\n this.state.rows = null;\n } else if (Array.isArray(newValue)) {\n const previous = this.state.rows ?? [];\n // the new set is built beside the one in place and installed whole: writing a row runs its validators, and\n // one reading this list in the middle of the walk must not be shown a position that has yet to be filled\n const rows: Group<T>[] = new Array(newValue.length);\n for (let index = 0; index < newValue.length; index++) {\n const item = newValue[index];\n const row = previous[index];\n // a row already standing at this index takes the new item, so its identity survives the assignment and\n // a keyed v-for keeps the component rendering it. It needs an item template: a list without one builds\n // every row from its own data, so two rows need not carry the same members and writing one row's data\n // into another's members would drop whatever they do not have in common. The row is reset rather than\n // assigned, so it ends up as the row built for this position would have been.\n if (row && this._itemTemplate && !(item instanceof Group)) {\n this.resetChild(row, this._itemTemplate, item);\n rows[index] = row;\n } else {\n if (row) this.releaseChild(row);\n rows[index] = this.processSetValueItem(item);\n }\n }\n for (let index = newValue.length; index < previous.length; index++) this.releaseChild(previous[index]);\n this.state.rows = rows;\n }\n this.bumpValueVersion();\n });\n }\n\n get value(): ListValue {\n // the version is a tracked read and the cache is not, so a reader that is answered from the cache still\n // depends on every write below this list without the walk over its rows being repeated for it\n const version = this.valueVersion;\n if (this.raw.cachedValueVersion === version) return this.raw.cachedValue;\n\n const value = this.state.rows?.map((item) => item.value);\n // the array outlives the read that built it - the next reader is answered with the very same one - so it is\n // frozen, as is every row object in it; a caller writing into either would change what the list reports\n // without any row holding that value\n const built = isEmpty(value) ? null : (Object.freeze(value) as Record<string, any>[]);\n this.raw.cachedValue = built;\n this.raw.cachedValueVersion = version;\n return built;\n }\n\n set value(newValue: Record<string, any>[]) {\n transactional(() => {\n this.setValueInternal(newValue);\n // an assignment is a statement about the whole list, and it is announced as one without being compared away\n this.propagateValueChanged(true);\n });\n }\n\n /**\n * The rows are taken from `source` where the caller supplied no value of its own, so a list nested in a row that\n * a whole-list assignment reuses ends up holding what the template gives it rather than what it held before.\n */\n protected resetTo(source: FieldBase, value: any): void {\n transactional((tx) => {\n tx.touch(this);\n if (this.errors.length) this.errors = [];\n this.setValueInternal(value === undefined ? (source as List<T>).value : value);\n const built = this.value;\n // a list brought to the state a fresh one would be in makes no statement of its own: the container that\n // reset it announces the whole of it\n this.raw.announcedValue = built;\n this.originalValue = List.baseline(built);\n super.validate(true);\n });\n }\n\n get touched(): boolean {\n return this.state.rows?.some((item) => item.touched) || false;\n }\n\n set touched(touched: boolean) {\n transactional(() => {\n this.state.rows?.forEach((item) => {\n item.touched = touched;\n });\n });\n }\n\n bind(data?: ListValue, overrides?: IBindParams<ListValue, X>): List<T, X> {\n const res = new List<T, X>(this._itemTemplate?.bind(), {\n // data is what the caller supplied, and undefined is not supplied; an explicit null is, and clears\n value: [...((data !== undefined ? data : this.value) ?? [])],\n ...(overrides && 'originalValue' in overrides ? { originalValue: overrides.originalValue } : {}),\n enabled: overrides?.enabled ?? this.enabled,\n visibility: overrides?.visibility ?? this.visibility,\n } as IFieldParams<ListValue, X>);\n res.boundFrom(this, res.value, res.originalValue, overrides);\n return res;\n }\n\n /**\n * Records that a row changed its value, so that the transaction in progress works out at commit what this\n * list's own value became and announces it once. The mutation methods call it themselves; you rarely need to.\n */\n notifyValueChanged() {\n this.propagateValueChanged();\n }\n\n protected get composesValue(): boolean {\n return true;\n }\n\n /**\n * A list with nothing listening for its value does not compose one at all, so the copy it holds is from before\n * the changes nobody received. A registration that adds a listener brings it up to date here, and what the\n * listener is then told about is the change that follows it.\n */\n protected refreshPreviousValue(): void {\n this.raw.announcedValue = this.value;\n }\n\n get valid() {\n return this.validRead;\n }\n\n protected composeValid(): boolean {\n return this.state.errors.length === 0 && (this.state.rows?.every((item) => item.valid) ?? true);\n }\n\n validate(revalidate: boolean = false) {\n transactional(() => {\n // the items are revalidated first and the list forms its own verdict afterwards, over the finished set: an\n // item that turns valid while a later one is still to be checked announces nothing until the transaction\n // closes, so the list never reports a verdict over a half-revalidated set\n if (revalidate) this.state.rows?.forEach((item) => item.validate(true));\n super.validate(revalidate);\n });\n }\n\n protected get members(): FieldBase[] {\n return this.raw.rows ?? [];\n }\n\n get(index: number): Group<T> | undefined {\n return this.state.rows != null ? this.state.rows[index] : undefined;\n }\n\n push(item: any): number {\n return this.insert(item, this.state.rows?.length ?? 0) + 1;\n }\n\n pop(): Group<T> | undefined {\n return this.remove((this.state.rows?.length ?? 0) - 1);\n }\n\n remove(index: number): Group<T> | undefined {\n let removedItem: Group<T> | undefined;\n transactional((tx) => {\n if (this.state.rows == null || index < 0 || this.state.rows.length <= index) return;\n\n // the row array is recorded before the splice, so a rollback puts back the set the list held\n tx.touch(this);\n const row = this.state.rows.splice(index, 1)?.[0];\n if (!row) return;\n\n // the row itself is what leaves the list: releaseChild has taken the back-reference away, so it carries\n // nothing of the list it stood in and is free to be taken by another container, and what it holds - the\n // values it ended up with, its errors, the change history behind isChanged - is the row's to report\n this.releaseChild(row);\n this.bumpValueVersion();\n removedItem = row;\n\n // an item removed is a fact about an operation and has no net over a transaction, so it is queued in order\n // rather than compared away, and the commit emits it before the value the removal left behind\n tx.recordStructural(this, { actionClass: ListItemRemovedAction, item: removedItem, index });\n // one item fewer is a different set, so no comparison is needed to establish that the value changed\n this.propagateValueChanged(true);\n });\n\n return removedItem;\n }\n\n insert(item: any, index: number): number {\n let position = 0;\n transactional((tx) => {\n tx.touch(this);\n if (this.state.rows == null) this.state.rows = [];\n // a negative index counts back from the end and stops at the start, the way splice reads it, so the\n // position announced and returned is the one the item actually occupies\n position = index < 0 ? Math.max(this.state.rows.length + index, 0) : index;\n while (this.state.rows.length < position) {\n // if the index is too large for current array size, we add as many as necessary\n const itm = this.createPaddingItem();\n // push returns the new length, while the event carries the index of the item that was added\n const idx = this.state.rows.push(itm) - 1;\n this.bumpValueVersion();\n tx.recordStructural(this, { actionClass: ListItemAddedAction, item: itm, index: idx });\n }\n const itm = this.processSetValueItem(item);\n this.state.rows.splice(position, 0, itm);\n\n tx.recordStructural(this, { actionClass: ListItemAddedAction, item: itm, index: position });\n // one item more is a different set, so no comparison is needed to establish that the value changed\n this.bumpValueVersion();\n this.propagateValueChanged(true);\n });\n\n return position;\n }\n\n /** Drops every row this list holds out of its tally, so a row that changes its verdict later is not counted. */\n private releaseRows(): void {\n this.state.rows?.forEach((row) => this.releaseChild(row));\n }\n\n clear() {\n transactional((tx) => {\n const hadItems = (this.state.rows?.length ?? 0) > 0;\n tx.touch(this);\n this.releaseRows();\n this.state.rows = null;\n this.bumpValueVersion();\n this.propagateValueChanged(hadItems);\n });\n }\n}\n\nexport type NullableList = List | null;\n","import { unref } from 'vue';\n\nimport { ValueChangedAction } from '../actions';\nimport { bindingsIn, resolveByName, resolveInScope, scopeOf } from '../binding/resolve';\nimport type { FieldBase } from '../field-base';\n\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator, ValidatorBindingState } from './validator';\n\n/**\n * How the field to compare against is named. A field names it directly, a string names it by the name its\n * container holds it under, and a callback works it out from the field being validated. All three answer for the\n * record the validation is running over: handed the field of a `List`'s item template, a row compares against that\n * row's field.\n */\nexport type CompareToTarget = FieldBase | string | ((field: FieldBase) => FieldBase | null | undefined);\n\n/** What the validator remembers about one field it validates. */\ninterface CompareToBindingState<T> extends ValidatorBindingState {\n oldValue: T;\n}\n\nexport default class CompareTo<T = any> extends Validator {\n private readonly otherField: CompareToTarget;\n\n /**\n * The fields this validator is registered on. Registration reaches one element at a time - the rows of a list\n * take the validator on one by one, as they are built from the item template that carries it - so this is what\n * says which of the fields a declaration stands for actually carry the rule, and a field that never took it on\n * is left alone by a change of the compared field.\n */\n private readonly registrations = new WeakSet<FieldBase>();\n\n /**\n * The fields this validator has installed its listener on. A binding of such a field carries the listener too -\n * a binding takes on the actions of the field it was bound from - so the field it was bound from is what is\n * asked about as well, and a list of a thousand rows installs one listener rather than a thousand.\n */\n private readonly listening = new WeakSet<FieldBase>();\n\n /**\n * What the fields this validator was registered on were declared as. One entry stands for every binding of such a\n * field, so a change of a compared field finds the fields of the record that change happened in without a list\n * of a thousand rows being held here.\n */\n private readonly declarations = new Set<FieldBase>();\n\n constructor(\n otherField: CompareToTarget,\n private isValidComparison: (myValue: T, otherValue: T) => boolean,\n message: RenderContentRef,\n ) {\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n this.comparisonState(field).oldValue = oldValue;\n\n const other = this.resolve(field);\n // a record that does not hold the compared field yet - a row still being built - reaches no verdict, and\n // the container that finishes the record runs this pass again over the field it then holds\n if (!other) {\n field.markRecordIncomplete();\n return null;\n }\n this.listenOn(other);\n\n if (!this.isValidComparison(unref(newValue), unref(other.value))) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(message, { newValue, oldValue, field, otherField: other }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n this.otherField = otherField;\n }\n\n /** The field `field` is compared against, within the record `field` belongs to. */\n private resolve(field: FieldBase): FieldBase | undefined {\n const other = this.otherField;\n if (typeof other === 'function') return other(field) ?? undefined;\n if (typeof other === 'string') return resolveByName(other, field);\n return resolveInScope(other, scopeOf(field));\n }\n\n /**\n * Makes a change of `other` re-run this comparison. The listener re-runs it over the fields of the record the\n * change happened in rather than over the field that installed it, so the listener a row inherits with the field\n * it was bound from serves that row; and it re-runs this one validator, not the chain around it.\n */\n private listenOn(other: FieldBase): void {\n if (this.listening.has(other) || this.listening.has(other.declaration)) return;\n this.listening.add(other);\n other.registerAction(\n new ValueChangedAction((oField, supr, oNewValue, oOldValue) => {\n supr(oField, oNewValue, oOldValue);\n const scope = scopeOf(oField);\n this.declarations.forEach((declaration) =>\n bindingsIn(declaration, scope).forEach((mine) => {\n // the fields a declaration stands for are the candidates; the ones that took the validator on are the\n // ones re-validated, so a rule written for one row of a list stays that row's rule\n if (!this.registrations.has(mine)) return;\n this.execute(mine, () => null, mine.value, this.comparisonState(mine).oldValue);\n }),\n );\n }),\n );\n }\n\n boundToBinding(binding: FieldBase) {\n this.declarations.add(binding.declaration);\n this.registrations.add(binding);\n }\n\n private comparisonState(field: FieldBase): CompareToBindingState<T> {\n return this.bindingState(field) as CompareToBindingState<T>;\n }\n\n protected newBindingState(): CompareToBindingState<T> {\n return { ...super.newBindingState(), oldValue: undefined as T };\n }\n\n unregisterFrom(binding: FieldBase) {\n this.registrations.delete(binding);\n }\n}\n","import { truncate } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport default class InAllowedValues<T = any> extends Validator {\n constructor(allowedValues: T[], message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Must be one of [**{allowedAsText}**]');\n let allowedAsText = allowedValues.join(', ');\n if (allowedAsText.length > 60) {\n allowedAsText = truncate(allowedAsText, {\n length: 40,\n separator: ', ',\n omission: `... (${allowedValues.length} items total)`,\n });\n }\n\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (!allowedValues.includes(unref(newValue))) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, allowedValues, allowedAsText }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { isArray, isObject, isString } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nfunction toLength(a: any): number {\n if (a == null) return 0;\n if (isArray(a)) return a.length;\n if (isString(a)) return a.length;\n if (isObject(a) && Object.getPrototypeOf(a) === Object.prototype) return Object.keys(a).length;\n return String(a).length;\n}\n\nexport default class Required<T = any> extends Validator {\n constructor(message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Please enter a value');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(unref(newValue)) === 0) {\n return [new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field }))];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport class MinValue<T = any> extends Validator {\n constructor(minValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be larger or equal to **{minValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue < minValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, minValue })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class MaxValue<T = any> extends Validator {\n constructor(maxValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be less than or equal to **{maxValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue > maxValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, maxValue })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class ValueInRange<T = any> extends Validator {\n constructor(minValue: T, maxValue: T, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must be between **{minValue}** and **{maxValue}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (newValue < minValue || newValue > maxValue || newValue === undefined) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, minValue, maxValue }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { isArray, isObject, isString } from 'lodash-es';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nfunction toLength(a: any): number {\n if (a == null) return 0;\n if (isArray(a)) return a.length;\n if (isString(a)) return a.length;\n if (isObject(a) && Object.getPrototypeOf(a) === Object.prototype) return Object.keys(a).length;\n return String(a).length;\n}\n\nexport class MinLength<T = any> extends Validator {\n constructor(minLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be larger or equal to **{minLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(newValue) < minLength) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, minLength })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class MaxLength<T = any> extends Validator {\n constructor(maxLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be less than or equal to **{maxLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (toLength(newValue) > maxLength) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, maxLength })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n\nexport class LengthInRange<T = any> extends Validator {\n constructor(minLength: number, maxLength: number, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Length must be between **{minLength}** and **{maxLength}**');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n const len = toLength(newValue);\n if (len < minLength || len > maxLength) {\n return [\n new ValidationErrorRenderContent(\n this.replacePlaceholders(msg, { newValue, oldValue, field, minLength, maxLength }),\n ),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n","import { unref } from 'vue';\n\nimport type { FieldBase } from '../field-base';\n\nimport { buildErrorMessage } from './error-message-builder';\nimport { RenderContentRef, ValidationErrorRenderContent } from './validation-error';\nimport { ValidationFunction, Validator } from './validator';\n\nexport default class Pattern<T = any> extends Validator {\n constructor(pattern: RegExp, message?: RenderContentRef) {\n const msg = message || buildErrorMessage('Value must match pattern \"**{pattern}**\"');\n const validationFn: ValidationFunction = (newValue: T, oldValue: T, field: FieldBase) => {\n if (!pattern.test(String(unref(newValue)))) {\n return [\n new ValidationErrorRenderContent(this.replacePlaceholders(msg, { newValue, oldValue, field, pattern })),\n ];\n }\n return null;\n };\n\n super(validationFn);\n }\n}\n"],"names":["DisplayMode","defaultDisplayMode","displayModeValues","entry","fromString","mode","fromAny","input","isDefined","check","FieldActionBase","executorFn","__publicField","key","init","field","supr","params","binding","AbortEventHandlingException","ValueChangedActionClassIdentifier","ValueChangedAction","newValue","oldValue","TxCapture","TxRestore","TxAnnounceValue","TxSettleValidity","hooks","element","depthOf","depth","ancestor","Transaction","force","event","_a","_b","work","index","fn","pick","buckets","visit","bucket","structural","dirty","current","currentHandle","currentTransaction","RollbackSignal","TransactionHandle","rejectThenable","result","transaction","joined","tx","handle","error","transactional","config","getConfig","setConfig","newConfig","config_default","app","options","MdString","value","plugins","isSimpleComponentDef","msg","uMsg","unref","isCallableFunction","ValidationError","ValidationErrorText","text","classes","ValidationErrorRenderContent","computed","RenderableValue","buildErrorMessage","mdErrorString","ValidatorClassIdentifier","validationFailedMessage","Validator","validationFn","runs","run","epoch","startedIn","isCurrent","errors","processErrors","err","mine","e","i","idx","isEqual","reason","owner","stamp","descriptors","__spreadProps","__spreadValues","replace","ret","isRef","ActionsMap","action","actionType","existingExecute","ex","identifier","ActionClass","execute","newActions","scopeOf","pathOf","path","resolveInScope","declaration","scope","resolved","name","bindingsIn","found","resolveByName","container","member","ConditionalStatementActionClassIdentifier","ConditionalStatementAction","statement","relay","source","targets","target","state","currentResult","previousResult","scopes","ConditionalVisibilityAction","ConditionalEnabledAction","ConditionalValueAction","trueValue","Operator","operator","op","isLogicOperator","EnabledChangingActionClassIdentifier","EnabledChangingAction","EnabledChangedActionClassIdentifier","EnabledChangedAction","ValidChangedActionClassIdentifier","ValidChangedAction","VisibilityChangingActionClassIdentifier","VisibilityChangingAction","VisibilityChangedActionClassIdentifier","VisibilityChangedAction","validReads","registrationParams","incompleteRecords","FieldBase","slots","__privateAdd","_state","_raw","__privateSet","reactive","__privateGet","data","owed","baseline","values","extended","isEmpty","snapshot","validating","canonical","child","fieldName","dropped","assigned","nowValid","read","alteredValue","isBoolean","actions","oldValid","newValid","revalidate","overrides","actionClass","previous","validator","XOR","value1","value2","Statement","operand1","operand2","operand","isString","fields","processOperand","ExecuteActionClassIdentifier","ExecuteAction","ListItemAddedActionClassIdentifier","ListItemAddedAction","item","ListItemRemovedActionClassIdentifier","ListItemRemovedAction","noExtra","elementSlots","fieldSlots","containerSlots","listSlots","Field","paramValue","validators","otherParams","__objRest","touched","Ctor","res","EmptyField","busyCounters","isValEmpty","val","defaultIfTrue","Action","originalValue","orgVal","ref","__async","props","__props","md","resolveComponent","htmlElements","render","h","componentBindings","_createBlock","Group","constructedValue","flds","isFieldAll","version","fieldValue","built","template","memberValue","newFields","List","itemTemplate","captured","rows","row","_c","_d","removedItem","position","itm","hadItems","CompareTo","otherField","isValidComparison","message","other","oField","oNewValue","oOldValue","InAllowedValues","allowedValues","allowedAsText","truncate","toLength","a","isArray","isObject","Required","MinValue","minValue","MaxValue","maxValue","ValueInRange","MinLength","minLength","MaxLength","maxLength","LengthInRange","len","Pattern","pattern"],"mappings":"s/CAGA,IAAKA,GAAAA,IAEHA,EAAAA,EAAA,SAAW,CAAA,EAAX,WACAA,EAAAA,EAAA,OAAS,CAAA,EAAT,SACAA,EAAAA,EAAA,UAAY,CAAA,EAAZ,YACAA,EAAAA,EAAA,KAAO,EAAA,EAAP,OALGA,IAAAA,GAAA,CAAA,CAAA,EAQE,MAAMC,EAAqB,GAK5BC,EAAyC,IAAI,IACjD,OAAO,OAAOF,CAAW,EAAE,OAAQG,GAA2B,OAAOA,GAAU,QAAQ,CACzF,GAGUH,GAAV,CACS,SAASI,EAAWC,EAA2B,CACpD,OAAIA,EAAK,gBAAkB,WAAmB,EAC1CA,EAAK,gBAAkB,SAAiB,EACxCA,EAAK,gBAAkB,YAAoB,EACxCJ,CACT,CALOD,EAAS,WAAAI,EAOT,SAASE,EAAQD,EAAwB,CAC9C,MAAME,EAAQ,OAAOF,GAAS,SAAWA,EAAOL,EAAY,WAAWK,CAAc,EACrF,OAAIH,EAAkB,IAAIK,CAAK,EAAUA,EAClCN,CACT,CAJOD,EAAS,QAAAM,EAMT,SAASE,EAAUH,EAAgC,CACxD,MAAMI,EAAQ,O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