ngx-sfc-common 0.0.0-watch

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 (219) hide show
  1. package/README.md +644 -0
  2. package/esm2020/lib/components/button/button-type.enum.mjs +9 -0
  3. package/esm2020/lib/components/button/button.component.mjs +44 -0
  4. package/esm2020/lib/components/checkmark/checkmark-type.enum.mjs +7 -0
  5. package/esm2020/lib/components/checkmark/checkmark.component.mjs +39 -0
  6. package/esm2020/lib/components/close/close.component.mjs +16 -0
  7. package/esm2020/lib/components/delimeter/delimeter.component.mjs +28 -0
  8. package/esm2020/lib/components/dots/dots.component.mjs +30 -0
  9. package/esm2020/lib/components/hamburger/default/hamburger.component.mjs +12 -0
  10. package/esm2020/lib/components/hamburger/hamburger-base.component.mjs +23 -0
  11. package/esm2020/lib/components/hamburger/menu/hamburger-menu.component.mjs +18 -0
  12. package/esm2020/lib/components/icon/icon.component.mjs +21 -0
  13. package/esm2020/lib/components/index.mjs +34 -0
  14. package/esm2020/lib/components/load-container/load-container.component.mjs +180 -0
  15. package/esm2020/lib/components/load-container/load-container.constants.mjs +5 -0
  16. package/esm2020/lib/components/load-container/load-container.enum.mjs +11 -0
  17. package/esm2020/lib/components/load-container/models/load-container.model.mjs +2 -0
  18. package/esm2020/lib/components/load-container/models/load-more-parameters.model.mjs +2 -0
  19. package/esm2020/lib/components/load-container/models/load-more-predicate-parameters.model.mjs +2 -0
  20. package/esm2020/lib/components/load-container/models/load-more.model.mjs +2 -0
  21. package/esm2020/lib/components/load-container/service/load-more.service.mjs +27 -0
  22. package/esm2020/lib/components/load-more-button/load-more-button.component.mjs +31 -0
  23. package/esm2020/lib/components/loader/bounce/bounce-loader.component.mjs +13 -0
  24. package/esm2020/lib/components/loader/circle/circle-loader-type.enum.mjs +6 -0
  25. package/esm2020/lib/components/loader/circle/circle-loader.component.mjs +20 -0
  26. package/esm2020/lib/components/loader/loader-base.component.mjs +51 -0
  27. package/esm2020/lib/components/loader/loader.constants.mjs +6 -0
  28. package/esm2020/lib/components/loader/loader.event.mjs +2 -0
  29. package/esm2020/lib/components/loader/service/loader.service.mjs +76 -0
  30. package/esm2020/lib/components/modal/directive/click/modal-open-on-click.directive.mjs +50 -0
  31. package/esm2020/lib/components/modal/directive/open/modal-open.directive.mjs +28 -0
  32. package/esm2020/lib/components/modal/footer/default/default-modal-footer.component.mjs +60 -0
  33. package/esm2020/lib/components/modal/footer/default/default-modal-footer.model.mjs +2 -0
  34. package/esm2020/lib/components/modal/header/default/default-modal-header.component.mjs +38 -0
  35. package/esm2020/lib/components/modal/header/default/default-modal-header.model.mjs +2 -0
  36. package/esm2020/lib/components/modal/modal-template.enum.mjs +7 -0
  37. package/esm2020/lib/components/modal/modal.component.mjs +103 -0
  38. package/esm2020/lib/components/modal/service/modal.event.mjs +2 -0
  39. package/esm2020/lib/components/modal/service/modal.service.mjs +31 -0
  40. package/esm2020/lib/components/pagination/models/pagination-view.model.mjs +2 -0
  41. package/esm2020/lib/components/pagination/pagination.component.mjs +104 -0
  42. package/esm2020/lib/components/pagination/pagination.constants.mjs +6 -0
  43. package/esm2020/lib/components/pagination/service/pagination.event.mjs +2 -0
  44. package/esm2020/lib/components/pagination/service/pagination.service.mjs +47 -0
  45. package/esm2020/lib/components/sorting/service/sorting.event.mjs +2 -0
  46. package/esm2020/lib/components/sorting/service/sorting.service.mjs +21 -0
  47. package/esm2020/lib/components/sorting/sorting.component.mjs +71 -0
  48. package/esm2020/lib/components/sorting/sorting.constants.mjs +6 -0
  49. package/esm2020/lib/components/sorting/sorting.model.mjs +2 -0
  50. package/esm2020/lib/components/template-content/template-content.component.mjs +31 -0
  51. package/esm2020/lib/components/toggle-switcher/toggle-switcher.component.mjs +38 -0
  52. package/esm2020/lib/components/toggle-switcher/toggle-switcher.model.mjs +2 -0
  53. package/esm2020/lib/components/tooltip/tooltip-type.enum.mjs +6 -0
  54. package/esm2020/lib/components/tooltip/tooltip.component.mjs +69 -0
  55. package/esm2020/lib/constants/common.constants.mjs +9 -0
  56. package/esm2020/lib/constants/date-time.constants.mjs +10 -0
  57. package/esm2020/lib/constants/file.constants.mjs +2 -0
  58. package/esm2020/lib/constants/index.mjs +4 -0
  59. package/esm2020/lib/constants/ui.constants.mjs +23 -0
  60. package/esm2020/lib/directives/click-outside/click-outside.directive.mjs +63 -0
  61. package/esm2020/lib/directives/click-outside/click-outside.event.mjs +2 -0
  62. package/esm2020/lib/directives/component-size/component-size.directive.mjs +59 -0
  63. package/esm2020/lib/directives/destroy-parent/destroy-parent.directive.mjs +27 -0
  64. package/esm2020/lib/directives/dom-changes/dom-changes.directive.mjs +32 -0
  65. package/esm2020/lib/directives/if/if.directive.mjs +26 -0
  66. package/esm2020/lib/directives/image-size/image-load.directive.mjs +41 -0
  67. package/esm2020/lib/directives/image-size/services/image-load.event.mjs +2 -0
  68. package/esm2020/lib/directives/image-size/services/image-load.service.mjs +22 -0
  69. package/esm2020/lib/directives/image-size/services/image-size.model.mjs +2 -0
  70. package/esm2020/lib/directives/index.mjs +14 -0
  71. package/esm2020/lib/directives/mouse-down/mouse-down.directive.mjs +37 -0
  72. package/esm2020/lib/directives/scroll-into-view/scroll-into-view.directive.mjs +39 -0
  73. package/esm2020/lib/directives/scroll-tracker/scroll-tracker.directive.mjs +39 -0
  74. package/esm2020/lib/directives/show-hide-element/show-hide-element.directive.mjs +42 -0
  75. package/esm2020/lib/directives/template-reference/template-reference.directive.mjs +23 -0
  76. package/esm2020/lib/directives/throw-element-on-hover/throw-element-on-hover.directive.mjs +38 -0
  77. package/esm2020/lib/enums/direction.enum.mjs +9 -0
  78. package/esm2020/lib/enums/index.mjs +9 -0
  79. package/esm2020/lib/enums/media.enum.mjs +13 -0
  80. package/esm2020/lib/enums/position.enum.mjs +12 -0
  81. package/esm2020/lib/enums/sequence.enum.mjs +9 -0
  82. package/esm2020/lib/enums/size.enum.mjs +11 -0
  83. package/esm2020/lib/enums/sorting-direction.enum.mjs +9 -0
  84. package/esm2020/lib/enums/theme.enum.mjs +9 -0
  85. package/esm2020/lib/enums/ui.enum.mjs +30 -0
  86. package/esm2020/lib/models/class.model.mjs +2 -0
  87. package/esm2020/lib/models/index.mjs +2 -0
  88. package/esm2020/lib/ngx-sfc-common.module.mjs +190 -0
  89. package/esm2020/lib/pipes/index.mjs +2 -0
  90. package/esm2020/lib/pipes/switch-multi-case/switch-multi-case.pipe.mjs +16 -0
  91. package/esm2020/lib/services/document-ref.service.mjs +71 -0
  92. package/esm2020/lib/services/index.mjs +4 -0
  93. package/esm2020/lib/services/resize.service.mjs +42 -0
  94. package/esm2020/lib/services/window-ref.service.mjs +70 -0
  95. package/esm2020/lib/utils/collections.utils.mjs +280 -0
  96. package/esm2020/lib/utils/common.utils.mjs +184 -0
  97. package/esm2020/lib/utils/date-time.utils.mjs +265 -0
  98. package/esm2020/lib/utils/file.utils.mjs +53 -0
  99. package/esm2020/lib/utils/index.mjs +7 -0
  100. package/esm2020/lib/utils/string.utils.mjs +31 -0
  101. package/esm2020/lib/utils/ui.utils.mjs +90 -0
  102. package/esm2020/ngx-sfc-common.mjs +5 -0
  103. package/esm2020/public-api.mjs +12 -0
  104. package/fesm2015/ngx-sfc-common.mjs +3097 -0
  105. package/fesm2015/ngx-sfc-common.mjs.map +1 -0
  106. package/fesm2020/ngx-sfc-common.mjs +3088 -0
  107. package/fesm2020/ngx-sfc-common.mjs.map +1 -0
  108. package/index.d.ts +5 -0
  109. package/lib/components/button/button-type.enum.d.ts +7 -0
  110. package/lib/components/button/button.component.d.ts +16 -0
  111. package/lib/components/checkmark/checkmark-type.enum.d.ts +5 -0
  112. package/lib/components/checkmark/checkmark.component.d.ts +11 -0
  113. package/lib/components/close/close.component.d.ts +6 -0
  114. package/lib/components/delimeter/delimeter.component.d.ts +9 -0
  115. package/lib/components/dots/dots.component.d.ts +9 -0
  116. package/lib/components/hamburger/default/hamburger.component.d.ts +6 -0
  117. package/lib/components/hamburger/hamburger-base.component.d.ts +7 -0
  118. package/lib/components/hamburger/menu/hamburger-menu.component.d.ts +7 -0
  119. package/lib/components/icon/icon.component.d.ts +9 -0
  120. package/lib/components/index.d.ts +44 -0
  121. package/lib/components/load-container/load-container.component.d.ts +50 -0
  122. package/lib/components/load-container/load-container.constants.d.ts +4 -0
  123. package/lib/components/load-container/load-container.enum.d.ts +8 -0
  124. package/lib/components/load-container/models/load-container.model.d.ts +14 -0
  125. package/lib/components/load-container/models/load-more-parameters.model.d.ts +5 -0
  126. package/lib/components/load-container/models/load-more-predicate-parameters.model.d.ts +3 -0
  127. package/lib/components/load-container/models/load-more.model.d.ts +5 -0
  128. package/lib/components/load-container/service/load-more.service.d.ts +12 -0
  129. package/lib/components/load-more-button/load-more-button.component.d.ts +12 -0
  130. package/lib/components/loader/bounce/bounce-loader.component.d.ts +6 -0
  131. package/lib/components/loader/circle/circle-loader-type.enum.d.ts +4 -0
  132. package/lib/components/loader/circle/circle-loader.component.d.ts +8 -0
  133. package/lib/components/loader/loader-base.component.d.ts +27 -0
  134. package/lib/components/loader/loader.constants.d.ts +5 -0
  135. package/lib/components/loader/loader.event.d.ts +4 -0
  136. package/lib/components/loader/service/loader.service.d.ts +33 -0
  137. package/lib/components/modal/directive/click/modal-open-on-click.directive.d.ts +17 -0
  138. package/lib/components/modal/directive/open/modal-open.directive.d.ts +13 -0
  139. package/lib/components/modal/footer/default/default-modal-footer.component.d.ts +19 -0
  140. package/lib/components/modal/footer/default/default-modal-footer.model.d.ts +8 -0
  141. package/lib/components/modal/header/default/default-modal-header.component.d.ts +16 -0
  142. package/lib/components/modal/header/default/default-modal-header.model.d.ts +6 -0
  143. package/lib/components/modal/modal-template.enum.d.ts +5 -0
  144. package/lib/components/modal/modal.component.d.ts +26 -0
  145. package/lib/components/modal/service/modal.event.d.ts +4 -0
  146. package/lib/components/modal/service/modal.service.d.ts +13 -0
  147. package/lib/components/pagination/models/pagination-view.model.d.ts +12 -0
  148. package/lib/components/pagination/pagination.component.d.ts +31 -0
  149. package/lib/components/pagination/pagination.constants.d.ts +5 -0
  150. package/lib/components/pagination/service/pagination.event.d.ts +6 -0
  151. package/lib/components/pagination/service/pagination.service.d.ts +25 -0
  152. package/lib/components/sorting/service/sorting.event.d.ts +5 -0
  153. package/lib/components/sorting/service/sorting.service.d.ts +9 -0
  154. package/lib/components/sorting/sorting.component.d.ts +22 -0
  155. package/lib/components/sorting/sorting.constants.d.ts +4 -0
  156. package/lib/components/sorting/sorting.model.d.ts +12 -0
  157. package/lib/components/template-content/template-content.component.d.ts +14 -0
  158. package/lib/components/toggle-switcher/toggle-switcher.component.d.ts +12 -0
  159. package/lib/components/toggle-switcher/toggle-switcher.model.d.ts +5 -0
  160. package/lib/components/tooltip/tooltip-type.enum.d.ts +4 -0
  161. package/lib/components/tooltip/tooltip.component.d.ts +22 -0
  162. package/lib/constants/common.constants.d.ts +8 -0
  163. package/lib/constants/date-time.constants.d.ts +9 -0
  164. package/lib/constants/file.constants.d.ts +1 -0
  165. package/lib/constants/index.d.ts +4 -0
  166. package/lib/constants/ui.constants.d.ts +22 -0
  167. package/lib/directives/click-outside/click-outside.directive.d.ts +23 -0
  168. package/lib/directives/click-outside/click-outside.event.d.ts +4 -0
  169. package/lib/directives/component-size/component-size.directive.d.ts +18 -0
  170. package/lib/directives/destroy-parent/destroy-parent.directive.d.ts +10 -0
  171. package/lib/directives/dom-changes/dom-changes.directive.d.ts +12 -0
  172. package/lib/directives/if/if.directive.d.ts +11 -0
  173. package/lib/directives/image-size/image-load.directive.d.ts +12 -0
  174. package/lib/directives/image-size/services/image-load.event.d.ts +5 -0
  175. package/lib/directives/image-size/services/image-load.service.d.ts +10 -0
  176. package/lib/directives/image-size/services/image-size.model.d.ts +4 -0
  177. package/lib/directives/index.d.ts +16 -0
  178. package/lib/directives/mouse-down/mouse-down.directive.d.ts +12 -0
  179. package/lib/directives/scroll-into-view/scroll-into-view.directive.d.ts +11 -0
  180. package/lib/directives/scroll-tracker/scroll-tracker.directive.d.ts +11 -0
  181. package/lib/directives/show-hide-element/show-hide-element.directive.d.ts +13 -0
  182. package/lib/directives/template-reference/template-reference.directive.d.ts +10 -0
  183. package/lib/directives/throw-element-on-hover/throw-element-on-hover.directive.d.ts +13 -0
  184. package/lib/enums/direction.enum.d.ts +7 -0
  185. package/lib/enums/index.d.ts +8 -0
  186. package/lib/enums/media.enum.d.ts +11 -0
  187. package/lib/enums/position.enum.d.ts +10 -0
  188. package/lib/enums/sequence.enum.d.ts +7 -0
  189. package/lib/enums/size.enum.d.ts +9 -0
  190. package/lib/enums/sorting-direction.enum.d.ts +7 -0
  191. package/lib/enums/theme.enum.d.ts +7 -0
  192. package/lib/enums/ui.enum.d.ts +27 -0
  193. package/lib/models/class.model.d.ts +3 -0
  194. package/lib/models/index.d.ts +1 -0
  195. package/lib/ngx-sfc-common.module.d.ts +43 -0
  196. package/lib/pipes/index.d.ts +1 -0
  197. package/lib/pipes/switch-multi-case/switch-multi-case.pipe.d.ts +7 -0
  198. package/lib/services/document-ref.service.d.ts +43 -0
  199. package/lib/services/index.d.ts +3 -0
  200. package/lib/services/resize.service.d.ts +32 -0
  201. package/lib/services/window-ref.service.d.ts +43 -0
  202. package/lib/utils/collections.utils.d.ts +156 -0
  203. package/lib/utils/common.utils.d.ts +78 -0
  204. package/lib/utils/date-time.utils.d.ts +164 -0
  205. package/lib/utils/file.utils.d.ts +25 -0
  206. package/lib/utils/index.d.ts +6 -0
  207. package/lib/utils/string.utils.d.ts +19 -0
  208. package/lib/utils/ui.utils.d.ts +58 -0
  209. package/package.json +56 -0
  210. package/public-api.d.ts +8 -0
  211. package/styles/_colors.scss +48 -0
  212. package/styles/_index.scss +4 -0
  213. package/styles/_mixins-delimeter.scss +21 -0
  214. package/styles/_mixins-scroll.scss +38 -0
  215. package/styles/_mixins.scss +46 -0
  216. package/styles/_variables.scss +12 -0
  217. package/styles/themes/_dark.scss +17 -0
  218. package/styles/themes/_default.scss +18 -0
  219. package/styles/themes/_yellow.scss +3 -0
