ember-source 4.4.0-alpha.4 → 4.4.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -5
- package/blueprints/-addon-import.js +9 -0
- package/blueprints/-maybe-polyfill-typescript-blueprints.js +17 -0
- package/blueprints/acceptance-test/index.js +8 -0
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/component/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component/index.js +6 -1
- package/blueprints/component-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-addon/index.js +9 -0
- package/blueprints/component-class/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-class/index.js +5 -0
- package/blueprints/component-class-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-class-addon/index.js +9 -0
- package/blueprints/component-test/index.js +8 -0
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/controller/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/controller/index.js +10 -0
- package/blueprints/controller-test/index.js +10 -0
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/helper/files/__root__/__collection__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/helper/index.js +9 -0
- package/blueprints/helper-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/helper-test/index.js +9 -0
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/initializer/files/__root__/initializers/__name__.ts +6 -0
- package/blueprints/initializer/index.js +9 -0
- package/blueprints/initializer-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/initializer-test/index.js +8 -0
- package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +3 -1
- package/blueprints/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.ts +37 -0
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.ts +6 -0
- package/blueprints/instance-initializer/index.js +9 -0
- package/blueprints/instance-initializer-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/instance-initializer-test/index.js +8 -0
- package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +5 -1
- package/blueprints/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +6 -1
- package/blueprints/route/files/__root__/__path__/{__name__.js → __name__.ts} +2 -4
- package/blueprints/route/index.js +9 -0
- package/blueprints/route-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/route-addon/index.js +9 -0
- package/blueprints/route-test/index.js +9 -0
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/service/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/service/index.js +10 -0
- package/blueprints/service-test/index.js +8 -0
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +0 -0
- package/blueprints/util/files/__root__/utils/{__name__.js → __name__.ts} +0 -0
- package/blueprints/util/index.js +10 -0
- package/blueprints/util-test/index.js +8 -0
- package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/{__name__-test.js → __name__-test.ts} +0 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +10 -12
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +7 -3
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +484 -785
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +1 -10
- package/dist/packages/@ember/-internals/glimmer/index.js +107 -218
- package/dist/packages/@ember/-internals/meta/lib/meta.js +1 -1
- package/dist/packages/@ember/-internals/metal/index.js +22 -21
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +140 -145
- package/dist/packages/@ember/-internals/routing/lib/system/route-info.js +4 -0
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +2 -0
- package/dist/packages/@ember/-internals/routing/lib/system/transition.js +4 -0
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +118 -302
- package/dist/packages/@ember/-internals/runtime/lib/system/object.js +8 -23
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +47 -29
- package/dist/packages/@ember/canary-features/index.js +1 -5
- package/dist/packages/@ember/debug/lib/deprecate.js +6 -2
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +448 -810
- package/package.json +20 -17
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -5
- package/blueprints/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +0 -34
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -5
- package/dist/packages/@ember/renderer/index.js +0 -21
package/dist/ember.debug.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
|
7
7
|
* @license Licensed under MIT license
|
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
|
9
|
-
* @version 4.4.0-alpha.
|
|
9
|
+
* @version 4.4.0-alpha.7
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -564,11 +564,6 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
564
564
|
this.normalizedName = normalizedName;
|
|
565
565
|
this.madeToString = undefined;
|
|
566
566
|
this.injections = undefined;
|
|
567
|
-
setFactoryFor(this, this);
|
|
568
|
-
|
|
569
|
-
if (isInstantiatable(container, fullName)) {
|
|
570
|
-
setFactoryFor(factory, this);
|
|
571
|
-
}
|
|
572
567
|
}
|
|
573
568
|
|
|
574
569
|
toString() {
|
|
@@ -588,14 +583,10 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
588
583
|
throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);
|
|
589
584
|
}
|
|
590
585
|
|
|
591
|
-
var props = {};
|
|
586
|
+
var props = options ? Object.assign({}, options) : {};
|
|
592
587
|
(0, _owner.setOwner)(props, container.owner);
|
|
593
588
|
setFactoryFor(props, this);
|
|
594
589
|
|
|
595
|
-
if (options !== undefined) {
|
|
596
|
-
props = Object.assign({}, props, options);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
590
|
if (true
|
|
600
591
|
/* DEBUG */
|
|
601
592
|
) {
|
|
@@ -4712,12 +4703,35 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4712
4703
|
|
|
4713
4704
|
var lazyEventsProcessed = new WeakMap();
|
|
4714
4705
|
|
|
4715
|
-
|
|
4716
|
-
|
|
4706
|
+
class Component extends _views.CoreView.extend(_views.ChildViewsSupport, _views.ViewStateSupport, _views.ClassNamesSupport, _runtime2.TargetActionSupport, _views.ActionSupport, _views.ViewMixin, {
|
|
4707
|
+
// These need to be overridable via extend/create but should still
|
|
4708
|
+
// have a default. Defining them here is the best way to achieve that.
|
|
4709
|
+
didReceiveAttrs() {},
|
|
4717
4710
|
|
|
4718
|
-
|
|
4719
|
-
this._super(...arguments);
|
|
4711
|
+
didRender() {},
|
|
4720
4712
|
|
|
4713
|
+
didUpdate() {},
|
|
4714
|
+
|
|
4715
|
+
didUpdateAttrs() {},
|
|
4716
|
+
|
|
4717
|
+
willRender() {},
|
|
4718
|
+
|
|
4719
|
+
willUpdate() {}
|
|
4720
|
+
|
|
4721
|
+
}) {
|
|
4722
|
+
constructor() {
|
|
4723
|
+
super(...arguments);
|
|
4724
|
+
this.isComponent = true;
|
|
4725
|
+
}
|
|
4726
|
+
|
|
4727
|
+
init(properties) {
|
|
4728
|
+
super.init(properties); // Handle methods from ViewMixin.
|
|
4729
|
+
// The native class inheritance will not work for mixins. To work around this,
|
|
4730
|
+
// we copy the existing rerender method provided by the mixin and swap in the
|
|
4731
|
+
// new rerender method from our class.
|
|
4732
|
+
|
|
4733
|
+
this._superRerender = this.rerender;
|
|
4734
|
+
this.rerender = this._rerender;
|
|
4721
4735
|
this[IS_DISPATCHING_ATTRS] = false;
|
|
4722
4736
|
this[DIRTY_TAG] = (0, _validator.createTag)();
|
|
4723
4737
|
this[BOUNDS] = null;
|
|
@@ -4753,7 +4767,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4753
4767
|
for (var key in events) {
|
|
4754
4768
|
var methodName = events[key];
|
|
4755
4769
|
|
|
4756
|
-
if (typeof this[methodName] === 'function') {
|
|
4770
|
+
if (methodName && typeof this[methodName] === 'function') {
|
|
4757
4771
|
eventNames.push(methodName);
|
|
4758
4772
|
}
|
|
4759
4773
|
} // If in a tagless component, assert that no event handlers are defined
|
|
@@ -4761,7 +4775,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4761
4775
|
|
|
4762
4776
|
(true && !(!eventNames.length) && (0, _debug.assert)(`You can not define \`${eventNames}\` function(s) to handle DOM event in the \`${this}\` tagless component since it doesn't have any DOM element.`, !eventNames.length));
|
|
4763
4777
|
}
|
|
4764
|
-
}
|
|
4778
|
+
}
|
|
4765
4779
|
|
|
4766
4780
|
get _dispatcher() {
|
|
4767
4781
|
if (this.__dispatcher === undefined) {
|
|
@@ -4769,8 +4783,9 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4769
4783
|
(true && !(owner) && (0, _debug.assert)('Component is unexpectedly missing an owner', owner));
|
|
4770
4784
|
|
|
4771
4785
|
if (owner.lookup('-environment:main').isInteractive) {
|
|
4772
|
-
|
|
4773
|
-
(true && !(
|
|
4786
|
+
var dispatcher = owner.lookup('event_dispatcher:main');
|
|
4787
|
+
(true && !(dispatcher instanceof _views.EventDispatcher) && (0, _debug.assert)('Expected dispatcher to be an EventDispatcher', dispatcher instanceof _views.EventDispatcher));
|
|
4788
|
+
this.__dispatcher = dispatcher;
|
|
4774
4789
|
} else {
|
|
4775
4790
|
// In FastBoot we have no EventDispatcher. Set to null to not try again to look it up.
|
|
4776
4791
|
this.__dispatcher = null;
|
|
@@ -4778,20 +4793,24 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4778
4793
|
}
|
|
4779
4794
|
|
|
4780
4795
|
return this.__dispatcher;
|
|
4781
|
-
}
|
|
4796
|
+
}
|
|
4782
4797
|
|
|
4783
|
-
on(
|
|
4798
|
+
on(name, target, method) {
|
|
4784
4799
|
var _a;
|
|
4785
4800
|
|
|
4786
|
-
(_a = this._dispatcher) === null || _a === void 0 ? void 0 : _a.setupHandlerForEmberEvent(
|
|
4787
|
-
|
|
4788
|
-
|
|
4801
|
+
(_a = this._dispatcher) === null || _a === void 0 ? void 0 : _a.setupHandlerForEmberEvent(name); // The `on` method here comes from the Evented mixin. Since this mixin
|
|
4802
|
+
// is applied to the parent of this class, however, we are still able
|
|
4803
|
+
// to use `super`.
|
|
4789
4804
|
|
|
4790
|
-
|
|
4805
|
+
return super.on(name, target, method);
|
|
4806
|
+
} // Changed to `rerender` on init
|
|
4807
|
+
|
|
4808
|
+
|
|
4809
|
+
_rerender() {
|
|
4791
4810
|
(0, _validator.dirtyTag)(this[DIRTY_TAG]);
|
|
4792
4811
|
|
|
4793
|
-
this.
|
|
4794
|
-
}
|
|
4812
|
+
this._superRerender();
|
|
4813
|
+
}
|
|
4795
4814
|
|
|
4796
4815
|
[_metal.PROPERTY_DID_CHANGE](key, value) {
|
|
4797
4816
|
if (this[IS_DISPATCHING_ATTRS]) {
|
|
@@ -4804,39 +4823,40 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4804
4823
|
if (reference !== undefined && (0, _reference.isUpdatableRef)(reference)) {
|
|
4805
4824
|
(0, _reference.updateRef)(reference, arguments.length === 2 ? value : (0, _metal.get)(this, key));
|
|
4806
4825
|
}
|
|
4807
|
-
}
|
|
4826
|
+
}
|
|
4808
4827
|
|
|
4809
4828
|
getAttr(key) {
|
|
4810
4829
|
// TODO Intimate API should be deprecated
|
|
4811
4830
|
return this.get(key);
|
|
4812
|
-
}
|
|
4813
|
-
|
|
4831
|
+
}
|
|
4814
4832
|
/**
|
|
4815
4833
|
Normally, Ember's component model is "write-only". The component takes a
|
|
4816
4834
|
bunch of attributes that it got passed in, and uses them to render its
|
|
4817
4835
|
template.
|
|
4818
|
-
|
|
4836
|
+
One nice thing about this model is that if you try to set a value to the
|
|
4819
4837
|
same thing as last time, Ember (through HTMLBars) will avoid doing any
|
|
4820
4838
|
work on the DOM.
|
|
4821
|
-
|
|
4839
|
+
This is not just a performance optimization. If an attribute has not
|
|
4822
4840
|
changed, it is important not to clobber the element's "hidden state".
|
|
4823
4841
|
For example, if you set an input's `value` to the same value as before,
|
|
4824
4842
|
it will clobber selection state and cursor position. In other words,
|
|
4825
4843
|
setting an attribute is not **always** idempotent.
|
|
4826
|
-
|
|
4844
|
+
This method provides a way to read an element's attribute and also
|
|
4827
4845
|
update the last value Ember knows about at the same time. This makes
|
|
4828
4846
|
setting an attribute idempotent.
|
|
4829
|
-
|
|
4847
|
+
In particular, what this means is that if you get an `<input>` element's
|
|
4830
4848
|
`value` attribute and then re-render the template with the same value,
|
|
4831
4849
|
it will avoid clobbering the cursor and selection position.
|
|
4832
4850
|
Since most attribute sets are idempotent in the browser, you typically
|
|
4833
4851
|
can get away with reading attributes using jQuery, but the most reliable
|
|
4834
4852
|
way to do so is through this method.
|
|
4835
4853
|
@method readDOMAttr
|
|
4836
|
-
|
|
4854
|
+
@param {String} name the name of the attribute
|
|
4837
4855
|
@return String
|
|
4838
4856
|
@public
|
|
4839
|
-
|
|
4857
|
+
*/
|
|
4858
|
+
|
|
4859
|
+
|
|
4840
4860
|
readDOMAttr(name) {
|
|
4841
4861
|
// TODO revisit this
|
|
4842
4862
|
var _element = (0, _views.getViewElement)(this);
|
|
@@ -4856,207 +4876,61 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4856
4876
|
}
|
|
4857
4877
|
|
|
4858
4878
|
return element[normalized];
|
|
4859
|
-
}
|
|
4860
|
-
|
|
4861
|
-
/**
|
|
4862
|
-
The WAI-ARIA role of the control represented by this view. For example, a
|
|
4863
|
-
button may have a role of type 'button', or a pane may have a role of
|
|
4864
|
-
type 'alertdialog'. This property is used by assistive software to help
|
|
4865
|
-
visually challenged users navigate rich web applications.
|
|
4866
|
-
The full list of valid WAI-ARIA roles is available at:
|
|
4867
|
-
[https://www.w3.org/TR/wai-aria/#roles_categorization](https://www.w3.org/TR/wai-aria/#roles_categorization)
|
|
4868
|
-
@property ariaRole
|
|
4869
|
-
@type String
|
|
4870
|
-
@default null
|
|
4871
|
-
@public
|
|
4872
|
-
*/
|
|
4873
|
-
|
|
4874
|
-
/**
|
|
4875
|
-
Enables components to take a list of parameters as arguments.
|
|
4876
|
-
For example, a component that takes two parameters with the names
|
|
4877
|
-
`name` and `age`:
|
|
4878
|
-
```app/components/my-component.js
|
|
4879
|
-
import Component from '@ember/component';
|
|
4880
|
-
let MyComponent = Component.extend();
|
|
4881
|
-
MyComponent.reopenClass({
|
|
4882
|
-
positionalParams: ['name', 'age']
|
|
4883
|
-
});
|
|
4884
|
-
export default MyComponent;
|
|
4885
|
-
```
|
|
4886
|
-
It can then be invoked like this:
|
|
4887
|
-
```hbs
|
|
4888
|
-
{{my-component "John" 38}}
|
|
4889
|
-
```
|
|
4890
|
-
The parameters can be referred to just like named parameters:
|
|
4891
|
-
```hbs
|
|
4892
|
-
Name: {{name}}, Age: {{age}}.
|
|
4893
|
-
```
|
|
4894
|
-
Using a string instead of an array allows for an arbitrary number of
|
|
4895
|
-
parameters:
|
|
4896
|
-
```app/components/my-component.js
|
|
4897
|
-
import Component from '@ember/component';
|
|
4898
|
-
let MyComponent = Component.extend();
|
|
4899
|
-
MyComponent.reopenClass({
|
|
4900
|
-
positionalParams: 'names'
|
|
4901
|
-
});
|
|
4902
|
-
export default MyComponent;
|
|
4903
|
-
```
|
|
4904
|
-
It can then be invoked like this:
|
|
4905
|
-
```hbs
|
|
4906
|
-
{{my-component "John" "Michael" "Scott"}}
|
|
4907
|
-
```
|
|
4908
|
-
The parameters can then be referred to by enumerating over the list:
|
|
4909
|
-
```hbs
|
|
4910
|
-
{{#each names as |name|}}{{name}}{{/each}}
|
|
4911
|
-
```
|
|
4912
|
-
@static
|
|
4913
|
-
@public
|
|
4914
|
-
@property positionalParams
|
|
4915
|
-
@since 1.13.0
|
|
4916
|
-
*/
|
|
4917
|
-
|
|
4918
|
-
/**
|
|
4919
|
-
Called when the attributes passed into the component have been updated.
|
|
4920
|
-
Called both during the initial render of a container and during a rerender.
|
|
4921
|
-
Can be used in place of an observer; code placed here will be executed
|
|
4922
|
-
every time any attribute updates.
|
|
4923
|
-
@method didReceiveAttrs
|
|
4924
|
-
@public
|
|
4925
|
-
@since 1.13.0
|
|
4926
|
-
*/
|
|
4927
|
-
didReceiveAttrs() {},
|
|
4928
|
-
|
|
4929
|
-
/**
|
|
4930
|
-
Called when the attributes passed into the component have been updated.
|
|
4931
|
-
Called both during the initial render of a container and during a rerender.
|
|
4932
|
-
Can be used in place of an observer; code placed here will be executed
|
|
4933
|
-
every time any attribute updates.
|
|
4934
|
-
@event didReceiveAttrs
|
|
4935
|
-
@public
|
|
4936
|
-
@since 1.13.0
|
|
4937
|
-
*/
|
|
4938
|
-
|
|
4939
|
-
/**
|
|
4940
|
-
Called after a component has been rendered, both on initial render and
|
|
4941
|
-
in subsequent rerenders.
|
|
4942
|
-
@method didRender
|
|
4943
|
-
@public
|
|
4944
|
-
@since 1.13.0
|
|
4945
|
-
*/
|
|
4946
|
-
didRender() {},
|
|
4947
|
-
|
|
4948
|
-
/**
|
|
4949
|
-
Called after a component has been rendered, both on initial render and
|
|
4950
|
-
in subsequent rerenders.
|
|
4951
|
-
@event didRender
|
|
4952
|
-
@public
|
|
4953
|
-
@since 1.13.0
|
|
4954
|
-
*/
|
|
4955
|
-
|
|
4956
|
-
/**
|
|
4957
|
-
Called before a component has been rendered, both on initial render and
|
|
4958
|
-
in subsequent rerenders.
|
|
4959
|
-
@method willRender
|
|
4960
|
-
@public
|
|
4961
|
-
@since 1.13.0
|
|
4962
|
-
*/
|
|
4963
|
-
willRender() {},
|
|
4964
|
-
|
|
4965
|
-
/**
|
|
4966
|
-
Called before a component has been rendered, both on initial render and
|
|
4967
|
-
in subsequent rerenders.
|
|
4968
|
-
@event willRender
|
|
4969
|
-
@public
|
|
4970
|
-
@since 1.13.0
|
|
4971
|
-
*/
|
|
4972
|
-
|
|
4973
|
-
/**
|
|
4974
|
-
Called when the attributes passed into the component have been changed.
|
|
4975
|
-
Called only during a rerender, not during an initial render.
|
|
4976
|
-
@method didUpdateAttrs
|
|
4977
|
-
@public
|
|
4978
|
-
@since 1.13.0
|
|
4979
|
-
*/
|
|
4980
|
-
didUpdateAttrs() {},
|
|
4981
|
-
|
|
4982
|
-
/**
|
|
4983
|
-
Called when the attributes passed into the component have been changed.
|
|
4984
|
-
Called only during a rerender, not during an initial render.
|
|
4985
|
-
@event didUpdateAttrs
|
|
4986
|
-
@public
|
|
4987
|
-
@since 1.13.0
|
|
4988
|
-
*/
|
|
4879
|
+
}
|
|
4989
4880
|
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
@method willUpdate
|
|
4994
|
-
@public
|
|
4995
|
-
@since 1.13.0
|
|
4996
|
-
*/
|
|
4997
|
-
willUpdate() {},
|
|
4881
|
+
static toString() {
|
|
4882
|
+
return '@ember/component';
|
|
4883
|
+
}
|
|
4998
4884
|
|
|
4999
|
-
|
|
5000
|
-
Called when the component is about to update and rerender itself.
|
|
5001
|
-
Called only during a rerender, not during an initial render.
|
|
5002
|
-
@event willUpdate
|
|
5003
|
-
@public
|
|
5004
|
-
@since 1.13.0
|
|
5005
|
-
*/
|
|
4885
|
+
}
|
|
5006
4886
|
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
Called only during a rerender, not during an initial render.
|
|
5010
|
-
@method didUpdate
|
|
5011
|
-
@public
|
|
5012
|
-
@since 1.13.0
|
|
5013
|
-
*/
|
|
5014
|
-
didUpdate() {}
|
|
5015
|
-
/**
|
|
5016
|
-
Called when the component has updated and rerendered itself.
|
|
5017
|
-
Called only during a rerender, not during an initial render.
|
|
5018
|
-
@event didUpdate
|
|
5019
|
-
@public
|
|
5020
|
-
@since 1.13.0
|
|
5021
|
-
*/
|
|
4887
|
+
_exports.Component = Component;
|
|
4888
|
+
Component.isComponentFactory = true; // We continue to use reopenClass here so that positionalParams can be overridden with reopenClass in subclasses.
|
|
5022
4889
|
|
|
4890
|
+
Component.reopenClass({
|
|
5023
4891
|
/**
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
4892
|
+
Enables components to take a list of parameters as arguments.
|
|
4893
|
+
For example, a component that takes two parameters with the names
|
|
4894
|
+
`name` and `age`:
|
|
4895
|
+
```app/components/my-component.js
|
|
4896
|
+
import Component from '@ember/component';
|
|
4897
|
+
let MyComponent = Component.extend();
|
|
4898
|
+
MyComponent.reopenClass({
|
|
4899
|
+
positionalParams: ['name', 'age']
|
|
4900
|
+
});
|
|
4901
|
+
export default MyComponent;
|
|
5028
4902
|
```
|
|
5029
|
-
|
|
5030
|
-
|
|
4903
|
+
It can then be invoked like this:
|
|
4904
|
+
```hbs
|
|
4905
|
+
{{my-component "John" 38}}
|
|
5031
4906
|
```
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
}
|
|
4907
|
+
The parameters can be referred to just like named parameters:
|
|
4908
|
+
```hbs
|
|
4909
|
+
Name: {{name}}, Age: {{age}}.
|
|
4910
|
+
```
|
|
4911
|
+
Using a string instead of an array allows for an arbitrary number of
|
|
4912
|
+
parameters:
|
|
4913
|
+
```app/components/my-component.js
|
|
4914
|
+
import Component from '@ember/component';
|
|
4915
|
+
let MyComponent = Component.extend();
|
|
4916
|
+
MyComponent.reopenClass({
|
|
4917
|
+
positionalParams: 'names'
|
|
5044
4918
|
});
|
|
4919
|
+
export default MyComponent;
|
|
5045
4920
|
```
|
|
5046
|
-
|
|
5047
|
-
|
|
4921
|
+
It can then be invoked like this:
|
|
4922
|
+
```hbs
|
|
4923
|
+
{{my-component "John" "Michael" "Scott"}}
|
|
4924
|
+
```
|
|
4925
|
+
The parameters can then be referred to by enumerating over the list:
|
|
4926
|
+
```hbs
|
|
4927
|
+
{{#each names as |name|}}{{name}}{{/each}}
|
|
4928
|
+
```
|
|
4929
|
+
@static
|
|
5048
4930
|
@public
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
});
|
|
5053
|
-
|
|
5054
|
-
_exports.Component = Component;
|
|
5055
|
-
|
|
5056
|
-
Component.toString = () => '@ember/component';
|
|
5057
|
-
|
|
5058
|
-
Component.reopenClass({
|
|
5059
|
-
isComponentFactory: true,
|
|
4931
|
+
@property positionalParams
|
|
4932
|
+
@since 1.13.0
|
|
4933
|
+
*/
|
|
5060
4934
|
positionalParams: []
|
|
5061
4935
|
});
|
|
5062
4936
|
(0, _manager2.setInternalComponentManager)(CURLY_COMPONENT_MANAGER, Component);
|
|
@@ -5070,8 +4944,8 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5070
4944
|
var IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
5071
4945
|
|
|
5072
4946
|
class Helper extends _runtime2.FrameworkObject {
|
|
5073
|
-
init() {
|
|
5074
|
-
super.init();
|
|
4947
|
+
init(properties) {
|
|
4948
|
+
super.init(properties);
|
|
5075
4949
|
this[RECOMPUTE_TAG] = (0, _validator.createTag)();
|
|
5076
4950
|
}
|
|
5077
4951
|
/**
|
|
@@ -6562,7 +6436,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
6562
6436
|
@module ember
|
|
6563
6437
|
*/
|
|
6564
6438
|
|
|
6565
|
-
internalHelper(() => {
|
|
6439
|
+
var uniqueId = internalHelper(() => {
|
|
6566
6440
|
return (0, _reference.createConstRef)(uniqueId$1(), 'unique-id');
|
|
6567
6441
|
}); // From https://gist.github.com/selfish/fef2c0ba6cdfe07af76e64cecd74888b
|
|
6568
6442
|
//
|
|
@@ -7261,6 +7135,9 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7261
7135
|
get: _runtime.get,
|
|
7262
7136
|
hash: _runtime.hash
|
|
7263
7137
|
});
|
|
7138
|
+
{
|
|
7139
|
+
BUILTIN_HELPERS['unique-id'] = uniqueId;
|
|
7140
|
+
}
|
|
7264
7141
|
var BUILTIN_KEYWORD_MODIFIERS = {
|
|
7265
7142
|
action: actionModifier
|
|
7266
7143
|
};
|
|
@@ -8605,7 +8482,7 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
8605
8482
|
/* ADD */
|
|
8606
8483
|
&& kind === 0
|
|
8607
8484
|
/* ADD */
|
|
8608
|
-
&& listener.sync !== sync)) && (0, _debug.assert)(`You attempted to add an observer for the same method on '${event.split(':')[0]}' twice to ${target} as both sync and async. Observers must be either sync or async, they cannot be both. This is likely a mistake, you should either remove the code that added the observer a second time, or update it to always be sync or async. The method was ${method}.`, !(listener.kind === 0 && kind === 0 && listener.sync !== sync))); // update own listener
|
|
8485
|
+
&& listener.sync !== sync)) && (0, _debug.assert)(`You attempted to add an observer for the same method on '${event.split(':')[0]}' twice to ${target} as both sync and async. Observers must be either sync or async, they cannot be both. This is likely a mistake, you should either remove the code that added the observer a second time, or update it to always be sync or async. The method was ${String(method)}.`, !(listener.kind === 0 && kind === 0 && listener.sync !== sync))); // update own listener
|
|
8609
8486
|
|
|
8610
8487
|
listener.kind = kind;
|
|
8611
8488
|
listener.sync = sync;
|
|
@@ -8964,6 +8841,7 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
8964
8841
|
}
|
|
8965
8842
|
});
|
|
8966
8843
|
_exports.hasListeners = hasListeners;
|
|
8844
|
+
_exports.hasUnknownProperty = hasUnknownProperty;
|
|
8967
8845
|
_exports.inject = inject;
|
|
8968
8846
|
_exports.isBlank = isBlank;
|
|
8969
8847
|
_exports.isClassicDecorator = isClassicDecorator;
|
|
@@ -10889,6 +10767,10 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
10889
10767
|
};
|
|
10890
10768
|
}
|
|
10891
10769
|
|
|
10770
|
+
function hasUnknownProperty(val) {
|
|
10771
|
+
return typeof val === 'object' && val !== null && typeof val.unknownProperty === 'function';
|
|
10772
|
+
}
|
|
10773
|
+
|
|
10892
10774
|
function get(obj, keyName) {
|
|
10893
10775
|
(true && !(arguments.length === 2) && (0, _debug.assert)(`Get must be called with two arguments; an object and a property key`, arguments.length === 2));
|
|
10894
10776
|
(true && !(obj !== undefined && obj !== null) && (0, _debug.assert)(`Cannot call get with '${keyName}' on an undefined object.`, obj !== undefined && obj !== null));
|
|
@@ -10913,7 +10795,7 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
10913
10795
|
value = obj[keyName];
|
|
10914
10796
|
}
|
|
10915
10797
|
|
|
10916
|
-
if (value === undefined && typeof obj === 'object' && !(keyName in obj) &&
|
|
10798
|
+
if (value === undefined && typeof obj === 'object' && !(keyName in obj) && hasUnknownProperty(obj)) {
|
|
10917
10799
|
value = obj.unknownProperty(keyName);
|
|
10918
10800
|
}
|
|
10919
10801
|
|
|
@@ -11314,7 +11196,7 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
11314
11196
|
return true;
|
|
11315
11197
|
}
|
|
11316
11198
|
|
|
11317
|
-
if (
|
|
11199
|
+
if (!hasUnknownProperty(obj) && typeof obj.size === 'number') {
|
|
11318
11200
|
return !obj.size;
|
|
11319
11201
|
}
|
|
11320
11202
|
|
|
@@ -12640,40 +12522,38 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
12640
12522
|
_exports.TrackedDescriptor = TrackedDescriptor;
|
|
12641
12523
|
|
|
12642
12524
|
var cached = function () {
|
|
12643
|
-
{
|
|
12644
|
-
|
|
12645
|
-
|
|
12646
|
-
}
|
|
12525
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key13 = 0; _key13 < _len12; _key13++) {
|
|
12526
|
+
args[_key13] = arguments[_key13];
|
|
12527
|
+
}
|
|
12647
12528
|
|
|
12648
|
-
|
|
12529
|
+
var [target, key, descriptor] = args; // Error on `@cached()`, `@cached(...args)`, and `@cached propName = value;`
|
|
12649
12530
|
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12531
|
+
if (true
|
|
12532
|
+
/* DEBUG */
|
|
12533
|
+
&& target === undefined) throwCachedExtraneousParens();
|
|
12653
12534
|
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12535
|
+
if (true
|
|
12536
|
+
/* DEBUG */
|
|
12537
|
+
&& (typeof target !== 'object' || typeof key !== 'string' || typeof descriptor !== 'object' || args.length !== 3)) {
|
|
12538
|
+
throwCachedInvalidArgsError(args);
|
|
12539
|
+
}
|
|
12659
12540
|
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12541
|
+
if (true
|
|
12542
|
+
/* DEBUG */
|
|
12543
|
+
&& (!('get' in descriptor) || typeof descriptor.get !== 'function')) {
|
|
12544
|
+
throwCachedGetterOnlyError(key);
|
|
12545
|
+
}
|
|
12665
12546
|
|
|
12666
|
-
|
|
12667
|
-
|
|
12547
|
+
var caches = new WeakMap();
|
|
12548
|
+
var getter = descriptor.get;
|
|
12668
12549
|
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12550
|
+
descriptor.get = function () {
|
|
12551
|
+
if (!caches.has(this)) {
|
|
12552
|
+
caches.set(this, (0, _validator.createCache)(getter.bind(this)));
|
|
12553
|
+
}
|
|
12673
12554
|
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
}
|
|
12555
|
+
return (0, _validator.getValue)(caches.get(this));
|
|
12556
|
+
};
|
|
12677
12557
|
};
|
|
12678
12558
|
|
|
12679
12559
|
_exports.cached = cached;
|
|
@@ -14366,151 +14246,6 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14366
14246
|
}
|
|
14367
14247
|
|
|
14368
14248
|
class RouterService extends _service.default.extend(_runtime.Evented) {
|
|
14369
|
-
constructor() {
|
|
14370
|
-
super(...arguments);
|
|
14371
|
-
/**
|
|
14372
|
-
You can register a listener for events emitted by this service with `.on()`:
|
|
14373
|
-
```app/routes/contact-form.js
|
|
14374
|
-
import Route from '@ember/routing';
|
|
14375
|
-
import { service } from '@ember/service';
|
|
14376
|
-
export default class extends Route {
|
|
14377
|
-
@service router;
|
|
14378
|
-
activate() {
|
|
14379
|
-
this.router.on('routeWillChange', (transition) => {
|
|
14380
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14381
|
-
alert("Please save or cancel your changes.");
|
|
14382
|
-
transition.abort();
|
|
14383
|
-
}
|
|
14384
|
-
})
|
|
14385
|
-
}
|
|
14386
|
-
}
|
|
14387
|
-
```
|
|
14388
|
-
@method on
|
|
14389
|
-
@param {String} eventName
|
|
14390
|
-
@param {Function} callback
|
|
14391
|
-
@public
|
|
14392
|
-
*/
|
|
14393
|
-
|
|
14394
|
-
/**
|
|
14395
|
-
You can unregister a listener for events emitted by this service with `.off()`:
|
|
14396
|
-
```app/routes/contact-form.js
|
|
14397
|
-
import Route from '@ember/routing';
|
|
14398
|
-
import { service } from '@ember/service';
|
|
14399
|
-
export default class extends Route {
|
|
14400
|
-
@service router;
|
|
14401
|
-
callback = (transition) => {
|
|
14402
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14403
|
-
alert("Please save or cancel your changes.");
|
|
14404
|
-
transition.abort();
|
|
14405
|
-
}
|
|
14406
|
-
};
|
|
14407
|
-
activate() {
|
|
14408
|
-
this.router.on('routeWillChange', this.callback);
|
|
14409
|
-
}
|
|
14410
|
-
deactivate() {
|
|
14411
|
-
this.router.off('routeWillChange', this.callback);
|
|
14412
|
-
}
|
|
14413
|
-
```
|
|
14414
|
-
@method off
|
|
14415
|
-
@param {String} eventName
|
|
14416
|
-
@param {Function} callback
|
|
14417
|
-
@public
|
|
14418
|
-
*/
|
|
14419
|
-
|
|
14420
|
-
/**
|
|
14421
|
-
The `routeWillChange` event is fired at the beginning of any
|
|
14422
|
-
attempted transition with a `Transition` object as the sole
|
|
14423
|
-
argument. This action can be used for aborting, redirecting,
|
|
14424
|
-
or decorating the transition from the currently active routes.
|
|
14425
|
-
A good example is preventing navigation when a form is
|
|
14426
|
-
half-filled out:
|
|
14427
|
-
```app/routes/contact-form.js
|
|
14428
|
-
import Route from '@ember/routing';
|
|
14429
|
-
import { service } from '@ember/service';
|
|
14430
|
-
export default class extends Route {
|
|
14431
|
-
@service router;
|
|
14432
|
-
activate() {
|
|
14433
|
-
this.router.on('routeWillChange', (transition) => {
|
|
14434
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14435
|
-
alert("Please save or cancel your changes.");
|
|
14436
|
-
transition.abort();
|
|
14437
|
-
}
|
|
14438
|
-
})
|
|
14439
|
-
}
|
|
14440
|
-
}
|
|
14441
|
-
```
|
|
14442
|
-
The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.
|
|
14443
|
-
@event routeWillChange
|
|
14444
|
-
@param {Transition} transition
|
|
14445
|
-
@public
|
|
14446
|
-
*/
|
|
14447
|
-
|
|
14448
|
-
/**
|
|
14449
|
-
The `routeDidChange` event only fires once a transition has settled.
|
|
14450
|
-
This includes aborts and error substates. Like the `routeWillChange` event
|
|
14451
|
-
it receives a Transition as the sole argument.
|
|
14452
|
-
A good example is sending some analytics when the route has transitioned:
|
|
14453
|
-
```app/routes/contact-form.js
|
|
14454
|
-
import Route from '@ember/routing';
|
|
14455
|
-
import { service } from '@ember/service';
|
|
14456
|
-
export default class extends Route {
|
|
14457
|
-
@service router;
|
|
14458
|
-
activate() {
|
|
14459
|
-
this.router.on('routeDidChange', (transition) => {
|
|
14460
|
-
ga.send('pageView', {
|
|
14461
|
-
current: transition.to.name,
|
|
14462
|
-
from: transition.from.name
|
|
14463
|
-
});
|
|
14464
|
-
})
|
|
14465
|
-
}
|
|
14466
|
-
}
|
|
14467
|
-
```
|
|
14468
|
-
`routeDidChange` will be called after any `Route`'s
|
|
14469
|
-
[didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)
|
|
14470
|
-
action has been fired.
|
|
14471
|
-
The updates of properties
|
|
14472
|
-
[currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),
|
|
14473
|
-
[currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)
|
|
14474
|
-
and
|
|
14475
|
-
[currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)
|
|
14476
|
-
are completed at the time `routeDidChange` is called.
|
|
14477
|
-
@event routeDidChange
|
|
14478
|
-
@param {Transition} transition
|
|
14479
|
-
@public
|
|
14480
|
-
*/
|
|
14481
|
-
// Canary features
|
|
14482
|
-
|
|
14483
|
-
/**
|
|
14484
|
-
* Refreshes all currently active routes, doing a full transition.
|
|
14485
|
-
* If a route name is provided and refers to a currently active route,
|
|
14486
|
-
* it will refresh only that route and its descendents.
|
|
14487
|
-
* Returns a promise that will be resolved once the refresh is complete.
|
|
14488
|
-
* All resetController, beforeModel, model, afterModel, redirect, and setupController
|
|
14489
|
-
* hooks will be called again. You will get new data from the model hook.
|
|
14490
|
-
*
|
|
14491
|
-
* @method refresh
|
|
14492
|
-
* @param {String} [routeName] the route to refresh (along with all child routes)
|
|
14493
|
-
* @return Transition
|
|
14494
|
-
* @category EMBER_ROUTING_ROUTER_SERVICE_REFRESH
|
|
14495
|
-
* @public
|
|
14496
|
-
*/
|
|
14497
|
-
|
|
14498
|
-
this.refresh = true
|
|
14499
|
-
/* EMBER_ROUTING_ROUTER_SERVICE_REFRESH */
|
|
14500
|
-
? function (pivotRouteName) {
|
|
14501
|
-
if (!pivotRouteName) {
|
|
14502
|
-
return this._router._routerMicrolib.refresh();
|
|
14503
|
-
}
|
|
14504
|
-
|
|
14505
|
-
(true && !(this._router.hasRoute(pivotRouteName)) && (0, _debug.assert)(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName)));
|
|
14506
|
-
(true && !(this.isActive(pivotRouteName)) && (0, _debug.assert)(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName)));
|
|
14507
|
-
var owner = (0, _owner.getOwner)(this);
|
|
14508
|
-
(true && !(owner) && (0, _debug.assert)('RouterService is unexpectedly missing an owner', owner));
|
|
14509
|
-
var pivotRoute = owner.lookup(`route:${pivotRouteName}`);
|
|
14510
|
-
return this._router._routerMicrolib.refresh(pivotRoute);
|
|
14511
|
-
} : undefined;
|
|
14512
|
-
}
|
|
14513
|
-
|
|
14514
14249
|
get _router() {
|
|
14515
14250
|
var router = this[ROUTER];
|
|
14516
14251
|
|
|
@@ -14846,6 +14581,146 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14846
14581
|
var internalURL = cleanURL(url, this.rootURL);
|
|
14847
14582
|
return this._router._routerMicrolib.recognizeAndLoad(internalURL);
|
|
14848
14583
|
}
|
|
14584
|
+
/**
|
|
14585
|
+
You can register a listener for events emitted by this service with `.on()`:
|
|
14586
|
+
```app/routes/contact-form.js
|
|
14587
|
+
import Route from '@ember/routing';
|
|
14588
|
+
import { service } from '@ember/service';
|
|
14589
|
+
export default class extends Route {
|
|
14590
|
+
@service router;
|
|
14591
|
+
activate() {
|
|
14592
|
+
this.router.on('routeWillChange', (transition) => {
|
|
14593
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14594
|
+
alert("Please save or cancel your changes.");
|
|
14595
|
+
transition.abort();
|
|
14596
|
+
}
|
|
14597
|
+
})
|
|
14598
|
+
}
|
|
14599
|
+
}
|
|
14600
|
+
```
|
|
14601
|
+
@method on
|
|
14602
|
+
@param {String} eventName
|
|
14603
|
+
@param {Function} callback
|
|
14604
|
+
@public
|
|
14605
|
+
*/
|
|
14606
|
+
|
|
14607
|
+
/**
|
|
14608
|
+
You can unregister a listener for events emitted by this service with `.off()`:
|
|
14609
|
+
```app/routes/contact-form.js
|
|
14610
|
+
import Route from '@ember/routing';
|
|
14611
|
+
import { service } from '@ember/service';
|
|
14612
|
+
export default class extends Route {
|
|
14613
|
+
@service router;
|
|
14614
|
+
callback = (transition) => {
|
|
14615
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14616
|
+
alert("Please save or cancel your changes.");
|
|
14617
|
+
transition.abort();
|
|
14618
|
+
}
|
|
14619
|
+
};
|
|
14620
|
+
activate() {
|
|
14621
|
+
this.router.on('routeWillChange', this.callback);
|
|
14622
|
+
}
|
|
14623
|
+
deactivate() {
|
|
14624
|
+
this.router.off('routeWillChange', this.callback);
|
|
14625
|
+
}
|
|
14626
|
+
```
|
|
14627
|
+
@method off
|
|
14628
|
+
@param {String} eventName
|
|
14629
|
+
@param {Function} callback
|
|
14630
|
+
@public
|
|
14631
|
+
*/
|
|
14632
|
+
|
|
14633
|
+
/**
|
|
14634
|
+
The `routeWillChange` event is fired at the beginning of any
|
|
14635
|
+
attempted transition with a `Transition` object as the sole
|
|
14636
|
+
argument. This action can be used for aborting, redirecting,
|
|
14637
|
+
or decorating the transition from the currently active routes.
|
|
14638
|
+
A good example is preventing navigation when a form is
|
|
14639
|
+
half-filled out:
|
|
14640
|
+
```app/routes/contact-form.js
|
|
14641
|
+
import Route from '@ember/routing';
|
|
14642
|
+
import { service } from '@ember/service';
|
|
14643
|
+
export default class extends Route {
|
|
14644
|
+
@service router;
|
|
14645
|
+
activate() {
|
|
14646
|
+
this.router.on('routeWillChange', (transition) => {
|
|
14647
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
14648
|
+
alert("Please save or cancel your changes.");
|
|
14649
|
+
transition.abort();
|
|
14650
|
+
}
|
|
14651
|
+
})
|
|
14652
|
+
}
|
|
14653
|
+
}
|
|
14654
|
+
```
|
|
14655
|
+
The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.
|
|
14656
|
+
@event routeWillChange
|
|
14657
|
+
@param {Transition} transition
|
|
14658
|
+
@public
|
|
14659
|
+
*/
|
|
14660
|
+
|
|
14661
|
+
/**
|
|
14662
|
+
The `routeDidChange` event only fires once a transition has settled.
|
|
14663
|
+
This includes aborts and error substates. Like the `routeWillChange` event
|
|
14664
|
+
it receives a Transition as the sole argument.
|
|
14665
|
+
A good example is sending some analytics when the route has transitioned:
|
|
14666
|
+
```app/routes/contact-form.js
|
|
14667
|
+
import Route from '@ember/routing';
|
|
14668
|
+
import { service } from '@ember/service';
|
|
14669
|
+
export default class extends Route {
|
|
14670
|
+
@service router;
|
|
14671
|
+
activate() {
|
|
14672
|
+
this.router.on('routeDidChange', (transition) => {
|
|
14673
|
+
ga.send('pageView', {
|
|
14674
|
+
current: transition.to.name,
|
|
14675
|
+
from: transition.from.name
|
|
14676
|
+
});
|
|
14677
|
+
})
|
|
14678
|
+
}
|
|
14679
|
+
}
|
|
14680
|
+
```
|
|
14681
|
+
`routeDidChange` will be called after any `Route`'s
|
|
14682
|
+
[didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)
|
|
14683
|
+
action has been fired.
|
|
14684
|
+
The updates of properties
|
|
14685
|
+
[currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),
|
|
14686
|
+
[currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)
|
|
14687
|
+
and
|
|
14688
|
+
[currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)
|
|
14689
|
+
are completed at the time `routeDidChange` is called.
|
|
14690
|
+
@event routeDidChange
|
|
14691
|
+
@param {Transition} transition
|
|
14692
|
+
@public
|
|
14693
|
+
*/
|
|
14694
|
+
|
|
14695
|
+
/**
|
|
14696
|
+
* Refreshes all currently active routes, doing a full transition.
|
|
14697
|
+
* If a route name is provided and refers to a currently active route,
|
|
14698
|
+
* it will refresh only that route and its descendents.
|
|
14699
|
+
* Returns a promise that will be resolved once the refresh is complete.
|
|
14700
|
+
* All resetController, beforeModel, model, afterModel, redirect, and setupController
|
|
14701
|
+
* hooks will be called again. You will get new data from the model hook.
|
|
14702
|
+
*
|
|
14703
|
+
* @method refresh
|
|
14704
|
+
* @param {String} [routeName] the route to refresh (along with all child routes)
|
|
14705
|
+
* @return Transition
|
|
14706
|
+
* @public
|
|
14707
|
+
*/
|
|
14708
|
+
|
|
14709
|
+
|
|
14710
|
+
refresh(pivotRouteName) {
|
|
14711
|
+
if (!pivotRouteName) {
|
|
14712
|
+
return this._router._routerMicrolib.refresh();
|
|
14713
|
+
}
|
|
14714
|
+
|
|
14715
|
+
(true && !(this._router.hasRoute(pivotRouteName)) && (0, _debug.assert)(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName)));
|
|
14716
|
+
(true && !(this.isActive(pivotRouteName)) && (0, _debug.assert)(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName)));
|
|
14717
|
+
var owner = (0, _owner.getOwner)(this);
|
|
14718
|
+
(true && !(owner) && (0, _debug.assert)('RouterService is unexpectedly missing an owner', owner));
|
|
14719
|
+
var pivotRoute = owner.lookup(`route:${pivotRouteName}`); // R could be instantiated with a different sub-type
|
|
14720
|
+
// @ts-ignore
|
|
14721
|
+
|
|
14722
|
+
return this._router._routerMicrolib.refresh(pivotRoute);
|
|
14723
|
+
}
|
|
14849
14724
|
|
|
14850
14725
|
}
|
|
14851
14726
|
|
|
@@ -17363,6 +17238,8 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
17363
17238
|
seen[name] = true;
|
|
17364
17239
|
|
|
17365
17240
|
if (!route) {
|
|
17241
|
+
// SAFETY: this is configured in `commonSetupRegistry` in the
|
|
17242
|
+
// `@ember/application/lib` package.
|
|
17366
17243
|
var DefaultRoute = routeOwner.factoryFor('route:basic').class;
|
|
17367
17244
|
routeOwner.register(fullRouteName, DefaultRoute.extend());
|
|
17368
17245
|
route = routeOwner.lookup(fullRouteName);
|
|
@@ -18880,6 +18757,10 @@ define("@ember/-internals/routing/lib/system/router_state", ["exports", "@ember/
|
|
|
18880
18757
|
});
|
|
18881
18758
|
define("@ember/-internals/routing/lib/system/transition", [], function () {
|
|
18882
18759
|
"use strict";
|
|
18760
|
+
/**
|
|
18761
|
+
@module @ember/routing
|
|
18762
|
+
*/
|
|
18763
|
+
|
|
18883
18764
|
/**
|
|
18884
18765
|
A Transition is a thennable (a promise-like object) that represents
|
|
18885
18766
|
an attempt to transition to another route. It can be aborted, either
|
|
@@ -23603,6 +23484,14 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23603
23484
|
/**
|
|
23604
23485
|
@module @ember/object
|
|
23605
23486
|
*/
|
|
23487
|
+
function hasSetUnknownProperty(val) {
|
|
23488
|
+
return typeof val === 'object' && val !== null && typeof val.setUnknownProperty === 'function';
|
|
23489
|
+
}
|
|
23490
|
+
|
|
23491
|
+
function hasToStringExtension(val) {
|
|
23492
|
+
return typeof val === 'object' && val !== null && typeof val.toStringExtension === 'function';
|
|
23493
|
+
}
|
|
23494
|
+
|
|
23606
23495
|
var reopen = _metal.Mixin.prototype.reopen;
|
|
23607
23496
|
var wasApplied = new _util._WeakSet();
|
|
23608
23497
|
var prototypeMixinMap = new WeakMap();
|
|
@@ -23626,12 +23515,9 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23626
23515
|
(true && !(!(properties instanceof _metal.Mixin)) && (0, _debug.assert)('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _metal.Mixin)));
|
|
23627
23516
|
var concatenatedProperties = obj.concatenatedProperties;
|
|
23628
23517
|
var mergedProperties = obj.mergedProperties;
|
|
23629
|
-
var hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
|
|
23630
|
-
var hasMergedProps = mergedProperties !== undefined && mergedProperties.length > 0;
|
|
23631
23518
|
var keyNames = Object.keys(properties);
|
|
23632
23519
|
|
|
23633
|
-
for (var
|
|
23634
|
-
var keyName = keyNames[i];
|
|
23520
|
+
for (var keyName of keyNames) {
|
|
23635
23521
|
var value = properties[keyName];
|
|
23636
23522
|
(true && !(!(0, _metal.isClassicDecorator)(value)) && (0, _debug.assert)('EmberObject.create no longer supports defining computed ' + 'properties. Define computed properties using extend() or reopen() ' + 'before calling create().', !(0, _metal.isClassicDecorator)(value)));
|
|
23637
23523
|
(true && !(!(typeof value === 'function' && value.toString().indexOf('._super') !== -1)) && (0, _debug.assert)('EmberObject.create no longer supports defining methods that call _super.', !(typeof value === 'function' && value.toString().indexOf('._super') !== -1)));
|
|
@@ -23640,7 +23526,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23640
23526
|
var isDescriptor = possibleDesc !== undefined;
|
|
23641
23527
|
|
|
23642
23528
|
if (!isDescriptor) {
|
|
23643
|
-
if (
|
|
23529
|
+
if (concatenatedProperties !== undefined && concatenatedProperties.length > 0 && concatenatedProperties.includes(keyName)) {
|
|
23644
23530
|
var baseValue = obj[keyName];
|
|
23645
23531
|
|
|
23646
23532
|
if (baseValue) {
|
|
@@ -23650,7 +23536,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23650
23536
|
}
|
|
23651
23537
|
}
|
|
23652
23538
|
|
|
23653
|
-
if (
|
|
23539
|
+
if (mergedProperties !== undefined && mergedProperties.length > 0 && mergedProperties.includes(keyName)) {
|
|
23654
23540
|
var _baseValue = obj[keyName];
|
|
23655
23541
|
value = Object.assign({}, _baseValue, value);
|
|
23656
23542
|
}
|
|
@@ -23658,7 +23544,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23658
23544
|
|
|
23659
23545
|
if (isDescriptor) {
|
|
23660
23546
|
possibleDesc.set(obj, keyName, value);
|
|
23661
|
-
} else if (
|
|
23547
|
+
} else if (hasSetUnknownProperty(obj) && !(keyName in obj)) {
|
|
23662
23548
|
obj.setUnknownProperty(keyName, value);
|
|
23663
23549
|
} else {
|
|
23664
23550
|
if (true
|
|
@@ -23684,86 +23570,24 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23684
23570
|
var observerEvents = m.observerEvents();
|
|
23685
23571
|
|
|
23686
23572
|
if (observerEvents !== undefined) {
|
|
23687
|
-
for (var
|
|
23688
|
-
(0, _metal.activateObserver)(obj, observerEvents[
|
|
23573
|
+
for (var i = 0; i < observerEvents.length; i++) {
|
|
23574
|
+
(0, _metal.activateObserver)(obj, observerEvents[i].event, observerEvents[i].sync);
|
|
23689
23575
|
}
|
|
23690
23576
|
}
|
|
23691
23577
|
|
|
23692
|
-
(0, _metal.sendEvent)(obj, 'init', undefined, undefined,
|
|
23578
|
+
(0, _metal.sendEvent)(obj, 'init', undefined, undefined, m);
|
|
23693
23579
|
}
|
|
23694
|
-
/**
|
|
23695
|
-
`CoreObject` is the base class for all Ember constructs. It establishes a
|
|
23696
|
-
class system based on Ember's Mixin system, and provides the basis for the
|
|
23697
|
-
Ember Object Model. `CoreObject` should generally not be used directly,
|
|
23698
|
-
instead you should use `EmberObject`.
|
|
23699
|
-
|
|
23700
|
-
## Usage
|
|
23701
|
-
|
|
23702
|
-
You can define a class by extending from `CoreObject` using the `extend`
|
|
23703
|
-
method:
|
|
23704
|
-
|
|
23705
|
-
```js
|
|
23706
|
-
const Person = CoreObject.extend({
|
|
23707
|
-
name: 'Tomster',
|
|
23708
|
-
});
|
|
23709
|
-
```
|
|
23710
|
-
|
|
23711
|
-
For detailed usage, see the [Object Model](https://guides.emberjs.com/release/object-model/)
|
|
23712
|
-
section of the guides.
|
|
23713
|
-
|
|
23714
|
-
## Usage with Native Classes
|
|
23715
|
-
|
|
23716
|
-
Native JavaScript `class` syntax can be used to extend from any `CoreObject`
|
|
23717
|
-
based class:
|
|
23718
|
-
|
|
23719
|
-
```js
|
|
23720
|
-
class Person extends CoreObject {
|
|
23721
|
-
init() {
|
|
23722
|
-
super.init(...arguments);
|
|
23723
|
-
this.name = 'Tomster';
|
|
23724
|
-
}
|
|
23725
|
-
}
|
|
23726
|
-
```
|
|
23727
|
-
|
|
23728
|
-
Some notes about `class` usage:
|
|
23729
|
-
|
|
23730
|
-
* `new` syntax is not currently supported with classes that extend from
|
|
23731
|
-
`EmberObject` or `CoreObject`. You must continue to use the `create` method
|
|
23732
|
-
when making new instances of classes, even if they are defined using native
|
|
23733
|
-
class syntax. If you want to use `new` syntax, consider creating classes
|
|
23734
|
-
which do _not_ extend from `EmberObject` or `CoreObject`. Ember features,
|
|
23735
|
-
such as computed properties and decorators, will still work with base-less
|
|
23736
|
-
classes.
|
|
23737
|
-
* Instead of using `this._super()`, you must use standard `super` syntax in
|
|
23738
|
-
native classes. See the [MDN docs on classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Super_class_calls_with_super)
|
|
23739
|
-
for more details.
|
|
23740
|
-
* Native classes support using [constructors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Constructor)
|
|
23741
|
-
to set up newly-created instances. Ember uses these to, among other things,
|
|
23742
|
-
support features that need to retrieve other entities by name, like Service
|
|
23743
|
-
injection and `getOwner`. To ensure your custom instance setup logic takes
|
|
23744
|
-
place after this important work is done, avoid using the `constructor` in
|
|
23745
|
-
favor of `init`.
|
|
23746
|
-
* Properties passed to `create` will be available on the instance by the time
|
|
23747
|
-
`init` runs, so any code that requires these values should work at that
|
|
23748
|
-
time.
|
|
23749
|
-
* Using native classes, and switching back to the old Ember Object model is
|
|
23750
|
-
fully supported.
|
|
23751
|
-
|
|
23752
|
-
@class CoreObject
|
|
23753
|
-
@public
|
|
23754
|
-
*/
|
|
23755
|
-
|
|
23756
23580
|
|
|
23757
23581
|
class CoreObject {
|
|
23758
23582
|
constructor(owner) {
|
|
23759
23583
|
this[_owner2.OWNER] = owner; // prepare prototype...
|
|
23760
23584
|
|
|
23761
23585
|
this.constructor.proto();
|
|
23762
|
-
var self
|
|
23586
|
+
var self;
|
|
23763
23587
|
|
|
23764
23588
|
if (true
|
|
23765
23589
|
/* DEBUG */
|
|
23766
|
-
&&
|
|
23590
|
+
&& (0, _metal.hasUnknownProperty)(this)) {
|
|
23767
23591
|
var messageFor = (obj, property) => {
|
|
23768
23592
|
return `You attempted to access the \`${String(property)}\` property (of ${obj}).\n` + `Since Ember 3.1, this is usually fine as you no longer need to use \`.get()\`\n` + `to access computed properties. However, in this case, the object in question\n` + `is a special kind of Ember object (a proxy). Therefore, it is still necessary\n` + `to use \`.get('${String(property)}')\` in this case.\n\n` + `If you encountered this error because of third-party code that you don't control,\n` + `there is more information at https://github.com/emberjs/ember.js/issues/16148, and\n` + `you can help us improve this error message by telling us more about what happened in\n` + `this situation.`;
|
|
23769
23593
|
};
|
|
@@ -23787,10 +23611,13 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23787
23611
|
}
|
|
23788
23612
|
|
|
23789
23613
|
});
|
|
23614
|
+
} else {
|
|
23615
|
+
self = this;
|
|
23790
23616
|
}
|
|
23791
23617
|
|
|
23618
|
+
var destroyable = self;
|
|
23792
23619
|
(0, _destroyable.registerDestructor)(self, ensureDestroyCalled, true);
|
|
23793
|
-
(0, _destroyable.registerDestructor)(self, () =>
|
|
23620
|
+
(0, _destroyable.registerDestructor)(self, () => destroyable.willDestroy()); // disable chains
|
|
23794
23621
|
|
|
23795
23622
|
var m = (0, _meta2.meta)(self);
|
|
23796
23623
|
m.setInitializing(); // only return when in debug builds and `self` is the proxy created above
|
|
@@ -23813,61 +23640,61 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23813
23640
|
/**
|
|
23814
23641
|
An overridable method called when objects are instantiated. By default,
|
|
23815
23642
|
does nothing unless it is overridden during class definition.
|
|
23816
|
-
|
|
23817
|
-
|
|
23643
|
+
Example:
|
|
23644
|
+
```javascript
|
|
23818
23645
|
import EmberObject from '@ember/object';
|
|
23819
|
-
|
|
23646
|
+
const Person = EmberObject.extend({
|
|
23820
23647
|
init() {
|
|
23821
23648
|
alert(`Name is ${this.get('name')}`);
|
|
23822
23649
|
}
|
|
23823
23650
|
});
|
|
23824
|
-
|
|
23651
|
+
let steve = Person.create({
|
|
23825
23652
|
name: 'Steve'
|
|
23826
23653
|
});
|
|
23827
|
-
|
|
23654
|
+
// alerts 'Name is Steve'.
|
|
23828
23655
|
```
|
|
23829
|
-
|
|
23656
|
+
NOTE: If you do override `init` for a framework class like `Component`
|
|
23830
23657
|
from `@ember/component`, be sure to call `this._super(...arguments)`
|
|
23831
23658
|
in your `init` declaration!
|
|
23832
23659
|
If you don't, Ember may not have an opportunity to
|
|
23833
23660
|
do important setup work, and you'll see strange behavior in your
|
|
23834
23661
|
application.
|
|
23835
|
-
|
|
23662
|
+
@method init
|
|
23836
23663
|
@public
|
|
23837
23664
|
*/
|
|
23838
23665
|
|
|
23839
23666
|
|
|
23840
|
-
init() {}
|
|
23667
|
+
init(_properties) {}
|
|
23841
23668
|
/**
|
|
23842
23669
|
Defines the properties that will be concatenated from the superclass
|
|
23843
23670
|
(instead of overridden).
|
|
23844
|
-
|
|
23671
|
+
By default, when you extend an Ember class a property defined in
|
|
23845
23672
|
the subclass overrides a property with the same name that is defined
|
|
23846
23673
|
in the superclass. However, there are some cases where it is preferable
|
|
23847
23674
|
to build up a property's value by combining the superclass' property
|
|
23848
23675
|
value with the subclass' value. An example of this in use within Ember
|
|
23849
23676
|
is the `classNames` property of `Component` from `@ember/component`.
|
|
23850
|
-
|
|
23677
|
+
Here is some sample code showing the difference between a concatenated
|
|
23851
23678
|
property and a normal one:
|
|
23852
|
-
|
|
23679
|
+
```javascript
|
|
23853
23680
|
import EmberObject from '@ember/object';
|
|
23854
|
-
|
|
23681
|
+
const Bar = EmberObject.extend({
|
|
23855
23682
|
// Configure which properties to concatenate
|
|
23856
23683
|
concatenatedProperties: ['concatenatedProperty'],
|
|
23857
|
-
|
|
23684
|
+
someNonConcatenatedProperty: ['bar'],
|
|
23858
23685
|
concatenatedProperty: ['bar']
|
|
23859
23686
|
});
|
|
23860
|
-
|
|
23687
|
+
const FooBar = Bar.extend({
|
|
23861
23688
|
someNonConcatenatedProperty: ['foo'],
|
|
23862
23689
|
concatenatedProperty: ['foo']
|
|
23863
23690
|
});
|
|
23864
|
-
|
|
23691
|
+
let fooBar = FooBar.create();
|
|
23865
23692
|
fooBar.get('someNonConcatenatedProperty'); // ['foo']
|
|
23866
23693
|
fooBar.get('concatenatedProperty'); // ['bar', 'foo']
|
|
23867
23694
|
```
|
|
23868
|
-
|
|
23695
|
+
This behavior extends to object creation as well. Continuing the
|
|
23869
23696
|
above example:
|
|
23870
|
-
|
|
23697
|
+
```javascript
|
|
23871
23698
|
let fooBar = FooBar.create({
|
|
23872
23699
|
someNonConcatenatedProperty: ['baz'],
|
|
23873
23700
|
concatenatedProperty: ['baz']
|
|
@@ -23875,23 +23702,23 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23875
23702
|
fooBar.get('someNonConcatenatedProperty'); // ['baz']
|
|
23876
23703
|
fooBar.get('concatenatedProperty'); // ['bar', 'foo', 'baz']
|
|
23877
23704
|
```
|
|
23878
|
-
|
|
23879
|
-
|
|
23705
|
+
Adding a single property that is not an array will just add it in the array:
|
|
23706
|
+
```javascript
|
|
23880
23707
|
let fooBar = FooBar.create({
|
|
23881
23708
|
concatenatedProperty: 'baz'
|
|
23882
23709
|
})
|
|
23883
23710
|
view.get('concatenatedProperty'); // ['bar', 'foo', 'baz']
|
|
23884
23711
|
```
|
|
23885
|
-
|
|
23712
|
+
Using the `concatenatedProperties` property, we can tell Ember to mix the
|
|
23886
23713
|
content of the properties.
|
|
23887
|
-
|
|
23714
|
+
In `Component` the `classNames`, `classNameBindings` and
|
|
23888
23715
|
`attributeBindings` properties are concatenated.
|
|
23889
|
-
|
|
23716
|
+
This feature is available for you to use throughout the Ember object model,
|
|
23890
23717
|
although typical app developers are likely to use it infrequently. Since
|
|
23891
23718
|
it changes expectations about behavior of properties, you should properly
|
|
23892
23719
|
document its usage in each individual concatenated property (to not
|
|
23893
23720
|
mislead your users to think they can override the property in a subclass).
|
|
23894
|
-
|
|
23721
|
+
@property concatenatedProperties
|
|
23895
23722
|
@type Array
|
|
23896
23723
|
@default null
|
|
23897
23724
|
@public
|
|
@@ -23900,20 +23727,20 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23900
23727
|
/**
|
|
23901
23728
|
Defines the properties that will be merged from the superclass
|
|
23902
23729
|
(instead of overridden).
|
|
23903
|
-
|
|
23730
|
+
By default, when you extend an Ember class a property defined in
|
|
23904
23731
|
the subclass overrides a property with the same name that is defined
|
|
23905
23732
|
in the superclass. However, there are some cases where it is preferable
|
|
23906
23733
|
to build up a property's value by merging the superclass property value
|
|
23907
23734
|
with the subclass property's value. An example of this in use within Ember
|
|
23908
23735
|
is the `queryParams` property of routes.
|
|
23909
|
-
|
|
23736
|
+
Here is some sample code showing the difference between a merged
|
|
23910
23737
|
property and a normal one:
|
|
23911
|
-
|
|
23738
|
+
```javascript
|
|
23912
23739
|
import EmberObject from '@ember/object';
|
|
23913
|
-
|
|
23740
|
+
const Bar = EmberObject.extend({
|
|
23914
23741
|
// Configure which properties are to be merged
|
|
23915
23742
|
mergedProperties: ['mergedProperty'],
|
|
23916
|
-
|
|
23743
|
+
someNonMergedProperty: {
|
|
23917
23744
|
nonMerged: 'superclass value of nonMerged'
|
|
23918
23745
|
},
|
|
23919
23746
|
mergedProperty: {
|
|
@@ -23921,7 +23748,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23921
23748
|
limit: { replace: true }
|
|
23922
23749
|
}
|
|
23923
23750
|
});
|
|
23924
|
-
|
|
23751
|
+
const FooBar = Bar.extend({
|
|
23925
23752
|
someNonMergedProperty: {
|
|
23926
23753
|
completelyNonMerged: 'subclass value of nonMerged'
|
|
23927
23754
|
},
|
|
@@ -23929,13 +23756,13 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23929
23756
|
limit: { replace: false }
|
|
23930
23757
|
}
|
|
23931
23758
|
});
|
|
23932
|
-
|
|
23933
|
-
|
|
23759
|
+
let fooBar = FooBar.create();
|
|
23760
|
+
fooBar.get('someNonMergedProperty');
|
|
23934
23761
|
// => { completelyNonMerged: 'subclass value of nonMerged' }
|
|
23935
23762
|
//
|
|
23936
23763
|
// Note the entire object, including the nonMerged property of
|
|
23937
23764
|
// the superclass object, has been replaced
|
|
23938
|
-
|
|
23765
|
+
fooBar.get('mergedProperty');
|
|
23939
23766
|
// => {
|
|
23940
23767
|
// page: {replace: false},
|
|
23941
23768
|
// limit: {replace: false}
|
|
@@ -23945,15 +23772,15 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23945
23772
|
// `limit` property's value of `false` has been merged from
|
|
23946
23773
|
// the subclass.
|
|
23947
23774
|
```
|
|
23948
|
-
|
|
23775
|
+
This behavior is not available during object `create` calls. It is only
|
|
23949
23776
|
available at `extend` time.
|
|
23950
|
-
|
|
23951
|
-
|
|
23777
|
+
In `Route` the `queryParams` property is merged.
|
|
23778
|
+
This feature is available for you to use throughout the Ember object model,
|
|
23952
23779
|
although typical app developers are likely to use it infrequently. Since
|
|
23953
23780
|
it changes expectations about behavior of properties, you should properly
|
|
23954
23781
|
document its usage in each individual merged property (to not
|
|
23955
23782
|
mislead your users to think they can override the property in a subclass).
|
|
23956
|
-
|
|
23783
|
+
@property mergedProperties
|
|
23957
23784
|
@type Array
|
|
23958
23785
|
@default null
|
|
23959
23786
|
@public
|
|
@@ -23961,9 +23788,9 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23961
23788
|
|
|
23962
23789
|
/**
|
|
23963
23790
|
Destroyed object property flag.
|
|
23964
|
-
|
|
23791
|
+
if this property is `true` the observers and bindings were already
|
|
23965
23792
|
removed by the effect of calling the `destroy()` method.
|
|
23966
|
-
|
|
23793
|
+
@property isDestroyed
|
|
23967
23794
|
@default false
|
|
23968
23795
|
@public
|
|
23969
23796
|
*/
|
|
@@ -23973,14 +23800,14 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23973
23800
|
return (0, _destroyable.isDestroyed)(this);
|
|
23974
23801
|
}
|
|
23975
23802
|
|
|
23976
|
-
set isDestroyed(
|
|
23803
|
+
set isDestroyed(_value) {
|
|
23977
23804
|
(true && !(false) && (0, _debug.assert)(`You cannot set \`${this}.isDestroyed\` directly, please use \`.destroy()\`.`, false));
|
|
23978
23805
|
}
|
|
23979
23806
|
/**
|
|
23980
23807
|
Destruction scheduled flag. The `destroy()` method has been called.
|
|
23981
|
-
|
|
23808
|
+
The object stays intact until the end of the run loop at which point
|
|
23982
23809
|
the `isDestroyed` flag is set.
|
|
23983
|
-
|
|
23810
|
+
@property isDestroying
|
|
23984
23811
|
@default false
|
|
23985
23812
|
@public
|
|
23986
23813
|
*/
|
|
@@ -23990,17 +23817,17 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
23990
23817
|
return (0, _destroyable.isDestroying)(this);
|
|
23991
23818
|
}
|
|
23992
23819
|
|
|
23993
|
-
set isDestroying(
|
|
23820
|
+
set isDestroying(_value) {
|
|
23994
23821
|
(true && !(false) && (0, _debug.assert)(`You cannot set \`${this}.isDestroying\` directly, please use \`.destroy()\`.`, false));
|
|
23995
23822
|
}
|
|
23996
23823
|
/**
|
|
23997
23824
|
Destroys an object by setting the `isDestroyed` flag and removing its
|
|
23998
23825
|
metadata, which effectively destroys observers and bindings.
|
|
23999
|
-
|
|
23826
|
+
If you try to set a property on a destroyed object, an exception will be
|
|
24000
23827
|
raised.
|
|
24001
|
-
|
|
23828
|
+
Note that destruction is scheduled for the end of the run loop and does not
|
|
24002
23829
|
happen immediately. It will set an isDestroying flag immediately.
|
|
24003
|
-
|
|
23830
|
+
@method destroy
|
|
24004
23831
|
@return {EmberObject} receiver
|
|
24005
23832
|
@public
|
|
24006
23833
|
*/
|
|
@@ -24020,7 +23847,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24020
23847
|
}
|
|
24021
23848
|
/**
|
|
24022
23849
|
Override to implement teardown.
|
|
24023
|
-
|
|
23850
|
+
@method willDestroy
|
|
24024
23851
|
@public
|
|
24025
23852
|
*/
|
|
24026
23853
|
|
|
@@ -24030,22 +23857,22 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24030
23857
|
Returns a string representation which attempts to provide more information
|
|
24031
23858
|
than Javascript's `toString` typically does, in a generic way for all Ember
|
|
24032
23859
|
objects.
|
|
24033
|
-
|
|
23860
|
+
```javascript
|
|
24034
23861
|
import EmberObject from '@ember/object';
|
|
24035
|
-
|
|
23862
|
+
const Person = EmberObject.extend();
|
|
24036
23863
|
person = Person.create();
|
|
24037
23864
|
person.toString(); //=> "<Person:ember1024>"
|
|
24038
23865
|
```
|
|
24039
|
-
|
|
23866
|
+
If the object's class is not defined on an Ember namespace, it will
|
|
24040
23867
|
indicate it is a subclass of the registered superclass:
|
|
24041
|
-
|
|
23868
|
+
```javascript
|
|
24042
23869
|
const Student = Person.extend();
|
|
24043
23870
|
let student = Student.create();
|
|
24044
23871
|
student.toString(); //=> "<(subclass of Person):ember1025>"
|
|
24045
23872
|
```
|
|
24046
|
-
|
|
23873
|
+
If the method `toStringExtension` is defined, its return value will be
|
|
24047
23874
|
included in the output.
|
|
24048
|
-
|
|
23875
|
+
```javascript
|
|
24049
23876
|
const Teacher = Person.extend({
|
|
24050
23877
|
toStringExtension() {
|
|
24051
23878
|
return this.get('fullName');
|
|
@@ -24054,133 +23881,34 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24054
23881
|
teacher = Teacher.create();
|
|
24055
23882
|
teacher.toString(); //=> "<Teacher:ember1026:Tom Dale>"
|
|
24056
23883
|
```
|
|
24057
|
-
|
|
23884
|
+
@method toString
|
|
24058
23885
|
@return {String} string representation
|
|
24059
23886
|
@public
|
|
24060
23887
|
*/
|
|
24061
23888
|
|
|
24062
23889
|
|
|
24063
23890
|
toString() {
|
|
24064
|
-
var
|
|
24065
|
-
var extension = hasToStringExtension ? `:${this.toStringExtension()}` : '';
|
|
23891
|
+
var extension = hasToStringExtension(this) ? `:${this.toStringExtension()}` : '';
|
|
24066
23892
|
return `<${(0, _container.getFactoryFor)(this) || '(unknown)'}:${(0, _utils.guidFor)(this)}${extension}>`;
|
|
24067
23893
|
}
|
|
24068
|
-
/**
|
|
24069
|
-
Creates a new subclass.
|
|
24070
|
-
```javascript
|
|
24071
|
-
import EmberObject from '@ember/object';
|
|
24072
|
-
const Person = EmberObject.extend({
|
|
24073
|
-
say(thing) {
|
|
24074
|
-
alert(thing);
|
|
24075
|
-
}
|
|
24076
|
-
});
|
|
24077
|
-
```
|
|
24078
|
-
This defines a new subclass of EmberObject: `Person`. It contains one method: `say()`.
|
|
24079
|
-
You can also create a subclass from any existing class by calling its `extend()` method.
|
|
24080
|
-
For example, you might want to create a subclass of Ember's built-in `Component` class:
|
|
24081
|
-
```javascript
|
|
24082
|
-
import Component from '@ember/component';
|
|
24083
|
-
const PersonComponent = Component.extend({
|
|
24084
|
-
tagName: 'li',
|
|
24085
|
-
classNameBindings: ['isAdministrator']
|
|
24086
|
-
});
|
|
24087
|
-
```
|
|
24088
|
-
When defining a subclass, you can override methods but still access the
|
|
24089
|
-
implementation of your parent class by calling the special `_super()` method:
|
|
24090
|
-
```javascript
|
|
24091
|
-
import EmberObject from '@ember/object';
|
|
24092
|
-
const Person = EmberObject.extend({
|
|
24093
|
-
say(thing) {
|
|
24094
|
-
let name = this.get('name');
|
|
24095
|
-
alert(`${name} says: ${thing}`);
|
|
24096
|
-
}
|
|
24097
|
-
});
|
|
24098
|
-
const Soldier = Person.extend({
|
|
24099
|
-
say(thing) {
|
|
24100
|
-
this._super(`${thing}, sir!`);
|
|
24101
|
-
},
|
|
24102
|
-
march(numberOfHours) {
|
|
24103
|
-
alert(`${this.get('name')} marches for ${numberOfHours} hours.`);
|
|
24104
|
-
}
|
|
24105
|
-
});
|
|
24106
|
-
let yehuda = Soldier.create({
|
|
24107
|
-
name: 'Yehuda Katz'
|
|
24108
|
-
});
|
|
24109
|
-
yehuda.say('Yes'); // alerts "Yehuda Katz says: Yes, sir!"
|
|
24110
|
-
```
|
|
24111
|
-
The `create()` on line #17 creates an *instance* of the `Soldier` class.
|
|
24112
|
-
The `extend()` on line #8 creates a *subclass* of `Person`. Any instance
|
|
24113
|
-
of the `Person` class will *not* have the `march()` method.
|
|
24114
|
-
You can also pass `Mixin` classes to add additional properties to the subclass.
|
|
24115
|
-
```javascript
|
|
24116
|
-
import EmberObject from '@ember/object';
|
|
24117
|
-
import Mixin from '@ember/object/mixin';
|
|
24118
|
-
const Person = EmberObject.extend({
|
|
24119
|
-
say(thing) {
|
|
24120
|
-
alert(`${this.get('name')} says: ${thing}`);
|
|
24121
|
-
}
|
|
24122
|
-
});
|
|
24123
|
-
const SingingMixin = Mixin.create({
|
|
24124
|
-
sing(thing) {
|
|
24125
|
-
alert(`${this.get('name')} sings: la la la ${thing}`);
|
|
24126
|
-
}
|
|
24127
|
-
});
|
|
24128
|
-
const BroadwayStar = Person.extend(SingingMixin, {
|
|
24129
|
-
dance() {
|
|
24130
|
-
alert(`${this.get('name')} dances: tap tap tap tap `);
|
|
24131
|
-
}
|
|
24132
|
-
});
|
|
24133
|
-
```
|
|
24134
|
-
The `BroadwayStar` class contains three methods: `say()`, `sing()`, and `dance()`.
|
|
24135
|
-
@method extend
|
|
24136
|
-
@static
|
|
24137
|
-
@for @ember/object
|
|
24138
|
-
@param {Mixin} [mixins]* One or more Mixin classes
|
|
24139
|
-
@param {Object} [arguments]* Object containing values to use within the new class
|
|
24140
|
-
@public
|
|
24141
|
-
*/
|
|
24142
|
-
|
|
24143
23894
|
|
|
24144
23895
|
static extend() {
|
|
24145
23896
|
var Class = class extends this {};
|
|
24146
|
-
|
|
23897
|
+
|
|
23898
|
+
for (var _len2 = arguments.length, mixins = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
23899
|
+
mixins[_key2] = arguments[_key2];
|
|
23900
|
+
}
|
|
23901
|
+
|
|
23902
|
+
reopen.apply(Class.PrototypeMixin, mixins);
|
|
24147
23903
|
return Class;
|
|
24148
23904
|
}
|
|
24149
|
-
/**
|
|
24150
|
-
Creates an instance of a class. Accepts either no arguments, or an object
|
|
24151
|
-
containing values to initialize the newly instantiated object with.
|
|
24152
|
-
```javascript
|
|
24153
|
-
import EmberObject from '@ember/object';
|
|
24154
|
-
const Person = EmberObject.extend({
|
|
24155
|
-
helloWorld() {
|
|
24156
|
-
alert(`Hi, my name is ${this.get('name')}`);
|
|
24157
|
-
}
|
|
24158
|
-
});
|
|
24159
|
-
let tom = Person.create({
|
|
24160
|
-
name: 'Tom Dale'
|
|
24161
|
-
});
|
|
24162
|
-
tom.helloWorld(); // alerts "Hi, my name is Tom Dale".
|
|
24163
|
-
```
|
|
24164
|
-
`create` will call the `init` function if defined during
|
|
24165
|
-
`AnyObject.extend`
|
|
24166
|
-
If no arguments are passed to `create`, it will not set values to the new
|
|
24167
|
-
instance during initialization:
|
|
24168
|
-
```javascript
|
|
24169
|
-
let noName = Person.create();
|
|
24170
|
-
noName.helloWorld(); // alerts undefined
|
|
24171
|
-
```
|
|
24172
|
-
NOTE: For performance reasons, you cannot declare methods or computed
|
|
24173
|
-
properties during `create`. You should instead declare methods and computed
|
|
24174
|
-
properties when using `extend`.
|
|
24175
|
-
@method create
|
|
24176
|
-
@for @ember/object
|
|
24177
|
-
@static
|
|
24178
|
-
@param [arguments]*
|
|
24179
|
-
@public
|
|
24180
|
-
*/
|
|
24181
23905
|
|
|
23906
|
+
static create() {
|
|
23907
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
23908
|
+
args[_key3] = arguments[_key3];
|
|
23909
|
+
}
|
|
24182
23910
|
|
|
24183
|
-
|
|
23911
|
+
var props = args[0];
|
|
24184
23912
|
var instance;
|
|
24185
23913
|
|
|
24186
23914
|
if (props !== undefined) {
|
|
@@ -24190,10 +23918,10 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24190
23918
|
instance = new this();
|
|
24191
23919
|
}
|
|
24192
23920
|
|
|
24193
|
-
if (
|
|
23921
|
+
if (args.length <= 1) {
|
|
24194
23922
|
initialize(instance, props);
|
|
24195
23923
|
} else {
|
|
24196
|
-
initialize(instance, flattenProps.apply(this,
|
|
23924
|
+
initialize(instance, flattenProps.apply(this, args));
|
|
24197
23925
|
}
|
|
24198
23926
|
|
|
24199
23927
|
return instance;
|
|
@@ -24201,25 +23929,25 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24201
23929
|
/**
|
|
24202
23930
|
Augments a constructor's prototype with additional
|
|
24203
23931
|
properties and functions:
|
|
24204
|
-
|
|
23932
|
+
```javascript
|
|
24205
23933
|
import EmberObject from '@ember/object';
|
|
24206
|
-
|
|
23934
|
+
const MyObject = EmberObject.extend({
|
|
24207
23935
|
name: 'an object'
|
|
24208
23936
|
});
|
|
24209
|
-
|
|
23937
|
+
o = MyObject.create();
|
|
24210
23938
|
o.get('name'); // 'an object'
|
|
24211
|
-
|
|
23939
|
+
MyObject.reopen({
|
|
24212
23940
|
say(msg) {
|
|
24213
23941
|
console.log(msg);
|
|
24214
23942
|
}
|
|
24215
23943
|
});
|
|
24216
|
-
|
|
23944
|
+
o2 = MyObject.create();
|
|
24217
23945
|
o2.say('hello'); // logs "hello"
|
|
24218
|
-
|
|
23946
|
+
o.say('goodbye'); // logs "goodbye"
|
|
24219
23947
|
```
|
|
24220
|
-
|
|
23948
|
+
To add functions and properties to the constructor itself,
|
|
24221
23949
|
see `reopenClass`
|
|
24222
|
-
|
|
23950
|
+
@method reopen
|
|
24223
23951
|
@for @ember/object
|
|
24224
23952
|
@static
|
|
24225
23953
|
@public
|
|
@@ -24228,7 +23956,12 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24228
23956
|
|
|
24229
23957
|
static reopen() {
|
|
24230
23958
|
this.willReopen();
|
|
24231
|
-
|
|
23959
|
+
|
|
23960
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
23961
|
+
args[_key4] = arguments[_key4];
|
|
23962
|
+
}
|
|
23963
|
+
|
|
23964
|
+
reopen.apply(this.PrototypeMixin, args);
|
|
24232
23965
|
return this;
|
|
24233
23966
|
}
|
|
24234
23967
|
|
|
@@ -24247,47 +23980,47 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24247
23980
|
}
|
|
24248
23981
|
/**
|
|
24249
23982
|
Augments a constructor's own properties and functions:
|
|
24250
|
-
|
|
23983
|
+
```javascript
|
|
24251
23984
|
import EmberObject from '@ember/object';
|
|
24252
|
-
|
|
23985
|
+
const MyObject = EmberObject.extend({
|
|
24253
23986
|
name: 'an object'
|
|
24254
23987
|
});
|
|
24255
|
-
|
|
23988
|
+
MyObject.reopenClass({
|
|
24256
23989
|
canBuild: false
|
|
24257
23990
|
});
|
|
24258
|
-
|
|
23991
|
+
MyObject.canBuild; // false
|
|
24259
23992
|
o = MyObject.create();
|
|
24260
23993
|
```
|
|
24261
|
-
|
|
23994
|
+
In other words, this creates static properties and functions for the class.
|
|
24262
23995
|
These are only available on the class and not on any instance of that class.
|
|
24263
|
-
|
|
23996
|
+
```javascript
|
|
24264
23997
|
import EmberObject from '@ember/object';
|
|
24265
|
-
|
|
23998
|
+
const Person = EmberObject.extend({
|
|
24266
23999
|
name: '',
|
|
24267
24000
|
sayHello() {
|
|
24268
24001
|
alert(`Hello. My name is ${this.get('name')}`);
|
|
24269
24002
|
}
|
|
24270
24003
|
});
|
|
24271
|
-
|
|
24004
|
+
Person.reopenClass({
|
|
24272
24005
|
species: 'Homo sapiens',
|
|
24273
|
-
|
|
24006
|
+
createPerson(name) {
|
|
24274
24007
|
return Person.create({ name });
|
|
24275
24008
|
}
|
|
24276
24009
|
});
|
|
24277
|
-
|
|
24010
|
+
let tom = Person.create({
|
|
24278
24011
|
name: 'Tom Dale'
|
|
24279
24012
|
});
|
|
24280
24013
|
let yehuda = Person.createPerson('Yehuda Katz');
|
|
24281
|
-
|
|
24014
|
+
tom.sayHello(); // "Hello. My name is Tom Dale"
|
|
24282
24015
|
yehuda.sayHello(); // "Hello. My name is Yehuda Katz"
|
|
24283
24016
|
alert(Person.species); // "Homo sapiens"
|
|
24284
24017
|
```
|
|
24285
|
-
|
|
24018
|
+
Note that `species` and `createPerson` are *not* valid on the `tom` and `yehuda`
|
|
24286
24019
|
variables. They are only valid on `Person`.
|
|
24287
|
-
|
|
24020
|
+
To add functions and properties to instances of
|
|
24288
24021
|
a constructor by extending the constructor's prototype
|
|
24289
24022
|
see `reopen`
|
|
24290
|
-
|
|
24023
|
+
@method reopenClass
|
|
24291
24024
|
@for @ember/object
|
|
24292
24025
|
@static
|
|
24293
24026
|
@public
|
|
@@ -24295,7 +24028,11 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24295
24028
|
|
|
24296
24029
|
|
|
24297
24030
|
static reopenClass() {
|
|
24298
|
-
(
|
|
24031
|
+
for (var _len5 = arguments.length, mixins = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
24032
|
+
mixins[_key5] = arguments[_key5];
|
|
24033
|
+
}
|
|
24034
|
+
|
|
24035
|
+
(0, _metal.applyMixin)(this, mixins);
|
|
24299
24036
|
return this;
|
|
24300
24037
|
}
|
|
24301
24038
|
|
|
@@ -24323,21 +24060,21 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24323
24060
|
metadata about how they function or what values they operate on. For
|
|
24324
24061
|
example, computed property functions may close over variables that are then
|
|
24325
24062
|
no longer available for introspection.
|
|
24326
|
-
|
|
24327
|
-
|
|
24063
|
+
You can pass a hash of these values to a computed property like this:
|
|
24064
|
+
```javascript
|
|
24328
24065
|
import { computed } from '@ember/object';
|
|
24329
|
-
|
|
24066
|
+
person: computed(function() {
|
|
24330
24067
|
let personId = this.get('personId');
|
|
24331
24068
|
return Person.create({ id: personId });
|
|
24332
24069
|
}).meta({ type: Person })
|
|
24333
24070
|
```
|
|
24334
|
-
|
|
24071
|
+
Once you've done this, you can retrieve the values saved to the computed
|
|
24335
24072
|
property from your class like this:
|
|
24336
|
-
|
|
24073
|
+
```javascript
|
|
24337
24074
|
MyClass.metaForProperty('person');
|
|
24338
24075
|
```
|
|
24339
|
-
|
|
24340
|
-
|
|
24076
|
+
This will return the original hash that was passed to `meta()`.
|
|
24077
|
+
@static
|
|
24341
24078
|
@method metaForProperty
|
|
24342
24079
|
@param key {String} property name
|
|
24343
24080
|
@private
|
|
@@ -24354,7 +24091,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24354
24091
|
/**
|
|
24355
24092
|
Iterate over each computed property for the class, passing its name
|
|
24356
24093
|
and any associated metadata (see `metaForProperty`) to the callback.
|
|
24357
|
-
|
|
24094
|
+
@static
|
|
24358
24095
|
@method eachComputedProperty
|
|
24359
24096
|
@param {Function} callback
|
|
24360
24097
|
@param {Object} binding
|
|
@@ -24427,38 +24164,19 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24427
24164
|
CoreObject.isMethod = false;
|
|
24428
24165
|
|
|
24429
24166
|
function flattenProps() {
|
|
24430
|
-
var {
|
|
24431
|
-
concatenatedProperties,
|
|
24432
|
-
mergedProperties
|
|
24433
|
-
} = this;
|
|
24434
|
-
var hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
|
|
24435
|
-
var hasMergedProps = mergedProperties !== undefined && mergedProperties.length > 0;
|
|
24436
24167
|
var initProperties = {};
|
|
24437
24168
|
|
|
24438
|
-
for (var
|
|
24439
|
-
|
|
24169
|
+
for (var _len6 = arguments.length, props = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
24170
|
+
props[_key6] = arguments[_key6];
|
|
24171
|
+
}
|
|
24172
|
+
|
|
24173
|
+
for (var properties of props) {
|
|
24440
24174
|
(true && !(!(properties instanceof _metal.Mixin)) && (0, _debug.assert)('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _metal.Mixin)));
|
|
24441
24175
|
var keyNames = Object.keys(properties);
|
|
24442
24176
|
|
|
24443
24177
|
for (var j = 0, k = keyNames.length; j < k; j++) {
|
|
24444
24178
|
var keyName = keyNames[j];
|
|
24445
24179
|
var value = properties[keyName];
|
|
24446
|
-
|
|
24447
|
-
if (hasConcatenatedProps && concatenatedProperties.indexOf(keyName) > -1) {
|
|
24448
|
-
var baseValue = initProperties[keyName];
|
|
24449
|
-
|
|
24450
|
-
if (baseValue) {
|
|
24451
|
-
value = (0, _utils.makeArray)(baseValue).concat(value);
|
|
24452
|
-
} else {
|
|
24453
|
-
value = (0, _utils.makeArray)(value);
|
|
24454
|
-
}
|
|
24455
|
-
}
|
|
24456
|
-
|
|
24457
|
-
if (hasMergedProps && mergedProperties.indexOf(keyName) > -1) {
|
|
24458
|
-
var _baseValue2 = initProperties[keyName];
|
|
24459
|
-
value = Object.assign({}, _baseValue2, value);
|
|
24460
|
-
}
|
|
24461
|
-
|
|
24462
24180
|
initProperties[keyName] = value;
|
|
24463
24181
|
}
|
|
24464
24182
|
}
|
|
@@ -24471,7 +24189,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24471
24189
|
) {
|
|
24472
24190
|
/**
|
|
24473
24191
|
Provides lookup-time type validation for injected properties.
|
|
24474
|
-
|
|
24192
|
+
@private
|
|
24475
24193
|
@method _onLookup
|
|
24476
24194
|
*/
|
|
24477
24195
|
CoreObject._onLookup = function injectedPropertyAssertion(debugContainerKey) {
|
|
@@ -24489,7 +24207,7 @@ define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-
|
|
|
24489
24207
|
/**
|
|
24490
24208
|
Returns a hash of property names and container names that injected
|
|
24491
24209
|
properties will lookup on the container lazily.
|
|
24492
|
-
|
|
24210
|
+
@method _lazyInjections
|
|
24493
24211
|
@return {Object} Hash of all lazy injected property keys to container names
|
|
24494
24212
|
@private
|
|
24495
24213
|
*/
|
|
@@ -24609,18 +24327,7 @@ define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-inter
|
|
|
24609
24327
|
/**
|
|
24610
24328
|
@module @ember/object
|
|
24611
24329
|
*/
|
|
24612
|
-
|
|
24613
|
-
/**
|
|
24614
|
-
`EmberObject` is the main base class for all Ember objects. It is a subclass
|
|
24615
|
-
of `CoreObject` with the `Observable` mixin applied. For details,
|
|
24616
|
-
see the documentation for each of these.
|
|
24617
|
-
|
|
24618
|
-
@class EmberObject
|
|
24619
|
-
@extends CoreObject
|
|
24620
|
-
@uses Observable
|
|
24621
|
-
@public
|
|
24622
|
-
*/
|
|
24623
|
-
class EmberObject extends _core_object.default {
|
|
24330
|
+
class EmberObject extends _core_object.default.extend(_observable.default) {
|
|
24624
24331
|
get _debugContainerKey() {
|
|
24625
24332
|
var factory = (0, _container.getFactoryFor)(this);
|
|
24626
24333
|
return factory !== undefined && factory.fullName;
|
|
@@ -24628,21 +24335,10 @@ define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-inter
|
|
|
24628
24335
|
|
|
24629
24336
|
}
|
|
24630
24337
|
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
var FrameworkObject;
|
|
24338
|
+
var _default = EmberObject;
|
|
24339
|
+
_exports.default = _default;
|
|
24340
|
+
var FrameworkObject = class FrameworkObject extends EmberObject {};
|
|
24636
24341
|
_exports.FrameworkObject = FrameworkObject;
|
|
24637
|
-
_exports.FrameworkObject = FrameworkObject = class FrameworkObject extends _core_object.default {
|
|
24638
|
-
get _debugContainerKey() {
|
|
24639
|
-
var factory = (0, _container.getFactoryFor)(this);
|
|
24640
|
-
return factory !== undefined && factory.fullName;
|
|
24641
|
-
}
|
|
24642
|
-
|
|
24643
|
-
};
|
|
24644
|
-
|
|
24645
|
-
_observable.default.apply(FrameworkObject.prototype);
|
|
24646
24342
|
|
|
24647
24343
|
if (true
|
|
24648
24344
|
/* DEBUG */
|
|
@@ -24650,8 +24346,8 @@ define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-inter
|
|
|
24650
24346
|
var INIT_WAS_CALLED = (0, _utils.symbol)('INIT_WAS_CALLED');
|
|
24651
24347
|
var ASSERT_INIT_WAS_CALLED = (0, _utils.symbol)('ASSERT_INIT_WAS_CALLED');
|
|
24652
24348
|
_exports.FrameworkObject = FrameworkObject = class DebugFrameworkObject extends EmberObject {
|
|
24653
|
-
init() {
|
|
24654
|
-
super.init(
|
|
24349
|
+
init(properties) {
|
|
24350
|
+
super.init(properties);
|
|
24655
24351
|
this[INIT_WAS_CALLED] = true;
|
|
24656
24352
|
}
|
|
24657
24353
|
|
|
@@ -27178,36 +26874,49 @@ define("@ember/-internals/views/lib/views/core_view", ["exports", "@ember/-inter
|
|
|
27178
26874
|
});
|
|
27179
26875
|
_exports.default = void 0;
|
|
27180
26876
|
|
|
27181
|
-
var
|
|
27182
|
-
|
|
27183
|
-
|
|
26877
|
+
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
26878
|
+
var c = arguments.length,
|
|
26879
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
26880
|
+
d;
|
|
26881
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
|
26882
|
+
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
26883
|
+
}
|
|
26884
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26885
|
+
};
|
|
27184
26886
|
|
|
27185
|
-
|
|
27186
|
-
|
|
26887
|
+
class CoreView extends _runtime.FrameworkObject.extend(_runtime.Evented, _runtime.ActionHandler, {
|
|
26888
|
+
// Continue to declare `_states` here so that we have a single reference on the prototype
|
|
26889
|
+
// instead of one on each instance.
|
|
26890
|
+
_states: _states.default
|
|
26891
|
+
}) {
|
|
26892
|
+
constructor() {
|
|
26893
|
+
super(...arguments);
|
|
26894
|
+
this.isView = true;
|
|
26895
|
+
}
|
|
27187
26896
|
|
|
27188
|
-
|
|
27189
|
-
|
|
27190
|
-
},
|
|
26897
|
+
init(properties) {
|
|
26898
|
+
var _a;
|
|
27191
26899
|
|
|
27192
|
-
|
|
26900
|
+
super.init(properties); // Handle methods from Evented
|
|
26901
|
+
// The native class inheritance will not work for mixins. To work around this,
|
|
26902
|
+
// we copy the existing trigger and has methods provided by the mixin and swap in the
|
|
26903
|
+
// new ones from our class.
|
|
27193
26904
|
|
|
27194
|
-
|
|
27195
|
-
|
|
27196
|
-
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
27201
|
-
|
|
27202
|
-
parentView: null,
|
|
26905
|
+
this._superTrigger = this.trigger;
|
|
26906
|
+
this.trigger = this._trigger;
|
|
26907
|
+
this._superHas = this.has;
|
|
26908
|
+
this.has = this._has;
|
|
26909
|
+
(_a = this.parentView) !== null && _a !== void 0 ? _a : this.parentView = null;
|
|
26910
|
+
this._state = 'preRender';
|
|
26911
|
+
this._currentState = this._states.preRender;
|
|
26912
|
+
}
|
|
27203
26913
|
|
|
27204
26914
|
instrumentDetails(hash) {
|
|
27205
26915
|
hash['object'] = this.toString();
|
|
27206
26916
|
hash['containerKey'] = this._debugContainerKey;
|
|
27207
26917
|
hash['view'] = this;
|
|
27208
26918
|
return hash;
|
|
27209
|
-
}
|
|
27210
|
-
|
|
26919
|
+
}
|
|
27211
26920
|
/**
|
|
27212
26921
|
Override the default event firing from `Evented` to
|
|
27213
26922
|
also call methods with the given name.
|
|
@@ -27215,29 +26924,34 @@ define("@ember/-internals/views/lib/views/core_view", ["exports", "@ember/-inter
|
|
|
27215
26924
|
@param name {String}
|
|
27216
26925
|
@private
|
|
27217
26926
|
*/
|
|
27218
|
-
trigger
|
|
26927
|
+
// Changed to `trigger` on init
|
|
26928
|
+
|
|
26929
|
+
|
|
26930
|
+
_trigger(name) {
|
|
27219
26931
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
27220
26932
|
args[_key - 1] = arguments[_key];
|
|
27221
26933
|
}
|
|
27222
26934
|
|
|
27223
|
-
this.
|
|
26935
|
+
this._superTrigger(name, ...args);
|
|
27224
26936
|
|
|
27225
26937
|
var method = this[name];
|
|
27226
26938
|
|
|
27227
26939
|
if (typeof method === 'function') {
|
|
27228
26940
|
return method.apply(this, args);
|
|
27229
26941
|
}
|
|
27230
|
-
}
|
|
26942
|
+
} // Changed to `has` on init
|
|
27231
26943
|
|
|
27232
|
-
|
|
27233
|
-
|
|
26944
|
+
|
|
26945
|
+
_has(name) {
|
|
26946
|
+
return typeof this[name] === 'function' || this._superHas(name);
|
|
27234
26947
|
}
|
|
27235
26948
|
|
|
27236
|
-
}
|
|
26949
|
+
}
|
|
26950
|
+
|
|
26951
|
+
CoreView.isViewFactory = true;
|
|
26952
|
+
|
|
26953
|
+
__decorate([(0, _metal.inject)('renderer', '-dom')], CoreView.prototype, "renderer", void 0);
|
|
27237
26954
|
|
|
27238
|
-
CoreView.reopenClass({
|
|
27239
|
-
isViewFactory: true
|
|
27240
|
-
});
|
|
27241
26955
|
var _default = CoreView;
|
|
27242
26956
|
_exports.default = _default;
|
|
27243
26957
|
});
|
|
@@ -29055,7 +28769,7 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
29055
28769
|
Object.defineProperty(_exports, "__esModule", {
|
|
29056
28770
|
value: true
|
|
29057
28771
|
});
|
|
29058
|
-
_exports.FEATURES = _exports.EMBER_UNIQUE_ID_HELPER = _exports.
|
|
28772
|
+
_exports.FEATURES = _exports.EMBER_UNIQUE_ID_HELPER = _exports.EMBER_LIBRARIES_ISREGISTERED = _exports.EMBER_IMPROVED_INSTRUMENTATION = _exports.DEFAULT_FEATURES = void 0;
|
|
29059
28773
|
_exports.isEnabled = isEnabled;
|
|
29060
28774
|
|
|
29061
28775
|
/**
|
|
@@ -29071,9 +28785,7 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
29071
28785
|
var DEFAULT_FEATURES = {
|
|
29072
28786
|
EMBER_LIBRARIES_ISREGISTERED: null,
|
|
29073
28787
|
EMBER_IMPROVED_INSTRUMENTATION: null,
|
|
29074
|
-
|
|
29075
|
-
EMBER_CACHED: true,
|
|
29076
|
-
EMBER_UNIQUE_ID_HELPER: null
|
|
28788
|
+
EMBER_UNIQUE_ID_HELPER: true
|
|
29077
28789
|
};
|
|
29078
28790
|
/**
|
|
29079
28791
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -29129,10 +28841,6 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
29129
28841
|
_exports.EMBER_LIBRARIES_ISREGISTERED = EMBER_LIBRARIES_ISREGISTERED;
|
|
29130
28842
|
var EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
|
|
29131
28843
|
_exports.EMBER_IMPROVED_INSTRUMENTATION = EMBER_IMPROVED_INSTRUMENTATION;
|
|
29132
|
-
var EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
29133
|
-
_exports.EMBER_ROUTING_ROUTER_SERVICE_REFRESH = EMBER_ROUTING_ROUTER_SERVICE_REFRESH;
|
|
29134
|
-
var EMBER_CACHED = featureValue(FEATURES.EMBER_CACHED);
|
|
29135
|
-
_exports.EMBER_CACHED = EMBER_CACHED;
|
|
29136
28844
|
var EMBER_UNIQUE_ID_HELPER = featureValue(FEATURES.EMBER_UNIQUE_ID_HELPER);
|
|
29137
28845
|
_exports.EMBER_UNIQUE_ID_HELPER = EMBER_UNIQUE_ID_HELPER;
|
|
29138
28846
|
});
|
|
@@ -29773,11 +29481,15 @@ define("@ember/debug/lib/deprecate", ["exports", "@ember/-internals/environment"
|
|
|
29773
29481
|
var formatMessage = function formatMessage(_message, options) {
|
|
29774
29482
|
var message = _message;
|
|
29775
29483
|
|
|
29776
|
-
if (options
|
|
29484
|
+
if (options === null || options === void 0 ? void 0 : options.id) {
|
|
29777
29485
|
message = message + ` [deprecation id: ${options.id}]`;
|
|
29778
29486
|
}
|
|
29779
29487
|
|
|
29780
|
-
if (options
|
|
29488
|
+
if (options === null || options === void 0 ? void 0 : options.until) {
|
|
29489
|
+
message = message + ` This will be removed in Ember ${options.until}.`;
|
|
29490
|
+
}
|
|
29491
|
+
|
|
29492
|
+
if (options === null || options === void 0 ? void 0 : options.url) {
|
|
29781
29493
|
message += ` See ${options.url} for more details.`;
|
|
29782
29494
|
}
|
|
29783
29495
|
|
|
@@ -34088,19 +33800,6 @@ define("@ember/polyfills/lib/assign", ["exports", "@ember/debug"], function (_ex
|
|
|
34088
33800
|
return Object.assign(target, ...rest);
|
|
34089
33801
|
}
|
|
34090
33802
|
});
|
|
34091
|
-
define("@ember/renderer/index", ["exports", "@ember/-internals/glimmer"], function (_exports, _glimmer) {
|
|
34092
|
-
"use strict";
|
|
34093
|
-
|
|
34094
|
-
Object.defineProperty(_exports, "__esModule", {
|
|
34095
|
-
value: true
|
|
34096
|
-
});
|
|
34097
|
-
Object.defineProperty(_exports, "renderSettled", {
|
|
34098
|
-
enumerable: true,
|
|
34099
|
-
get: function () {
|
|
34100
|
-
return _glimmer.renderSettled;
|
|
34101
|
-
}
|
|
34102
|
-
});
|
|
34103
|
-
});
|
|
34104
33803
|
define("@ember/routing/auto-location", ["exports", "@ember/-internals/routing"], function (_exports, _routing) {
|
|
34105
33804
|
"use strict";
|
|
34106
33805
|
|
|
@@ -55063,7 +54762,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
55063
54762
|
value: true
|
|
55064
54763
|
});
|
|
55065
54764
|
_exports.default = void 0;
|
|
55066
|
-
var _default = "4.4.0-alpha.
|
|
54765
|
+
var _default = "4.4.0-alpha.7";
|
|
55067
54766
|
_exports.default = _default;
|
|
55068
54767
|
});
|
|
55069
54768
|
define("route-recognizer", ["exports"], function (_exports) {
|