@masterkeymaterial/ui 0.0.1 → 0.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 (141) hide show
  1. package/README.md +9 -59
  2. package/ng-package.json +10 -0
  3. package/package.json +5 -14
  4. package/src/elements/ui-button/ui-button.css +229 -0
  5. package/src/elements/ui-button/ui-button.html +12 -0
  6. package/src/elements/ui-button/ui-button.ts +133 -0
  7. package/src/elements/ui-check-box/ui-check-box.css +66 -0
  8. package/src/elements/ui-check-box/ui-check-box.html +5 -0
  9. package/src/elements/ui-check-box/ui-check-box.ts +65 -0
  10. package/src/elements/ui-chip/ui-chip.css +24 -0
  11. package/src/elements/ui-chip/ui-chip.html +3 -0
  12. package/src/elements/ui-chip/ui-chip.ts +25 -0
  13. package/src/elements/ui-drop-zone/ui-drop-zone.css +91 -0
  14. package/src/elements/ui-drop-zone/ui-drop-zone.html +8 -0
  15. package/src/elements/ui-drop-zone/ui-drop-zone.ts +153 -0
  16. package/src/elements/ui-file-list/ui-file-list.css +43 -0
  17. package/src/elements/ui-file-list/ui-file-list.html +17 -0
  18. package/src/elements/ui-file-list/ui-file-list.ts +22 -0
  19. package/src/elements/ui-list-errors/ui-list-errors.css +30 -0
  20. package/src/elements/ui-list-errors/ui-list-errors.html +10 -0
  21. package/src/elements/ui-list-errors/ui-list-errors.ts +14 -0
  22. package/src/elements/ui-loading/ui-loading.css +13 -0
  23. package/src/elements/ui-loading/ui-loading.html +1 -0
  24. package/src/elements/ui-loading/ui-loading.ts +10 -0
  25. package/src/elements/ui-menu/ui-menu.css +69 -0
  26. package/src/elements/ui-menu/ui-menu.html +20 -0
  27. package/src/elements/ui-menu/ui-menu.ts +267 -0
  28. package/src/elements/ui-procurar/ui-procurar.css +48 -0
  29. package/src/elements/ui-procurar/ui-procurar.html +14 -0
  30. package/src/elements/ui-procurar/ui-procurar.ts +82 -0
  31. package/src/elements/ui-progress/ui-progress.css +0 -0
  32. package/src/elements/ui-progress/ui-progress.html +1 -0
  33. package/src/elements/ui-progress/ui-progress.ts +15 -0
  34. package/src/elements/ui-select/ui-select.css +211 -0
  35. package/src/elements/ui-select/ui-select.html +46 -0
  36. package/src/elements/ui-select/ui-select.ts +482 -0
  37. package/src/elements/ui-slide/ui-slide.css +75 -0
  38. package/src/elements/ui-slide/ui-slide.html +7 -0
  39. package/src/elements/ui-slide/ui-slide.ts +61 -0
  40. package/src/fields/Base/BaseFieldsForm/BaseFieldsForm.component.ts +113 -0
  41. package/src/fields/Base/BaseFieldsValues/BaseFieldsValues.ts +112 -0
  42. package/src/fields/Formulario/Formulario.ts +1056 -0
  43. package/src/fields/Formulario/form-action/form-action.css +98 -0
  44. package/src/fields/Formulario/form-action/form-action.html +75 -0
  45. package/src/fields/Formulario/form-action/form-action.ts +187 -0
  46. package/src/fields/Formulario/form-controls/form-controls.css +108 -0
  47. package/src/fields/Formulario/form-controls/form-controls.html +105 -0
  48. package/src/fields/Formulario/form-controls/form-controls.ts +122 -0
  49. package/src/fields/Formulario/form-fase/form-fase.css +84 -0
  50. package/src/fields/Formulario/form-fase/form-fase.html +24 -0
  51. package/src/fields/Formulario/form-fase/form-fase.ts +157 -0
  52. package/src/fields/Formulario/form-filter/form-filter.css +50 -0
  53. package/src/fields/Formulario/form-filter/form-filter.html +25 -0
  54. package/src/fields/Formulario/form-filter/form-filter.ts +53 -0
  55. package/src/fields/Formulario/form-no-action/form-no-action.css +32 -0
  56. package/src/fields/Formulario/form-no-action/form-no-action.html +12 -0
  57. package/src/fields/Formulario/form-no-action/form-no-action.ts +21 -0
  58. package/src/fields/Formulario/formated-values/formated-values.css +104 -0
  59. package/src/fields/Formulario/formated-values/formated-values.html +15 -0
  60. package/src/fields/Formulario/formated-values/formated-values.ts +186 -0
  61. package/src/fields/Formulario/single-values/single-values.css +88 -0
  62. package/src/fields/Formulario/single-values/single-values.html +11 -0
  63. package/src/fields/Formulario/single-values/single-values.ts +65 -0
  64. package/src/fields/autocomplete/autocomplete.css +94 -0
  65. package/src/fields/autocomplete/autocomplete.html +38 -0
  66. package/src/fields/autocomplete/autocomplete.ts +294 -0
  67. package/src/fields/button/button.css +7 -0
  68. package/src/fields/button/button.html +19 -0
  69. package/src/fields/button/button.ts +38 -0
  70. package/src/fields/checkbox/checkbox.css +27 -0
  71. package/src/fields/checkbox/checkbox.html +20 -0
  72. package/src/fields/checkbox/checkbox.ts +44 -0
  73. package/src/fields/color/CirculoColorido/circulocolorido.css +50 -0
  74. package/src/fields/color/CirculoColorido/circulocolorido.html +8 -0
  75. package/src/fields/color/CirculoColorido/circulocolorido.ts +24 -0
  76. package/src/fields/color/color.css +15 -0
  77. package/src/fields/color/color.html +24 -0
  78. package/src/fields/color/color.ts +47 -0
  79. package/src/fields/date/date.html +19 -0
  80. package/src/fields/date/date.ts +29 -0
  81. package/src/fields/datetime/datetime.html +19 -0
  82. package/src/fields/datetime/datetime.ts +29 -0
  83. package/src/fields/display/display.css +7 -0
  84. package/src/fields/display/display.html +20 -0
  85. package/src/fields/display/display.ts +43 -0
  86. package/src/fields/editor/editor.css +51 -0
  87. package/src/fields/editor/editor.html +37 -0
  88. package/src/fields/editor/editor.ts +218 -0
  89. package/src/fields/email/email.html +19 -0
  90. package/src/fields/email/email.ts +29 -0
  91. package/src/fields/fields.css +180 -0
  92. package/src/fields/generic/generic.html +3 -0
  93. package/src/fields/generic/generic.ts +91 -0
  94. package/src/fields/hidden/hidden.html +3 -0
  95. package/src/fields/hidden/hidden.ts +20 -0
  96. package/src/fields/icon/icon.css +19 -0
  97. package/src/fields/icon/icon.html +27 -0
  98. package/src/fields/icon/icon.ts +31 -0
  99. package/src/fields/multifactor/multifactor.css +21 -0
  100. package/src/fields/multifactor/multifactor.html +39 -0
  101. package/src/fields/multifactor/multifactor.ts +106 -0
  102. package/src/fields/multikv/multikv.css +43 -0
  103. package/src/fields/multikv/multikv.html +47 -0
  104. package/src/fields/multikv/multikv.ts +88 -0
  105. package/src/fields/multitext/multitext.css +36 -0
  106. package/src/fields/multitext/multitext.html +38 -0
  107. package/src/fields/multitext/multitext.ts +75 -0
  108. package/src/fields/number/number.html +20 -0
  109. package/src/fields/number/number.ts +35 -0
  110. package/src/fields/password/password.html +23 -0
  111. package/src/fields/password/password.ts +37 -0
  112. package/src/fields/search/search.css +0 -0
  113. package/src/fields/search/search.html +19 -0
  114. package/src/fields/search/search.ts +54 -0
  115. package/src/fields/select/select.css +15 -0
  116. package/src/fields/select/select.html +18 -0
  117. package/src/fields/select/select.ts +52 -0
  118. package/src/fields/slide/slide.css +27 -0
  119. package/src/fields/slide/slide.html +20 -0
  120. package/src/fields/slide/slide.ts +45 -0
  121. package/src/fields/text/text.html +19 -0
  122. package/src/fields/text/text.ts +30 -0
  123. package/src/fields/textarea/textarea.css +4 -0
  124. package/src/fields/textarea/textarea.html +20 -0
  125. package/src/fields/textarea/textarea.ts +31 -0
  126. package/src/fields/time/time.html +19 -0
  127. package/src/fields/time/time.ts +29 -0
  128. package/src/fields/upload/upload.css +24 -0
  129. package/src/fields/upload/upload.html +41 -0
  130. package/src/fields/upload/upload.ts +137 -0
  131. package/src/interfaces/interfaces.ts +61 -0
  132. package/src/public-api.ts +38 -0
  133. package/src/util/ClassOf.pipe.ts +11 -0
  134. package/src/util/JsonColorido.pipe.ts +11 -0
  135. package/src/util/util.ts +2151 -0
  136. package/tsconfig.lib.json +16 -0
  137. package/tsconfig.lib.prod.json +9 -0
  138. package/tsconfig.spec.json +13 -0
  139. package/fesm2022/masterkeymaterial-ui.mjs +0 -6457
  140. package/fesm2022/masterkeymaterial-ui.mjs.map +0 -1
  141. package/types/masterkeymaterial-ui.d.ts +0 -928
