ember-source 3.28.5 → 4.0.0-beta.10
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 +113 -10
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
- package/blueprints/helper-test/index.js +4 -22
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/manager.js +19 -98
- package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
- package/dist/dependencies/@glimmer/runtime.js +1 -55
- package/dist/dependencies/@glimmer/validator.js +19 -51
- package/dist/ember-template-compiler.js +3692 -5667
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +12 -560
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +4357 -12470
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/bootstrap/index.js +2 -55
- package/dist/packages/@ember/-internals/container/index.js +35 -206
- package/dist/packages/@ember/-internals/environment/index.js +3 -46
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +1 -2
- package/dist/packages/@ember/-internals/glimmer/index.js +4774 -7035
- package/dist/packages/@ember/-internals/meta/lib/meta.js +2 -50
- package/dist/packages/@ember/-internals/metal/index.js +785 -1109
- package/dist/packages/@ember/-internals/overrides/index.js +1 -3
- package/dist/packages/@ember/-internals/owner/index.js +1 -19
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +1 -51
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -7
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +34 -2
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -3
- package/dist/packages/@ember/-internals/routing/lib/system/dsl.js +5 -6
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +192 -652
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +119 -248
- package/dist/packages/@ember/-internals/routing/lib/system/router_state.js +1 -2
- package/dist/packages/@ember/-internals/routing/lib/utils.js +1 -2
- package/dist/packages/@ember/-internals/runtime/index.js +1 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +4 -175
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +1 -18
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +10 -141
- package/dist/packages/@ember/-internals/utils/index.js +3 -59
- package/dist/packages/@ember/-internals/views/index.js +0 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -121
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -40
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +115 -190
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/pre_render.js +1 -2
- package/dist/packages/@ember/application/instance.js +3 -25
- package/dist/packages/@ember/application/lib/application.js +14 -32
- package/dist/packages/@ember/canary-features/index.js +5 -6
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/component/template-only.js +2 -0
- package/dist/packages/@ember/debug/lib/deprecate.js +7 -41
- package/dist/packages/@ember/deprecated-features/index.js +1 -14
- package/dist/packages/@ember/engine/index.js +3 -17
- package/dist/packages/@ember/engine/instance.js +0 -4
- package/dist/packages/@ember/helper/index.js +12 -4
- package/dist/packages/@ember/object/index.js +3 -101
- package/dist/packages/@ember/object/internals.js +0 -1
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +12 -384
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +9 -360
- package/dist/packages/@ember/polyfills/index.js +1 -6
- package/dist/packages/@ember/polyfills/lib/assign.js +12 -28
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@ember/runloop/index.js +1 -83
- package/dist/packages/@ember/string/index.js +1 -206
- package/dist/packages/@ember/utils/index.js +0 -1
- package/dist/packages/ember/index.js +17 -180
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/index.js +0 -2
- package/dist/packages/ember-testing/lib/helpers.js +0 -12
- package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
- package/docs/data.json +1637 -3659
- package/lib/index.js +14 -59
- package/lib/overrides.js +0 -61
- package/lib/transforms/inject-babel-helpers.js +1 -3
- package/package.json +27 -23
- package/dist/packages/@ember/-internals/console/index.js +0 -190
- package/dist/packages/@ember/-internals/runtime/lib/copy.js +0 -119
- package/dist/packages/@ember/-internals/runtime/lib/ext/function.js +0 -155
- package/dist/packages/@ember/-internals/runtime/lib/mixins/copyable.js +0 -31
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -357
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- package/dist/packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js +0 -60
- package/dist/packages/@ember/application/deprecations.js +0 -25
- package/dist/packages/@ember/application/globals-resolver.js +0 -434
- package/dist/packages/@ember/application/resolver.js +0 -1
- package/dist/packages/@ember/component/checkbox.js +0 -17
- package/dist/packages/@ember/component/text-area.js +0 -17
- package/dist/packages/@ember/component/text-field.js +0 -17
- package/dist/packages/@ember/polyfills/lib/merge.js +0 -50
- package/dist/packages/@ember/routing/link-component.js +0 -17
- package/dist/packages/ember-testing/lib/events.js +0 -102
- package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
- package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
- package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
- package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
- package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
- package/dist/packages/ember-testing/lib/support.js +0 -57
- package/dist/packages/jquery/index.js +0 -2
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@module ember
|
|
3
|
-
*/
|
|
4
|
-
import { ENV } from '@ember/-internals/environment';
|
|
5
|
-
import { on, computed, observer } from '@ember/-internals/metal';
|
|
6
|
-
import { deprecate } from '@ember/debug';
|
|
7
|
-
import { FUNCTION_PROTOTYPE_EXTENSIONS } from '@ember/deprecated-features';
|
|
8
|
-
|
|
9
|
-
if (FUNCTION_PROTOTYPE_EXTENSIONS && ENV.EXTEND_PROTOTYPES.Function) {
|
|
10
|
-
Object.defineProperties(Function.prototype, {
|
|
11
|
-
/**
|
|
12
|
-
The `property` extension of Javascript's Function prototype is available
|
|
13
|
-
when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
|
|
14
|
-
`true`, which is the default.
|
|
15
|
-
Computed properties allow you to treat a function like a property:
|
|
16
|
-
```app/utils/president.js
|
|
17
|
-
import EmberObject from '@ember/object';
|
|
18
|
-
export default EmberObject.extend({
|
|
19
|
-
firstName: '',
|
|
20
|
-
lastName: '',
|
|
21
|
-
fullName: function() {
|
|
22
|
-
return this.get('firstName') + ' ' + this.get('lastName');
|
|
23
|
-
}.property() // Call this flag to mark the function as a property
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
```javascript
|
|
27
|
-
let president = President.create({
|
|
28
|
-
firstName: 'Barack',
|
|
29
|
-
lastName: 'Obama'
|
|
30
|
-
});
|
|
31
|
-
president.get('fullName'); // 'Barack Obama'
|
|
32
|
-
```
|
|
33
|
-
Treating a function like a property is useful because they can work with
|
|
34
|
-
bindings, just like any other property.
|
|
35
|
-
Many computed properties have dependencies on other properties. For
|
|
36
|
-
example, in the above example, the `fullName` property depends on
|
|
37
|
-
`firstName` and `lastName` to determine its value. You can tell Ember
|
|
38
|
-
about these dependencies like this:
|
|
39
|
-
```app/utils/president.js
|
|
40
|
-
import EmberObject from '@ember/object';
|
|
41
|
-
export default EmberObject.extend({
|
|
42
|
-
firstName: '',
|
|
43
|
-
lastName: '',
|
|
44
|
-
fullName: function() {
|
|
45
|
-
return this.get('firstName') + ' ' + this.get('lastName');
|
|
46
|
-
// Tell Ember.js that this computed property depends on firstName
|
|
47
|
-
// and lastName
|
|
48
|
-
}.property('firstName', 'lastName')
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
Make sure you list these dependencies so Ember knows when to update
|
|
52
|
-
bindings that connect to a computed property. Changing a dependency
|
|
53
|
-
will not immediately trigger an update of the computed property, but
|
|
54
|
-
will instead clear the cache so that it is updated when the next `get`
|
|
55
|
-
is called on the property.
|
|
56
|
-
See [ComputedProperty](/ember/release/classes/ComputedProperty), [@ember/object/computed](/ember/release/classes/@ember%2Fobject%2Fcomputed).
|
|
57
|
-
@method property
|
|
58
|
-
@for Function
|
|
59
|
-
@public
|
|
60
|
-
*/
|
|
61
|
-
property: {
|
|
62
|
-
configurable: true,
|
|
63
|
-
enumerable: false,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: function () {
|
|
66
|
-
deprecate(`Function prototype extensions have been deprecated, please migrate from function(){}.property('bar') to computed('bar', function() {}).`, false, {
|
|
67
|
-
id: 'function-prototype-extensions.property',
|
|
68
|
-
until: '4.0.0',
|
|
69
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-property',
|
|
70
|
-
for: 'ember-source',
|
|
71
|
-
since: {
|
|
72
|
-
enabled: '3.11.0'
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return computed(...arguments, this);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
The `observes` extension of Javascript's Function prototype is available
|
|
81
|
-
when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
|
|
82
|
-
true, which is the default.
|
|
83
|
-
You can observe property changes simply by adding the `observes`
|
|
84
|
-
call to the end of your method declarations in classes that you write.
|
|
85
|
-
For example:
|
|
86
|
-
```javascript
|
|
87
|
-
import EmberObject from '@ember/object';
|
|
88
|
-
EmberObject.extend({
|
|
89
|
-
valueObserver: function() {
|
|
90
|
-
// Executes whenever the "value" property changes
|
|
91
|
-
}.observes('value')
|
|
92
|
-
});
|
|
93
|
-
```
|
|
94
|
-
In the future this method may become asynchronous.
|
|
95
|
-
See `observer`.
|
|
96
|
-
@method observes
|
|
97
|
-
@for Function
|
|
98
|
-
@public
|
|
99
|
-
*/
|
|
100
|
-
observes: {
|
|
101
|
-
configurable: true,
|
|
102
|
-
enumerable: false,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: function () {
|
|
105
|
-
deprecate(`Function prototype extensions have been deprecated, please migrate from function(){}.observes('foo') to observer('foo', function() {}).`, false, {
|
|
106
|
-
id: 'function-prototype-extensions.observes',
|
|
107
|
-
until: '4.0.0',
|
|
108
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-observes',
|
|
109
|
-
for: 'ember-source',
|
|
110
|
-
since: {
|
|
111
|
-
enabled: '3.11.0'
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
return observer(...arguments, this);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
The `on` extension of Javascript's Function prototype is available
|
|
120
|
-
when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
|
|
121
|
-
true, which is the default.
|
|
122
|
-
You can listen for events simply by adding the `on` call to the end of
|
|
123
|
-
your method declarations in classes or mixins that you write. For example:
|
|
124
|
-
```javascript
|
|
125
|
-
import Mixin from '@ember/mixin';
|
|
126
|
-
Mixin.create({
|
|
127
|
-
doSomethingWithElement: function() {
|
|
128
|
-
// Executes whenever the "didInsertElement" event fires
|
|
129
|
-
}.on('didInsertElement')
|
|
130
|
-
});
|
|
131
|
-
```
|
|
132
|
-
See `@ember/object/evented/on`.
|
|
133
|
-
@method on
|
|
134
|
-
@for Function
|
|
135
|
-
@public
|
|
136
|
-
*/
|
|
137
|
-
on: {
|
|
138
|
-
configurable: true,
|
|
139
|
-
enumerable: false,
|
|
140
|
-
writable: true,
|
|
141
|
-
value: function () {
|
|
142
|
-
deprecate(`Function prototype extensions have been deprecated, please migrate from function(){}.on('foo') to on('foo', function() {}).`, false, {
|
|
143
|
-
id: 'function-prototype-extensions.on',
|
|
144
|
-
until: '4.0.0',
|
|
145
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_function-prototype-extensions-on',
|
|
146
|
-
for: 'ember-source',
|
|
147
|
-
since: {
|
|
148
|
-
enabled: '3.11.0'
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return on(...arguments, this);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@module ember
|
|
3
|
-
*/
|
|
4
|
-
import { Mixin } from '@ember/-internals/metal';
|
|
5
|
-
/**
|
|
6
|
-
Implements some standard methods for copying an object. Add this mixin to
|
|
7
|
-
any object you create that can create a copy of itself. This mixin is
|
|
8
|
-
added automatically to the built-in array.
|
|
9
|
-
|
|
10
|
-
You should generally implement the `copy()` method to return a copy of the
|
|
11
|
-
receiver.
|
|
12
|
-
|
|
13
|
-
@class Copyable
|
|
14
|
-
@namespace Ember
|
|
15
|
-
@since Ember 0.9
|
|
16
|
-
@deprecated Use 'ember-copy' addon instead
|
|
17
|
-
@private
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export default Mixin.create({
|
|
21
|
-
/**
|
|
22
|
-
__Required.__ You must implement this method to apply this mixin.
|
|
23
|
-
Override to return a copy of the receiver. Default implementation raises
|
|
24
|
-
an exception.
|
|
25
|
-
@method copy
|
|
26
|
-
@param {Boolean} deep if `true`, a deep copy of the object should be made
|
|
27
|
-
@return {Object} copy of receiver
|
|
28
|
-
@private
|
|
29
|
-
*/
|
|
30
|
-
copy: null
|
|
31
|
-
});
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@module ember
|
|
3
|
-
*/
|
|
4
|
-
import { get, set, Mixin } from '@ember/-internals/metal';
|
|
5
|
-
import { deprecate } from '@ember/debug';
|
|
6
|
-
import { SEND_ACTION } from '@ember/deprecated-features';
|
|
7
|
-
import { MUTABLE_CELL } from '@ember/-internals/views';
|
|
8
|
-
import { DEBUG } from '@glimmer/env';
|
|
9
|
-
|
|
10
|
-
if (DEBUG && true
|
|
11
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
12
|
-
) {
|
|
13
|
-
Mixin._disableDebugSeal = true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const KEY_EVENTS = {
|
|
17
|
-
Enter: 'insertNewline',
|
|
18
|
-
Escape: 'cancel'
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
`TextSupport` is a shared mixin used by both `TextField` and
|
|
22
|
-
`TextArea`. `TextSupport` adds a number of methods that allow you to
|
|
23
|
-
specify a controller action to invoke when a certain event is fired on your
|
|
24
|
-
text field or textarea. The specified controller action would get the current
|
|
25
|
-
value of the field passed in as the only argument unless the value of
|
|
26
|
-
the field is empty. In that case, the instance of the field itself is passed
|
|
27
|
-
in as the only argument.
|
|
28
|
-
|
|
29
|
-
Let's use the pressing of the escape key as an example. If you wanted to
|
|
30
|
-
invoke a controller action when a user presses the escape key while on your
|
|
31
|
-
field, you would use the `escape-press` attribute on your field like so:
|
|
32
|
-
|
|
33
|
-
```handlebars
|
|
34
|
-
{{! application.hbs}}
|
|
35
|
-
|
|
36
|
-
{{input escape-press='alertUser'}}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
import Application from '@ember/application';
|
|
41
|
-
import Controller from '@ember/controller';
|
|
42
|
-
App = Application.create();
|
|
43
|
-
|
|
44
|
-
App.ApplicationController = Controller.extend({
|
|
45
|
-
actions: {
|
|
46
|
-
alertUser: function ( currentValue ) {
|
|
47
|
-
alert( 'escape pressed, current value: ' + currentValue );
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
The following chart is a visual representation of what takes place when the
|
|
54
|
-
escape key is pressed in this scenario:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
The Template
|
|
58
|
-
+---------------------------+
|
|
59
|
-
| |
|
|
60
|
-
| escape-press='alertUser' |
|
|
61
|
-
| | TextSupport Mixin
|
|
62
|
-
+----+----------------------+ +-------------------------------+
|
|
63
|
-
| | cancel method |
|
|
64
|
-
| escape button pressed | |
|
|
65
|
-
+-------------------------------> | checks for the `escape-press` |
|
|
66
|
-
| attribute and pulls out the |
|
|
67
|
-
+-------------------------------+ | `alertUser` value |
|
|
68
|
-
| action name 'alertUser' +-------------------------------+
|
|
69
|
-
| sent to controller
|
|
70
|
-
v
|
|
71
|
-
Controller
|
|
72
|
-
+------------------------------------------ +
|
|
73
|
-
| |
|
|
74
|
-
| actions: { |
|
|
75
|
-
| alertUser: function( currentValue ){ |
|
|
76
|
-
| alert( 'the esc key was pressed!' ) |
|
|
77
|
-
| } |
|
|
78
|
-
| } |
|
|
79
|
-
| |
|
|
80
|
-
+-------------------------------------------+
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Here are the events that we currently support along with the name of the
|
|
84
|
-
attribute you would need to use on your field. To reiterate, you would use the
|
|
85
|
-
attribute name like so:
|
|
86
|
-
|
|
87
|
-
```handlebars
|
|
88
|
-
{{input attribute-name='controllerAction'}}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
+--------------------+----------------+
|
|
93
|
-
| | |
|
|
94
|
-
| event | attribute name |
|
|
95
|
-
+--------------------+----------------+
|
|
96
|
-
| new line inserted | insert-newline |
|
|
97
|
-
| | |
|
|
98
|
-
| enter key pressed | enter |
|
|
99
|
-
| | |
|
|
100
|
-
| cancel key pressed | escape-press |
|
|
101
|
-
| | |
|
|
102
|
-
| focusin | focus-in |
|
|
103
|
-
| | |
|
|
104
|
-
| focusout | focus-out |
|
|
105
|
-
| | |
|
|
106
|
-
| keypress | key-press |
|
|
107
|
-
| | |
|
|
108
|
-
| keyup | key-up |
|
|
109
|
-
| | |
|
|
110
|
-
| keydown | key-down |
|
|
111
|
-
+--------------------+----------------+
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
@class TextSupport
|
|
115
|
-
@namespace Ember
|
|
116
|
-
@uses Ember.TargetActionSupport
|
|
117
|
-
@extends Mixin
|
|
118
|
-
@private
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
const TextSupport = Mixin.create({
|
|
122
|
-
value: '',
|
|
123
|
-
attributeBindings: ['autocapitalize', 'autocorrect', 'autofocus', 'disabled', 'form', 'maxlength', 'minlength', 'placeholder', 'readonly', 'required', 'selectionDirection', 'spellcheck', 'tabindex', 'title'],
|
|
124
|
-
placeholder: null,
|
|
125
|
-
disabled: false,
|
|
126
|
-
maxlength: null,
|
|
127
|
-
|
|
128
|
-
init() {
|
|
129
|
-
this._super(...arguments);
|
|
130
|
-
|
|
131
|
-
this.on('paste', this, this._elementValueDidChange);
|
|
132
|
-
this.on('cut', this, this._elementValueDidChange);
|
|
133
|
-
this.on('input', this, this._elementValueDidChange);
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
Whether the `keyUp` event that triggers an `action` to be sent continues
|
|
138
|
-
propagating to other views.
|
|
139
|
-
By default, when the user presses the return key on their keyboard and
|
|
140
|
-
the text field has an `action` set, the action will be sent to the view's
|
|
141
|
-
controller and the key event will stop propagating.
|
|
142
|
-
If you would like parent views to receive the `keyUp` event even after an
|
|
143
|
-
action has been dispatched, set `bubbles` to true.
|
|
144
|
-
@property bubbles
|
|
145
|
-
@type Boolean
|
|
146
|
-
@default false
|
|
147
|
-
@private
|
|
148
|
-
*/
|
|
149
|
-
bubbles: false,
|
|
150
|
-
|
|
151
|
-
interpretKeyEvents(event) {
|
|
152
|
-
let method = KEY_EVENTS[event.key];
|
|
153
|
-
|
|
154
|
-
this._elementValueDidChange();
|
|
155
|
-
|
|
156
|
-
if (method) {
|
|
157
|
-
return this[method](event);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
_elementValueDidChange() {
|
|
162
|
-
set(this, 'value', this.element.value);
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
change(event) {
|
|
166
|
-
this._elementValueDidChange(event);
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
Allows you to specify a controller action to invoke when either the `enter`
|
|
171
|
-
key is pressed or, in the case of the field being a textarea, when a newline
|
|
172
|
-
is inserted. To use this method, give your field an `insert-newline`
|
|
173
|
-
attribute. The value of that attribute should be the name of the action
|
|
174
|
-
in your controller that you wish to invoke.
|
|
175
|
-
For an example on how to use the `insert-newline` attribute, please
|
|
176
|
-
reference the example near the top of this file.
|
|
177
|
-
@method insertNewline
|
|
178
|
-
@param {Event} event
|
|
179
|
-
@private
|
|
180
|
-
*/
|
|
181
|
-
insertNewline(event) {
|
|
182
|
-
sendAction('enter', this, event);
|
|
183
|
-
sendAction('insert-newline', this, event);
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
Allows you to specify a controller action to invoke when the escape button
|
|
188
|
-
is pressed. To use this method, give your field an `escape-press`
|
|
189
|
-
attribute. The value of that attribute should be the name of the action
|
|
190
|
-
in your controller that you wish to invoke.
|
|
191
|
-
For an example on how to use the `escape-press` attribute, please reference
|
|
192
|
-
the example near the top of this file.
|
|
193
|
-
@method cancel
|
|
194
|
-
@param {Event} event
|
|
195
|
-
@private
|
|
196
|
-
*/
|
|
197
|
-
cancel(event) {
|
|
198
|
-
sendAction('escape-press', this, event);
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
Allows you to specify a controller action to invoke when a field receives
|
|
203
|
-
focus. To use this method, give your field a `focus-in` attribute. The value
|
|
204
|
-
of that attribute should be the name of the action in your controller
|
|
205
|
-
that you wish to invoke.
|
|
206
|
-
For an example on how to use the `focus-in` attribute, please reference the
|
|
207
|
-
example near the top of this file.
|
|
208
|
-
@method focusIn
|
|
209
|
-
@param {Event} event
|
|
210
|
-
@private
|
|
211
|
-
*/
|
|
212
|
-
focusIn(event) {
|
|
213
|
-
sendAction('focus-in', this, event);
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
Allows you to specify a controller action to invoke when a field loses
|
|
218
|
-
focus. To use this method, give your field a `focus-out` attribute. The value
|
|
219
|
-
of that attribute should be the name of the action in your controller
|
|
220
|
-
that you wish to invoke.
|
|
221
|
-
For an example on how to use the `focus-out` attribute, please reference the
|
|
222
|
-
example near the top of this file.
|
|
223
|
-
@method focusOut
|
|
224
|
-
@param {Event} event
|
|
225
|
-
@private
|
|
226
|
-
*/
|
|
227
|
-
focusOut(event) {
|
|
228
|
-
this._elementValueDidChange(event);
|
|
229
|
-
|
|
230
|
-
sendAction('focus-out', this, event);
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
Allows you to specify a controller action to invoke when a key is pressed.
|
|
235
|
-
To use this method, give your field a `key-press` attribute. The value of
|
|
236
|
-
that attribute should be the name of the action in your controller you
|
|
237
|
-
that wish to invoke.
|
|
238
|
-
For an example on how to use the `key-press` attribute, please reference the
|
|
239
|
-
example near the top of this file.
|
|
240
|
-
@method keyPress
|
|
241
|
-
@param {Event} event
|
|
242
|
-
@private
|
|
243
|
-
*/
|
|
244
|
-
keyPress(event) {
|
|
245
|
-
sendAction('key-press', this, event);
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
Allows you to specify a controller action to invoke when a key-up event is
|
|
250
|
-
fired. To use this method, give your field a `key-up` attribute. The value
|
|
251
|
-
of that attribute should be the name of the action in your controller
|
|
252
|
-
that you wish to invoke.
|
|
253
|
-
For an example on how to use the `key-up` attribute, please reference the
|
|
254
|
-
example near the top of this file.
|
|
255
|
-
@method keyUp
|
|
256
|
-
@param {Event} event
|
|
257
|
-
@private
|
|
258
|
-
*/
|
|
259
|
-
keyUp(event) {
|
|
260
|
-
this.interpretKeyEvents(event);
|
|
261
|
-
sendAction('key-up', this, event);
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
Allows you to specify a controller action to invoke when a key-down event is
|
|
266
|
-
fired. To use this method, give your field a `key-down` attribute. The value
|
|
267
|
-
of that attribute should be the name of the action in your controller that
|
|
268
|
-
you wish to invoke.
|
|
269
|
-
For an example on how to use the `key-down` attribute, please reference the
|
|
270
|
-
example near the top of this file.
|
|
271
|
-
@method keyDown
|
|
272
|
-
@param {Event} event
|
|
273
|
-
@private
|
|
274
|
-
*/
|
|
275
|
-
keyDown(event) {
|
|
276
|
-
sendAction('key-down', this, event);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
}); // In principle, this shouldn't be necessary, but the legacy
|
|
280
|
-
// sendAction semantics for TextField are different from
|
|
281
|
-
// the component semantics so this method normalizes them.
|
|
282
|
-
|
|
283
|
-
function sendAction(eventName, view, event) {
|
|
284
|
-
let action = get(view, `attrs.${eventName}`);
|
|
285
|
-
|
|
286
|
-
if (action !== null && typeof action === 'object' && action[MUTABLE_CELL] === true) {
|
|
287
|
-
action = action.value;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (action === undefined) {
|
|
291
|
-
action = get(view, eventName);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
let value = get(view, 'value');
|
|
295
|
-
|
|
296
|
-
if (SEND_ACTION && typeof action === 'string') {
|
|
297
|
-
let message = `Passing actions to components as strings (like \`<Input @${eventName}="${action}" />\`) is deprecated. Please use closure actions instead (\`<Input @${eventName}={{action "${action}"}} />\`).`;
|
|
298
|
-
deprecate(message, false, {
|
|
299
|
-
id: 'ember-component.send-action',
|
|
300
|
-
until: '4.0.0',
|
|
301
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
|
|
302
|
-
for: 'ember-source',
|
|
303
|
-
since: {
|
|
304
|
-
enabled: '3.4.0'
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
view.triggerAction({
|
|
308
|
-
action: action,
|
|
309
|
-
actionContext: [value, event]
|
|
310
|
-
});
|
|
311
|
-
} else if (typeof action === 'function') {
|
|
312
|
-
action(value, event);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (action && !get(view, 'bubbles')) {
|
|
316
|
-
event.stopPropagation();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (true
|
|
321
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
322
|
-
) {
|
|
323
|
-
Object.defineProperty(TextSupport, '_wasReopened', {
|
|
324
|
-
configurable: true,
|
|
325
|
-
enumerable: false,
|
|
326
|
-
writable: true,
|
|
327
|
-
value: false
|
|
328
|
-
});
|
|
329
|
-
Object.defineProperty(TextSupport, 'reopen', {
|
|
330
|
-
configurable: true,
|
|
331
|
-
enumerable: false,
|
|
332
|
-
writable: true,
|
|
333
|
-
value: function reopen(...args) {
|
|
334
|
-
if (this === TextSupport) {
|
|
335
|
-
deprecate('Reopening Ember.TextSupport is deprecated.', false, {
|
|
336
|
-
id: 'ember.built-in-components.reopen',
|
|
337
|
-
for: 'ember-source',
|
|
338
|
-
since: {
|
|
339
|
-
enabled: '3.27.0'
|
|
340
|
-
},
|
|
341
|
-
until: '4.0.0',
|
|
342
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen'
|
|
343
|
-
});
|
|
344
|
-
TextSupport._wasReopened = true;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return Mixin.prototype.reopen.call(this, ...args);
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
if (DEBUG) {
|
|
352
|
-
Object.seal(TextSupport);
|
|
353
|
-
Mixin._disableDebugSeal = false;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export default TextSupport;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { context } from '@ember/-internals/environment';
|
|
2
|
-
import { hasDOM } from '@ember/-internals/browser-environment';
|
|
3
|
-
import { ENV } from '@ember/-internals/environment';
|
|
4
|
-
import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
|
|
5
|
-
export let jQuery;
|
|
6
|
-
export let jQueryDisabled = !JQUERY_INTEGRATION || ENV._JQUERY_INTEGRATION === false;
|
|
7
|
-
|
|
8
|
-
if (JQUERY_INTEGRATION && hasDOM) {
|
|
9
|
-
jQuery = context.imports.jQuery;
|
|
10
|
-
|
|
11
|
-
if (!jQueryDisabled && jQuery) {
|
|
12
|
-
if (jQuery.event.addProp) {
|
|
13
|
-
jQuery.event.addProp('dataTransfer');
|
|
14
|
-
} else {
|
|
15
|
-
// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents
|
|
16
|
-
['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend'].forEach(eventName => {
|
|
17
|
-
jQuery.event.fixHooks[eventName] = {
|
|
18
|
-
props: ['dataTransfer']
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
jQuery = undefined;
|
|
24
|
-
jQueryDisabled = true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/* global Proxy */
|
|
2
|
-
import { deprecate } from '@ember/debug';
|
|
3
|
-
import { global } from '@ember/-internals/environment';
|
|
4
|
-
import { HAS_NATIVE_PROXY } from '@ember/-internals/utils';
|
|
5
|
-
import { DEBUG } from '@glimmer/env';
|
|
6
|
-
import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
|
|
7
|
-
export default function addJQueryEventDeprecation(jqEvent) {
|
|
8
|
-
if (DEBUG && JQUERY_INTEGRATION && HAS_NATIVE_PROXY) {
|
|
9
|
-
let boundFunctions = new Map(); // wrap the jQuery event in a Proxy to add the deprecation message for originalEvent, according to RFC#294
|
|
10
|
-
// we need a native Proxy here, so we can make sure that the internal use of originalEvent in jQuery itself does
|
|
11
|
-
// not trigger a deprecation
|
|
12
|
-
|
|
13
|
-
return new Proxy(jqEvent, {
|
|
14
|
-
get(target, name) {
|
|
15
|
-
switch (name) {
|
|
16
|
-
case 'originalEvent':
|
|
17
|
-
deprecate('Accessing jQuery.Event specific properties is deprecated. Either use the ember-jquery-legacy addon to normalize events to native events, or explicitly opt into jQuery integration using @ember/optional-features.', (EmberENV => {
|
|
18
|
-
// this deprecation is intentionally checking `global.EmberENV` so
|
|
19
|
-
// that we can ensure we _only_ deprecate in the case where jQuery
|
|
20
|
-
// integration is enabled implicitly (e.g. "defaulted" to enabled)
|
|
21
|
-
// as opposed to when the user explicitly opts in to using jQuery
|
|
22
|
-
if (typeof EmberENV !== 'object' || EmberENV === null) return false;
|
|
23
|
-
return EmberENV._JQUERY_INTEGRATION === true;
|
|
24
|
-
})(global.EmberENV), {
|
|
25
|
-
id: 'ember-views.event-dispatcher.jquery-event',
|
|
26
|
-
until: '4.0.0',
|
|
27
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-event',
|
|
28
|
-
for: 'ember-source',
|
|
29
|
-
since: {
|
|
30
|
-
enabled: '3.9.0'
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return target[name];
|
|
34
|
-
// provide an escape hatch for ember-jquery-legacy to access originalEvent without a deprecation
|
|
35
|
-
|
|
36
|
-
case '__originalEvent':
|
|
37
|
-
return target.originalEvent;
|
|
38
|
-
|
|
39
|
-
default:
|
|
40
|
-
if (typeof target[name] === 'function') {
|
|
41
|
-
// cache functions for reuse
|
|
42
|
-
if (!boundFunctions.has(name)) {
|
|
43
|
-
// for jQuery.Event methods call them with `target` as the `this` context, so they will access
|
|
44
|
-
// `originalEvent` from the original jQuery event, not our proxy, thus not trigger the deprecation
|
|
45
|
-
boundFunctions.set(name, target[name].bind(target));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return boundFunctions.get(name);
|
|
49
|
-
} // same for jQuery's getter functions for simple properties
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return target[name];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return jqEvent;
|
|
60
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { deprecate as _deprecate, deprecateFunc as _deprecateFunc } from '@ember/debug';
|
|
2
|
-
export function deprecate(message, condition, options) {
|
|
3
|
-
_deprecate("`import { deprecate } from '@ember/application/deprecations';` has been deprecated, please update to `import { deprecate } from '@ember/debug';`", false, {
|
|
4
|
-
id: 'old-deprecate-method-paths',
|
|
5
|
-
until: '4.0.0',
|
|
6
|
-
for: 'ember-source',
|
|
7
|
-
since: {
|
|
8
|
-
enabled: '3.0.0'
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
_deprecate(message, condition, options);
|
|
13
|
-
}
|
|
14
|
-
export function deprecateFunc(message, options, func) {
|
|
15
|
-
_deprecate("`import { deprecateFunc } from '@ember/application/deprecations';` has been deprecated, please update to `import { deprecateFunc } from '@ember/debug';`", false, {
|
|
16
|
-
id: 'old-deprecate-method-paths',
|
|
17
|
-
until: '4.0.0',
|
|
18
|
-
for: 'ember-source',
|
|
19
|
-
since: {
|
|
20
|
-
enabled: '3.0.0'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
_deprecateFunc(message, options, func);
|
|
25
|
-
}
|