ember-source 4.6.0-alpha.1 → 4.6.0-alpha.2
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/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +2 -2
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +3 -8
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +119 -419
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
- package/dist/packages/@ember/-internals/metal/index.js +0 -3
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
- package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +73 -364
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +2 -7
- package/docs/data.json +533 -527
- package/package.json +4 -4
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.6.0-alpha.
|
|
9
|
+
* @version 4.6.0-alpha.2
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -5178,14 +5178,25 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5178
5178
|
return string.replace(badChars, escapeChar);
|
|
5179
5179
|
}
|
|
5180
5180
|
/**
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5181
|
+
Use this method to indicate that a string should be rendered as HTML
|
|
5182
|
+
when the string is used in a template. To say this another way,
|
|
5183
|
+
strings marked with `htmlSafe` will not be HTML escaped.
|
|
5184
|
+
|
|
5185
|
+
A word of warning - The `htmlSafe` method does not make the string safe;
|
|
5186
|
+
it only tells the framework to treat the string as if it is safe to render
|
|
5187
|
+
as HTML. If a string contains user inputs or other untrusted
|
|
5188
|
+
data, you must sanitize the string before using the `htmlSafe` method.
|
|
5189
|
+
Otherwise your code is vulnerable to
|
|
5190
|
+
[Cross-Site Scripting](https://owasp.org/www-community/attacks/DOM_Based_XSS).
|
|
5191
|
+
There are many open source sanitization libraries to choose from,
|
|
5192
|
+
both for front end and server-side sanitization.
|
|
5184
5193
|
|
|
5185
5194
|
```javascript
|
|
5186
5195
|
import { htmlSafe } from '@ember/template';
|
|
5187
5196
|
|
|
5188
|
-
|
|
5197
|
+
const someTrustedOrSanitizedString = "<div>Hello!</div>"
|
|
5198
|
+
|
|
5199
|
+
htmlSafe(someTrustedorSanitizedString)
|
|
5189
5200
|
```
|
|
5190
5201
|
|
|
5191
5202
|
@method htmlSafe
|
|
@@ -7434,7 +7445,9 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7434
7445
|
return value;
|
|
7435
7446
|
}
|
|
7436
7447
|
|
|
7437
|
-
}
|
|
7448
|
+
}
|
|
7449
|
+
|
|
7450
|
+
var NO_OP = () => {}; // This wrapper logic prevents us from rerendering in case of a hard failure
|
|
7438
7451
|
// during render. This prevents infinite revalidation type loops from occuring,
|
|
7439
7452
|
// and ensures that errors are not swallowed by subsequent follow on failures.
|
|
7440
7453
|
|
|
@@ -7542,10 +7555,6 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7542
7555
|
}
|
|
7543
7556
|
}
|
|
7544
7557
|
|
|
7545
|
-
function K() {
|
|
7546
|
-
/* noop */
|
|
7547
|
-
}
|
|
7548
|
-
|
|
7549
7558
|
var renderSettledDeferred = null;
|
|
7550
7559
|
/*
|
|
7551
7560
|
Returns a promise which will resolve when rendering has settled. Settled in
|
|
@@ -7564,7 +7573,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7564
7573
|
|
|
7565
7574
|
if (!(0, _runloop._getCurrentRunLoop)()) {
|
|
7566
7575
|
// ensure a runloop has been kicked off
|
|
7567
|
-
_runloop._backburner.schedule('actions', null,
|
|
7576
|
+
_runloop._backburner.schedule('actions', null, NO_OP);
|
|
7568
7577
|
}
|
|
7569
7578
|
}
|
|
7570
7579
|
|
|
@@ -7593,7 +7602,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7593
7602
|
}
|
|
7594
7603
|
|
|
7595
7604
|
loops++;
|
|
7596
|
-
return _runloop._backburner.join(null,
|
|
7605
|
+
return _runloop._backburner.join(null, NO_OP);
|
|
7597
7606
|
}
|
|
7598
7607
|
}
|
|
7599
7608
|
|
|
@@ -8901,10 +8910,6 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
8901
8910
|
_exports.tracked = tracked;
|
|
8902
8911
|
_exports.trySet = trySet;
|
|
8903
8912
|
|
|
8904
|
-
/**
|
|
8905
|
-
@module @ember/object
|
|
8906
|
-
*/
|
|
8907
|
-
|
|
8908
8913
|
/*
|
|
8909
8914
|
The event system uses a series of nested hashes to store listeners on an
|
|
8910
8915
|
object. When a listener is registered, or when an event arrives, these
|
|
@@ -17067,9 +17072,6 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
17067
17072
|
_exports.default = void 0;
|
|
17068
17073
|
_exports.triggerEvent = triggerEvent;
|
|
17069
17074
|
|
|
17070
|
-
/**
|
|
17071
|
-
@module @ember/routing
|
|
17072
|
-
*/
|
|
17073
17075
|
function defaultDidTransition(infos) {
|
|
17074
17076
|
updatePaths(this);
|
|
17075
17077
|
|
|
@@ -28499,31 +28501,21 @@ define("@ember/controller/lib/controller_mixin", ["exports", "@ember/-internals/
|
|
|
28499
28501
|
});
|
|
28500
28502
|
_exports.default = void 0;
|
|
28501
28503
|
var MODEL = (0, _utils.symbol)('MODEL');
|
|
28502
|
-
/**
|
|
28503
|
-
@module ember
|
|
28504
|
-
*/
|
|
28505
|
-
|
|
28506
|
-
/**
|
|
28507
|
-
@class ControllerMixin
|
|
28508
|
-
@namespace Ember
|
|
28509
|
-
@uses Ember.ActionHandler
|
|
28510
|
-
@private
|
|
28511
|
-
*/
|
|
28512
28504
|
|
|
28513
|
-
var
|
|
28505
|
+
var ControllerMixin = _metal.Mixin.create(_runtime.ActionHandler, {
|
|
28514
28506
|
/* ducktype as a controller */
|
|
28515
28507
|
isController: true,
|
|
28516
28508
|
|
|
28517
28509
|
/**
|
|
28518
28510
|
The object to which actions from the view should be sent.
|
|
28519
|
-
|
|
28511
|
+
For example, when a Handlebars template uses the `{{action}}` helper,
|
|
28520
28512
|
it will attempt to send the action to the view's controller's `target`.
|
|
28521
|
-
|
|
28513
|
+
By default, the value of the target property is set to the router, and
|
|
28522
28514
|
is injected when a controller is instantiated. This injection is applied
|
|
28523
28515
|
as part of the application's initialization process. In most cases the
|
|
28524
28516
|
`target` property will automatically be set to the logical consumer of
|
|
28525
28517
|
actions for the controller.
|
|
28526
|
-
|
|
28518
|
+
@property target
|
|
28527
28519
|
@default null
|
|
28528
28520
|
@public
|
|
28529
28521
|
*/
|
|
@@ -28533,7 +28525,7 @@ define("@ember/controller/lib/controller_mixin", ["exports", "@ember/-internals/
|
|
|
28533
28525
|
/**
|
|
28534
28526
|
The controller's current model. When retrieving or modifying a controller's
|
|
28535
28527
|
model, this property should be used instead of the `content` property.
|
|
28536
|
-
|
|
28528
|
+
@property model
|
|
28537
28529
|
@public
|
|
28538
28530
|
*/
|
|
28539
28531
|
model: (0, _metal.computed)({
|
|
@@ -28541,13 +28533,14 @@ define("@ember/controller/lib/controller_mixin", ["exports", "@ember/-internals/
|
|
|
28541
28533
|
return this[MODEL];
|
|
28542
28534
|
},
|
|
28543
28535
|
|
|
28544
|
-
set(
|
|
28536
|
+
set(_key, value) {
|
|
28545
28537
|
return this[MODEL] = value;
|
|
28546
28538
|
}
|
|
28547
28539
|
|
|
28548
28540
|
})
|
|
28549
28541
|
});
|
|
28550
28542
|
|
|
28543
|
+
var _default = ControllerMixin;
|
|
28551
28544
|
_exports.default = _default;
|
|
28552
28545
|
});
|
|
28553
28546
|
define("@ember/debug/container-debug-adapter", ["exports", "@ember/-internals/extension-support"], function (_exports, _extensionSupport) {
|
|
@@ -31350,8 +31343,7 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
|
|
|
31350
31343
|
expandedProperties.push(entry);
|
|
31351
31344
|
}
|
|
31352
31345
|
|
|
31353
|
-
for (var
|
|
31354
|
-
var property = properties[i];
|
|
31346
|
+
for (var property of properties) {
|
|
31355
31347
|
(true && !(property.indexOf(' ') < 0) && (0, _debug.assert)(`Dependent keys passed to \`${predicateName}\` computed macro can't have spaces.`, property.indexOf(' ') < 0));
|
|
31356
31348
|
(0, _metal.expandProperties)(property, extractProperty);
|
|
31357
31349
|
}
|
|
@@ -31360,23 +31352,26 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
|
|
|
31360
31352
|
}
|
|
31361
31353
|
|
|
31362
31354
|
function generateComputedWithPredicate(name, predicate) {
|
|
31363
|
-
return function () {
|
|
31364
|
-
for (var _len = arguments.length,
|
|
31365
|
-
|
|
31355
|
+
return function (dependentKey) {
|
|
31356
|
+
for (var _len = arguments.length, additionalDependentKeys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
31357
|
+
additionalDependentKeys[_key - 1] = arguments[_key];
|
|
31366
31358
|
}
|
|
31367
31359
|
|
|
31360
|
+
var properties = [dependentKey, ...additionalDependentKeys];
|
|
31368
31361
|
(true && !(!(0, _metal.isElementDescriptor)(properties)) && (0, _debug.assert)(`You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`, !(0, _metal.isElementDescriptor)(properties)));
|
|
31369
31362
|
var dependentKeys = expandPropertiesToArray(name, properties);
|
|
31370
31363
|
var computedFunc = (0, _metal.computed)(...dependentKeys, function () {
|
|
31371
31364
|
var lastIdx = dependentKeys.length - 1;
|
|
31372
31365
|
|
|
31373
31366
|
for (var i = 0; i < lastIdx; i++) {
|
|
31367
|
+
// SAFETY: `i` is derived from the length of `dependentKeys`
|
|
31374
31368
|
var value = (0, _metal.get)(this, dependentKeys[i]);
|
|
31375
31369
|
|
|
31376
31370
|
if (!predicate(value)) {
|
|
31377
31371
|
return value;
|
|
31378
31372
|
}
|
|
31379
|
-
}
|
|
31373
|
+
} // SAFETY: `lastIdx` is derived from the length of `dependentKeys`
|
|
31374
|
+
|
|
31380
31375
|
|
|
31381
31376
|
return (0, _metal.get)(this, dependentKeys[lastIdx]);
|
|
31382
31377
|
});
|
|
@@ -32137,7 +32132,7 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
|
|
|
32137
32132
|
});
|
|
32138
32133
|
}
|
|
32139
32134
|
});
|
|
32140
|
-
define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/debug", "@ember/-internals/metal", "@ember/-internals/runtime"], function (_exports, _debug, _metal, _runtime) {
|
|
32135
|
+
define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/debug", "@ember/-internals/metal", "@ember/-internals/runtime", "@ember/-internals/runtime/lib/mixins/array"], function (_exports, _debug, _metal, _runtime, _array) {
|
|
32141
32136
|
"use strict";
|
|
32142
32137
|
|
|
32143
32138
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -32161,6 +32156,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32161
32156
|
/**
|
|
32162
32157
|
@module @ember/object
|
|
32163
32158
|
*/
|
|
32159
|
+
function isNativeOrEmberArray(obj) {
|
|
32160
|
+
return Array.isArray(obj) || _array.default.detect(obj);
|
|
32161
|
+
}
|
|
32162
|
+
|
|
32164
32163
|
function reduceMacro(dependentKey, callback, initialValue, name) {
|
|
32165
32164
|
(true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`${name}\` computed macro shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
|
32166
32165
|
return (0, _metal.computed)(`${dependentKey}.[]`, function () {
|
|
@@ -32188,7 +32187,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32188
32187
|
return (0, _metal.computed)(dependentKey, ...additionalDependentKeys, function () {
|
|
32189
32188
|
var value = (0, _metal.get)(this, propertyName);
|
|
32190
32189
|
|
|
32191
|
-
if ((
|
|
32190
|
+
if (isNativeOrEmberArray(value)) {
|
|
32192
32191
|
return (0, _runtime.A)(callback.call(this, value));
|
|
32193
32192
|
} else {
|
|
32194
32193
|
return (0, _runtime.A)();
|
|
@@ -32360,95 +32359,25 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32360
32359
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @min as a decorator directly, but it requires a `dependentKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32361
32360
|
return reduceMacro(dependentKey, (min, item) => Math.min(min, item), Infinity, 'min');
|
|
32362
32361
|
}
|
|
32363
|
-
/**
|
|
32364
|
-
Returns an array mapped via the callback
|
|
32365
|
-
|
|
32366
|
-
The callback method you provide should have the following signature:
|
|
32367
|
-
- `item` is the current item in the iteration.
|
|
32368
|
-
- `index` is the integer index of the current item in the iteration.
|
|
32369
|
-
|
|
32370
|
-
```javascript
|
|
32371
|
-
function mapCallback(item, index);
|
|
32372
|
-
```
|
|
32373
|
-
|
|
32374
|
-
Example:
|
|
32375
|
-
|
|
32376
|
-
```javascript
|
|
32377
|
-
import { set } from '@ember/object';
|
|
32378
|
-
import { map } from '@ember/object/computed';
|
|
32379
|
-
|
|
32380
|
-
class Hamster {
|
|
32381
|
-
constructor(chores) {
|
|
32382
|
-
set(this, 'chores', chores);
|
|
32383
|
-
}
|
|
32384
|
-
|
|
32385
|
-
@map('chores', function(chore, index) {
|
|
32386
|
-
return `${chore.toUpperCase()}!`;
|
|
32387
|
-
})
|
|
32388
|
-
excitingChores;
|
|
32389
|
-
});
|
|
32390
|
-
|
|
32391
|
-
let hamster = new Hamster(['clean', 'write more unit tests']);
|
|
32392
|
-
|
|
32393
|
-
hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
|
|
32394
|
-
```
|
|
32395
|
-
|
|
32396
|
-
You can optionally pass an array of additional dependent keys as the second
|
|
32397
|
-
parameter to the macro, if your map function relies on any external values:
|
|
32398
|
-
|
|
32399
|
-
```javascript
|
|
32400
|
-
import { set } from '@ember/object';
|
|
32401
|
-
import { map } from '@ember/object/computed';
|
|
32402
|
-
|
|
32403
|
-
class Hamster {
|
|
32404
|
-
shouldUpperCase = false;
|
|
32405
|
-
|
|
32406
|
-
constructor(chores) {
|
|
32407
|
-
set(this, 'chores', chores);
|
|
32408
|
-
}
|
|
32409
|
-
|
|
32410
|
-
@map('chores', ['shouldUpperCase'], function(chore, index) {
|
|
32411
|
-
if (this.shouldUpperCase) {
|
|
32412
|
-
return `${chore.toUpperCase()}!`;
|
|
32413
|
-
} else {
|
|
32414
|
-
return `${chore}!`;
|
|
32415
|
-
}
|
|
32416
|
-
})
|
|
32417
|
-
excitingChores;
|
|
32418
|
-
}
|
|
32419
|
-
|
|
32420
|
-
let hamster = new Hamster(['clean', 'write more unit tests']);
|
|
32421
|
-
|
|
32422
|
-
hamster.excitingChores; // ['clean!', 'write more unit tests!']
|
|
32423
|
-
|
|
32424
|
-
set(hamster, 'shouldUpperCase', true);
|
|
32425
|
-
hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
|
|
32426
|
-
```
|
|
32427
|
-
|
|
32428
|
-
@method map
|
|
32429
|
-
@for @ember/object/computed
|
|
32430
|
-
@static
|
|
32431
|
-
@param {String} dependentKey
|
|
32432
|
-
@param {Array} [additionalDependentKeys] optional array of additional
|
|
32433
|
-
dependent keys
|
|
32434
|
-
@param {Function} callback
|
|
32435
|
-
@return {ComputedProperty} an array mapped via the callback
|
|
32436
|
-
@public
|
|
32437
|
-
*/
|
|
32438
|
-
|
|
32439
32362
|
|
|
32440
|
-
function map(dependentKey,
|
|
32363
|
+
function map(dependentKey, additionalDependentKeysOrCallback, callback) {
|
|
32441
32364
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @map as a decorator directly, but it requires atleast `dependentKey` and `callback` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32365
|
+
(true && !(typeof callback === 'function' || callback === undefined && typeof additionalDependentKeysOrCallback === 'function') && (0, _debug.assert)('The final parameter provided to map must be a callback function', typeof callback === 'function' || callback === undefined && typeof additionalDependentKeysOrCallback === 'function'));
|
|
32366
|
+
(true && !(Array.isArray(additionalDependentKeysOrCallback) || typeof additionalDependentKeysOrCallback === 'function') && (0, _debug.assert)('The second parameter provided to map must either be the callback or an array of additional dependent keys', Array.isArray(additionalDependentKeysOrCallback) || typeof additionalDependentKeysOrCallback === 'function'));
|
|
32367
|
+
var additionalDependentKeys;
|
|
32442
32368
|
|
|
32443
|
-
if (
|
|
32444
|
-
callback =
|
|
32369
|
+
if (typeof additionalDependentKeysOrCallback === 'function') {
|
|
32370
|
+
callback = additionalDependentKeysOrCallback;
|
|
32445
32371
|
additionalDependentKeys = [];
|
|
32372
|
+
} else {
|
|
32373
|
+
additionalDependentKeys = additionalDependentKeysOrCallback;
|
|
32446
32374
|
}
|
|
32447
32375
|
|
|
32448
|
-
|
|
32449
|
-
(true && !(
|
|
32376
|
+
var cCallback = callback;
|
|
32377
|
+
(true && !(cCallback) && (0, _debug.assert)('[BUG] Missing callback', cCallback));
|
|
32450
32378
|
return arrayMacro(dependentKey, additionalDependentKeys, function (value) {
|
|
32451
|
-
|
|
32379
|
+
// This is so dumb...
|
|
32380
|
+
return Array.isArray(value) ? value.map(cCallback, this) : value.map(cCallback, this);
|
|
32452
32381
|
});
|
|
32453
32382
|
}
|
|
32454
32383
|
/**
|
|
@@ -32507,125 +32436,24 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32507
32436
|
(true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`mapBy\` computed macro shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
|
32508
32437
|
return map(`${dependentKey}.@each.${propertyKey}`, item => (0, _metal.get)(item, propertyKey));
|
|
32509
32438
|
}
|
|
32510
|
-
/**
|
|
32511
|
-
Filters the array by the callback.
|
|
32512
|
-
|
|
32513
|
-
The callback method you provide should have the following signature:
|
|
32514
|
-
- `item` is the current item in the iteration.
|
|
32515
|
-
- `index` is the integer index of the current item in the iteration.
|
|
32516
|
-
- `array` is the dependant array itself.
|
|
32517
|
-
|
|
32518
|
-
```javascript
|
|
32519
|
-
function filterCallback(item, index, array);
|
|
32520
|
-
```
|
|
32521
|
-
|
|
32522
|
-
Example:
|
|
32523
|
-
|
|
32524
|
-
```javascript
|
|
32525
|
-
import { set } from '@ember/object';
|
|
32526
|
-
import { filter } from '@ember/object/computed';
|
|
32527
|
-
|
|
32528
|
-
class Hamster {
|
|
32529
|
-
constructor(chores) {
|
|
32530
|
-
set(this, 'chores', chores);
|
|
32531
|
-
}
|
|
32532
|
-
|
|
32533
|
-
@filter('chores', function(chore, index, array) {
|
|
32534
|
-
return !chore.done;
|
|
32535
|
-
})
|
|
32536
|
-
remainingChores;
|
|
32537
|
-
}
|
|
32538
|
-
|
|
32539
|
-
let hamster = Hamster.create([
|
|
32540
|
-
{ name: 'cook', done: true },
|
|
32541
|
-
{ name: 'clean', done: true },
|
|
32542
|
-
{ name: 'write more unit tests', done: false }
|
|
32543
|
-
]);
|
|
32544
|
-
|
|
32545
|
-
hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
|
|
32546
|
-
```
|
|
32547
|
-
|
|
32548
|
-
You can also use `@each.property` in your dependent key, the callback will
|
|
32549
|
-
still use the underlying array:
|
|
32550
|
-
|
|
32551
|
-
```javascript
|
|
32552
|
-
import { set } from '@ember/object';
|
|
32553
|
-
import { filter } from '@ember/object/computed';
|
|
32554
|
-
|
|
32555
|
-
class Hamster {
|
|
32556
|
-
constructor(chores) {
|
|
32557
|
-
set(this, 'chores', chores);
|
|
32558
|
-
}
|
|
32559
|
-
|
|
32560
|
-
@filter('chores.@each.done', function(chore, index, array) {
|
|
32561
|
-
return !chore.done;
|
|
32562
|
-
})
|
|
32563
|
-
remainingChores;
|
|
32564
|
-
}
|
|
32565
|
-
|
|
32566
|
-
let hamster = new Hamster([
|
|
32567
|
-
{ name: 'cook', done: true },
|
|
32568
|
-
{ name: 'clean', done: true },
|
|
32569
|
-
{ name: 'write more unit tests', done: false }
|
|
32570
|
-
]);
|
|
32571
|
-
hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
|
|
32572
|
-
|
|
32573
|
-
set(hamster.chores[2], 'done', true);
|
|
32574
|
-
hamster.remainingChores; // []
|
|
32575
|
-
```
|
|
32576
|
-
|
|
32577
|
-
Finally, you can optionally pass an array of additional dependent keys as the
|
|
32578
|
-
second parameter to the macro, if your filter function relies on any external
|
|
32579
|
-
values:
|
|
32580
|
-
|
|
32581
|
-
```javascript
|
|
32582
|
-
import { filter } from '@ember/object/computed';
|
|
32583
|
-
|
|
32584
|
-
class Hamster {
|
|
32585
|
-
constructor(chores) {
|
|
32586
|
-
set(this, 'chores', chores);
|
|
32587
|
-
}
|
|
32588
|
-
|
|
32589
|
-
doneKey = 'finished';
|
|
32590
|
-
|
|
32591
|
-
@filter('chores', ['doneKey'], function(chore, index, array) {
|
|
32592
|
-
return !chore[this.doneKey];
|
|
32593
|
-
})
|
|
32594
|
-
remainingChores;
|
|
32595
|
-
}
|
|
32596
|
-
|
|
32597
|
-
let hamster = new Hamster([
|
|
32598
|
-
{ name: 'cook', finished: true },
|
|
32599
|
-
{ name: 'clean', finished: true },
|
|
32600
|
-
{ name: 'write more unit tests', finished: false }
|
|
32601
|
-
]);
|
|
32602
|
-
|
|
32603
|
-
hamster.remainingChores; // [{name: 'write more unit tests', finished: false}]
|
|
32604
|
-
```
|
|
32605
|
-
|
|
32606
|
-
@method filter
|
|
32607
|
-
@for @ember/object/computed
|
|
32608
|
-
@static
|
|
32609
|
-
@param {String} dependentKey
|
|
32610
|
-
@param {Array} [additionalDependentKeys] optional array of additional dependent keys
|
|
32611
|
-
@param {Function} callback
|
|
32612
|
-
@return {ComputedProperty} the filtered array
|
|
32613
|
-
@public
|
|
32614
|
-
*/
|
|
32615
32439
|
|
|
32616
|
-
|
|
32617
|
-
function filter(dependentKey, additionalDependentKeys, callback) {
|
|
32440
|
+
function filter(dependentKey, additionalDependentKeysOrCallback, callback) {
|
|
32618
32441
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @filter as a decorator directly, but it requires atleast `dependentKey` and `callback` parameters', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32442
|
+
(true && !(typeof callback === 'function' || callback === undefined && typeof additionalDependentKeysOrCallback === 'function') && (0, _debug.assert)('The final parameter provided to filter must be a callback function', typeof callback === 'function' || callback === undefined && typeof additionalDependentKeysOrCallback === 'function'));
|
|
32443
|
+
(true && !(Array.isArray(additionalDependentKeysOrCallback) || typeof additionalDependentKeysOrCallback === 'function') && (0, _debug.assert)('The second parameter provided to filter must either be the callback or an array of additional dependent keys', Array.isArray(additionalDependentKeysOrCallback) || typeof additionalDependentKeysOrCallback === 'function'));
|
|
32444
|
+
var additionalDependentKeys;
|
|
32619
32445
|
|
|
32620
|
-
if (
|
|
32621
|
-
callback =
|
|
32446
|
+
if (typeof additionalDependentKeysOrCallback === 'function') {
|
|
32447
|
+
callback = additionalDependentKeysOrCallback;
|
|
32622
32448
|
additionalDependentKeys = [];
|
|
32449
|
+
} else {
|
|
32450
|
+
additionalDependentKeys = additionalDependentKeysOrCallback;
|
|
32623
32451
|
}
|
|
32624
32452
|
|
|
32625
|
-
|
|
32626
|
-
(true && !(Array.isArray(additionalDependentKeys)) && (0, _debug.assert)('The second parameter provided to filter must either be the callback or an array of additional dependent keys', Array.isArray(additionalDependentKeys)));
|
|
32453
|
+
var cCallback = callback;
|
|
32627
32454
|
return arrayMacro(dependentKey, additionalDependentKeys, function (value) {
|
|
32628
|
-
|
|
32455
|
+
// This is a really silly way to keep TS happy
|
|
32456
|
+
return Array.isArray(value) ? value.filter(cCallback, this) : value.filter(cCallback, this);
|
|
32629
32457
|
});
|
|
32630
32458
|
}
|
|
32631
32459
|
/**
|
|
@@ -32716,19 +32544,20 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32716
32544
|
*/
|
|
32717
32545
|
|
|
32718
32546
|
|
|
32719
|
-
function uniq() {
|
|
32720
|
-
for (var _len = arguments.length,
|
|
32721
|
-
|
|
32547
|
+
function uniq(dependentKey) {
|
|
32548
|
+
for (var _len = arguments.length, additionalDependentKeys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
32549
|
+
additionalDependentKeys[_key - 1] = arguments[_key];
|
|
32722
32550
|
}
|
|
32723
32551
|
|
|
32724
32552
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @uniq/@union as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32553
|
+
var args = [dependentKey, ...additionalDependentKeys];
|
|
32725
32554
|
return multiArrayMacro(args, function (dependentKeys) {
|
|
32726
32555
|
var uniq = (0, _runtime.A)();
|
|
32727
32556
|
var seen = new Set();
|
|
32728
32557
|
dependentKeys.forEach(dependentKey => {
|
|
32729
32558
|
var value = (0, _metal.get)(this, dependentKey);
|
|
32730
32559
|
|
|
32731
|
-
if ((
|
|
32560
|
+
if (isNativeOrEmberArray(value)) {
|
|
32732
32561
|
value.forEach(item => {
|
|
32733
32562
|
if (!seen.has(item)) {
|
|
32734
32563
|
seen.add(item);
|
|
@@ -32784,7 +32613,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32784
32613
|
(true && !(!/[[\]{}]/g.test(dependentKey)) && (0, _debug.assert)(`Dependent key passed to \`uniqBy\` computed macro shouldn't contain brace expanding pattern.`, !/[[\]{}]/g.test(dependentKey)));
|
|
32785
32614
|
return (0, _metal.computed)(`${dependentKey}.[]`, function () {
|
|
32786
32615
|
var list = (0, _metal.get)(this, dependentKey);
|
|
32787
|
-
return (
|
|
32616
|
+
return isNativeOrEmberArray(list) ? (0, _runtime.uniqBy)(list, propertyKey) : (0, _runtime.A)();
|
|
32788
32617
|
}).readOnly();
|
|
32789
32618
|
}
|
|
32790
32619
|
/**
|
|
@@ -32873,24 +32702,26 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32873
32702
|
|
|
32874
32703
|
_exports.union = union;
|
|
32875
32704
|
|
|
32876
|
-
function intersect() {
|
|
32877
|
-
for (var _len2 = arguments.length,
|
|
32878
|
-
|
|
32705
|
+
function intersect(dependentKey) {
|
|
32706
|
+
for (var _len2 = arguments.length, additionalDependentKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
32707
|
+
additionalDependentKeys[_key2 - 1] = arguments[_key2];
|
|
32879
32708
|
}
|
|
32880
32709
|
|
|
32881
32710
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @intersect as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32711
|
+
var args = [dependentKey, ...additionalDependentKeys];
|
|
32882
32712
|
return multiArrayMacro(args, function (dependentKeys) {
|
|
32883
32713
|
var arrays = dependentKeys.map(dependentKey => {
|
|
32884
32714
|
var array = (0, _metal.get)(this, dependentKey);
|
|
32885
|
-
return
|
|
32715
|
+
return Array.isArray(array) ? array : [];
|
|
32886
32716
|
});
|
|
32887
|
-
var
|
|
32888
|
-
|
|
32717
|
+
var firstArray = arrays.pop();
|
|
32718
|
+
(true && !(firstArray) && (0, _debug.assert)('Attempted to apply multiArrayMacro for intersect without any dependentKeys', firstArray));
|
|
32719
|
+
var results = firstArray.filter(candidate => {
|
|
32720
|
+
for (var array of arrays) {
|
|
32889
32721
|
var found = false;
|
|
32890
|
-
var array = arrays[i];
|
|
32891
32722
|
|
|
32892
|
-
for (var
|
|
32893
|
-
if (
|
|
32723
|
+
for (var item of array) {
|
|
32724
|
+
if (item === candidate) {
|
|
32894
32725
|
found = true;
|
|
32895
32726
|
break;
|
|
32896
32727
|
}
|
|
@@ -32959,11 +32790,11 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32959
32790
|
var setA = (0, _metal.get)(this, setAProperty);
|
|
32960
32791
|
var setB = (0, _metal.get)(this, setBProperty);
|
|
32961
32792
|
|
|
32962
|
-
if (!(
|
|
32793
|
+
if (!isNativeOrEmberArray(setA)) {
|
|
32963
32794
|
return (0, _runtime.A)();
|
|
32964
32795
|
}
|
|
32965
32796
|
|
|
32966
|
-
if (!(
|
|
32797
|
+
if (!isNativeOrEmberArray(setB)) {
|
|
32967
32798
|
return (0, _runtime.A)(setA);
|
|
32968
32799
|
}
|
|
32969
32800
|
|
|
@@ -33003,12 +32834,13 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
33003
32834
|
*/
|
|
33004
32835
|
|
|
33005
32836
|
|
|
33006
|
-
function collect() {
|
|
33007
|
-
for (var _len3 = arguments.length,
|
|
33008
|
-
|
|
32837
|
+
function collect(dependentKey) {
|
|
32838
|
+
for (var _len3 = arguments.length, additionalDependentKeys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
32839
|
+
additionalDependentKeys[_key3 - 1] = arguments[_key3];
|
|
33009
32840
|
}
|
|
33010
32841
|
|
|
33011
32842
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @collect as a decorator directly, but it requires atleast one dependent key parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
32843
|
+
var dependentKeys = [dependentKey, ...additionalDependentKeys];
|
|
33012
32844
|
return multiArrayMacro(dependentKeys, function () {
|
|
33013
32845
|
var res = dependentKeys.map(key => {
|
|
33014
32846
|
var val = (0, _metal.get)(this, key);
|
|
@@ -33017,148 +32849,8 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
33017
32849
|
return (0, _runtime.A)(res);
|
|
33018
32850
|
}, 'collect');
|
|
33019
32851
|
}
|
|
33020
|
-
/**
|
|
33021
|
-
A computed property which returns a new array with all the properties from the
|
|
33022
|
-
first dependent array sorted based on a property or sort function. The sort
|
|
33023
|
-
macro can be used in two different ways:
|
|
33024
|
-
|
|
33025
|
-
1. By providing a sort callback function
|
|
33026
|
-
2. By providing an array of keys to sort the array
|
|
33027
|
-
|
|
33028
|
-
In the first form, the callback method you provide should have the following
|
|
33029
|
-
signature:
|
|
33030
|
-
|
|
33031
|
-
```javascript
|
|
33032
|
-
function sortCallback(itemA, itemB);
|
|
33033
|
-
```
|
|
33034
|
-
|
|
33035
|
-
- `itemA` the first item to compare.
|
|
33036
|
-
- `itemB` the second item to compare.
|
|
33037
|
-
|
|
33038
|
-
This function should return negative number (e.g. `-1`) when `itemA` should
|
|
33039
|
-
come before `itemB`. It should return positive number (e.g. `1`) when `itemA`
|
|
33040
|
-
should come after `itemB`. If the `itemA` and `itemB` are equal this function
|
|
33041
|
-
should return `0`.
|
|
33042
|
-
|
|
33043
|
-
Therefore, if this function is comparing some numeric values, simple `itemA -
|
|
33044
|
-
itemB` or `itemA.get( 'foo' ) - itemB.get( 'foo' )` can be used instead of
|
|
33045
|
-
series of `if`.
|
|
33046
|
-
|
|
33047
|
-
Example:
|
|
33048
|
-
|
|
33049
|
-
```javascript
|
|
33050
|
-
import { set } from '@ember/object';
|
|
33051
|
-
import { sort } from '@ember/object/computed';
|
|
33052
|
-
|
|
33053
|
-
class ToDoList {
|
|
33054
|
-
constructor(todos) {
|
|
33055
|
-
set(this, 'todos', todos);
|
|
33056
|
-
}
|
|
33057
|
-
|
|
33058
|
-
// using a custom sort function
|
|
33059
|
-
@sort('todos', function(a, b){
|
|
33060
|
-
if (a.priority > b.priority) {
|
|
33061
|
-
return 1;
|
|
33062
|
-
} else if (a.priority < b.priority) {
|
|
33063
|
-
return -1;
|
|
33064
|
-
}
|
|
33065
|
-
|
|
33066
|
-
return 0;
|
|
33067
|
-
})
|
|
33068
|
-
priorityTodos;
|
|
33069
|
-
}
|
|
33070
|
-
|
|
33071
|
-
let todoList = new ToDoList([
|
|
33072
|
-
{ name: 'Unit Test', priority: 2 },
|
|
33073
|
-
{ name: 'Documentation', priority: 3 },
|
|
33074
|
-
{ name: 'Release', priority: 1 }
|
|
33075
|
-
]);
|
|
33076
|
-
|
|
33077
|
-
todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
|
|
33078
|
-
```
|
|
33079
|
-
|
|
33080
|
-
You can also optionally pass an array of additional dependent keys as the
|
|
33081
|
-
second parameter, if your sort function is dependent on additional values that
|
|
33082
|
-
could changes:
|
|
33083
|
-
|
|
33084
|
-
```js
|
|
33085
|
-
import EmberObject, { set } from '@ember/object';
|
|
33086
|
-
import { sort } from '@ember/object/computed';
|
|
33087
|
-
|
|
33088
|
-
class ToDoList {
|
|
33089
|
-
sortKey = 'priority';
|
|
33090
|
-
|
|
33091
|
-
constructor(todos) {
|
|
33092
|
-
set(this, 'todos', todos);
|
|
33093
|
-
}
|
|
33094
|
-
|
|
33095
|
-
// using a custom sort function
|
|
33096
|
-
@sort('todos', ['sortKey'], function(a, b){
|
|
33097
|
-
if (a[this.sortKey] > b[this.sortKey]) {
|
|
33098
|
-
return 1;
|
|
33099
|
-
} else if (a[this.sortKey] < b[this.sortKey]) {
|
|
33100
|
-
return -1;
|
|
33101
|
-
}
|
|
33102
|
-
|
|
33103
|
-
return 0;
|
|
33104
|
-
})
|
|
33105
|
-
sortedTodos;
|
|
33106
|
-
});
|
|
33107
|
-
|
|
33108
|
-
let todoList = new ToDoList([
|
|
33109
|
-
{ name: 'Unit Test', priority: 2 },
|
|
33110
|
-
{ name: 'Documentation', priority: 3 },
|
|
33111
|
-
{ name: 'Release', priority: 1 }
|
|
33112
|
-
]);
|
|
33113
|
-
|
|
33114
|
-
todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
|
|
33115
|
-
```
|
|
33116
|
-
|
|
33117
|
-
In the second form, you should provide the key of the array of sort values as
|
|
33118
|
-
the second parameter:
|
|
33119
|
-
|
|
33120
|
-
```javascript
|
|
33121
|
-
import { set } from '@ember/object';
|
|
33122
|
-
import { sort } from '@ember/object/computed';
|
|
33123
|
-
|
|
33124
|
-
class ToDoList {
|
|
33125
|
-
constructor(todos) {
|
|
33126
|
-
set(this, 'todos', todos);
|
|
33127
|
-
}
|
|
33128
|
-
|
|
33129
|
-
// using standard ascending sort
|
|
33130
|
-
todosSorting = ['name'];
|
|
33131
|
-
@sort('todos', 'todosSorting') sortedTodos;
|
|
33132
|
-
|
|
33133
|
-
// using descending sort
|
|
33134
|
-
todosSortingDesc = ['name:desc'];
|
|
33135
|
-
@sort('todos', 'todosSortingDesc') sortedTodosDesc;
|
|
33136
|
-
}
|
|
33137
|
-
|
|
33138
|
-
let todoList = new ToDoList([
|
|
33139
|
-
{ name: 'Unit Test', priority: 2 },
|
|
33140
|
-
{ name: 'Documentation', priority: 3 },
|
|
33141
|
-
{ name: 'Release', priority: 1 }
|
|
33142
|
-
]);
|
|
33143
|
-
|
|
33144
|
-
todoList.sortedTodos; // [{ name:'Documentation', priority:3 }, { name:'Release', priority:1 }, { name:'Unit Test', priority:2 }]
|
|
33145
|
-
todoList.sortedTodosDesc; // [{ name:'Unit Test', priority:2 }, { name:'Release', priority:1 }, { name:'Documentation', priority:3 }]
|
|
33146
|
-
```
|
|
33147
|
-
|
|
33148
|
-
@method sort
|
|
33149
|
-
@for @ember/object/computed
|
|
33150
|
-
@static
|
|
33151
|
-
@param {String} itemsKey
|
|
33152
|
-
@param {String|Function|Array} sortDefinitionOrDependentKeys The key of the sort definition (an array of sort properties),
|
|
33153
|
-
the sort function, or an array of additional dependent keys
|
|
33154
|
-
@param {Function?} sortDefinition the sort function (when used with additional dependent keys)
|
|
33155
|
-
@return {ComputedProperty} computes a new sorted array based on the sort
|
|
33156
|
-
property array or callback function
|
|
33157
|
-
@public
|
|
33158
|
-
*/
|
|
33159
32852
|
|
|
33160
|
-
|
|
33161
|
-
function sort(itemsKey, additionalDependentKeys, sortDefinition) {
|
|
32853
|
+
function sort(itemsKey, additionalDependentKeysOrDefinition, sortDefinition) {
|
|
33162
32854
|
(true && !(!(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))) && (0, _debug.assert)('You attempted to use @sort as a decorator directly, but it requires atleast an `itemsKey` parameter', !(0, _metal.isElementDescriptor)(Array.prototype.slice.call(arguments))));
|
|
33163
32855
|
|
|
33164
32856
|
if (true
|
|
@@ -33167,25 +32859,31 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
33167
32859
|
var argumentsValid = false;
|
|
33168
32860
|
|
|
33169
32861
|
if (arguments.length === 2) {
|
|
33170
|
-
argumentsValid = typeof itemsKey === 'string' && (typeof
|
|
32862
|
+
argumentsValid = typeof itemsKey === 'string' && (typeof additionalDependentKeysOrDefinition === 'string' || typeof additionalDependentKeysOrDefinition === 'function');
|
|
33171
32863
|
}
|
|
33172
32864
|
|
|
33173
32865
|
if (arguments.length === 3) {
|
|
33174
|
-
argumentsValid = typeof itemsKey === 'string' && Array.isArray(
|
|
32866
|
+
argumentsValid = typeof itemsKey === 'string' && Array.isArray(additionalDependentKeysOrDefinition) && typeof sortDefinition === 'function';
|
|
33175
32867
|
}
|
|
33176
32868
|
|
|
33177
32869
|
(true && !(argumentsValid) && (0, _debug.assert)('The `sort` computed macro can either be used with an array of sort properties or with a sort function. If used with an array of sort properties, it must receive exactly two arguments: the key of the array to sort, and the key of the array of sort properties. If used with a sort function, it may receive up to three arguments: the key of the array to sort, an optional additional array of dependent keys for the computed property, and the sort function.', argumentsValid));
|
|
33178
32870
|
}
|
|
33179
32871
|
|
|
33180
|
-
|
|
33181
|
-
|
|
32872
|
+
var additionalDependentKeys;
|
|
32873
|
+
var sortDefinitionOrString;
|
|
32874
|
+
|
|
32875
|
+
if (Array.isArray(additionalDependentKeysOrDefinition)) {
|
|
32876
|
+
additionalDependentKeys = additionalDependentKeysOrDefinition;
|
|
32877
|
+
sortDefinitionOrString = sortDefinition;
|
|
32878
|
+
} else {
|
|
33182
32879
|
additionalDependentKeys = [];
|
|
32880
|
+
sortDefinitionOrString = additionalDependentKeysOrDefinition;
|
|
33183
32881
|
}
|
|
33184
32882
|
|
|
33185
|
-
if (typeof
|
|
33186
|
-
return customSort(itemsKey, additionalDependentKeys,
|
|
32883
|
+
if (typeof sortDefinitionOrString === 'function') {
|
|
32884
|
+
return customSort(itemsKey, additionalDependentKeys, sortDefinitionOrString);
|
|
33187
32885
|
} else {
|
|
33188
|
-
return propertySort(itemsKey,
|
|
32886
|
+
return propertySort(itemsKey, sortDefinitionOrString);
|
|
33189
32887
|
}
|
|
33190
32888
|
}
|
|
33191
32889
|
|
|
@@ -33200,12 +32898,16 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
33200
32898
|
function propertySort(itemsKey, sortPropertiesKey) {
|
|
33201
32899
|
var cp = (0, _metal.autoComputed)(function (key) {
|
|
33202
32900
|
var sortProperties = (0, _metal.get)(this, sortPropertiesKey);
|
|
33203
|
-
(true && !(
|
|
32901
|
+
(true && !(function (arr) {
|
|
32902
|
+
return isNativeOrEmberArray(arr) && arr.every(s => typeof s === 'string');
|
|
32903
|
+
}(sortProperties)) && (0, _debug.assert)(`The sort definition for '${key}' on ${this} must be a function or an array of strings`, function (arr) {
|
|
32904
|
+
return isNativeOrEmberArray(arr) && arr.every(s => typeof s === 'string');
|
|
32905
|
+
}(sortProperties)));
|
|
33204
32906
|
var itemsKeyIsAtThis = itemsKey === '@this';
|
|
33205
32907
|
var normalizedSortProperties = normalizeSortProperties(sortProperties);
|
|
33206
32908
|
var items = itemsKeyIsAtThis ? this : (0, _metal.get)(this, itemsKey);
|
|
33207
32909
|
|
|
33208
|
-
if (!(
|
|
32910
|
+
if (!isNativeOrEmberArray(items)) {
|
|
33209
32911
|
return (0, _runtime.A)();
|
|
33210
32912
|
}
|
|
33211
32913
|
|
|
@@ -33219,17 +32921,20 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
33219
32921
|
}
|
|
33220
32922
|
|
|
33221
32923
|
function normalizeSortProperties(sortProperties) {
|
|
33222
|
-
|
|
32924
|
+
var callback = p => {
|
|
33223
32925
|
var [prop, direction] = p.split(':');
|
|
33224
|
-
direction = direction || 'asc';
|
|
32926
|
+
direction = direction || 'asc'; // SAFETY: There will always be at least one value returned by split
|
|
32927
|
+
|
|
33225
32928
|
return [prop, direction];
|
|
33226
|
-
}
|
|
32929
|
+
}; // This nonsense is necessary since technically the two map implementations diverge.
|
|
32930
|
+
|
|
32931
|
+
|
|
32932
|
+
return Array.isArray(sortProperties) ? sortProperties.map(callback) : sortProperties.map(callback);
|
|
33227
32933
|
}
|
|
33228
32934
|
|
|
33229
32935
|
function sortByNormalizedSortProperties(items, normalizedSortProperties) {
|
|
33230
32936
|
return (0, _runtime.A)(items.slice().sort((itemA, itemB) => {
|
|
33231
|
-
for (var
|
|
33232
|
-
var [prop, direction] = normalizedSortProperties[i];
|
|
32937
|
+
for (var [prop, direction] of normalizedSortProperties) {
|
|
33233
32938
|
var result = (0, _runtime.compare)((0, _metal.get)(itemA, prop), (0, _metal.get)(itemB, prop));
|
|
33234
32939
|
|
|
33235
32940
|
if (result !== 0) {
|
|
@@ -52620,9 +52325,6 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52620
52325
|
});
|
|
52621
52326
|
_exports.default = void 0;
|
|
52622
52327
|
|
|
52623
|
-
function K() {
|
|
52624
|
-
return this;
|
|
52625
|
-
}
|
|
52626
52328
|
/**
|
|
52627
52329
|
@module @ember/test
|
|
52628
52330
|
*/
|
|
@@ -52634,8 +52336,6 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52634
52336
|
@class TestAdapter
|
|
52635
52337
|
@public
|
|
52636
52338
|
*/
|
|
52637
|
-
|
|
52638
|
-
|
|
52639
52339
|
var _default = _runtime.Object.extend({
|
|
52640
52340
|
/**
|
|
52641
52341
|
This callback will be called whenever an async operation is about to start.
|
|
@@ -52644,14 +52344,14 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52644
52344
|
@public
|
|
52645
52345
|
@method asyncStart
|
|
52646
52346
|
*/
|
|
52647
|
-
asyncStart
|
|
52347
|
+
asyncStart() {},
|
|
52648
52348
|
|
|
52649
52349
|
/**
|
|
52650
52350
|
This callback will be called whenever an async operation has completed.
|
|
52651
52351
|
@public
|
|
52652
52352
|
@method asyncEnd
|
|
52653
52353
|
*/
|
|
52654
|
-
asyncEnd
|
|
52354
|
+
asyncEnd() {},
|
|
52655
52355
|
|
|
52656
52356
|
/**
|
|
52657
52357
|
Override this method with your testing framework's false assertion.
|
|
@@ -54405,7 +54105,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
54405
54105
|
value: true
|
|
54406
54106
|
});
|
|
54407
54107
|
_exports.default = void 0;
|
|
54408
|
-
var _default = "4.6.0-alpha.
|
|
54108
|
+
var _default = "4.6.0-alpha.2";
|
|
54409
54109
|
_exports.default = _default;
|
|
54410
54110
|
});
|
|
54411
54111
|
define("route-recognizer", ["exports"], function (_exports) {
|