@c10t/nice-component-library 0.0.1-beta → 0.0.3-beta
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 +2 -2
- package/components/cva-input.component.d.ts +2 -2
- package/components/cva-multi-select-autocomplete.d.ts +2 -2
- package/components/cva-quill-editor.component.d.ts +2 -2
- package/components/cva-radiobutton.component.d.ts +2 -2
- package/components/datepicker/cva-date-picker.component.d.ts +2 -2
- package/components/datepicker/cva-range-date-picker.component.d.ts +2 -2
- package/components/tree/cva-flat-tree.component.d.ts +2 -2
- package/enums/base-status.enum.d.ts +6 -0
- package/fesm2022/c10t-nice-component-library.mjs +57 -51
- package/fesm2022/c10t-nice-component-library.mjs.map +1 -1
- package/index.d.ts +4 -3
- package/package.json +4 -4
- package/services/{ns-validator.service.d.ts → validator.service.d.ts} +3 -3
- package/src/styles/base.theme.scss +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter, Injector, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
|
-
import {
|
|
3
|
+
import { ValidatorService } from '../services/validator.service';
|
|
4
4
|
import { AlignEnum } from '../enums/align.enum';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class CvaCounterInputComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
@@ -24,7 +24,7 @@ export declare class CvaCounterInputComponent implements ControlValueAccessor, O
|
|
|
24
24
|
isFormControl: boolean;
|
|
25
25
|
onChange: EventEmitter<number>;
|
|
26
26
|
formControl: AbstractControl | undefined;
|
|
27
|
-
get NsValidator(): typeof
|
|
27
|
+
get NsValidator(): typeof ValidatorService;
|
|
28
28
|
constructor(injector: Injector, ngControl: NgControl);
|
|
29
29
|
ngOnChanges(changes: SimpleChanges): void;
|
|
30
30
|
ngOnInit(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit, EventEmitter, Injector, OnInit } from '@angular/core';
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
|
-
import {
|
|
3
|
+
import { ValidatorService } from '../services/validator.service';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class CvaInputComponent implements ControlValueAccessor, OnInit, AfterViewInit {
|
|
6
6
|
private injector;
|
|
@@ -29,7 +29,7 @@ export declare class CvaInputComponent implements ControlValueAccessor, OnInit,
|
|
|
29
29
|
isFormControl: boolean;
|
|
30
30
|
formatFunc: any;
|
|
31
31
|
control: AbstractControl | undefined;
|
|
32
|
-
get NsValidator(): typeof
|
|
32
|
+
get NsValidator(): typeof ValidatorService;
|
|
33
33
|
constructor(injector: Injector, ngControl: NgControl);
|
|
34
34
|
ngAfterViewInit(): void;
|
|
35
35
|
ngOnInit(): void;
|
|
@@ -4,7 +4,7 @@ import { SelectModel } from '../models/components/select.model';
|
|
|
4
4
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
5
5
|
import { MatSelectChange } from '@angular/material/select';
|
|
6
6
|
import { TranslateService } from '@ngx-translate/core';
|
|
7
|
-
import {
|
|
7
|
+
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 * as i0 from "@angular/core";
|
|
@@ -37,7 +37,7 @@ export declare class CvaMultiSelectAutocomplete implements ControlValueAccessor,
|
|
|
37
37
|
get displayString(): string;
|
|
38
38
|
labelCount: number;
|
|
39
39
|
cdkVirtualScrollViewPort: CdkVirtualScrollViewport | undefined;
|
|
40
|
-
get NsValidator(): typeof
|
|
40
|
+
get NsValidator(): typeof ValidatorService;
|
|
41
41
|
constructor(translateService: TranslateService, injector: Injector, ngControl: NgControl);
|
|
42
42
|
ngOnInit(): void;
|
|
43
43
|
getRequired(): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, Injector, OnInit } from '@angular/core';
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl, ValidationErrors } from '@angular/forms';
|
|
3
3
|
import { QuillEditorComponent, QuillModules } from 'ngx-quill';
|
|
4
|
-
import {
|
|
4
|
+
import { ValidatorService } from '../services/validator.service';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class CvaQuillEditorComponent implements ControlValueAccessor, OnInit {
|
|
7
7
|
private injector;
|
|
@@ -33,7 +33,7 @@ export declare class CvaQuillEditorComponent implements ControlValueAccessor, On
|
|
|
33
33
|
isFormControl: boolean;
|
|
34
34
|
formatFunc: any;
|
|
35
35
|
control: AbstractControl | undefined;
|
|
36
|
-
get NsValidator(): typeof
|
|
36
|
+
get NsValidator(): typeof ValidatorService;
|
|
37
37
|
constructor(injector: Injector, ngControl: NgControl);
|
|
38
38
|
ngOnInit(): void;
|
|
39
39
|
get textValue(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter, Injector, OnChanges, OnInit } from '@angular/core';
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
3
|
import { SelectModel } from '../models/components/select.model';
|
|
4
|
-
import {
|
|
4
|
+
import { ValidatorService } from "../services/validator.service";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class CvaRadiobuttonComponent implements ControlValueAccessor, OnChanges, OnInit {
|
|
7
7
|
private injector;
|
|
@@ -18,7 +18,7 @@ export declare class CvaRadiobuttonComponent implements ControlValueAccessor, On
|
|
|
18
18
|
control: AbstractControl | undefined;
|
|
19
19
|
get selectedValue(): number;
|
|
20
20
|
set selectedValue(val: number);
|
|
21
|
-
get NsValidator(): typeof
|
|
21
|
+
get NsValidator(): typeof ValidatorService;
|
|
22
22
|
constructor(injector: Injector, ngControl: NgControl);
|
|
23
23
|
ngOnChanges(): void;
|
|
24
24
|
ngOnInit(): void;
|
|
@@ -2,7 +2,7 @@ import { EventEmitter, Injector, OnInit } from '@angular/core';
|
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
3
|
import { DateUtilService } from '../../services/date-util.service';
|
|
4
4
|
import { NiceComponentLibraryConfig } from '../../models/nice-component-library.config';
|
|
5
|
-
import {
|
|
5
|
+
import { ValidatorService } from '../../services/validator.service';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class CvaDatePickerComponent implements ControlValueAccessor, OnInit {
|
|
8
8
|
private dateServiceUtil;
|
|
@@ -23,7 +23,7 @@ export declare class CvaDatePickerComponent implements ControlValueAccessor, OnI
|
|
|
23
23
|
config: NiceComponentLibraryConfig;
|
|
24
24
|
isFormControl: boolean;
|
|
25
25
|
formControl: AbstractControl | undefined;
|
|
26
|
-
get NsValidator(): typeof
|
|
26
|
+
get NsValidator(): typeof ValidatorService;
|
|
27
27
|
constructor(dateServiceUtil: DateUtilService, ngControl: NgControl, injector: Injector);
|
|
28
28
|
ngOnInit(): void;
|
|
29
29
|
callValidator(): void;
|
|
@@ -2,7 +2,7 @@ import { EventEmitter, Injector, OnInit } from '@angular/core';
|
|
|
2
2
|
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
3
|
import { RangeDatePickerModel } from '../../models/components/range-date-picker.model';
|
|
4
4
|
import { DateUtilService } from '../../services/date-util.service';
|
|
5
|
-
import {
|
|
5
|
+
import { ValidatorService } from '../../services/validator.service';
|
|
6
6
|
import { MatDateRangePicker } from '@angular/material/datepicker';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
export declare class CvaRangeDatePickerComponent implements ControlValueAccessor, OnInit {
|
|
@@ -38,7 +38,7 @@ export declare class CvaRangeDatePickerComponent implements ControlValueAccessor
|
|
|
38
38
|
isFormControl: boolean;
|
|
39
39
|
formControl: AbstractControl | undefined;
|
|
40
40
|
defaultFromDate: any;
|
|
41
|
-
get NsValiator(): typeof
|
|
41
|
+
get NsValiator(): typeof ValidatorService;
|
|
42
42
|
constructor(dateServiceUtil: DateUtilService, ngControl: NgControl, injector: Injector);
|
|
43
43
|
get fromDateValue(): any;
|
|
44
44
|
set fromDateValue(val: any);
|
|
@@ -5,7 +5,7 @@ import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms
|
|
|
5
5
|
import { TranslateService } from '@ngx-translate/core';
|
|
6
6
|
import { FlatTreeConfigModel } from '../../models/components/flat-tree-config.model';
|
|
7
7
|
import { FlatTreeNodeModel } from '../../models/components/flat-tree-node.model';
|
|
8
|
-
import {
|
|
8
|
+
import { ValidatorService } from '../../services/validator.service';
|
|
9
9
|
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
export declare class CvaFlatTreeComponent implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges {
|
|
@@ -52,7 +52,7 @@ export declare class CvaFlatTreeComponent implements ControlValueAccessor, OnIni
|
|
|
52
52
|
formControl: AbstractControl | undefined;
|
|
53
53
|
chooseVirtualScroll?: CdkVirtualScrollViewport;
|
|
54
54
|
selectedVirtualScroll?: CdkVirtualScrollViewport;
|
|
55
|
-
get NsValiator(): typeof
|
|
55
|
+
get NsValiator(): typeof ValidatorService;
|
|
56
56
|
constructor(translateService: TranslateService, injector: Injector, cdr: ChangeDetectorRef, ngControl: NgControl);
|
|
57
57
|
setSelectedNode(): void;
|
|
58
58
|
setDataSourceOrigin(): void;
|
|
@@ -477,6 +477,14 @@ var ActionTypeEnum;
|
|
|
477
477
|
ActionTypeEnum["_VIEW"] = "view";
|
|
478
478
|
})(ActionTypeEnum || (ActionTypeEnum = {}));
|
|
479
479
|
|
|
480
|
+
var BaseStatusEnum;
|
|
481
|
+
(function (BaseStatusEnum) {
|
|
482
|
+
BaseStatusEnum["_"] = "base.status.all";
|
|
483
|
+
BaseStatusEnum["_DRAFT"] = "base.status.draft";
|
|
484
|
+
BaseStatusEnum["_APPROVED"] = "base.status.approved";
|
|
485
|
+
BaseStatusEnum["_REJECTED"] = "base.status.rejected";
|
|
486
|
+
})(BaseStatusEnum || (BaseStatusEnum = {}));
|
|
487
|
+
|
|
480
488
|
class BaseTableComponent {
|
|
481
489
|
activatedRoute;
|
|
482
490
|
authoritiesService;
|
|
@@ -1522,7 +1530,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1522
1530
|
type: Injectable
|
|
1523
1531
|
}] });
|
|
1524
1532
|
|
|
1525
|
-
class
|
|
1533
|
+
class ValidatorService {
|
|
1526
1534
|
static invalid(control) {
|
|
1527
1535
|
return !!control && control.dirty ? control.invalid : false;
|
|
1528
1536
|
}
|
|
@@ -1559,7 +1567,7 @@ class NsValidator {
|
|
|
1559
1567
|
const validationFns = [];
|
|
1560
1568
|
const validation = (control) => {
|
|
1561
1569
|
const value = control.value;
|
|
1562
|
-
if (
|
|
1570
|
+
if (ValidatorService.getRequiredDynamic(conditions.required) && (value === undefined || value === null || value === ''
|
|
1563
1571
|
|| (!!conditions.multiple && value.length === 0))) {
|
|
1564
1572
|
return { required: true };
|
|
1565
1573
|
}
|
|
@@ -1595,13 +1603,13 @@ class NsValidator {
|
|
|
1595
1603
|
}
|
|
1596
1604
|
if (conditions.min != undefined && conditions.min != null) {
|
|
1597
1605
|
const validationMin = (control) => {
|
|
1598
|
-
return
|
|
1606
|
+
return ValidatorService.customMinValueNsCounterInput(control.value, ValidatorService.getMinMaxDynamic(conditions.min));
|
|
1599
1607
|
};
|
|
1600
1608
|
validationFns.push(validationMin);
|
|
1601
1609
|
}
|
|
1602
1610
|
if (conditions.max != undefined && conditions.max != null) {
|
|
1603
1611
|
const validationMax = (control) => {
|
|
1604
|
-
return
|
|
1612
|
+
return ValidatorService.customMaxValueNsCounterInput(control.value, ValidatorService.getMinMaxDynamic(conditions.max));
|
|
1605
1613
|
};
|
|
1606
1614
|
validationFns.push(validationMax);
|
|
1607
1615
|
}
|
|
@@ -1629,10 +1637,10 @@ class NsValidator {
|
|
|
1629
1637
|
// || NsValidator.getRequiredDynamic(conditions.requiredToDate)) {
|
|
1630
1638
|
const validation = (control) => {
|
|
1631
1639
|
const range = control.value;
|
|
1632
|
-
if (!range?.fromDate &&
|
|
1640
|
+
if (!range?.fromDate && ValidatorService.getRequiredDynamic(conditions.requiredFromDate)) {
|
|
1633
1641
|
return { requiredFromDate: true };
|
|
1634
1642
|
}
|
|
1635
|
-
if (!range?.toDate &&
|
|
1643
|
+
if (!range?.toDate && ValidatorService.getRequiredDynamic(conditions.requiredToDate)) {
|
|
1636
1644
|
return { requiredToDate: true };
|
|
1637
1645
|
}
|
|
1638
1646
|
return null;
|
|
@@ -1713,28 +1721,28 @@ class NsValidator {
|
|
|
1713
1721
|
const tempControl = new FormControl();
|
|
1714
1722
|
tempControl.setValue(row[column.columnDef]);
|
|
1715
1723
|
if (TableService.getColumnType(column, row) === ColumnTypeEnum.MULTI_SELECT_AUTOCOMPLETE) {
|
|
1716
|
-
if (
|
|
1724
|
+
if (ValidatorService.getRequired(column)) {
|
|
1717
1725
|
tempControl.setValidators(Validators.required);
|
|
1718
1726
|
}
|
|
1719
1727
|
}
|
|
1720
1728
|
else if (TableService.getColumnType(column, row) === ColumnTypeEnum.INPUT_COUNTER) {
|
|
1721
|
-
tempControl.setValidators(
|
|
1722
|
-
required:
|
|
1729
|
+
tempControl.setValidators(ValidatorService.generateNsCounterInputValidators({
|
|
1730
|
+
required: ValidatorService.getRequired(column),
|
|
1723
1731
|
min: null,
|
|
1724
1732
|
max: null,
|
|
1725
|
-
isDecimal:
|
|
1733
|
+
isDecimal: ValidatorService.getIsDecimal(column),
|
|
1726
1734
|
}));
|
|
1727
1735
|
}
|
|
1728
1736
|
else if (TableService.getColumnType(column, row) === ColumnTypeEnum.DATE_PICKER) {
|
|
1729
|
-
tempControl.setValidators(
|
|
1730
|
-
required:
|
|
1737
|
+
tempControl.setValidators(ValidatorService.generateNsDatePickerValidators({
|
|
1738
|
+
required: ValidatorService.getRequired(column),
|
|
1731
1739
|
min: null,
|
|
1732
1740
|
max: null,
|
|
1733
1741
|
}));
|
|
1734
1742
|
}
|
|
1735
1743
|
else if (TableService.getColumnType(column, row) === ColumnTypeEnum.INPUT) {
|
|
1736
|
-
tempControl.setValidators(
|
|
1737
|
-
required:
|
|
1744
|
+
tempControl.setValidators(ValidatorService.generateNsInputValidators({
|
|
1745
|
+
required: ValidatorService.getRequired(column),
|
|
1738
1746
|
maxLength: column.max ? column.max(row) : undefined,
|
|
1739
1747
|
minLength: column.min ? column.min(row) : undefined,
|
|
1740
1748
|
pattern: undefined
|
|
@@ -1746,11 +1754,11 @@ class NsValidator {
|
|
|
1746
1754
|
if (tempControl.errors) {
|
|
1747
1755
|
errorsArr.push(tempControl.errors);
|
|
1748
1756
|
}
|
|
1749
|
-
if (
|
|
1750
|
-
errorsArr.push(
|
|
1757
|
+
if (ValidatorService.customMinDateValidatorControl(tempControl.value, column.min ? column.min(row) : null)) {
|
|
1758
|
+
errorsArr.push(ValidatorService.customMinDateValidatorControl(tempControl.value, column.min ? column.min(row) : null));
|
|
1751
1759
|
}
|
|
1752
|
-
if (
|
|
1753
|
-
errorsArr.push(
|
|
1760
|
+
if (ValidatorService.customMaxDateValidatorControl(tempControl.value, column.max ? column.max(row) : null)) {
|
|
1761
|
+
errorsArr.push(ValidatorService.customMaxDateValidatorControl(tempControl.value, column.max ? column.max(row) : null));
|
|
1754
1762
|
}
|
|
1755
1763
|
if (errorsArr.length > 0) {
|
|
1756
1764
|
tempControl.setErrors(errorsArr);
|
|
@@ -1761,11 +1769,11 @@ class NsValidator {
|
|
|
1761
1769
|
if (tempControl.errors) {
|
|
1762
1770
|
errorsArr.push(tempControl.errors);
|
|
1763
1771
|
}
|
|
1764
|
-
if (
|
|
1765
|
-
errorsArr.push(
|
|
1772
|
+
if (ValidatorService.customMinValueNsCounterInput(tempControl.value, column.min ? column.min(row) : null)) {
|
|
1773
|
+
errorsArr.push(ValidatorService.customMinValueNsCounterInput(tempControl.value, column.min ? column.min(row) : null));
|
|
1766
1774
|
}
|
|
1767
|
-
if (
|
|
1768
|
-
errorsArr.push(
|
|
1775
|
+
if (ValidatorService.customMaxValueNsCounterInput(tempControl.value, column.max ? column.max(row) : null)) {
|
|
1776
|
+
errorsArr.push(ValidatorService.customMaxValueNsCounterInput(tempControl.value, column.max ? column.max(row) : null));
|
|
1769
1777
|
}
|
|
1770
1778
|
if (errorsArr.length > 0) {
|
|
1771
1779
|
tempControl.setErrors(errorsArr);
|
|
@@ -1781,10 +1789,10 @@ class NsValidator {
|
|
|
1781
1789
|
};
|
|
1782
1790
|
return validator;
|
|
1783
1791
|
}
|
|
1784
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type:
|
|
1785
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type:
|
|
1792
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ValidatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1793
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ValidatorService });
|
|
1786
1794
|
}
|
|
1787
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type:
|
|
1795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ValidatorService, decorators: [{
|
|
1788
1796
|
type: Injectable
|
|
1789
1797
|
}] });
|
|
1790
1798
|
|
|
@@ -1813,7 +1821,7 @@ class CvaCounterInputComponent {
|
|
|
1813
1821
|
// Cái này là để gắn khi nó là FormControl trong 1 FormGroup
|
|
1814
1822
|
formControl;
|
|
1815
1823
|
get NsValidator() {
|
|
1816
|
-
return
|
|
1824
|
+
return ValidatorService;
|
|
1817
1825
|
}
|
|
1818
1826
|
constructor(injector, ngControl) {
|
|
1819
1827
|
this.injector = injector;
|
|
@@ -1863,7 +1871,7 @@ class CvaCounterInputComponent {
|
|
|
1863
1871
|
// - Nếu this.formControl là parent FormControl thì sẽ show error lên FormGroup
|
|
1864
1872
|
// - Nếu this.formControl là new FormControl thì sẽ quét QueryList để check {errors}
|
|
1865
1873
|
if (this.formControl) {
|
|
1866
|
-
this.formControl.setValidators(
|
|
1874
|
+
this.formControl.setValidators(ValidatorService.generateNsCounterInputValidators({
|
|
1867
1875
|
required: this.required,
|
|
1868
1876
|
min: this.min,
|
|
1869
1877
|
max: this.max,
|
|
@@ -1879,11 +1887,11 @@ class CvaCounterInputComponent {
|
|
|
1879
1887
|
// Nếu là parent FormControl rồi thì kệ
|
|
1880
1888
|
this.formControl.updateValueAndValidity();
|
|
1881
1889
|
if (!this.formControl.errors) {
|
|
1882
|
-
const minErr =
|
|
1890
|
+
const minErr = ValidatorService.customMinValueNsCounterInput(this.value, this.getMinNumber());
|
|
1883
1891
|
if (minErr) {
|
|
1884
1892
|
this.formControl.setErrors(minErr);
|
|
1885
1893
|
}
|
|
1886
|
-
const maxErr =
|
|
1894
|
+
const maxErr = ValidatorService.customMaxValueNsCounterInput(this.value, this.getMaxNumber());
|
|
1887
1895
|
if (maxErr) {
|
|
1888
1896
|
this.formControl.setErrors(maxErr);
|
|
1889
1897
|
}
|
|
@@ -3207,7 +3215,7 @@ class CvaInputComponent {
|
|
|
3207
3215
|
formatFunc;
|
|
3208
3216
|
control = undefined;
|
|
3209
3217
|
get NsValidator() {
|
|
3210
|
-
return
|
|
3218
|
+
return ValidatorService;
|
|
3211
3219
|
}
|
|
3212
3220
|
constructor(injector, ngControl) {
|
|
3213
3221
|
this.injector = injector;
|
|
@@ -3249,7 +3257,7 @@ class CvaInputComponent {
|
|
|
3249
3257
|
// - Nếu this.formControl là new FormControl thì sẽ quét QueryList để check {errors}
|
|
3250
3258
|
if (this.control) {
|
|
3251
3259
|
if (this.control.validator) {
|
|
3252
|
-
this.control.setValidators([...
|
|
3260
|
+
this.control.setValidators([...ValidatorService.generateNsInputValidators({
|
|
3253
3261
|
required: this.required,
|
|
3254
3262
|
minLength: this.minLength,
|
|
3255
3263
|
maxLength: this.maxLength,
|
|
@@ -3257,7 +3265,7 @@ class CvaInputComponent {
|
|
|
3257
3265
|
}), this.control.validator]);
|
|
3258
3266
|
}
|
|
3259
3267
|
else {
|
|
3260
|
-
this.control.setValidators([...
|
|
3268
|
+
this.control.setValidators([...ValidatorService.generateNsInputValidators({
|
|
3261
3269
|
required: this.required,
|
|
3262
3270
|
minLength: this.minLength,
|
|
3263
3271
|
maxLength: this.maxLength,
|
|
@@ -3604,7 +3612,7 @@ class CvaDatePickerComponent {
|
|
|
3604
3612
|
isFormControl = true;
|
|
3605
3613
|
formControl;
|
|
3606
3614
|
get NsValidator() {
|
|
3607
|
-
return
|
|
3615
|
+
return ValidatorService;
|
|
3608
3616
|
}
|
|
3609
3617
|
constructor(dateServiceUtil, ngControl, injector) {
|
|
3610
3618
|
this.dateServiceUtil = dateServiceUtil;
|
|
@@ -3635,7 +3643,7 @@ class CvaDatePickerComponent {
|
|
|
3635
3643
|
// - Nếu this.formControl là parent FormControl thì sẽ show error lên FormGroup
|
|
3636
3644
|
// - Nếu this.formControl là new FormControl thì sẽ quét QueryList để check {errors}
|
|
3637
3645
|
if (this.formControl) {
|
|
3638
|
-
this.formControl.setValidators(
|
|
3646
|
+
this.formControl.setValidators(ValidatorService.generateNsDatePickerValidators({
|
|
3639
3647
|
required: this.required,
|
|
3640
3648
|
min: this.getMinDate(),
|
|
3641
3649
|
max: this.getMaxDate(),
|
|
@@ -3656,13 +3664,13 @@ class CvaDatePickerComponent {
|
|
|
3656
3664
|
errorsObj[key] = errors[key];
|
|
3657
3665
|
});
|
|
3658
3666
|
}
|
|
3659
|
-
const minValidation =
|
|
3667
|
+
const minValidation = ValidatorService.customMinDateValidatorControl(this.value, this.getMinDate());
|
|
3660
3668
|
if (minValidation) {
|
|
3661
3669
|
Object.keys(minValidation).forEach(key => {
|
|
3662
3670
|
errorsObj[key] = minValidation[key];
|
|
3663
3671
|
});
|
|
3664
3672
|
}
|
|
3665
|
-
const maxValidation =
|
|
3673
|
+
const maxValidation = ValidatorService.customMaxDateValidatorControl(this.value, this.getMaxDate());
|
|
3666
3674
|
if (maxValidation) {
|
|
3667
3675
|
Object.keys(maxValidation).forEach(key => {
|
|
3668
3676
|
errorsObj[key] = maxValidation[key];
|
|
@@ -3904,7 +3912,7 @@ class CvaMultiSelectAutocomplete {
|
|
|
3904
3912
|
labelCount = 1;
|
|
3905
3913
|
cdkVirtualScrollViewPort;
|
|
3906
3914
|
get NsValidator() {
|
|
3907
|
-
return
|
|
3915
|
+
return ValidatorService;
|
|
3908
3916
|
}
|
|
3909
3917
|
constructor(translateService, injector, ngControl) {
|
|
3910
3918
|
this.translateService = translateService;
|
|
@@ -3930,7 +3938,7 @@ class CvaMultiSelectAutocomplete {
|
|
|
3930
3938
|
this.formControl = new FormControl();
|
|
3931
3939
|
}
|
|
3932
3940
|
if (this.formControl) {
|
|
3933
|
-
this.formControl.setValidators(
|
|
3941
|
+
this.formControl.setValidators(ValidatorService.generateNsMultiSelectValidators({
|
|
3934
3942
|
required: this.required,
|
|
3935
3943
|
multiple: this.multiple,
|
|
3936
3944
|
}));
|
|
@@ -4583,7 +4591,7 @@ class CvaSmartTableComponent {
|
|
|
4583
4591
|
this.formControl = new FormControl();
|
|
4584
4592
|
}
|
|
4585
4593
|
if (this.formControl) {
|
|
4586
|
-
this.formControl.setValidators(
|
|
4594
|
+
this.formControl.setValidators(ValidatorService.generateNsSmartTableValidators({
|
|
4587
4595
|
columns: this.columns,
|
|
4588
4596
|
minRow: this.minRow,
|
|
4589
4597
|
maxRow: this.maxRow,
|
|
@@ -5179,7 +5187,7 @@ class CvaRangeDatePickerComponent {
|
|
|
5179
5187
|
formControl;
|
|
5180
5188
|
defaultFromDate; // lưu giá trị khởi tạo ban đầu khi truyền từ bên ngoài vào
|
|
5181
5189
|
get NsValiator() {
|
|
5182
|
-
return
|
|
5190
|
+
return ValidatorService;
|
|
5183
5191
|
}
|
|
5184
5192
|
constructor(dateServiceUtil, ngControl, injector) {
|
|
5185
5193
|
this.dateServiceUtil = dateServiceUtil;
|
|
@@ -5317,7 +5325,7 @@ class CvaRangeDatePickerComponent {
|
|
|
5317
5325
|
}
|
|
5318
5326
|
}
|
|
5319
5327
|
if (!(this.getDisabled(this.disabledFromDate) || this.getDisabled(this.disabledAll))) {
|
|
5320
|
-
const minValidation =
|
|
5328
|
+
const minValidation = ValidatorService.customMinDateValidatorControl(this.value.fromDate, this.getMinDate());
|
|
5321
5329
|
if (minValidation) {
|
|
5322
5330
|
Object.keys(minValidation).forEach(key => {
|
|
5323
5331
|
errorsObj[key] = minValidation[key];
|
|
@@ -5325,7 +5333,7 @@ class CvaRangeDatePickerComponent {
|
|
|
5325
5333
|
this.formControl.markAsDirty();
|
|
5326
5334
|
}
|
|
5327
5335
|
}
|
|
5328
|
-
const maxValidation =
|
|
5336
|
+
const maxValidation = ValidatorService.customMaxDateValidatorControl(this.value.toDate, this.getMaxDate());
|
|
5329
5337
|
if (maxValidation) {
|
|
5330
5338
|
Object.keys(maxValidation).forEach(key => {
|
|
5331
5339
|
errorsObj[key] = maxValidation[key];
|
|
@@ -6838,7 +6846,7 @@ class CvaRadiobuttonComponent {
|
|
|
6838
6846
|
this.writeValue(val);
|
|
6839
6847
|
}
|
|
6840
6848
|
get NsValidator() {
|
|
6841
|
-
return
|
|
6849
|
+
return ValidatorService;
|
|
6842
6850
|
}
|
|
6843
6851
|
constructor(injector, ngControl) {
|
|
6844
6852
|
this.injector = injector;
|
|
@@ -6973,8 +6981,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
6973
6981
|
</div>
|
|
6974
6982
|
</div>
|
|
6975
6983
|
`,
|
|
6976
|
-
// encapsulation: ViewEncapsulation.None,
|
|
6977
|
-
// styleUrls: ['../styles/ns-style/cva-radio-button.scss'],
|
|
6978
6984
|
}]
|
|
6979
6985
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i1$2.NgControl, decorators: [{
|
|
6980
6986
|
type: Self
|
|
@@ -7338,7 +7344,7 @@ class CvaFlatTreeComponent {
|
|
|
7338
7344
|
chooseVirtualScroll;
|
|
7339
7345
|
selectedVirtualScroll;
|
|
7340
7346
|
get NsValiator() {
|
|
7341
|
-
return
|
|
7347
|
+
return ValidatorService;
|
|
7342
7348
|
}
|
|
7343
7349
|
constructor(translateService, injector, cdr, ngControl) {
|
|
7344
7350
|
this.translateService = translateService;
|
|
@@ -8264,7 +8270,7 @@ class CvaQuillEditorComponent {
|
|
|
8264
8270
|
formatFunc;
|
|
8265
8271
|
control = undefined;
|
|
8266
8272
|
get NsValidator() {
|
|
8267
|
-
return
|
|
8273
|
+
return ValidatorService;
|
|
8268
8274
|
}
|
|
8269
8275
|
constructor(injector, ngControl) {
|
|
8270
8276
|
this.injector = injector;
|
|
@@ -8347,7 +8353,7 @@ class CvaQuillEditorComponent {
|
|
|
8347
8353
|
// - Nếu this.formControl là new FormControl thì sẽ quét QueryList để check {errors}
|
|
8348
8354
|
if (this.control) {
|
|
8349
8355
|
if (this.control.validator) {
|
|
8350
|
-
this.control.setValidators([...
|
|
8356
|
+
this.control.setValidators([...ValidatorService.generateNsInputValidators({
|
|
8351
8357
|
required: this.required,
|
|
8352
8358
|
minLength: undefined,
|
|
8353
8359
|
maxLength: undefined,
|
|
@@ -8355,7 +8361,7 @@ class CvaQuillEditorComponent {
|
|
|
8355
8361
|
}), this.control.validator, this.customLengthValidator, this.customSizeValidator]);
|
|
8356
8362
|
}
|
|
8357
8363
|
else {
|
|
8358
|
-
this.control.setValidators([...
|
|
8364
|
+
this.control.setValidators([...ValidatorService.generateNsInputValidators({
|
|
8359
8365
|
required: this.required,
|
|
8360
8366
|
minLength: undefined,
|
|
8361
8367
|
maxLength: undefined,
|
|
@@ -8860,7 +8866,7 @@ class NiceComponentLibraryModule {
|
|
|
8860
8866
|
return {
|
|
8861
8867
|
ngModule: NiceComponentLibraryModule,
|
|
8862
8868
|
providers: [
|
|
8863
|
-
ApiService, DateUtilService, FormStateService, UtilsService, LoaderService,
|
|
8869
|
+
ApiService, DateUtilService, FormStateService, UtilsService, LoaderService, ValidatorService,
|
|
8864
8870
|
AuthoritiesService, AuthoritiesResolverService, SingletonTranslateService,
|
|
8865
8871
|
{ provide: InjectTokenNextSolutionsConfig, useValue: config ? config.data : {} }
|
|
8866
8872
|
],
|
|
@@ -9020,5 +9026,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
9020
9026
|
* Generated bundle index. Do not edit.
|
|
9021
9027
|
*/
|
|
9022
9028
|
|
|
9023
|
-
export { ActionTypeEnum, AlignEnum, ApiService, AuthoritiesResolverService, AuthoritiesService, Authority, BaseAddEditComponent, BaseModel, BaseSearchComponent, BaseTableComponent, BreadCrumbModel, ButtonClickEvent, ButtonModel, CheckboxModel, ColumnModel, ColumnTypeEnum, CustomDialogDataConfigModel, CvaBreadcrumbComponent, CvaCounterInputComponent, CvaCustomDialogComponent, CvaDatePickerComponent, CvaDialogImportFileComponent, CvaFlatTreeComponent, CvaFlatTreeNodeLeftComponent, CvaFlatTreeNodeRightComponent, CvaInputComponent, CvaLoaderComponent, CvaMultiSelectAutocomplete, CvaMultiUploadComponent, CvaMultiUploadImgComponent, CvaQuillEditorComponent, CvaRadiobuttonComponent, CvaRangeDatePickerComponent, CvaSmartTableComponent, CvaTableComponent, CvaTreeComponent, CvaUploadFileComponent, DateUtilService, DialogImportFileConfigModel, DialogTypeEnum, DragDropDirective, FileTypeEnum, FlatTreeConfigModel, FlatTreeModel, FlatTreeNodeModel, FormStateService, FormatInputDirective, IconTypeEnum, InjectTokenNextSolutionsConfig, JsogHttpInterceptor, LoaderInterceptor, LoaderService, MenuModel, MultiTranslateHttpLoader, NavigatorModel, NiceComponentLibraryModule,
|
|
9029
|
+
export { ActionTypeEnum, AlignEnum, ApiService, AuthoritiesResolverService, AuthoritiesService, Authority, BaseAddEditComponent, BaseModel, BaseSearchComponent, BaseStatusEnum, BaseTableComponent, BreadCrumbModel, ButtonClickEvent, ButtonModel, CheckboxModel, ColumnModel, ColumnTypeEnum, CustomDialogDataConfigModel, CvaBreadcrumbComponent, CvaCounterInputComponent, CvaCustomDialogComponent, CvaDatePickerComponent, CvaDialogImportFileComponent, CvaFlatTreeComponent, CvaFlatTreeNodeLeftComponent, CvaFlatTreeNodeRightComponent, CvaInputComponent, CvaLoaderComponent, CvaMultiSelectAutocomplete, CvaMultiUploadComponent, CvaMultiUploadImgComponent, CvaQuillEditorComponent, CvaRadiobuttonComponent, CvaRangeDatePickerComponent, CvaSmartTableComponent, CvaTableComponent, CvaTreeComponent, CvaUploadFileComponent, DateUtilService, DialogImportFileConfigModel, DialogTypeEnum, DragDropDirective, FileTypeEnum, FlatTreeConfigModel, FlatTreeModel, FlatTreeNodeModel, FormStateService, FormatInputDirective, IconTypeEnum, InjectTokenNextSolutionsConfig, JsogHttpInterceptor, LoaderInterceptor, LoaderService, MenuModel, MultiTranslateHttpLoader, NavigatorModel, NiceComponentLibraryModule, OAuth2AuthenticationDto, PatternDirective, PermissionModel, Principal, RangeDatePickerModel, RoleModel, SecureImgPipe, SelectModel, SingletonTranslateService, StylePaginatorDirective, TableFooterModel, TablePagingRequestModel, TablePagingResponseModel, TableService, UIState, UploadModel, UtilsService, ValidatorService };
|
|
9024
9030
|
//# sourceMappingURL=c10t-nice-component-library.mjs.map
|