import type { ComponentCustomOptions, MethodOptions, VNode } 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; } } /** * The props of the default slot's children of `type`. A component that also RENDERS that slot passes the nodes its * render already got (`slotNodes`): every call of the slot re-runs the parent's slot function — with Vue's JSX, every * expression written inside those children — so reading the props off a second call builds the content twice. */ protected getSlotProperties(type: string, slotNodes: VNode[] = this.$slots.default?.()): Array { const slots = slotUnwrapper(slotNodes); 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; } }