File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { createAutoAnimatePlugin } from '@formkit/addons'
33
44import { de , en } from '@formkit/i18n'
55import { primeInputs } from 'my-library/definitions'
6+ import { addPrimeAsteriskPlugin } from 'my-library/plugins'
67import type { UserModule } from '@/types'
78
89export const install : UserModule = ( { app } ) => {
@@ -27,6 +28,7 @@ export const install: UserModule = ({ app }) => {
2728 repeater : [ 'items' ] ,
2829 } ,
2930 ) ,
31+ addPrimeAsteriskPlugin ,
3032 ] ,
3133 } ) )
3234}
Original file line number Diff line number Diff line change 3434 "import" : " ./dist/definitions/index.mjs" ,
3535 "require" : " ./dist/definitions/index.js"
3636 },
37+ "./plugins" : {
38+ "types" : " ./dist/plugins/index.d.ts" ,
39+ "import" : " ./dist/plugins/index.mjs" ,
40+ "require" : " ./dist/plugins/index.js"
41+ },
3742 "./dist/sass/formkit-primevue.scss" : {
3843 "import" : " ./dist/sass/formkit-primevue.scss" ,
3944 "require" : " ./dist/sass/formkit-primevue.scss"
Original file line number Diff line number Diff line change 1+ export function addPrimeAsteriskPlugin ( node : any ) : any {
2+ if ( ! node . props . type . startsWith ( 'prime' ) )
3+ return
4+
5+ node . on ( 'created' , ( ) => {
6+ const schemaFn = node . props . definition . schema
7+ node . props . definition . schema = ( sectionsSchema = { } ) => {
8+ sectionsSchema . label = {
9+ children : [ '$label' , {
10+ $el : 'span' ,
11+ if : '$state.required' ,
12+ attrs : {
13+ class : 'p-formkit-asterisk' ,
14+ } ,
15+ children : [ '*' ] ,
16+ } ] ,
17+ }
18+
19+ return schemaFn ( sectionsSchema )
20+ }
21+ } )
22+ }
You can’t perform that action at this time.
0 commit comments