|
1 | | -import type { |
2 | | - SimpleJsViewFieldDeclaration, |
3 | | - SimpleViewFieldDeclaration, |
4 | | -} from 'packages/core/src/parsers/viewFieldParser/ViewFieldDeclaration'; |
5 | | -import type { BindTargetScope } from 'packages/core/src/metadata/BindTargetScope'; |
6 | | -import type { SimpleInputFieldDeclaration } from 'packages/core/src/parsers/inputFieldParser/InputFieldDeclaration'; |
7 | | -import type { ButtonConfig } from 'packages/core/src/config/ButtonConfig'; |
8 | | -import type { SimpleButtonGroupDeclaration } from 'packages/core/src/parsers/ButtonParser'; |
9 | | -import { type BindTargetDeclaration } from 'packages/core/src/parsers/bindTargetParser/BindTargetDeclaration'; |
10 | | -import { type MetaBindColumnDeclaration } from 'packages/core/src/fields/metaBindTable/TableMountable'; |
11 | | - |
12 | 1 | /** |
13 | 2 | * @internal |
14 | 3 | */ |
@@ -604,93 +593,4 @@ export const ViewFieldArgumentConfigs: Record<ViewFieldArgumentType, ViewFieldAr |
604 | 593 | }, |
605 | 594 | }; |
606 | 595 |
|
607 | | -export enum RenderChildType { |
608 | | - INLINE = 'inline', |
609 | | - BLOCK = 'block', |
610 | | -} |
611 | | - |
612 | 596 | export const EMBED_MAX_DEPTH = 8; |
613 | | - |
614 | | -export enum FieldType { |
615 | | - INPUT = 'INPUT', |
616 | | - VIEW = 'VIEW', |
617 | | - JS_VIEW = 'JS_VIEW', |
618 | | - TABLE = 'TABLE', |
619 | | - BUTTON_GROUP = 'BUTTON_GROUP', |
620 | | - BUTTON = 'BUTTON', |
621 | | - EMBED = 'EMBED', |
622 | | - EXCLUDED = 'EXCLUDED', |
623 | | -} |
624 | | - |
625 | | -export interface InputFieldOptions { |
626 | | - renderChildType: RenderChildType; |
627 | | - declaration: SimpleInputFieldDeclaration | string; |
628 | | - scope?: BindTargetScope | undefined; |
629 | | -} |
630 | | - |
631 | | -export interface ViewFieldOptions { |
632 | | - renderChildType: RenderChildType; |
633 | | - declaration: SimpleViewFieldDeclaration | string; |
634 | | - scope?: BindTargetScope | undefined; |
635 | | -} |
636 | | - |
637 | | -export interface JsViewFieldOptions { |
638 | | - declaration: SimpleJsViewFieldDeclaration | string; |
639 | | -} |
640 | | - |
641 | | -export interface TableOptions { |
642 | | - bindTarget: BindTargetDeclaration; |
643 | | - tableHead: string[]; |
644 | | - columns: MetaBindColumnDeclaration[]; |
645 | | -} |
646 | | - |
647 | | -export interface ButtonGroupOptions { |
648 | | - renderChildType: RenderChildType; |
649 | | - declaration: SimpleButtonGroupDeclaration | string; |
650 | | - position?: NotePosition | undefined; |
651 | | -} |
652 | | - |
653 | | -export interface ButtonOptions { |
654 | | - declaration: ButtonConfig | string; |
655 | | - position?: NotePosition | undefined; |
656 | | - isPreview: boolean; |
657 | | -} |
658 | | - |
659 | | -export class NotePosition { |
660 | | - linePosition: LinePosition | undefined; |
661 | | - |
662 | | - constructor(linePosition: LinePosition | undefined) { |
663 | | - this.linePosition = linePosition; |
664 | | - } |
665 | | - |
666 | | - getPosition(): LinePosition | undefined { |
667 | | - return this.linePosition; |
668 | | - } |
669 | | -} |
670 | | - |
671 | | -export interface LinePosition { |
672 | | - lineStart: number; |
673 | | - lineEnd: number; |
674 | | -} |
675 | | - |
676 | | -export interface EmbedOptions { |
677 | | - depth: number; |
678 | | - content: string; |
679 | | -} |
680 | | - |
681 | | -export interface FieldOptionMap { |
682 | | - [FieldType.INPUT]: InputFieldOptions; |
683 | | - [FieldType.VIEW]: ViewFieldOptions; |
684 | | - [FieldType.JS_VIEW]: JsViewFieldOptions; |
685 | | - [FieldType.TABLE]: TableOptions; |
686 | | - [FieldType.BUTTON_GROUP]: ButtonGroupOptions; |
687 | | - [FieldType.BUTTON]: ButtonOptions; |
688 | | - [FieldType.EMBED]: EmbedOptions; |
689 | | - [FieldType.EXCLUDED]: undefined; |
690 | | -} |
691 | | - |
692 | | -export type InlineFieldType = FieldType.INPUT | FieldType.VIEW | FieldType.BUTTON_GROUP; |
693 | | - |
694 | | -export function isFieldTypeAllowedInline(type: FieldType): type is InlineFieldType { |
695 | | - return type === FieldType.INPUT || type === FieldType.VIEW || type === FieldType.BUTTON_GROUP; |
696 | | -} |
0 commit comments