@@ -3,7 +3,7 @@ import { getConfig } from '../../../../scripts/nexter.js';
33import getStyle from '../../../../utils/styles.js' ;
44import getSvg from '../../../../utils/svg.js' ;
55import { fetchConfig } from '../../utils/utils.js' ;
6- import { getAllActions , formatLangs , formatConfig , finalizeOptions } from './utils/utils.js' ;
6+ import { getAllActions , formatLangs , formatConfig , finalizeOptions , getCustomOptions } from './utils/utils.js' ;
77
88const { nxBase : nx } = getConfig ( ) ;
99
@@ -190,6 +190,41 @@ class NxLocOptions extends LitElement {
190190 </ div > ` ;
191191 }
192192
193+ renderCustomOptions ( ) {
194+ const custom = getCustomOptions ( this . _siteConfig ) ;
195+ return Object . entries ( custom ) . flatMap ( ( [ type , items ] ) => items . map ( ( { name, values } ) => {
196+ const key = `translation.service.custom.${ type } .${ name } ` ;
197+ if ( type === 'option' ) {
198+ return html `
199+ < div class ="nx-loc-fieldgroup ">
200+ < p > ${ name } </ p >
201+ < sl-select name ="${ key } " value ="${ values [ 0 ] . value } " @change =${ this . handleChangeOption } >
202+ ${ values . map ( ( { label, value } ) => html `< option value ="${ value } "> ${ label } </ option > ` ) }
203+ </ sl-select >
204+ </ div > ` ;
205+ }
206+ if ( type === 'boolean' ) {
207+ return html `
208+ < div class ="nx-loc-fieldgroup ">
209+ < p > ${ name } </ p >
210+ < sl-checkbox name ="${ key } " ?checked =${ values [ 0 ] . value === 'true' } @change =${ this . handleChangeOption } > </ sl-checkbox >
211+ </ div > ` ;
212+ }
213+ if ( type === 'textarea' ) {
214+ return html `
215+ < div class ="nx-loc-fieldgroup ">
216+ < p > ${ name } </ p >
217+ < sl-textarea name ="${ key } " value ="${ values [ 0 ] . value } " @change =${ this . handleChangeOption } > </ sl-textarea >
218+ </ div > ` ;
219+ }
220+ return html `
221+ < div class ="nx-loc-fieldgroup ">
222+ < p > ${ name } </ p >
223+ < sl-input name ="${ key } " value ="${ values [ 0 ] . value } " @change =${ this . handleChangeOption } > </ sl-input >
224+ </ div > ` ;
225+ } ) ) ;
226+ }
227+
193228 renderDateField ( label , property ) {
194229 return html `
195230 < div class ="nx-loc-fieldgroup ">
@@ -305,6 +340,7 @@ class NxLocOptions extends LitElement {
305340 < div class ="nx-loc-options-group ">
306341 ${ this . renderFieldgroup ( 'Environment' , 'translation.service.all.env' ) }
307342 ${ this . _siteConfig [ 'translation.service.supports.duedate' ] ? this . renderDateField ( 'Due date' , 'project.due' ) : nothing }
343+ ${ this . renderCustomOptions ( ) }
308344 </ div >
309345 < p class ="nx-loc-options-panel-subhead "> Conflict resolution</ p >
310346 < div class ="nx-loc-options-group ">
0 commit comments