export function initLifecycle(vm) { const options = vm.$options // locate first non-abstract parent let parent = options.parent if (parent && !options.abstract) { while (parent.$options.abstract && parent.$parent) { parent = parent.$parent } parent.$children.push(vm) } vm.$parent = parent vm.$root = parent ? parent.$root : vm vm.$children = [] vm.$refs = {} vm._watcher = null vm._inactive = null vm._directInactive = false vm._isMounted = false vm._isDestroyed = false vm._isBeingDestroyed = false }
export function activateChildComponent(vm, direct) { if (direct) { vm._directInactive = false if (isInInactiveTree(vm)) { return } } else if (vm._directInactive) { return } if (vm._inactive || vm._inactive === null) { vm._inactive = false for (let i = 0; i < vm.$children.length; i++) { activateChildComponent(vm.$children[i]) } callHook(vm, 'activated') } }
remove(parent.$children, vm)
function broadcast(componentName, eventName, params) { for (const child of this.$children) { const name = child.$options.name; if (name === componentName) { child.$emit(...[eventName].concat(params)); } else { broadcast.apply(child, [componentName, eventName].concat([params])); } } }
Opal.def(self, '$string_compose', $Default_string_compose$15 = function $$string_compose(begin_t, parts, end_t) { var $a, self = this; if ($truthy(self['$collapse_string_parts?'](parts))) { if ($truthy(($truthy($a = begin_t['$nil?']()) ? end_t['$nil?']() : $a))) { return parts.$first() } else { return self.$n("str", parts.$first().$children(), self.$string_map(begin_t, parts, end_t)) } } else { return self.$n("dstr", [].concat(Opal.to_a(parts)), self.$string_map(begin_t, parts, end_t)) } }, $Default_string_compose$15.$$arity = 3);
this.$children.each(function () { $(this) .removeClass(options.animationIn) .removeClass(options.animationOut); });
activeAide (pointInsertion, $) { if (!this.situation.aideActivee) { this.situation.activeAide(); this.journal.enregistre(new EvenementActivationAide()); } this.fenetreAide.affiche(pointInsertion, $); this.fenetreAide.vm.$children[0].$on(FERME, () => { this.fenetreAide.cache(); }); }
(function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'MatchCurrentLineNode'); var $nesting = [self].concat($parent_nesting), $MatchCurrentLineNode_compile$21; self.$handle("match_current_line"); self.$children("regexp"); return (Opal.def(self, '$compile', $MatchCurrentLineNode_compile$21 = function $$compile() { var self = this, gvar_sexp = nil, send_node = nil; gvar_sexp = self.$s("gvar", "$_"); send_node = self.$s("send", gvar_sexp, "=~", self.$regexp()); return self.$push(self.$expr(send_node)); }, $MatchCurrentLineNode_compile$21.$$arity = 0), nil) && 'compile'; })($nesting[0], $$($nesting, 'Base'), $nesting);
Opal.def(self, '$static_regexp_node', $Default_static_regexp_node$160 = function $$static_regexp_node(node) { var $a, self = this, parts = nil, options = nil; if (node.$type()['$==']("regexp")) { $a = [node.$children()['$[]']($range(0, -2, false)), node.$children()['$[]'](-1)], (parts = $a[0]), (options = $a[1]), $a; return self.$static_regexp(parts, options); } else { return nil } }, $Default_static_regexp_node$160.$$arity = 1);
Opal.def(self, '$symbol_compose', $Default_symbol_compose$20 = function $$symbol_compose(begin_t, parts, end_t) { var $a, self = this, str = nil; if ($truthy(self['$collapse_string_parts?'](parts))) { str = parts.$first(); return self.$n("sym", [str.$children().$first().$to_sym()], self.$collection_map(begin_t, str.$loc().$expression(), end_t)); } else if ($truthy((($a = self.parser.$version()['$=='](18)) ? parts['$empty?']() : self.parser.$version()['$=='](18)))) { return self.$diagnostic("error", "empty_symbol", nil, self.$loc(begin_t).$join(self.$loc(end_t))) } else { return self.$n("dsym", [].concat(Opal.to_a(parts)), self.$collection_map(begin_t, parts, end_t)) } }, $Default_symbol_compose$20.$$arity = 3);
it('should bind to a child component', () => { Vue.component('bar', { template: '<span>Hello</span>' }) vm = new Vue({ el, template: '<bar @custom="foo"></bar>', methods: { foo: spy } }) vm.$children[0].$emit('custom', 'foo', 'bar') expect(spy).toHaveBeenCalledWith('foo', 'bar') })
Opal.def(self, '$compile_arguments', $CallNode_compile_arguments$11 = function $$compile_arguments() { var self = this; self.$push(", "); if ($truthy(self['$splat?']())) { return self.$push(self.$expr(self.$arglist())) } else if ($truthy(self.$arglist().$children()['$empty?']())) { return self.$push("[]") } else { return self.$push("[", self.$expr(self.$arglist()), "]") }; }, $CallNode_compile_arguments$11.$$arity = 0);
(function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'SymbolNode'); var $nesting = [self].concat($parent_nesting), $SymbolNode_compile$11; self.$handle("sym"); self.$children("value"); return (Opal.def(self, '$compile', $SymbolNode_compile$11 = function $$compile() { var self = this; return self.$push(self.$value().$to_s().$inspect()) }, $SymbolNode_compile$11.$$arity = 0), nil) && 'compile'; })($nesting[0], $$($nesting, 'Base'), $nesting);
(function($base, $super, $parent_nesting) { var self = $klass($base, $super, 'ComplexNode'); var $nesting = [self].concat($parent_nesting), $ComplexNode_compile$33; self.$handle("complex"); self.$children("value"); return (Opal.def(self, '$compile', $ComplexNode_compile$33 = function $$compile() { var self = this; return self.$push("" + "Opal.Complex.$new(" + (self.$value().$real()) + ", " + (self.$value().$imag()) + ")") }, $ComplexNode_compile$33.$$arity = 0), nil) && 'compile'; })($nesting[0], $$($nesting, 'Base'), $nesting);