@klippa/ngx-enhancy-forms 1.0.0 → 2.1.0

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 (125) hide show
  1. package/README.md +179 -23
  2. package/bundles/klippa-ngx-enhancy-forms.umd.js +1206 -0
  3. package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -0
  4. package/bundles/klippa-ngx-enhancy-forms.umd.min.js +17 -0
  5. package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -0
  6. package/esm2015/klippa-ngx-enhancy-forms.js +6 -0
  7. package/esm2015/lib/elements/button/button.component.js +38 -0
  8. package/esm2015/lib/elements/checkbox/checkbox.component.js +18 -0
  9. package/esm2015/lib/elements/datepicker/datepicker.component.js +111 -0
  10. package/esm2015/lib/elements/email/email-input.component.js +21 -0
  11. package/esm2015/lib/elements/loading-indicator/loading-indicator.component.js +19 -0
  12. package/esm2015/lib/elements/number-input/number-input.component.js +17 -0
  13. package/esm2015/lib/elements/password-field/password-field.component.js +21 -0
  14. package/esm2015/lib/elements/select/select.component.js +35 -0
  15. package/esm2015/lib/elements/sortable-items/sortable-items.component.js +25 -0
  16. package/esm2015/lib/elements/text-input/text-input.component.js +22 -0
  17. package/esm2015/lib/elements/toggle/toggle.component.js +14 -0
  18. package/esm2015/lib/elements/value-accessor-base/value-accessor-base.component.js +88 -0
  19. package/esm2015/lib/form/form-caption/form-caption.component.js +35 -0
  20. package/esm2015/lib/form/form-element/form-element.component.js +100 -0
  21. package/esm2015/lib/form/form-error/form-error.component.js +37 -0
  22. package/esm2015/lib/form/form-submit-button/form-submit-button.component.js +53 -0
  23. package/esm2015/lib/form/form.component.js +72 -0
  24. package/esm2015/lib/material.module.js +17 -0
  25. package/esm2015/lib/ngx-enhancy-forms.module.js +75 -0
  26. package/esm2015/lib/types.js +2 -0
  27. package/esm2015/lib/util/values.js +38 -0
  28. package/esm2015/lib/validators/dateValidator.js +6 -0
  29. package/esm2015/public-api.js +24 -0
  30. package/fesm2015/klippa-ngx-enhancy-forms.js +804 -0
  31. package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -0
  32. package/klippa-ngx-enhancy-forms.d.ts +5 -0
  33. package/klippa-ngx-enhancy-forms.metadata.json +1 -0
  34. package/lib/elements/button/button.component.d.ts +11 -0
  35. package/lib/elements/checkbox/checkbox.component.d.ts +5 -0
  36. package/lib/elements/datepicker/datepicker.component.d.ts +26 -0
  37. package/lib/elements/email/email-input.component.d.ts +4 -0
  38. package/lib/elements/loading-indicator/loading-indicator.component.d.ts +4 -0
  39. package/lib/elements/number-input/number-input.component.d.ts +4 -0
  40. package/lib/elements/password-field/password-field.component.d.ts +4 -0
  41. package/lib/elements/select/select.component.d.ts +24 -0
  42. package/lib/elements/sortable-items/sortable-items.component.d.ts +6 -0
  43. package/lib/elements/text-input/text-input.component.d.ts +5 -0
  44. package/lib/elements/toggle/toggle.component.d.ts +3 -0
  45. package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +32 -0
  46. package/lib/form/form-caption/form-caption.component.d.ts +8 -0
  47. package/lib/form/form-element/form-element.component.d.ts +38 -0
  48. package/lib/form/form-error/form-error.component.d.ts +11 -0
  49. package/lib/form/form-submit-button/form-submit-button.component.d.ts +11 -0
  50. package/lib/form/form.component.d.ts +13 -0
  51. package/lib/material.module.d.ts +2 -0
  52. package/lib/ngx-enhancy-forms.module.d.ts +2 -0
  53. package/lib/types.d.ts +15 -0
  54. package/lib/util/values.d.ts +9 -0
  55. package/lib/validators/dateValidator.d.ts +3 -0
  56. package/package.json +16 -41
  57. package/public-api.d.ts +20 -0
  58. package/.editorconfig +0 -17
  59. package/.github/workflows/ci.yml +0 -18
  60. package/.github/workflows/release.yml +0 -22
  61. package/angular.json +0 -28
  62. package/ng-package.json +0 -7
  63. package/src/lib/elements/button/button.component.html +0 -18
  64. package/src/lib/elements/button/button.component.scss +0 -203
  65. package/src/lib/elements/button/button.component.ts +0 -34
  66. package/src/lib/elements/checkbox/checkbox.component.html +0 -15
  67. package/src/lib/elements/checkbox/checkbox.component.scss +0 -55
  68. package/src/lib/elements/checkbox/checkbox.component.ts +0 -14
  69. package/src/lib/elements/datepicker/datepicker.component.html +0 -20
  70. package/src/lib/elements/datepicker/datepicker.component.scss +0 -47
  71. package/src/lib/elements/datepicker/datepicker.component.ts +0 -142
  72. package/src/lib/elements/email/email-input.component.html +0 -8
  73. package/src/lib/elements/email/email-input.component.scss +0 -15
  74. package/src/lib/elements/email/email-input.component.ts +0 -13
  75. package/src/lib/elements/loading-indicator/loading-indicator.component.html +0 -40
  76. package/src/lib/elements/loading-indicator/loading-indicator.component.scss +0 -179
  77. package/src/lib/elements/loading-indicator/loading-indicator.component.ts +0 -11
  78. package/src/lib/elements/number-input/number-input.component.html +0 -7
  79. package/src/lib/elements/number-input/number-input.component.scss +0 -15
  80. package/src/lib/elements/number-input/number-input.component.ts +0 -13
  81. package/src/lib/elements/password-field/password-field.component.html +0 -10
  82. package/src/lib/elements/password-field/password-field.component.scss +0 -15
  83. package/src/lib/elements/password-field/password-field.component.ts +0 -11
  84. package/src/lib/elements/select/select.component.html +0 -22
  85. package/src/lib/elements/select/select.component.scss +0 -289
  86. package/src/lib/elements/select/select.component.ts +0 -44
  87. package/src/lib/elements/sortable-items/sortable-items.component.html +0 -23
  88. package/src/lib/elements/sortable-items/sortable-items.component.scss +0 -34
  89. package/src/lib/elements/sortable-items/sortable-items.component.ts +0 -18
  90. package/src/lib/elements/text-input/text-input.component.html +0 -10
  91. package/src/lib/elements/text-input/text-input.component.scss +0 -15
  92. package/src/lib/elements/text-input/text-input.component.ts +0 -14
  93. package/src/lib/elements/toggle/toggle.component.html +0 -9
  94. package/src/lib/elements/toggle/toggle.component.scss +0 -78
  95. package/src/lib/elements/toggle/toggle.component.ts +0 -11
  96. package/src/lib/elements/value-accessor-base/value-accessor-base.component.ts +0 -89
  97. package/src/lib/form/form-caption/form-caption.component.html +0 -3
  98. package/src/lib/form/form-caption/form-caption.component.scss +0 -3
  99. package/src/lib/form/form-caption/form-caption.component.ts +0 -28
  100. package/src/lib/form/form-element/form-element.component.html +0 -25
  101. package/src/lib/form/form-element/form-element.component.scss +0 -44
  102. package/src/lib/form/form-element/form-element.component.ts +0 -76
  103. package/src/lib/form/form-error/form-error.component.html +0 -3
  104. package/src/lib/form/form-error/form-error.component.scss +0 -4
  105. package/src/lib/form/form-error/form-error.component.ts +0 -29
  106. package/src/lib/form/form-submit-button/form-submit-button.component.html +0 -11
  107. package/src/lib/form/form-submit-button/form-submit-button.component.scss +0 -10
  108. package/src/lib/form/form-submit-button/form-submit-button.component.ts +0 -32
  109. package/src/lib/form/form.component.html +0 -5
  110. package/src/lib/form/form.component.scss +0 -6
  111. package/src/lib/form/form.component.ts +0 -67
  112. package/src/lib/ngx-enhancy-forms.module.ts +0 -68
  113. package/src/lib/util/values.ts +0 -46
  114. package/src/lib/validators/dateValidator.ts +0 -8
  115. package/src/public-api.ts +0 -5
  116. package/src/style/_form.scss +0 -502
  117. package/src/style/_klippa.scss +0 -1006
  118. package/src/style/_mixins.scss +0 -66
  119. package/src/style/_widgets.scss +0 -251
  120. package/src/style/app.scss +0 -1
  121. package/src/style/themes/default/_variables.scss +0 -156
  122. package/tsconfig.json +0 -37
  123. package/tsconfig.lib.json +0 -26
  124. package/tsconfig.lib.prod.json +0 -10
  125. package/tslint.json +0 -140
