@angular-wave/angular.ts 0.0.13 → 0.0.15
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/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +1 -1
- package/src/exts/messages.md +30 -30
- package/src/index.js +0 -1
- package/src/router/adapter/directives/stateDirectives.js +17 -27
- package/src/router/adapter/directives/viewDirective.js +35 -45
- package/src/router/adapter/services.js +4 -3
- package/src/router/adapter/stateFilters.js +2 -7
- package/src/router/adapter/statebuilders/onEnterExitRetain.js +1 -2
- package/src/router/adapter/statebuilders/views.js +4 -5
- package/src/router/adapter/templateFactory.js +1 -1
- package/src/router/adapter/viewScroll.js +1 -8
- package/src/router/core/common/common.js +10 -22
- package/src/router/core/params/param.js +5 -5
- package/src/router/core/params/paramType.js +3 -3
- package/src/router/core/params/paramTypes.js +6 -7
- package/src/router/core/params/stateParams.js +3 -3
- package/src/router/core/path/pathNode.js +2 -2
- package/src/router/core/path/pathUtils.js +4 -5
- package/src/router/core/resolve/resolvable.js +2 -2
- package/src/router/core/state/stateBuilder.js +1 -2
- package/src/router/core/state/stateObject.js +3 -3
- package/src/router/core/state/stateService.js +2 -3
- package/src/router/core/state/targetState.js +8 -5
- package/src/router/core/transition/hookBuilder.js +2 -2
- package/src/router/core/transition/hookRegistry.js +2 -2
- package/src/router/core/transition/rejectFactory.js +2 -3
- package/src/router/core/transition/transition.js +5 -3
- package/src/router/core/url/urlMatcherFactory.js +2 -8
- package/src/router/core/url/urlRule.js +7 -4
- package/src/router/core/url/urlService.js +2 -2
- package/src/router/router.js +28 -10
- package/test/module-test.html +15 -12
- package/test/ng/directive/if.spec.js +0 -1
- package/test/original-test.html +27 -15
package/package.json
CHANGED
package/src/exts/messages.md
CHANGED
|
@@ -518,33 +518,33 @@ _ {@link module:ngMessages Click here} to learn more about`ngMessages`and`ngMess
|
|
|
518
518
|
_ @param {string} ngMessageExp|whenExp an expression value corresponding to the message key.
|
|
519
519
|
_/
|
|
520
520
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
521
|
+
/**
|
|
522
|
+
* @ngdoc directive
|
|
523
|
+
* @name ngMessageDefault
|
|
524
|
+
* @restrict AE
|
|
525
|
+
* @scope
|
|
526
|
+
*
|
|
527
|
+
* @description
|
|
528
|
+
* `ngMessageDefault` is a directive with the purpose to show and hide a default message for
|
|
529
|
+
* {@link directive:ngMessages}, when none of provided messages matches.
|
|
530
|
+
*
|
|
531
|
+
* More information about using `ngMessageDefault` can be found in the
|
|
532
|
+
* {@link module:ngMessages `ngMessages` module documentation}.
|
|
533
|
+
*
|
|
534
|
+
* @usage
|
|
535
|
+
* ```html
|
|
536
|
+
* <!-- using attribute directives -->
|
|
537
|
+
* <ANY ng-messages="expression" role="alert">
|
|
538
|
+
* <ANY ng-message="stringValue">...</ANY>
|
|
539
|
+
* <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
|
|
540
|
+
* <ANY ng-message-default>...</ANY>
|
|
541
|
+
* </ANY>
|
|
542
|
+
*
|
|
543
|
+
* <!-- or by using element directives -->
|
|
544
|
+
* <ng-messages for="expression" role="alert">
|
|
545
|
+
* <ng-message when="stringValue">...</ng-message>
|
|
546
|
+
* <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
|
|
547
|
+
* <ng-message-default>...</ng-message-default>
|
|
548
|
+
* </ng-messages>
|
|
549
|
+
*
|
|
550
|
+
*/
|
package/src/index.js
CHANGED
|
@@ -4,23 +4,20 @@
|
|
|
4
4
|
* These are the directives included in UI-Router for Angular 1.
|
|
5
5
|
* These directives are used in templates to create viewports and link/navigate to states.
|
|
6
6
|
*
|
|
7
|
-
|
|
8
|
-
*/ /** */
|
|
7
|
+
*/
|
|
9
8
|
import {
|
|
10
|
-
extend,
|
|
11
9
|
forEach,
|
|
12
10
|
tail,
|
|
13
|
-
isString,
|
|
14
|
-
isObject,
|
|
15
|
-
isArray,
|
|
16
|
-
parse,
|
|
17
11
|
noop,
|
|
18
12
|
unnestR,
|
|
19
13
|
identity,
|
|
20
14
|
uniqR,
|
|
21
15
|
inArray,
|
|
22
16
|
removeFrom,
|
|
23
|
-
} from "../../core/
|
|
17
|
+
} from "../../core/common/common";
|
|
18
|
+
import { isString, isObject, isArray } from "../../core/common/predicates";
|
|
19
|
+
|
|
20
|
+
import { parse } from "../../core/common/hof";
|
|
24
21
|
/** @hidden */
|
|
25
22
|
function parseStateRef(ref) {
|
|
26
23
|
const paramsOnly = ref.match(/^\s*({[^}]*})\s*$/);
|
|
@@ -41,7 +38,7 @@ function stateContext(el) {
|
|
|
41
38
|
/** @hidden */
|
|
42
39
|
function processedDef($state, $element, def) {
|
|
43
40
|
const uiState = def.uiState || $state.current.name;
|
|
44
|
-
const uiStateOpts =
|
|
41
|
+
const uiStateOpts = Object.assign(
|
|
45
42
|
defaultOpts($element, $state),
|
|
46
43
|
def.uiStateOpts || {},
|
|
47
44
|
);
|
|
@@ -52,12 +49,12 @@ function processedDef($state, $element, def) {
|
|
|
52
49
|
function getTypeInfo(el) {
|
|
53
50
|
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
|
|
54
51
|
const isSvg =
|
|
55
|
-
Object.prototype.toString.call(el.
|
|
52
|
+
Object.prototype.toString.call(el[0].getAttribute("href")) ===
|
|
56
53
|
"[object SVGAnimatedString]";
|
|
57
54
|
const isForm = el[0].nodeName === "FORM";
|
|
58
55
|
return {
|
|
59
56
|
attr: isForm ? "action" : isSvg ? "xlink:href" : "href",
|
|
60
|
-
isAnchor: el.
|
|
57
|
+
isAnchor: el[0].nodeName === "A",
|
|
61
58
|
clickable: !isForm,
|
|
62
59
|
};
|
|
63
60
|
}
|
|
@@ -252,8 +249,7 @@ function bindEvents(element, scope, hookFn, uiStateOpts) {
|
|
|
252
249
|
* - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).
|
|
253
250
|
* If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.
|
|
254
251
|
*/
|
|
255
|
-
let uiSrefDirective
|
|
256
|
-
uiSrefDirective = [
|
|
252
|
+
export let uiSrefDirective = [
|
|
257
253
|
"$uiRouter",
|
|
258
254
|
"$timeout",
|
|
259
255
|
function $StateRefDirective($uiRouter, $timeout) {
|
|
@@ -286,12 +282,12 @@ uiSrefDirective = [
|
|
|
286
282
|
scope.$watch(
|
|
287
283
|
ref.paramExpr,
|
|
288
284
|
function (val) {
|
|
289
|
-
rawDef.uiStateParams =
|
|
285
|
+
rawDef.uiStateParams = Object.assign({}, val);
|
|
290
286
|
update();
|
|
291
287
|
},
|
|
292
288
|
true,
|
|
293
289
|
);
|
|
294
|
-
rawDef.uiStateParams =
|
|
290
|
+
rawDef.uiStateParams = Object.assign({}, scope.$eval(ref.paramExpr));
|
|
295
291
|
}
|
|
296
292
|
update();
|
|
297
293
|
scope.$on("$destroy", $uiRouter.stateRegistry.onStatesChanged(update));
|
|
@@ -390,8 +386,7 @@ uiSrefDirective = [
|
|
|
390
386
|
* - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.
|
|
391
387
|
* ```
|
|
392
388
|
*/
|
|
393
|
-
let uiStateDirective
|
|
394
|
-
uiStateDirective = [
|
|
389
|
+
export let uiStateDirective = [
|
|
395
390
|
"$uiRouter",
|
|
396
391
|
"$timeout",
|
|
397
392
|
function $StateRefDynamicDirective($uiRouter, $timeout) {
|
|
@@ -540,8 +535,7 @@ uiStateDirective = [
|
|
|
540
535
|
*
|
|
541
536
|
* - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`
|
|
542
537
|
*/
|
|
543
|
-
let uiSrefActiveDirective
|
|
544
|
-
uiSrefActiveDirective = [
|
|
538
|
+
export let uiSrefActiveDirective = [
|
|
545
539
|
"$state",
|
|
546
540
|
"$stateParams",
|
|
547
541
|
"$interpolate",
|
|
@@ -675,9 +669,11 @@ uiSrefActiveDirective = [
|
|
|
675
669
|
(cls) => !inArray(addClasses, cls),
|
|
676
670
|
);
|
|
677
671
|
$scope.$evalAsync(() => {
|
|
678
|
-
addClasses.forEach((className) =>
|
|
672
|
+
addClasses.forEach((className) =>
|
|
673
|
+
$element[0].classList.add(className),
|
|
674
|
+
);
|
|
679
675
|
removeClasses.forEach((className) =>
|
|
680
|
-
$element.
|
|
676
|
+
$element[0].classList.remove(className),
|
|
681
677
|
);
|
|
682
678
|
});
|
|
683
679
|
}
|
|
@@ -687,9 +683,3 @@ uiSrefActiveDirective = [
|
|
|
687
683
|
};
|
|
688
684
|
},
|
|
689
685
|
];
|
|
690
|
-
window.angular
|
|
691
|
-
.module("ui.router.state")
|
|
692
|
-
.directive("uiSref", uiSrefDirective)
|
|
693
|
-
.directive("uiSrefActive", uiSrefActiveDirective)
|
|
694
|
-
.directive("uiSrefActiveEq", uiSrefActiveDirective)
|
|
695
|
-
.directive("uiState", uiStateDirective);
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
kebobString,
|
|
9
|
-
noop,
|
|
10
|
-
parse,
|
|
11
|
-
ResolveContext,
|
|
12
|
-
tail,
|
|
13
|
-
trace,
|
|
14
|
-
unnestR,
|
|
15
|
-
} from "../../core/index";
|
|
16
|
-
|
|
1
|
+
import { filter, tail, unnestR } from "../../core/common/common";
|
|
2
|
+
import { isDefined, isFunction, isString } from "../../core/common/predicates";
|
|
3
|
+
import { kebobString } from "../../core/common/strings";
|
|
4
|
+
import { noop } from "../../core/common/common";
|
|
5
|
+
import { parse } from "../../core/common/hof";
|
|
6
|
+
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
7
|
+
import { trace } from "../../core/common/trace";
|
|
17
8
|
import { getLocals } from "../services";
|
|
18
9
|
import { Ng1ViewConfig } from "../statebuilders/views";
|
|
10
|
+
import { jqLite } from "../../../jqLite";
|
|
19
11
|
/**
|
|
20
12
|
* `ui-view`: A viewport directive which is filled in by a view from the active state.
|
|
21
13
|
*
|
|
@@ -141,9 +133,7 @@ import { Ng1ViewConfig } from "../statebuilders/views";
|
|
|
141
133
|
* });
|
|
142
134
|
* ```
|
|
143
135
|
*/
|
|
144
|
-
export let uiView
|
|
145
|
-
// eslint-disable-next-line prefer-const
|
|
146
|
-
uiView = [
|
|
136
|
+
export let uiView = [
|
|
147
137
|
"$view",
|
|
148
138
|
"$animate",
|
|
149
139
|
"$uiViewScroll",
|
|
@@ -153,18 +143,18 @@ uiView = [
|
|
|
153
143
|
function getRenderer() {
|
|
154
144
|
return {
|
|
155
145
|
enter: function (element, target, cb) {
|
|
156
|
-
if (angular.version.minor > 2) {
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
|
|
160
|
-
}
|
|
146
|
+
// if (angular.version.minor > 2) {
|
|
147
|
+
//$animate.enter(element, null, target).then(cb);
|
|
148
|
+
// } else {
|
|
149
|
+
$animate.enter(element, null, target, cb);
|
|
150
|
+
// }
|
|
161
151
|
},
|
|
162
152
|
leave: function (element, cb) {
|
|
163
|
-
if (angular.version.minor > 2) {
|
|
164
|
-
|
|
165
|
-
} else {
|
|
166
|
-
|
|
167
|
-
}
|
|
153
|
+
// if (angular.version.minor > 2) {
|
|
154
|
+
//$animate.leave(element).then(cb);
|
|
155
|
+
// } else {
|
|
156
|
+
$animate.leave(element, cb);
|
|
157
|
+
// }
|
|
168
158
|
},
|
|
169
159
|
};
|
|
170
160
|
}
|
|
@@ -324,8 +314,13 @@ $ViewDirectiveFill.$inject = [
|
|
|
324
314
|
"$view",
|
|
325
315
|
"$q",
|
|
326
316
|
];
|
|
327
|
-
|
|
328
|
-
|
|
317
|
+
export function $ViewDirectiveFill(
|
|
318
|
+
$compile,
|
|
319
|
+
$controller,
|
|
320
|
+
$transitions,
|
|
321
|
+
$view,
|
|
322
|
+
$q,
|
|
323
|
+
) {
|
|
329
324
|
const getControllerAs = parse("viewDecl.controllerAs");
|
|
330
325
|
const getResolveAs = parse("viewDecl.resolveAs");
|
|
331
326
|
return {
|
|
@@ -338,14 +333,18 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
338
333
|
const data = $element.data("$uiView");
|
|
339
334
|
if (!data) {
|
|
340
335
|
$element.html(initial);
|
|
341
|
-
$compile($element.
|
|
336
|
+
$compile($element[0].contentDocument || $element[0].childNodes)(
|
|
337
|
+
scope,
|
|
338
|
+
);
|
|
342
339
|
return;
|
|
343
340
|
}
|
|
344
341
|
const cfg = data.$cfg || { viewDecl: {}, getTemplate: noop };
|
|
345
342
|
const resolveCtx = cfg.path && new ResolveContext(cfg.path);
|
|
346
343
|
$element.html(cfg.getTemplate($element, resolveCtx) || initial);
|
|
347
344
|
trace.traceUIViewFill(data.$uiView, $element.html());
|
|
348
|
-
const link = $compile(
|
|
345
|
+
const link = $compile(
|
|
346
|
+
$element[0].contentDocument || $element[0].childNodes,
|
|
347
|
+
);
|
|
349
348
|
const controller = cfg.controller;
|
|
350
349
|
const controllerAs = getControllerAs(cfg);
|
|
351
350
|
const resolveAs = getResolveAs(cfg);
|
|
@@ -354,7 +353,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
354
353
|
if (controller) {
|
|
355
354
|
const controllerInstance = $controller(
|
|
356
355
|
controller,
|
|
357
|
-
|
|
356
|
+
Object.assign({}, locals, { $scope: scope, $element: $element }),
|
|
358
357
|
);
|
|
359
358
|
if (controllerAs) {
|
|
360
359
|
scope[controllerAs] = controllerInstance;
|
|
@@ -386,7 +385,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
386
385
|
.filter((el) => el && el.tagName && tagRegexp.exec(el.tagName));
|
|
387
386
|
return (
|
|
388
387
|
directiveEl &&
|
|
389
|
-
|
|
388
|
+
jqLite(directiveEl).data(`$${cfg.component}Controller`)
|
|
390
389
|
);
|
|
391
390
|
};
|
|
392
391
|
const deregisterWatch = scope.$watch(
|
|
@@ -410,8 +409,6 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
410
409
|
};
|
|
411
410
|
}
|
|
412
411
|
/** @hidden */
|
|
413
|
-
const hasComponentImpl =
|
|
414
|
-
typeof angular.module("ui.router")["component"] === "function";
|
|
415
412
|
/** @hidden incrementing id */
|
|
416
413
|
let _uiCanExitId = 0;
|
|
417
414
|
/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */
|
|
@@ -425,10 +422,7 @@ function registerControllerCallbacks(
|
|
|
425
422
|
// Call $onInit() ASAP
|
|
426
423
|
if (
|
|
427
424
|
isFunction(controllerInstance.$onInit) &&
|
|
428
|
-
!(
|
|
429
|
-
(cfg.viewDecl.component || cfg.viewDecl.componentProvider) &&
|
|
430
|
-
hasComponentImpl
|
|
431
|
-
)
|
|
425
|
+
!(cfg.viewDecl.component || cfg.viewDecl.componentProvider)
|
|
432
426
|
) {
|
|
433
427
|
controllerInstance.$onInit();
|
|
434
428
|
}
|
|
@@ -508,7 +502,3 @@ function registerControllerCallbacks(
|
|
|
508
502
|
);
|
|
509
503
|
}
|
|
510
504
|
}
|
|
511
|
-
window.angular
|
|
512
|
-
.module("ui.router.state")
|
|
513
|
-
.directive("uiView", uiView)
|
|
514
|
-
.directive("uiView", $ViewDirectiveFill);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { services } from "../core/common/coreservices";
|
|
12
12
|
import { applyPairs, unnestR } from "../core/common/common";
|
|
13
|
-
import { isString
|
|
13
|
+
import { isString } from "../../core/utils";
|
|
14
14
|
import { trace } from "../core/common/trace";
|
|
15
15
|
import { UIRouter } from "../core/router";
|
|
16
16
|
import {
|
|
@@ -100,8 +100,9 @@ export function runBlock($injector, $q, $uiRouter) {
|
|
|
100
100
|
// $state service and $stateProvider
|
|
101
101
|
// $urlRouter service and $urlRouterProvider
|
|
102
102
|
export function getStateProvider() {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
return Object.assign(router.stateProvider, {
|
|
104
|
+
$get: () => router.stateService,
|
|
105
|
+
});
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
watchDigests.$inject = ["$rootScope"];
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
$IsStateFilter.$inject = ["$state"];
|
|
14
|
-
function $IsStateFilter($state) {
|
|
14
|
+
export function $IsStateFilter($state) {
|
|
15
15
|
const isFilter = function (state, params, options) {
|
|
16
16
|
return $state.is(state, params, options);
|
|
17
17
|
};
|
|
@@ -29,15 +29,10 @@ function $IsStateFilter($state) {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
$IncludedByStateFilter.$inject = ["$state"];
|
|
32
|
-
function $IncludedByStateFilter($state) {
|
|
32
|
+
export function $IncludedByStateFilter($state) {
|
|
33
33
|
const includesFilter = function (state, params, options) {
|
|
34
34
|
return $state.includes(state, params, options);
|
|
35
35
|
};
|
|
36
36
|
includesFilter.$stateful = true;
|
|
37
37
|
return includesFilter;
|
|
38
38
|
}
|
|
39
|
-
window.angular
|
|
40
|
-
.module("ui.router.state")
|
|
41
|
-
.filter("isState", $IsStateFilter)
|
|
42
|
-
.filter("includedByState", $IncludedByStateFilter);
|
|
43
|
-
export { $IsStateFilter, $IncludedByStateFilter };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @publicapi @module ng1 */ /** */
|
|
2
2
|
import { getLocals } from "../services";
|
|
3
3
|
import { services } from "../../core/common/coreservices";
|
|
4
|
-
import { extend } from "../../../core/utils";
|
|
5
4
|
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -20,7 +19,7 @@ export const getStateHookBuilder = (hookName) =>
|
|
|
20
19
|
function decoratedNg1Hook(trans, state) {
|
|
21
20
|
const resolveContext = new ResolveContext(trans.treeChanges(pathname));
|
|
22
21
|
const subContext = resolveContext.subContext(state.$$state());
|
|
23
|
-
const locals =
|
|
22
|
+
const locals = Object.assign(getLocals(subContext), {
|
|
24
23
|
$state$: state,
|
|
25
24
|
$transition$: trans,
|
|
26
25
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { pick, forEach, tail, extend } from "../../core/common/common";
|
|
1
|
+
import { pick, forEach, tail } from "../../core/common/common";
|
|
3
2
|
import { isArray, isDefined, isString } from "../../../core/utils";
|
|
4
3
|
import { isInjectable } from "../../core/common/predicates";
|
|
5
4
|
import { services } from "../../core/common/coreservices";
|
|
@@ -69,7 +68,7 @@ export function ng1ViewsBuilder(state) {
|
|
|
69
68
|
// Account for views: { header: "headerComponent" }
|
|
70
69
|
if (isString(config)) config = { component: config };
|
|
71
70
|
// Make a shallow copy of the config object
|
|
72
|
-
config =
|
|
71
|
+
config = Object.assign({}, config);
|
|
73
72
|
// Do not allow a view to mix props for component-style view with props for template/controller-style view
|
|
74
73
|
if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
|
|
75
74
|
throw new Error(
|
|
@@ -114,7 +113,7 @@ export class Ng1ViewConfig {
|
|
|
114
113
|
const $q = services.$q;
|
|
115
114
|
const context = new ResolveContext(this.path);
|
|
116
115
|
const params = this.path.reduce(
|
|
117
|
-
(acc, node) =>
|
|
116
|
+
(acc, node) => Object.assign(acc, node.paramValues),
|
|
118
117
|
{},
|
|
119
118
|
);
|
|
120
119
|
const promises = {
|
|
@@ -126,7 +125,7 @@ export class Ng1ViewConfig {
|
|
|
126
125
|
return $q.all(promises).then((results) => {
|
|
127
126
|
trace.traceViewServiceEvent("Loaded", this);
|
|
128
127
|
this.controller = results.controller;
|
|
129
|
-
|
|
128
|
+
Object.assign(this, results.template); // Either { template: "tpl" } or { component: "cmpName" }
|
|
130
129
|
return this;
|
|
131
130
|
});
|
|
132
131
|
}
|
|
@@ -154,7 +154,7 @@ export class TemplateFactory {
|
|
|
154
154
|
makeComponentTemplate(uiView, context, component, bindings) {
|
|
155
155
|
bindings = bindings || {};
|
|
156
156
|
// Bind once prefix
|
|
157
|
-
const prefix = angular.version.minor >= 3 ? "::" : "";
|
|
157
|
+
const prefix = "::"; //angular.version.minor >= 3 ? "::" : "";
|
|
158
158
|
// Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`
|
|
159
159
|
const kebob = (camelCase) => {
|
|
160
160
|
const kebobed = kebobString(camelCase);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @hidden */
|
|
4
|
-
function $ViewScrollProvider() {
|
|
1
|
+
export function $ViewScrollProvider() {
|
|
5
2
|
let useAnchorScroll = false;
|
|
6
3
|
this.useAnchorScroll = function () {
|
|
7
4
|
useAnchorScroll = true;
|
|
@@ -25,7 +22,3 @@ function $ViewScrollProvider() {
|
|
|
25
22
|
},
|
|
26
23
|
];
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
window.angular
|
|
30
|
-
.module("ui.router.state")
|
|
31
|
-
.provider("$uiViewScroll", $ViewScrollProvider);
|
|
@@ -13,12 +13,10 @@ export const root =
|
|
|
13
13
|
(typeof self === "object" && self.self === self && self) ||
|
|
14
14
|
(typeof global === "object" && global.global === global && global) ||
|
|
15
15
|
this;
|
|
16
|
-
const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const extend = Object.assign || _extend;
|
|
21
|
-
export const equals = angular.equals || _equals;
|
|
16
|
+
export const fromJson = JSON.parse.bind(JSON);
|
|
17
|
+
export const toJson = JSON.stringify.bind(JSON);
|
|
18
|
+
export const forEach = _forEach;
|
|
19
|
+
export const equals = _equals;
|
|
22
20
|
export function identity(x) {
|
|
23
21
|
return x;
|
|
24
22
|
}
|
|
@@ -102,7 +100,7 @@ export function createProxyFunctions(
|
|
|
102
100
|
* prototypal inheritance helper.
|
|
103
101
|
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
|
|
104
102
|
*/
|
|
105
|
-
export const inherit = (parent, extra) =>
|
|
103
|
+
export const inherit = (parent, extra) => Object.setPrototypeOf(parent, extra);
|
|
106
104
|
/** Given an array, returns true if the object is found in the array, (using indexOf) */
|
|
107
105
|
export const inArray = curry(_inArray);
|
|
108
106
|
export function _inArray(array, obj) {
|
|
@@ -135,11 +133,11 @@ export const deregAll = (functions) =>
|
|
|
135
133
|
* Earlier objects in the defaultsList take precedence when applying defaults.
|
|
136
134
|
*/
|
|
137
135
|
export function defaults(opts, ...defaultsList) {
|
|
138
|
-
const defaultVals =
|
|
139
|
-
return
|
|
136
|
+
const defaultVals = Object.assign({}, ...defaultsList.reverse());
|
|
137
|
+
return Object.assign(defaultVals, pick(opts || {}, Object.keys(defaultVals)));
|
|
140
138
|
}
|
|
141
139
|
/** Reduce function that merges each element of the list into a single object, using extend */
|
|
142
|
-
export const mergeR = (memo, item) =>
|
|
140
|
+
export const mergeR = (memo, item) => Object.assign(memo, item);
|
|
143
141
|
/**
|
|
144
142
|
* Finds the common ancestor path between two states.
|
|
145
143
|
*
|
|
@@ -441,24 +439,14 @@ export function tail(arr) {
|
|
|
441
439
|
export function copy(src, dest) {
|
|
442
440
|
if (dest) Object.keys(dest).forEach((key) => delete dest[key]);
|
|
443
441
|
if (!dest) dest = {};
|
|
444
|
-
return
|
|
442
|
+
return Object.assign(dest, src);
|
|
445
443
|
}
|
|
446
444
|
/** Naive forEach implementation works with Objects or Arrays */
|
|
447
445
|
function _forEach(obj, cb, _this) {
|
|
448
446
|
if (isArray(obj)) return obj.forEach(cb, _this);
|
|
449
447
|
Object.keys(obj).forEach((key) => cb(obj[key], key));
|
|
450
448
|
}
|
|
451
|
-
|
|
452
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
453
|
-
const obj = arguments[i];
|
|
454
|
-
if (!obj) continue;
|
|
455
|
-
const keys = Object.keys(obj);
|
|
456
|
-
for (let j = 0; j < keys.length; j++) {
|
|
457
|
-
toObj[keys[j]] = obj[keys[j]];
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return toObj;
|
|
461
|
-
}
|
|
449
|
+
|
|
462
450
|
function _equals(o1, o2) {
|
|
463
451
|
if (o1 === o2) return true;
|
|
464
452
|
if (o1 === null || o2 === null) return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter, map, allTrueR, find } from "../common/common";
|
|
2
2
|
import { prop } from "../common/hof";
|
|
3
3
|
import {
|
|
4
4
|
isInjectable,
|
|
@@ -29,7 +29,7 @@ function getParamDeclaration(paramName, location, state) {
|
|
|
29
29
|
const paramConfig = unwrapShorthand(
|
|
30
30
|
state && state.params && state.params[paramName],
|
|
31
31
|
);
|
|
32
|
-
return
|
|
32
|
+
return Object.assign(defaultConfig, paramConfig);
|
|
33
33
|
}
|
|
34
34
|
function unwrapShorthand(cfg) {
|
|
35
35
|
cfg = isShorthand(cfg) ? { value: cfg } : cfg;
|
|
@@ -38,7 +38,7 @@ function unwrapShorthand(cfg) {
|
|
|
38
38
|
return cfg.value;
|
|
39
39
|
}
|
|
40
40
|
const $$fn = isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue;
|
|
41
|
-
return
|
|
41
|
+
return Object.assign(cfg, { $$fn });
|
|
42
42
|
}
|
|
43
43
|
function getType(cfg, urlType, location, id, paramTypes) {
|
|
44
44
|
if (cfg.type && urlType && urlType.name !== "string")
|
|
@@ -157,9 +157,9 @@ export class Param {
|
|
|
157
157
|
array: location === DefType.SEARCH ? "auto" : false,
|
|
158
158
|
};
|
|
159
159
|
const arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {};
|
|
160
|
-
return
|
|
160
|
+
return Object.assign(arrayDefaults, arrayParamNomenclature, config).array;
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
Object.assign(this, {
|
|
163
163
|
id,
|
|
164
164
|
type,
|
|
165
165
|
location,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter, map } from "../common/common";
|
|
2
2
|
import { isArray, isDefined } from "../common/predicates";
|
|
3
3
|
/**
|
|
4
4
|
* An internal class which implements [[ParamTypeDefinition]].
|
|
@@ -34,7 +34,7 @@ export class ParamType {
|
|
|
34
34
|
this.pattern = /.*/;
|
|
35
35
|
/** @inheritdoc */
|
|
36
36
|
this.inherit = true;
|
|
37
|
-
|
|
37
|
+
Object.assign(this, def);
|
|
38
38
|
}
|
|
39
39
|
// consider these four methods to be "abstract methods" that should be overridden
|
|
40
40
|
/** @inheritdoc */
|
|
@@ -127,7 +127,7 @@ function ArrayType(type, mode) {
|
|
|
127
127
|
const wrapperFn = name === "equals" ? arrayEqualsHandler : arrayHandler;
|
|
128
128
|
this[name] = wrapperFn(paramTypeFn);
|
|
129
129
|
});
|
|
130
|
-
|
|
130
|
+
Object.assign(this, {
|
|
131
131
|
dynamic: type.dynamic,
|
|
132
132
|
name: type.name,
|
|
133
133
|
pattern: type.pattern,
|