@angular-wave/angular.ts 0.7.7 → 0.8.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.
- package/@types/animations/raf-scheduler.d.ts +2 -2
- package/@types/animations/shared.d.ts +0 -1
- package/@types/core/compile/attributes.d.ts +3 -3
- package/@types/core/compile/compile.d.ts +1 -1
- package/@types/core/di/injector.d.ts +0 -1
- package/@types/core/di/internal-injector.d.ts +1 -0
- package/@types/core/di/ng-module.d.ts +5 -0
- package/@types/core/filter/filter.d.ts +11 -13
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
- package/@types/core/scope/scope.d.ts +1 -1
- package/@types/directive/attrs/attrs.d.ts +7 -1
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/directive/events/events.d.ts +9 -3
- package/@types/directive/http/http.d.ts +6 -2
- package/@types/directive/include/include.d.ts +2 -2
- package/@types/directive/input/input.d.ts +2 -12
- package/@types/directive/messages/messages.d.ts +9 -48
- package/@types/directive/model/model.d.ts +3 -3
- package/@types/directive/options/options.d.ts +13 -20
- package/@types/directive/switch/switch.d.ts +1 -0
- package/@types/directive/transclude/transclude.d.ts +10 -6
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +56 -18
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/view-directive.d.ts +2 -19
- package/@types/router/{common → glob}/glob.d.ts +5 -1
- package/@types/router/globals.d.ts +2 -3
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-registry.d.ts +1 -2
- package/@types/router/state/state-service.d.ts +8 -7
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition.d.ts +12 -15
- package/@types/router/url/url-matcher.d.ts +3 -3
- package/@types/router/url/url-rule.d.ts +1 -0
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +30 -42
- package/@types/services/anchor-scroll.d.ts +1 -1
- package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
- package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
- package/@types/services/http/http.d.ts +48 -3
- package/@types/services/http/interface.d.ts +2 -2
- package/@types/services/http-backend/http-backend.d.ts +49 -44
- package/@types/services/location/interface.d.ts +63 -0
- package/@types/services/location/location.d.ts +330 -0
- package/@types/{core → services}/sce/sce.d.ts +1 -1
- package/@types/services/template-cache/interface.d.ts +8 -2
- package/@types/services/template-cache/template-cache.d.ts +1 -1
- package/@types/services/template-request.d.ts +1 -1
- package/@types/shared/cache.d.ts +0 -2
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/dom.d.ts +6 -0
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/test-utils.d.ts +1 -0
- package/@types/shared/url-utils/interface.d.ts +46 -0
- package/@types/shared/url-utils/url-utils.d.ts +64 -0
- package/@types/shared/utils.d.ts +44 -6
- package/Makefile +8 -4
- package/dist/angular-ts.esm.js +1889 -2199
- package/dist/angular-ts.umd.js +1889 -2199
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +10 -8
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +203 -0
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +66 -1
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/templateCache.md +2 -2
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/showcss.html +2 -0
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-bind/ng-bind.html +2 -2
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- package/docs/static/typedoc/classes/NgModule.html +32 -0
- package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
- package/docs/static/typedoc/hierarchy.html +1 -1
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Directive.html +5 -4
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
- package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
- package/docs/static/typedoc/interfaces/Provider.html +16 -10
- package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
- package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
- package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
- package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/typedoc/variables/SwapMode.html +11 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/legacy.d.ts +0 -10
- package/package.json +1 -3
- package/src/{loader.js → angular.js} +5 -10
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-children-directive.js +2 -2
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/raf-scheduler.js +1 -1
- package/src/animations/shared.js +2 -12
- package/src/binding.spec.js +1 -1
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +7 -10
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +11 -25
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +7 -7
- package/src/core/di/ng-module.js +12 -27
- package/src/core/filter/filter.js +28 -28
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/interpreter.js +32 -38
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +17 -16
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.js +3 -3
- package/src/core/scope/scope.js +12 -13
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.js +7 -4
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +6 -2
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +3 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +281 -4
- package/src/directive/http/http.js +112 -15
- package/src/directive/http/http.test.js +2 -2
- package/src/directive/http/post.spec.js +506 -9
- package/src/directive/http/put.spec.js +3 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.js +7 -7
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +19 -43
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.js +4 -0
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +14 -14
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.js +454 -464
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.js +12 -14
- package/src/directive/setter/setter.spec.js +40 -17
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/transclude/transclude.js +87 -89
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +6 -2
- package/src/interface.ts +70 -19
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +16 -23
- package/src/{public.spec.js → ng.spec.js} +1 -1
- package/src/router/directives/state-directives.spec.js +9 -8
- package/src/router/directives/view-directive.js +11 -9
- package/src/router/directives/view-directive.spec.js +8 -9
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common → glob}/glob.js +5 -0
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/globals.js +1 -2
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/services.spec.js +5 -6
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +2 -3
- package/src/router/state/state-service.js +13 -10
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +15 -11
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +1 -1
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +6 -5
- package/src/router/transition/transition.js +4 -4
- package/src/router/url/url-matcher.js +3 -3
- package/src/router/url/url-rule.js +1 -0
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +82 -85
- package/src/router/url/url-service.spec.js +55 -39
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.spec.js +1 -1
- package/src/services/anchor-scroll.html +2 -9
- package/src/services/anchor-scroll.js +6 -5
- package/src/{core → services/exception}/exception-handler.js +2 -2
- package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
- package/src/services/http/http.js +11 -17
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/interface.ts +2 -2
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +53 -89
- package/src/services/http-backend/http-backend.spec.js +2 -6
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +70 -0
- package/src/{core → services}/location/location.html +4 -1
- package/src/services/location/location.js +999 -0
- package/src/{core → services}/location/location.spec.js +911 -532
- package/src/{core → services}/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/{core → services}/sce/sce.html +1 -1
- package/src/{core → services}/sce/sce.js +14 -10
- package/src/{core → services}/sce/sce.md +2 -2
- package/src/{core → services}/sce/sce.spec.js +3 -4
- package/src/{core → services}/sce/sce.test.js +1 -1
- package/src/services/template-cache/interface.ts +8 -2
- package/src/services/template-cache/template-cache.js +3 -1
- package/src/services/template-cache/template-cache.spec.js +73 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/services/template-request.js +2 -1
- package/src/shared/cache.js +0 -2
- package/src/shared/common.js +0 -5
- package/src/shared/common.spec.js +1 -1
- package/src/shared/dom.js +10 -0
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/test-utils.js +1 -0
- package/src/shared/url-utils/interface.ts +54 -0
- package/src/{core → shared}/url-utils/url-utils.html +4 -1
- package/src/{core → shared}/url-utils/url-utils.js +26 -47
- package/src/{core → shared}/url-utils/url-utils.spec.js +10 -17
- package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
- package/src/shared/utils.js +60 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +36 -2
- package/utils/version.cjs +23 -0
- package/@types/core/location/location.d.ts +0 -317
- package/@types/core/task-tracker-factory.d.ts +0 -76
- package/@types/core/url-utils/url-utils.d.ts +0 -56
- package/@types/router/state-provider.d.ts +0 -123
- package/@types/services/browser.d.ts +0 -101
- package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
- package/jsdoc.json +0 -22
- package/src/core/location/location.js +0 -984
- package/src/core/location/location.md +0 -114
- package/src/core/task-tracker-factory.js +0 -145
- package/src/core/url-utils/url-utils.md +0 -46
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/browser.js +0 -212
- /package/@types/{loader.d.ts → angular.d.ts} +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isNumberNaN,
|
|
3
3
|
isString,
|
|
4
|
-
toInt,
|
|
5
4
|
minErr,
|
|
6
5
|
isUndefined,
|
|
7
6
|
isProxy,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
} from "../../shared/utils.js";
|
|
10
9
|
import { REGEX_STRING_REGEXP } from "./../attrs/attrs.js";
|
|
11
10
|
import { startingTag } from "../../shared/dom.js";
|
|
11
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
@@ -34,7 +34,7 @@ import { startingTag } from "../../shared/dom.js";
|
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
export const requiredDirective = [
|
|
37
|
-
|
|
37
|
+
$t.$parse,
|
|
38
38
|
/**
|
|
39
39
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
40
40
|
* @returns {import("../../interface.ts").Directive}
|
|
@@ -116,75 +116,72 @@ export const requiredDirective = [
|
|
|
116
116
|
* </div>
|
|
117
117
|
*/
|
|
118
118
|
export const patternDirective = [
|
|
119
|
-
|
|
119
|
+
$t.$parse,
|
|
120
120
|
/**
|
|
121
121
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
122
122
|
* @returns {import("../../interface.ts").Directive}
|
|
123
123
|
*/
|
|
124
|
-
($parse) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let parseFn;
|
|
124
|
+
($parse) => ({
|
|
125
|
+
restrict: "A",
|
|
126
|
+
require: "?ngModel",
|
|
127
|
+
compile: (_Elm, tAttr) => {
|
|
128
|
+
let patternExp;
|
|
129
|
+
let parseFn;
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
if (tAttr["ngPattern"]) {
|
|
132
|
+
patternExp = tAttr["ngPattern"];
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
134
|
+
// ngPattern might be a scope expression, or an inlined regex, which is not parsable.
|
|
135
|
+
// We get value of the attribute here, so we can compare the old and the new value
|
|
136
|
+
// in the observer to avoid unnecessary validations
|
|
137
|
+
if (
|
|
138
|
+
tAttr["ngPattern"].charAt(0) === "/" &&
|
|
139
|
+
REGEX_STRING_REGEXP.test(tAttr["ngPattern"])
|
|
140
|
+
) {
|
|
141
|
+
parseFn = function () {
|
|
142
|
+
return tAttr["ngPattern"];
|
|
143
|
+
};
|
|
144
|
+
} else {
|
|
145
|
+
parseFn = $parse(tAttr["ngPattern"]);
|
|
148
146
|
}
|
|
147
|
+
}
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
let attrVal = attr["pattern"];
|
|
149
|
+
return function (scope, elm, attr, ctrl) {
|
|
150
|
+
if (!ctrl) return;
|
|
151
|
+
let attrVal = attr["pattern"];
|
|
154
152
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
if (attr["ngPattern"]) {
|
|
154
|
+
attrVal = parseFn(scope);
|
|
155
|
+
} else {
|
|
156
|
+
patternExp = attr["pattern"];
|
|
157
|
+
}
|
|
160
158
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
let regexp = parsePatternAttr(attrVal, patternExp, elm);
|
|
160
|
+
attr.$observe("pattern", (newVal) => {
|
|
161
|
+
const oldRegexp = regexp;
|
|
164
162
|
|
|
165
|
-
|
|
163
|
+
regexp = parsePatternAttr(newVal, patternExp, elm);
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
if (
|
|
166
|
+
(oldRegexp && oldRegexp.toString()) !==
|
|
167
|
+
(regexp && regexp.toString())
|
|
168
|
+
) {
|
|
169
|
+
ctrl["$validate"]();
|
|
170
|
+
}
|
|
171
|
+
});
|
|
174
172
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
};
|
|
173
|
+
ctrl["$validators"]["pattern"] = (_modelValue, viewValue) => {
|
|
174
|
+
// HTML5 pattern constraint validates the input value, so we validate the viewValue
|
|
175
|
+
return (
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
ctrl.$isEmpty(viewValue) ||
|
|
178
|
+
isUndefined(regexp) ||
|
|
179
|
+
regexp.test(viewValue)
|
|
180
|
+
);
|
|
184
181
|
};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
188
185
|
];
|
|
189
186
|
|
|
190
187
|
/**
|
|
@@ -218,7 +215,7 @@ export const patternDirective = [
|
|
|
218
215
|
*
|
|
219
216
|
*/
|
|
220
217
|
export const maxlengthDirective = [
|
|
221
|
-
|
|
218
|
+
$t.$parse,
|
|
222
219
|
/**
|
|
223
220
|
* @param {import("../../core/parse/interface.ts").ParseService} $parse
|
|
224
221
|
* @returns {import("../../interface.ts").Directive}
|
|
@@ -290,32 +287,28 @@ export const maxlengthDirective = [
|
|
|
290
287
|
*
|
|
291
288
|
*/
|
|
292
289
|
export const minlengthDirective = [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (!ctrl) return;
|
|
290
|
+
$t.$parse,
|
|
291
|
+
($parse) => ({
|
|
292
|
+
restrict: "A",
|
|
293
|
+
require: "?ngModel",
|
|
294
|
+
link(scope, elm, attr, ctrl) {
|
|
295
|
+
if (!ctrl) return;
|
|
300
296
|
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
let minlength = attr.minlength || $parse(attr.ngMinlength)(scope);
|
|
298
|
+
let minlengthParsed = parseLength(minlength) || -1;
|
|
303
299
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
},
|
|
300
|
+
attr.$observe("minlength", (value) => {
|
|
301
|
+
if (minlength !== value) {
|
|
302
|
+
minlengthParsed = parseLength(value) || -1;
|
|
303
|
+
minlength = value;
|
|
304
|
+
ctrl.$validate();
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
ctrl.$validators.minlength = function (modelValue, viewValue) {
|
|
308
|
+
return ctrl.$isEmpty(viewValue) || viewValue.length >= minlengthParsed;
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
}),
|
|
319
312
|
];
|
|
320
313
|
|
|
321
314
|
function parsePatternAttr(regex, patternExp, elm) {
|
|
@@ -326,7 +319,12 @@ function parsePatternAttr(regex, patternExp, elm) {
|
|
|
326
319
|
}
|
|
327
320
|
|
|
328
321
|
if (isString(regex)) {
|
|
329
|
-
|
|
322
|
+
const match = regex.match(/^\/(.*)\/([gimsuy]*)$/);
|
|
323
|
+
if (match) {
|
|
324
|
+
regex = new RegExp(match[1], match[2]);
|
|
325
|
+
} else {
|
|
326
|
+
regex = new RegExp(`^${regex}$`);
|
|
327
|
+
}
|
|
330
328
|
}
|
|
331
329
|
|
|
332
330
|
if (!regex.test) {
|
|
@@ -343,6 +341,6 @@ function parsePatternAttr(regex, patternExp, elm) {
|
|
|
343
341
|
}
|
|
344
342
|
|
|
345
343
|
function parseLength(val) {
|
|
346
|
-
const intVal =
|
|
344
|
+
const intVal = parseInt(val, 10);
|
|
347
345
|
return isNumberNaN(intVal) ? -1 : intVal;
|
|
348
346
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { wait } from "../../shared/test-utils.js";
|
|
3
|
-
import { getController } from "../../shared/dom.js";
|
|
3
|
+
import { dealoc, getController } from "../../shared/dom.js";
|
|
4
4
|
|
|
5
5
|
describe("validators", () => {
|
|
6
6
|
let $rootScope;
|
|
@@ -9,6 +9,7 @@ describe("validators", () => {
|
|
|
9
9
|
let errors = [];
|
|
10
10
|
|
|
11
11
|
beforeEach(() => {
|
|
12
|
+
dealoc(document.getElementById("app"));
|
|
12
13
|
errors = [];
|
|
13
14
|
window.angular = new Angular();
|
|
14
15
|
window.angular
|
|
@@ -27,7 +28,7 @@ describe("validators", () => {
|
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
describe("pattern", () => {
|
|
30
|
-
it("should validate in-lined pattern", () => {
|
|
31
|
+
it("should validate in-lined pattern", async () => {
|
|
31
32
|
inputElm = $compile(
|
|
32
33
|
'<input type="text" ng-model="value" ng-pattern="/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/" />',
|
|
33
34
|
)($rootScope);
|
|
@@ -246,7 +247,7 @@ describe("validators", () => {
|
|
|
246
247
|
inputElm.dispatchEvent(new Event("change"));
|
|
247
248
|
expect($rootScope.form.test.$error.pattern).toBe(true);
|
|
248
249
|
expect(inputElm.classList.contains("ng-invalid")).toBeTrue();
|
|
249
|
-
|
|
250
|
+
//
|
|
250
251
|
inputElm.setAttribute("value", "12345");
|
|
251
252
|
inputElm.dispatchEvent(new Event("change"));
|
|
252
253
|
expect($rootScope.form.test.$error.pattern).toBe(true);
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/validators/validators.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(3000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
package/src/filters/limit-to.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
isNumber,
|
|
5
5
|
isNumberNaN,
|
|
6
6
|
isString,
|
|
7
|
-
toInt,
|
|
8
7
|
} from "../shared/utils.js";
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -23,7 +22,7 @@ export function limitToFilter() {
|
|
|
23
22
|
if (Math.abs(Number(limit)) === Infinity) {
|
|
24
23
|
limit = Number(limit);
|
|
25
24
|
} else {
|
|
26
|
-
limit =
|
|
25
|
+
limit = parseInt(/** @type {string} */ (limit), 10);
|
|
27
26
|
}
|
|
28
27
|
if (isNumberNaN(limit)) return input;
|
|
29
28
|
|
|
@@ -33,7 +32,7 @@ export function limitToFilter() {
|
|
|
33
32
|
begin =
|
|
34
33
|
!begin || isNaN(/** @type {any} */ (begin))
|
|
35
34
|
? 0
|
|
36
|
-
:
|
|
35
|
+
: parseInt(/** @type {string} */ (begin), 10);
|
|
37
36
|
begin =
|
|
38
37
|
begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
|
|
39
38
|
|
package/src/index.js
CHANGED
package/src/injection-tokens.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
* @type Readonly<Record<string, string>>
|
|
17
17
|
*/
|
|
18
18
|
export const $injectTokens = Object.freeze({
|
|
19
|
+
$attrs: "$attrs",
|
|
20
|
+
$scope: "$scope",
|
|
21
|
+
$element: "$element",
|
|
19
22
|
$$AnimateRunner: "$$AnimateRunner",
|
|
20
23
|
$$animateAsyncRun: "$$animateAsyncRun",
|
|
21
24
|
$$animateCache: "$$animateCache",
|
|
@@ -30,7 +33,7 @@ export const $injectTokens = Object.freeze({
|
|
|
30
33
|
$animate: "$animate",
|
|
31
34
|
$animateCss: "$animateCss",
|
|
32
35
|
$aria: "$aria",
|
|
33
|
-
$
|
|
36
|
+
$compile: "$compile",
|
|
34
37
|
$controller: "$controller",
|
|
35
38
|
$eventBus: "$eventBus",
|
|
36
39
|
$exceptionHandler: "$exceptionHandler",
|
|
@@ -44,6 +47,7 @@ export const $injectTokens = Object.freeze({
|
|
|
44
47
|
$ngViewScroll: "$ngViewScroll",
|
|
45
48
|
$parse: "$parse",
|
|
46
49
|
$rootScope: "$rootScope",
|
|
50
|
+
$rootElement: "$rootElement",
|
|
47
51
|
$routerGlobals: "$routerGlobals",
|
|
48
52
|
$sce: "$sce",
|
|
49
53
|
$sceDelegate: "$sceDelegate",
|
|
@@ -54,7 +58,7 @@ export const $injectTokens = Object.freeze({
|
|
|
54
58
|
$templateRequest: "$templateRequest",
|
|
55
59
|
$transitions: "$transitions",
|
|
56
60
|
$urlConfig: "$urlConfig",
|
|
57
|
-
$
|
|
61
|
+
$url: "$url",
|
|
58
62
|
$view: "$view",
|
|
59
63
|
// provide literals
|
|
60
64
|
$provide: "$provide",
|
package/src/interface.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Attributes } from "./core/compile/attributes.js";
|
|
2
2
|
import { Scope } from "./core/scope/scope.js";
|
|
3
|
+
export * from "./core/di/ng-module.js";
|
|
3
4
|
export * from "./services/http/interface.ts";
|
|
4
5
|
export * from "./services/log/interface.ts";
|
|
5
6
|
export * from "./services/log/log.js";
|
|
7
|
+
export * from "./services/location/interface.ts";
|
|
8
|
+
export * from "./services/location/location.js";
|
|
6
9
|
export * from "./services/pubsub/pubsub.js";
|
|
7
10
|
export * from "./services/template-cache/interface.ts";
|
|
8
11
|
export * from "./services/template-cache/template-cache.js";
|
|
@@ -62,47 +65,66 @@ export interface ServiceProvider {
|
|
|
62
65
|
* services, factories, constants, values, decorators, etc.
|
|
63
66
|
*/
|
|
64
67
|
export interface Provider {
|
|
68
|
+
/**
|
|
69
|
+
* Register a directive
|
|
70
|
+
* @param name - The name of the directive.
|
|
71
|
+
* @param directive - An object with a `$get` property that defines how the service is created.
|
|
72
|
+
*/
|
|
73
|
+
directive(name: string, directive: DirectiveFactory): Provider;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Register multiple directives
|
|
77
|
+
* @param obj
|
|
78
|
+
*/
|
|
79
|
+
directive(obj: Record<string, DirectiveFactory>): Provider;
|
|
80
|
+
|
|
65
81
|
/**
|
|
66
82
|
* Register a service provider.
|
|
67
83
|
* @param name - The name of the service.
|
|
68
84
|
* @param provider - An object with a `$get` property that defines how the service is created.
|
|
69
85
|
*/
|
|
70
|
-
provider(name: string, provider:
|
|
86
|
+
provider(name: string, provider: Function): Provider;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Register multiple service providers
|
|
90
|
+
* @param obj
|
|
91
|
+
*/
|
|
92
|
+
provider(obj: Record<string, Function>): Provider;
|
|
71
93
|
|
|
72
94
|
/**
|
|
73
95
|
* Register a factory function to create a service.
|
|
74
96
|
* @param name - The name of the service.
|
|
75
97
|
* @param factoryFn - A function (or annotated array) that returns the service instance.
|
|
76
98
|
*/
|
|
77
|
-
factory(name: string, factoryFn: Injectable):
|
|
99
|
+
factory(name: string, factoryFn: Injectable): Provider;
|
|
78
100
|
|
|
79
101
|
/**
|
|
80
102
|
* Register a constructor function to create a service.
|
|
81
103
|
* @param name - The name of the service.
|
|
82
104
|
* @param constructor - A class or function to instantiate.
|
|
83
105
|
*/
|
|
84
|
-
service(name: string, constructor: Injectable):
|
|
106
|
+
service(name: string, constructor: Injectable): Provider;
|
|
85
107
|
|
|
86
108
|
/**
|
|
87
109
|
* Register a fixed value as a service.
|
|
88
110
|
* @param name - The name of the service.
|
|
89
111
|
* @param val - The value to use.
|
|
90
112
|
*/
|
|
91
|
-
value(name: string, val: any):
|
|
113
|
+
value(name: string, val: any): Provider;
|
|
92
114
|
|
|
93
115
|
/**
|
|
94
116
|
* Register a constant value (available during config).
|
|
95
117
|
* @param name - The name of the constant.
|
|
96
118
|
* @param val - The constant value.
|
|
97
119
|
*/
|
|
98
|
-
constant(name: string, val: any):
|
|
120
|
+
constant(name: string, val: any): Provider;
|
|
99
121
|
|
|
100
122
|
/**
|
|
101
123
|
* Register a decorator function to modify or replace an existing service.
|
|
102
124
|
* @param name - The name of the service to decorate.
|
|
103
125
|
* @param fn - A function that takes `$delegate` and returns a decorated service.
|
|
104
126
|
*/
|
|
105
|
-
decorator(name: string, fn:
|
|
127
|
+
decorator(name: string, fn: Function): Provider;
|
|
106
128
|
}
|
|
107
129
|
|
|
108
130
|
/**
|
|
@@ -247,15 +269,19 @@ export interface Directive {
|
|
|
247
269
|
/** Template URL for loading from server */
|
|
248
270
|
templateUrl?: string | ((element: Element, attrs: Attributes) => string);
|
|
249
271
|
/** Enables transclusion or configures named slots */
|
|
250
|
-
transclude?: boolean |
|
|
272
|
+
transclude?: boolean | string | Record<string, string>;
|
|
251
273
|
/** Internal hook for directive compilation state */
|
|
252
274
|
$$addStateInfo?: (...args: any[]) => any;
|
|
275
|
+
count?: number;
|
|
253
276
|
}
|
|
254
277
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
278
|
+
export type DirectiveFactoryFn = (
|
|
279
|
+
...args: any[]
|
|
280
|
+
) => Directive | DirectiveLinkFn;
|
|
281
|
+
|
|
282
|
+
export type AnnotatedDirectiveFactory = Array<string | DirectiveFactoryFn>;
|
|
283
|
+
|
|
284
|
+
export type DirectiveFactory = DirectiveFactoryFn | AnnotatedDirectiveFactory;
|
|
259
285
|
|
|
260
286
|
/**
|
|
261
287
|
* Represents advanced transclusion functions used in directives.
|
|
@@ -339,14 +365,39 @@ export interface NgModelController {
|
|
|
339
365
|
/** Current value shown in the view */
|
|
340
366
|
$viewValue: any;
|
|
341
367
|
}
|
|
342
|
-
|
|
343
368
|
/**
|
|
344
369
|
* Possible values for `data-swap` attribute
|
|
345
370
|
*/
|
|
346
|
-
export
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
371
|
+
export const SwapMode = {
|
|
372
|
+
/** (default) Replaces the contents inside the element */
|
|
373
|
+
innerHTML: "innerHTML",
|
|
374
|
+
|
|
375
|
+
/** Replaces the entire element, including the tag itself */
|
|
376
|
+
outerHTML: "outerHTML",
|
|
377
|
+
|
|
378
|
+
/** Inserts plain text (without parsing HTML) */
|
|
379
|
+
textContent: "textContent",
|
|
380
|
+
|
|
381
|
+
/** Inserts HTML immediately before the element itself */
|
|
382
|
+
beforebegin: "beforebegin",
|
|
383
|
+
|
|
384
|
+
/** Inserts HTML inside the element, before its first child */
|
|
385
|
+
afterbegin: "afterbegin",
|
|
386
|
+
|
|
387
|
+
/** Inserts HTML inside the element, after its last child */
|
|
388
|
+
beforeend: "beforeend",
|
|
389
|
+
|
|
390
|
+
/** Inserts HTML immediately after the element itself */
|
|
391
|
+
afterend: "afterend",
|
|
392
|
+
|
|
393
|
+
/** Removes the element entirely */
|
|
394
|
+
delete: "delete",
|
|
395
|
+
|
|
396
|
+
/** Performs no insertion (no-op) */
|
|
397
|
+
none: "none",
|
|
398
|
+
} as const;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Union type representing all possible DOM insertion modes.
|
|
402
|
+
*/
|
|
403
|
+
export type SwapModeType = keyof typeof SwapMode;
|