wacom 13.0.1 → 13.0.2

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.
Files changed (44) hide show
  1. package/README.md +496 -496
  2. package/esm2020/lib/components/alert/alert.component.mjs +3 -3
  3. package/esm2020/lib/components/alert/wrapper/wrapper.component.mjs +3 -3
  4. package/esm2020/lib/components/files/files.component.mjs +3 -3
  5. package/esm2020/lib/components/loader/loader.component.mjs +3 -3
  6. package/esm2020/lib/components/modal/modal.component.mjs +3 -3
  7. package/esm2020/lib/directives/click-outside.directive.mjs +1 -1
  8. package/esm2020/lib/guard/meta.guard.mjs +1 -1
  9. package/esm2020/lib/interfaces/alert.interface.mjs +1 -1
  10. package/esm2020/lib/interfaces/config.mjs +1 -1
  11. package/esm2020/lib/interfaces/modal.interface.mjs +1 -1
  12. package/esm2020/lib/pipes/arr.pipe.mjs +1 -1
  13. package/esm2020/lib/pipes/mongodate.pipe.mjs +1 -1
  14. package/esm2020/lib/pipes/pagination.pipe.mjs +1 -1
  15. package/esm2020/lib/pipes/safe.pipe.mjs +1 -1
  16. package/esm2020/lib/pipes/search.pipe.mjs +1 -1
  17. package/esm2020/lib/pipes/splice.pipe.mjs +1 -1
  18. package/esm2020/lib/services/alert.service.mjs +1 -1
  19. package/esm2020/lib/services/base.service.mjs +1 -1
  20. package/esm2020/lib/services/core.service.mjs +3 -1
  21. package/esm2020/lib/services/crud.service.mjs +1 -1
  22. package/esm2020/lib/services/dom.service.mjs +1 -1
  23. package/esm2020/lib/services/file.service.mjs +1 -1
  24. package/esm2020/lib/services/hash.service.mjs +1 -1
  25. package/esm2020/lib/services/http.service.mjs +1 -1
  26. package/esm2020/lib/services/loader.service.mjs +1 -1
  27. package/esm2020/lib/services/meta.service.mjs +4 -4
  28. package/esm2020/lib/services/modal.service.mjs +1 -1
  29. package/esm2020/lib/services/mongo.service.mjs +13 -1
  30. package/esm2020/lib/services/render.service.mjs +1 -1
  31. package/esm2020/lib/services/socket.service.mjs +1 -1
  32. package/esm2020/lib/services/store.service.mjs +1 -1
  33. package/esm2020/lib/services/time.service.mjs +1 -1
  34. package/esm2020/lib/services/ui.service.mjs +1 -1
  35. package/esm2020/lib/wacom.module.mjs +1 -1
  36. package/esm2020/public-api.mjs +1 -1
  37. package/fesm2015/wacom.mjs +27 -13
  38. package/fesm2015/wacom.mjs.map +1 -1
  39. package/fesm2020/wacom.mjs +27 -13
  40. package/fesm2020/wacom.mjs.map +1 -1
  41. package/lib/services/core.service.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/src/lib/components/alert/README.md +34 -34
  44. package/src/lib/components/loader/README.md +34 -34
