-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f121fbb
commit 8c9886d
Showing
18 changed files
with
1,357 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,74 @@ | ||
define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) { | ||
"use strict"; | ||
|
||
var _prototypeProperties = function (child, staticProps, instanceProps) { | ||
if (staticProps) Object.defineProperties(child, staticProps); | ||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps); | ||
}; | ||
|
||
var TemplateController = _aureliaTemplating.TemplateController; | ||
var Property = _aureliaTemplating.Property; | ||
var BoundViewFactory = _aureliaTemplating.BoundViewFactory; | ||
var ViewSlot = _aureliaTemplating.ViewSlot; | ||
var If = function If(viewFactory, viewSlot) { | ||
this.viewFactory = viewFactory; | ||
this.viewSlot = viewSlot; | ||
this.showing = false; | ||
}; | ||
|
||
If.annotations = function () { | ||
return [new TemplateController("if"), new Property("value", "valueChanged", "if")]; | ||
}; | ||
|
||
If.inject = function () { | ||
return [BoundViewFactory, ViewSlot]; | ||
}; | ||
var If = (function () { | ||
var If = function If(viewFactory, viewSlot) { | ||
this.viewFactory = viewFactory; | ||
this.viewSlot = viewSlot; | ||
this.showing = false; | ||
}; | ||
|
||
If.prototype.valueChanged = function (newValue) { | ||
if (!newValue) { | ||
if (this.view) { | ||
this.viewSlot.remove(this.view); | ||
this.view.unbind(); | ||
_prototypeProperties(If, { | ||
annotations: { | ||
value: function () { | ||
return [new TemplateController("if"), new Property("value", "valueChanged", "if")]; | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
}, | ||
inject: { | ||
value: function () { | ||
return [BoundViewFactory, ViewSlot]; | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}, { | ||
valueChanged: { | ||
value: function (newValue) { | ||
if (!newValue) { | ||
if (this.view) { | ||
this.viewSlot.remove(this.view); | ||
this.view.unbind(); | ||
} | ||
|
||
this.showing = false; | ||
return; | ||
} | ||
this.showing = false; | ||
return; | ||
} | ||
|
||
if (!this.view) { | ||
this.view = this.viewFactory.create(); | ||
} | ||
if (!this.view) { | ||
this.view = this.viewFactory.create(); | ||
} | ||
|
||
if (!this.showing) { | ||
this.showing = true; | ||
if (!this.showing) { | ||
this.showing = true; | ||
|
||
if (!this.view.bound) { | ||
this.view.bind(); | ||
if (!this.view.bound) { | ||
this.view.bind(); | ||
} | ||
|
||
this.viewSlot.add(this.view); | ||
} | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}); | ||
|
||
this.viewSlot.add(this.view); | ||
} | ||
}; | ||
return If; | ||
})(); | ||
|
||
exports.If = If; | ||
}); |
Oops, something went wrong.