@@ -1,289 +0,0 @@
1
- @import '../../../style/themes/default/variables';
2
- $color-marked: lighten($primary, 50%)!default;
3
- $label-background: lighten($primary, 50%)!default;
4
- $label-border: lighten($primary, 30%)!default;
5
-
6
- :host {
7
- display: block;
8
- }
9
- .showErrors ::ng-deep .ng-select-container {
10
- border-color: $default-warning;
11
- }
12
- :host ::ng-deep ng-select.ng-select .ng-select-container {
13
- color: $default-text-color;
14
- }
15
-
16
- :host ::ng-deep .ng-select.ng-select-opened>.ng-select-container{
17
- background:#fff;
18
- //border-color:#b3b3b3 #ccc #d9d9d9
19
- border-color: lighten($primary, 10%);
20
- }
21
- :host ::ng-deep .ng-select.ng-select-opened>.ng-select-container:hover{
22
- box-shadow:none
23
- }
24
- :host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow{
25
- top:-2px;
26
- border-color:transparent transparent #999;
27
- border-width:0 5px 5px
28
- }
29
- :host ::ng-deep .ng-select.ng-select-opened>.ng-select-container .ng-arrow:hover{
30
- border-color:transparent transparent #666
31
- }
32
- :host ::ng-deep .ng-select.ng-select-opened.ng-select-bottom>.ng-select-container{
33
- border-bottom-right-radius:0;
34
- border-bottom-left-radius:0
35
- }
36
- :host ::ng-deep .ng-select.ng-select-opened.ng-select-top>.ng-select-container{
37
- border-top-right-radius:0;
38
- border-top-left-radius:0
39
- }
40
- :host ::ng-deep .ng-select.ng-select-focused:not(.ng-select-opened)>.ng-select-container{
41
- //border-color:#007eff;
42
- //box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 0 3px rgba(0,126,255,0.1)
43
- }
44
- :host ::ng-deep .ng-select.ng-select-disabled>.ng-select-container{
45
- background-color:#f9f9f9
46
- }
47
- :host ::ng-deep .ng-select .ng-has-value .ng-placeholder{
48
- display:none
49
- }
50
- :host ::ng-deep .ng-select .ng-select-container{
51
- display: flex;
52
- flex-direction: row;
53
- background-color:#fff;
54
- border-radius:4px;
55
- border:1px solid #ccc;
56
- min-height:42px;
57
- align-items:center;
58
-
59
- background-clip: padding-box;
60
- background-color: #fff;
61
- border: 1px solid #e6ecf5;
62
- border-radius: 2px;
63
- box-shadow: none;
64
- box-sizing: border-box;
65
- color: #888da8;
66
- font-size: 1rem;
67
- font-size: 14px;
68
- //height: calc(2.25rem + 2px);
69
- line-height: 1.5;
70
- margin: 0;
71
- outline: none;
72
- overflow: visible;
73
- padding: .375rem .75rem;
74
- transition-delay: 0s;
75
- transition-duration: .2s;
76
- transition-property: all;
77
- transition-timing-function: ease-in;
78
- width: 100%;
79
- }
80
- :host ::ng-deep .ng-select .ng-select-container:hover{
81
- box-shadow:0 1px 0 rgba(0,0,0,0.06)
82
- }
83
- :host ::ng-deep .ng-select .ng-select-container .ng-value-container{
84
- align-items:center;
85
- padding-left:10px;
86
- overflow: hidden;
87
- }
88
- :host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-placeholder{
89
- color:#aaa
90
- }
91
- :host ::ng-deep .ng-select.ng-select-single .ng-select-container{
92
- height:42px;
93
- }
94
- :host ::ng-deep .ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{
95
- left:0;
96
- padding-left:10px;
97
- padding-right:50px;
98
- top:5px;
99
- }
100
- :host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value{
101
- background-color:#f9f9f9;
102
- border:1px solid #e3e3e3;
103
- }
104
- :host ::ng-deep .ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-label{
105
- padding:0px 5px
106
- }
107
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container{
108
- padding-left:7px;
109
- padding-right:10px;
110
- padding-top:2px;
111
- }
112
-
113
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{
114
- font-size:0.9em;
115
- margin-right:5px;
116
- margin-bottom:5px;
117
- background-color:$label-background;
118
- border-radius:2px;
119
- border:1px solid $label-border;
120
- display: flex;
121
- overflow: hidden;
122
- }
123
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled{
124
- background-color:#f9f9f9;
125
- border:1px solid #e3e3e3
126
- }
127
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-label{
128
- padding-left:5px
129
- }
130
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-label{
131
- display:inline-block;
132
- padding:0px 5px 0px 5px;
133
- overflow: hidden;
134
- text-overflow: ellipsis;
135
- }
136
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{
137
- display:inline-block;
138
- padding:0px 5px
139
- }
140
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon:hover{
141
- background-color:$label-border;
142
- }
143
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.left{
144
- border-right:1px solid $label-border;
145
- }
146
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon.right{
147
- border-left:1px solid #c2e0ff
148
- }
149
- :host ::ng-deep .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{
150
- padding-bottom:3px;
151
- padding-left:3px
152
- }
153
- :host ::ng-deep ng-select.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{
154
- top:5px;
155
- padding-bottom:3px;
156
- padding-left:3px;
157
- position: static;
158
- }
159
-
160
- :host ::ng-deep .ng-select .ng-clear-wrapper{
161
- color:#999
162
- }
163
- :host ::ng-deep .ng-select .ng-clear-wrapper .ng-clear:hover{
164
- color:$default-danger;
165
- }
166
- :host ::ng-deep .ng-select .ng-spinner-zone{
167
- padding-right:5px;
168
- padding-top:5px
169
- }
170
- :host ::ng-deep .ng-select .ng-arrow-wrapper{
171
- padding-right:5px;
172
- width:25px
173
- }
174
- :host ::ng-deep .ng-select .ng-arrow-wrapper:hover .ng-arrow{
175
- border-top-color:#666
176
- }
177
- :host ::ng-deep .ng-select .ng-arrow-wrapper .ng-arrow{
178
- border-color:#999 transparent transparent;
179
- border-style:solid;
180
- border-width:5px 5px 2.5px
181
- }
182
- :host ::ng-deep .ng-dropdown-panel{
183
- background-color:#fff;
184
- border:1px solid lighten($primary, 10%);
185
- box-shadow:0 1px 0 rgba(0,0,0,0.06)
186
- }
187
- :host ::ng-deep .ng-dropdown-panel.ng-select-bottom{
188
- top:100%;
189
- border-bottom-right-radius:4px;
190
- border-bottom-left-radius:4px;
191
- border-top-color:#e6e6e6;
192
- margin-top:-1px
193
- }
194
- :host ::ng-deep .ng-dropdown-panel.ng-select-bottom .ng-dropdown-panel-items .ng-option:last-child{
195
- border-bottom-right-radius:4px;
196
- border-bottom-left-radius:4px
197
- }
198
- :host ::ng-deep .ng-dropdown-panel.ng-select-top{
199
- bottom:100%;
200
- border-top-right-radius:4px;
201
- border-top-left-radius:4px;
202
- border-bottom-color:#e6e6e6;
203
- margin-bottom:-1px
204
- }
205
- :host ::ng-deep .ng-dropdown-panel.ng-select-top .ng-dropdown-panel-items .ng-option:first-child{
206
- border-top-right-radius:4px;
207
- border-top-left-radius:4px
208
- }
209
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-header{
210
- border-bottom:1px solid #ccc;
211
- padding:5px 7px
212
- }
213
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-footer{
214
- border-top:1px solid #ccc;
215
- padding:5px 7px
216
- }
217
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items{
218
- margin-bottom:1px
219
- }
220
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{
221
- user-select:none;
222
- cursor:default;
223
- padding:8px 10px;
224
- font-weight:500;
225
- color:rgba(0,0,0,0.54);
226
- cursor:pointer
227
- }
228
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-disabled{
229
- cursor:default
230
- }
231
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-marked{
232
- background-color:#ebf5ff
233
- }
234
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup.ng-option-selected{
235
- background-color:#f5faff;
236
- font-weight:600
237
- }
238
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option{
239
- background-color:#fff;
240
- color:rgba(0,0,0,0.87);
241
- padding:8px 10px
242
- }
243
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected{
244
- color:#333;
245
- background-color:$color-marked;
246
- }
247
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected .ng-option-label{
248
- font-weight:600
249
- }
250
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-marked{
251
- background-color: $color-marked;
252
- color:#333
253
- }
254
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-disabled{
255
- color:#cccccc
256
- }
257
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-child{
258
- padding-left:22px
259
- }
260
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-tag-label{
261
- padding-right:5px;
262
- font-size:80%;
263
- font-weight:400
264
- }
265
-
266
- :host ::ng-deep ng-select.ng-select .ng-select-container .ng-value-container {
267
- padding-left: 0;
268
- }
269
-
270
- :host ::ng-deep ng-select.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input {
271
- top: 9px;
272
- color: $default-text-color;
273
- }
274
-
275
- :host ::ng-deep .ng-select .ng-select-container .ng-value-container .ng-input>input {
276
- color: $default-text-color;
277
- }
278
-
279
- :host ::ng-deep .ng-dropdown-panel .ng-dropdown-panel-items .ng-option {
280
- color: $default-text-color;
281
- }
282
-
283
- :host ::ng-deep .ng-select.ng-select-auto-grow {
284
- max-width: inherit;
285
-
286
- .ng-dropdown-panel {
287
- width: auto;
288
- }
289
- }
@@ -1,44 +0,0 @@
1
- import { Component, Host, Input, OnInit, Optional } from '@angular/core';
2
- import { ControlContainer, NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import {ValueAccessorBase} from "../value-accessor-base/value-accessor-base.component";
4
- import {FormElementComponent} from "../../form/form-element/form-element.component";
5
- // import { TranslateService } from '@ngx-translate/core';
6
- // import { _ } from '~/app/util/i18n'; // TODO: translate
7
-
8
- export type AppSelectOptions = Array<{
9
- id: any;
10
- name: string;
11
- description?: string;
12
- disabled?: boolean;
13
- }>;
14
-
15
- @Component({
16
- selector: 'klp-form-select',
17
- templateUrl: './select.component.html',
18
- styleUrls: ['./select.component.scss'],
19
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
20
- })
21
- export class SelectComponent extends ValueAccessorBase<string | string[]> implements OnInit {
22
- @Input() placeholder: string;
23
- @Input() options: AppSelectOptions;
24
- @Input() multiple = false;
25
- @Input() clearable = true;
26
- @Input() public dropdownPosition: string;
27
- @Input() public customSearchFn: (term: string, item: { id: string; name: string; description: string }) => boolean;
28
-
29
- constructor(
30
- @Optional() @Host() protected parent: FormElementComponent,
31
- @Optional() @Host() protected controlContainer: ControlContainer,
32
- // private translate: TranslateService
33
- ) {
34
- super(parent, controlContainer);
35
- }
36
-
37
- ngOnInit(): void {
38
- super.ngOnInit();
39
- if (!this.placeholder) {
40
- // this.placeholder = this.translate.instant(_('Pick an option'));
41
- this.placeholder = ('Pick an option');
42
- }
43
- }
44
- }
@@ -1,23 +0,0 @@
1
- <ng-template #listItem>
2
- <li *ngFor="let item of innerValue; index as index"
3
- class="sortableItem"
4
- [ngClass]="{
5
- largeSortableItem: sortableItemSize === 'lg',
6
- smallSortableItem: sortableItemSize === 'sm'
7
- }"
8
- >
9
- <ng-container [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ item: item, index:index }" ></ng-container>
10
- </li>
11
- </ng-template>
12
-
13
- <ol *ngIf='!disabled'
14
- [sortablejs]="innerValue"
15
- [sortablejsOptions]="{ onUpdate: itemsOrderChanged }"
16
- class="itemsContainer"
17
- >
18
- <ng-container *ngTemplateOutlet="listItem"></ng-container>
19
- </ol>
20
-
21
- <ol *ngIf='disabled' class="itemsContainer disabled-mouse-cursor">
22
- <ng-container *ngTemplateOutlet="listItem"></ng-container>
23
- </ol>
@@ -1,34 +0,0 @@
1
- @import '../../../style/themes/default/variables';
2
-
3
- :host {
4
- display: block;
5
- }
6
- .itemsContainer {
7
- border: 1px solid $border-color;
8
- border-radius: $border-radius-default;
9
- padding: 0;
10
- margin-bottom: 0; // overwrite default styling for <ol>
11
- }
12
- .sortableItem {
13
- list-style: none;
14
- border-top: 1px solid $border-color;
15
- cursor: grab;
16
- &:hover {
17
- background: $default-gray-light;
18
- }
19
- &:first-child {
20
- border-top: none; // otherwise you get 2 borders, 1 from container and 1 from the topmost item
21
- }
22
- }
23
-
24
- .largeSortableItem {
25
- padding: 15px;
26
- }
27
-
28
- .smallSortableItem {
29
- padding: 0 10px;
30
- }
31
-
32
- .disabled-mouse-cursor li {
33
- cursor: no-drop;
34
- }
@@ -1,18 +0,0 @@
1
- import { Component, ContentChild, Input, TemplateRef } from '@angular/core';
2
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import {ValueAccessorBase} from "../value-accessor-base/value-accessor-base.component";
4
-
5
- @Component({
6
- selector: 'klp-form-sortable-items',
7
- templateUrl: './sortable-items.component.html',
8
- styleUrls: ['./sortable-items.component.scss'],
9
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SortableItemsComponent, multi: true }],
10
- })
11
- export class SortableItemsComponent extends ValueAccessorBase<Array<any>> {
12
- @ContentChild(TemplateRef) template;
13
- @Input() sortableItemSize: 'sm' | 'lg' = 'lg';
14
-
15
- itemsOrderChanged = () => {
16
- this.setInnerValueAndNotify(this.innerValue);
17
- };
18
- }
@@ -1,10 +0,0 @@
1
- <input
2
- [type]="type"
3
- class="form-control"
4
- [ngClass]="{showErrors: isInErrorState()}"
5
- [(ngModel)]="innerValue"
6
- (input)="setInnerValueAndNotify($event.target.value)"
7
- [placeholder]="placeholder ? placeholder : ''"
8
- (blur)="touch()"
9
- [disabled]='disabled'
10
- />
@@ -1,15 +0,0 @@
1
- @import '../../../style/themes/default/variables';
2
- @import '../../../style/mixins';
3
-
4
- :host {
5
- display: block;
6
- }
7
-
8
- input {
9
- outline: none;
10
- @include formControl();
11
- }
12
-
13
- .showErrors {
14
- border-color: $default-warning;
15
- }
@@ -1,14 +0,0 @@
1
- import { Component, Input } from '@angular/core';
2
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import {ValueAccessorBase} from "../value-accessor-base/value-accessor-base.component";
4
-
5
- @Component({
6
- selector: 'klp-form-text-input',
7
- templateUrl: './text-input.component.html',
8
- styleUrls: ['./text-input.component.scss'],
9
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }],
10
- })
11
- export class TextInputComponent extends ValueAccessorBase<string> {
12
- @Input() placeholder: string;
13
- @Input() type: 'text' | 'password' = 'text';
14
- }
@@ -1,9 +0,0 @@
1
- <div class="componentContainer" [ngClass]="{disabled: disabled}">
2
- <input type="checkbox" class="nativeCheckbox"
3
- [(ngModel)]="innerValue"
4
- (input)="setInnerValueAndNotify($event.target.checked); touch()"
5
- [disabled]="disabled"
6
- [ngClass]="{showErrors: isInErrorState()}"
7
- />
8
- <div class="toggleVisual"></div>
9
- </div>
@@ -1,78 +0,0 @@
1
- @import '../../../style/themes/default/variables';
2
- @import '../../../style/mixins';
3
-
4
- $width: 35px;
5
- $height: 20px;
6
-
7
- :host {
8
- display: block;
9
- }
10
- .componentContainer {
11
- position: relative;
12
- }
13
- .nativeCheckbox {
14
- position: absolute;
15
- opacity: 0;
16
- top: 0;
17
- left: 0;
18
- width: $width;
19
- height: $height;
20
- cursor: pointer;
21
- }
22
-
23
- .toggleVisual {
24
- pointer-events: none;
25
- position: relative;
26
- display: block;
27
- @include transition(0.4s ease);
28
- width: $width;
29
- height: $height;
30
- border: 1px solid $border-color;
31
- border-radius: $width;
32
-
33
- &:before {
34
- content: '';
35
- position: absolute;
36
- display: block;
37
- @include transition(0.2s cubic-bezier(0.24, 0, 0.5, 1));
38
- margin: 1px;
39
- width: $width - 2px;
40
- height: $height - 2px;
41
- top: -1px;
42
- left: -1px;
43
- border-radius: 30px;
44
- }
45
-
46
- &:after {
47
- content: '';
48
- position: absolute;
49
- display: block;
50
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 0px 0 rgba(0, 0, 0, 0.04), 0 4px 9px rgba(0, 0, 0, 0.13), 0 3px 3px rgba(0, 0, 0, 0.05);
51
- @include transition(0.35s cubic-bezier(0.54, 1.6, 0.5, 1));
52
- background: darken($default-white, 3%);
53
- height: $height;
54
- width: $height; // using height here because we want the knob to be as same width as height
55
- top: -1px;
56
- left: 0;
57
- border-radius: 60px;
58
- }
59
- }
60
-
61
- .nativeCheckbox:checked {
62
- + .toggleVisual {
63
- &:before {
64
- background: $default-success;
65
- @include transition(width 0.2s cubic-bezier(0, 0, 0, 0.1));
66
- }
67
- &:after {
68
- left: 18px;
69
- }
70
- }
71
- }
72
-
73
- .disabled {
74
- opacity: 0.6;
75
- }
76
- .showErrors + .toggleVisual:before {
77
- border: 1px solid $default-warning;
78
- }
@@ -1,11 +0,0 @@
1
- import { Component, Input } from '@angular/core';
2
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
- import {ValueAccessorBase} from "../value-accessor-base/value-accessor-base.component";
4
-
5
- @Component({
6
- selector: 'klp-form-toggle',
7
- templateUrl: './toggle.component.html',
8
- styleUrls: ['./toggle.component.scss'],
9
- providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: ToggleComponent, multi: true }],
10
- })
11
- export class ToggleComponent extends ValueAccessorBase<boolean> {}
@@ -1,89 +0,0 @@
1
- import { ControlContainer, ControlValueAccessor, FormControl } from '@angular/forms';
2
- import { Component, Host, Input, Optional } from '@angular/core';
3
- import { FormElementComponent } from '../../form/form-element/form-element.component';
4
- import { isNullOrUndefined, stringIsSetAndNotEmpty } from '../../util/values';
5
-
6
- /**
7
- * This component is a base in order to create a component that supports ngModel.
8
- * Some important things to know about it:
9
- *
10
- * innerValue = your own inner state, which you should use to store the current state of what ngModel should be.
11
- * writeValue() = called by angular, when ngModel is changed from OUTSIDE of the component. Feel free to patch this method if you need inner logic to happen when ngModel is altered from the outside. Always remember to also call the super.writeValue if you do!
12
- * setInnerValueAndNotify() = call this when you want your ngModel to be updated from INSIDE of your component, and provide it to the OUTSIDE.
13
- * ngOnInit() = Used to support the angular reactive forms framework. If you use ngOnInit in your own component (which happens fairly often) you must not forget to call the super.ngOnInit() method.
14
- */
15
-
16
- @Component({
17
- selector: '',
18
- template: '',
19
- })
20
- export class ValueAccessorBase<T> implements ControlValueAccessor {
21
- public innerValue: T;
22
- public changed = new Array<(value: T) => void>();
23
- private touched = new Array<() => void>();
24
-
25
- @Input() public disabled = false;
26
- // we support both providing just the formControlName and the full formControl
27
- @Input() public formControlName: string = null;
28
- @Input() public formControl: FormControl = null;
29
-
30
- private attachedFormControl: FormControl;
31
-
32
- constructor(
33
- @Host() @Optional() protected parent: FormElementComponent,
34
- @Host() @Optional() protected controlContainer: ControlContainer
35
- ) {}
36
-
37
- ngOnInit() {
38
- if (this.formControl) {
39
- this.attachedFormControl = this.formControl;
40
- } else if (stringIsSetAndNotEmpty(this.formControlName)) {
41
- this.attachedFormControl = this.controlContainer?.control.get(this.formControlName) as FormControl;
42
- if (isNullOrUndefined(this.attachedFormControl)) {
43
- throw new Error(`Form element '${this.formControlName}' with caption '${this.parent?.caption}' is not declared in your FormGroup.`);
44
- }
45
- }
46
- if (this.attachedFormControl) {
47
- this.disabled = this.attachedFormControl.disabled;
48
- this.attachedFormControl.statusChanges.subscribe(() => {
49
- this.disabled = this.attachedFormControl.disabled;
50
- });
51
- this.parent?.registerControl(this.attachedFormControl);
52
- }
53
- }
54
-
55
- isInErrorState() {
56
- return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
57
- }
58
-
59
- ngOnDestroy() {
60
- if (this.attachedFormControl) {
61
- this.parent?.unregisterControl(this.attachedFormControl);
62
- }
63
- }
64
-
65
- touch() {
66
- this.touched.forEach((f) => f());
67
- }
68
-
69
- writeValue(value: T) {
70
- this.innerValue = value;
71
- }
72
-
73
- registerOnChange(fn: (value: T) => void) {
74
- this.changed.push(fn);
75
- }
76
-
77
- registerOnTouched(fn: () => void) {
78
- this.touched.push(fn);
79
- }
80
-
81
- setInnerValueAndNotify(value) {
82
- this.innerValue = value;
83
- this.changed.forEach((fn) => fn(value));
84
- }
85
-
86
- resetToNull() {
87
- this.setInnerValueAndNotify(null);
88
- }
89
- }
@@ -1,3 +0,0 @@
1
- <ng-template #contentRef>
2
- <ng-content></ng-content>
3
- </ng-template>
@@ -1,3 +0,0 @@
1
- :host {
2
- display: block;
3
- }
@@ -1,28 +0,0 @@
1
- import { Component, ElementRef, Host, OnInit, Optional, ViewChild } from '@angular/core';
2
- import {FormElementComponent} from "../form-element/form-element.component";
3
- import {isNullOrUndefined} from "../../util/values";
4
-
5
- @Component({
6
- selector: 'klp-form-caption',
7
- templateUrl: './form-caption.component.html',
8
- styleUrls: ['./form-caption.component.scss'],
9
- })
10
- export class FormCaptionComponent implements OnInit {
11
- @ViewChild('contentRef') public contentRef: ElementRef;
12
-
13
- constructor(@Host() @Optional() private parent: FormElementComponent) {}
14
-
15
- ngOnInit(): void {
16
- // this is being run next cycle, because we dont want to fail if the order of components is as follows:
17
- // <app-form-error />
18
- // <some-input />
19
- // That would fail, because the logic of the form error is run first, and at that moment, the `some-input` isnt registered yet
20
- setTimeout(() => {
21
- const attachedControl = this.parent.getAttachedControl();
22
- this.parent.registerCaption(this.contentRef);
23
- if (isNullOrUndefined(attachedControl)) {
24
- throw new Error('You added a Form Caption component without an attached Form Control');
25
- }
26
- });
27
- }
28
- }