@masterkeymaterial/ui 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/masterkeymaterial-ui.mjs +6457 -0
- package/fesm2022/masterkeymaterial-ui.mjs.map +1 -0
- package/package.json +14 -5
- package/types/masterkeymaterial-ui.d.ts +928 -0
- package/ng-package.json +0 -10
- package/src/elements/ui-button/ui-button.css +0 -229
- package/src/elements/ui-button/ui-button.html +0 -12
- package/src/elements/ui-button/ui-button.ts +0 -133
- package/src/elements/ui-check-box/ui-check-box.css +0 -66
- package/src/elements/ui-check-box/ui-check-box.html +0 -5
- package/src/elements/ui-check-box/ui-check-box.ts +0 -65
- package/src/elements/ui-chip/ui-chip.css +0 -24
- package/src/elements/ui-chip/ui-chip.html +0 -3
- package/src/elements/ui-chip/ui-chip.ts +0 -25
- package/src/elements/ui-drop-zone/ui-drop-zone.css +0 -91
- package/src/elements/ui-drop-zone/ui-drop-zone.html +0 -8
- package/src/elements/ui-drop-zone/ui-drop-zone.ts +0 -153
- package/src/elements/ui-file-list/ui-file-list.css +0 -43
- package/src/elements/ui-file-list/ui-file-list.html +0 -17
- package/src/elements/ui-file-list/ui-file-list.ts +0 -22
- package/src/elements/ui-list-errors/ui-list-errors.css +0 -30
- package/src/elements/ui-list-errors/ui-list-errors.html +0 -10
- package/src/elements/ui-list-errors/ui-list-errors.ts +0 -14
- package/src/elements/ui-loading/ui-loading.css +0 -13
- package/src/elements/ui-loading/ui-loading.html +0 -1
- package/src/elements/ui-loading/ui-loading.ts +0 -10
- package/src/elements/ui-menu/ui-menu.css +0 -69
- package/src/elements/ui-menu/ui-menu.html +0 -20
- package/src/elements/ui-menu/ui-menu.ts +0 -267
- package/src/elements/ui-procurar/ui-procurar.css +0 -48
- package/src/elements/ui-procurar/ui-procurar.html +0 -14
- package/src/elements/ui-procurar/ui-procurar.ts +0 -82
- package/src/elements/ui-progress/ui-progress.css +0 -0
- package/src/elements/ui-progress/ui-progress.html +0 -1
- package/src/elements/ui-progress/ui-progress.ts +0 -15
- package/src/elements/ui-select/ui-select.css +0 -211
- package/src/elements/ui-select/ui-select.html +0 -46
- package/src/elements/ui-select/ui-select.ts +0 -482
- package/src/elements/ui-slide/ui-slide.css +0 -75
- package/src/elements/ui-slide/ui-slide.html +0 -7
- package/src/elements/ui-slide/ui-slide.ts +0 -61
- package/src/fields/Base/BaseFieldsForm/BaseFieldsForm.component.ts +0 -113
- package/src/fields/Base/BaseFieldsValues/BaseFieldsValues.ts +0 -112
- package/src/fields/Formulario/Formulario.ts +0 -1056
- package/src/fields/Formulario/form-action/form-action.css +0 -98
- package/src/fields/Formulario/form-action/form-action.html +0 -75
- package/src/fields/Formulario/form-action/form-action.ts +0 -187
- package/src/fields/Formulario/form-controls/form-controls.css +0 -108
- package/src/fields/Formulario/form-controls/form-controls.html +0 -105
- package/src/fields/Formulario/form-controls/form-controls.ts +0 -122
- package/src/fields/Formulario/form-fase/form-fase.css +0 -84
- package/src/fields/Formulario/form-fase/form-fase.html +0 -24
- package/src/fields/Formulario/form-fase/form-fase.ts +0 -157
- package/src/fields/Formulario/form-filter/form-filter.css +0 -50
- package/src/fields/Formulario/form-filter/form-filter.html +0 -25
- package/src/fields/Formulario/form-filter/form-filter.ts +0 -53
- package/src/fields/Formulario/form-no-action/form-no-action.css +0 -32
- package/src/fields/Formulario/form-no-action/form-no-action.html +0 -12
- package/src/fields/Formulario/form-no-action/form-no-action.ts +0 -21
- package/src/fields/Formulario/formated-values/formated-values.css +0 -104
- package/src/fields/Formulario/formated-values/formated-values.html +0 -15
- package/src/fields/Formulario/formated-values/formated-values.ts +0 -186
- package/src/fields/Formulario/single-values/single-values.css +0 -88
- package/src/fields/Formulario/single-values/single-values.html +0 -11
- package/src/fields/Formulario/single-values/single-values.ts +0 -65
- package/src/fields/autocomplete/autocomplete.css +0 -94
- package/src/fields/autocomplete/autocomplete.html +0 -38
- package/src/fields/autocomplete/autocomplete.ts +0 -294
- package/src/fields/button/button.css +0 -7
- package/src/fields/button/button.html +0 -19
- package/src/fields/button/button.ts +0 -38
- package/src/fields/checkbox/checkbox.css +0 -27
- package/src/fields/checkbox/checkbox.html +0 -20
- package/src/fields/checkbox/checkbox.ts +0 -44
- package/src/fields/color/CirculoColorido/circulocolorido.css +0 -50
- package/src/fields/color/CirculoColorido/circulocolorido.html +0 -8
- package/src/fields/color/CirculoColorido/circulocolorido.ts +0 -24
- package/src/fields/color/color.css +0 -15
- package/src/fields/color/color.html +0 -24
- package/src/fields/color/color.ts +0 -47
- package/src/fields/date/date.html +0 -19
- package/src/fields/date/date.ts +0 -29
- package/src/fields/datetime/datetime.html +0 -19
- package/src/fields/datetime/datetime.ts +0 -29
- package/src/fields/display/display.css +0 -7
- package/src/fields/display/display.html +0 -20
- package/src/fields/display/display.ts +0 -43
- package/src/fields/editor/editor.css +0 -51
- package/src/fields/editor/editor.html +0 -37
- package/src/fields/editor/editor.ts +0 -218
- package/src/fields/email/email.html +0 -19
- package/src/fields/email/email.ts +0 -29
- package/src/fields/fields.css +0 -180
- package/src/fields/generic/generic.html +0 -3
- package/src/fields/generic/generic.ts +0 -91
- package/src/fields/hidden/hidden.html +0 -3
- package/src/fields/hidden/hidden.ts +0 -20
- package/src/fields/icon/icon.css +0 -19
- package/src/fields/icon/icon.html +0 -27
- package/src/fields/icon/icon.ts +0 -31
- package/src/fields/multifactor/multifactor.css +0 -21
- package/src/fields/multifactor/multifactor.html +0 -39
- package/src/fields/multifactor/multifactor.ts +0 -106
- package/src/fields/multikv/multikv.css +0 -43
- package/src/fields/multikv/multikv.html +0 -47
- package/src/fields/multikv/multikv.ts +0 -88
- package/src/fields/multitext/multitext.css +0 -36
- package/src/fields/multitext/multitext.html +0 -38
- package/src/fields/multitext/multitext.ts +0 -75
- package/src/fields/number/number.html +0 -20
- package/src/fields/number/number.ts +0 -35
- package/src/fields/password/password.html +0 -23
- package/src/fields/password/password.ts +0 -37
- package/src/fields/search/search.css +0 -0
- package/src/fields/search/search.html +0 -19
- package/src/fields/search/search.ts +0 -54
- package/src/fields/select/select.css +0 -15
- package/src/fields/select/select.html +0 -18
- package/src/fields/select/select.ts +0 -52
- package/src/fields/slide/slide.css +0 -27
- package/src/fields/slide/slide.html +0 -20
- package/src/fields/slide/slide.ts +0 -45
- package/src/fields/text/text.html +0 -19
- package/src/fields/text/text.ts +0 -30
- package/src/fields/textarea/textarea.css +0 -4
- package/src/fields/textarea/textarea.html +0 -20
- package/src/fields/textarea/textarea.ts +0 -31
- package/src/fields/time/time.html +0 -19
- package/src/fields/time/time.ts +0 -29
- package/src/fields/upload/upload.css +0 -24
- package/src/fields/upload/upload.html +0 -41
- package/src/fields/upload/upload.ts +0 -137
- package/src/interfaces/interfaces.ts +0 -61
- package/src/public-api.ts +0 -38
- package/src/util/ClassOf.pipe.ts +0 -11
- package/src/util/JsonColorido.pipe.ts +0 -11
- package/src/util/util.ts +0 -2151
- package/tsconfig.lib.json +0 -16
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -13
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { NgComponentOutlet } from '@angular/common';
|
|
2
|
-
import { Component, computed } from '@angular/core';
|
|
3
|
-
import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
|
|
4
|
-
|
|
5
|
-
import { FieldsAutocomplete } from '../autocomplete/autocomplete';
|
|
6
|
-
import { FieldsButton } from "../button/button";
|
|
7
|
-
import { FieldsCheckbox } from '../checkbox/checkbox';
|
|
8
|
-
import { FieldsColor } from '../color/color';
|
|
9
|
-
import { FieldsDate } from '../date/date';
|
|
10
|
-
import { FieldsDatetime } from '../datetime/datetime';
|
|
11
|
-
import { FieldsDisplay } from '../display/display';
|
|
12
|
-
import { FieldsEditor } from '../editor/editor';
|
|
13
|
-
import { FieldsEmail } from '../email/email';
|
|
14
|
-
import { FieldsHidden } from '../hidden/hidden';
|
|
15
|
-
import { FieldsIcon } from '../icon/icon';
|
|
16
|
-
import { FieldsMultifactor } from '../multifactor/multifactor';
|
|
17
|
-
import { FieldsMultiText } from '../multitext/multitext';
|
|
18
|
-
import { FieldsNumber } from '../number/number';
|
|
19
|
-
import { FieldsPassword } from '../password/password';
|
|
20
|
-
import { FieldsSearch } from '../search/search';
|
|
21
|
-
import { FieldsSelect } from '../select/select';
|
|
22
|
-
import { FieldsSlide } from '../slide/slide';
|
|
23
|
-
import { FieldsText } from '../text/text';
|
|
24
|
-
import { FieldsUpload } from '../upload/upload';
|
|
25
|
-
import { FieldsTime } from '../time/time';
|
|
26
|
-
import { FieldsTextarea } from '../textarea/textarea';
|
|
27
|
-
import { IField } from '../Formulario/Formulario';
|
|
28
|
-
import { FieldsMultiKV } from '../multikv/multikv';
|
|
29
|
-
|
|
30
|
-
@Component({
|
|
31
|
-
selector: 'fields-g',
|
|
32
|
-
templateUrl: './generic.html',
|
|
33
|
-
// styles: `:host.hidden {
|
|
34
|
-
// display: none;
|
|
35
|
-
// }`,
|
|
36
|
-
imports: [NgComponentOutlet],
|
|
37
|
-
})
|
|
38
|
-
export class FieldsGeneric extends BaseFieldsForm {
|
|
39
|
-
|
|
40
|
-
readonly campos = computed(() => this.form().campos());
|
|
41
|
-
|
|
42
|
-
// @HostBinding('class.hidden')
|
|
43
|
-
// isHidden = false;
|
|
44
|
-
|
|
45
|
-
// Mapeamento de tipos para componentes
|
|
46
|
-
getComponentForType(tipo?: IField): any {
|
|
47
|
-
// Tipo Hidden não exibe componente e coloca o host como hidden
|
|
48
|
-
// if (tipo == IField.Hidden) {
|
|
49
|
-
// this.isHidden = true;
|
|
50
|
-
// return null;
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
/************************************************\\
|
|
54
|
-
// MAPA: Tipo de Campo - Componente Responsável \\
|
|
55
|
-
//*************************************************/
|
|
56
|
-
// Comente o campo caso haja algum problema de dependência circular ou outro...
|
|
57
|
-
|
|
58
|
-
const FIELDS_MAP: Partial<Record<IField, any>> = {
|
|
59
|
-
[IField.AutoComplete]: FieldsAutocomplete,
|
|
60
|
-
[IField.Button]: FieldsButton,
|
|
61
|
-
[IField.Checkbox]: FieldsCheckbox,
|
|
62
|
-
[IField.Color]: FieldsColor,
|
|
63
|
-
[IField.Date]: FieldsDate,
|
|
64
|
-
[IField.DateTime]: FieldsDatetime,
|
|
65
|
-
[IField.Display]: FieldsDisplay,
|
|
66
|
-
[IField.Editor]: FieldsEditor,
|
|
67
|
-
[IField.Email]: FieldsEmail,
|
|
68
|
-
[IField.Hidden]: FieldsHidden,
|
|
69
|
-
[IField.Icon]: FieldsIcon,
|
|
70
|
-
[IField.MultiFactor]: FieldsMultifactor,
|
|
71
|
-
[IField.MultiKV]: FieldsMultiKV,
|
|
72
|
-
[IField.MultiText]: FieldsMultiText,
|
|
73
|
-
[IField.Number]: FieldsNumber,
|
|
74
|
-
[IField.Password]: FieldsPassword,
|
|
75
|
-
[IField.Referencia]: FieldsDisplay,
|
|
76
|
-
[IField.Search]: FieldsSearch,
|
|
77
|
-
[IField.Select]: FieldsSelect,
|
|
78
|
-
[IField.Slide]: FieldsSlide,
|
|
79
|
-
[IField.Text]: FieldsText,
|
|
80
|
-
[IField.Textarea]: FieldsTextarea,
|
|
81
|
-
[IField.Time]: FieldsTime,
|
|
82
|
-
[IField.Upload]: FieldsUpload,
|
|
83
|
-
|
|
84
|
-
[IField.Custom]: this.campo()?.componente,
|
|
85
|
-
}
|
|
86
|
-
if (tipo) return FIELDS_MAP[tipo] || null;
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<div class="fieldHidden" [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"></div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Component, effect } from '@angular/core';
|
|
2
|
-
import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'fields-hidden',
|
|
6
|
-
templateUrl: './hidden.html',
|
|
7
|
-
styles: `.fieldHidden{display: none;}`
|
|
8
|
-
})
|
|
9
|
-
export class FieldsHidden extends BaseFieldsForm {
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
effect(() => {
|
|
14
|
-
const val = this.value();
|
|
15
|
-
let empty = val === null || val === undefined || val === '';
|
|
16
|
-
this.updateCampo({ empty });
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
package/src/fields/icon/icon.css
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.noIcon {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
transform: rotate(-10deg) skewX(-15deg) skewY(-15deg) translate(0px, -5px);
|
|
4
|
-
font-size: 16px;
|
|
5
|
-
position: relative;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.noIcon:after {
|
|
9
|
-
content: 'ICO';
|
|
10
|
-
position: absolute;
|
|
11
|
-
bottom: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
transform: scaleY(-1) skewX(-50deg);
|
|
14
|
-
transform-origin: bottom;
|
|
15
|
-
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
|
|
16
|
-
background-clip: text;
|
|
17
|
-
-webkit-background-clip: text;
|
|
18
|
-
-webkit-text-fill-color: transparent;
|
|
19
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
<ui-button tipo="raised" tema="secondary" (clicked)="onClickEmit()" [disabled]="campo()?.disabled"
|
|
10
|
-
[style.width.px]="100">
|
|
11
|
-
@if(value()){
|
|
12
|
-
<i [class]="value()" [style.fontSize]="'25px'"></i>
|
|
13
|
-
}@else {
|
|
14
|
-
<div class="noIcon">ICO</div>
|
|
15
|
-
}
|
|
16
|
-
</ui-button>
|
|
17
|
-
<div class="fieldEffect">
|
|
18
|
-
<div class="fieldField FieldIconType">
|
|
19
|
-
<input type="text" [value]="value()" (input)="onInput($event.target.value)" (change)="onChangeEmit()"
|
|
20
|
-
[name]="campo()?.prop" [disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''"
|
|
21
|
-
[attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class]="campo()?.classe"
|
|
22
|
-
[style]="campo()?.style" [class.outlined]="true" [class.input]="true" />
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
|
|
27
|
-
</div>
|
package/src/fields/icon/icon.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Component, effect } from '@angular/core';
|
|
2
|
-
import { LibUtil } from '../../util/util';
|
|
3
|
-
import { UiButton } from "../../elements/ui-button/ui-button";
|
|
4
|
-
import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
|
|
5
|
-
import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'fields-icon',
|
|
9
|
-
templateUrl: './icon.html',
|
|
10
|
-
styleUrls: ['../fields.css', './icon.css'],
|
|
11
|
-
imports: [UiButton, UiListErrors]
|
|
12
|
-
})
|
|
13
|
-
export class FieldsIcon 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
|
-
|
|
31
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.gridFactor {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(6, 1fr);
|
|
4
|
-
gap: 0.5rem;
|
|
5
|
-
padding: 5px;
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.fieldField.FieldMultifactor {
|
|
10
|
-
border: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.fieldField.FieldMultifactor input {
|
|
14
|
-
text-align: center;
|
|
15
|
-
outline: 1px solid var(--sys-outline);
|
|
16
|
-
height: 37px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.fieldField.FieldMultifactor .corpo:focus-visible {
|
|
20
|
-
outline: 2px solid var(--campoCor);
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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 FieldMultifactor">
|
|
11
|
-
<input type="text" [value]="value()" (input)="onInput($event.target.value)" [name]="campo()?.prop"
|
|
12
|
-
[disabled]="campo()?.disabled" [placeholder]="campo()?.placeholder ?? ''" [class]="campo()?.classe"
|
|
13
|
-
[style]="campo()?.style" [hidden]="true" [readOnly]="true" />
|
|
14
|
-
|
|
15
|
-
<div class="gridFactor">
|
|
16
|
-
<input #controle class="fieldSingleInput" name="a" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
17
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
18
|
-
[class.corpo]="true" [class.input]="true" />
|
|
19
|
-
<input class="fieldSingleInput" name="b" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
20
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
21
|
-
[class.corpo]="true" [class.input]="true" />
|
|
22
|
-
<input class="fieldSingleInput" name="c" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
23
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
24
|
-
[class.corpo]="true" [class.input]="true" />
|
|
25
|
-
<input class="fieldSingleInput" name="d" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
26
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
27
|
-
[class.corpo]="true" [class.input]="true" />
|
|
28
|
-
<input class="fieldSingleInput" name="e" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
29
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
30
|
-
[class.corpo]="true" [class.input]="true" />
|
|
31
|
-
<input class="fieldSingleInput" name="f" size="1" type="text" [maxLength]="1" min="0" max="9"
|
|
32
|
-
pattern="\d{1,1}" (input)="onInputChar($event)" (keyup)="onKeyUp($event)" (focus)="onFocus($event)"
|
|
33
|
-
[class.corpo]="true" [class.input]="true" />
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
|
|
39
|
-
</div>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, Component, effect, ElementRef, viewChild } from '@angular/core';
|
|
2
|
-
import { LibUtil, LOG } from '../../util/util';
|
|
3
|
-
import { BaseFieldsForm } from '../Base/BaseFieldsForm/BaseFieldsForm.component';
|
|
4
|
-
import { UiListErrors } from "../../elements/ui-list-errors/ui-list-errors";
|
|
5
|
-
|
|
6
|
-
interface ICode {
|
|
7
|
-
[key: string]: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'fields-multifactor',
|
|
12
|
-
templateUrl: './multifactor.html',
|
|
13
|
-
styleUrls: ['../fields.css', './multifactor.css'],
|
|
14
|
-
imports: [UiListErrors],
|
|
15
|
-
})
|
|
16
|
-
export class FieldsMultifactor extends BaseFieldsForm implements AfterViewInit {
|
|
17
|
-
|
|
18
|
-
code: ICode = {};
|
|
19
|
-
controle = viewChild('controle', { read: ElementRef });
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
effect(() => {
|
|
24
|
-
const val = this.value();
|
|
25
|
-
let empty = val === null || val === undefined || val === '';
|
|
26
|
-
this.updateCampo({ empty });
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
ngAfterViewInit() {
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
if (this.campo()?.autofocus && this.controle()?.nativeElement) {
|
|
33
|
-
this.controle()?.nativeElement.focus();
|
|
34
|
-
}
|
|
35
|
-
}, 100);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
onInput(newValue: string) {
|
|
39
|
-
if (this.campo()?.mask) newValue = LibUtil.mascarar(newValue, this.campo()?.mask) ?? '';
|
|
40
|
-
this.updateValue(newValue);
|
|
41
|
-
this.campo()?.onInput?.(this.form());
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onInputChar(ev: Event) {
|
|
46
|
-
let e = (ev.target as HTMLInputElement);
|
|
47
|
-
let v = e.value;
|
|
48
|
-
let name = e.name;
|
|
49
|
-
let order = "abcdef";
|
|
50
|
-
let nextInputName: String = "b";
|
|
51
|
-
let isLast = false;
|
|
52
|
-
|
|
53
|
-
if (v && v != "" && "0123456789".includes(v)) {
|
|
54
|
-
// Só seta no objeto se for válido
|
|
55
|
-
this.code[name] = v;
|
|
56
|
-
// Identificar próximo campo
|
|
57
|
-
nextInputName = order.charAt(order.indexOf(name) + 1);
|
|
58
|
-
// Tentativa de focar próximo elemento
|
|
59
|
-
let nextE = (document.querySelector(`.fieldSingleInput[name='${nextInputName}']`) as HTMLInputElement | null);
|
|
60
|
-
if (nextE) {
|
|
61
|
-
nextE.focus();
|
|
62
|
-
} else {
|
|
63
|
-
isLast = true;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
e.value = "";
|
|
67
|
-
delete this.code[name];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Seta valor do campo de forma ordenada
|
|
71
|
-
let novoValor = Object.values(Object.fromEntries(Object.entries(this.code).sort())).join("");
|
|
72
|
-
this.updateValue(novoValor);
|
|
73
|
-
|
|
74
|
-
// Verifica se completou
|
|
75
|
-
if (this.campo()?.onComplete && novoValor.length == 6 && isLast) {
|
|
76
|
-
try {
|
|
77
|
-
this.campo()?.onComplete?.(this.form(), novoValor);
|
|
78
|
-
this.onChangeEmit();
|
|
79
|
-
} catch (err) {
|
|
80
|
-
LOG(1, `❌ Erro ao executar onMatch do campo '${this.name.toString()}'`, err);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
onKeyUp(ev: KeyboardEvent) {
|
|
86
|
-
let key = ev.key;
|
|
87
|
-
let e = (ev.target as HTMLInputElement);
|
|
88
|
-
let v = e.value;
|
|
89
|
-
if (e && v == "" && key == "Backspace") {
|
|
90
|
-
let order = "abcdef";
|
|
91
|
-
let indexOf = order.indexOf(e.name);
|
|
92
|
-
let nextInputName: String = order.charAt(indexOf - 1);
|
|
93
|
-
// Tentativa de focar próximo elemento
|
|
94
|
-
let nextE = (document.querySelector(`.fieldSingleInput[name='${nextInputName}']`) as HTMLInputElement | null);
|
|
95
|
-
if (nextE) {
|
|
96
|
-
if (nextE.value != "") {
|
|
97
|
-
nextE.focus();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
onFocus(ev: Event) {
|
|
104
|
-
(ev.target as HTMLInputElement)?.select();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.FieldMultiKv {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: 1fr 1fr auto;
|
|
4
|
-
grid-template-rows: 40px;
|
|
5
|
-
gap: 8px;
|
|
6
|
-
align-items: center;
|
|
7
|
-
padding: 8px;
|
|
8
|
-
border: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.fieldField.FieldMultiKv .input {
|
|
13
|
-
outline: 1px solid var(--sys-outline);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.fieldField.FieldMultiKv .input:focus-visible {
|
|
17
|
-
outline: 2px solid var(--campoCor);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.index {
|
|
21
|
-
text-align: center;
|
|
22
|
-
font-weight: bold;
|
|
23
|
-
min-width: 18px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.add {
|
|
27
|
-
grid-area: auto / auto / auto / span 3;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.input {
|
|
31
|
-
height: 40px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.action {
|
|
35
|
-
min-width: 32px;
|
|
36
|
-
min-height: 32px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.header {
|
|
40
|
-
font-weight: bold;
|
|
41
|
-
text-decoration: underline;
|
|
42
|
-
padding-left: 10px;
|
|
43
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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 FieldMultiKv">
|
|
11
|
-
@if(campo()?.showHeader != false){
|
|
12
|
-
<div class="header">{{ campo()?.tituloChave ?? 'Chaves'}}</div>
|
|
13
|
-
<div class="header">{{ campo()?.tituloValor ?? 'Valores'}}</div>
|
|
14
|
-
<div class="header action"></div>
|
|
15
|
-
}
|
|
16
|
-
@for (item of items; track $index) {
|
|
17
|
-
<div>
|
|
18
|
-
<input type="text" [value]="item.k" [name]="campo()?.prop" [disabled]="campo()?.disabled"
|
|
19
|
-
[placeholder]="campo()?.placeholder ?? ''" [class]="campo()?.classe" [style]="campo()?.style"
|
|
20
|
-
[attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class.input]="true"
|
|
21
|
-
[class.outlined]="true" (input)="_onLocalInputK($event.target.value, $index)"
|
|
22
|
-
(change)="_onLocalChangeK($event.target.value, $index)" />
|
|
23
|
-
</div>
|
|
24
|
-
<div>
|
|
25
|
-
<input type="text" [value]="item.v" [name]="campo()?.prop" [disabled]="campo()?.disabled"
|
|
26
|
-
[placeholder]="campo()?.placeholder ?? ''" [class]="campo()?.classe" [style]="campo()?.style"
|
|
27
|
-
[attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class.input]="true"
|
|
28
|
-
[class.outlined]="true" (input)="_onLocalInputV($event.target.value, $index)"
|
|
29
|
-
(change)="_onLocalChangeV($event.target.value, $index)" />
|
|
30
|
-
</div>
|
|
31
|
-
<div class="action">
|
|
32
|
-
<ui-button tipo="icon" tema="error" title="Remover Linha" (click)="onClickDelItem($index)"
|
|
33
|
-
icone="bi bi-trash">
|
|
34
|
-
</ui-button>
|
|
35
|
-
</div>
|
|
36
|
-
}
|
|
37
|
-
<div class="add">
|
|
38
|
-
<ui-button tipo="nofill" tema="primary" title="Adicionar Linha" (click)="onClickAddItem()"
|
|
39
|
-
icone="bi bi-plus-circle">
|
|
40
|
-
Adicionar Linha
|
|
41
|
-
</ui-button>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
|
|
47
|
-
</div>
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
import { IKV } from '../../interfaces/interfaces';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'fields-multikv',
|
|
9
|
-
templateUrl: './multikv.html',
|
|
10
|
-
styleUrls: ['../fields.css', './multikv.css'],
|
|
11
|
-
imports: [UiButton, UiListErrors],
|
|
12
|
-
})
|
|
13
|
-
export class FieldsMultiKV extends BaseFieldsForm implements OnInit {
|
|
14
|
-
|
|
15
|
-
// Componente para adicionar ou retirar itens em forma KV (Como usado nos seletores)
|
|
16
|
-
items: IKV[] | null = [];
|
|
17
|
-
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
effect(() => {
|
|
21
|
-
const val = this.value();
|
|
22
|
-
let empty = val === null || val === undefined || val === '';
|
|
23
|
-
if (val && Array.isArray(val) && val.length <= 0) empty = true;
|
|
24
|
-
// if (!Array.isArray(val)) errors = [...errors, Valide.msg.apenasLista];
|
|
25
|
-
this.updateCampo({ empty });
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override ngOnInit() {
|
|
30
|
-
super.ngOnInit();
|
|
31
|
-
let value = this.value();
|
|
32
|
-
if (value && Array.isArray(value)) this.items = value ?? [];
|
|
33
|
-
else this.items = [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ngAfterViewInit(): void {
|
|
37
|
-
this.updateValue(this.items ?? [], false);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onClickAddItem() {
|
|
41
|
-
let value: IKV = this.campo()?.value ?? { k: "", v: "" };
|
|
42
|
-
if (!this.items) this.items = [];
|
|
43
|
-
this.items = [...this.items, value];
|
|
44
|
-
this.updateValue(this.items);
|
|
45
|
-
this.campo()?.onInput?.(this.form());
|
|
46
|
-
this.onChangeEmit();
|
|
47
|
-
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
let allInputs = (document.querySelectorAll(`.FieldMultiText .input`) as NodeListOf<HTMLInputElement> | null);
|
|
50
|
-
if (allInputs && allInputs.length > 0) {
|
|
51
|
-
allInputs[allInputs.length - 1].focus();
|
|
52
|
-
}
|
|
53
|
-
}, 1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
onClickDelItem(index: number) {
|
|
57
|
-
this.items = this.items?.filter((v, i) => i != index) ?? [];
|
|
58
|
-
if (this.items && this.items?.length <= 0) this.items = [];
|
|
59
|
-
this.updateValue(this.items);
|
|
60
|
-
this.campo()?.onInput?.(this.form());
|
|
61
|
-
this.onChangeEmit();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_onLocalInputK(key: string, index: number) {
|
|
65
|
-
if (this.items) this.items[index].k = key;
|
|
66
|
-
this.updateValue(this.items);
|
|
67
|
-
this.campo()?.onInput?.(this.form());
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_onLocalInputV(value: string, index: number) {
|
|
71
|
-
if (this.items) this.items[index].v = value;
|
|
72
|
-
this.updateValue(this.items);
|
|
73
|
-
this.campo()?.onInput?.(this.form());
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
_onLocalChangeK(key: string, index: number) {
|
|
77
|
-
if (this.items) this.items[index].k = key;
|
|
78
|
-
this.updateValue(this.items);
|
|
79
|
-
this.onChangeEmit();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
_onLocalChangeV(value: string, index: number) {
|
|
83
|
-
if (this.items) this.items[index].v = value;
|
|
84
|
-
this.updateValue(this.items);
|
|
85
|
-
this.onChangeEmit();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
.FieldMultiText {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: 1fr auto;
|
|
4
|
-
grid-template-rows: 40px;
|
|
5
|
-
gap: 8px;
|
|
6
|
-
align-items: center;
|
|
7
|
-
padding: 8px;
|
|
8
|
-
border: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.fieldField.FieldMultiText .input {
|
|
12
|
-
outline: 1px solid var(--sys-outline);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.fieldField.FieldMultiText .input:focus-visible {
|
|
16
|
-
outline: 2px solid var(--campoCor);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.index {
|
|
20
|
-
text-align: center;
|
|
21
|
-
font-weight: bold;
|
|
22
|
-
min-width: 18px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.add {
|
|
26
|
-
grid-area: auto / auto / auto / span 2;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.input {
|
|
30
|
-
height: 40px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.action {
|
|
34
|
-
min-width: 32px;
|
|
35
|
-
min-height: 32px;
|
|
36
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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 FieldMultiText">
|
|
11
|
-
@if(campo()?.showHeader){
|
|
12
|
-
<div>Itens</div>
|
|
13
|
-
<div class="action"></div>
|
|
14
|
-
}
|
|
15
|
-
@for (item of items; track $index) {
|
|
16
|
-
<div>
|
|
17
|
-
<input type="text" [value]="item" [name]="campo()?.prop" [disabled]="campo()?.disabled"
|
|
18
|
-
[placeholder]="campo()?.placeholder ?? ''" [class]="campo()?.classe" [style]="campo()?.style"
|
|
19
|
-
[attr.maxLength]="campo()?.maxl" [attr.minLength]="campo()?.minl" [class.input]="true"
|
|
20
|
-
[class.outlined]="true" (input)="_onLocalInput($event.target.value, $index)" />
|
|
21
|
-
</div>
|
|
22
|
-
<div class="action">
|
|
23
|
-
<ui-button tipo="icon" tema="error" title="Remover Linha" (click)="onClickDelItem($index)"
|
|
24
|
-
icone="bi bi-trash">
|
|
25
|
-
</ui-button>
|
|
26
|
-
</div>
|
|
27
|
-
}
|
|
28
|
-
<div class="add">
|
|
29
|
-
<ui-button tipo="nofill" tema="primary" title="Adicionar Linha" (click)="onClickAddItem()"
|
|
30
|
-
icone="bi bi-plus-circle">
|
|
31
|
-
Adicionar Linha
|
|
32
|
-
</ui-button>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
<ui-list-errors [errors]="campo()?.errors" [dica]="campo()?.dica" [show]="campo()?.touched"></ui-list-errors>
|
|
38
|
-
</div>
|