Skip to content

Commit

Permalink
Merge pull request #2 from bigBear713/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bigBear713 authored Mar 27, 2022
2 parents b2eb27f + 6e98033 commit ecf0562
Show file tree
Hide file tree
Showing 29 changed files with 428 additions and 120 deletions.
8 changes: 6 additions & 2 deletions README.EN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

### @bigbear713/nb-form
# @bigbear713/nb-form

Angular common form lib by bigBear713.

Expand All @@ -13,12 +13,16 @@ Angular common form lib by bigBear713.
</div>

## Document
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md "中文文档")
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md "文档 - 中文")
- [English](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md "English Document")

## Changelog
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/CHANGELOG.md "更新日志 - 中文")
- [English](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/CHANGELOG.EN.md "Changelog - English")

## Feature
- Provide the common validators:`arrLength`, `fileSize`, `fileType`, `repeated`, `required`, `whitespace`. You can see the definition below;
- Support to use DI to set common error info;
- Support the changeDetection of components as `ChangeDetectionStrategy.OnPush`;

## Installation
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

### @bigbear713/nb-form
# @bigbear713/nb-form

Angular common form lib by bigBear713.

Expand All @@ -13,11 +13,16 @@ Angular common form lib by bigBear713.
</div>

## Document
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md "中文文档")
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md "文档 - 中文")
- [English](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md "English Document")

## Changelog
- [中文](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/CHANGELOG.md "更新日志 - 中文")
- [English](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/CHANGELOG.EN.md "Changelog - English")

## Feature
- 提供常用的表单控件校验器:`arrLength`, `fileSize`, `fileType`, `repeated`, `required`, `whitespace`。具体见下方校验器的定义;
- 支持通过DI设置common error info;
- 支持组件的更新策略为`ChangeDetectionStrategy.OnPush`;

## Installation
Expand Down
47 changes: 24 additions & 23 deletions docs/3rdpartylicenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,30 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@bigbear713/nb-form
MIT
MIT License

Copyright (c) 2022 @bigbear713/nb-form project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@bigbear713/nb-trans
MIT
MIT License
Expand Down Expand Up @@ -112,29 +136,6 @@ licenses; we recommend you read them, as their terms may differ from the
terms above.


nb-form
MIT License

Copyright (c) 2022 nb-form project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

rxjs
Apache-2.0
Apache License
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<link rel="stylesheet" href="styles.31d6cfe0d16ae931b73c.css"></head>
<body>
<app-root></app-root>
<script src="runtime.3525f3edb423e47fc8f8.js" defer></script><script src="polyfills.3d2ff633476065fe1e11.js" defer></script><script src="main.1d3785e1e902e0dbb19e.js" defer></script>
<script src="runtime.3525f3edb423e47fc8f8.js" defer></script><script src="polyfills.3d2ff633476065fe1e11.js" defer></script><script src="main.af4599e89ec8f19b1b08.js" defer></script>

</body></html>
4 changes: 3 additions & 1 deletion docs/assets/localization/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"field3": "field 3",
"field4": "field 4",
"field5": "field 5",
"field6": "field 6",
"useComp": "use <nb-control-err></nb-control-err> directly",
"submit": "submit",
"resetField1": "reset field1",
Expand All @@ -18,6 +19,7 @@
"desc3": "The format of field 3's file should be: jpg/svg, and file size shoule between 100KB ~ 500KB",
"desc4": "The error info about required error and file type support i18n",
"desc5": "The values of field 4 and field 5 should be equal",
"desc6": "The common error info is supported to be set via DI, the common error will be combined with the error info from <nb-control-err></nb-control-err> component"
"desc6": "The common error info is supported to be set via DI, the common error will be combined with the error info from <nb-control-err></nb-control-err> component",
"desc7": "The error info of field 6 will be displayed at the beginning"
}
}
4 changes: 3 additions & 1 deletion docs/assets/localization/zh-CN/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"field3": "字段3",
"field4": "字段4",
"field5": "字段5",
"field6": "字段6",
"useComp": "直接使用<nb-control-err></nb-control-err>",
"submit": "提交",
"resetField1": "重置字段1",
Expand All @@ -18,6 +19,7 @@
"desc3": "字段3要求选择的文件的格式为:jpg/svg,文件大小在 100KB ~ 500KB 之间。",
"desc4": "必填错误信息和文件格式错误信息支持多语言转换",
"desc5": "字段4和字段5要求值要相等",
"desc6": "支持通过DI(依赖注入)设置公用错误信息,会和<nb-control-err></nb-control-err>组件传进来的错误信息组合成最终的错误信息"
"desc6": "支持通过DI(依赖注入)设置公用错误信息,会和<nb-control-err></nb-control-err>组件传进来的错误信息组合成最终的错误信息",
"desc7": "字段6会一开始就显示错误信息"
}
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<link rel="stylesheet" href="styles.31d6cfe0d16ae931b73c.css"></head>
<body>
<app-root></app-root>
<script src="runtime.3525f3edb423e47fc8f8.js" defer></script><script src="polyfills.3d2ff633476065fe1e11.js" defer></script><script src="main.1d3785e1e902e0dbb19e.js" defer></script>
<script src="runtime.3525f3edb423e47fc8f8.js" defer></script><script src="polyfills.3d2ff633476065fe1e11.js" defer></script><script src="main.af4599e89ec8f19b1b08.js" defer></script>

