@semantic-ui/templating
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "@semantic-ui/templating", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "src/index.js", | ||
@@ -9,8 +9,8 @@ "module": "src/index.js", | ||
"dependencies": { | ||
"@semantic-ui/component": "^0.0.6", | ||
"@semantic-ui/query": "^0.0.6", | ||
"@semantic-ui/reactivity": "^0.0.6", | ||
"@semantic-ui/templating": "^0.0.6", | ||
"@semantic-ui/utils": "^0.0.6" | ||
"@semantic-ui/component": "^0.0.7", | ||
"@semantic-ui/query": "^0.0.7", | ||
"@semantic-ui/reactivity": "^0.0.7", | ||
"@semantic-ui/templating": "^0.0.7", | ||
"@semantic-ui/utils": "^0.0.7" | ||
} | ||
} |
import { $ } from '@semantic-ui/query'; | ||
import { capitalize, fatal, each, remove, generateID, isEqual, noop, isServer, inArray, isFunction, extend, clone, wrapFunction } from '@semantic-ui/utils'; | ||
import { capitalize, fatal, each, remove, generateID, isEqual, noop, isServer, inArray, isFunction, proxyObject, extend, clone, wrapFunction } from '@semantic-ui/utils'; | ||
import { Reaction } from '@semantic-ui/reactivity'; | ||
@@ -120,5 +120,7 @@ | ||
Template.addTemplate(this); | ||
this.dispatchEvent('created', { tpl: this.tpl }, {}, { triggerCallback: false }); | ||
}; | ||
this.onRendered = () => { | ||
this.call(this.onRenderedCallback); | ||
this.dispatchEvent('rendered', { tpl: this.tpl }, {}, { triggerCallback: false }); | ||
}; | ||
@@ -134,2 +136,3 @@ this.onThemeChanged = (...args) => { | ||
this.call(this.onDestroyedCallback); | ||
this.dispatchEvent('destroyed', { tpl: this.tpl }, {}, { triggerCallback: false }); | ||
}; | ||
@@ -417,3 +420,3 @@ | ||
data: this.tpl.data, | ||
settings: this.tpl.data, // Todo: extract only settings from data | ||
settings: this.element.settings, | ||
@@ -462,8 +465,12 @@ isServer: Template.isServer, | ||
// dispatches an event from this template | ||
dispatchEvent(eventName, eventData, eventSettings) { | ||
dispatchEvent(eventName, eventData, eventSettings, { triggerCallback = true } = {}) { | ||
if(Template.isServer) { | ||
return; | ||
} | ||
// call callback on DOM element if defined | ||
const callbackName = `on${capitalize(eventName)}`; | ||
const callback = this.element[callbackName]; | ||
wrapFunction(callback).call(this, eventData); | ||
if(triggerCallback) { | ||
const callbackName = `on${capitalize(eventName)}`; | ||
const callback = this.element[callbackName]; | ||
wrapFunction(callback).call(this, eventData); | ||
} | ||
@@ -470,0 +477,0 @@ // trigger DOM event |
69556
1989
+ Added@semantic-ui/component@0.0.7(transitive)
+ Added@semantic-ui/query@0.0.7(transitive)
+ Added@semantic-ui/reactivity@0.0.7(transitive)
+ Added@semantic-ui/utils@0.0.7(transitive)
- Removed@semantic-ui/component@0.0.6(transitive)
- Removed@semantic-ui/query@0.0.6(transitive)
- Removed@semantic-ui/reactivity@0.0.6(transitive)
- Removed@semantic-ui/utils@0.0.6(transitive)
Updated@semantic-ui/query@^0.0.7
Updated@semantic-ui/utils@^0.0.7