@ssv/ngx.command 3.0.0-dev.19 → 3.0.0-dev.20
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/README.md +14 -92
- package/package.json +1 -1
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
[projectUri]: https://github.com/sketch7/ngx.command
|
|
2
|
-
[changeLog]: ./CHANGELOG.md
|
|
3
|
-
[releaseWorkflowWiki]: ./docs/RELEASE-WORKFLOW.md
|
|
4
|
-
|
|
5
2
|
[npm]: https://www.npmjs.com
|
|
6
3
|
[commandpatternwiki]: https://en.wikipedia.org/wiki/Command_pattern
|
|
7
4
|
|
|
@@ -13,10 +10,6 @@
|
|
|
13
10
|
|
|
14
11
|
Primary usage is to disable a button when an action is executing, or not in a valid state (e.g. busy, invalid), and also to show an activity progress while executing.
|
|
15
12
|
|
|
16
|
-
**Quick links**
|
|
17
|
-
|
|
18
|
-
[Change logs][changeLog] | [Project Repository][projectUri]
|
|
19
|
-
|
|
20
13
|
## Installation
|
|
21
14
|
|
|
22
15
|
Get library via [npm]
|
|
@@ -29,31 +22,18 @@ Choose the version corresponding to your Angular version:
|
|
|
29
22
|
|
|
30
23
|
| Angular | library |
|
|
31
24
|
| ------- | ------- |
|
|
25
|
+
| 17+ | 3.x+ |
|
|
32
26
|
| 10+ | 2.x+ |
|
|
33
27
|
| 4 to 9 | 1.x+ |
|
|
34
28
|
|
|
35
29
|
|
|
36
30
|
# Usage
|
|
37
31
|
|
|
38
|
-
## Register module
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
import { SsvCommandModule } from "@ssv/ngx.command";
|
|
42
|
-
|
|
43
|
-
@NgModule({
|
|
44
|
-
imports: [
|
|
45
|
-
SsvCommandModule
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
export class AppModule {
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
32
|
## Command
|
|
53
33
|
In order to start working with Command, you need to create a new instance of it.
|
|
54
34
|
|
|
55
35
|
```ts
|
|
56
|
-
import {
|
|
36
|
+
import { Command, CommandAsync, ICommand } from "@ssv/ngx.command";
|
|
57
37
|
|
|
58
38
|
isValid$ = new BehaviorSubject(false);
|
|
59
39
|
|
|
@@ -159,85 +139,27 @@ This will make canExecute respond to `form.valid` and for `form.dirty` - also ca
|
|
|
159
139
|
```ts
|
|
160
140
|
import { CommandAsync, canExecuteFromNgForm } from "@ssv/ngx.command";
|
|
161
141
|
|
|
162
|
-
loginCmd = new CommandAsync(this.login
|
|
142
|
+
loginCmd = new CommandAsync(x => this.login(), canExecuteFromNgForm(this.form));
|
|
163
143
|
|
|
164
144
|
// options - disable dirty check
|
|
165
|
-
loginCmd = new CommandAsync(this.login
|
|
145
|
+
loginCmd = new CommandAsync(x => this.login(), canExecuteFromNgForm(this.form, {
|
|
166
146
|
dirty: false
|
|
167
147
|
}));
|
|
168
148
|
|
|
169
149
|
```
|
|
170
150
|
|
|
171
151
|
|
|
172
|
-
##
|
|
173
|
-
In order to configure globally, you can do so as following:
|
|
152
|
+
## Global options
|
|
174
153
|
|
|
175
154
|
```ts
|
|
176
|
-
import {
|
|
177
|
-
|
|
178
|
-
imports: [
|
|
179
|
-
SsvCommandModule.forRoot({ executingCssClass: "is-busy" })
|
|
180
|
-
],
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
## Getting Started
|
|
185
|
-
|
|
186
|
-
### Setup Machine for Development
|
|
187
|
-
Install/setup the following:
|
|
188
|
-
|
|
189
|
-
- NodeJS v18.16.0+
|
|
190
|
-
- Visual Studio Code or similar code editor
|
|
191
|
-
- TypeScript 5.0+
|
|
192
|
-
- Git + SourceTree, SmartGit or similar (optional)
|
|
193
|
-
- Ensure to install **global NPM modules** using the following:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
npm install -g git gulp devtool
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
### Project Setup
|
|
202
|
-
The following process need to be executed in order to get started.
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
npm install
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
### Building the code
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
npm run build
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Running the tests
|
|
155
|
+
import { provideSsvCommandOptions } from "@ssv/ngx.command";
|
|
216
156
|
|
|
217
|
-
|
|
218
|
-
|
|
157
|
+
export const appConfig: ApplicationConfig = {
|
|
158
|
+
providers: [
|
|
159
|
+
provideSsvCommandOptions({
|
|
160
|
+
executingCssClass: "is-busy",
|
|
161
|
+
hasDisabledDelay: false
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
164
|
+
};
|
|
219
165
|
```
|
|
220
|
-
|
|
221
|
-
#### Watch
|
|
222
|
-
Handles compiling of changes.
|
|
223
|
-
|
|
224
|
-
```bash
|
|
225
|
-
npm start
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
#### Running Continuous Tests
|
|
230
|
-
Spawns test runner and keep watching for changes.
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
npm run tdd
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
### Preparation for Release
|
|
238
|
-
|
|
239
|
-
- Update changelogs
|
|
240
|
-
- bump version
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Check out the [release workflow guide][releaseWorkflowWiki] in order to guide you creating a release and publishing it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssv/ngx.command",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.20",
|
|
4
4
|
"versionSuffix": "",
|
|
5
5
|
"description": "Command pattern implementation for angular. Command used to encapsulate information which is needed to perform an action.",
|
|
6
6
|
"keywords": [
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.0-dev.
|
|
1
|
+
export const VERSION = "3.0.0-dev.20";
|