@@ -12,26 +12,27 @@ import {
1212 type JsViewFieldOptions ,
1313 type NotePosition ,
1414 RenderChildType ,
15+ type TableFieldOptions ,
1516 type ViewFieldOptions ,
1617} from 'packages/core/src/config/FieldConfigs' ;
17- import { type FieldBase } from 'packages/core/src/fields/FieldBase ' ;
18+ import { type FieldMountable } from 'packages/core/src/fields/FieldMountable ' ;
1819import { ButtonActionRunner } from 'packages/core/src/fields/button/ButtonActionRunner' ;
19- import { ButtonBase } from 'packages/core/src/fields/button/ButtonBase ' ;
20+ import { ButtonMountable } from 'packages/core/src/fields/button/ButtonMountable ' ;
2021import { ButtonManager } from 'packages/core/src/fields/button/ButtonManager' ;
21- import { ButtonGroupBase } from 'packages/core/src/fields/button/ButtonGroupBase ' ;
22- import { InputFieldBase } from 'packages/core/src/fields/inputFields/InputFieldBase ' ;
22+ import { ButtonGroupMountable } from 'packages/core/src/fields/button/ButtonGroupMountable ' ;
23+ import { InputFieldMountable } from 'packages/core/src/fields/inputFields/InputFieldMountable ' ;
2324import { InputFieldFactory } from 'packages/core/src/fields/inputFields/InputFieldFactory' ;
24- import { JsViewField } from 'packages/core/src/fields/viewFields/JsViewField ' ;
25- import { ViewFieldBase } from 'packages/core/src/fields/viewFields/ViewFieldBase ' ;
25+ import { JsViewFieldMountable } from 'packages/core/src/fields/viewFields/JsViewFieldMountable ' ;
26+ import { ViewFieldMountable } from 'packages/core/src/fields/viewFields/ViewFieldMountable ' ;
2627import { ViewFieldFactory } from 'packages/core/src/fields/viewFields/ViewFieldFactory' ;
2728import type { BindTargetScope } from 'packages/core/src/metadata/BindTargetScope' ;
2829import { BindTargetParser } from 'packages/core/src/parsers/bindTargetParser/BindTargetParser' ;
2930import { InputFieldParser } from 'packages/core/src/parsers/inputFieldParser/InputFieldParser' ;
3031import { ViewFieldParser } from 'packages/core/src/parsers/viewFieldParser/ViewFieldParser' ;
3132import { expectType , getUUID } from 'packages/core/src/utils/Utils' ;
3233import { ErrorLevel , MetaBindInternalError } from 'packages/core/src/utils/errors/MetaBindErrors' ;
33- import { EmbedBase } from 'packages/core/src/fields/embed/EmbedBase ' ;
34- import { ExcludedBase } from 'packages/core/src/fields/excluded/ExcludedBase ' ;
34+ import { EmbedMountable } from 'packages/core/src/fields/embed/EmbedMountable ' ;
35+ import { ExcludedMountable } from 'packages/core/src/fields/excluded/ExcludedMountable ' ;
3536import { type InputFieldDeclaration } from 'packages/core/src/parsers/inputFieldParser/InputFieldDeclaration' ;
3637import {
3738 type JsViewFieldDeclaration ,
@@ -57,10 +58,12 @@ import {
5758 V_InputFieldOptions ,
5859 V_JsViewFieldOptions ,
5960 V_RenderChildType ,
61+ V_TableFieldOptions ,
6062 V_ViewFieldOptions ,
6163} from 'packages/core/src/api/Validators' ;
6264import { validate } from 'packages/core/src/utils/ZodUtils' ;
6365import { z } from 'zod' ;
66+ import { TableMountable } from 'packages/core/src/fields/metaBindTable/TableMountable' ;
6467
6568export interface LifecycleHook {
6669 register ( cb : ( ) => void ) : void ;
@@ -127,7 +130,7 @@ export abstract class API<Plugin extends IPlugin> {
127130 filePath : string ,
128131 options : FieldOptionMap [ Type ] ,
129132 honorExcludedSetting : boolean = true ,
130- ) : FieldBase {
133+ ) : FieldMountable {
131134 validate (
132135 z . object ( {
133136 type : V_FieldType ,
@@ -144,23 +147,25 @@ export abstract class API<Plugin extends IPlugin> {
144147 ) ;
145148
146149 if ( this . plugin . internal . isFilePathExcluded ( filePath ) && honorExcludedSetting ) {
147- return this . createExcludedBase ( filePath ) ;
150+ return this . createExcludedMountable ( filePath ) ;
148151 }
149152
150- if ( type === FieldType . INPUT_FIELD ) {
151- return this . createInputFieldBase ( filePath , options as FieldOptionMap [ FieldType . INPUT_FIELD ] ) ;
152- } else if ( type === FieldType . VIEW_FIELD ) {
153- return this . createViewFieldBase ( filePath , options as FieldOptionMap [ FieldType . VIEW_FIELD ] ) ;
154- } else if ( type === FieldType . JS_VIEW_FIELD ) {
155- return this . createJsViewFieldBase ( filePath , options as FieldOptionMap [ FieldType . JS_VIEW_FIELD ] ) ;
153+ if ( type === FieldType . INPUT ) {
154+ return this . createInputFieldMountable ( filePath , options as FieldOptionMap [ FieldType . INPUT ] ) ;
155+ } else if ( type === FieldType . VIEW ) {
156+ return this . createViewFieldMountable ( filePath , options as FieldOptionMap [ FieldType . VIEW ] ) ;
157+ } else if ( type === FieldType . JS_VIEW ) {
158+ return this . createJsViewFieldMountable ( filePath , options as FieldOptionMap [ FieldType . JS_VIEW ] ) ;
159+ } else if ( type === FieldType . TABLE ) {
160+ return this . createTableFieldMountable ( filePath , options as FieldOptionMap [ FieldType . TABLE ] ) ;
156161 } else if ( type === FieldType . BUTTON_GROUP ) {
157- return this . createButtonGroupBase ( filePath , options as FieldOptionMap [ FieldType . BUTTON_GROUP ] ) ;
162+ return this . createButtonGroupMountable ( filePath , options as FieldOptionMap [ FieldType . BUTTON_GROUP ] ) ;
158163 } else if ( type === FieldType . BUTTON ) {
159- return this . createButtonBase ( filePath , options as FieldOptionMap [ FieldType . BUTTON ] ) ;
164+ return this . createButtonMountable ( filePath , options as FieldOptionMap [ FieldType . BUTTON ] ) ;
160165 } else if ( type === FieldType . EMBED ) {
161- return this . createEmbedBase ( filePath , options as FieldOptionMap [ FieldType . EMBED ] ) ;
166+ return this . createEmbedMountable ( filePath , options as FieldOptionMap [ FieldType . EMBED ] ) ;
162167 } else if ( type === FieldType . EXCLUDED ) {
163- return this . createExcludedBase ( filePath ) ;
168+ return this . createExcludedMountable ( filePath ) ;
164169 }
165170
166171 expectType < never > ( type ) ;
@@ -187,7 +192,7 @@ export abstract class API<Plugin extends IPlugin> {
187192 renderChildType : RenderChildType = RenderChildType . INLINE ,
188193 position ?: NotePosition | undefined ,
189194 honorExcludedSetting : boolean = true ,
190- ) : FieldBase {
195+ ) : FieldMountable {
191196 validate (
192197 z . object ( {
193198 fieldString : z . string ( ) ,
@@ -245,7 +250,7 @@ export abstract class API<Plugin extends IPlugin> {
245250 renderChildType : RenderChildType = RenderChildType . INLINE ,
246251 position ?: NotePosition | undefined ,
247252 honorExcludedSetting : boolean = true ,
248- ) : FieldBase {
253+ ) : FieldMountable {
249254 validate (
250255 z . object ( {
251256 type : V_FieldType ,
@@ -266,27 +271,27 @@ export abstract class API<Plugin extends IPlugin> {
266271 ) ;
267272
268273 if ( this . plugin . internal . isFilePathExcluded ( filePath ) && honorExcludedSetting ) {
269- return this . createExcludedBase ( filePath ) ;
274+ return this . createExcludedMountable ( filePath ) ;
270275 }
271276
272- if ( type === FieldType . INPUT_FIELD ) {
273- return this . createInputFieldBase ( filePath , {
277+ if ( type === FieldType . INPUT ) {
278+ return this . createInputFieldMountable ( filePath , {
274279 renderChildType : renderChildType ,
275280 declaration : declaration ,
276281 scope : scope ,
277282 } ) ;
278283 }
279284
280- if ( type === FieldType . VIEW_FIELD ) {
281- return this . createViewFieldBase ( filePath , {
285+ if ( type === FieldType . VIEW ) {
286+ return this . createViewFieldMountable ( filePath , {
282287 renderChildType : renderChildType ,
283288 declaration : declaration ,
284289 scope : scope ,
285290 } ) ;
286291 }
287292
288293 if ( type === FieldType . BUTTON_GROUP ) {
289- return this . createButtonGroupBase ( filePath , {
294+ return this . createButtonGroupMountable ( filePath , {
290295 renderChildType : renderChildType ,
291296 declaration : declaration ,
292297 position : position ,
@@ -302,7 +307,7 @@ export abstract class API<Plugin extends IPlugin> {
302307 } ) ;
303308 }
304309
305- public createInputFieldBase ( filePath : string , options : InputFieldOptions ) : InputFieldBase {
310+ public createInputFieldMountable ( filePath : string , options : InputFieldOptions ) : InputFieldMountable {
306311 validate (
307312 z . object ( {
308313 filePath : V_FilePath ,
@@ -327,10 +332,10 @@ export abstract class API<Plugin extends IPlugin> {
327332 ) ;
328333 }
329334
330- return new InputFieldBase ( this . plugin , uuid , filePath , options . renderChildType , declaration ) ;
335+ return new InputFieldMountable ( this . plugin , uuid , filePath , options . renderChildType , declaration ) ;
331336 }
332337
333- public createViewFieldBase ( filePath : string , options : ViewFieldOptions ) : ViewFieldBase {
338+ public createViewFieldMountable ( filePath : string , options : ViewFieldOptions ) : ViewFieldMountable {
334339 validate (
335340 z . object ( {
336341 filePath : V_FilePath ,
@@ -355,10 +360,10 @@ export abstract class API<Plugin extends IPlugin> {
355360 ) ;
356361 }
357362
358- return new ViewFieldBase ( this . plugin , uuid , filePath , options . renderChildType , declaration ) ;
363+ return new ViewFieldMountable ( this . plugin , uuid , filePath , options . renderChildType , declaration ) ;
359364 }
360365
361- public createJsViewFieldBase ( filePath : string , options : JsViewFieldOptions ) : JsViewField {
366+ public createJsViewFieldMountable ( filePath : string , options : JsViewFieldOptions ) : JsViewFieldMountable {
362367 validate (
363368 z . object ( {
364369 filePath : V_FilePath ,
@@ -379,10 +384,27 @@ export abstract class API<Plugin extends IPlugin> {
379384 declaration = this . jsViewFieldParser . fromSimpleDeclarationAndValidate ( options . declaration , filePath ) ;
380385 }
381386
382- return new JsViewField ( this . plugin , uuid , filePath , declaration ) ;
387+ return new JsViewFieldMountable ( this . plugin , uuid , filePath , declaration ) ;
383388 }
384389
385- public createButtonGroupBase ( filePath : string , options : ButtonGroupOptions ) : ButtonGroupBase {
390+ public createTableFieldMountable ( filePath : string , options : TableFieldOptions ) : TableMountable {
391+ validate (
392+ z . object ( {
393+ filePath : V_FilePath ,
394+ options : V_TableFieldOptions ,
395+ } ) ,
396+ {
397+ filePath : filePath ,
398+ options : options ,
399+ } ,
400+ ) ;
401+
402+ const uuid = getUUID ( ) ;
403+
404+ return new TableMountable ( this . plugin , uuid , filePath , options . bindTarget , options . tableHead , options . columns ) ;
405+ }
406+
407+ public createButtonGroupMountable ( filePath : string , options : ButtonGroupOptions ) : ButtonGroupMountable {
386408 validate (
387409 z . object ( {
388410 filePath : V_FilePath ,
@@ -403,10 +425,17 @@ export abstract class API<Plugin extends IPlugin> {
403425 declaration = this . buttonParser . validateGroup ( options . declaration ) ;
404426 }
405427
406- return new ButtonGroupBase ( this . plugin , uuid , filePath , declaration , options . renderChildType , options . position ) ;
428+ return new ButtonGroupMountable (
429+ this . plugin ,
430+ uuid ,
431+ filePath ,
432+ declaration ,
433+ options . renderChildType ,
434+ options . position ,
435+ ) ;
407436 }
408437
409- public createButtonBase ( filePath : string , options : ButtonOptions ) : ButtonBase {
438+ public createButtonMountable ( filePath : string , options : ButtonOptions ) : ButtonMountable {
410439 validate (
411440 z . object ( {
412441 filePath : V_FilePath ,
@@ -427,10 +456,10 @@ export abstract class API<Plugin extends IPlugin> {
427456 declaration = this . buttonParser . validate ( options . declaration ) ;
428457 }
429458
430- return new ButtonBase ( this . plugin , uuid , filePath , declaration , options . position , options . isPreview ) ;
459+ return new ButtonMountable ( this . plugin , uuid , filePath , declaration , options . position , options . isPreview ) ;
431460 }
432461
433- public createEmbedBase ( filePath : string , options : EmbedOptions ) : EmbedBase {
462+ public createEmbedMountable ( filePath : string , options : EmbedOptions ) : EmbedMountable {
434463 validate (
435464 z . object ( {
436465 filePath : V_FilePath ,
@@ -443,10 +472,10 @@ export abstract class API<Plugin extends IPlugin> {
443472 ) ;
444473
445474 const uuid = getUUID ( ) ;
446- return new EmbedBase ( this . plugin , uuid , filePath , options . depth , options . content ) ;
475+ return new EmbedMountable ( this . plugin , uuid , filePath , options . depth , options . content ) ;
447476 }
448477
449- public createExcludedBase ( filePath : string ) : ExcludedBase {
478+ public createExcludedMountable ( filePath : string ) : ExcludedMountable {
450479 validate (
451480 z . object ( {
452481 filePath : V_FilePath ,
@@ -457,7 +486,7 @@ export abstract class API<Plugin extends IPlugin> {
457486 ) ;
458487
459488 const uuid = getUUID ( ) ;
460- return new ExcludedBase ( this . plugin , uuid , filePath ) ;
489+ return new ExcludedMountable ( this . plugin , uuid , filePath ) ;
461490 }
462491
463492 /**
@@ -475,9 +504,9 @@ export abstract class API<Plugin extends IPlugin> {
475504 } ,
476505 ) ;
477506
478- if ( fieldType === FieldType . INPUT_FIELD ) {
507+ if ( fieldType === FieldType . INPUT ) {
479508 return 'INPUT' ;
480- } else if ( fieldType === FieldType . VIEW_FIELD ) {
509+ } else if ( fieldType === FieldType . VIEW ) {
481510 return 'VIEW' ;
482511 } else if ( fieldType === FieldType . BUTTON_GROUP ) {
483512 return 'BUTTON' ;
0 commit comments