package/README.md ADDED
@@ -0,0 +1,644 @@
1
+ # ngx-sfc-common
2
+
3
+ This is shared library for Street Football Club (SFC) project, that contains components, directives, utils, enums and constants that will be used in related libraries: [ngx-sfc-inputs](https://github.com/1kriva1/ngx-sfc/tree/master/projects/ngx-sfc-inputs) and [ngx-sfc-components](https://github.com/1kriva1/ngx-sfc/tree/master/projects/ngx-sfc-components).
4
+
5
+ ## Table of Contents
6
+
7
+ - [Get started](#get-started)
8
+ - [Directives](#directives)
9
+ - [Click out side](#click-out-side-sfcclickoutside)
10
+ - [Component size](#component-size-sfccomponentsize)
11
+ - [Destroy parent](#destroy-parent-sfcdestroyparent)
12
+ - [Mouse down](#mouse-down-sfcmousedown)
13
+ - [Show/Hide element](#showhide-element-sfcshowhideelement)
14
+ - [Template reference](#template-reference-sfctemplatereference)
15
+ - [Throw element on hover](#throw-element-on-hover-sfcthrowelementonhover)
16
+ - [Components](#components)
17
+ - [Button](#button-sfc-button)
18
+ - [Checkmark](#checkmark-sfc-checkmark)
19
+ - [Close](#close-sfc-close)
20
+ - [Delimeter](#delimeter-sfc-delimeter)
21
+ - [Dots](#dots-sfc-dots)
22
+ - [Hamburger](#hamburger-sfc-hamburger)
23
+ - [Loader](#loader-sfc-bounce-loader-sfc-circle-loader)
24
+ - [Modal](#modal-sfc-modal)
25
+ - [Pagination](#pagination-sfc-pagination)
26
+ - [Sorting](#sorting-sfc-sorting)
27
+ - [Template-content](#template-content-sfc-template-content)
28
+ - [Toggle-switcher](#toggle-switcher-sfc-toggle-switcher)
29
+ - [Tooltip](#tooltip-sfc-tooltip)
30
+ - [Services](#services)
31
+ - [Resize](#resize)
32
+ - [Utils](#utils)
33
+
34
+ ## Get started
35
+
36
+ 1. Run `npm install ngx-sfc-common` or `ng add ngx-sfc-common`.
37
+ 2. Import `NgxSfcCommonModule` into a module where you intend to use components and directives:
38
+
39
+ ```typescript
40
+ import { NgxSfcCommonModule } from 'ngx-sfc-common';
41
+ @NgModule({
42
+ imports: [ NgxSfcCommonModule ]
43
+ })
44
+ export class SomeModule { }
45
+ ```
46
+
47
+ ## Directives
48
+
49
+ ## **Click out side `[sfcClickOutside]`**
50
+
51
+ This directive can be usefull when need to detect if click event occured on specific HTML element (or it descendants) or outside it.
52
+
53
+ Add directive `[sfcClickOutside]` to element that you whant to check:
54
+
55
+ ```html
56
+ <div class="target" [sfcClickOutside]="value" (action)="onClick($event)"></div>
57
+ ```
58
+
59
+ Parameters:
60
+ 1. `[sfcClickOutside]="value"` - if value is true, directive will listen click events, othervise ignoring.
61
+ 2. `(action)` - function to handle click events
62
+
63
+ After clicking, directive will emit `ClickOutsideEvent` event for `(action)` output function.
64
+
65
+ `ClickOutsideEvent` has such structure:
66
+
67
+ ```typescript
68
+ export interface ClickOutsideEvent {
69
+ target: EventTarget | null;
70
+ value: boolean;
71
+ }
72
+ ```
73
+ 1. `target` - clicked element
74
+ 2. `value` - true if clicked outside target element (which has directive on it)
75
+
76
+ ## **Component size `[sfcComponentSize]`**
77
+
78
+ This directive allow to set defined size (Small, Medium or Large) or custom size in `em` units on element.
79
+
80
+ Add `[sfcComponentSize]` with value `ComponentSize` or add `[customSize]` for setting custom size:
81
+
82
+ ```html
83
+ <div class="target" [sfcComponentSize]="ComponentSize.Small" [customSize]="customSize">
84
+ ```
85
+
86
+ Parameters:
87
+ 1. `sfcComponentSize` expect enum `ComponentSize` value
88
+
89
+ `ComponentSize` has three posible values:
90
+
91
+ ComponentSize | CSS Value
92
+ --------------|-----------
93
+ Small | 0.5em
94
+ Medium | 1em
95
+ Large | 2em
96
+
97
+ 2. `customSize` - custom size as number (`em` unit will be added)
98
+
99
+ ## **Destroy parent `[sfcDestroyParent]`**
100
+
101
+ This directive allow to destroy parent element of directive owner.
102
+
103
+ Add `[sfcDestroyParent]` with value `destroy` and optionaly can define delay by `delay` value (e.g. after 10 ms will destroy):
104
+
105
+ ```html
106
+ <div class="container" [sfcDestroyParent]="destroy" [delay]="10">
107
+ ```
108
+ Parameters:
109
+ 1. `sfcDestroyParent` expect boolean value, if true - will destroy parent element
110
+ 2. `delay` - define delay before destroying, by default 0.
111
+
112
+ ## **Mouse down `(sfcMouseDown)`**
113
+
114
+ This directive allow clicking only by specific mouse button (by default allow left button click).
115
+
116
+ Add `(sfcMouseDown)="click($event)"` for defined click event handler and `[button]` to define what mouse button allowed to do this click:
117
+
118
+ ```html
119
+ <div class="target" (sfcMouseDown)="click($event)" [button]="button">
120
+ ```
121
+
122
+ Parameters:
123
+ 1. `(sfcMouseDown)` - if button allowed this action will be emitted
124
+ 2. `button` - define button, which will be allowed for clicking
125
+
126
+ ## **Show/Hide element `[sfcShowHideElement]`**
127
+
128
+ This directive allow to show or hide element with delay.
129
+
130
+ Add `[sfcShowHideElement]="show"` for defined show or hide element and `[delay]` for delay between show and hide states:
131
+
132
+ ```html
133
+ <div class="target" [sfcShowHideElement]="show" [delay]="delay">
134
+ ```
135
+
136
+ Parameters:
137
+ 1. `[sfcShowHideElement]` - if pass true value, than show element, otherwise hide
138
+ 2. `[delay]` - delay for show/hide animation (0.5s by default)
139
+
140
+ ## **Template reference `[sfcTemplateReference]`**
141
+
142
+ This directive allow to define templates by name and query these templates as array inside component.
143
+
144
+ Add `ng-template` with directive `[sfcTemplateReference]="ModalTemplate.Header"` (`ModalTemplate.Header` it's a name for template):
145
+
146
+ ```html
147
+ <ng-template [sfcTemplateReference]="ModalTemplate.Header">
148
+ <div>
149
+ <div>{{HEADER_MODEL.Title}}</div>
150
+ <fa-icon [icon]="HEADER_MODEL.Icon"></fa-icon>
151
+ <button (click)="FOOTER_MODEL.Click()">hide model</button>
152
+ </div>
153
+ </ng-template>
154
+ ```
155
+
156
+ Inside component query all templates by directive:
157
+
158
+ ```typescript
159
+ @ContentChildren(TemplateReferenceDirective, { read: TemplateReferenceDirective })
160
+ private templates: QueryList<TemplateReferenceDirective> | undefined;
161
+ ```
162
+
163
+ Get template by name `templateName`:
164
+
165
+ ```typescript
166
+ const templateRef = firstOrDefault(this.templates?.toArray(),
167
+ t => t.templateName == ModalTemplate.Header);
168
+ ```
169
+
170
+ Parameters:
171
+ 1. `[sfcTemplateReference]` - name(identificator) for template
172
+
173
+ ## **Throw element on hover `[sfcThrowElementOnHover]`**
174
+
175
+ This directive allow to throw element on `mouseenter` by Y axis and than back element on `mouseleave`.
176
+
177
+ Add directive `[sfcThrowElementOnHover]` with throw power `value`:
178
+
179
+ ```html
180
+ <div class="target" [sfcThrowElementOnHover]="value">
181
+ ```
182
+
183
+ Parameters:
184
+ 1. `[sfcThrowElementOnHover]` - with which power will throw element
185
+
186
+ ## Components
187
+
188
+ ## **Button `<sfc-button>`**
189
+
190
+ Button component allow to define several visualization types, add text, icons before and after text and make button disabled.
191
+
192
+ ```html
193
+ <sfc-button [iconBefore]="faStar" text="Button" [iconAfter]="faCar" [disabled]="false" [types]="[ButtonType.Rounded,ButtonType.Filled]">
194
+ </sfc-button>
195
+ ```
196
+
197
+ Parameters:
198
+ 1. `iconBefore` - icon before text
199
+ 2. `iconAfter` - icon after text
200
+ 3. `text` - button text
201
+ 4. `[disabled]` - disable button
202
+ 5. `[types]` - visualization types
203
+
204
+ Visualization types:
205
+ 1. Bordered - `ButtonType.Bordered`
206
+ 2. Filled - `ButtonType.Filled`
207
+ 3. Texted - `ButtonType.Texted`
208
+ 4. Circled - `ButtonType.Circled`
209
+ 5. Rounded - `ButtonType.Rounded`
210
+
211
+ Types can be combinated.
212
+
213
+ ## **Checkmark `<sfc-checkmark>`**
214
+
215
+ Check mark with possibility to change icon value. Can be used for checking rows in table rows.
216
+
217
+ ```html
218
+ <sfc-checkmark [active]="value" [icon]="faStar"></sfc-checkmark>
219
+ ```
220
+
221
+ Parameters:
222
+ 1. `[active]` - check value, if checked - will have true value
223
+ 2. `icon` - icon value inside checkmark (default value - `fa fa-check`)
224
+
225
+ ## **Close `<sfc-close>`**
226
+
227
+ Close icon. Used in notification and modal components.
228
+
229
+ ```html
230
+ <sfc-close *ngIf="show" (click)="onClose()"></sfc-close>
231
+ ```
232
+
233
+ ## **Delimeter `<sfc-delimeter>`**
234
+
235
+ Can be used for separate element on UI.
236
+
237
+ ```html
238
+ <sfc-delimeter></sfc-delimeter>
239
+ ```
240
+
241
+ ## **Dots `<sfc-dots>`**
242
+
243
+ Dots component for toggling menues or dropdowns visibility.
244
+
245
+ ```html
246
+ <sfc-dots [open]="open" [direction]="Direction.Horizontal"></sfc-dots>
247
+ ```
248
+
249
+ Parameters:
250
+ 1. `[open]` - define open/close state
251
+ 2. `[direction]` - dots direction
252
+
253
+ Directions:
254
+ 1. Horizontal - `Direction.Horizontal`
255
+ 2. Vertical - `Direction.Vertical`
256
+
257
+ ## **Hamburger `<sfc-hamburger>`**
258
+
259
+ Hamburger element for toggling menues.
260
+
261
+ ```html
262
+ <sfc-hamburger [open]="open"></sfc-hamburger>
263
+ ```
264
+
265
+ Parameters:
266
+ 1. `[open]` - define open/close state
267
+
268
+ ## **Loader `<sfc-bounce-loader>, <sfc-circle-loader>`**
269
+
270
+ Loader component allow to show/hide loaders on specific elements or globally on all window object.
271
+
272
+ There two types of loaders:
273
+ 1. Global - `id` value must be NULL
274
+ 2. Local - `id` value is required and must be unique
275
+
276
+ Add `<sfc-bounce-loader>` loader component:
277
+
278
+ ```html
279
+ <sfc-bounce-loader id="bounceLoader" [start]="true"></sfc-bounce-loader>
280
+ ```
281
+
282
+ Add `<button>` for showing and hidding loader (just for example):
283
+
284
+ ```html
285
+ <button (click)="showLoader('bounceLoader')">Show</button>
286
+ <button (click)="hideLoader('bounceLoader')">Hide</button>
287
+ ```
288
+
289
+ Inject `LoaderService` inside component:
290
+
291
+ ```typescript
292
+ constructor(private loaderService: LoaderService) { }
293
+ ```
294
+
295
+ Add `showLoader` and `hideLoader` methods for buttons:
296
+
297
+ ```typescript
298
+ public showLoader(id?: string): void {
299
+ this.loaderService.show(id);
300
+ }
301
+
302
+ public hideLoader(id?: string): void {
303
+ this.loaderService.hide(id);
304
+ }
305
+ ```
306
+
307
+ There are several types for visual representations of loaders:
308
+ 1. Bounce - `<sfc-bounce-loader>`
309
+ 2. Circle - `<sfc-circle-loader>`
310
+ 3. Circle-fading - `<sfc-circle-loader [type]="CircleLoaderType.Fading">`
311
+
312
+ Additional parameters:
313
+ 1. `[start]` - start loading on loader init (false by default)
314
+ 2. `[background]` - add overlay on loading (true by default)
315
+
316
+ ## **Modal `<sfc-modal>`**
317
+
318
+ Component allow to add/remove modal on all window object.
319
+ Modal contains three main parts: `header`, `body` and `footer`. All these parts can be replaced by reference or content templates.
320
+ If reference and content templates not provided, `header` and `footer` parts have default implementation.
321
+
322
+ Register button as modal handler by directive `*sfcModalOpenOnClick`. When click on this button, modal will add/removed:
323
+
324
+ ```html
325
+ <button #defaultModalBtn>Default modal</button>
326
+ <sfc-modal *sfcModalOpenOnClick="defaultModalBtn"></sfc-modal>
327
+ ```
328
+
329
+ Possible severals handlers:
330
+
331
+ ```html
332
+ <button #defaultOneModalBtn>Button 1</button>
333
+ <button #defaultSecondModalBtn>Button 1</button>
334
+ <sfc-modal *sfcModalOpenOnClick="[defaultOneModalBtn, defaultSecondModalBtn]"></sfc-modal>
335
+ ```
336
+
337
+ Examles of setting modal parts:
338
+
339
+ - References:
340
+
341
+ ```html
342
+ <ng-template #headerRef>
343
+ <div>
344
+ <div>{{HEADER_MODEL.Title}}</div>
345
+ </div>
346
+ </ng-template>
347
+
348
+ <ng-template #footerRef>
349
+ <div>
350
+ <div>{{FOOTER_MODEL.Title}}</div>
351
+ </div>
352
+ </ng-template>
353
+
354
+ <sfc-modal [header]="headerRef" [footer]="footerRef"></sfc-modal>
355
+ ```
356
+
357
+ - Templates:
358
+
359
+ ```html
360
+ <sfc-modal>
361
+ <ng-template [sfcTemplateReference]="ModalTemplate.Header">
362
+ <div>
363
+ <div>{{HEADER_MODEL.Title}}</div>
364
+ </div>
365
+ </ng-template>
366
+ <ng-template [sfcTemplateReference]="ModalTemplate.Footer">
367
+ <div>
368
+ <div>{{FOOTER_MODEL.Title}}</div>
369
+ </div>
370
+ </ng-template>
371
+ </sfc-modal>
372
+ ```
373
+
374
+ Modal can be added/removed by `ModalService`:
375
+
376
+ ```typescript
377
+ constructor(private modalService: ModalService) { }
378
+
379
+ // open
380
+ this.modalService.open();
381
+
382
+ // close
383
+ this.modalService.close();
384
+ ```
385
+
386
+ Additional parameters:
387
+ 1. `hideOnEsc` - if true, than modal can be removed on Escape button (by default true)
388
+ 2. `hideOnClickOutside` - if true, than modal can be removed on click outside of modal (by default true)
389
+
390
+ ## **Pagination `<sfc-pagination>`**
391
+
392
+ Component allow to paginate data for example for tables.
393
+
394
+ ```html
395
+ <sfc-pagination [count]="3" [limits]="false" [full]="false" [data$]="data$"></sfc-pagination>
396
+ ```
397
+
398
+ Parameters:
399
+ 1. `[count]` - max limit for pagination buttons
400
+ 2. `[full]` - show or not full range of data
401
+ 3. `[limits]` - show or not first/last pagination button
402
+ 4. `[data$]` - pagination data observable
403
+
404
+ ## **Sorting `<sfc-sorting>`**
405
+
406
+ Add posibility to emit sorting for specific data. Can add template for displaying UI, also component will add default or defined by model sorting icons. When click on component, sorting event will be emitted.
407
+
408
+ ```html
409
+ <sfc-sorting [id]="column.field" [model]="column.sorting">
410
+ <sfc-default-table-column [model]="column"></sfc-default-table-column>
411
+ </sfc-sorting>
412
+ ```
413
+
414
+ Parameters:
415
+ 1. `[id]` - sorting ID
416
+ 2. `[model]` - sorting model
417
+
418
+ Model contract:
419
+
420
+ ```typescript
421
+ export interface ISortingModel {
422
+ enabled: boolean; // enable sorting
423
+ active?: boolean; // is current sorting is active
424
+ direction: SortingDirection; // direction - asc or desc
425
+ icons?: ISortingIcon[]; // custom icons for sorting
426
+ }
427
+
428
+ export interface ISortingIcon {
429
+ direction: SortingDirection;
430
+ icon: string
431
+ }
432
+ ```
433
+
434
+ ## **Template-content `<sfc-template-content>`**
435
+
436
+ Component allow to insert template as template reference or as template content. Also can be defined default content.
437
+
438
+ ```html
439
+ <sfc-template-content [referenceContent]="header" [templatesContent]="templates"
440
+ [templateType]="ModalTemplate.Header" [defaultContent]="defaultHeader">
441
+ </sfc-template-content>
442
+
443
+ <ng-template #defaultHeader>
444
+ <sfc-default-modal-header [model]="defaultHeaderModel"></sfc-default-modal-header>
445
+ </ng-template>
446
+ ```
447
+
448
+ Parameters:
449
+ 1. `[referenceContent]` - reference template
450
+ 2. `[templatesContent]` - content templates
451
+
452
+ ```typescript
453
+ @ContentChildren(TemplateReferenceDirective, { read: TemplateReferenceDirective })
454
+ templates: QueryList<TemplateReferenceDirective> | undefined;
455
+ ```
456
+
457
+ 3. `[templateType]` - type for content templates
458
+
459
+ ```typescript
460
+ export enum ModalTemplate {
461
+ Body = 'body',
462
+ Header = 'header',
463
+ Footer = 'footer'
464
+ }
465
+ ```
466
+ 4. `[defaultContent]` - reference for default content
467
+
468
+ ## **Toggle-switcher `<sfc-toggle-switcher>`**
469
+
470
+ Component allow to add toggler with posibility to define text and icon for left and right part of component.
471
+ Can be used for toggling dark and light themes on page, toggling table types (rows or cards).
472
+
473
+ ```html
474
+ <sfc-toggle-switcher [active]="false" [leftModel]="{label:'test1', icon:faCar}"
475
+ [rightModel]="{label:'test1', icon:faStar}">
476
+ </sfc-toggle-switcher>
477
+ ```
478
+
479
+ Parameters:
480
+ 1. `[active]` - if true, toggler will move to right side
481
+ 2. `[leftModel]` - left model
482
+ 3. `[rightModel]` - right model
483
+
484
+ Model contract:
485
+
486
+ ```typescript
487
+ export interface IToggleSwitcherModel {
488
+ label: string,
489
+ icon?: string;
490
+ }
491
+ ```
492
+
493
+ ## **Tooltip `<sfc-tooltip>`**
494
+
495
+ Allow to add texted tooltip for element and define appearance position.
496
+ Also component has two types - show tooltip on hower and show tooltip on click.
497
+
498
+ ```html
499
+ <p sfc-tooltip="tooltip content" [tooltipPosition]="Position.Left" [tooltipType]="TooltipType.Click" [tooltipShow]="false">
500
+ ```
501
+
502
+ Parameters:
503
+ 1. `sfc-tooltip` - texted content of tooltip
504
+ 2. `[tooltipShow]` - show/hide tooltip
505
+ 3. `[tooltipPosition]` - tooltip appearance position
506
+ 4. `[tooltipType]` - type of tooltip
507
+
508
+ Positions:
509
+ - Top - `Position.Top`
510
+ - Bottom - `Position.Bottom`
511
+ - Left - `Position.Left`
512
+ - Right - `Position.Right`
513
+
514
+ Types:
515
+ - Hover - `TooltipType.Hover`
516
+ - Click - `TooltipType.Click`
517
+
518
+ ## Services
519
+
520
+ ## **Resize**
521
+
522
+ Service will emit on every window's resize event and provide current state of window object.
523
+
524
+ Inject service:
525
+
526
+ ```typescript
527
+ constructor(private resizeService: ResizeService) { }
528
+ ```
529
+
530
+ Subscribe on resize observable and handle emit result:
531
+
532
+ ```typescript
533
+ this._resizeSubscription = this.resizeService.onResize$
534
+ .pipe(startWith(this.window))
535
+ .subscribe(window => this.tooltipPosition = window.innerWidth <= MediaLimits.Tablet
536
+ ? Position.Bottom : this._position);
537
+ ```
538
+
539
+ ## Utils
540
+
541
+ - `Collection` utils
542
+
543
+ Methods for array(collection) opearations.
544
+
545
+ ```typescript
546
+ /**
547
+ * Return true if collection not empty
548
+ * @param collection Array of items
549
+ * @returns True if collection not empty
550
+ */
551
+ export function any<T>(collection: Array<T> | null | undefined): boolean {
552
+ return isDefined(collection) && (collection as Array<T>).length > 0;
553
+ }
554
+ ```
555
+ - `Common` utils
556
+
557
+ Methods for object checking, modification and operations.
558
+
559
+ ```typescript
560
+ /**
561
+ * Return true if value defined
562
+ * @param value Value to check
563
+ * @returns True if value is not null and defined
564
+ */
565
+ export function isDefined<T>(value: T | undefined | null): boolean {
566
+ return <T>value !== undefined && <T>value !== null;
567
+ }
568
+ ```
569
+
570
+ - `DateTime` utils
571
+
572
+ Method for DATETime objects.
573
+
574
+ ```typescript
575
+ /**
576
+ * Return first day of month as date from date value
577
+ * @param date Date value
578
+ * @returns First day of month as date
579
+ */
580
+ export function getFirstDayOfMonth(date: Date): Date {
581
+ if (isDefined(date) && date instanceof Date) {
582
+ const year = date.getFullYear(),
583
+ month = date.getMonth();
584
+ return new Date(year, month, 1);
585
+ }
586
+
587
+ return date;
588
+ }
589
+ ```
590
+
591
+ - `File` utils
592
+
593
+ Methods for IO and files.
594
+
595
+ ```typescript
596
+ /**
597
+ * Return parsed file size as string
598
+ * @param bytes Bytes count
599
+ * @param decimals Value after dot
600
+ * @returns Parsed file size
601
+ */
602
+ export function parseFileSize(bytes: number, decimals = 2): string {
603
+ if (bytes === 0)
604
+ return '0';
605
+
606
+ const k = 1024;
607
+ const dm = decimals < 0 ? 0 : decimals;
608
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
609
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
610
+
611
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
612
+ }
613
+ ```
614
+
615
+ - `String` utils
616
+
617
+ Methods for strings modification and operations on them.
618
+
619
+ ```typescript
620
+ /**
621
+ * Return true if string has value(not empty string)
622
+ * @param value String value to check
623
+ * @returns True if string is not null and defined(not empty string)
624
+ */
625
+ export function isNullOrEmptyString(value: string | undefined | null) {
626
+ return !isDefined(value) || value === CommonConstants.EMPTY_STRING;
627
+ }
628
+ ```
629
+
630
+ - `UI` utils
631
+
632
+ Methods for UI operations.
633
+
634
+ ```typescript
635
+ /**
636
+ * Return CSS like value
637
+ * @param value Value as number
638
+ * @returns Value as '1px'
639
+ */
640
+ export function getCssLikeValue(value: number,
641
+ type: string = UIConstants.CSS_PIXELS): string {
642
+ return value + type;
643
+ }
644
+ ```
@@ -0,0 +1,9 @@
1
+ export var ButtonType;
2
+ (function (ButtonType) {
3
+ ButtonType["Bordered"] = "bordered";
4
+ ButtonType["Filled"] = "filled";
5
+ ButtonType["Rounded"] = "rounded";
6
+ ButtonType["Circled"] = "circled";
7
+ ButtonType["Texted"] = "texted";
8
+ })(ButtonType || (ButtonType = {}));
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnV0dG9uLXR5cGUuZW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zZmMtY29tbW9uL3NyYy9saWIvY29tcG9uZW50cy9idXR0b24vYnV0dG9uLXR5cGUuZW51bS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxVQU1YO0FBTkQsV0FBWSxVQUFVO0lBQ2xCLG1DQUFxQixDQUFBO0lBQ3JCLCtCQUFpQixDQUFBO0lBQ2pCLGlDQUFtQixDQUFBO0lBQ25CLGlDQUFtQixDQUFBO0lBQ25CLCtCQUFpQixDQUFBO0FBQ3JCLENBQUMsRUFOVyxVQUFVLEtBQVYsVUFBVSxRQU1yQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBlbnVtIEJ1dHRvblR5cGUge1xyXG4gICAgQm9yZGVyZWQgPSAnYm9yZGVyZWQnLFxyXG4gICAgRmlsbGVkID0gJ2ZpbGxlZCcsXHJcbiAgICBSb3VuZGVkID0gJ3JvdW5kZWQnLFxyXG4gICAgQ2lyY2xlZCA9ICdjaXJjbGVkJyxcclxuICAgIFRleHRlZCA9ICd0ZXh0ZWQnXHJcbn0iXX0=