import type { ComponentCustomOptions, MethodOptions } from 'vue'; import type { ComponentSetupFunction, Cons } from 'vue-facing-decorator/dist/component'; import type { ValidationRuleset, ValidationState } from '../common/static-wrappers/interfaces/validation-interface'; import { Component as OriginalComponent, Prop, Vue } from 'vue-facing-decorator'; import { slotUnwrapper } from '../common/slot-unwrapper'; @Component export default class TsxComponent

extends Vue { private vueTsxProps: Readonly<{ ref?: string; key?: string | number }> & Readonly

; model: never; @Prop() validationState!: ValidationState; protected get hasValidationError(): boolean { return this.validationState != null && this.validationState.valid == false; } protected get validationCssClass(): string { return this.hasValidationError ? 'has-danger' : ''; } protected get validationErrorMessage(): string { return this.hasValidationError ? this.validationState.errorMessage : null; } protected populateValidationDeclaration(): void { if (this.validationState != null) { // @ts-expect-error it is readonly this.validationState.validationDeclaration._changed = true; // @ts-expect-error it is readonly this.validationState.validationDeclaration._label = this.label; } } protected getSlotProperties(type: string): Array { const slots = slotUnwrapper(this.$slots.default?.()); const retVal: Array = [] = slots?.filter(node => (node as any)?.type?.__vfdConstructor?.$fwName == type).map(node => node.props as any); return retVal; // var retVal: Array = []; // for (const node of (this.$slots.default?.() || [])) { // const fwId = (node as any).type?.__vfdConstructor?.$fwName; // if (fwId == type) { // retVal.push(node.props as any) // } // } // return retVal; } } @Component export class TsxComponentLite

extends Vue { model: never; private vueTsxProps: Readonly<{ ref?: string }> & Readonly

; } interface ComponentOption { name?: string; emits?: string[]; provide?: Record | Function; components?: Record; directives?: Record; inheritAttrs?: boolean; expose?: string[]; render?: Function; modifier?: (raw: any) => any; options?: ComponentCustomOptions & Record; template?: string; mixins?: any[]; setup?: ComponentSetupFunction; methods?: MethodOptions; } type ComponentConsOption = Cons | ComponentOption; type ComponentOptions = { validations?: ValidationRuleset; } & ComponentConsOption; export function Component(options: ComponentOptions, ctx?: any) { return OriginalComponent(options as any, ctx); } declare global { namespace JSX { interface ElementAttributesProperty { vueTsxProps: {}; } } interface PublicMethodSet { methods: T; } }