@@ -0,0 +1,75 @@
1
+ import { Component, effect, OnInit } from '@angular/core';
2
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
3
+ import { UiButton } from "../../elements/ui-button/ui-button";
4
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
5
+
6
+ @Component({
7
+ selector: 'fields-multitext',
8
+ templateUrl: './multitext.html',
9
+ styleUrls: ['../fields.css', './multitext.css'],
10
+ imports: [UiButton, UiListErrors],
11
+ })
12
+ export class FieldsMultiText extends BaseFieldsForm implements OnInit {
13
+
14
+ items: string[] | null = [];
15
+
16
+ constructor() {
17
+ super();
18
+ effect(() => {
19
+ const val = this.value();
20
+ let empty = val === null || val === undefined || val === '';
21
+ if (val && Array.isArray(val) && val.length <= 0) empty = true;
22
+ // if (!Array.isArray(val)) errors = [...errors, Valide.msg.apenasLista];
23
+ this.updateCampo({ empty });
24
+ });
25
+ }
26
+
27
+ override ngOnInit() {
28
+ super.ngOnInit();
29
+ let value = this.value();
30
+ if (value && Array.isArray(value)) this.items = value ?? [];
31
+ else this.items = [];
32
+ }
33
+
34
+ ngAfterViewInit(): void {
35
+ this.updateValue(this.items ?? [], false);
36
+ }
37
+
38
+ onInput(newValue: string) {
39
+ this.updateValue(newValue);
40
+ this.campo()?.onInput?.(this.form());
41
+ this.onChangeEmit();
42
+ }
43
+
44
+ onClickAddItem() {
45
+ let value = "";
46
+ if (!this.items) this.items = [];
47
+ this.items = [...this.items, value];
48
+ this.updateValue(this.items);
49
+ this.campo()?.onInput?.(this.form());
50
+ this.onChangeEmit();
51
+
52
+ setTimeout(() => {
53
+ let allInputs = (document.querySelectorAll(`.FieldMultiText .input`) as NodeListOf<HTMLInputElement> | null);
54
+ if (allInputs && allInputs.length > 0) {
55
+ allInputs[allInputs.length - 1].focus();
56
+ }
57
+ }, 1);
58
+ }
59
+
60
+ onClickDelItem(index: number) {
61
+ this.items = this.items?.filter((v, i) => i != index) ?? [];
62
+ if (this.items && this.items?.length <= 0) this.items = [];
63
+ this.updateValue(this.items);
64
+ this.campo()?.onInput?.(this.form());
65
+ this.onChangeEmit();
66
+ }
67
+
68
+ _onLocalInput(value: string, index: number) {
69
+ if (this.items) this.items[index] = value;
70
+ this.updateValue(this.items);
71
+ this.campo()?.onInput?.(this.form());
72
+ this.onChangeEmit();
73
+ }
74
+
75
+ }
@@ -0,0 +1,20 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldText">
11
+ <input type="number" [value]="value()" (input)="onInput($event.target.value)" (change)="onChangeEmit()"
12
+ [name]="campo()?.prop" [disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''"
13
+ [attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class]="campo()?.classe"
14
+ [style]="campo()?.style" [readOnly]="campo()?.readonly ?? false" [class.outlined]="true"
15
+ [class.input]="true" />
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
20
+ </div>
@@ -0,0 +1,35 @@
1
+ import { Component, effect } from '@angular/core';
2
+ import { LibUtil } from '../../util/util';
3
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
4
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
5
+
6
+ @Component({
7
+ selector: 'fields-number',
8
+ templateUrl: './number.html',
9
+ styleUrls: ['../fields.css'],
10
+ imports: [UiListErrors],
11
+ })
12
+ export class FieldsNumber extends BaseFieldsForm {
13
+
14
+ constructor() {
15
+ super();
16
+ effect(() => {
17
+ const val = this.value();
18
+ let empty = val === null || val === undefined || val === '' || val === 0;
19
+ this.updateCampo({ empty });
20
+ });
21
+ }
22
+
23
+ ngAfterViewInit(): void {
24
+ this.onInput(this.value(), false);
25
+ }
26
+
27
+ onInput(newValue: string, touch: boolean = true) {
28
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
29
+ let num = parseFloat(newValue);
30
+ if (isNaN(num)) num = 0;
31
+ this.updateValue(num, touch);
32
+ this.campo()?.onInput?.(this.form());
33
+ }
34
+
35
+ }
@@ -0,0 +1,23 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldPassword">
11
+ <input [type]="hide() ? 'password' : 'text'" [value]="value()" (input)="onInput($event.target.value)"
12
+ (change)="onChangeEmit()" [name]="campo()?.prop" [disabled]="campo()?.disabled"
13
+ [placeholder]="campo()?.placeholder ?? ''" [class]="campo()?.classe" [style]="campo()?.style"
14
+ [attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class.outlined]="true"
15
+ [class.input]="true" />
16
+ <ui-button tipo="icon" tema="primary" (click)="_aoClicarVerSenha($event)" aria-label="Oculta ou Exibe Senha"
17
+ title="Oculta ou Exibe Senha" [aria-pressed]="hide()"><i
18
+ [class]="hide() ? 'bi bi-eye-slash-fill' : 'bi bi-eye-fill'"></i></ui-button>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
23
+ </div>
@@ -0,0 +1,37 @@
1
+ import { Component, effect, signal } from '@angular/core';
2
+ import { LibUtil } from '../../util/util';
3
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
4
+ import { UiButton } from "../../elements/ui-button/ui-button";
5
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
6
+
7
+ @Component({
8
+ selector: 'fields-password',
9
+ templateUrl: './password.html',
10
+ styleUrls: ['../fields.css'],
11
+ imports: [UiButton, UiListErrors],
12
+ })
13
+ export class FieldsPassword extends BaseFieldsForm {
14
+
15
+ constructor() {
16
+ super();
17
+ effect(() => {
18
+ const val = this.value();
19
+ let empty = val === null || val === undefined || val === '';
20
+ this.updateCampo({ empty });
21
+ });
22
+ }
23
+
24
+ onInput(newValue: string) {
25
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
26
+ this.updateValue(newValue);
27
+ this.campo()?.onInput?.(this.form());
28
+ }
29
+
30
+ // Exibir e Ocultar Senha
31
+ hide = signal(true);
32
+ _aoClicarVerSenha(event: MouseEvent) {
33
+ this.hide.set(!this.hide());
34
+ event.stopPropagation();
35
+ }
36
+ }
37
+
File without changes
@@ -0,0 +1,19 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty"
4
+ [class.isCollapsed]="isCollapsed()">
5
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
6
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
7
+ {{ campo()?.titulo }}
8
+ </div>
9
+ <div class="fieldControl doCampo">
10
+ <div class="fieldEffect">
11
+ <div class="fieldField FieldSearch">
12
+ <ui-procurar [value]="value()" [name]="campo()?.prop" (inputed)="onInput($event)" (changed)="onChangeEmit()"
13
+ [colapsed]="isCollapsed()" [disabled]="campo()?.disabled"
14
+ [placeholder]="campo()?.placeholder ?? 'Procurar...'"></ui-procurar>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
19
+ </div>
@@ -0,0 +1,54 @@
1
+ import { Component, computed, effect, ElementRef, viewChild } from '@angular/core';
2
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
3
+ import { UiProcurar } from "../../elements/ui-procurar/ui-procurar";
4
+ import { LibUtil } from '../../util/util';
5
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
6
+
7
+ @Component({
8
+ selector: 'fields-search',
9
+ templateUrl: './search.html',
10
+ styleUrls: ['../fields.css', './search.css'],
11
+ imports: [UiListErrors, UiProcurar],
12
+ })
13
+ export class FieldsSearch extends BaseFieldsForm {
14
+
15
+ readonly searchInput = viewChild<ElementRef>('searchInput');
16
+
17
+ isCollapsed = computed(() => this.campo()?.isCollapsed?.() ?? false);
18
+
19
+ constructor() {
20
+ super();
21
+ effect(() => {
22
+ const val = this.value();
23
+ let empty = val === null || val === undefined || val === '';
24
+ this.updateCampo({ empty });
25
+ });
26
+ }
27
+
28
+ onInput(newValue: string) {
29
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
30
+ this.updateValue(newValue);
31
+ this.campo()?.onInput?.(this.form());
32
+ }
33
+
34
+ // Limpa o filtro de opções
35
+ onClearSearch() {
36
+ this.updateValue("");
37
+ this.focusSearchInput();
38
+ this.campo()?.onInput?.(this.form());
39
+ this.onChangeEmit();
40
+ }
41
+
42
+ focusSearchInput() {
43
+ this.searchInput()?.nativeElement?.focus();
44
+ }
45
+
46
+ onClickSearchIcon() {
47
+ this.focusSearchInput();
48
+ this.onChangeEmit();
49
+ }
50
+
51
+ onSearch() {
52
+ this.onChangeEmit();
53
+ }
54
+ }
@@ -0,0 +1,15 @@
1
+ .FieldSelect {
2
+ width: 100%;
3
+ padding: 0 4px 0 8px;
4
+ }
5
+
6
+ .FieldSelect ui-select {
7
+ width: 100%;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ }
12
+
13
+ .fieldField:has(ui-select.opened) {
14
+ outline: 2px solid var(--campoCor);
15
+ }
@@ -0,0 +1,18 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldSelect">
11
+ <ui-select [value]="this.value()" [options]="fieldOptions()" (changed)="onChange($event)"
12
+ [multiple]="this.campo()?.multiple ?? false" [name]="this.campo()?.prop" [textEmpty]="this.campo()?.textEmpty"
13
+ [canUnselect]="campo()?.canUnselect"></ui-select>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
18
+ </div>
@@ -0,0 +1,52 @@
1
+ import { Component, computed, effect, OnInit, signal } from '@angular/core';
2
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
3
+ import { UiSelect } from '../../elements/ui-select/ui-select';
4
+ import { IOptionValue } from '../../elements/ui-select/ui-select';
5
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
6
+ import { LOG } from '../../util/util';
7
+
8
+
9
+ @Component({
10
+ selector: 'fields-select',
11
+ templateUrl: './select.html',
12
+ styleUrls: ['../fields.css', './select.css'],
13
+ imports: [UiSelect, UiListErrors],
14
+ })
15
+ export class FieldsSelect extends BaseFieldsForm {
16
+
17
+
18
+ constructor() {
19
+ super();
20
+ effect(() => {
21
+ const val = this.value();
22
+ let empty = val === null || val === undefined || val === '';
23
+ this.updateCampo({ empty });
24
+ });
25
+ }
26
+ // Um Refill pode estar em andamento enquanto este componente é iniciado.
27
+ // Utilize o campo.mapear ou campo.refill para alterar o comportamento do refill inicial.
28
+
29
+
30
+ fieldOptions = computed(() => {
31
+ return this.campo()?.options?.() ?? [];
32
+ });
33
+
34
+
35
+ // Manipula mudança de valor (valueOfK não chegará nulo ou undefined)
36
+ onChange(optionValue: IOptionValue) {
37
+ let newValue: any = optionValue.keys;
38
+
39
+ if (this.campo()?.onMatchOption && optionValue.optionChanged) {
40
+ try {
41
+ this.campo()?.onMatchOption?.(this.form(), optionValue.optionChanged);
42
+ } catch (err) {
43
+ LOG(1, `❌ Erro ao executar onMatchOption do campo '${this.name()}'`, err);
44
+ }
45
+ }
46
+
47
+ this.updateValue(newValue);
48
+ this.campo()?.onInput?.(this.form());
49
+ this.onChangeEmit();
50
+ }
51
+
52
+ }
@@ -0,0 +1,27 @@
1
+ .FieldSlide {
2
+ padding-left: 4px;
3
+ display: flex;
4
+ flex-wrap: nowrap;
5
+ align-items: center;
6
+ transition: outline 0s;
7
+ transition-delay: 0.2s;
8
+ }
9
+
10
+ .tituloClicavel {
11
+ display: flex;
12
+ align-items: center;
13
+ padding-left: 8px;
14
+ padding-right: 8px;
15
+ font-size: 0.875rem;
16
+ cursor: pointer;
17
+ user-select: none;
18
+ flex: 1;
19
+ line-height: 30px;
20
+ text-align: var(--ui-text-align, center);
21
+ }
22
+
23
+ .FieldSlide:has(ui-slide.focused) {
24
+ outline: 2px solid var(--sys-primary);
25
+ transition: outline 0s;
26
+
27
+ }
@@ -0,0 +1,20 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldSlide microPos4">
11
+ <ui-slide [value]="value()" (changed)="onChange($event)" [focus]="signalFocus()"></ui-slide>
12
+ <div class="tituloClicavel" (click)="toogleAtivo()">
13
+ {{ value() ? (campo()?.textoAtivo ?? campo()?.tituloClicavel ) : (campo()?.textoInativo ??
14
+ campo()?.tituloClicavel) }}
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
20
+ </div>
@@ -0,0 +1,45 @@
1
+ import { AfterViewInit, Component, effect, signal } from '@angular/core';
2
+ import { UiSlide } from '../../elements/ui-slide/ui-slide';
3
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
4
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
5
+
6
+ @Component({
7
+ selector: 'fields-slide',
8
+ templateUrl: './slide.html',
9
+ styleUrls: ['../fields.css', './slide.css'],
10
+ imports: [UiSlide, UiListErrors],
11
+ })
12
+ export class FieldsSlide extends BaseFieldsForm implements AfterViewInit {
13
+
14
+ signalFocus = signal<boolean>(false);
15
+
16
+ constructor() {
17
+ super();
18
+ effect(() => {
19
+ const val = this.value();
20
+ let empty = val === null || val === undefined || val === '';
21
+ this.updateCampo({ empty });
22
+ });
23
+ }
24
+
25
+ onChange(newValue: boolean) {
26
+ this.updateValue(newValue);
27
+ this.campo()?.onInput?.(this.form());
28
+ this.onChangeEmit();
29
+ }
30
+
31
+ ngAfterViewInit(): void {
32
+ let val = this.value();
33
+ this.updateValue(val === true || val === 'true' || val === 1 || val === '1', false);
34
+ }
35
+
36
+ toogleAtivo() {
37
+ this.onChange(!this.value());
38
+ this.signalFocus.set(true);
39
+ setTimeout(() => {
40
+ this.signalFocus.set(false);
41
+ }, 1)
42
+ }
43
+
44
+
45
+ }
@@ -0,0 +1,19 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldText">
11
+ <input type="text" [value]="value() ?? ''" (input)="onInput($event.target.value)" (change)="onChangeEmit()"
12
+ [name]="campo()?.prop" [disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''"
13
+ [attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class]="campo()?.classe"
14
+ [style]="campo()?.style" [class.outlined]="true" [class.input]="true" />
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
19
+ </div>
@@ -0,0 +1,30 @@
1
+ import { Component, effect } from '@angular/core';
2
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
3
+ import { LibUtil } from '../../util/util';
4
+ import { UiListErrors } from '../../elements/ui-list-errors/ui-list-errors';
5
+
6
+ @Component({
7
+ selector: 'fields-text',
8
+ templateUrl: './text.html',
9
+ styleUrls: ['../fields.css'],
10
+ imports: [UiListErrors]
11
+ })
12
+ export class FieldsText extends BaseFieldsForm {
13
+
14
+ constructor() {
15
+ super();
16
+ effect(() => {
17
+ const val = this.value();
18
+ let empty = val === null || val === undefined || val === '';
19
+ this.updateCampo({ empty });
20
+ });
21
+ }
22
+
23
+ onInput(newValue: string) {
24
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
25
+ this.updateValue(newValue);
26
+ this.campo()?.onInput?.(this.form());
27
+
28
+ }
29
+
30
+ }
@@ -0,0 +1,4 @@
1
+ .FieldTextArea {
2
+ padding: 0.5rem 0;
3
+ line-height: 22px;
4
+ }
@@ -0,0 +1,20 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldTextArea">
11
+ <textarea [value]="value()" (input)="onInput($event)" (change)="onChangeEmit()" [name]="campo()?.prop"
12
+ [disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''" [attr.maxLength]="campo()?.maxl"
13
+ [attr.minLength]="campo()?.minl" [class]="campo()?.classe" [style]="campo()?.style" [class.outlined]="true"
14
+ [rows]="campo()?.rows ?? 5" [cols]="campo()?.cols" [attr.readonly]="campo()?.readonly ? true : null"
15
+ [class.input]="true"></textarea>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
20
+ </div>
@@ -0,0 +1,31 @@
1
+ import { Component, effect } from '@angular/core';
2
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
3
+ import { LibUtil } from '../../util/util';
4
+ import { UiListErrors } from '../../elements/ui-list-errors/ui-list-errors';
5
+
6
+ @Component({
7
+ selector: 'fields-textarea',
8
+ templateUrl: './textarea.html',
9
+ styleUrls: ['../fields.css', './textarea.css'],
10
+ imports: [UiListErrors]
11
+ })
12
+ export class FieldsTextarea extends BaseFieldsForm {
13
+
14
+ constructor() {
15
+ super();
16
+ effect(() => {
17
+ const val = this.value();
18
+ let empty = val === null || val === undefined || val === '';
19
+ this.updateCampo({ empty });
20
+ });
21
+ }
22
+
23
+ onInput(event: Event) {
24
+ let newValue = (event.target as HTMLTextAreaElement).value;
25
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
26
+ this.updateValue(newValue);
27
+ this.campo()?.onInput?.(this.form());
28
+
29
+ }
30
+
31
+ }
@@ -0,0 +1,19 @@
1
+ <div class="fieldContainer" [class.isTouched]="campo()?.touched" [class.showTouched]="form().showTouched()"
2
+ [class.isInvalid]="campo()?.invalid" [class.isDisabled]="campo()?.disabled" [class.isReadonly]="campo()?.readonly"
3
+ [class.isNeed]="campo()?.need" [class.isPending]="campo()?.pending" [class.isEmpty]="campo()?.empty">
4
+ <div class="fieldLabel" (click)="onClickLabel()" [class.hideLabel]="campo()?.hideLabel">
5
+ @if(campo()?.icone){ <div class="fieldIcon"><i [class]="campo()?.icone"></i></div> }
6
+ {{ campo()?.titulo }}
7
+ </div>
8
+ <div class="fieldControl doCampo">
9
+ <div class="fieldEffect">
10
+ <div class="fieldField FieldTime">
11
+ <input type="time" [value]="value()" (input)="onInput($event.target.value)" (change)="onChangeEmit()"
12
+ [name]="campo()?.prop" [disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''"
13
+ [attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class]="campo()?.classe"
14
+ [style]="campo()?.style" [class.outlined]="true" [class.input]="true" />
15
+ </div>
16
+ </div>
17
+ </div>
18
+ <ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
19
+ </div>
@@ -0,0 +1,29 @@
1
+ import { Component, effect } from '@angular/core';
2
+ import { LibUtil } from '../../util/util';
3
+ import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
4
+ import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
5
+
6
+ @Component({
7
+ selector: 'fields-time',
8
+ templateUrl: './time.html',
9
+ styleUrls: ['../fields.css'],
10
+ imports: [UiListErrors],
11
+ })
12
+ export class FieldsTime extends BaseFieldsForm {
13
+
14
+ constructor() {
15
+ super();
16
+ effect(() => {
17
+ const val = this.value();
18
+ let empty = val === null || val === undefined || val === '';
19
+ this.updateCampo({ empty });
20
+ });
21
+ }
22
+
23
+ onInput(newValue: string) {
24
+ if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
25
+ this.updateValue(newValue);
26
+ this.campo()?.onInput?.(this.form());
27
+ }
28
+
29
+ }
@@ -0,0 +1,24 @@
1
+ .FieldUpload:has(ui-drop-zone) {
2
+ outline: none;
3
+ border: 0;
4
+ }
5
+
6
+ .fieldDidplayUpload {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ justify-content: center;
11
+ width: 100%;
12
+ gap: 10px;
13
+ }
14
+
15
+ .fieldDidplayUpload i {
16
+ font-size: 48px;
17
+ }
18
+
19
+ .dica {
20
+ margin-top: 4px;
21
+ font-size: 12px;
22
+ filter: grayscale();
23
+ opacity: 0.7;
24
+ }