keevo-components 1.3.7 → 1.3.8
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/ng-package.json +7 -0
- package/package.json +20 -39
- package/src/index.ts +1 -0
- package/src/lib/api/base-components/base-component-button.ts +26 -0
- package/src/lib/api/base-components/base-component-dropdown.ts +127 -0
- package/src/lib/api/base-components/base-component-input.ts +91 -0
- package/src/lib/api/base-components/base-component.ts +46 -0
- package/src/lib/api/components/error/error.component.html +3 -0
- package/src/lib/api/components/error/error.component.scss +0 -0
- package/src/lib/api/components/error/error.component.ts +22 -0
- package/src/lib/api/components/error/kverror.module.ts +23 -0
- package/src/lib/api/components/table/action-item.ts +5 -0
- package/{lib/api/components/table/kv-menuitem.d.ts → src/lib/api/components/table/kv-menuitem.ts} +4 -3
- package/src/lib/api/components/table/table.config.column.ts +10 -0
- package/src/lib/api/components/table/table.config.ts +14 -0
- package/src/lib/api/components/table/table.paginate.ts +6 -0
- package/src/lib/api/helpers/component-providers.ts +16 -0
- package/src/lib/api/helpers/translate-primeng.ts +25 -0
- package/src/lib/api/modules/primeng.module.ts +97 -0
- package/src/lib/api/services/component.service.ts +22 -0
- package/src/lib/api/services/notification.service.ts +82 -0
- package/src/lib/api/services/object.service.ts +20 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.html +9 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.scss +0 -0
- package/src/lib/buttons/button-personalize/button-personalize.component.ts +13 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.html +9 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.scss +13 -0
- package/src/lib/buttons/button-secondary/button-secondary.component.ts +13 -0
- package/src/lib/buttons/button-success/button-success.component.html +9 -0
- package/src/lib/buttons/button-success/button-success.component.scss +12 -0
- package/src/lib/buttons/button-success/button-success.component.ts +13 -0
- package/src/lib/buttons/kvbutton.module.ts +22 -0
- package/src/lib/directives/template.directive.ts +15 -0
- package/src/lib/inputs/check/check.component.html +11 -0
- package/src/lib/inputs/check/check.component.scss +0 -0
- package/src/lib/inputs/check/check.component.ts +24 -0
- package/src/lib/inputs/dropdown/dropdown.component.html +43 -0
- package/src/lib/inputs/dropdown/dropdown.component.scss +0 -0
- package/src/lib/inputs/dropdown/dropdown.component.ts +19 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.html +22 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.scss +0 -0
- package/src/lib/inputs/input-calendar/input-calendar.component.ts +54 -0
- package/src/lib/inputs/input-mask/input-mask.component.html +15 -0
- package/src/lib/inputs/input-mask/input-mask.component.scss +0 -0
- package/src/lib/inputs/input-mask/input-mask.component.ts +20 -0
- package/src/lib/inputs/input-number/input-number.component.html +15 -0
- package/src/lib/inputs/input-number/input-number.component.scss +0 -0
- package/src/lib/inputs/input-number/input-number.component.ts +51 -0
- package/src/lib/inputs/input-password/input-password.component.html +18 -0
- package/src/lib/inputs/input-password/input-password.component.scss +0 -0
- package/src/lib/inputs/input-password/input-password.component.ts +23 -0
- package/src/lib/inputs/input-text/input-text.component.html +14 -0
- package/src/lib/inputs/input-text/input-text.component.scss +18 -0
- package/src/lib/inputs/input-text/input-text.component.ts +17 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.html +17 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.scss +0 -0
- package/src/lib/inputs/input-textarea/input-textarea.component.ts +33 -0
- package/src/lib/inputs/input-time/input-time.component.html +18 -0
- package/src/lib/inputs/input-time/input-time.component.scss +0 -0
- package/src/lib/inputs/input-time/input-time.component.ts +20 -0
- package/src/lib/inputs/kvinputs.module.ts +53 -0
- package/src/lib/inputs/multi-select/multi-select.component.html +21 -0
- package/src/lib/inputs/multi-select/multi-select.component.scss +0 -0
- package/src/lib/inputs/multi-select/multi-select.component.ts +44 -0
- package/src/lib/inputs/switch/switch.component.html +11 -0
- package/src/lib/inputs/switch/switch.component.scss +3 -0
- package/src/lib/inputs/switch/switch.component.ts +24 -0
- package/src/lib/keevo-components.module.ts +20 -0
- package/src/lib/pipes/codigofile.pipe.ts +15 -0
- package/src/lib/pipes/cpfcnpj.pipe.ts +21 -0
- package/src/lib/pipes/pipes.module.ts +22 -0
- package/src/lib/pipes/telefone.pipe.ts +38 -0
- package/src/lib/styles-components.scss +3 -0
- package/src/lib/table/kvtable.module.ts +20 -0
- package/src/lib/table/table.component.html +189 -0
- package/src/lib/table/table.component.scss +21 -0
- package/src/lib/table/table.component.spec.ts +28 -0
- package/src/lib/table/table.component.ts +211 -0
- package/{public-api.d.ts → src/public-api.ts} +11 -4
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/esm2020/keevo-components.mjs +0 -5
- package/esm2020/lib/api/base-components/base-component-button.mjs +0 -36
- package/esm2020/lib/api/base-components/base-component-dropdown.mjs +0 -116
- package/esm2020/lib/api/base-components/base-component-input.mjs +0 -77
- package/esm2020/lib/api/base-components/base-component.mjs +0 -49
- package/esm2020/lib/api/components/error/error.component.mjs +0 -26
- package/esm2020/lib/api/components/error/kverror.module.mjs +0 -35
- package/esm2020/lib/api/components/table/action-item.mjs +0 -2
- package/esm2020/lib/api/components/table/kv-menuitem.mjs +0 -3
- package/esm2020/lib/api/components/table/table.config.column.mjs +0 -2
- package/esm2020/lib/api/components/table/table.config.mjs +0 -2
- package/esm2020/lib/api/components/table/table.paginate.mjs +0 -9
- package/esm2020/lib/api/helpers/component-providers.mjs +0 -16
- package/esm2020/lib/api/helpers/translate-primeng.mjs +0 -23
- package/esm2020/lib/api/modules/primeng.module.mjs +0 -191
- package/esm2020/lib/api/services/component.service.mjs +0 -27
- package/esm2020/lib/api/services/notification.service.mjs +0 -67
- package/esm2020/lib/api/services/object.service.mjs +0 -26
- package/esm2020/lib/buttons/button-personalize/button-personalize.component.mjs +0 -17
- package/esm2020/lib/buttons/button-secondary/button-secondary.component.mjs +0 -17
- package/esm2020/lib/buttons/button-success/button-success.component.mjs +0 -17
- package/esm2020/lib/buttons/kvbutton.module.mjs +0 -34
- package/esm2020/lib/directives/template.directive.mjs +0 -24
- package/esm2020/lib/inputs/check/check.component.mjs +0 -26
- package/esm2020/lib/inputs/dropdown/dropdown.component.mjs +0 -26
- package/esm2020/lib/inputs/input-calendar/input-calendar.component.mjs +0 -62
- package/esm2020/lib/inputs/input-mask/input-mask.component.mjs +0 -22
- package/esm2020/lib/inputs/input-number/input-number.component.mjs +0 -56
- package/esm2020/lib/inputs/input-password/input-password.component.mjs +0 -32
- package/esm2020/lib/inputs/input-text/input-text.component.mjs +0 -20
- package/esm2020/lib/inputs/input-textarea/input-textarea.component.mjs +0 -42
- package/esm2020/lib/inputs/input-time/input-time.component.mjs +0 -23
- package/esm2020/lib/inputs/kvinputs.module.mjs +0 -89
- package/esm2020/lib/inputs/multi-select/multi-select.component.mjs +0 -50
- package/esm2020/lib/inputs/switch/switch.component.mjs +0 -26
- package/esm2020/lib/keevo-components.module.mjs +0 -35
- package/esm2020/lib/pipes/codigofile.pipe.mjs +0 -19
- package/esm2020/lib/pipes/cpfcnpj.pipe.mjs +0 -25
- package/esm2020/lib/pipes/pipes.module.mjs +0 -34
- package/esm2020/lib/pipes/telefone.pipe.mjs +0 -45
- package/esm2020/lib/table/kvtable.module.mjs +0 -28
- package/esm2020/lib/table/table.component.mjs +0 -194
- package/esm2020/public-api.mjs +0 -44
- package/fesm2015/keevo-components.mjs +0 -1481
- package/fesm2015/keevo-components.mjs.map +0 -1
- package/fesm2020/keevo-components.mjs +0 -1490
- package/fesm2020/keevo-components.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/api/base-components/base-component-button.d.ts +0 -14
- package/lib/api/base-components/base-component-dropdown.d.ts +0 -31
- package/lib/api/base-components/base-component-input.d.ts +0 -26
- package/lib/api/base-components/base-component.d.ts +0 -21
- package/lib/api/components/error/error.component.d.ts +0 -12
- package/lib/api/components/error/kverror.module.d.ts +0 -10
- package/lib/api/components/table/action-item.d.ts +0 -5
- package/lib/api/components/table/table.config.column.d.ts +0 -10
- package/lib/api/components/table/table.config.d.ts +0 -12
- package/lib/api/components/table/table.paginate.d.ts +0 -6
- package/lib/api/helpers/component-providers.d.ts +0 -2
- package/lib/api/helpers/translate-primeng.d.ts +0 -4
- package/lib/api/modules/primeng.module.d.ts +0 -46
- package/lib/api/services/component.service.d.ts +0 -11
- package/lib/api/services/notification.service.d.ts +0 -25
- package/lib/api/services/object.service.d.ts +0 -8
- package/lib/buttons/button-personalize/button-personalize.component.d.ts +0 -7
- package/lib/buttons/button-secondary/button-secondary.component.d.ts +0 -7
- package/lib/buttons/button-success/button-success.component.d.ts +0 -7
- package/lib/buttons/kvbutton.module.d.ts +0 -10
- package/lib/directives/template.directive.d.ts +0 -11
- package/lib/inputs/check/check.component.d.ts +0 -11
- package/lib/inputs/dropdown/dropdown.component.d.ts +0 -9
- package/lib/inputs/input-calendar/input-calendar.component.d.ts +0 -21
- package/lib/inputs/input-mask/input-mask.component.d.ts +0 -10
- package/lib/inputs/input-number/input-number.component.d.ts +0 -18
- package/lib/inputs/input-password/input-password.component.d.ts +0 -13
- package/lib/inputs/input-text/input-text.component.d.ts +0 -9
- package/lib/inputs/input-textarea/input-textarea.component.d.ts +0 -16
- package/lib/inputs/input-time/input-time.component.d.ts +0 -10
- package/lib/inputs/kvinputs.module.d.ts +0 -21
- package/lib/inputs/multi-select/multi-select.component.d.ts +0 -20
- package/lib/inputs/switch/switch.component.d.ts +0 -11
- package/lib/keevo-components.module.d.ts +0 -9
- package/lib/pipes/codigofile.pipe.d.ts +0 -7
- package/lib/pipes/cpfcnpj.pipe.d.ts +0 -7
- package/lib/pipes/pipes.module.d.ts +0 -10
- package/lib/pipes/telefone.pipe.d.ts +0 -7
- package/lib/table/kvtable.module.d.ts +0 -9
- package/lib/table/table.component.d.ts +0 -56
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { BaseComponentInput } from '../../api/base-components/base-component-input';
|
|
3
|
+
import { ComponentProviders } from '../../api/helpers/component-providers';
|
|
4
|
+
import { ComponentService } from '../../api/services/component.service';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'kv-input-textarea',
|
|
9
|
+
templateUrl: './input-textarea.component.html',
|
|
10
|
+
styleUrls: ['./input-textarea.component.scss', '../../styles-components.scss'],
|
|
11
|
+
providers: ComponentProviders(InputTextareaComponent),
|
|
12
|
+
})
|
|
13
|
+
export class InputTextareaComponent extends BaseComponentInput<string> implements OnInit {
|
|
14
|
+
@Input() multiline: boolean = false;
|
|
15
|
+
@Input() rows: number = 2;
|
|
16
|
+
@Input() cols: number = 20;
|
|
17
|
+
@Input() autoResize: boolean = false;
|
|
18
|
+
@Input() maxValueLength: number = 0;
|
|
19
|
+
|
|
20
|
+
counterValueLength: number = 0;
|
|
21
|
+
|
|
22
|
+
constructor(componentService: ComponentService) {
|
|
23
|
+
super(componentService);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
override ngOnInit(): void {
|
|
27
|
+
super.ngOnInit();
|
|
28
|
+
|
|
29
|
+
this.formControl?.valueChanges.subscribe((value: any) => {
|
|
30
|
+
this.counterValueLength = value?.length;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<span class="p-float-label">
|
|
2
|
+
|
|
3
|
+
<p-calendar
|
|
4
|
+
appendTo="body"
|
|
5
|
+
[class]="baseInputClass"
|
|
6
|
+
[id]="componentId"
|
|
7
|
+
[(ngModel)]="value"
|
|
8
|
+
[disabled]="disabled"
|
|
9
|
+
[showIcon]="showIcon"
|
|
10
|
+
[showTime]="true"
|
|
11
|
+
[timeOnly]="true"
|
|
12
|
+
(onBlur)="onInputBlur($event)">
|
|
13
|
+
</p-calendar>
|
|
14
|
+
<label [for]="componentId">{{ label }}</label>
|
|
15
|
+
|
|
16
|
+
<kv-error [hasError]="hasControlError()">{{ erroMessage() }}</kv-error>
|
|
17
|
+
</span>
|
|
18
|
+
<ng-content></ng-content>
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { BaseComponentInput } from '../../api/base-components/base-component-input';
|
|
3
|
+
import { ComponentProviders } from '../../api/helpers/component-providers';
|
|
4
|
+
import { ComponentService } from '../../api/services/component.service';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'kv-input-time',
|
|
9
|
+
templateUrl: './input-time.component.html',
|
|
10
|
+
styleUrls: ['./input-time.component.scss', '../../styles-components.scss'],
|
|
11
|
+
providers: ComponentProviders(InputTimeComponent),
|
|
12
|
+
})
|
|
13
|
+
export class InputTimeComponent extends BaseComponentInput<string> implements OnInit {
|
|
14
|
+
|
|
15
|
+
@Input() showIcon: boolean = true;
|
|
16
|
+
|
|
17
|
+
constructor(componentService: ComponentService) {
|
|
18
|
+
super(componentService);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { CheckComponent } from './check/check.component';
|
|
5
|
+
import { DropdownComponent } from './dropdown/dropdown.component';
|
|
6
|
+
import { InputCalendarComponent } from './input-calendar/input-calendar.component';
|
|
7
|
+
import { InputMaskComponent } from './input-mask/input-mask.component';
|
|
8
|
+
import { InputNumberComponent } from './input-number/input-number.component';
|
|
9
|
+
import { InputPasswordComponent } from './input-password/input-password.component';
|
|
10
|
+
import { InputTextComponent } from './input-text/input-text.component';
|
|
11
|
+
import { InputTextareaComponent } from './input-textarea/input-textarea.component';
|
|
12
|
+
import { InputTimeComponent } from './input-time/input-time.component';
|
|
13
|
+
import { MultiSelectComponent } from './multi-select/multi-select.component';
|
|
14
|
+
import { SwitchComponent } from './switch/switch.component';
|
|
15
|
+
import { kvErrorModule } from '../api/components/error/kverror.module';
|
|
16
|
+
import { PrimeNgModule } from '../api/modules/primeng.module';
|
|
17
|
+
|
|
18
|
+
@NgModule({
|
|
19
|
+
declarations: [
|
|
20
|
+
CheckComponent,
|
|
21
|
+
DropdownComponent,
|
|
22
|
+
InputCalendarComponent,
|
|
23
|
+
InputMaskComponent,
|
|
24
|
+
InputNumberComponent,
|
|
25
|
+
InputPasswordComponent,
|
|
26
|
+
InputTextComponent,
|
|
27
|
+
InputTextareaComponent,
|
|
28
|
+
InputTimeComponent,
|
|
29
|
+
MultiSelectComponent,
|
|
30
|
+
SwitchComponent,
|
|
31
|
+
],
|
|
32
|
+
imports: [
|
|
33
|
+
CommonModule,
|
|
34
|
+
FormsModule,
|
|
35
|
+
kvErrorModule,
|
|
36
|
+
PrimeNgModule,
|
|
37
|
+
ReactiveFormsModule,
|
|
38
|
+
],
|
|
39
|
+
exports: [
|
|
40
|
+
CheckComponent,
|
|
41
|
+
DropdownComponent,
|
|
42
|
+
InputCalendarComponent,
|
|
43
|
+
InputMaskComponent,
|
|
44
|
+
InputNumberComponent,
|
|
45
|
+
InputPasswordComponent,
|
|
46
|
+
InputTextComponent,
|
|
47
|
+
InputTextareaComponent,
|
|
48
|
+
InputTimeComponent,
|
|
49
|
+
MultiSelectComponent,
|
|
50
|
+
SwitchComponent,
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
export class KvInputsModule { }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<span class="p-float-label">
|
|
2
|
+
<p-multiSelect
|
|
3
|
+
appendTo="body"
|
|
4
|
+
display="chip"
|
|
5
|
+
inputId="multiselect"
|
|
6
|
+
[class]="baseInputClass"
|
|
7
|
+
[disabled]="disabled"
|
|
8
|
+
[options]="options"
|
|
9
|
+
[optionLabel]="optionLabel"
|
|
10
|
+
[optionValue]="optionValue"
|
|
11
|
+
[filter]="filter"
|
|
12
|
+
[showClear]="showClear"
|
|
13
|
+
[(ngModel)]="value"
|
|
14
|
+
(onChange)="selectionChange($event)"
|
|
15
|
+
(onPanelHide)="panelHide($event)">
|
|
16
|
+
</p-multiSelect>
|
|
17
|
+
<label [for]="componentId">{{ label }}</label>
|
|
18
|
+
|
|
19
|
+
<kv-error [hasError]="hasControlError()">{{ erroMessage() }}</kv-error>
|
|
20
|
+
</span>
|
|
21
|
+
<ng-content></ng-content>
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { ComponentProviders } from '../../api/helpers/component-providers';
|
|
3
|
+
import { BaseComponentInput } from '../../api/base-components/base-component-input';
|
|
4
|
+
import { ComponentService } from '../../api/services/component.service';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'kv-multi-select',
|
|
9
|
+
templateUrl: './multi-select.component.html',
|
|
10
|
+
styleUrls: ['./multi-select.component.scss', '../../styles-components.scss'],
|
|
11
|
+
providers: ComponentProviders(MultiSelectComponent),
|
|
12
|
+
})
|
|
13
|
+
export class MultiSelectComponent extends BaseComponentInput<any> implements OnInit {
|
|
14
|
+
|
|
15
|
+
@Input() options: any;
|
|
16
|
+
@Input() optionLabel!: string;
|
|
17
|
+
@Input() optionValue!: string;
|
|
18
|
+
@Input() filter: boolean = false;
|
|
19
|
+
@Input() showClear: boolean = false;
|
|
20
|
+
|
|
21
|
+
@Output() onSelectionChange: EventEmitter<any> = new EventEmitter();
|
|
22
|
+
@Output() onPanelHide: EventEmitter<any> = new EventEmitter();
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
constructor(componentService: ComponentService) {
|
|
26
|
+
super(componentService);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override ngOnInit(): void {
|
|
30
|
+
super.ngOnInit();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public override get baseInputClass(): string {
|
|
34
|
+
return `p-multiselect-sm ${this.hasError ? 'ng-invalid ng-dirty' : ''}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
selectionChange(event: Event) {
|
|
38
|
+
this.onSelectionChange.emit(event);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
panelHide(event: Event) {
|
|
42
|
+
this.onPanelHide.emit(event);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="center field-checkbox">
|
|
2
|
+
|
|
3
|
+
<p-inputSwitch
|
|
4
|
+
[inputId]="componentId"
|
|
5
|
+
[(ngModel)]="value"
|
|
6
|
+
[disabled]="disabled">
|
|
7
|
+
</p-inputSwitch>
|
|
8
|
+
<label [for]="componentId">{{ label }}</label>
|
|
9
|
+
|
|
10
|
+
<kv-error [hasError]="hasControlError()">{{ erroMessage() }}</kv-error>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { ComponentProviders } from '../../api/helpers/component-providers';
|
|
3
|
+
import { BaseComponentInput } from '../../api/base-components/base-component-input';
|
|
4
|
+
import { ComponentService } from '../../api/services/component.service';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'kv-switch',
|
|
9
|
+
templateUrl: './switch.component.html',
|
|
10
|
+
styleUrls: ['./switch.component.scss', '../../styles-components.scss'],
|
|
11
|
+
providers: ComponentProviders(SwitchComponent),
|
|
12
|
+
})
|
|
13
|
+
export class SwitchComponent extends BaseComponentInput<boolean> implements OnInit {
|
|
14
|
+
|
|
15
|
+
@Output() onSwitchChange: EventEmitter<any> = new EventEmitter();
|
|
16
|
+
|
|
17
|
+
constructor(componentService: ComponentService) {
|
|
18
|
+
super(componentService);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
emitOnSwitchChange(event: any) {
|
|
22
|
+
this.onSwitchChange.emit(event);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { KvButtonsModule } from './buttons/kvbutton.module';
|
|
3
|
+
import { KvInputsModule } from './inputs/kvinputs.module';
|
|
4
|
+
import { KvTableModule } from './table/kvtable.module';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
],
|
|
9
|
+
imports: [
|
|
10
|
+
KvInputsModule,
|
|
11
|
+
KvButtonsModule,
|
|
12
|
+
KvTableModule
|
|
13
|
+
],
|
|
14
|
+
exports: [
|
|
15
|
+
KvInputsModule,
|
|
16
|
+
KvButtonsModule,
|
|
17
|
+
KvTableModule
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
export class KeevoComponentsModule { }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Pipe({ name: 'codigoFipe' })
|
|
4
|
+
export class CodigoFipePipe implements PipeTransform {
|
|
5
|
+
|
|
6
|
+
transform(value: string) {
|
|
7
|
+
if (value) {
|
|
8
|
+
|
|
9
|
+
const identificacao = value.replace(/[^0-9]/g, '');
|
|
10
|
+
|
|
11
|
+
return identificacao.replace(/(\d{6})(\d{1})/g, "\$1-\$2");
|
|
12
|
+
}
|
|
13
|
+
else return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Pipe({ name: 'cpfCnpj' })
|
|
4
|
+
export class CpfCnpjPipe implements PipeTransform {
|
|
5
|
+
|
|
6
|
+
transform(value: string) {
|
|
7
|
+
if (value) {
|
|
8
|
+
|
|
9
|
+
const identificacao = value.replace(/[^0-9]/g, '');
|
|
10
|
+
|
|
11
|
+
if (identificacao.length === 11) {
|
|
12
|
+
return identificacao.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/g, "\$1.\$2.\$3\-\$4");
|
|
13
|
+
} else if (identificacao.length === 14) {
|
|
14
|
+
return identificacao.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/g, "\$1.\$2.\$3\/\$4\-\$5");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
else return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { CpfCnpjPipe } from './cpfcnpj.pipe';
|
|
4
|
+
import { TelefonePipe } from './telefone.pipe';
|
|
5
|
+
import { CodigoFipePipe } from './codigofile.pipe';
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
imports: [
|
|
9
|
+
CommonModule
|
|
10
|
+
],
|
|
11
|
+
declarations: [
|
|
12
|
+
CpfCnpjPipe,
|
|
13
|
+
TelefonePipe,
|
|
14
|
+
CodigoFipePipe
|
|
15
|
+
],
|
|
16
|
+
exports: [
|
|
17
|
+
CpfCnpjPipe,
|
|
18
|
+
TelefonePipe,
|
|
19
|
+
CodigoFipePipe
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class PipesModule { }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Pipe({
|
|
4
|
+
name: 'Telefone'
|
|
5
|
+
})
|
|
6
|
+
export class TelefonePipe implements PipeTransform {
|
|
7
|
+
|
|
8
|
+
transform(tel: string) {
|
|
9
|
+
if (tel) {
|
|
10
|
+
const value = tel.toString().replace(/\D/g, '');
|
|
11
|
+
|
|
12
|
+
let foneFormatado = '';
|
|
13
|
+
|
|
14
|
+
if (value.length > 12) {
|
|
15
|
+
foneFormatado = value.replace(/(\d{2})?(\d{2})?(\d{5})?(\d{4})/, '+$1 ($2) $3-$4');
|
|
16
|
+
|
|
17
|
+
} else if (value.length > 11) {
|
|
18
|
+
foneFormatado = value.replace(/(\d{2})?(\d{2})?(\d{4})?(\d{4})/, '+$1 ($2) $3-$4');
|
|
19
|
+
|
|
20
|
+
} else if (value.length > 10) {
|
|
21
|
+
foneFormatado = value.replace(/(\d{2})?(\d{5})?(\d{4})/, '($1) $2-$3');
|
|
22
|
+
|
|
23
|
+
} else if (value.length > 9) {
|
|
24
|
+
foneFormatado = value.replace(/(\d{2})?(\d{4})?(\d{4})/, '($1) $2-$3');
|
|
25
|
+
|
|
26
|
+
} else if (value.length > 5) {
|
|
27
|
+
foneFormatado = value.replace(/^(\d{2})?(\d{4})?(\d{0,4})/, '($1) $2-$3');
|
|
28
|
+
|
|
29
|
+
} else if (value.length > 1) {
|
|
30
|
+
foneFormatado = value.replace(/^(\d{2})?(\d{0,5})/, '($1) $2');
|
|
31
|
+
} else {
|
|
32
|
+
if (tel !== '') { foneFormatado = value.replace(/^(\d*)/, '($1'); }
|
|
33
|
+
}
|
|
34
|
+
return foneFormatado;
|
|
35
|
+
}
|
|
36
|
+
else return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { TableComponent } from './table.component';
|
|
4
|
+
import { PrimeNgModule } from '../api/modules/primeng.module';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
declarations: [
|
|
10
|
+
TableComponent
|
|
11
|
+
],
|
|
12
|
+
imports: [
|
|
13
|
+
CommonModule,
|
|
14
|
+
PrimeNgModule
|
|
15
|
+
],
|
|
16
|
+
exports: [
|
|
17
|
+
TableComponent
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
export class KvTableModule { }
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<p-table
|
|
2
|
+
*ngIf="config"
|
|
3
|
+
#dt
|
|
4
|
+
styleClass="p-datatable-sm"
|
|
5
|
+
[value]="dataSource"
|
|
6
|
+
[(selection)]="selectedItems"
|
|
7
|
+
[columns]="config.columns"
|
|
8
|
+
[globalFilterFields]="globalFilterFields"
|
|
9
|
+
[rows]="rows"
|
|
10
|
+
[paginator]="paginator"
|
|
11
|
+
[rowsPerPageOptions]="rowsPerPageOptions"
|
|
12
|
+
[showCurrentPageReport]="true"
|
|
13
|
+
currentPageReportTemplate="{first} - {last} de {totalRecords}"
|
|
14
|
+
[rowHover]="true"
|
|
15
|
+
[totalRecords]="totalRecords"
|
|
16
|
+
[lazy]="config.lazy"
|
|
17
|
+
(onLazyLoad)="paginate($event)"
|
|
18
|
+
(selectionChange)="selectionChange($event)"
|
|
19
|
+
rowGroupMode="rowspan"
|
|
20
|
+
[groupRowsBy]="config.fieldGroup"
|
|
21
|
+
[showFirstLastIcon]="false"
|
|
22
|
+
[pageLinks]="1"
|
|
23
|
+
[responsive]="true"
|
|
24
|
+
responsiveLayout="stack"
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
<ng-template
|
|
28
|
+
pTemplate="caption"
|
|
29
|
+
*ngIf="config.enableCation"
|
|
30
|
+
>
|
|
31
|
+
<div class="flex flex-row flex-wrap justify-content-between grid formgrid p-fluid col-12">
|
|
32
|
+
<h5
|
|
33
|
+
class="field col-3"
|
|
34
|
+
*ngIf="config.title"
|
|
35
|
+
>{{ config.title }}</h5>
|
|
36
|
+
<div [class]="tamanhoTela < 768 ? 'col-12 md:col-6 lg:col-4' : 'col-12 md:col-6 lg:col-4 input-search'">
|
|
37
|
+
<span
|
|
38
|
+
*ngIf="config.enableFilter"
|
|
39
|
+
class="block mt-2 md:mt-0 p-input-icon-left"
|
|
40
|
+
>
|
|
41
|
+
<i class="pi pi-search"></i>
|
|
42
|
+
<input
|
|
43
|
+
pInputText
|
|
44
|
+
pAutoFocus
|
|
45
|
+
[autofocus]="true"
|
|
46
|
+
type="text"
|
|
47
|
+
(input)="onGlobalFilter(dt, $event)"
|
|
48
|
+
placeholder="Pesquisar..."
|
|
49
|
+
class="w-full"
|
|
50
|
+
/>
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
</ng-template>
|
|
56
|
+
|
|
57
|
+
<ng-template
|
|
58
|
+
pTemplate="header"
|
|
59
|
+
let-columns
|
|
60
|
+
>
|
|
61
|
+
|
|
62
|
+
<tr>
|
|
63
|
+
<th
|
|
64
|
+
style="width: 4rem"
|
|
65
|
+
*ngIf="config.enableSelect"
|
|
66
|
+
>
|
|
67
|
+
<p-tableHeaderCheckbox (click)="selectRow('toggleAll' ,$event)"></p-tableHeaderCheckbox>
|
|
68
|
+
</th>
|
|
69
|
+
|
|
70
|
+
<th
|
|
71
|
+
*ngFor="let col of columns;"
|
|
72
|
+
[pSortableColumn]="col.field"
|
|
73
|
+
[pSortableColumnDisabled]="col.sortable === false"
|
|
74
|
+
[style.width]="col.width"
|
|
75
|
+
class="text-sm"
|
|
76
|
+
>
|
|
77
|
+
<div [class]=" centralizarColunas(col) ? 'flex flex-row justify-content-center' : 'flex flex-row '">
|
|
78
|
+
{{col.header}}
|
|
79
|
+
<p-sortIcon
|
|
80
|
+
*ngIf="col.sortable === true"
|
|
81
|
+
[field]="col.field"
|
|
82
|
+
style="font-size: 10px;"
|
|
83
|
+
></p-sortIcon>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
</th>
|
|
87
|
+
<th *ngIf="config.actions && config.actions.length> 0"></th>
|
|
88
|
+
</tr>
|
|
89
|
+
</ng-template>
|
|
90
|
+
|
|
91
|
+
<ng-template
|
|
92
|
+
pTemplate="body"
|
|
93
|
+
let-rowData
|
|
94
|
+
let-columns="columns"
|
|
95
|
+
let-rowgroup="rowgroup"
|
|
96
|
+
let-rowspan="rowspan"
|
|
97
|
+
>
|
|
98
|
+
|
|
99
|
+
<tr (dblclick)="doubleClick($event, rowData)">
|
|
100
|
+
|
|
101
|
+
<td
|
|
102
|
+
*ngIf="config.enableSelect"
|
|
103
|
+
[style]="applyStyle(rowData, {field:'check-box' , header: ''})"
|
|
104
|
+
>
|
|
105
|
+
<p-tableCheckbox
|
|
106
|
+
[value]="rowData"
|
|
107
|
+
(click)="selectRow(rowData, $event)"
|
|
108
|
+
></p-tableCheckbox>
|
|
109
|
+
</td>
|
|
110
|
+
|
|
111
|
+
<ng-container *ngFor="let col of columns">
|
|
112
|
+
<td
|
|
113
|
+
*ngIf="rowgroup"
|
|
114
|
+
[attr.rowspan]="rowgroup && col.grouped? rowspan: null"
|
|
115
|
+
class="rowTable"
|
|
116
|
+
[style]="applyStyle(rowData, col) + centralizarColunas(col)"
|
|
117
|
+
>
|
|
118
|
+
<span class="p-column-title">{{col.header}}</span>
|
|
119
|
+
<span
|
|
120
|
+
*ngIf="!isBooleanField(rowData, col); else booleanField"
|
|
121
|
+
[class]="returnRowClass(rowData, col)"
|
|
122
|
+
>
|
|
123
|
+
{{ transformValue(rowData, col) }}
|
|
124
|
+
</span>
|
|
125
|
+
|
|
126
|
+
<ng-template #booleanField>
|
|
127
|
+
<i [ngClass]="rowData[col.field] ? 'pi pi-check' : 'pi pi-times'"></i>
|
|
128
|
+
</ng-template>
|
|
129
|
+
</td>
|
|
130
|
+
|
|
131
|
+
<td
|
|
132
|
+
*ngIf="!rowgroup && !col.grouped"
|
|
133
|
+
[style]="applyStyle(rowData, col) + centralizarColunas(col)"
|
|
134
|
+
class="rowTable"
|
|
135
|
+
>
|
|
136
|
+
<span class="p-column-title">{{col.header}}</span>
|
|
137
|
+
<span
|
|
138
|
+
*ngIf="!isBooleanField(rowData, col); else booleanField"
|
|
139
|
+
[class]="returnRowClass(rowData, col)"
|
|
140
|
+
>
|
|
141
|
+
{{ transformValue(rowData, col) }}
|
|
142
|
+
</span>
|
|
143
|
+
|
|
144
|
+
<ng-template #booleanField>
|
|
145
|
+
<i [ngClass]="rowData[col.field] ? 'text-green-500 pi pi-check' : 'text-red-500 pi pi-times'"></i>
|
|
146
|
+
</ng-template>
|
|
147
|
+
</td>
|
|
148
|
+
|
|
149
|
+
</ng-container>
|
|
150
|
+
|
|
151
|
+
<td
|
|
152
|
+
*ngIf="config.actions && config.actions.length> 0"
|
|
153
|
+
[style]="applyStyle(rowData, {field:'btns-options' , header: ''})"
|
|
154
|
+
>
|
|
155
|
+
<div class="flex flex-row justify-content-end w-full">
|
|
156
|
+
<div *ngFor="let action of config.actions">
|
|
157
|
+
<p-button
|
|
158
|
+
[icon]="retornarCampo(action, rowData, 'icon')"
|
|
159
|
+
styleClass="p-button-text p-button-secondary p-button-raised h-2rem w-2rem ml-1"
|
|
160
|
+
(click)="action?.command(); activeItem(rowData)"
|
|
161
|
+
[pTooltip]="retornarCampo(action, rowData, 'tooltip')"
|
|
162
|
+
></p-button>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
</td>
|
|
167
|
+
|
|
168
|
+
</tr>
|
|
169
|
+
</ng-template>
|
|
170
|
+
|
|
171
|
+
<ng-template
|
|
172
|
+
pTemplate="emptymessage"
|
|
173
|
+
let-columns
|
|
174
|
+
>
|
|
175
|
+
<tr>
|
|
176
|
+
<td
|
|
177
|
+
[attr.colspan]="columns.length"
|
|
178
|
+
style="text-align: center;"
|
|
179
|
+
>
|
|
180
|
+
Nenhum registro encontrado
|
|
181
|
+
</td>
|
|
182
|
+
</tr>
|
|
183
|
+
</ng-template>
|
|
184
|
+
</p-table>
|
|
185
|
+
<p-menu
|
|
186
|
+
#menu
|
|
187
|
+
[popup]="true"
|
|
188
|
+
[model]="config.actions"
|
|
189
|
+
></p-menu>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// ::ng-deep .p-datatable>.p-datatable-wrapper::-webkit-scrollbar {
|
|
2
|
+
// height: 8px;
|
|
3
|
+
// width: 8px;
|
|
4
|
+
// background-color: rgba(222, 222, 222, 0.75);
|
|
5
|
+
// }
|
|
6
|
+
|
|
7
|
+
// ::ng-deep .p-datatable>.p-datatable-wrapper::-webkit-scrollbar-thumb {
|
|
8
|
+
// border-radius: 6px;
|
|
9
|
+
// background-color: rgba(0, 0, 0, 0.5);
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
.error-show {
|
|
13
|
+
background-color: red;
|
|
14
|
+
width: 5px;
|
|
15
|
+
height: 10px
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.input-search {
|
|
19
|
+
position: relative;
|
|
20
|
+
right: 15px;
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* tslint:disable:no-unused-variable */
|
|
2
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { DebugElement } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
import { TableComponent } from './table.component';
|
|
7
|
+
|
|
8
|
+
describe('TableComponent', () => {
|
|
9
|
+
let component: TableComponent;
|
|
10
|
+
let fixture: ComponentFixture<TableComponent>;
|
|
11
|
+
|
|
12
|
+
beforeEach(async(() => {
|
|
13
|
+
TestBed.configureTestingModule({
|
|
14
|
+
declarations: [ TableComponent ]
|
|
15
|
+
})
|
|
16
|
+
.compileComponents();
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
fixture = TestBed.createComponent(TableComponent);
|
|
21
|
+
component = fixture.componentInstance;
|
|
22
|
+
fixture.detectChanges();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should create', () => {
|
|
26
|
+
expect(component).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
});
|