File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,39 @@ export function addPrimeAsteriskPlugin(node: FormKitNode): void {
2424 }
2525 } )
2626}
27+
28+ export function addLabelPlugin ( node : FormKitNode ) : void {
29+ if ( ! node . props . type . startsWith ( 'prime' ) )
30+ return
31+
32+ node . on ( 'created' , ( ) => {
33+ if ( node . props . definition ?. schema ) {
34+ const schemaFn = node . props . definition ?. schema as FormKitExtendableSchemaRoot
35+ node . props . definition ! . schema = ( sectionsSchema = { } ) => {
36+ sectionsSchema . label = {
37+ children : [ {
38+ $el : 'span' ,
39+ attrs : {
40+ title : '$help' ,
41+ class : 'p-formkit-label' ,
42+ } ,
43+ children : [ '$label' ] ,
44+ } , {
45+ $el : 'span' ,
46+ if : '$state.required' ,
47+ attrs : {
48+ class : 'p-formkit-required' ,
49+ title : '$help' ,
50+ } ,
51+ children : [ '*' ] ,
52+ } ] ,
53+ }
54+ sectionsSchema . help = {
55+ children : [ ] ,
56+ }
57+
58+ return schemaFn ( sectionsSchema )
59+ }
60+ }
61+ } )
62+ }
You can’t perform that action at this time.
0 commit comments