j-Layout
- Este componente pode criar um layout para o seu SPA. este componente é um pouco mais difícil de entender, mas é muito útil.
j-Layoutusa jComponent+v17.
Configuração:
parent {String}pode conter o seletorparent,windowou jQuery para o métodoclosest(default:window)margin {Number}adiciona margem para oheight(default:0)remember {Boolean}pode lembrar as últimas configurações de layout para reservar (default:true)space {Number}interno, contém um espaço entre os painéis (default:1)border {Number}interno, contém um tamanho de fronteira (default:0)resize {String}interno, um caminho para o método que é executado quando o layout é redesenhadoautoresize {Boolean}permite auto-resize (default:true)
Métodos:
component.refresh()Layout de refrescoscomponent.resize()é uma reposiçãocomponent.reset()faz reposição de resumocomponent.layout(name)altera uma layout (como duas maneiras de ligar dados)component.rebind(code_string)cria uma nova configuração de layoutcomponent.lock(type, [boolean])fecha o painel
Tipos de Panel:
leftpainel esquerdo, residualright- Panel Direito, Residível- O painel
right2direito estará ao lado do painel esquerdo e usa a chaverightna configuração, residual toppainel superior, residual (é painel em cima de todos os painéis)top2painel superior, residual e usa a chavetopna configuração (é entre o painellefteright)bottompainel de fundo, residual (é o painel no fundo de todos os painéis)bottom2painel de fundo, residual e usa a chavebottomna configuração (é entre o painellefteright)- Pano principal de
main, can't be resizable e o tamanho é calculado automaticamente
Layout:
A criação de layout é muito fácil e com muitas possibilidades.Layout deve ter sua própria estrutura HTML.Olha para o exemplo.O exemplo abaixo descreve apenas os metadados do layout.
size {Number/String}pode conter uma altura / largura do painel de acordo com o tipo de painel. Número120define pixels e String100%pode definir percentagemminsize {Number/String}é um tamanho mínimo do painel enquanto o painel está reescrevendo (default: valorsize)maxsize {Number/String}é o tamanho máximo do painel enquanto o painel está reescrevendo (default: auto-contado)resize {Boolean}permite a reposição do painel com exceção de painelmain(é contado automaticamente)show {Boolean}permite visibilidade (default:false)
{
top: { size: 80, resize: true, minsize: 50 }, // top panel
right: { size: 100 },
bottom: { size: 100 }, // bottom panel
left: { size: 100, resize: true }, // left panel
main: {}, // main panel
// Can contain a different template for various display types
// lg = Large display, md = Medium display, sm = Small display, xs = Extra small display
md: {
top: { show: true, size: 80 },
bottom: { show: false },
left: { show: false },
main: { show: true }
},
// Custom layouts
detail: {
// Custom display types in custom layouts
md: {
top: { show: true },
bottom: { show: true },
main: { show: true },
left: { show: false },
right: { show: true, size: 300 }
},
xs: {
top: { show: true },
bottom: { show: true },
main: { show: false },
left: { show: false },
right: { show: true, size: '100%' }
}
}
}Bom para saber:
- IMPORTANTE: Este componente deve conter metadados do layout embalado em
<script type="text/plain"></script> - Cada painel é um elemento
sectione deve conter o atributodata-type="top"com o tipo de painel. - Defina os painéis que você vai usar
- Comprar todos os elementos de
sectionnão é importante top2usa a chave de configuraçãotopright2usa a chave de configuraçãorightbottom2usa a chave de configuraçãobottom
Use-o com <ui-component name="layout">Quando o componente ainda não está carregado, jComponent Descarrega-o no primeiro uso do endereço DEF.fallback (a partir do Componentator CDN por padrão). autor: Peter Širka. fonte: o Componentator Reserva de componentes, licença MIT.
<style>
.ui-layout-section { font-size: 11px; }
</style>
<div style="width:500px;height:300px">
<ui-component name="layout" path="mylayout" config="parent:parent" class="invisible">
<!-- META DATA OF THE LAYOUT -->
<!-- VERY IMPORTANT -->
<script type="text/plain">
{
top: { size: 80, resize: true },
bottom: { size: 100 },
left: { size: 100, minsize: 50, resize: true },
right: { size: 100 },
main: {},
detail: {
left: { show: false },
right: { show: true, size: '100%' },
bottom: { show: false },
main: { show: false }
}
}
</script>
<!-- PANEL IN LAYOUT -->
<section data-type="top">
TOP
</section>
<!-- PANEL IN LAYOUT -->
<section data-type="main">
MAIN
</section>
<!-- PANEL IN LAYOUT -->
<section data-type="right">
RIGHT
</section>
<!-- PANEL IN LAYOUT -->
<section data-type="left">
LEFT
</section>
<!-- PANEL IN LAYOUT -->
<section data-type="bottom">
BOTTOM
</section>
</ui-component>
</div>
<br />
<div style="width:500px;height:300px">
<ui-component name="layout" config="parent:parent" class="invisible">
<script type="text/plain">
{
top: { size: 80, resize: 1 },
bottom: { size: 100 },
left: { size: 100 },
right: { size: 100 },
main: {}
}
</script>
<section data-type="top2">
TOP2
</section>
<section data-type="main">
MAIN
</section>
<section data-type="right">
RIGHT
</section>
<section data-type="left">
LEFT
</section>
<section data-type="bottom2">
BOTTOM2
</section>
</ui-component>
</div>
<script>
var mylayout = '';
setInterval(function() {
SET('mylayout', mylayout === 'detail' ? '' : 'detail');
}, 5000);
setInterval(function() {
SETTER('layout', 'lock', 'right');
}, 8000);
</script>