</body></html>

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"watch": "ng build --watch --configuration development",
"test": "ng test",
"start:lib": "ng build --watch nb-form",
"build:lib": "ng build nb-form && npm run copy:readmeEn",
"build:lib": "ng build nb-form && npm run copy:readmeEn && npm run copy:changelog",
"build:analyze": "npm run build -- --source-map && npm run view:analyze",
"view:analyze": "node_modules/.bin/source-map-explorer dist/nb-form-demo/*",
"test:lib": "ng test nb-form",
"deploy": "ng build --outputPath=docs --base-href=/nb-form/ && cp docs/index.html docs/404.html",
"publish:lib": "npm run build:lib && cd ./dist/nb-form && npm publish --access=public",
"copy:readmeEn": "cp projects/nb-form/README.EN.md dist/nb-form/README.EN.md",
"pack:lib": "cd ./dist/nb-form && npm pack",
"reInstall": "rm -rf ./node_modules && npm i"
"copy:readmeEn": "cp projects/nb-form/README.EN.md dist/nb-form/",
"copy:changelog": "cp projects/nb-form/CHANGELOG.* dist/nb-form/",
"pack:lib": "cd ./dist/nb-form && npm pack"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -52,4 +52,4 @@
"source-map-explorer": "^2.5.2",
"typescript": "~4.3.5"
}
}
}
44 changes: 44 additions & 0 deletions projects/nb-form/CHANGELOG.EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# v12.1.0
## [Validators](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Validators "Validators")
### [NbFormValidators.equal](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#nbformvalidatorsequal "NbFormValidators.equal")
- feat: Add `immediately` param, the default is `true`;

## [Services](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Services "Services")
### [NbFormService](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#nbformservice "NbFormService")
- feat: Add `updateEqualControlsValidities()` function so that you can more convenient to update the validities of the two controls which want to be equal;

## [Components](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Components "Components")
### [`<nb-control-err></nb-control-err>`](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#nb-control-errnb-control-err "<nb-control-err></nb-control-err>")
- fix: When the control is in init status and it is dirty, the component will not display the error information;

# v12.0.0
## [Module](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Module "Module")
- feat: NbFormModule - provide some useful `component`
- feat: NbFormTestingModule - provide the env to unit test;

## [Validators](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Validators "Validators")
- feat: NbFormValidators.arrLength - array length validator
- feat: NbFormValidators.equal - values are equal validator
- feat: NbFormValidators.fileSize - file size validator
- feat: NbFormValidators.fileType - file type validator
- feat: NbFormValidators.required - required validator
- feat: NbFormValidators.whitespace - can all be whitespace validator

## [Services](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Services "Services")
- feat: NbFormService - a `service` which provide some common function about form

## [Components](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Components "Components")
- feat: `<nb-control-err></nb-control-err>` - the component is used to show error info of the control
- feat: `<nb-field-item></nb-field-item>` - it has common layout and can show error info

## [Tokens](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Tokens "Tokens")
- feat: NB_CONTROL_COMMON_ERR_INFO_TOKEN - used to set common error info via DI, and the error information will be used in `<nb-control-err></nb-control-err>`

## [Interfaces](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Interfaces "Interfaces")
- feat: NbAbstractControl - abstract control type
- feat: INbFormConfigs - form control configs
- feat: INbControlConfig - control config
- feat: INbControlErrInfo - error information of the control

## [Enums](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.EN.md#Enums "Enums")
- feat: NbControlErrTypeEnum - common error enum
44 changes: 44 additions & 0 deletions projects/nb-form/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# v12.1.0
## [Validators](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Validators "Validators")
### [NbFormValidators.equal](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#nbformvalidatorsequal "NbFormValidators.equal")
- feat: 增加`immediately`参数,默认为`true`;

## [Services](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Services "Services")
### [NbFormService](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#nbformservice "NbFormService")
- feat: `updateEqualControlsValidities()`可以更便捷的更新两个期望相等的控件的有效性;

## [Components](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Components "Components")
### [`<nb-control-err></nb-control-err>`](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#nb-control-errnb-control-err "<nb-control-err></nb-control-err>")
- fix: 控件初始时为`dirty`,组件不显示错误信息;

# v12.0.0
## [Module](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Module "Module")
- feat: NbFormModule - 提供可用的`component`
- feat: NbFormTestingModule - 提供单元测试环境

## [Validators](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Validators "Validators")
- feat: NbFormValidators.arrLength - 数组长度校验器
- feat: NbFormValidators.equal - 控件值是否相等校验器
- feat: NbFormValidators.fileSize - 文件大小校验器
- feat: NbFormValidators.fileType - 文件类型校验器
- feat: NbFormValidators.required - 必填校验器
- feat: NbFormValidators.whitespace - 是否允许都为空格校验器

## [Services](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Services "Services")
- feat: NbFormService - 提供常用表单功能

## [Components](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Components "Components")
- feat: `<nb-control-err></nb-control-err>` - 显示控件错误信息
- feat: `<nb-field-item></nb-field-item>` - 提供常见的字段布局,以及控件错误信息,常用于表单中

## [Tokens](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Tokens "Tokens")
- feat: NB_CONTROL_COMMON_ERR_INFO_TOKEN - 通过DI设置常见的错误信息,便于在`<nb-control-err></nb-control-err>`中使用

## [Interfaces](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Interfaces "Interfaces")
- feat: NbAbstractControl - 抽象控件类型
- feat: INbFormConfigs - 表单的控件配置
- feat: INbControlConfig - 控件配置
- feat: INbControlErrInfo - 控件错误信息

## [Enums](https://github.com/bigBear713/nb-form/blob/master/projects/nb-form/README.md#Enums "Enums")
- feat: NbControlErrTypeEnum - 常用表单错误枚举
2 changes: 1 addition & 1 deletion projects/nb-form/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 nb-form project
Copyright (c) 2022 @bigbear713/nb-form project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit ecf0562

Please sign in to comment.