File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 2020 "@nuxt-alt/auth" : " ^3.1.6" ,
2121 "@nuxt-alt/http" : " ^1.7.10" ,
2222 "@nuxt-alt/proxy" : " ^2.5.8" ,
23+ "@nyariv/sandboxjs" : " ^0.8.23" ,
2324 "@pinia/nuxt" : " ^0.5.1" ,
2425 "@quasar/extras" : " ^1.16.9" ,
2526 "@vueuse/router" : " ^10.7.2" ,
Original file line number Diff line number Diff line change 11import type { QTableProps } from 'quasar'
22import type { components } from '#build/types/service-api'
3+ import Sandbox from '@nyariv/sandboxjs'
34
45type Identity = components [ 'schemas' ] [ 'IdentitiesDto' ]
56
@@ -31,15 +32,23 @@ const daysjs = useDayjs()
3132
3233function processFieldValue ( row : any , field : any ) {
3334 if ( field . type === 'function' ) {
34- return eval ( field . value ) ;
35+ const sandbox = new Sandbox ( ) ;
36+ const exec = sandbox . compile ( 'return ' + field . value , true ) ;
37+
38+ return exec ( { row } ) . run ( ) ;
3539 }
40+
3641 return row [ field ] ;
3742}
3843
3944function processFormat ( value : any , format : any ) {
4045 if ( format && format . type === 'function' ) {
41- return eval ( format . value ) ;
46+ const sandbox = new Sandbox ( ) ;
47+ const exec = sandbox . compile ( 'return ' + format . value , true ) ;
48+
49+ return exec ( { value } ) . run ( ) ;
4250 }
51+
4352 return Array . isArray ( value ) ? value ?. join ( ', ' ) : value ;
4453}
4554
Original file line number Diff line number Diff line change 11051105 vite-plugin-checker "^0.6.4"
11061106 vue-bundle-renderer "^2.0.0"
11071107
1108+ " @nyariv/sandboxjs@^0.8.23 " :
1109+ version "0.8.23"
1110+ resolved "https://registry.yarnpkg.com/@nyariv/sandboxjs/-/sandboxjs-0.8.23.tgz#6903ff28343988f12f142f79c577fbd226288920"
1111+ integrity sha512-OaD3i0czFTZzQFQdwgFVEqNyZVK19N6Jzmx/LjmDc+kiV751FQ2h3xscYkAeY4jfau2vZTZau+xR8fpkKrv/Ng==
1112+
11081113" @parcel/watcher-android-arm64@2.4.1 " :
11091114 version "2.4.1"
11101115 resolved "https://registry.yarnpkg.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz#c2c19a3c442313ff007d2d7a9c2c1dd3e1c9ca84"
You can’t perform that action at this time.
0 commit comments