├── .all-contributorsrc ├── .editorconfig ├── .gitignore ├── .husky ├── commit-msg ├── pre-commit └── pre-push ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── angular.json ├── assets └── logo.psd ├── commitlint.config.js ├── hooks └── pre-commit.js ├── logo.png ├── package-lock.json ├── package.json ├── prettier.config.js ├── projects ├── ngx-errors-material │ ├── .browserslistrc │ ├── README.md │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ │ ├── lib │ │ │ ├── ngx-errors-material.module.ts │ │ │ └── set-mat-input-error-state-matcher.directive.ts │ │ ├── public-api.ts │ │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json ├── ngx-errors │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ │ ├── lib │ │ │ ├── custom-error-state-matchers.ts │ │ │ ├── error-state-matchers.service.ts │ │ │ ├── error-state-matchers.ts │ │ │ ├── error.directive.spec.ts │ │ │ ├── error.directive.ts │ │ │ ├── errors-configuration.ts │ │ │ ├── errors.directive.spec.ts │ │ │ ├── errors.directive.ts │ │ │ ├── errors.module.ts │ │ │ ├── form.directive.ts │ │ │ ├── misc.ts │ │ │ ├── ngx-errors.ts │ │ │ ├── overridden-show-when.service.ts │ │ │ ├── validators.spec.ts │ │ │ └── validators.ts │ │ ├── public-api.ts │ │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json └── playground │ ├── .browserslistrc │ ├── karma.conf.js │ ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── custom-matchers │ │ │ ├── index.ts │ │ │ ├── provider.ts │ │ │ ├── show-on-dima-error-state-matcher.ts │ │ │ └── show-on-five-error-state-matcher.ts │ │ ├── home │ │ │ ├── home.component.html │ │ │ ├── home.component.scss │ │ │ ├── home.component.spec.ts │ │ │ └── home.component.ts │ │ └── lazy │ │ │ ├── lazy-routing.module.ts │ │ │ ├── lazy.component.html │ │ │ ├── lazy.component.scss │ │ │ ├── lazy.component.spec.ts │ │ │ ├── lazy.component.ts │ │ │ └── lazy.module.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json ├── tsconfig.json └── tslint.json /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "ngs-errors", 3 | "projectOwner": "ngspot", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": true, 11 | "commitConvention": "angular", 12 | "contributors": [ 13 | { 14 | "login": "DmitryEfimenko", 15 | "name": "Dmitry A. Efimenko", 16 | "avatar_url": "https://avatars0.githubusercontent.com/u/2098175?v=4", 17 | "profile": "https://github.com/DmitryEfimenko/", 18 | "contributions": [ 19 | "code", 20 | "design", 21 | "doc", 22 | "ideas" 23 | ] 24 | }, 25 | { 26 | "login": "AnaBoca", 27 | "name": "Ana Boca", 28 | "avatar_url": "https://avatars0.githubusercontent.com/u/17017510?v=4", 29 | "profile": "https://github.com/AnaBoca", 30 | "contributions": [ 31 | "doc" 32 | ] 33 | } 34 | ], 35 | "contributorsPerLine": 7 36 | } 37 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.angular/cache 36 | /.sass-cache 37 | /connect.lock 38 | /coverage 39 | /libpeerconnection.log 40 | npm-debug.log 41 | debug.log 42 | yarn-error.log 43 | testem.log 44 | /typings 45 | 46 | # System Files 47 | .DS_Store 48 | Thumbs.db 49 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install -- commitlint -e $GIT_PARAMS 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run hooks:pre-commit && node_modules/.bin/lint-staged 5 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run test:lib:headless 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [3.2.1](https://github.com/ngspot/ngx-errors/compare/v3.2.0...v3.2.1) (2022-11-25) 6 | 7 | ### Bug Fixes 8 | 9 | - 🐛 fix compatibility with template-driven forms 10 | 11 | ## [3.2.0](https://github.com/ngspot/ngx-errors/compare/v3.1.5...v3.2.0) (2022-02-04) 12 | 13 | ### Features 14 | 15 | - 🎸 move material deps into @ngspot/ngx-errors-material ([ad49c7c](https://github.com/ngspot/ngx-errors/commit/ad49c7cca52a24be83e80fb3738ebcd450a3f5ab)), closes [#9](https://github.com/ngspot/ngx-errors/issues/9) 16 | 17 | ### [3.1.5](https://github.com/ngspot/ngx-errors/compare/v3.1.4...v3.1.5) (2022-01-21) 18 | 19 | ### Bug Fixes 20 | 21 | - 🐛 broken matInput without ngModel ([e8d6f47](https://github.com/ngspot/ngx-errors/commit/e8d6f47ee38fa3effeb59ec59787261291f4d07c)) 22 | 23 | ### [3.1.4](https://github.com/ngspot/ngx-errors/compare/v3.1.3...v3.1.4) (2022-01-16) 24 | 25 | ### Bug Fixes 26 | 27 | - 🐛 providing errorsModule in the lazy app module ([b2f1488](https://github.com/ngspot/ngx-errors/commit/b2f1488a2d3ea004ca6fa0d25b90c240e60e38c6)) 28 | 29 | ### [3.1.3](https://github.com/ngspot/ngx-errors/compare/v3.1.2...v3.1.3) (2022-01-11) 30 | 31 | ### Bug Fixes 32 | 33 | - 🐛 provide config defaults ([5242c70](https://github.com/ngspot/ngx-errors/commit/5242c70a30968af5ea8e9c77b6d755b4886734f8)) 34 | 35 | ## 3.1.2 (2022-01-11) 36 | 37 | ### Bug Fixes 38 | 39 | - 🐛 missed null check for showMaxErrors ([66f2f4c](https://github.com/ngspot/ngx-errors/commit/66f2f4cef75381de843ed4f72189c5df5faad650)) 40 | 41 | ## 3.1.1 (2022-01-11) 42 | 43 | ### Bug Fixes 44 | 45 | - 🐛 class used before it was declared ([66d27a6](https://github.com/ngspot/ngx-errors/commit/66d27a65930d208e63ddfae87a683abfa0912423)) 46 | 47 | ## 3.1.0 (2022-01-11) 48 | 49 | ### Features 50 | 51 | - 🎸 integrate with MatInput; support arbitrary showWhen ([55fd44a](https://github.com/ngspot/ngx-errors/commit/55fd44a1e946ccee34d9cf979925f5bc4e5a6dfa)) 52 | - 🎸 new config option - showMaxErrors ([d46ba1b](https://github.com/ngspot/ngx-errors/commit/d46ba1be40a4e49be1d0f2e00c88475806c540ea)) 53 | 54 | ## 3.0.0 (2021-12-09) 55 | 56 | ### ⚠ BREAKING CHANGES 57 | 58 | - 🧨 Require Angular v13 59 | 60 | ### Features 61 | 62 | - 🎸 bump Angular to v13 ([a9b18aa](https://github.com/ngspot/ngx-errors/commit/a9b18aac8f78cca778d43f4c897b50f357df742d)) 63 | 64 | ## 2.0.2 (2021-12-09) 65 | 66 | ### Bug Fixes 67 | 68 | - 🐛 not displaying error when async validator present ([684dcf5](https://github.com/ngspot/ngx-errors/commit/684dcf5114a1e2ac9c6c4e64925d6ebf262cc6ba)) 69 | 70 | ## 2.0.1 (2021-01-19) 71 | 72 | ### Features 73 | 74 | - 🎸 dependentValidator ([b49b82f](https://github.com/ngspot/ngx-errors/commit/b49b82f9cf75b718288c72f190fa2a09ca1469dc)) 75 | 76 | ## 2.0.0 (2020-12-06) 77 | 78 | ### Features 79 | 80 | - You can specify to show errors when input is dirty, touched, dirty and touched or when form is submitted. 81 | - You can now access error details in the template 82 | 83 | ### Breaking Changes 84 | 85 | - 🎸 new config options. The config file now has different signature. 86 | 87 | ```ts 88 | export interface IErrorsConfiguration { 89 | showErrorsWhenInput: ShowErrorWhen; 90 | } 91 | 92 | export type ShowErrorWhen = 93 | | 'touched' 94 | | 'dirty' 95 | | 'touchedAndDirty' 96 | | 'formIsSubmitted'; 97 | ``` 98 | 99 | ### Bug Fixes 100 | 101 | - 🐛 headless test not working ([d73f689](https://github.com/ngspot/ngx-errors/commit/d73f689d6010b3c728167d24a815b1ea7fe7255c)) 102 | 103 | ## 1.0.1 (2020-04-13) 104 | 105 | ### Bug Fixes 106 | 107 | - 🐛 headless test not working ([d73f689](https://github.com/ngspot/ngx-errors/commit/d73f689d6010b3c728167d24a815b1ea7fe7255c)) 108 | 109 | ## 1.0.0 (2020-04-13) 110 | 111 | ### Features 112 | 113 | - create project ([fa7b22d](https://github.com/ngspot/ngx-errors/commit/fa7b22dab9f8cb43e2d0760c6aa30655987df95a)) 114 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dmitrief@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to ngx-errors 2 | 3 | 🙏 We would ❤️ for you to contribute to ngx-errors and help make it even better than it is today! 4 | 5 | # Developing 6 | 7 | Start by installing all dependencies: 8 | 9 | ```bash 10 | npm i 11 | ``` 12 | 13 | Run the tests: 14 | 15 | ```bash 16 | npm test 17 | npm run e2e 18 | ``` 19 | 20 | Run the playground app: 21 | 22 | ```bash 23 | npm start 24 | ``` 25 | 26 | ## Building 27 | 28 | ```bash 29 | npm run build 30 | ``` 31 | 32 | ## Coding Rules 33 | 34 | To ensure consistency throughout the source code, keep these rules in mind as you are working: 35 | 36 | - All features or bug fixes **must be tested** by one or more specs (unit-tests). 37 | - All public API methods **must be documented**. 38 | 39 | ## Commit Message Guidelines 40 | 41 | We have very precise rules over how our git commit messages can be formatted. This leads to **more 42 | readable messages** that are easy to follow when looking through the **project history**. But also, 43 | we use the git commit messages to **generate the changelog**. 44 | 45 | ### Commit Message Format 46 | 47 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 48 | format that includes a **type**, a **scope** and a **subject**: 49 | 50 | ``` 51 | (): 52 | 53 | 54 | 55 |