j-Dashboard
- Prend en charge les appareils mobiles
- Prend en charge les touches
- Mobile
- Travail
- Redimensionnable
Le composant attend le Array des objets.
Configuration :
axisX {Number}une taille de réseau d'axe X (defaut:12)axisY {Number}une taille de réseau d'axe Y (defaut:144)padding {Number}un tapis entre les widgets (defaut:10)delay {Number}retard de l'inité (défaut :200)serviceinterval {Number}un intervalle de service (defaut :5000)ondrop {String}est un chemin vers la méthodefunction(meta) {}, s'il y a quelqu'un qui jette un élément dans la zone.meta.xX position de réseaumeta.yet position de réseaumeta.elÉlément tracémeta.pageXmeta.pageYmeta.offsetXmeta.offsetYmeta.targetmeta.dmode d'affichagexs,sm,mdoulg
noemitresizedésactive l'exécution de la méthoderesizedans tous les composants nés (defaut:false)parent {String}un conteneur parent qui définit une hauteur minimale (par défaut :null)margin {Number}une marge de haut/bas pour l'optionparent(defaut:0)minsizexs {Number}: une taille minimale de colonne/rouge pour les écrans plus petits (defaut :2)minsizesm {Number}une taille minimale de colonne/rouge pour les petits disques (defaut:2)minsizemd {Number}une taille minimale de colonne/rouge pour les écrans médius (defaut:1)minsizelg {Number}une taille minimale de colonne/rouge pour les écrans majeurs (défaut:1)iconsettings {String}Icôneiconremove {String}supprimer l'icônechange {String}un chemin vers la méthodefunction(type, id)(exécuté si le panneau de commande capte un changementmoveouremove)- Style d'animation
animation {Number}:- Opacité
1 2De la grande à la normale3La taille de la petite à la normale (defaut)4rotation Z5changement de position X6changement de position Y
- Opacité
grid {Boolean}renders en arrière-plan (defaut :false)- NEW:
reanimate {Boolean}permet l'animation pour changer les widgets (défaut :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éthodes :
SETTER('dashboard/send', id, body)envoie des données à tous les widgets qui contiennent le déléguédataid {String}nullpour tous les composants@componentenvoie aux composants spécifiques selon le nom des composantsstringenvoie à un composant spécifique selon l'identificateur
SETTER('dashboard/call', method_name, [a], [b], [c], [d])exécute une méthode dans chaque widgetRETURN('dashboard/pixel')revient à la taille du pixel (square)- Le
RETURN('dashboard/display')revient à une largeur d'écran actuelle
Bon à savoir :
- Le composant ajoute des classes au corps du composant :
d_colNUMBERdétermine le nombre de colonnes prises par exempled_col2d_rowNUMBERdétermine le nombre de rangs pris, par exempled_row3d_squarele composant a la même largeur / hauteurd_verticalle composant n'a que 1 étape de largeur et plus d'1 étapes de hauteurd_horizontalle composant n'a que 1 étape de hauteur et plus d'un pas de largeur
Utilisez-le avec <ui-component name="dashboard">. Lorsque le composant n'est pas encore chargé, jComponent le télécharge lors de la première utilisation depuis l'adresse dans DEF.fallback (le CDN Componentator par défaut). Auteur : Peter Širka. Source : le référentiel de composants Componentator, licence 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>