@dynamicforms/vue-forms 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dynamicforms-vue-forms.js +786 -635
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/dynamicforms-vue-forms.umd.cjs +2 -2
- package/dist/dynamicforms-vue-forms.umd.cjs.map +1 -1
- package/dist/index.d.cts +60 -0
- package/dist/index.d.ts +60 -0
- package/package.json +11 -4
- package/readme.md +14 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamicforms-vue-forms.js","sources":["../src/display-mode.ts","../src/actions/field-action-base.ts","../src/field.interface.ts","../src/actions/value-changed-action.ts","../src/validators/validation-error.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/config.ts","../src/validators/error-message-builder.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","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 { isEqual } from 'lodash-es';\nimport { unref } from 'vue';\n\nimport { ValueChangedAction } from '../actions/value-changed-action';\nimport { type FieldBase } from '../field-base';\nimport { FieldActionExecute } from '../field.interface';\n\nimport {\n isCallableFunction,\n isSimpleComponentDef,\n MdString,\n RenderContentRef,\n ValidationError,\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 * 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 errors = validationFn(newValue, oldValue, field) || [];\n\n const processErrors = (err: ValidationFunctionResult) => {\n err?.forEach((e) =>\n Object.defineProperty(e, 'source', { value: this.source, enumerable: false, configurable: false }),\n );\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 = err?.findIndex((e) => isEqual(e, error)) ?? -1;\n if (idx >= 0) err?.splice(idx, 1);\n else field.errors.splice(i, 1);\n }\n }\n\n if (err && err.length > 0) field.errors.push(...err);\n field.validate(); // Update the field's valid state\n };\n\n if (errors instanceof Promise) {\n field.beginValidating();\n errors.then((err) => processErrors(err)).finally(() => field.endValidating());\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 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 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 validate(revalidate: boolean = false) {\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) this.actions.trigger(ValidChangedAction, this, this.valid, oldValid);\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 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 clearValidators(): void {\n this.actions = this.actions.cloneWithoutValidators();\n this.errors = [];\n this._valid = true;\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 case Operator.AND:\n return operand1 && operand2;\n case Operator.OR:\n return 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(operand1, 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 return operand2?.includes?.(operand1) ?? false;\n case Operator.NOT_IN:\n return !(operand2?.includes?.(operand1) ?? true);\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 [...(validators || []), ...(actions || [])].forEach((a) => this.registerAction(a));\n Object.assign(this, otherParams);\n this._value = 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 this.actions.trigger(ValueChangedAction, this, this._value, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n this.validate();\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 value: 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 { 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 [...(validators || []), ...(actions || [])].forEach((a) => this.registerAction(a));\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 tip za pretvorbo field strukture v value strukturo.\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 [...(validators || []), ...(actions || [])].forEach((a) => this.registerAction(a));\n Object.assign(this, otherParams);\n this.value = paramValue ?? this.originalValue;\n }\n\n if (this.originalValue === undefined) this.originalValue = 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 set value(newValue: GroupValueInput<T>) {\n this.suppressNotifyValueChanged = 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 = false;\n }\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 this.actions.trigger(ValueChangedAction, this, newValue, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n this.validate();\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) Object.values(this._fields).forEach((field) => field.validate(true));\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 value: 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 [...(validators || []), ...(actions || [])].forEach((a) => this.registerAction(a));\n Object.assign(this, otherParams);\n\n if (paramValue) 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 private setValueInternal(newValue: any[]) {\n 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.value;\n this.setValueInternal(newValue);\n this.actions.trigger(ValueChangedAction, this, this.value, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n this.validate();\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 value: [...(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 this.actions.trigger(ValueChangedAction, this, newValue, oldValue);\n if (this.parent) this.parent.notifyValueChanged();\n this.validate();\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) this._value?.forEach((item) => item.validate(true));\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 while (this._value.length < index) {\n // if the index is too large for current array size, we add as many as necessary\n const itm = this.processSetValueItem(null);\n const idx = this._value.push(itm);\n this.actions.trigger(ListItemAddedAction, this, itm, idx);\n }\n const itm = this.processSetValueItem(item);\n this._value.splice(index, 0, itm);\n\n this.actions.trigger(ListItemAddedAction, this, itm, index);\n this.notifyValueChanged();\n\n return index;\n }\n\n clear() {\n this._value = null;\n this.notifyValueChanged();\n }\n}\n\nexport type NullableList = List | null;\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 { 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 { 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","MdString","value","options","plugins","isSimpleComponentDef","msg","uMsg","unref","isCallableFunction","ValidationError","ValidationErrorText","text","classes","ValidationErrorRenderContent","computed","RenderableValue","ValidatorClassIdentifier","Validator","validationFn","errors","processErrors","err","e","i","error","idx","_a","isEqual","replace","ret","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","actionClass","XOR","value1","value2","Statement","operand1","operand2","_b","_d","_c","isString","fields","processOperand","ExecuteActionClassIdentifier","ExecuteAction","ListItemAddedActionClassIdentifier","ListItemAddedAction","item","index","ListItemRemovedActionClassIdentifier","ListItemRemovedAction","Field","paramValue","validators","actions","otherParams","__objRest","a","touched","overrides","Ctor","res","__spreadProps","__spreadValues","EmptyField","isValEmpty","val","defaultIfTrue","Action","originalValue","orgVal","props","__props","md","resolveComponent","htmlElements","render","h","componentBindings","_createBlock","Group","name","fieldName","flds","isFieldAll","data","fieldValue","isEmpty","newFields","List","itemTemplate","_e","removedItem","itm","config","getConfig","setConfig","newConfig","config_default","app","buildErrorMessage","mdErrorString","CompareTo","otherField","isValidComparison","message","listenerSet","nVal","oVal","oField","oNewValue","oOldValue","InAllowedValues","allowedValues","allowedAsText","truncate","toLength","isArray","isObject","Required","MinValue","minValue","MaxValue","maxValue","ValueInRange","MinLength","minLength","MaxLength","maxLength","LengthInRange","len","Pattern","pattern"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAKA,sBAAAA,OAEHA,EAAAA,EAAA,WAAW,CAAA,IAAX,YACAA,EAAAA,EAAA,SAAS,CAAA,IAAT,UACAA,EAAAA,EAAA,YAAY,CAAA,IAAZ,aACAA,EAAAA,EAAA,OAAO,EAAA,IAAP,QALGA,IAAAA,KAAA,CAAA,CAAA;AAQE,MAAMC,KAAqB;AAAA,CAGlC,CAAUD,MAAV;AACS,WAASE,EAAWC,GAA2B;AACpD,WAAIA,EAAK,kBAAkB,aAAmB,IAC1CA,EAAK,kBAAkB,WAAiB,IACxCA,EAAK,kBAAkB,cAAoB,IACxCF;AAAA,EACT;AALOD,EAAAA,EAAS,aAAAE;AAOT,WAASE,EAAQD,GAAwB;AAC9C,UAAME,IAAQ,OAAOF,KAAS,WAAWA,IAAOH,EAAY,WAAWG,CAAc;AACrF,WAAI,OAAO,OAAOH,CAAW,EAAE,SAASK,CAAK,IAAUA,IAChDJ;AAAA,EACT;AAJOD,EAAAA,EAAS,UAAAI;AAMT,WAASE,EAAUH,GAAgC;AACxD,UAAMI,IAAQ,OAAOJ,KAAS,WAAWA,IAAOH,EAAY,WAAWG,CA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AAU;AAAA,EACtD,YAAY2J,GAAiB3B,GAA4B;AACvD,UAAM5I,IAAM4I,KAAWL,EAAkB,0CAA0C,GAC7E1H,IAAmC,CAACpB,GAAaC,GAAaP,MAC7DoL,EAAQ,KAAK,OAAOrK,EAAMT,CAAQ,CAAC,CAAC,IAKlC,OAJE;AAAA,MACL,IAAIe,EAA6B,KAAK,oBAAoBR,GAAK,EAAE,UAAAP,GAAU,UAAAC,GAAU,OAAAP,GAAO,SAAAoL,GAAS,CAAC;AAAA,IAAA;AAM5G,UAAM1J,CAAY;AAAA,EACpB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dynamicforms-vue-forms.js","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","DisplayMode$1","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","Operator$1","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","maxValue","ValueInRange","MinLength","minLength","MaxLength","maxLength","LengthInRange","len","Pattern","pattern"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAKA,sBAAAA,OAEHA,EAAAA,EAAA,WAAW,CAAA,IAAX,YACAA,EAAAA,EAAA,SAAS,CAAA,IAAT,UACAA,EAAAA,EAAA,YAAY,CAAA,IAAZ,aACAA,EAAAA,EAAA,OAAO,EAAA,IAAP,QALGA,IAAAA,KAAA,CAAA,CAAA;AAQE,MAAMC,KAAqB;AAAA,CAGlC,CAAUD,MAAV;AACS,WAASE,EAAWC,GAA2B;AACpD,WAAIA,EAAK,kBAAkB,aAAmB,IAC1CA,EAAK,kBAAkB,WAAiB,IACxCA,EAAK,kBAAkB,cAAoB,IACxCF;AAAA,EACT;AALOD,EAAAA,EAAS,aAAAE;AAOT,WAASE,EAAQD,GAAwB;AAC9C,UAAME,IAAQ,OAAOF,KAAS,WAAWA,IAAOH,EAAY,WAAWG,CAAc;AACrF,WAAI,OAAO,OAAOH,CAAW,EAAE,SAASK,CAAK,IAAUA,IAChDJ;AAAA,EACT;AAJOD,EAAAA,EAAS,UAAAI;AAMT,WAASE,EAAUH,GAAgC;AACxD,UAAMI,IAAQ,OAAOJ,KAAS,WAAWA,IAAOH,EAAY,WAAWG,CAAc;AACrF,WAAO,OAAO,OAAOH,CAAW,EAAE,SAASO,CAAK;AAAA,EAClD;AAHOP,EAAAA,EAAS,YAAAM;AAAA,GAdRN,MAAAA,IAAA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