angularjs-rails 1.5.8 → 1.6.0
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.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/engine.rb +1 -1
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +75 -60
- data/vendor/assets/javascripts/angular-aria.js +29 -32
- data/vendor/assets/javascripts/angular-cookies.js +19 -11
- data/vendor/assets/javascripts/angular-loader.js +9 -8
- data/vendor/assets/javascripts/angular-message-format.js +61 -70
- data/vendor/assets/javascripts/angular-messages.js +10 -8
- data/vendor/assets/javascripts/angular-mocks.js +392 -114
- data/vendor/assets/javascripts/angular-parse-ext.js +3 -1
- data/vendor/assets/javascripts/angular-resource.js +79 -95
- data/vendor/assets/javascripts/angular-route.js +219 -72
- data/vendor/assets/javascripts/angular-sanitize.js +52 -51
- data/vendor/assets/javascripts/angular-scenario.js +3421 -2491
- data/vendor/assets/javascripts/angular-touch.js +31 -19
- data/vendor/assets/javascripts/angular.js +3332 -2205
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.6.0
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -26,19 +26,19 @@
|
|
26
26
|
*
|
27
27
|
* Below is a more detailed breakdown of the attributes handled by ngAria:
|
28
28
|
*
|
29
|
-
* | Directive | Supported Attributes
|
30
|
-
*
|
29
|
+
* | Directive | Supported Attributes |
|
30
|
+
* |---------------------------------------------|-----------------------------------------------------------------------------------------------------|
|
31
31
|
* | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
|
32
|
-
* | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled
|
33
|
-
* | {@link ng.directive:ngRequired ngRequired} | aria-required
|
34
|
-
* | {@link ng.directive:ngChecked ngChecked} | aria-checked
|
35
|
-
* | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly
|
36
|
-
* | {@link ng.directive:ngValue ngValue} | aria-checked
|
37
|
-
* | {@link ng.directive:ngShow ngShow} | aria-hidden
|
38
|
-
* | {@link ng.directive:ngHide ngHide} | aria-hidden
|
39
|
-
* | {@link ng.directive:ngDblclick ngDblclick} | tabindex
|
40
|
-
* | {@link module:ngMessages ngMessages} | aria-live
|
41
|
-
* | {@link ng.directive:ngClick ngClick} | tabindex,
|
32
|
+
* | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
|
33
|
+
* | {@link ng.directive:ngRequired ngRequired} | aria-required |
|
34
|
+
* | {@link ng.directive:ngChecked ngChecked} | aria-checked |
|
35
|
+
* | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly |
|
36
|
+
* | {@link ng.directive:ngValue ngValue} | aria-checked |
|
37
|
+
* | {@link ng.directive:ngShow ngShow} | aria-hidden |
|
38
|
+
* | {@link ng.directive:ngHide ngHide} | aria-hidden |
|
39
|
+
* | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
|
40
|
+
* | {@link module:ngMessages ngMessages} | aria-live |
|
41
|
+
* | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role |
|
42
42
|
*
|
43
43
|
* Find out more information about each directive by reading the
|
44
44
|
* {@link guide/accessibility ngAria Developer Guide}.
|
@@ -58,7 +58,6 @@
|
|
58
58
|
* {@link ngAria.$ariaProvider#config config} method. For more details, see the
|
59
59
|
* {@link guide/accessibility Developer Guide}.
|
60
60
|
*/
|
61
|
-
/* global -ngAriaModule */
|
62
61
|
var ngAriaModule = angular.module('ngAria', ['ng']).
|
63
62
|
provider('$aria', $AriaProvider);
|
64
63
|
|
@@ -75,6 +74,7 @@ var isNodeOneOf = function(elem, nodeTypeArray) {
|
|
75
74
|
/**
|
76
75
|
* @ngdoc provider
|
77
76
|
* @name $ariaProvider
|
77
|
+
* @this
|
78
78
|
*
|
79
79
|
* @description
|
80
80
|
*
|
@@ -103,7 +103,7 @@ function $AriaProvider() {
|
|
103
103
|
ariaInvalid: true,
|
104
104
|
ariaValue: true,
|
105
105
|
tabindex: true,
|
106
|
-
|
106
|
+
bindKeydown: true,
|
107
107
|
bindRoleForClick: true
|
108
108
|
};
|
109
109
|
|
@@ -119,12 +119,15 @@ function $AriaProvider() {
|
|
119
119
|
* - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
|
120
120
|
* - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
|
121
121
|
* - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
|
122
|
-
* - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and
|
122
|
+
* - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and
|
123
|
+
* aria-valuenow tags
|
123
124
|
* - **tabindex** – `{boolean}` – Enables/disables tabindex tags
|
124
|
-
* - **
|
125
|
-
* `li`
|
126
|
-
*
|
127
|
-
*
|
125
|
+
* - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive
|
126
|
+
* elements (such as `div` or `li`) using ng-click, making them more accessible to users of
|
127
|
+
* assistive technologies
|
128
|
+
* - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as
|
129
|
+
* `div` or `li`) using ng-click, making them more accessible to users of assistive
|
130
|
+
* technologies
|
128
131
|
*
|
129
132
|
* @description
|
130
133
|
* Enables/disables various ARIA attributes
|
@@ -233,8 +236,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
|
|
233
236
|
function shouldAttachRole(role, elem) {
|
234
237
|
// if element does not have role attribute
|
235
238
|
// AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
|
236
|
-
// AND element is not
|
237
|
-
return !elem.attr('role') && (elem.attr('type') === role) && (elem
|
239
|
+
// AND element is not in nodeBlackList
|
240
|
+
return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, nodeBlackList);
|
238
241
|
}
|
239
242
|
|
240
243
|
function getShape(attr, elem) {
|
@@ -254,14 +257,6 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
|
|
254
257
|
var shape = getShape(attr, elem);
|
255
258
|
|
256
259
|
return {
|
257
|
-
pre: function(scope, elem, attr, ngModel) {
|
258
|
-
if (shape === 'checkbox') {
|
259
|
-
//Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
|
260
|
-
ngModel.$isEmpty = function(value) {
|
261
|
-
return value === false;
|
262
|
-
};
|
263
|
-
}
|
264
|
-
},
|
265
260
|
post: function(scope, elem, attr, ngModel) {
|
266
261
|
var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false);
|
267
262
|
|
@@ -270,6 +265,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
|
|
270
265
|
}
|
271
266
|
|
272
267
|
function getRadioReaction(newVal) {
|
268
|
+
// Strict comparison would cause a BC
|
269
|
+
// eslint-disable-next-line eqeqeq
|
273
270
|
var boolVal = (attr.value == ngModel.$viewValue);
|
274
271
|
elem.attr('aria-checked', boolVal);
|
275
272
|
}
|
@@ -376,8 +373,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
|
|
376
373
|
elem.attr('tabindex', 0);
|
377
374
|
}
|
378
375
|
|
379
|
-
if ($aria.config('
|
380
|
-
elem.on('
|
376
|
+
if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) {
|
377
|
+
elem.on('keydown', function(event) {
|
381
378
|
var keyCode = event.which || event.keyCode;
|
382
379
|
if (keyCode === 32 || keyCode === 13) {
|
383
380
|
scope.$apply(callback);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.6.0
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -28,7 +28,7 @@ angular.module('ngCookies', ['ng']).
|
|
28
28
|
* @description
|
29
29
|
* Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
|
30
30
|
* */
|
31
|
-
provider('$cookies', [function $CookiesProvider() {
|
31
|
+
provider('$cookies', [/** @this */function $CookiesProvider() {
|
32
32
|
/**
|
33
33
|
* @ngdoc property
|
34
34
|
* @name $cookiesProvider#defaults
|
@@ -51,6 +51,16 @@ angular.module('ngCookies', ['ng']).
|
|
51
51
|
* Note: By default, the address that appears in your `<base>` tag will be used as the path.
|
52
52
|
* This is important so that cookies will be visible for all routes when html5mode is enabled.
|
53
53
|
*
|
54
|
+
* @example
|
55
|
+
*
|
56
|
+
* ```js
|
57
|
+
* angular.module('cookiesProviderExample', ['ngCookies'])
|
58
|
+
* .config(['$cookiesProvider', function($cookiesProvider) {
|
59
|
+
* // Setting default options
|
60
|
+
* $cookiesProvider.defaults.domain = 'foo.com';
|
61
|
+
* $cookiesProvider.defaults.secure = true;
|
62
|
+
* }]);
|
63
|
+
* ```
|
54
64
|
**/
|
55
65
|
var defaults = this.defaults = {};
|
56
66
|
|
@@ -184,6 +194,9 @@ angular.module('ngCookies').
|
|
184
194
|
* @ngdoc service
|
185
195
|
* @name $cookieStore
|
186
196
|
* @deprecated
|
197
|
+
* sinceVersion="v1.4.0"
|
198
|
+
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
|
199
|
+
*
|
187
200
|
* @requires $cookies
|
188
201
|
*
|
189
202
|
* @description
|
@@ -193,11 +206,6 @@ angular.module('ngCookies').
|
|
193
206
|
*
|
194
207
|
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
195
208
|
*
|
196
|
-
* <div class="alert alert-danger">
|
197
|
-
* **Note:** The $cookieStore service is **deprecated**.
|
198
|
-
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
|
199
|
-
* </div>
|
200
|
-
*
|
201
209
|
* @example
|
202
210
|
*
|
203
211
|
* ```js
|
@@ -299,9 +307,9 @@ function $$CookieWriter($document, $log, $browser) {
|
|
299
307
|
// - 4096 bytes per cookie
|
300
308
|
var cookieLength = str.length + 1;
|
301
309
|
if (cookieLength > 4096) {
|
302
|
-
$log.warn(
|
303
|
-
|
304
|
-
cookieLength +
|
310
|
+
$log.warn('Cookie \'' + name +
|
311
|
+
'\' possibly not set or overflowed because it was too large (' +
|
312
|
+
cookieLength + ' > 4096 bytes)!');
|
305
313
|
}
|
306
314
|
|
307
315
|
return str;
|
@@ -314,7 +322,7 @@ function $$CookieWriter($document, $log, $browser) {
|
|
314
322
|
|
315
323
|
$$CookieWriter.$inject = ['$document', '$log', '$browser'];
|
316
324
|
|
317
|
-
angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() {
|
325
|
+
angular.module('ngCookies').provider('$$cookieWriter', /** @this */ function $$CookieWriterProvider() {
|
318
326
|
this.$get = $$CookieWriter;
|
319
327
|
});
|
320
328
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.6.0
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -87,7 +87,7 @@ function minErr(module, ErrorConstructor) {
|
|
87
87
|
return match;
|
88
88
|
});
|
89
89
|
|
90
|
-
message += '\nhttp://errors.angularjs.org/1.
|
90
|
+
message += '\nhttp://errors.angularjs.org/1.6.0/' +
|
91
91
|
(module ? module + '/' : '') + code;
|
92
92
|
|
93
93
|
for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
|
@@ -190,9 +190,9 @@ function setupModuleLoader(window) {
|
|
190
190
|
}
|
191
191
|
return ensure(modules, name, function() {
|
192
192
|
if (!requires) {
|
193
|
-
throw $injectorMinErr('nomod',
|
194
|
-
|
195
|
-
|
193
|
+
throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
|
194
|
+
'the module name or forgot to load it. If registering a module ensure that you ' +
|
195
|
+
'specify the dependencies as the second argument.', name);
|
196
196
|
}
|
197
197
|
|
198
198
|
/** @type {!Array.<Array.<*>>} */
|
@@ -302,7 +302,7 @@ function setupModuleLoader(window) {
|
|
302
302
|
* @description
|
303
303
|
* See {@link auto.$provide#decorator $provide.decorator()}.
|
304
304
|
*/
|
305
|
-
decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
|
305
|
+
decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
|
306
306
|
|
307
307
|
/**
|
308
308
|
* @ngdoc method
|
@@ -448,10 +448,11 @@ function setupModuleLoader(window) {
|
|
448
448
|
* @param {string} method
|
449
449
|
* @returns {angular.Module}
|
450
450
|
*/
|
451
|
-
function invokeLaterAndSetModuleName(provider, method) {
|
451
|
+
function invokeLaterAndSetModuleName(provider, method, queue) {
|
452
|
+
if (!queue) queue = invokeQueue;
|
452
453
|
return function(recipeName, factoryFunction) {
|
453
454
|
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
|
454
|
-
|
455
|
+
queue.push([provider, method, arguments]);
|
455
456
|
return moduleInstance;
|
456
457
|
};
|
457
458
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.6.0
|
3
3
|
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -13,22 +13,14 @@
|
|
13
13
|
/* global isFunction: false */
|
14
14
|
/* global noop: false */
|
15
15
|
/* global toJson: false */
|
16
|
-
|
17
|
-
function stringify(value) {
|
18
|
-
if (value == null /* null/undefined */) { return ''; }
|
19
|
-
switch (typeof value) {
|
20
|
-
case 'string': return value;
|
21
|
-
case 'number': return '' + value;
|
22
|
-
default: return toJson(value);
|
23
|
-
}
|
24
|
-
}
|
16
|
+
/* global $$stringify: false */
|
25
17
|
|
26
18
|
// Convert an index into the string into line/column for use in error messages
|
27
19
|
// As such, this doesn't have to be efficient.
|
28
20
|
function indexToLineAndColumn(text, index) {
|
29
21
|
var lines = text.split(/\n/g);
|
30
|
-
for (var i=0; i < lines.length; i++) {
|
31
|
-
var line=lines[i];
|
22
|
+
for (var i = 0; i < lines.length; i++) {
|
23
|
+
var line = lines[i];
|
32
24
|
if (index >= line.length) {
|
33
25
|
index -= line.length;
|
34
26
|
} else {
|
@@ -47,7 +39,7 @@ function parseTextLiteral(text) {
|
|
47
39
|
parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
|
48
40
|
var unwatch = scope['$watch'](noop,
|
49
41
|
function textLiteralWatcher() {
|
50
|
-
if (isFunction(listener)) { listener
|
42
|
+
if (isFunction(listener)) { listener(text, text, scope); }
|
51
43
|
unwatch();
|
52
44
|
},
|
53
45
|
objectEquality);
|
@@ -64,14 +56,14 @@ function subtractOffset(expressionFn, offset) {
|
|
64
56
|
return expressionFn;
|
65
57
|
}
|
66
58
|
function minusOffset(value) {
|
67
|
-
return (value ==
|
59
|
+
return (value == null) ? value : value - offset;
|
68
60
|
}
|
69
61
|
function parsedFn(context) { return minusOffset(expressionFn(context)); }
|
70
62
|
var unwatch;
|
71
63
|
parsedFn['$$watchDelegate'] = function watchDelegate(scope, listener, objectEquality) {
|
72
64
|
unwatch = scope['$watch'](expressionFn,
|
73
65
|
function pluralExpressionWatchListener(newValue, oldValue) {
|
74
|
-
if (isFunction(listener)) { listener
|
66
|
+
if (isFunction(listener)) { listener(minusOffset(newValue), minusOffset(oldValue), scope); }
|
75
67
|
},
|
76
68
|
objectEquality);
|
77
69
|
return unwatch;
|
@@ -96,7 +88,7 @@ function MessageSelectorBase(expressionFn, choices) {
|
|
96
88
|
var self = this;
|
97
89
|
this.expressionFn = expressionFn;
|
98
90
|
this.choices = choices;
|
99
|
-
if (choices[
|
91
|
+
if (choices['other'] === undefined) {
|
100
92
|
throw $interpolateMinErr('reqother', '“other” is a required option.');
|
101
93
|
}
|
102
94
|
this.parsedFn = function(context) { return self.getResult(context); };
|
@@ -130,7 +122,7 @@ function MessageSelectorWatchers(msgSelector, scope, listener, objectEquality) {
|
|
130
122
|
this.msgSelector = msgSelector;
|
131
123
|
this.listener = listener;
|
132
124
|
this.objectEquality = objectEquality;
|
133
|
-
this.lastMessage =
|
125
|
+
this.lastMessage = undefined;
|
134
126
|
this.messageFnWatcher = noop;
|
135
127
|
var expressionFnListener = function(newValue, oldValue) { return self.expressionFnListener(newValue, oldValue); };
|
136
128
|
this.expressionFnWatcher = scope['$watch'](msgSelector.expressionFn, expressionFnListener, objectEquality);
|
@@ -170,7 +162,7 @@ SelectMessageProto.prototype = MessageSelectorBase.prototype;
|
|
170
162
|
|
171
163
|
SelectMessage.prototype = new SelectMessageProto();
|
172
164
|
SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) {
|
173
|
-
return (this.choices[value] !==
|
165
|
+
return (this.choices[value] !== undefined) ? value : 'other';
|
174
166
|
};
|
175
167
|
|
176
168
|
/**
|
@@ -190,12 +182,12 @@ PluralMessageProto.prototype = MessageSelectorBase.prototype;
|
|
190
182
|
PluralMessage.prototype = new PluralMessageProto();
|
191
183
|
PluralMessage.prototype.categorizeValue = function categorizePluralValue(value) {
|
192
184
|
if (isNaN(value)) {
|
193
|
-
return
|
194
|
-
} else if (this.choices[value] !==
|
185
|
+
return 'other';
|
186
|
+
} else if (this.choices[value] !== undefined) {
|
195
187
|
return value;
|
196
188
|
} else {
|
197
189
|
var category = this.pluralCat(value - this.offset);
|
198
|
-
return (this.choices[category] !==
|
190
|
+
return (this.choices[category] !== undefined) ? category : 'other';
|
199
191
|
}
|
200
192
|
};
|
201
193
|
|
@@ -264,7 +256,7 @@ InterpolationParts.prototype.getExpressionValues = function getExpressionValues(
|
|
264
256
|
InterpolationParts.prototype.getResult = function getResult(expressionValues) {
|
265
257
|
for (var i = 0; i < this.expressionIndices.length; i++) {
|
266
258
|
var expressionValue = expressionValues[i];
|
267
|
-
if (this.allOrNothing && expressionValue ===
|
259
|
+
if (this.allOrNothing && expressionValue === undefined) return;
|
268
260
|
this.textParts[this.expressionIndices[i]] = expressionValue;
|
269
261
|
}
|
270
262
|
return this.textParts.join('');
|
@@ -275,7 +267,7 @@ InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression
|
|
275
267
|
var self = this;
|
276
268
|
this.flushPartialText();
|
277
269
|
if (mustHaveExpression && this.expressionFns.length === 0) {
|
278
|
-
return
|
270
|
+
return undefined;
|
279
271
|
}
|
280
272
|
if (this.textParts.length === 0) {
|
281
273
|
return parseTextLiteral('');
|
@@ -284,7 +276,7 @@ InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression
|
|
284
276
|
$interpolateMinErr['throwNoconcat'](originalText);
|
285
277
|
}
|
286
278
|
if (this.expressionFns.length === 0) {
|
287
|
-
if (this.textParts.length
|
279
|
+
if (this.textParts.length !== 1) { this.errorInParseLogic(); }
|
288
280
|
return parseTextLiteral(this.textParts[0]);
|
289
281
|
}
|
290
282
|
var parsedFn = function(context) {
|
@@ -311,7 +303,7 @@ InterpolationParts.prototype.watchDelegate = function watchDelegate(scope, liste
|
|
311
303
|
function InterpolationPartsWatcher(interpolationParts, scope, listener, objectEquality) {
|
312
304
|
this.interpolationParts = interpolationParts;
|
313
305
|
this.scope = scope;
|
314
|
-
this.previousResult = (
|
306
|
+
this.previousResult = (undefined);
|
315
307
|
this.listener = listener;
|
316
308
|
var self = this;
|
317
309
|
this.expressionFnsWatcher = scope['$watchGroup'](interpolationParts.expressionFns, function(newExpressionValues, oldExpressionValues) {
|
@@ -423,7 +415,7 @@ MessageFormatParser.prototype.popState = function popState() {
|
|
423
415
|
MessageFormatParser.prototype.matchRe = function matchRe(re, search) {
|
424
416
|
re.lastIndex = this.index;
|
425
417
|
var match = re.exec(this.text);
|
426
|
-
if (match != null && (search === true || (match.index
|
418
|
+
if (match != null && (search === true || (match.index === this.index))) {
|
427
419
|
this.index = re.lastIndex;
|
428
420
|
return match;
|
429
421
|
}
|
@@ -461,7 +453,7 @@ MessageFormatParser.prototype.errorInParseLogic = function errorInParseLogic() {
|
|
461
453
|
};
|
462
454
|
|
463
455
|
MessageFormatParser.prototype.assertRuleOrNull = function assertRuleOrNull(rule) {
|
464
|
-
if (rule ===
|
456
|
+
if (rule === undefined) {
|
465
457
|
this.errorInParseLogic();
|
466
458
|
}
|
467
459
|
};
|
@@ -477,7 +469,7 @@ MessageFormatParser.prototype.errorExpecting = function errorExpecting() {
|
|
477
469
|
position.line, position.column, this.text);
|
478
470
|
}
|
479
471
|
var word = match[1];
|
480
|
-
if (word
|
472
|
+
if (word === 'select' || word === 'plural') {
|
481
473
|
position = indexToLineAndColumn(this.text, this.index);
|
482
474
|
throw $interpolateMinErr('reqcomma',
|
483
475
|
'Expected a comma after the keyword “{0}” at line {1}, column {2} of text “{3}”',
|
@@ -505,7 +497,7 @@ MessageFormatParser.prototype.ruleString = function ruleString() {
|
|
505
497
|
MessageFormatParser.prototype.startStringAtMatch = function startStringAtMatch(match) {
|
506
498
|
this.stringStartIndex = match.index;
|
507
499
|
this.stringQuote = match[0];
|
508
|
-
this.stringInterestsRe = this.stringQuote
|
500
|
+
this.stringInterestsRe = this.stringQuote === '\'' ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE;
|
509
501
|
this.rule = this.ruleInsideString;
|
510
502
|
};
|
511
503
|
|
@@ -519,8 +511,7 @@ MessageFormatParser.prototype.ruleInsideString = function ruleInsideString() {
|
|
519
511
|
'The string beginning at line {0}, column {1} is unterminated in text “{2}”',
|
520
512
|
position.line, position.column, this.text);
|
521
513
|
}
|
522
|
-
|
523
|
-
if (match == this.stringQuote) {
|
514
|
+
if (match[0] === this.stringQuote) {
|
524
515
|
this.rule = null;
|
525
516
|
}
|
526
517
|
};
|
@@ -533,8 +524,8 @@ MessageFormatParser.prototype.rulePluralOrSelect = function rulePluralOrSelect()
|
|
533
524
|
}
|
534
525
|
var argType = match[1];
|
535
526
|
switch (argType) {
|
536
|
-
case
|
537
|
-
case
|
527
|
+
case 'plural': this.rule = this.rulePluralStyle; break;
|
528
|
+
case 'select': this.rule = this.ruleSelectStyle; break;
|
538
529
|
default: this.errorInParseLogic();
|
539
530
|
}
|
540
531
|
};
|
@@ -552,7 +543,7 @@ MessageFormatParser.prototype.ruleSelectStyle = function ruleSelectStyle() {
|
|
552
543
|
};
|
553
544
|
|
554
545
|
var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g;
|
555
|
-
var PLURAL_OFFSET_RE = new RegExp(
|
546
|
+
var PLURAL_OFFSET_RE = new RegExp('\\s*offset\\s*:\\s*(' + NUMBER_RE.source + ')', 'g');
|
556
547
|
|
557
548
|
MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
|
558
549
|
var match = this.matchRe(PLURAL_OFFSET_RE);
|
@@ -562,7 +553,7 @@ MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
|
|
562
553
|
};
|
563
554
|
|
564
555
|
MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) {
|
565
|
-
if (this.choices[choiceKey] !==
|
556
|
+
if (this.choices[choiceKey] !== undefined) {
|
566
557
|
var position = indexToLineAndColumn(this.text, index);
|
567
558
|
throw $interpolateMinErr('dupvalue',
|
568
559
|
'The choice “{0}” is specified more than once. Duplicate key is at line {1}, column {2} in text “{3}”',
|
@@ -583,7 +574,7 @@ MessageFormatParser.prototype.ruleSelectKeyword = function ruleSelectKeyword() {
|
|
583
574
|
this.rule = this.ruleMessageText;
|
584
575
|
};
|
585
576
|
|
586
|
-
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp(
|
577
|
+
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp('\\s*(?:(?:=(' + NUMBER_RE.source + '))|(\\w+))', 'g');
|
587
578
|
MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() {
|
588
579
|
var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE);
|
589
580
|
if (match == null) {
|
@@ -600,7 +591,7 @@ MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValu
|
|
600
591
|
this.rule = this.ruleMessageText;
|
601
592
|
};
|
602
593
|
|
603
|
-
var BRACE_OPEN_RE = /\s
|
594
|
+
var BRACE_OPEN_RE = /\s*\{/g;
|
604
595
|
var BRACE_CLOSE_RE = /}/g;
|
605
596
|
MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() {
|
606
597
|
if (!this.consumeRe(BRACE_OPEN_RE)) {
|
@@ -620,7 +611,7 @@ var INTERP_OR_END_MESSAGE_RE = /\\.|{{|}/g;
|
|
620
611
|
var INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE = /\\.|{{|#|}/g;
|
621
612
|
var ESCAPE_OR_MUSTACHE_BEGIN_RE = /\\.|{{/g;
|
622
613
|
MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function advanceInInterpolationOrMessageText() {
|
623
|
-
var currentIndex = this.index, match
|
614
|
+
var currentIndex = this.index, match;
|
624
615
|
if (this.ruleChoiceKeyword == null) { // interpolation
|
625
616
|
match = this.searchRe(ESCAPE_OR_MUSTACHE_BEGIN_RE);
|
626
617
|
if (match == null) { // End of interpolation text. Nothing more to process.
|
@@ -629,7 +620,7 @@ MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function adv
|
|
629
620
|
return null;
|
630
621
|
}
|
631
622
|
} else {
|
632
|
-
match = this.searchRe(this.ruleChoiceKeyword
|
623
|
+
match = this.searchRe(this.ruleChoiceKeyword === this.rulePluralValueOrKeyword ?
|
633
624
|
INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE);
|
634
625
|
if (match == null) {
|
635
626
|
var position = indexToLineAndColumn(this.text, this.msgStartIndex);
|
@@ -654,20 +645,20 @@ MessageFormatParser.prototype.ruleInInterpolationOrMessageText = function ruleIn
|
|
654
645
|
this.rule = null;
|
655
646
|
return;
|
656
647
|
}
|
657
|
-
if (token[0]
|
648
|
+
if (token[0] === '\\') {
|
658
649
|
// unescape next character and continue
|
659
650
|
this.interpolationParts.addText(this.textPart + token[1]);
|
660
651
|
return;
|
661
652
|
}
|
662
653
|
this.interpolationParts.addText(this.textPart);
|
663
|
-
if (token
|
654
|
+
if (token === '{{') {
|
664
655
|
this.pushState();
|
665
656
|
this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage);
|
666
657
|
this.rule = this.ruleEnteredMustache;
|
667
|
-
} else if (token
|
658
|
+
} else if (token === '}') {
|
668
659
|
this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text);
|
669
660
|
this.rule = this.ruleChoiceKeyword;
|
670
|
-
} else if (token
|
661
|
+
} else if (token === '#') {
|
671
662
|
this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn);
|
672
663
|
} else {
|
673
664
|
this.errorInParseLogic();
|
@@ -691,7 +682,7 @@ MessageFormatParser.prototype.ruleInInterpolation = function ruleInInterpolation
|
|
691
682
|
return;
|
692
683
|
}
|
693
684
|
var token = match[0];
|
694
|
-
if (token[0]
|
685
|
+
if (token[0] === '\\') {
|
695
686
|
// unescape next character and continue
|
696
687
|
this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]);
|
697
688
|
return;
|
@@ -757,18 +748,18 @@ MessageFormatParser.prototype.ruleAngularExpression = function ruleAngularExpres
|
|
757
748
|
|
758
749
|
function getEndOperator(opBegin) {
|
759
750
|
switch (opBegin) {
|
760
|
-
case
|
761
|
-
case
|
762
|
-
case
|
751
|
+
case '{': return '}';
|
752
|
+
case '[': return ']';
|
753
|
+
case '(': return ')';
|
763
754
|
default: return null;
|
764
755
|
}
|
765
756
|
}
|
766
757
|
|
767
758
|
function getBeginOperator(opEnd) {
|
768
759
|
switch (opEnd) {
|
769
|
-
case
|
770
|
-
case
|
771
|
-
case
|
760
|
+
case '}': return '{';
|
761
|
+
case ']': return '[';
|
762
|
+
case ')': return '(';
|
772
763
|
default: return null;
|
773
764
|
}
|
774
765
|
}
|
@@ -778,7 +769,6 @@ function getBeginOperator(opEnd) {
|
|
778
769
|
// should support any other type of start/end interpolation symbol.
|
779
770
|
var INTERESTING_OPERATORS_RE = /[[\]{}()'",]/g;
|
780
771
|
MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() {
|
781
|
-
var startIndex = this.index;
|
782
772
|
var match = this.searchRe(INTERESTING_OPERATORS_RE);
|
783
773
|
var position;
|
784
774
|
if (match == null) {
|
@@ -803,12 +793,12 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
803
793
|
this.getEndOperator(innermostOperator), this.text);
|
804
794
|
}
|
805
795
|
var operator = match[0];
|
806
|
-
if (operator
|
796
|
+
if (operator === '\'' || operator === '"') {
|
807
797
|
this.ruleStack.push(this.ruleInAngularExpression);
|
808
798
|
this.startStringAtMatch(match);
|
809
799
|
return;
|
810
800
|
}
|
811
|
-
if (operator
|
801
|
+
if (operator === ',') {
|
812
802
|
if (this.trustedContext) {
|
813
803
|
position = indexToLineAndColumn(this.text, this.index);
|
814
804
|
throw $interpolateMinErr('unsafe',
|
@@ -836,7 +826,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
836
826
|
this.errorInParseLogic();
|
837
827
|
}
|
838
828
|
if (this.angularOperatorStack.length > 0) {
|
839
|
-
if (beginOperator
|
829
|
+
if (beginOperator === this.angularOperatorStack[0]) {
|
840
830
|
this.angularOperatorStack.shift();
|
841
831
|
return;
|
842
832
|
}
|
@@ -864,7 +854,6 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
864
854
|
/* global noop: true */
|
865
855
|
/* global toJson: true */
|
866
856
|
/* global MessageFormatParser: false */
|
867
|
-
/* global stringify: false */
|
868
857
|
|
869
858
|
/**
|
870
859
|
* @ngdoc module
|
@@ -909,9 +898,9 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
909
898
|
* this.gender = gender;
|
910
899
|
* }
|
911
900
|
*
|
912
|
-
* var alice = new Person(
|
913
|
-
* bob = new Person(
|
914
|
-
* ashley = new Person(
|
901
|
+
* var alice = new Person('Alice', 'female'),
|
902
|
+
* bob = new Person('Bob', 'male'),
|
903
|
+
* ashley = new Person('Ashley', '');
|
915
904
|
*
|
916
905
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
917
906
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -952,11 +941,11 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
952
941
|
* this.gender = gender;
|
953
942
|
* }
|
954
943
|
*
|
955
|
-
* var alice = new Person(
|
956
|
-
* bob = new Person(
|
957
|
-
* sarah = new Person(
|
958
|
-
* harry = new Person(
|
959
|
-
* ashley = new Person(
|
944
|
+
* var alice = new Person('Alice', 'female'),
|
945
|
+
* bob = new Person('Bob', 'male'),
|
946
|
+
* sarah = new Person('Sarah', 'female'),
|
947
|
+
* harry = new Person('Harry Potter', 'male'),
|
948
|
+
* ashley = new Person('Ashley', '');
|
960
949
|
*
|
961
950
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
962
951
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -1012,10 +1001,10 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
1012
1001
|
* this.gender = gender;
|
1013
1002
|
* }
|
1014
1003
|
*
|
1015
|
-
* var alice = new Person(
|
1016
|
-
* bob = new Person(
|
1017
|
-
* harry = new Person(
|
1018
|
-
* ashley = new Person(
|
1004
|
+
* var alice = new Person('Alice', 'female'),
|
1005
|
+
* bob = new Person('Bob', 'male'),
|
1006
|
+
* harry = new Person('Harry Potter', 'male'),
|
1007
|
+
* ashley = new Person('Ashley', '');
|
1019
1008
|
*
|
1020
1009
|
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
1021
1010
|
* .controller('AppController', ['$scope', function($scope) {
|
@@ -1028,13 +1017,13 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
|
1028
1017
|
*/
|
1029
1018
|
|
1030
1019
|
var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler', function $$messageFormat(
|
1031
|
-
|
1020
|
+
$parse, $locale, $sce, $exceptionHandler) {
|
1032
1021
|
|
1033
1022
|
function getStringifier(trustedContext, allOrNothing, text) {
|
1034
1023
|
return function stringifier(value) {
|
1035
1024
|
try {
|
1036
1025
|
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
|
1037
|
-
return allOrNothing && (value ===
|
1026
|
+
return allOrNothing && (value === undefined) ? value : $$stringify(value);
|
1038
1027
|
} catch (err) {
|
1039
1028
|
$exceptionHandler($interpolateMinErr['interr'](text, err));
|
1040
1029
|
}
|
@@ -1055,7 +1044,7 @@ var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler',
|
|
1055
1044
|
}];
|
1056
1045
|
|
1057
1046
|
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
|
1058
|
-
if ($interpolate['startSymbol']()
|
1047
|
+
if ($interpolate['startSymbol']() !== '{{' || $interpolate['endSymbol']() !== '}}') {
|
1059
1048
|
throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.');
|
1060
1049
|
}
|
1061
1050
|
var interpolate = $$messageFormat['interpolate'];
|
@@ -1068,6 +1057,7 @@ var $interpolateMinErr;
|
|
1068
1057
|
var isFunction;
|
1069
1058
|
var noop;
|
1070
1059
|
var toJson;
|
1060
|
+
var $$stringify;
|
1071
1061
|
|
1072
1062
|
var module = window['angular']['module']('ngMessageFormat', ['ng']);
|
1073
1063
|
module['factory']('$$messageFormat', $$MessageFormatFactory);
|
@@ -1076,6 +1066,7 @@ module['config'](['$provide', function($provide) {
|
|
1076
1066
|
isFunction = window['angular']['isFunction'];
|
1077
1067
|
noop = window['angular']['noop'];
|
1078
1068
|
toJson = window['angular']['toJson'];
|
1069
|
+
$$stringify = window['angular']['$$stringify'];
|
1079
1070
|
|
1080
1071
|
$provide['decorator']('$interpolate', $$interpolateDecorator);
|
1081
1072
|
}]);
|