芝麻web文件管理V1.00
编辑当前文件:/home/soundframestudio/www/wp-content/themes/betheme/visual-builder/assets/js/forms/fields/tabs.js
function mfn_field_tabs(field) { let html = ''; let preview = ''; let primary = 'title'; let secondary = 'title'; let ul_classes = ['tabs-wrapper'] let options = []; let tabs = []; if( _.has(field, 'preview') ){ ul_classes.push('preview-'+field.preview); } if( _.has(field, 'primary') ){ primary = field.primary; } if( _.has(field, 'secondary') ){ secondary = field.secondary; } if( _.has(field, 'options') ){ options = field.options; } if( _.has(edited_item['attr'], field.id) && edited_item['attr'][field.id].length ){ tabs = edited_item['attr'][field.id]; }else if( _.has(field, 'std') && field.std.length ){ tabs = field.std; } const inputs = { input: function input(val, o, i) { let input_classes = ['not-empty field-to-object mfn-form-control mfn-form-input', 'mfn-tab-'+o]; if( o == primary ) input_classes.push('js-title'); return `
`; }, select: function select(val, o, i) { let input_classes = ['not-empty field-to-object mfn-form-control mfn-form-select', 'mfn-tab-'+o]; if( o == primary ) input_classes.push('js-title'); let html = `
`; if( typeof options[o][3] === 'array' || typeof options[o][3] === 'object' ){ _.map( options[o][3], function(option, opt) { html += `
${option}
` }).join('') }else if( typeof options[o][3] === 'string' && _.has(mfnDbLists, options[o][3]) ){ _.map( mfnDbLists[options[o][3]], (opt, o) => html += '
'+opt+'
' ).join('') } html += `
`; return html; }, textarea: function textarea(val, o, i) { let input_classes = ['ot-empty field-to-object mfn-form-control mfn-form-textarea', 'mfn-tab-'+o]; if( o == primary ) input_classes.push('js-title'); return `
${val}</textarea>`; }, icon: function icon(val, o, i) { let input_classes = ['not-empty field-to-object mfn-form-control mfn-form-input', 'mfn-tab-'+o]; if( o == primary ) input_classes.push('js-title'); return `
Browse
`; }, image: function image(val, o, i) { let input_classes = ['not-empty field-to-object mfn-form-control mfn-form-input', 'mfn-tab-'+o]; let input_wrapper_classes = ['form-group browse-image has-addons has-addons-append']; if( o == primary ) input_classes.push('js-title'); if( val == '' ) input_wrapper_classes.push('empty'); return `
Browse
`; }, color: function color(val, o, i) { let input_classes = ['not-empty field-to-object mfn-form-control color-picker-vb mfn-form-input', 'mfn-tab-'+o]; if( o == primary ) input_classes.push('js-title'); return `
Clear
`; } } html += `
${field.options[primary][2]}
${ _.map( options, (opt, o) => `
${opt[1]}
${ inputs[opt[0]](opt[2], o, 0) }
` ).join('') }
${ _.map( tabs, (val, v) => `
${_.escape(val[primary])}
${ _.map( options, function(opt, o) { let val_input = typeof val[o] !== 'undefined' ? val[o]+'' : ''; return `
${o}
${ inputs[opt[0]](val_input, o, v) }
`; }).join('') }
`).join('') }
Add new
`; return html; }