j-Dashboard
- Suporte aos dispositivos móveis
- Apoiando o toque
- Movimento
- Dragão
- Resistência
O componente espera Array de objetos.
Configuração:
axisX {Number}um tamanho da rede do eixo X (default:12)axisY {Number}um tamanho da rede do eixo Y (default:144)padding {Number}um padding entre widgets (default:10)delay {Number}Init atraso (default:200)serviceinterval {Number}um intervalo de serviço (default:5000)ondrop {String}um caminho para o métodofunction(meta) {}, é executado se alguém cair algum elemento na áreameta.xX posição de redemeta.ye posição da redemeta.el- Elementos de Caminhometa.pageXmeta.pageYmeta.offsetXmeta.offsetYmeta.targetmeta.dum modo de exibiçãoxs,sm,mdoulg
noemitresizedesabilita a execução do métodoresizeem todos os componentes nestados (default:false)parent {String}um recipiente parental que estabelece uma altura mínima (default:null)margin {Number}uma margem superior/baixo para a opçãoparent(default:0)minsizexs {Number}um tamanho mínimo de coluna/roga para exibições extras pequenas (default:2)minsizesm {Number}: tamanho mínimo de coluna/cama para pequenos ecrãs (default:2)minsizemd {Number}um tamanho mínimo de coluna/roga para exibições medianas (default:1)minsizelg {Number}um tamanho mínimo de coluna/roga para exibições grandes (default:1)- Icon de configuração
iconsettings {String} iconremove {String}remove o íconechange {String}um caminho para o métodofunction(type, id)(executado se o painel capturar uma mudançamoveouremove)animation {Number}estilo de animação:1Opacidade2: de grande a normal3de pequeno a normal (default)- Rotação de
4 5Mudança de posição X6mudança de posição Y
grid {Boolean}Render Gráfico (default:false)- NEW:
reanimate {Boolean}permite a animação para mudança de widgets (default:false)
// Component declaration
var component = {
// Component ID
id: 'COMPONENT_ID',
// Positioning
// You can define specific display size and if the display size is not specified then the component tries to find a size for larger display
offset: {
xs: { x: 1, y: 1, width: 6, height: 6 }, // Number means the position in the grid, so e.g. width "2" takes "2" columns in X axis
lg: { x: 1, y: 1, width: 6, height: 6 }
},
html: 'THE CONTENT OF COMPONENT', // or can be raw HTMLElement
// Default settings
actions: { move: true, remove: true, resize: true, resizeX: true, resizeY: true, resizeP: false, settings: true },
// resizeP means: resize "proportionally"
// Can disable header (default: true)
header: true,
// Can delay displaying (in "ms", default: config.delay)
delay: 0,
// A component title
title: 'Title for the component',
// Custom properties which will be assigned to the instance
template: Object,
config: Object,
// reset: true, // NEW: reloads the component again
// class: String // adds a class to the item
make: function(exports, config, el) {
// @exports {Object}
// @config {Object}
// @el {jQuery} a content of the component
// Handlers (optional):
exports.destroy = function() {
// @el {jQuery} a content of the component
// @this {Instance}
// is executed when the component is destroyed
};
exports.data = function(data, el) {
// @data {Object}
// @this {Instance}
// @el {jQuery} a content element of the component
// It can be executed via SETTER('dashboard/send', ....)
};
exports.service = function(counter, el) {
// @counter {Number} count of calls
// @el {jQuery} a content of the component
// @this {Instance}
// dashboard will execute this handler each 5 seconds
};
exports.focus = function() {
// Optional, when the "window" is focused the delegate will be executed
};
exports.resize = function(width, height, el, display) {
// @width {Number}
// @height {Number}
// @el {jQuery} a content of the component
// @display {String} a current display size "xs", "sm", "md" or "lg"
// @this {Instance}
// is executed when the component is resized
// @this {Instance}
};
exports.settings = function(config, el, elbtn) {
// @config {Object}
// @el {jQuery} a content element of the component
// @elbtn {jQuery} button element
// is executed when the users clicks on the settings icon
};
exports.remove = function(remove) {
// remove {Function} removes that widget
remove();
};
exports.configure = function() {
// is executed when the configuration is changed
};
// this.meta {Object} a reference to component object
// this.element {jQuery} a content element of the component
// this.container {jQuery} a main content element of the component
// this.main {Object} a reference to Dashboard component
// this.width {Number} a width of "this.element"
// this.height {Number} a height of "this.element"
// this.display {String} a current display size "xs", "sm", "md" or "lg"
// is executed when the component is making
}
};
PUSH('components', component);Métodos:
SETTER('dashboard/send', id, body)envia dados para todos os widgets que contêm o delegadodataid {String}nullpara todos os componentes@componenté enviado para os componentes específicos de acordo com o nome do componentestringé enviado para um componente específico de acordo com o identificador
SETTER('dashboard/call', method_name, [a], [b], [c], [d])executa um método em cada widgetRETURN('dashboard/pixel')retorna um tamanho do pixel (quadrado)RETURN('dashboard/display')retorna uma largura de tela atual
Bom para saber:
- O componente adiciona classes ao corpo do componente:
d_colNUMBERdetermina o número de colunas tomadas, por exemplo,d_col2d_rowNUMBERdetermina o número de linhas tomadas, por exemplo,d_row3d_squareo componente tem a mesma largura/alturad_verticalo componente tem apenas 1 passo de largura e mais de 1 passo da alturad_horizontalo componente tem apenas 1 passo de altura e mais de 1 passo da largura
Use-o com <ui-component name="dashboard">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.
<ui-component name="dashboard" path="components"></ui-component>
<script>
var components = [];
components.push({
id: 'A',
offset: { lg: { x: 0, y: 0, width: 4, height: 4 }},
title: 'A',
html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
actions: { settings: true, remove: true, move: true, resize: true },
make: function(exports, config, el) {
// If you change some action "exports.actions" then execute:
// exports.refresh();
exports.data = function(data) {
};
exports.configure = function() {
};
}
});
components.push({
id: 'B',
offset: { lg: { x: 4, y: 0, width: 4, height: 4 }},
title: 'B',
html: '<div class="padding">Lorem ipsum dolor sit amet.</div>',
actions: { settings: true, remove: true, move: true, resize: true }
});
</script>