package/README.md CHANGED
@@ -1,496 +1,496 @@
1
- # Angular (ngx) common
2
- Module which has common services and components which can be used on all projects.
3
-
4
- ## Getting Started
5
-
6
- ### License
7
- [MIT](LICENSE)
8
-
9
- ### Instalation
10
- ```bash
11
- $ npm i --save wacom
12
- ```
13
-
14
- ### Services
15
- | Name | Description |
16
- | ------- |:-----:|
17
- | [**`Core`**](https://www.npmjs.com/package/wacom#core-service) | Common supportive function which can be used in any service |
18
- | [**`Http`**](https://www.npmjs.com/package/wacom#http-service) | Http layer for HttpClient |
19
- | [**`Store`**](https://www.npmjs.com/package/wacom#store-service) | Service will is responsible for keeping information on the device |
20
- | [**`Hash`**](https://www.npmjs.com/package/wacom#hash-service) | Hash management for easily use, storage which stay in url |
21
- | [**`Render`**](https://www.npmjs.com/package/wacom#render-service) | Make not automated render management well structured |
22
- | [**`Meta`**](https://www.npmjs.com/package/wacom#meta-service) | Website meta tags management within router |
23
- | [**`Alert`**](https://www.npmjs.com/package/wacom#alert-service) | Alerts management |
24
- | [**`Modal`**](https://www.npmjs.com/package/wacom#modal-service) | Modals management |
25
- | [**`Loader`**](https://www.npmjs.com/package/wacom#loader-service) | Loaders management |
26
- | [**`UI`**](https://www.npmjs.com/package/wacom#ui-service) | Supportive UI/UX service |
27
-
28
- ### Components
29
- | Name | Description |
30
- | ------- |:-----:|
31
- | [**`Picker`**](https://www.npmjs.com/package/wacom#picker-component) | Huge common component which is used to take information from user |
32
-
33
- ## Core Service
34
- ### device
35
- ### version
36
- ### set_version
37
- ### host
38
- ### parallel
39
- ### serial
40
- ### each
41
- ### afterWhile
42
- ### emit
43
- ### on
44
- ### done
45
- ### ready
46
- ### next
47
- ## Mongo Service
48
- Mongo Service is an suportive service for combining angular 6 client with waw CRUD back-end. Which means that you have to use [waw Framework](https://www.npmjs.com/package/waw) or you have to made your back-end routes in a way of waw crud. Example of importing mongo service:
49
- ```javascript
50
- import { MongoService } from 'wacom';
51
- constructor(private mongo: MongoService){};
52
- ```
53
- ### create `function`
54
- connecting with waw CRUD create. As parameters accepting name of mongo collection, object with values for document and optionally callback function which will return the document. Document will be filled inside read callbacks. Example:
55
- ```javascript
56
- mongo.create('colName', {
57
- name: 'docName'
58
- }, created => {
59
- console.log('document has been created');
60
- });
61
- ```
62
- ### read `function`
63
- connecting with waw CRUD read. As parameters accepting name of mongo collection, optionally options, optionally callback which will return all documents in array as first parameter and in object with doc._id placeholder for doc as second parameter. Function returning directing array which will host the documents. Example:
64
- ```javascript
65
- mongo.get('colName',{
66
- replace: {
67
- name: function(val, cb, doc){
68
- cb(val+'_modified')
69
- }
70
- },
71
- name: 'me',
72
- next: {
73
- name: 'friends',
74
- next: {
75
- name: 'near',
76
- next: {
77
- name: 'city',
78
- next: {
79
- name: 'country'
80
- }
81
- }
82
- }
83
- },
84
- populate: [{
85
- field: 'author',
86
- part: 'user'
87
- }],
88
- groups: 'city name' || ['city', 'name'] || {
89
- first_name: {
90
- field: function(doc, cb){
91
- if(doc.name.split(' ').length>1) cb(doc.name.split(' ')[1]);
92
- retun doc.name.split(' ')[0];
93
- },
94
- allow: function(doc){
95
- return !!doc.name;
96
- },
97
- ignore: function(){
98
- return false;
99
- },
100
- sort: function(){
101
-
102
- }
103
- }
104
- },
105
- query: {
106
- male: function(doc){
107
- return doc.gender;
108
- },
109
- female: {
110
- allow: function(doc){
111
- return !doc.gender;
112
- },
113
- ignore: function(){
114
- return typeof doc.gender != 'boolean';
115
- },
116
- sort: function(a, b){
117
- if(a.order > b.order) return -1;
118
- return 1;
119
- }
120
- }
121
- }
122
- }, (arr, obj, name, resp) => {
123
- /*
124
- * arr will be array with total docs from that part
125
- * obj will be object with total docs from that part binded by _id
126
- * groups will be saved into obj in the way: obj.name['Denys'] or obj.city['Kiev']
127
- * name is the name of current pull from server
128
- * resp is the array of responsinse with documents queried
129
- */
130
- })
131
- ```
132
- #### replace `options`
133
- work as filler of each doc for cases when we can calculate things to use in website. Good example can be currencies which change each moment, we have product in one currency and we want to show it in different currrencies. Other good example can be date fields, which is saved as string and we need them in `new Date()` format.
134
- #### populate `options`
135
- works in the same way as populate of mongodb but in the client side. This works great when you need documents inside other documents and put on them sorting or other things.
136
- #### groups `options`
137
- makings arrays which show different documents inside specific placeholders. As example we can have list of users in specific town or country, so we don't have to create pipes for that.
138
- #### next `options`
139
- works as level of pulling different documents from the server. This is mostly made for performance, so user can have the info he needs directly.
140
- ### updateAll `function`
141
- connecting with waw CRUD updateAll. As parameters accepting name of mongo collection, document object, optionally options and optionally callback function which will return the document. Example:
142
- ```javascript
143
- mongo.updateAll('colName', {
144
- name: doc.name,
145
- _id: doc._id
146
- }, {
147
- fields: 'name'
148
- }, () => {
149
- console.log('document is updated');
150
- });
151
- ```
152
- ### updateUnique `function`
153
- connecting with waw CRUD updateUnique. As parameters accepting name of mongo collection, object with document _id and field value, optionally options and optionally callback function which will return if field has been updated. Example:
154
- ```javascript
155
- mongo.updateUnique('colName', {
156
- name: doc.name,
157
- _id: doc._id
158
- }, {
159
- name: 'name'
160
- }, (resp) => {
161
- if(resp){
162
- console.log('field is updated');
163
- }else {
164
- console.log('field is not updated');
165
- }
166
- });
167
- ```
168
- ### delete `function`
169
- connecting with waw CRUD delete. As parameters accepting name of mongo collection, document object, optionally options and optionally callback function which will return the document. Example:
170
- ```javascript
171
- mongo.delate('colName',{
172
- _id: doc._id
173
- }, {
174
- name: 'admin'
175
- }, () => {
176
- console.log('document is deleted');
177
- });
178
- ```
179
- ### _id `function`
180
- provide new mongo _id. As parameters accepting callback function which will return the _id. Example:
181
- ```javascript
182
- mongo._id( _id => {
183
- console.log(_id);
184
- });
185
- ```
186
- ### to_id `function`
187
- convert array of documents, object with documents, mixed documents or _id and converting it to array of _id. Example:
188
- ```javascript
189
- mongo.to_id([{
190
- _id: '1'
191
- }, '2']);
192
- // ['1', '2']
193
- mongo.to_id({
194
- '1': true
195
- '2': false
196
- });
197
- // ['1']
198
- ```
199
- ### afterWhile `function`
200
- provide delay on any action, usefull with input and model change. As parameters accepting document, callback and optionally time. Example:
201
- ```javascript
202
- mongo.afterWhile(doc, () => {
203
- console.log('change can be applied');
204
- }, 2000);
205
- ```
206
- ### populate `function`
207
- making population on specific field with specific collection. Example with doc which will have field as document of part provided:
208
- ```javascript
209
- mongo.populate(doc, 'field', 'colName');
210
- ```
211
- ### on `function`
212
- accepting array or string of parts and callback which will be called when all parts will be loaded.
213
- Example:
214
- ```javascript
215
- mongo.on('user post', () => {
216
- console.log('user and post part has been loaded');
217
- });
218
- ```
219
- ## Sort
220
- Set of functions, which are accepted by th function ```array.sort()``` as a parameter. Each of these functions is for sorting documents(objects).
221
- ### sortAscId `function`
222
- accepting array of objects and return it sorted in ascending order by _id
223
- Example:
224
- ```javascript
225
- array.sort(mongo.sortAscId());
226
- ```
227
- ### sortDescId `function`
228
- accepting array of objects and return it sorted in descending order by _id
229
- Example:
230
- ```javascript
231
- mongo.sortDescId();
232
- ```
233
- ### sortAscString `function`
234
- accepting array of object and return it sorted in ascending order by alphabet
235
- Example:
236
- ```javascript
237
- mongo.sortAscString();
238
- ```
239
- ### sortDescString `function`
240
- accepting array of object and return it sorted in descending order by alphabet
241
- Example:
242
- ```javascript
243
- mongo.sortDescString();
244
- ```
245
- ### sortAscDate `function`
246
- accepting array of object and return it sorted in ascending order by date
247
- Example:
248
- ```javascript
249
- mongo.sortAscDate();
250
- ```
251
- ### sortDescDate `function`
252
- accepting array of object and return it sorted in descending order by date
253
- Example:
254
- ```javascript
255
- mongo.sortDescDate();
256
- ```
257
- ### sortAscNumber `function`
258
- accepting array of object and return it sorted in ascending order by number
259
- Example:
260
- ```javascript
261
- mongo.sortAscNumber();
262
- ```
263
- ### sortDescNumber `function`
264
- accepting array of object and return it sorted in descending order by number
265
- Example:
266
- ```javascript
267
- mongo.sortDescNumber();
268
- ```
269
- ### sortAscBoolean `function`
270
- accepting array of object and return it sorted: first - true, second - false
271
- Example:
272
- ```javascript
273
- mongo.sortAscBoolean();
274
- ```
275
- ### sortDescBoolean `function`
276
- accepting array of object and return it sorted: first - false, second - true
277
- Example:
278
- ```javascript
279
- mongo.sortDescBoolean();
280
- ```
281
- ### beArr `function`
282
- checking value if it's array then we keep it and in other case, we replace it with new array. Example where each doc will have data as array:
283
- ```javascript
284
- mongo.get('colName', {
285
- replace: {
286
- data:mongo.beArr
287
- }
288
- });
289
- ```
290
- ### beObj `function`
291
- checking value if it's object then we keep it and in other case, we replace it with new object. Example where each doc will have data as array:
292
- ```javascript
293
- mongo.get('colName', {
294
- replace: {
295
- data:mongo.beObj
296
- }
297
- });
298
- ```
299
- ### beDate `function`
300
- making value new Date(valueContent). Example where each doc will have date as date:
301
- ```javascript
302
- mongo.get('colName', {
303
- replace: {
304
- date:mongo.beDate
305
- }
306
- });
307
- ```
308
- ### forceArr `function`
309
- convert any value to array within replace options. Example where each doc will have data as empty array:
310
- ```javascript
311
- mongo.get('colName', {
312
- replace: {
313
- data:mongo.forceArr
314
- }
315
- });
316
- ```
317
- ### forceObj `function`
318
- convert any value to object within replace options. Example where each doc will have data as empty object:
319
- ```javascript
320
- mongo.get('colName', {
321
- replace: {
322
- data:mongo.forceObj
323
- }
324
- });
325
- ```
326
- ## Alert Service
327
- Alert Service is an suportive service for alerts manamanagement. Example of importing alert service:
328
- ```javascript
329
- import { AlertService } from 'wacom';
330
- constructor(private alert: AlertService){};
331
- ```
332
- ### show `function`
333
- Opens the alert and return htmlElement of this alert.
334
- Example 1:
335
- ```javascript
336
- let my_alert = alert.show({
337
- text: 'Are you sure?',
338
- type: 'question',
339
- timeout: 5000,
340
- class: 'myClass',
341
- position: 'bottomRight',
342
- buttons: [{
343
- text: 'YES',
344
- callback: ()=>{
345
- console.log("YES!");
346
- }
347
- },{
348
- text: 'NO',
349
- callback: ()=>{
350
- console.log("NO!");
351
- }
352
- }]
353
- });
354
- ```
355
- Example 2:
356
- ```javascript
357
- let my_alert = alert.show({
358
- component: MyCustomComponent,
359
- timeout: 5000,
360
- class: 'myClass',
361
- position: 'center',
362
- closable: true
363
- });
364
- ```
365
- ### options
366
- | Name | Type | Description |
367
- | --------------- |--------- | --------------- |
368
- | `text` | string | Text of alert. |
369
- | `type` | string | Type of alert(etc `info`, `success`, `warning`, `error`, `question`). |
370
- | `class` | string | Custom class for your alert. |
371
- | `unique` | string | Identificator for your alerts. |
372
- | `progress` | boolean | Enable timeout progress bar. |
373
- | `position` | string | Position of the alert(`topLeft`, `topCenter`, `topRight`, `right`, `bottomRight`, `bottomCenter`, `bottomLeft`, `left`, `center`). |
374
- | `timeout` | number | Amount in milliseconds to close the alert, 0 to disable. |
375
- | `closable` | boolean | Show "x" close button. |
376
- | `buttons` | number | Array of buttons for your alerts. |
377
- | `component` | string or @Component | Component which will be appended into the alert. |
378
- | `close` | function | custom function for close alert. |
379
- | `onClose` | function | Capture when the alert is closing. |
380
- ### destroy `function`
381
- Close all alerts. Example:
382
- ```javascript
383
- alert.destroy();
384
- ```
385
- ## Modal Service
386
- Modal Service is an suportive service for modals manamanagement. Example of importing modal service:
387
- ```javascript
388
- import { ModalService } from 'wacom';
389
- constructor(private modal: ModalService){};
390
- ```
391
- ### show `function`
392
- Opens the modal and return htmlElement of this modal. Example:
393
- ```javascript
394
- let my_modal = modal.show({
395
- component: MyCustomComponent,
396
- size: 'mid',
397
- timeout: 5000,
398
- class: 'myClass',
399
- position: 'center',
400
- closable: true
401
- });
402
- ```
403
- ### options
404
- | Name | Type | Description |
405
- | --------------- |--------- | --------------- |
406
- | `id` | string | |
407
- | `component` | string or @Component | Component which will be appended into the modal. |
408
- | `size` | string | Size of the modal. |
409
- | `timeout` | number | Amount in milliseconds to close the modal, 0 to disable. |
410
- | `class` | string | Custom class for your modal. |
411
- | `closable` | boolean | Show "x" close button. |
412
- | `unique` | string | Identificator for your modals. |
413
- | `close` | function | custom function for close modal. |
414
- | `onOpen` | function | Capture when the modal is opening. |
415
- | `onClose` | function | Capture when the modal is closing. |
416
- ### destroy `function`
417
- Close all modals. Example:
418
- ```javascript
419
- modal.destroy();
420
- ```
421
- ## Loader Service
422
- Loader Service is an suportive service for loaders manamanagement.Example of importing loader service:
423
- ```javascript
424
- import { LoaderService } from 'wacom';
425
- constructor(private load: LoaderService){};
426
- ```
427
- ### show `function`
428
- Opens the loader and return htmlElement of this loader. Example:
429
- ```javascript
430
- let my_loader = load.show({
431
- timeout: 5000,
432
- class: 'myClass',
433
- closable: true
434
- });
435
- ```
436
- ### options
437
- | Name | Type | Description |
438
- | --------------- |--------- | --------------- |
439
- | `append` | @Component | Component where the loader will be appended. |
440
- | `component` | string or @Component | Component which will be appended into the loader. |
441
- | `timeout` | number | Amount in milliseconds to close the loader, 0 to disable. |
442
- | `progress` | boolean | Enable timeout progress bar. |
443
- | `class` | string | Custom class for your loader. |
444
- | `closable` | boolean | Show "x" close button. |
445
- | `close` | function | custom function for close loader. |
446
- | `onClose` | function | Capture when the loader is closing. |
447
- ### destroy `function`
448
- Close all loaders. Example:
449
- ```javascript
450
- loader.destroy();
451
- ```
452
- ## UI/UX Service
453
- UI/UX Service is supportive service for front-end features. This service provides saving css varibles and containes helpful tools for the front developer.
454
- ### var
455
- Object which can be used to contain all needed fields for front-end.
456
- ### get `function`
457
- Returns Object with all saved css viriables.
458
- Example:
459
- ```javascript
460
- ui.get();
461
- ```
462
- Result example:
463
- ```javascript
464
- {
465
- test: '15px solid'
466
- }
467
- ```
468
- ### remove `function`
469
- Removes css varible by the key.
470
- Example:
471
- ```javascript
472
- ui.remove('css');
473
- ```
474
- ### set `function`
475
- Method interface sets a new value for a property on a CSS style declaration object and saves all css variables which you have passed.
476
- Example:
477
- ```javascript
478
- ui.set(variables, options);
479
- ```
480
- ```variables``` - All css varibles you want to pass. If you want to set array of variables you'll need to have specific structure of the array. Example: ```[{key: 'name', value: example}]```. Object will be saved with the same structure.
481
-
482
- ```options``` - If you want to save css variables to the localStorage you should pass ```local: true```. Also if you want to save variables only for specific host you should pass ```host: 'hostname'```
483
- ### arr `function`
484
- Helps developer to generate array with custom length and with elements of specific type.
485
- Example:
486
- ```html
487
- <div *ngFor="let obj of ui.arr(length, type)"></div>
488
- ```
489
- ```length``` - Length of generated array.
490
- ```type``` - ```'number'||'text'||'date'``` Will set elements with random content at choosed type. 'number' is default type of elements.
491
- ### text `function`
492
- Helps developer to generate random string with specific length.
493
- Example:
494
- ```html
495
- <span>{{ui.text(length)}}</span>
496
- ```
1
+ # Angular (ngx) common
2
+ Module which has common services and components which can be used on all projects.
3
+
4
+ ## Getting Started
5
+
6
+ ### License
7
+ [MIT](LICENSE)
8
+
9
+ ### Instalation
10
+ ```bash
11
+ $ npm i --save wacom
12
+ ```
13
+
14
+ ### Services
15
+ | Name | Description |
16
+ | ------- |:-----:|
17
+ | [**`Core`**](https://www.npmjs.com/package/wacom#core-service) | Common supportive function which can be used in any service |
18
+ | [**`Http`**](https://www.npmjs.com/package/wacom#http-service) | Http layer for HttpClient |
19
+ | [**`Store`**](https://www.npmjs.com/package/wacom#store-service) | Service will is responsible for keeping information on the device |
20
+ | [**`Hash`**](https://www.npmjs.com/package/wacom#hash-service) | Hash management for easily use, storage which stay in url |
21
+ | [**`Render`**](https://www.npmjs.com/package/wacom#render-service) | Make not automated render management well structured |
22
+ | [**`Meta`**](https://www.npmjs.com/package/wacom#meta-service) | Website meta tags management within router |
23
+ | [**`Alert`**](https://www.npmjs.com/package/wacom#alert-service) | Alerts management |
24
+ | [**`Modal`**](https://www.npmjs.com/package/wacom#modal-service) | Modals management |
25
+ | [**`Loader`**](https://www.npmjs.com/package/wacom#loader-service) | Loaders management |
26
+ | [**`UI`**](https://www.npmjs.com/package/wacom#ui-service) | Supportive UI/UX service |
27
+
28
+ ### Components
29
+ | Name | Description |
30
+ | ------- |:-----:|
31
+ | [**`Picker`**](https://www.npmjs.com/package/wacom#picker-component) | Huge common component which is used to take information from user |
32
+
33
+ ## Core Service
34
+ ### device
35
+ ### version
36
+ ### set_version
37
+ ### host
38
+ ### parallel
39
+ ### serial
40
+ ### each
41
+ ### afterWhile
42
+ ### emit
43
+ ### on
44
+ ### done
45
+ ### ready
46
+ ### next
47
+ ## Mongo Service
48
+ Mongo Service is an suportive service for combining angular 6 client with waw CRUD back-end. Which means that you have to use [waw Framework](https://www.npmjs.com/package/waw) or you have to made your back-end routes in a way of waw crud. Example of importing mongo service:
49
+ ```javascript
50
+ import { MongoService } from 'wacom';
51
+ constructor(private mongo: MongoService){};
52
+ ```
53
+ ### create `function`
54
+ connecting with waw CRUD create. As parameters accepting name of mongo collection, object with values for document and optionally callback function which will return the document. Document will be filled inside read callbacks. Example:
55
+ ```javascript
56
+ mongo.create('colName', {
57
+ name: 'docName'
58
+ }, created => {
59
+ console.log('document has been created');
60
+ });
61
+ ```
62
+ ### read `function`
63
+ connecting with waw CRUD read. As parameters accepting name of mongo collection, optionally options, optionally callback which will return all documents in array as first parameter and in object with doc._id placeholder for doc as second parameter. Function returning directing array which will host the documents. Example:
64
+ ```javascript
65
+ mongo.get('colName',{
66
+ replace: {
67
+ name: function(val, cb, doc){
68
+ cb(val+'_modified')
69
+ }
70
+ },
71
+ name: 'me',
72
+ next: {
73
+ name: 'friends',
74
+ next: {
75
+ name: 'near',
76
+ next: {
77
+ name: 'city',
78
+ next: {
79
+ name: 'country'
80
+ }
81
+ }
82
+ }
83
+ },
84
+ populate: [{
85
+ field: 'author',
86
+ part: 'user'
87
+ }],
88
+ groups: 'city name' || ['city', 'name'] || {
89
+ first_name: {
90
+ field: function(doc, cb){
91
+ if(doc.name.split(' ').length>1) cb(doc.name.split(' ')[1]);
92
+ retun doc.name.split(' ')[0];
93
+ },
94
+ allow: function(doc){
95
+ return !!doc.name;
96
+ },
97
+ ignore: function(){
98
+ return false;
99
+ },
100
+ sort: function(){
101
+
102
+ }
103
+ }
104
+ },
105
+ query: {
106
+ male: function(doc){
107
+ return doc.gender;
108
+ },
109
+ female: {
110
+ allow: function(doc){
111
+ return !doc.gender;
112
+ },
113
+ ignore: function(){
114
+ return typeof doc.gender != 'boolean';
115
+ },
116
+ sort: function(a, b){
117
+ if(a.order > b.order) return -1;
118
+ return 1;
119
+ }
120
+ }
121
+ }
122
+ }, (arr, obj, name, resp) => {
123
+ /*
124
+ * arr will be array with total docs from that part
125
+ * obj will be object with total docs from that part binded by _id
126
+ * groups will be saved into obj in the way: obj.name['Denys'] or obj.city['Kiev']
127
+ * name is the name of current pull from server
128
+ * resp is the array of responsinse with documents queried
129
+ */
130
+ })
131
+ ```
132
+ #### replace `options`
133
+ work as filler of each doc for cases when we can calculate things to use in website. Good example can be currencies which change each moment, we have product in one currency and we want to show it in different currrencies. Other good example can be date fields, which is saved as string and we need them in `new Date()` format.
134
+ #### populate `options`
135
+ works in the same way as populate of mongodb but in the client side. This works great when you need documents inside other documents and put on them sorting or other things.
136
+ #### groups `options`
137
+ makings arrays which show different documents inside specific placeholders. As example we can have list of users in specific town or country, so we don't have to create pipes for that.
138
+ #### next `options`
139
+ works as level of pulling different documents from the server. This is mostly made for performance, so user can have the info he needs directly.
140
+ ### updateAll `function`
141
+ connecting with waw CRUD updateAll. As parameters accepting name of mongo collection, document object, optionally options and optionally callback function which will return the document. Example:
142
+ ```javascript
143
+ mongo.updateAll('colName', {
144
+ name: doc.name,
145
+ _id: doc._id
146
+ }, {
147
+ fields: 'name'
148
+ }, () => {
149
+ console.log('document is updated');
150
+ });
151
+ ```
152
+ ### updateUnique `function`
153
+ connecting with waw CRUD updateUnique. As parameters accepting name of mongo collection, object with document _id and field value, optionally options and optionally callback function which will return if field has been updated. Example:
154
+ ```javascript
155
+ mongo.updateUnique('colName', {
156
+ name: doc.name,
157
+ _id: doc._id
158
+ }, {
159
+ name: 'name'
160
+ }, (resp) => {
161
+ if(resp){
162
+ console.log('field is updated');
163
+ }else {
164
+ console.log('field is not updated');
165
+ }
166
+ });
167
+ ```
168
+ ### delete `function`
169
+ connecting with waw CRUD delete. As parameters accepting name of mongo collection, document object, optionally options and optionally callback function which will return the document. Example:
170
+ ```javascript
171
+ mongo.delate('colName',{
172
+ _id: doc._id
173
+ }, {
174
+ name: 'admin'
175
+ }, () => {
176
+ console.log('document is deleted');
177
+ });
178
+ ```
179
+ ### _id `function`
180
+ provide new mongo _id. As parameters accepting callback function which will return the _id. Example:
181
+ ```javascript
182
+ mongo._id( _id => {
183
+ console.log(_id);
184
+ });
185
+ ```
186
+ ### to_id `function`
187
+ convert array of documents, object with documents, mixed documents or _id and converting it to array of _id. Example:
188
+ ```javascript
189
+ mongo.to_id([{
190
+ _id: '1'
191
+ }, '2']);
192
+ // ['1', '2']
193
+ mongo.to_id({
194
+ '1': true
195
+ '2': false
196
+ });
197
+ // ['1']
198
+ ```
199
+ ### afterWhile `function`
200
+ provide delay on any action, usefull with input and model change. As parameters accepting document, callback and optionally time. Example:
201
+ ```javascript
202
+ mongo.afterWhile(doc, () => {
203
+ console.log('change can be applied');
204
+ }, 2000);
205
+ ```
206
+ ### populate `function`
207
+ making population on specific field with specific collection. Example with doc which will have field as document of part provided:
208
+ ```javascript
209
+ mongo.populate(doc, 'field', 'colName');
210
+ ```
211
+ ### on `function`
212
+ accepting array or string of parts and callback which will be called when all parts will be loaded.
213
+ Example:
214
+ ```javascript
215
+ mongo.on('user post', () => {
216
+ console.log('user and post part has been loaded');
217
+ });
218
+ ```
219
+ ## Sort
220
+ Set of functions, which are accepted by th function ```array.sort()``` as a parameter. Each of these functions is for sorting documents(objects).
221
+ ### sortAscId `function`
222
+ accepting array of objects and return it sorted in ascending order by _id
223
+ Example:
224
+ ```javascript
225
+ array.sort(mongo.sortAscId());
226
+ ```
227
+ ### sortDescId `function`
228
+ accepting array of objects and return it sorted in descending order by _id
229
+ Example:
230
+ ```javascript
231
+ mongo.sortDescId();
232
+ ```
233
+ ### sortAscString `function`
234
+ accepting array of object and return it sorted in ascending order by alphabet
235
+ Example:
236
+ ```javascript
237
+ mongo.sortAscString();
238
+ ```
239
+ ### sortDescString `function`
240
+ accepting array of object and return it sorted in descending order by alphabet
241
+ Example:
242
+ ```javascript
243
+ mongo.sortDescString();
244
+ ```
245
+ ### sortAscDate `function`
246
+ accepting array of object and return it sorted in ascending order by date
247
+ Example:
248
+ ```javascript
249
+ mongo.sortAscDate();
250
+ ```
251
+ ### sortDescDate `function`
252
+ accepting array of object and return it sorted in descending order by date
253
+ Example:
254
+ ```javascript
255
+ mongo.sortDescDate();
256
+ ```
257
+ ### sortAscNumber `function`
258
+ accepting array of object and return it sorted in ascending order by number
259
+ Example:
260
+ ```javascript
261
+ mongo.sortAscNumber();
262
+ ```
263
+ ### sortDescNumber `function`
264
+ accepting array of object and return it sorted in descending order by number
265
+ Example:
266
+ ```javascript
267
+ mongo.sortDescNumber();
268
+ ```
269
+ ### sortAscBoolean `function`
270
+ accepting array of object and return it sorted: first - true, second - false
271
+ Example:
272
+ ```javascript
273
+ mongo.sortAscBoolean();
274
+ ```
275
+ ### sortDescBoolean `function`
276
+ accepting array of object and return it sorted: first - false, second - true
277
+ Example:
278
+ ```javascript
279
+ mongo.sortDescBoolean();
280
+ ```
281
+ ### beArr `function`
282
+ checking value if it's array then we keep it and in other case, we replace it with new array. Example where each doc will have data as array:
283
+ ```javascript
284
+ mongo.get('colName', {
285
+ replace: {
286
+ data:mongo.beArr
287
+ }
288
+ });
289
+ ```
290
+ ### beObj `function`
291
+ checking value if it's object then we keep it and in other case, we replace it with new object. Example where each doc will have data as array:
292
+ ```javascript
293
+ mongo.get('colName', {
294
+ replace: {
295
+ data:mongo.beObj
296
+ }
297
+ });
298
+ ```
299
+ ### beDate `function`
300
+ making value new Date(valueContent). Example where each doc will have date as date:
301
+ ```javascript
302
+ mongo.get('colName', {
303
+ replace: {
304
+ date:mongo.beDate
305
+ }
306
+ });
307
+ ```
308
+ ### forceArr `function`
309
+ convert any value to array within replace options. Example where each doc will have data as empty array:
310
+ ```javascript
311
+ mongo.get('colName', {
312
+ replace: {
313
+ data:mongo.forceArr
314
+ }
315
+ });
316
+ ```
317
+ ### forceObj `function`
318
+ convert any value to object within replace options. Example where each doc will have data as empty object:
319
+ ```javascript
320
+ mongo.get('colName', {
321
+ replace: {
322
+ data:mongo.forceObj
323
+ }
324
+ });
325
+ ```
326
+ ## Alert Service
327
+ Alert Service is an suportive service for alerts manamanagement. Example of importing alert service:
328
+ ```javascript
329
+ import { AlertService } from 'wacom';
330
+ constructor(private alert: AlertService){};
331
+ ```
332
+ ### show `function`
333
+ Opens the alert and return htmlElement of this alert.
334
+ Example 1:
335
+ ```javascript
336
+ let my_alert = alert.show({
337
+ text: 'Are you sure?',
338
+ type: 'question',
339
+ timeout: 5000,
340
+ class: 'myClass',
341
+ position: 'bottomRight',
342
+ buttons: [{
343
+ text: 'YES',
344
+ callback: ()=>{
345
+ console.log("YES!");
346
+ }
347
+ },{
348
+ text: 'NO',
349
+ callback: ()=>{
350
+ console.log("NO!");
351
+ }
352
+ }]
353
+ });
354
+ ```
355
+ Example 2:
356
+ ```javascript
357
+ let my_alert = alert.show({
358
+ component: MyCustomComponent,
359
+ timeout: 5000,
360
+ class: 'myClass',
361
+ position: 'center',
362
+ closable: true
363
+ });
364
+ ```
365
+ ### options
366
+ | Name | Type | Description |
367
+ | --------------- |--------- | --------------- |
368
+ | `text` | string | Text of alert. |
369
+ | `type` | string | Type of alert(etc `info`, `success`, `warning`, `error`, `question`). |
370
+ | `class` | string | Custom class for your alert. |
371
+ | `unique` | string | Identificator for your alerts. |
372
+ | `progress` | boolean | Enable timeout progress bar. |
373
+ | `position` | string | Position of the alert(`topLeft`, `topCenter`, `topRight`, `right`, `bottomRight`, `bottomCenter`, `bottomLeft`, `left`, `center`). |
374
+ | `timeout` | number | Amount in milliseconds to close the alert, 0 to disable. |
375
+ | `closable` | boolean | Show "x" close button. |
376
+ | `buttons` | number | Array of buttons for your alerts. |
377
+ | `component` | string or @Component | Component which will be appended into the alert. |
378
+ | `close` | function | custom function for close alert. |
379
+ | `onClose` | function | Capture when the alert is closing. |
380
+ ### destroy `function`
381
+ Close all alerts. Example:
382
+ ```javascript
383
+ alert.destroy();
384
+ ```
385
+ ## Modal Service
386
+ Modal Service is an suportive service for modals manamanagement. Example of importing modal service:
387
+ ```javascript
388
+ import { ModalService } from 'wacom';
389
+ constructor(private modal: ModalService){};
390
+ ```
391
+ ### show `function`
392
+ Opens the modal and return htmlElement of this modal. Example:
393
+ ```javascript
394
+ let my_modal = modal.show({
395
+ component: MyCustomComponent,
396
+ size: 'mid',
397
+ timeout: 5000,
398
+ class: 'myClass',
399
+ position: 'center',
400
+ closable: true
401
+ });
402
+ ```
403
+ ### options
404
+ | Name | Type | Description |
405
+ | --------------- |--------- | --------------- |
406
+ | `id` | string | |
407
+ | `component` | string or @Component | Component which will be appended into the modal. |
408
+ | `size` | string | Size of the modal. |
409
+ | `timeout` | number | Amount in milliseconds to close the modal, 0 to disable. |
410
+ | `class` | string | Custom class for your modal. |
411
+ | `closable` | boolean | Show "x" close button. |
412
+ | `unique` | string | Identificator for your modals. |
413
+ | `close` | function | custom function for close modal. |
414
+ | `onOpen` | function | Capture when the modal is opening. |
415
+ | `onClose` | function | Capture when the modal is closing. |
416
+ ### destroy `function`
417
+ Close all modals. Example:
418
+ ```javascript
419
+ modal.destroy();
420
+ ```
421
+ ## Loader Service
422
+ Loader Service is an suportive service for loaders manamanagement.Example of importing loader service:
423
+ ```javascript
424
+ import { LoaderService } from 'wacom';
425
+ constructor(private load: LoaderService){};
426
+ ```
427
+ ### show `function`
428
+ Opens the loader and return htmlElement of this loader. Example:
429
+ ```javascript
430
+ let my_loader = load.show({
431
+ timeout: 5000,
432
+ class: 'myClass',
433
+ closable: true
434
+ });
435
+ ```
436
+ ### options
437
+ | Name | Type | Description |
438
+ | --------------- |--------- | --------------- |
439
+ | `append` | @Component | Component where the loader will be appended. |
440
+ | `component` | string or @Component | Component which will be appended into the loader. |
441
+ | `timeout` | number | Amount in milliseconds to close the loader, 0 to disable. |
442
+ | `progress` | boolean | Enable timeout progress bar. |
443
+ | `class` | string | Custom class for your loader. |
444
+ | `closable` | boolean | Show "x" close button. |
445
+ | `close` | function | custom function for close loader. |
446
+ | `onClose` | function | Capture when the loader is closing. |
447
+ ### destroy `function`
448
+ Close all loaders. Example:
449
+ ```javascript
450
+ loader.destroy();
451
+ ```
452
+ ## UI/UX Service
453
+ UI/UX Service is supportive service for front-end features. This service provides saving css varibles and containes helpful tools for the front developer.
454
+ ### var
455
+ Object which can be used to contain all needed fields for front-end.
456
+ ### get `function`
457
+ Returns Object with all saved css viriables.
458
+ Example:
459
+ ```javascript
460
+ ui.get();
461
+ ```
462
+ Result example:
463
+ ```javascript
464
+ {
465
+ test: '15px solid'
466
+ }
467
+ ```
468
+ ### remove `function`
469
+ Removes css varible by the key.
470
+ Example:
471
+ ```javascript
472
+ ui.remove('css');
473
+ ```
474
+ ### set `function`
475
+ Method interface sets a new value for a property on a CSS style declaration object and saves all css variables which you have passed.
476
+ Example:
477
+ ```javascript
478
+ ui.set(variables, options);
479
+ ```
480
+ ```variables``` - All css varibles you want to pass. If you want to set array of variables you'll need to have specific structure of the array. Example: ```[{key: 'name', value: example}]```. Object will be saved with the same structure.
481
+
482
+ ```options``` - If you want to save css variables to the localStorage you should pass ```local: true```. Also if you want to save variables only for specific host you should pass ```host: 'hostname'```
483
+ ### arr `function`
484
+ Helps developer to generate array with custom length and with elements of specific type.
485
+ Example:
486
+ ```html
487
+ <div *ngFor="let obj of ui.arr(length, type)"></div>
488
+ ```
489
+ ```length``` - Length of generated array.
490
+ ```type``` - ```'number'||'text'||'date'``` Will set elements with random content at choosed type. 'number' is default type of elements.
491
+ ### text `function`
492
+ Helps developer to generate random string with specific length.
493
+ Example:
494
+ ```html
495
+ <span>{{ui.text(length)}}</span>
496
+ ```