@c10t/nice-component-library 0.0.21-g → 0.0.22
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/components/cva-counter-input.component.d.ts +4 -2
- package/components/cva-form-control.d.ts +4 -0
- package/components/cva-input.component.d.ts +4 -2
- package/components/cva-live-searching.component.d.ts +4 -2
- package/components/cva-multi-select-autocomplete.d.ts +4 -2
- package/components/datepicker/cva-date-picker.component.d.ts +4 -2
- package/components/datepicker/cva-range-date-picker.component.d.ts +4 -2
- package/components/table/cva-smart-table.component.d.ts +4 -1
- package/fesm2022/c10t-nice-component-library.mjs +77 -68
- package/fesm2022/c10t-nice-component-library.mjs.map +1 -1
- package/package.json +1 -1
- package/services/validator.service.d.ts +3 -3
|
@@ -3,8 +3,9 @@ import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms
|
|
|
3
3
|
import { ValidatorService } from '../services/validator.service';
|
|
4
4
|
import { AlignEnum } from '../enums/align.enum';
|
|
5
5
|
import { NiceComponentLibraryConfig } from '../models/nice-component-library.config';
|
|
6
|
+
import { CvaFormControl } from './cva-form-control';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class CvaCounterInputComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
8
|
+
export declare class CvaCounterInputComponent implements ControlValueAccessor, CvaFormControl, OnInit, OnChanges {
|
|
8
9
|
private injector;
|
|
9
10
|
label: string;
|
|
10
11
|
placeholder: string;
|
|
@@ -25,12 +26,13 @@ export declare class CvaCounterInputComponent implements ControlValueAccessor, O
|
|
|
25
26
|
isFormControl: boolean;
|
|
26
27
|
onChange: EventEmitter<number>;
|
|
27
28
|
onEnter: EventEmitter<void>;
|
|
28
|
-
formControl: AbstractControl |
|
|
29
|
+
formControl: AbstractControl | null;
|
|
29
30
|
config: NiceComponentLibraryConfig;
|
|
30
31
|
constructor(injector: Injector, ngControl: NgControl);
|
|
31
32
|
get NsValidator(): typeof ValidatorService;
|
|
32
33
|
get counterValue(): number;
|
|
33
34
|
set counterValue(val: number);
|
|
35
|
+
getFormControl(): AbstractControl | null;
|
|
34
36
|
ngOnChanges(changes: SimpleChanges): void;
|
|
35
37
|
ngOnInit(): void;
|
|
36
38
|
getMinNumber(): number;
|
|
@@ -3,8 +3,9 @@ import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms
|
|
|
3
3
|
import { ValidatorService } from '../services/validator.service';
|
|
4
4
|
import { NiceComponentLibraryConfig } from '../models/nice-component-library.config';
|
|
5
5
|
import { AlignEnum } from '../enums/align.enum';
|
|
6
|
+
import { CvaFormControl } from './cva-form-control';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class CvaInputComponent implements ControlValueAccessor, OnInit {
|
|
8
|
+
export declare class CvaInputComponent implements ControlValueAccessor, CvaFormControl, OnInit {
|
|
8
9
|
private injector;
|
|
9
10
|
label: string;
|
|
10
11
|
name: string;
|
|
@@ -30,12 +31,13 @@ export declare class CvaInputComponent implements ControlValueAccessor, OnInit {
|
|
|
30
31
|
patternFilter: string;
|
|
31
32
|
isFormControl: boolean;
|
|
32
33
|
formatFunc: any;
|
|
33
|
-
formControl: AbstractControl |
|
|
34
|
+
formControl: AbstractControl | null;
|
|
34
35
|
config: NiceComponentLibraryConfig;
|
|
35
36
|
constructor(injector: Injector, ngControl: NgControl);
|
|
36
37
|
get NsValidator(): typeof ValidatorService;
|
|
37
38
|
get textValue(): string;
|
|
38
39
|
set textValue(val: string);
|
|
40
|
+
getFormControl(): AbstractControl | null;
|
|
39
41
|
ngOnInit(): void;
|
|
40
42
|
callValidator(): void;
|
|
41
43
|
propagateChange: (_: any) => void;
|
|
@@ -3,8 +3,9 @@ import { AbstractControl, ControlValueAccessor, FormControl, NgControl } from '@
|
|
|
3
3
|
import { ValidatorService } from '../services/validator.service';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { NiceComponentLibraryConfig } from '../models/nice-component-library.config';
|
|
6
|
+
import { CvaFormControl } from './cva-form-control';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class CvaLiveSearchingComponent implements ControlValueAccessor, OnInit {
|
|
8
|
+
export declare class CvaLiveSearchingComponent implements ControlValueAccessor, CvaFormControl, OnInit {
|
|
8
9
|
private injector;
|
|
9
10
|
label: string;
|
|
10
11
|
placeholder: string;
|
|
@@ -23,7 +24,7 @@ export declare class CvaLiveSearchingComponent implements ControlValueAccessor,
|
|
|
23
24
|
isFormControl: boolean;
|
|
24
25
|
row?: any;
|
|
25
26
|
columnDef?: string;
|
|
26
|
-
formControl: AbstractControl |
|
|
27
|
+
formControl: AbstractControl | null;
|
|
27
28
|
textControl: FormControl<string>;
|
|
28
29
|
filteredOptions: any[];
|
|
29
30
|
selected: any;
|
|
@@ -32,6 +33,7 @@ export declare class CvaLiveSearchingComponent implements ControlValueAccessor,
|
|
|
32
33
|
private searchSub?;
|
|
33
34
|
constructor(injector: Injector, ngControl: NgControl);
|
|
34
35
|
get NsValidator(): typeof ValidatorService;
|
|
36
|
+
getFormControl(): AbstractControl | null;
|
|
35
37
|
ngOnInit(): void;
|
|
36
38
|
callValidator(): void;
|
|
37
39
|
propagateChange: (_: any) => void;
|
|
@@ -8,8 +8,9 @@ import { ValidatorService } from '../services/validator.service';
|
|
|
8
8
|
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
9
9
|
import { MatOptionSelectionChange } from '@angular/material/core';
|
|
10
10
|
import { NiceComponentLibraryConfig } from '../models/nice-component-library.config';
|
|
11
|
+
import { CvaFormControl } from './cva-form-control';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
|
-
export declare class CvaMultiSelectAutocomplete implements ControlValueAccessor, OnInit, OnChanges {
|
|
13
|
+
export declare class CvaMultiSelectAutocomplete implements ControlValueAccessor, CvaFormControl, OnInit, OnChanges {
|
|
13
14
|
private translateService;
|
|
14
15
|
private injector;
|
|
15
16
|
placeholder: string;
|
|
@@ -32,7 +33,7 @@ export declare class CvaMultiSelectAutocomplete implements ControlValueAccessor,
|
|
|
32
33
|
valueOptionRef: SelectModel[];
|
|
33
34
|
isFormControl: boolean;
|
|
34
35
|
searchInputRef: any;
|
|
35
|
-
formControl: AbstractControl |
|
|
36
|
+
formControl: AbstractControl | null;
|
|
36
37
|
filteredOptions: SelectModel[];
|
|
37
38
|
selectAllChecked: boolean;
|
|
38
39
|
labelCount: number;
|
|
@@ -46,6 +47,7 @@ export declare class CvaMultiSelectAutocomplete implements ControlValueAccessor,
|
|
|
46
47
|
get NsValidator(): typeof ValidatorService;
|
|
47
48
|
get selectedValue(): any[] | any;
|
|
48
49
|
set selectedValue(val: any[] | any);
|
|
50
|
+
getFormControl(): AbstractControl | null;
|
|
49
51
|
ngOnInit(): void;
|
|
50
52
|
getRequired(): boolean;
|
|
51
53
|
callValidator(): void;
|
|
@@ -4,8 +4,9 @@ import { MatDatepicker } from '@angular/material/datepicker';
|
|
|
4
4
|
import { DateUtilService } from '../../services/date-util.service';
|
|
5
5
|
import { NiceComponentLibraryConfig } from '../../models/nice-component-library.config';
|
|
6
6
|
import { ValidatorService } from '../../services/validator.service';
|
|
7
|
+
import { CvaFormControl } from '../cva-form-control';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class CvaDatePickerComponent implements ControlValueAccessor, OnInit {
|
|
9
|
+
export declare class CvaDatePickerComponent implements ControlValueAccessor, CvaFormControl, OnInit {
|
|
9
10
|
private dateServiceUtil;
|
|
10
11
|
private injector;
|
|
11
12
|
label: string;
|
|
@@ -23,12 +24,13 @@ export declare class CvaDatePickerComponent implements ControlValueAccessor, OnI
|
|
|
23
24
|
title: string | null;
|
|
24
25
|
config: NiceComponentLibraryConfig;
|
|
25
26
|
isFormControl: boolean;
|
|
26
|
-
formControl: AbstractControl |
|
|
27
|
+
formControl: AbstractControl | null;
|
|
27
28
|
datepicker: MatDatepicker<any> | undefined;
|
|
28
29
|
constructor(dateServiceUtil: DateUtilService, ngControl: NgControl, injector: Injector);
|
|
29
30
|
get NsValidator(): typeof ValidatorService;
|
|
30
31
|
get datepickerValue(): any;
|
|
31
32
|
set datepickerValue(val: any);
|
|
33
|
+
getFormControl(): AbstractControl | null;
|
|
32
34
|
ngOnInit(): void;
|
|
33
35
|
callValidator(): void;
|
|
34
36
|
checkRequired(isRequired: boolean | (() => boolean)): boolean;
|
|
@@ -4,8 +4,9 @@ import { RangeDatePickerModel } from '../../models/components/range-date-picker.
|
|
|
4
4
|
import { DateUtilService } from '../../services/date-util.service';
|
|
5
5
|
import { ValidatorService } from '../../services/validator.service';
|
|
6
6
|
import { MatDateRangePicker } from '@angular/material/datepicker';
|
|
7
|
+
import { CvaFormControl } from '../cva-form-control';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class CvaRangeDatePickerComponent implements ControlValueAccessor, OnInit {
|
|
9
|
+
export declare class CvaRangeDatePickerComponent implements ControlValueAccessor, CvaFormControl, OnInit {
|
|
9
10
|
private dateServiceUtil;
|
|
10
11
|
private injector;
|
|
11
12
|
label: string;
|
|
@@ -36,7 +37,7 @@ export declare class CvaRangeDatePickerComponent implements ControlValueAccessor
|
|
|
36
37
|
toDateControlName: string;
|
|
37
38
|
title: string | null;
|
|
38
39
|
isFormControl: boolean;
|
|
39
|
-
formControl: AbstractControl |
|
|
40
|
+
formControl: AbstractControl | null;
|
|
40
41
|
defaultFromDate: any;
|
|
41
42
|
picker: MatDateRangePicker<any> | undefined;
|
|
42
43
|
constructor(dateServiceUtil: DateUtilService, ngControl: NgControl, injector: Injector);
|
|
@@ -45,6 +46,7 @@ export declare class CvaRangeDatePickerComponent implements ControlValueAccessor
|
|
|
45
46
|
set fromDateValue(val: any);
|
|
46
47
|
get toDateValue(): any;
|
|
47
48
|
set toDateValue(val: any);
|
|
49
|
+
getFormControl(): AbstractControl | null;
|
|
48
50
|
ngOnInit(): void;
|
|
49
51
|
propagateChange: (_: any) => void;
|
|
50
52
|
registerOnChange(fn: any): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AfterContentChecked, ChangeDetectorRef, EventEmitter, Injector, OnChanges, OnInit } from '@angular/core';
|
|
1
|
+
import { AfterContentChecked, ChangeDetectorRef, EventEmitter, Injector, OnChanges, OnInit, QueryList } from '@angular/core';
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
3
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
4
4
|
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
|
@@ -13,11 +13,13 @@ import { IconTypeEnum } from '../../enums/icon-type.enum';
|
|
|
13
13
|
import { TableFooterModel } from '../../models/components/table-footer.model';
|
|
14
14
|
import { NiceComponentLibraryConfig } from '../../models/nice-component-library.config';
|
|
15
15
|
import { NumericInputFormat } from '../../directives/numeric-input-format';
|
|
16
|
+
import { CvaFormControl } from '../cva-form-control';
|
|
16
17
|
import * as i0 from "@angular/core";
|
|
17
18
|
export declare class CvaSmartTableComponent implements ControlValueAccessor, OnChanges, OnInit, AfterContentChecked {
|
|
18
19
|
private ref;
|
|
19
20
|
config: NiceComponentLibraryConfig;
|
|
20
21
|
private injector;
|
|
22
|
+
cellComponents: QueryList<CvaFormControl>;
|
|
21
23
|
moduleName: string;
|
|
22
24
|
columns: ColumnModel[];
|
|
23
25
|
buttons: ButtonModel[];
|
|
@@ -69,6 +71,7 @@ export declare class CvaSmartTableComponent implements ControlValueAccessor, OnC
|
|
|
69
71
|
expandRow(i: number, row: any, parentRowClassIndex: number | 0 | 1): void;
|
|
70
72
|
getAlign(column: ColumnModel): AlignEnum;
|
|
71
73
|
getHeaderButtonColspan(): number;
|
|
74
|
+
markAllControlsAsDirty(): void;
|
|
72
75
|
static ɵfac: i0.ɵɵFactoryDeclaration<CvaSmartTableComponent, [null, null, null, { optional: true; self: true; }]>;
|
|
73
76
|
static ɵcmp: i0.ɵɵComponentDeclaration<CvaSmartTableComponent, "cva-smart-table", never, { "moduleName": { "alias": "moduleName"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "buttons": { "alias": "buttons"; "required": false; }; "value": { "alias": "value"; "required": false; }; "minRow": { "alias": "minRow"; "required": false; }; "maxRow": { "alias": "maxRow"; "required": false; }; "errorMessages": { "alias": "errorMessages"; "required": false; }; "isFormControl": { "alias": "isFormControl"; "required": false; }; "isSticky": { "alias": "isSticky"; "required": false; }; "isStickyHeader": { "alias": "isStickyHeader"; "required": false; }; "isStickyFooter": { "alias": "isStickyFooter"; "required": false; }; "isExpandRowTable": { "alias": "isExpandRowTable"; "required": false; }; "expandRowProperty": { "alias": "expandRowProperty"; "required": false; }; }, { "clickAction": "clickAction"; "onChange": "onChange"; }, never, never, false, never>;
|
|
74
77
|
}
|
|
@@ -3,7 +3,7 @@ import { FormGroup, FormArray, FormControl, Validators, NgControl, NG_VALUE_ACCE
|
|
|
3
3
|
import * as i1$3 from '@angular/common/http';
|
|
4
4
|
import { HttpParams, HttpHeaders, HttpResponse, HttpResponseBase } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, Self, Optional, Inject, Component, Injectable, Directive, EventEmitter, Output, Input, Host, Pipe, HostListener, forwardRef, ViewChild, HostBinding, ViewEncapsulation, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
6
|
+
import { InjectionToken, Self, Optional, Inject, Component, Injectable, Directive, EventEmitter, Output, Input, Host, Pipe, HostListener, forwardRef, ViewChild, ViewChildren, HostBinding, ViewEncapsulation, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
7
7
|
import * as i1$1 from '@angular/material/dialog';
|
|
8
8
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
9
9
|
import * as i1 from '@ngx-translate/core';
|
|
@@ -1578,7 +1578,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1578
1578
|
|
|
1579
1579
|
class ValidatorService {
|
|
1580
1580
|
static invalid(control) {
|
|
1581
|
-
|
|
1581
|
+
if (!control || !control.dirty) {
|
|
1582
|
+
return false;
|
|
1583
|
+
}
|
|
1584
|
+
return control.invalid || !!control.errors;
|
|
1582
1585
|
}
|
|
1583
1586
|
static getErrorMessage(control, errorMessages) {
|
|
1584
1587
|
if (!control) {
|
|
@@ -1872,7 +1875,7 @@ class CvaCounterInputComponent {
|
|
|
1872
1875
|
onChange = new EventEmitter();
|
|
1873
1876
|
onEnter = new EventEmitter();
|
|
1874
1877
|
// Cái này là để gắn khi nó là FormControl trong 1 FormGroup
|
|
1875
|
-
formControl;
|
|
1878
|
+
formControl = null;
|
|
1876
1879
|
config;
|
|
1877
1880
|
constructor(injector, ngControl) {
|
|
1878
1881
|
this.injector = injector;
|
|
@@ -1892,6 +1895,9 @@ class CvaCounterInputComponent {
|
|
|
1892
1895
|
set counterValue(val) {
|
|
1893
1896
|
this.writeValue(val);
|
|
1894
1897
|
}
|
|
1898
|
+
getFormControl() {
|
|
1899
|
+
return this.formControl;
|
|
1900
|
+
}
|
|
1895
1901
|
ngOnChanges(changes) {
|
|
1896
1902
|
if ('value' in changes) {
|
|
1897
1903
|
this.value = changes.value.currentValue;
|
|
@@ -1913,7 +1919,7 @@ class CvaCounterInputComponent {
|
|
|
1913
1919
|
if (ngControl && !this.formControl) {
|
|
1914
1920
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
1915
1921
|
if (this.isFormControl) {
|
|
1916
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
1922
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
1917
1923
|
}
|
|
1918
1924
|
else {
|
|
1919
1925
|
this.formControl = new FormControl();
|
|
@@ -1977,22 +1983,22 @@ class CvaCounterInputComponent {
|
|
|
1977
1983
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: CvaCounterInputComponent, isStandalone: false, selector: "cva-counter-input", inputs: { label: "label", placeholder: "placeholder", suffixText: "suffixText", hint: "hint", value: "value", disabled: "disabled", required: "required", errorMessages: "errorMessages", min: "min", max: "max", error: "error", isDecimal: "isDecimal", isLabelOutside: "isLabelOutside", isFloatLabel: "isFloatLabel", percentOfLabelOutside: "percentOfLabelOutside", alignNumber: "alignNumber", isFormControl: "isFormControl" }, outputs: { onChange: "onChange", onEnter: "onEnter" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1978
1984
|
<!-- css labelOutside trong base.theme-->
|
|
1979
1985
|
<div class="cva-counter-input"
|
|
1980
|
-
[ngClass]="{'labelOutside':
|
|
1986
|
+
[ngClass]="{'labelOutside': isLabelOutside, 'float_label': isFloatLabel && !isLabelOutside}"
|
|
1981
1987
|
fxLayout="row" fxLayout.lt-sm="row wrap">
|
|
1982
1988
|
<mat-label *ngIf="isLabelOutside" class="label_width"
|
|
1983
1989
|
fxLayout="column" fxFlex="auto" fxFlex.lt-md="100%">
|
|
1984
1990
|
<div class="label">
|
|
1985
1991
|
<div>
|
|
1986
1992
|
{{ (label ? label : placeholder) | translate }}<span
|
|
1987
|
-
class="required-label-outside">{{
|
|
1993
|
+
class="required-label-outside">{{ required ? '*' : '' }}</span>
|
|
1988
1994
|
</div>
|
|
1989
1995
|
</div>
|
|
1990
1996
|
</mat-label>
|
|
1991
1997
|
<mat-form-field *ngIf="isShowControl()"
|
|
1992
|
-
appearance="outline" [floatLabel]="
|
|
1998
|
+
appearance="outline" [floatLabel]="isFloatLabel ? 'always' : 'auto'"
|
|
1993
1999
|
[hideRequiredMarker]="!isFloatLabel"
|
|
1994
2000
|
fxLayout="column" fxFlex="auto" fxFlex.lt-md="100%">
|
|
1995
|
-
<mat-label *ngIf="!isLabelOutside &&
|
|
2001
|
+
<mat-label *ngIf="!isLabelOutside && isFloatLabel">{{ (label ? label : placeholder) | translate }}</mat-label>
|
|
1996
2002
|
<div class="input-area">
|
|
1997
2003
|
<input matInput type="number" [(ngModel)]="counterValue" #nsCounterInput="ngModel"
|
|
1998
2004
|
[style.text-align]="alignNumber"
|
|
@@ -2033,22 +2039,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
2033
2039
|
template: `
|
|
2034
2040
|
<!-- css labelOutside trong base.theme-->
|
|
2035
2041
|
<div class="cva-counter-input"
|
|
2036
|
-
[ngClass]="{'labelOutside':
|
|
2042
|
+
[ngClass]="{'labelOutside': isLabelOutside, 'float_label': isFloatLabel && !isLabelOutside}"
|
|
2037
2043
|
fxLayout="row" fxLayout.lt-sm="row wrap">
|
|
2038
2044
|
<mat-label *ngIf="isLabelOutside" class="label_width"
|
|
2039
2045
|
fxLayout="column" fxFlex="auto" fxFlex.lt-md="100%">
|
|
2040
2046
|
<div class="label">
|
|
2041
2047
|
<div>
|
|
2042
2048
|
{{ (label ? label : placeholder) | translate }}<span
|
|
2043
|
-
class="required-label-outside">{{
|
|
2049
|
+
class="required-label-outside">{{ required ? '*' : '' }}</span>
|
|
2044
2050
|
</div>
|
|
2045
2051
|
</div>
|
|
2046
2052
|
</mat-label>
|
|
2047
2053
|
<mat-form-field *ngIf="isShowControl()"
|
|
2048
|
-
appearance="outline" [floatLabel]="
|
|
2054
|
+
appearance="outline" [floatLabel]="isFloatLabel ? 'always' : 'auto'"
|
|
2049
2055
|
[hideRequiredMarker]="!isFloatLabel"
|
|
2050
2056
|
fxLayout="column" fxFlex="auto" fxFlex.lt-md="100%">
|
|
2051
|
-
<mat-label *ngIf="!isLabelOutside &&
|
|
2057
|
+
<mat-label *ngIf="!isLabelOutside && isFloatLabel">{{ (label ? label : placeholder) | translate }}</mat-label>
|
|
2052
2058
|
<div class="input-area">
|
|
2053
2059
|
<input matInput type="number" [(ngModel)]="counterValue" #nsCounterInput="ngModel"
|
|
2054
2060
|
[style.text-align]="alignNumber"
|
|
@@ -3329,7 +3335,7 @@ class CvaInputComponent {
|
|
|
3329
3335
|
// Chỉ bằng false khi trong NsSmartTable thôi nhé @@
|
|
3330
3336
|
isFormControl = true;
|
|
3331
3337
|
formatFunc;
|
|
3332
|
-
formControl =
|
|
3338
|
+
formControl = null;
|
|
3333
3339
|
config;
|
|
3334
3340
|
constructor(injector, ngControl) {
|
|
3335
3341
|
this.injector = injector;
|
|
@@ -3348,6 +3354,9 @@ class CvaInputComponent {
|
|
|
3348
3354
|
set textValue(val) {
|
|
3349
3355
|
this.writeValue(val);
|
|
3350
3356
|
}
|
|
3357
|
+
getFormControl() {
|
|
3358
|
+
return this.formControl;
|
|
3359
|
+
}
|
|
3351
3360
|
ngOnInit() {
|
|
3352
3361
|
this.callValidator();
|
|
3353
3362
|
}
|
|
@@ -3357,7 +3366,7 @@ class CvaInputComponent {
|
|
|
3357
3366
|
if (ngControl && !this.formControl) {
|
|
3358
3367
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
3359
3368
|
if (this.isFormControl) {
|
|
3360
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
3369
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
3361
3370
|
}
|
|
3362
3371
|
else {
|
|
3363
3372
|
this.formControl = new FormControl();
|
|
@@ -3765,7 +3774,7 @@ class CvaDatePickerComponent {
|
|
|
3765
3774
|
config;
|
|
3766
3775
|
// Chỉ bằng false khi trong NsSmartTable thôi @@
|
|
3767
3776
|
isFormControl = true;
|
|
3768
|
-
formControl;
|
|
3777
|
+
formControl = null;
|
|
3769
3778
|
datepicker;
|
|
3770
3779
|
constructor(dateServiceUtil, ngControl, injector) {
|
|
3771
3780
|
this.dateServiceUtil = dateServiceUtil;
|
|
@@ -3791,6 +3800,9 @@ class CvaDatePickerComponent {
|
|
|
3791
3800
|
set datepickerValue(val) {
|
|
3792
3801
|
this.writeValue(val);
|
|
3793
3802
|
}
|
|
3803
|
+
getFormControl() {
|
|
3804
|
+
return this.formControl;
|
|
3805
|
+
}
|
|
3794
3806
|
ngOnInit() {
|
|
3795
3807
|
if (this.isShowControl()) {
|
|
3796
3808
|
this.callValidator();
|
|
@@ -3802,7 +3814,7 @@ class CvaDatePickerComponent {
|
|
|
3802
3814
|
if (ngControl && !this.formControl) {
|
|
3803
3815
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
3804
3816
|
if (this.isFormControl) {
|
|
3805
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
3817
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
3806
3818
|
}
|
|
3807
3819
|
else {
|
|
3808
3820
|
this.formControl = new FormControl();
|
|
@@ -4099,7 +4111,7 @@ class CvaMultiSelectAutocomplete {
|
|
|
4099
4111
|
isFormControl = true;
|
|
4100
4112
|
searchInputRef;
|
|
4101
4113
|
// Cái này là để gắn khi nó là FormControl trong 1 FormGroup
|
|
4102
|
-
formControl;
|
|
4114
|
+
formControl = null;
|
|
4103
4115
|
filteredOptions = [];
|
|
4104
4116
|
selectAllChecked = false;
|
|
4105
4117
|
labelCount = 1;
|
|
@@ -4130,6 +4142,9 @@ class CvaMultiSelectAutocomplete {
|
|
|
4130
4142
|
set selectedValue(val) {
|
|
4131
4143
|
// this.writeValue(val); // Đọc comment bên dưới matSelectionChange
|
|
4132
4144
|
}
|
|
4145
|
+
getFormControl() {
|
|
4146
|
+
return this.formControl;
|
|
4147
|
+
}
|
|
4133
4148
|
ngOnInit() {
|
|
4134
4149
|
this.callValidator();
|
|
4135
4150
|
}
|
|
@@ -4141,7 +4156,7 @@ class CvaMultiSelectAutocomplete {
|
|
|
4141
4156
|
if (ngControl && !this.formControl) {
|
|
4142
4157
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
4143
4158
|
if (this.isFormControl) {
|
|
4144
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
4159
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
4145
4160
|
}
|
|
4146
4161
|
else {
|
|
4147
4162
|
this.formControl = new FormControl();
|
|
@@ -4632,7 +4647,7 @@ class CvaLiveSearchingComponent {
|
|
|
4632
4647
|
isFormControl = true;
|
|
4633
4648
|
row;
|
|
4634
4649
|
columnDef;
|
|
4635
|
-
formControl =
|
|
4650
|
+
formControl = null;
|
|
4636
4651
|
textControl = new FormControl('');
|
|
4637
4652
|
filteredOptions = [];
|
|
4638
4653
|
selected;
|
|
@@ -4650,6 +4665,9 @@ class CvaLiveSearchingComponent {
|
|
|
4650
4665
|
get NsValidator() {
|
|
4651
4666
|
return ValidatorService;
|
|
4652
4667
|
}
|
|
4668
|
+
getFormControl() {
|
|
4669
|
+
return this.formControl;
|
|
4670
|
+
}
|
|
4653
4671
|
ngOnInit() {
|
|
4654
4672
|
this.callValidator();
|
|
4655
4673
|
this.textValueChangeSubscribe();
|
|
@@ -4663,7 +4681,7 @@ class CvaLiveSearchingComponent {
|
|
|
4663
4681
|
if (ngControl && !this.formControl) {
|
|
4664
4682
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
4665
4683
|
if (this.isFormControl) {
|
|
4666
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
4684
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
4667
4685
|
}
|
|
4668
4686
|
else {
|
|
4669
4687
|
this.formControl = new FormControl();
|
|
@@ -4952,6 +4970,7 @@ class CvaSmartTableComponent {
|
|
|
4952
4970
|
ref;
|
|
4953
4971
|
config;
|
|
4954
4972
|
injector;
|
|
4973
|
+
cellComponents;
|
|
4955
4974
|
moduleName = '';
|
|
4956
4975
|
columns = [];
|
|
4957
4976
|
buttons = [];
|
|
@@ -5114,27 +5133,6 @@ class CvaSmartTableComponent {
|
|
|
5114
5133
|
onDisplayFooter(footer, dataTable) {
|
|
5115
5134
|
return typeof (footer.display) === 'function' ? footer.display(dataTable) : !!footer.display;
|
|
5116
5135
|
}
|
|
5117
|
-
// //Cái khúc này về sau mà có cái loại validate nào mà ngoài thì mới enable validate cột sau
|
|
5118
|
-
// validate(control: AbstractControl): ValidationErrors | null {
|
|
5119
|
-
// let valid = null;
|
|
5120
|
-
//
|
|
5121
|
-
// if (this.value) {
|
|
5122
|
-
// for (const row of this.value) {
|
|
5123
|
-
// for (const column of this.columns) {
|
|
5124
|
-
// if (column.validate) {
|
|
5125
|
-
// valid = column.validate(row);
|
|
5126
|
-
// if (valid) {
|
|
5127
|
-
// break;
|
|
5128
|
-
// }
|
|
5129
|
-
// }
|
|
5130
|
-
// }
|
|
5131
|
-
// if (valid) {
|
|
5132
|
-
// break;
|
|
5133
|
-
// }
|
|
5134
|
-
// }
|
|
5135
|
-
// }
|
|
5136
|
-
// return valid;
|
|
5137
|
-
// }
|
|
5138
5136
|
callValidator() {
|
|
5139
5137
|
const ngControl = this.injector.get(NgControl);
|
|
5140
5138
|
if (ngControl && !this.formControl) {
|
|
@@ -5150,6 +5148,11 @@ class CvaSmartTableComponent {
|
|
|
5150
5148
|
minRow: this.minRow,
|
|
5151
5149
|
maxRow: this.maxRow,
|
|
5152
5150
|
}));
|
|
5151
|
+
this.formControl.statusChanges.subscribe(status => {
|
|
5152
|
+
if (this.formControl?.touched && this.formControl?.dirty) {
|
|
5153
|
+
this.markAllControlsAsDirty();
|
|
5154
|
+
}
|
|
5155
|
+
});
|
|
5153
5156
|
}
|
|
5154
5157
|
}
|
|
5155
5158
|
if (this.formControl) {
|
|
@@ -5173,29 +5176,6 @@ class CvaSmartTableComponent {
|
|
|
5173
5176
|
if (row.isChildRow) {
|
|
5174
5177
|
return;
|
|
5175
5178
|
}
|
|
5176
|
-
// default not expand
|
|
5177
|
-
// if (row.expanded) {
|
|
5178
|
-
// // remove the flag
|
|
5179
|
-
// row.expanded = false;
|
|
5180
|
-
//
|
|
5181
|
-
// // remove the child rows
|
|
5182
|
-
// let childrenDetected = false;
|
|
5183
|
-
// const length = this.datasource.data.length;
|
|
5184
|
-
// for (let index = 0; index < length; index++) {
|
|
5185
|
-
// if (childrenDetected && !this.datasource.data[index].isChildRow) {
|
|
5186
|
-
// break;
|
|
5187
|
-
// }
|
|
5188
|
-
//
|
|
5189
|
-
// if (index > i && this.datasource.data[index].isChildRow) {
|
|
5190
|
-
// this.datasource.data.splice(index, 1);
|
|
5191
|
-
// index--;
|
|
5192
|
-
// childrenDetected = true;
|
|
5193
|
-
// }
|
|
5194
|
-
// }
|
|
5195
|
-
//
|
|
5196
|
-
// this.matTable?.renderRows();
|
|
5197
|
-
// return;
|
|
5198
|
-
// }
|
|
5199
5179
|
// set expanded to true so we don't expand this row again
|
|
5200
5180
|
row.expanded = true;
|
|
5201
5181
|
row.parentRowClassIndex = parentRowClassIndex;
|
|
@@ -5220,8 +5200,19 @@ class CvaSmartTableComponent {
|
|
|
5220
5200
|
this.buttonColspan = TableService.getHeaderButtonColspan(this.buttons, this.datasource.data);
|
|
5221
5201
|
return this.buttonColspan;
|
|
5222
5202
|
}
|
|
5203
|
+
markAllControlsAsDirty() {
|
|
5204
|
+
if (this.cellComponents) {
|
|
5205
|
+
this.cellComponents.forEach(cell => {
|
|
5206
|
+
const control = cell.getFormControl();
|
|
5207
|
+
if (control) {
|
|
5208
|
+
control.markAsDirty();
|
|
5209
|
+
control.updateValueAndValidity();
|
|
5210
|
+
}
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5223
5214
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CvaSmartTableComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: InjectTokenNextSolutionsConfig }, { token: i0.Injector }, { token: i1$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
5224
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: CvaSmartTableComponent, isStandalone: false, selector: "cva-smart-table", inputs: { moduleName: "moduleName", columns: "columns", buttons: "buttons", value: "value", minRow: "minRow", maxRow: "maxRow", errorMessages: "errorMessages", isFormControl: "isFormControl", isSticky: "isSticky", isStickyHeader: "isStickyHeader", isStickyFooter: "isStickyFooter", isExpandRowTable: "isExpandRowTable", expandRowProperty: "expandRowProperty" }, outputs: { clickAction: "clickAction", onChange: "onChange" }, viewQueries: [{ propertyName: "matTable", first: true, predicate: ["matTable"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
5215
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: CvaSmartTableComponent, isStandalone: false, selector: "cva-smart-table", inputs: { moduleName: "moduleName", columns: "columns", buttons: "buttons", value: "value", minRow: "minRow", maxRow: "maxRow", errorMessages: "errorMessages", isFormControl: "isFormControl", isSticky: "isSticky", isStickyHeader: "isStickyHeader", isStickyFooter: "isStickyFooter", isExpandRowTable: "isExpandRowTable", expandRowProperty: "expandRowProperty" }, outputs: { clickAction: "clickAction", onChange: "onChange" }, viewQueries: [{ propertyName: "matTable", first: true, predicate: ["matTable"], descendants: true }, { propertyName: "cellComponents", predicate: ["cellComponentRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
5225
5216
|
<div class="table-responsive"
|
|
5226
5217
|
[ngClass]="{'fixed_header': isSticky||isStickyHeader, 'fixed_footer': isSticky||isStickyFooter}">
|
|
5227
5218
|
<table mat-table [dataSource]="datasource" #matTable class="mat-elevation-z8 cva-smart-table">
|
|
@@ -5304,6 +5295,7 @@ class CvaSmartTableComponent {
|
|
|
5304
5295
|
</div>
|
|
5305
5296
|
</ng-container>
|
|
5306
5297
|
<cva-counter-input *ngSwitchCase="ColumnTypes.INPUT_COUNTER"
|
|
5298
|
+
#cellComponentRef
|
|
5307
5299
|
class="inputNumber" #nsCounterInput
|
|
5308
5300
|
[isFormControl]="false"
|
|
5309
5301
|
[alignNumber]="getAlign(column)"
|
|
@@ -5317,6 +5309,7 @@ class CvaSmartTableComponent {
|
|
|
5317
5309
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5318
5310
|
</cva-counter-input>
|
|
5319
5311
|
<cva-input *ngSwitchCase="ColumnTypes.INPUT"
|
|
5312
|
+
#cellComponentRef
|
|
5320
5313
|
[isFormControl]="false"
|
|
5321
5314
|
[alignText]="getAlign(column)"
|
|
5322
5315
|
[disabled]="column.disabled ? column.disabled(result) : false"
|
|
@@ -5328,6 +5321,7 @@ class CvaSmartTableComponent {
|
|
|
5328
5321
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5329
5322
|
</cva-input>
|
|
5330
5323
|
<cva-input *ngSwitchCase="ColumnTypes.INPUT_CURRENCY"
|
|
5324
|
+
#cellComponentRef
|
|
5331
5325
|
[isFormControl]="false"
|
|
5332
5326
|
[alignText]="getAlign(column)"
|
|
5333
5327
|
[disabled]="column.disabled ? column.disabled(result) : false"
|
|
@@ -5341,6 +5335,7 @@ class CvaSmartTableComponent {
|
|
|
5341
5335
|
[formatFunc]="formatFunc">
|
|
5342
5336
|
</cva-input>
|
|
5343
5337
|
<cva-date-picker *ngSwitchCase="ColumnTypes.DATE_PICKER"
|
|
5338
|
+
#cellComponentRef
|
|
5344
5339
|
[value]="result[column.columnDef]"
|
|
5345
5340
|
[isFormControl]="false"
|
|
5346
5341
|
[minDate]="column.min ? column.min(result) : null"
|
|
@@ -5351,6 +5346,7 @@ class CvaSmartTableComponent {
|
|
|
5351
5346
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5352
5347
|
</cva-date-picker>
|
|
5353
5348
|
<cva-multi-select-autocomplete [isFormControl]="false"
|
|
5349
|
+
#cellComponentRef
|
|
5354
5350
|
*ngSwitchCase="ColumnTypes.MULTI_SELECT_AUTOCOMPLETE"
|
|
5355
5351
|
class="multiSelectAutocomplete"
|
|
5356
5352
|
[isTree]="column.isTree??false"
|
|
@@ -5373,6 +5369,7 @@ class CvaSmartTableComponent {
|
|
|
5373
5369
|
</mat-checkbox>
|
|
5374
5370
|
</div>
|
|
5375
5371
|
<cva-live-searching *ngSwitchCase="ColumnTypes.LIVE_SEARCHING"
|
|
5372
|
+
#cellComponentRef
|
|
5376
5373
|
[isFormControl]="false" [required]="getRequired(column)"
|
|
5377
5374
|
[row]="result" [columnDef]="column.columnDef"
|
|
5378
5375
|
[searchFn]="column.searchFn"
|
|
@@ -5551,6 +5548,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5551
5548
|
</div>
|
|
5552
5549
|
</ng-container>
|
|
5553
5550
|
<cva-counter-input *ngSwitchCase="ColumnTypes.INPUT_COUNTER"
|
|
5551
|
+
#cellComponentRef
|
|
5554
5552
|
class="inputNumber" #nsCounterInput
|
|
5555
5553
|
[isFormControl]="false"
|
|
5556
5554
|
[alignNumber]="getAlign(column)"
|
|
@@ -5564,6 +5562,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5564
5562
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5565
5563
|
</cva-counter-input>
|
|
5566
5564
|
<cva-input *ngSwitchCase="ColumnTypes.INPUT"
|
|
5565
|
+
#cellComponentRef
|
|
5567
5566
|
[isFormControl]="false"
|
|
5568
5567
|
[alignText]="getAlign(column)"
|
|
5569
5568
|
[disabled]="column.disabled ? column.disabled(result) : false"
|
|
@@ -5575,6 +5574,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5575
5574
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5576
5575
|
</cva-input>
|
|
5577
5576
|
<cva-input *ngSwitchCase="ColumnTypes.INPUT_CURRENCY"
|
|
5577
|
+
#cellComponentRef
|
|
5578
5578
|
[isFormControl]="false"
|
|
5579
5579
|
[alignText]="getAlign(column)"
|
|
5580
5580
|
[disabled]="column.disabled ? column.disabled(result) : false"
|
|
@@ -5588,6 +5588,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5588
5588
|
[formatFunc]="formatFunc">
|
|
5589
5589
|
</cva-input>
|
|
5590
5590
|
<cva-date-picker *ngSwitchCase="ColumnTypes.DATE_PICKER"
|
|
5591
|
+
#cellComponentRef
|
|
5591
5592
|
[value]="result[column.columnDef]"
|
|
5592
5593
|
[isFormControl]="false"
|
|
5593
5594
|
[minDate]="column.min ? column.min(result) : null"
|
|
@@ -5598,6 +5599,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5598
5599
|
(onChange)="onCellValueChange(result, column, $event);">
|
|
5599
5600
|
</cva-date-picker>
|
|
5600
5601
|
<cva-multi-select-autocomplete [isFormControl]="false"
|
|
5602
|
+
#cellComponentRef
|
|
5601
5603
|
*ngSwitchCase="ColumnTypes.MULTI_SELECT_AUTOCOMPLETE"
|
|
5602
5604
|
class="multiSelectAutocomplete"
|
|
5603
5605
|
[isTree]="column.isTree??false"
|
|
@@ -5620,6 +5622,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5620
5622
|
</mat-checkbox>
|
|
5621
5623
|
</div>
|
|
5622
5624
|
<cva-live-searching *ngSwitchCase="ColumnTypes.LIVE_SEARCHING"
|
|
5625
|
+
#cellComponentRef
|
|
5623
5626
|
[isFormControl]="false" [required]="getRequired(column)"
|
|
5624
5627
|
[row]="result" [columnDef]="column.columnDef"
|
|
5625
5628
|
[searchFn]="column.searchFn"
|
|
@@ -5717,7 +5720,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
5717
5720
|
type: Self
|
|
5718
5721
|
}, {
|
|
5719
5722
|
type: Optional
|
|
5720
|
-
}] }], propDecorators: {
|
|
5723
|
+
}] }], propDecorators: { cellComponents: [{
|
|
5724
|
+
type: ViewChildren,
|
|
5725
|
+
args: ['cellComponentRef']
|
|
5726
|
+
}], moduleName: [{
|
|
5721
5727
|
type: Input
|
|
5722
5728
|
}], columns: [{
|
|
5723
5729
|
type: Input
|
|
@@ -5790,7 +5796,7 @@ class CvaRangeDatePickerComponent {
|
|
|
5790
5796
|
// config: NiceComponentLibraryConfig;
|
|
5791
5797
|
// Chỉ bằng false khi trong NsSmartTable thôi @@
|
|
5792
5798
|
isFormControl = true;
|
|
5793
|
-
formControl;
|
|
5799
|
+
formControl = null;
|
|
5794
5800
|
defaultFromDate; // lưu giá trị khởi tạo ban đầu khi truyền từ bên ngoài vào
|
|
5795
5801
|
picker;
|
|
5796
5802
|
constructor(dateServiceUtil, ngControl, injector) {
|
|
@@ -5830,6 +5836,9 @@ class CvaRangeDatePickerComponent {
|
|
|
5830
5836
|
this.value.toDate = val;
|
|
5831
5837
|
this.writeValue(this.value);
|
|
5832
5838
|
}
|
|
5839
|
+
getFormControl() {
|
|
5840
|
+
return this.formControl;
|
|
5841
|
+
}
|
|
5833
5842
|
ngOnInit() {
|
|
5834
5843
|
this.callValidator();
|
|
5835
5844
|
}
|
|
@@ -5875,7 +5884,7 @@ class CvaRangeDatePickerComponent {
|
|
|
5875
5884
|
if (ngControl && !this.formControl) {
|
|
5876
5885
|
// Nếu là NsSmartTable thì phải tự new FormControl còn không thì cứ hóng parent FormControl về ^^
|
|
5877
5886
|
if (this.isFormControl) {
|
|
5878
|
-
this.formControl = ngControl.control ? ngControl.control :
|
|
5887
|
+
this.formControl = ngControl.control ? ngControl.control : null;
|
|
5879
5888
|
if (this.formControl && !this.formControl.value) {
|
|
5880
5889
|
this.formControl.setValue(this.value);
|
|
5881
5890
|
}
|