@js-smart/ng-kit 20.6.2-beta.1 → 20.6.3
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 +100 -80
- package/fesm2022/js-smart-ng-kit.mjs +2443 -0
- package/fesm2022/js-smart-ng-kit.mjs.map +1 -0
- package/index.d.ts +1100 -0
- package/package.json +13 -2
- package/eslint.config.js +0 -18
- package/karma.conf.js +0 -35
- package/ng-package.json +0 -11
- package/src/assets/app-buttons.css +0 -33
- package/src/assets/app-mat-snack-bar.css +0 -89
- package/src/assets/app-variables.css +0 -10
- package/src/assets/general.scss +0 -77
- package/src/assets/styles.scss +0 -5
- package/src/lib/components/alert/alert.component.html +0 -12
- package/src/lib/components/alert/alert.component.scss +0 -5
- package/src/lib/components/alert/alert.component.ts +0 -105
- package/src/lib/components/autocomplete/autocomplete.component.html +0 -42
- package/src/lib/components/autocomplete/autocomplete.component.ts +0 -207
- package/src/lib/components/buttons/base-button/base-button.component.html +0 -0
- package/src/lib/components/buttons/base-button/base-button.component.ts +0 -86
- package/src/lib/components/buttons/base-button/base-button.directive.ts +0 -87
- package/src/lib/components/buttons/bs-link-button/bs-link-button.component.ts +0 -37
- package/src/lib/components/buttons/bs-link-button/bs-link-button.directive.ts +0 -28
- package/src/lib/components/buttons/close-button/close-button.directive.ts +0 -12
- package/src/lib/components/buttons/delete-button/delete-button.component.ts +0 -42
- package/src/lib/components/buttons/delete-button/delete-button.directive.ts +0 -15
- package/src/lib/components/buttons/edit-bs-button/edit-bs-button.component.ts +0 -39
- package/src/lib/components/buttons/edit-bs-button/edit-bs-button.directive.ts +0 -37
- package/src/lib/components/buttons/edit-button/edit-button.component.ts +0 -37
- package/src/lib/components/buttons/edit-button/edit-button.directive.ts +0 -15
- package/src/lib/components/buttons/edit-svg-icon-button/edit-svg-icon-button.component.ts +0 -37
- package/src/lib/components/buttons/edit-svg-icon-button/edit-svg-icon-button.directive.ts +0 -39
- package/src/lib/components/buttons/excel-export-button/excel-export-button.component.ts +0 -23
- package/src/lib/components/buttons/excel-export-button/excel-export-button.directive.ts +0 -23
- package/src/lib/components/buttons/manage-button/manage-button.component.ts +0 -35
- package/src/lib/components/buttons/manage-button/manage-button.directive.ts +0 -15
- package/src/lib/components/buttons/pdf-export-button/pdf-export-button.component.ts +0 -20
- package/src/lib/components/buttons/pdf-export-button/pdf-export-button.directive.ts +0 -22
- package/src/lib/components/buttons/primary-button/primary-button.component.ts +0 -43
- package/src/lib/components/buttons/primary-button/primary-button.directive.ts +0 -16
- package/src/lib/components/buttons/save-primary-button/save-primary-button.component.ts +0 -43
- package/src/lib/components/buttons/save-primary-button/save-primary-button.directive.ts +0 -16
- package/src/lib/components/buttons/search-button/search-button.component.ts +0 -41
- package/src/lib/components/buttons/success-button/success-button.component.ts +0 -41
- package/src/lib/components/buttons/success-button/success-button.directive.ts +0 -15
- package/src/lib/components/buttons/view-button/view-button.component.ts +0 -32
- package/src/lib/components/buttons/view-button/view-button.directive.ts +0 -14
- package/src/lib/components/buttons/view-primary-button/view-primary-button.component.ts +0 -37
- package/src/lib/components/buttons/view-primary-button/view-primary-button.directive.ts +0 -15
- package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -56
- package/src/lib/components/ngx-spinner/ngx-spinner.component.css +0 -169
- package/src/lib/components/ngx-spinner/ngx-spinner.component.html +0 -24
- package/src/lib/components/ngx-spinner/ngx-spinner.component.spec.ts +0 -186
- package/src/lib/components/ngx-spinner/ngx-spinner.component.ts +0 -199
- package/src/lib/components/ngx-spinner/ngx-spinner.enum.ts +0 -45
- package/src/lib/components/ngx-spinner/ngx-spinner.service.ts +0 -66
- package/src/lib/components/ngx-spinner/safe-html.pipe.ts +0 -17
- package/src/lib/components/snack-bar/error-snack-bar/error-snack-bar.component.ts +0 -36
- package/src/lib/components/snack-bar/success-snack-bar/success-snack-bar.component.ts +0 -35
- package/src/lib/components/spinner/spinner.component.html +0 -11
- package/src/lib/components/spinner/spinner.component.scss +0 -18
- package/src/lib/components/spinner/spinner.component.ts +0 -31
- package/src/lib/directives/ngx-print/ngx-print.directive.ts +0 -281
- package/src/lib/directives/ngx-print/print-options.ts +0 -16
- package/src/lib/directives/prevent-multiple-clicks/prevent-multiple-clicks.directive.spec.ts +0 -99
- package/src/lib/directives/prevent-multiple-clicks/prevent-multiple-clicks.directive.ts +0 -36
- package/src/lib/services/mat-snack-bar.service.ts +0 -102
- package/src/lib/store/entity-store.spec.ts +0 -128
- package/src/lib/store/entity-store.ts +0 -88
- package/src/lib/store/store.spec.ts +0 -47
- package/src/lib/store/store.ts +0 -44
- package/src/lib/svg-icons/edit-solid-svg/edit-solid-svg.component.ts +0 -20
- package/src/lib/types/id-type.ts +0 -3
- package/src/lib/types/progress-state.ts +0 -7
- package/src/lib/util/progress-util.ts +0 -84
- package/src/public-api.ts +0 -64
- package/test.ts +0 -11
- package/tsconfig.lib.json +0 -12
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -10
package/README.md
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Angular components and utilities
|
|
2
2
|
|
|
3
3
|
Reusable Angular components built with Angular Material and Bootstrap 5.x, Utility classes/functions for Date, Form and String operations
|
|
4
4
|
|
|
5
|
-
<p align="center">
|
|
6
5
|
[](https://github.com/js-smart/ng-kit/actions/workflows/build.yml)
|
|
7
6
|
<a href="https://www.npmjs.com/@js-smart/ng-kit">
|
|
8
|
-
<img src="https://img.shields.io/npm/v/@js-smart/ng-kit" alt="
|
|
7
|
+
<img src="https://img.shields.io/npm/v/@js-smart/ng-kit" alt="Ng Kit on npm" />
|
|
9
8
|
</a>
|
|
10
|
-
</p>
|
|
11
9
|
|
|
12
|
-
### Installation
|
|
13
10
|
|
|
11
|
+
### Installation
|
|
14
12
|
Install the library
|
|
15
13
|
|
|
16
14
|
```shell
|
|
@@ -20,60 +18,59 @@ npm install @js-smart/ng-kit
|
|
|
20
18
|
and use it as shown below in each section
|
|
21
19
|
|
|
22
20
|
### Technologies
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
2. Bootstrap 5+ (if applicable)
|
|
21
|
+
1. Angular
|
|
22
|
+
2. Bootstrap
|
|
26
23
|
|
|
27
24
|
## Auto Complete
|
|
28
|
-
|
|
29
25
|
Reusable Auto Complete that extends Mat Auto Complete component
|
|
30
26
|
|
|
31
27
|
### Demo
|
|
32
|
-
|
|
33
|
-
https://main--js-smart-ng-kit.netlify.app/autocomplete-demo
|
|
28
|
+
https://ng-kit.netlify.app/autocomplete-demo
|
|
34
29
|
|
|
35
30
|
### Usage
|
|
36
|
-
|
|
37
31
|
The library has one `autocomplete` component. To use the Auto Complete component, add the following code to the HTML page
|
|
38
32
|
|
|
39
33
|
**app.component.html**
|
|
40
|
-
|
|
41
34
|
```typescript
|
|
42
35
|
<!-- Auto Complete with Objects -->
|
|
43
36
|
|
|
44
|
-
<form [formGroup]="genericFormGroup">
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
<form [formGroup] = "genericFormGroup" >
|
|
38
|
+
<autocomplete
|
|
39
|
+
[data] = "cities"
|
|
40
|
+
[inputFormGroup] = "genericFormGroup"
|
|
41
|
+
[required] = "true"
|
|
42
|
+
[displayWith] = "displayFn"
|
|
43
|
+
bindLabel = "location"
|
|
44
|
+
bindValue = "id"
|
|
45
|
+
label = "City"
|
|
46
|
+
placeHolder = "Select City" >
|
|
47
|
+
</autocomplete>
|
|
48
|
+
< /form>
|
|
56
49
|
|
|
57
50
|
```
|
|
58
51
|
|
|
59
52
|
**app.component.ts**
|
|
60
|
-
|
|
61
53
|
Then define form group instances and object array (cities) and names (for string array)
|
|
62
54
|
|
|
63
55
|
```typescript
|
|
64
|
-
// Define objects
|
|
65
|
-
cities = [{id: 1001, location: 'New York'}, {id: 1002, location: 'Boston'}, {id: 1001, location: 'Washington DC'}];
|
|
56
|
+
// Define objects
|
|
57
|
+
cities = [{ id: 1001, location: 'New York' }, { id: 1002, location: 'Boston' }, { id: 1001, location: 'Washington DC' }];
|
|
66
58
|
|
|
67
|
-
// Define Form Groups
|
|
59
|
+
// Define Form Groups
|
|
68
60
|
inputFormGroup = this.fb.group({
|
|
69
61
|
autocomplete: ['']
|
|
70
62
|
})
|
|
71
63
|
|
|
72
64
|
//Display function
|
|
73
|
-
displayFn(object
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
displayFn(object
|
|
66
|
+
:
|
|
67
|
+
any
|
|
68
|
+
):
|
|
69
|
+
string
|
|
70
|
+
{
|
|
71
|
+
if (typeof object === "string") return object;
|
|
72
|
+
return object && object["location"] ? object["location"] : "";
|
|
73
|
+
}
|
|
77
74
|
```
|
|
78
75
|
|
|
79
76
|
If you are using strings rather than objects, do not provide `bindLabel`, `bindValue` and `displayWith` inputs. See below sample
|
|
@@ -92,12 +89,10 @@ If you are using strings rather than objects, do not provide `bindLabel`, `bindV
|
|
|
92
89
|
```
|
|
93
90
|
|
|
94
91
|
### Auto Complete API
|
|
95
|
-
|
|
96
92
|
#### List of selectors that can be used to select the component(s)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| autocomplete, lib-autocomplete |
|
|
93
|
+
| AutoComplete Selector |
|
|
94
|
+
|--------------------------------|
|
|
95
|
+
| autocomplete, lib-autocomplete |
|
|
101
96
|
|
|
102
97
|
#### Properties
|
|
103
98
|
|
|
@@ -115,16 +110,14 @@ If you are using strings rather than objects, do not provide `bindLabel`, `bindV
|
|
|
115
110
|
| data | List of Objects or String values that need to be bind and searched for | any[] or string[] | false |
|
|
116
111
|
|
|
117
112
|
## Alert
|
|
118
|
-
|
|
119
113
|
Reusable alert component created with Bootstrap 5+ and Angular 17+
|
|
120
114
|
|
|
121
115
|
### Auto Complete API
|
|
122
|
-
|
|
123
116
|
#### List of selectors that can be used to select the component
|
|
124
117
|
|
|
125
|
-
| Selector |
|
|
126
|
-
|-----------------|
|
|
127
|
-
| alert,lib-alert |
|
|
118
|
+
| Selector |
|
|
119
|
+
|-----------------|
|
|
120
|
+
| alert,lib-alert |
|
|
128
121
|
|
|
129
122
|
#### Properties
|
|
130
123
|
|
|
@@ -137,23 +130,19 @@ Reusable alert component created with Bootstrap 5+ and Angular 17+
|
|
|
137
130
|
| type | Alert type. Provides one of four bootstrap supported contextual classes: success, info, warning and danger | string | info |
|
|
138
131
|
|
|
139
132
|
## Spinner
|
|
140
|
-
|
|
141
133
|
Reusable Spinner component created with Bootstrap 5.x and Angular 17.x
|
|
142
134
|
|
|
143
135
|
### Demo
|
|
144
|
-
|
|
145
136
|
https://main--js-smart-ng-kit.netlify.app/alert-demo
|
|
146
137
|
|
|
147
138
|
### API
|
|
148
|
-
|
|
149
139
|
#### List of selectors that can be used to select the component
|
|
150
140
|
|
|
151
|
-
| Selector |
|
|
152
|
-
|---------------------|
|
|
153
|
-
| spinner,lib-spinner |
|
|
141
|
+
| Selector |
|
|
142
|
+
|---------------------|
|
|
143
|
+
| spinner,lib-spinner |
|
|
154
144
|
|
|
155
145
|
#### Properties
|
|
156
|
-
|
|
157
146
|
| Property | Description | Type | Default Value |
|
|
158
147
|
|------------------|----------------------------------------------|--------------------------|---------------|
|
|
159
148
|
| bootstrapSpinner | Use Boostrap Spinner. Default `true` | boolean | false |
|
|
@@ -162,19 +151,17 @@ https://main--js-smart-ng-kit.netlify.app/alert-demo
|
|
|
162
151
|
| strokeWidth | Stroke Width of the Angular Material spinner | boolean | false |
|
|
163
152
|
|
|
164
153
|
## Print
|
|
165
|
-
|
|
166
154
|
Angular (2++) directive that prints HTML section
|
|
167
155
|
|
|
168
156
|
### Usage
|
|
169
|
-
|
|
170
157
|
Import the main module `NgxPrintModule` :
|
|
171
158
|
|
|
172
|
-
```js
|
|
173
|
-
import {NgxPrintModule} from '@js-smart/print';
|
|
159
|
+
```js
|
|
160
|
+
import { NgxPrintModule } from '@js-smart/print';
|
|
174
161
|
|
|
175
162
|
@NgModule({
|
|
176
|
-
...
|
|
177
|
-
|
|
163
|
+
...
|
|
164
|
+
imports:
|
|
178
165
|
[NgxPrintModule, ...],
|
|
179
166
|
...
|
|
180
167
|
})
|
|
@@ -188,22 +175,23 @@ export class YourAppModule {
|
|
|
188
175
|
- Assuming you want to print the following HTML section:
|
|
189
176
|
|
|
190
177
|
```html
|
|
178
|
+
|
|
191
179
|
<div>
|
|
192
|
-
|
|
180
|
+
<!--Your html stuff that you want to print-->
|
|
193
181
|
</div>
|
|
194
|
-
<button>print</button>
|
|
195
|
-
|
|
182
|
+
<button>print</button> <!--Your relevant print button-->
|
|
183
|
+
|
|
196
184
|
```
|
|
197
185
|
|
|
198
|
-
- Now, what you have to do is tagging your
|
|
186
|
+
- Now, what you have to do is tagging your *wanted-to-print* section by an `id` attribute, then link that `id` to a
|
|
199
187
|
directive parameter in your button :
|
|
200
188
|
|
|
201
189
|
```html
|
|
202
|
-
<!--
|
|
190
|
+
<!--
|
|
203
191
|
1)- Add an ID here
|
|
204
192
|
-->
|
|
205
193
|
<div id="print-section">
|
|
206
|
-
|
|
194
|
+
<!--Your html stuff that you want to print-->
|
|
207
195
|
</div>
|
|
208
196
|
|
|
209
197
|
<!--
|
|
@@ -211,6 +199,7 @@ export class YourAppModule {
|
|
|
211
199
|
3)- Affect your ID to printSectionId
|
|
212
200
|
-->
|
|
213
201
|
<button printSectionId="print-section" ngxPrint>print</button>
|
|
202
|
+
|
|
214
203
|
```
|
|
215
204
|
|
|
216
205
|
### Optional properties
|
|
@@ -219,22 +208,38 @@ export class YourAppModule {
|
|
|
219
208
|
button `printTitle`:
|
|
220
209
|
|
|
221
210
|
```html
|
|
211
|
+
|
|
222
212
|
<div id="print-section">
|
|
223
|
-
|
|
213
|
+
|
|
214
|
+
<!-- ... -->
|
|
215
|
+
|
|
224
216
|
</div>
|
|
225
217
|
|
|
226
|
-
<button
|
|
218
|
+
<button
|
|
219
|
+
printTitle="MyTitle"
|
|
220
|
+
printSectionId="print-section"
|
|
221
|
+
ngxPrint>print
|
|
222
|
+
</button>
|
|
223
|
+
|
|
227
224
|
```
|
|
228
225
|
|
|
229
226
|
- Also, would you like to customize the printing window style sheet (CSS) ? Hence you can do so by adding infinite
|
|
230
227
|
styles to another attribute called `printStyle`:
|
|
231
228
|
|
|
232
229
|
```html
|
|
230
|
+
|
|
233
231
|
<div id="print-section">
|
|
234
|
-
|
|
232
|
+
|
|
233
|
+
<!-- ... -->
|
|
234
|
+
|
|
235
235
|
</div>
|
|
236
236
|
|
|
237
|
-
<button
|
|
237
|
+
<button
|
|
238
|
+
[printStyle]="{h1 : {'color': 'red'}, h2 : {'border': 'solid 1px'}}"
|
|
239
|
+
printSectionId="print-section"
|
|
240
|
+
ngxPrint>print
|
|
241
|
+
</button>
|
|
242
|
+
|
|
238
243
|
```
|
|
239
244
|
|
|
240
245
|
Here some simple styles were added to every `h1` & `h2` tags within the `div` where `print-section` is tagged to
|
|
@@ -243,36 +248,51 @@ its `id` attribute.
|
|
|
243
248
|
- If you would like to use your existing CSS with media print you can add the `useExistingCss` attribute:
|
|
244
249
|
|
|
245
250
|
```html
|
|
251
|
+
|
|
246
252
|
<div id="print-section">
|
|
247
|
-
|
|
253
|
+
|
|
254
|
+
<!-- ... -->
|
|
255
|
+
|
|
248
256
|
</div>
|
|
249
257
|
|
|
250
|
-
<button
|
|
258
|
+
<button
|
|
259
|
+
[useExistingCss]="true"
|
|
260
|
+
printSectionId="print-section"
|
|
261
|
+
ngxPrint>print
|
|
262
|
+
</button>
|
|
263
|
+
|
|
251
264
|
```
|
|
252
265
|
|
|
253
266
|
- If you want to customize the printing window style sheet (CSS) by importing the css provided in assets/css
|
|
254
267
|
use `styleSheetFile`:
|
|
255
268
|
|
|
256
269
|
```html
|
|
270
|
+
|
|
257
271
|
<div id="print-section">
|
|
258
|
-
|
|
272
|
+
|
|
273
|
+
<!-- ... -->
|
|
274
|
+
|
|
259
275
|
</div>
|
|
260
276
|
|
|
261
|
-
<button
|
|
277
|
+
<button
|
|
278
|
+
styleSheetFile="assets/css/custom1.css,assets/css/custom2.css"
|
|
279
|
+
printSectionId="print-section"
|
|
280
|
+
ngxPrint>print
|
|
281
|
+
</button>
|
|
282
|
+
|
|
262
283
|
```
|
|
263
284
|
|
|
264
285
|
### Publish library to NPM
|
|
265
|
-
|
|
266
286
|
1. Build the library
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
287
|
+
```shell
|
|
288
|
+
pnpm build ng-kit
|
|
289
|
+
```
|
|
270
290
|
2. If the NPM token is not configured, open `~/.npmrc` and add the following line:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
291
|
+
```shell
|
|
292
|
+
//registry.npmjs.org/:_authToken=<your npm token>
|
|
293
|
+
```
|
|
274
294
|
3. Then navigate to `dist` directory anf publish the library to NPM. If prompted, enter the 2fa auth code from the Authenticator app.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
295
|
+
```shell
|
|
296
|
+
cd dist/libs/ng-kit && npm publish --tag latest
|
|
297
|
+
```
|
|
278
298
|
For beta releases use tag `--tag beta`
|