@brggroup/share-lib 0.0.21 → 0.0.23
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.
|
@@ -1894,10 +1894,6 @@ class ExtendInputNumber {
|
|
|
1894
1894
|
inputHeight = '';
|
|
1895
1895
|
borderBottomOnly = false;
|
|
1896
1896
|
displayInline = false;
|
|
1897
|
-
/** separatorType: 'comma' (,) | 'dot' (.) */
|
|
1898
|
-
separatorType;
|
|
1899
|
-
/** defaultSeparatorType: 'comma' (,) | 'dot' (.) */
|
|
1900
|
-
static defaultSeparatorType = 'comma';
|
|
1901
1897
|
formData;
|
|
1902
1898
|
controlName;
|
|
1903
1899
|
_ngModel = null;
|
|
@@ -1910,48 +1906,25 @@ class ExtendInputNumber {
|
|
|
1910
1906
|
focus() {
|
|
1911
1907
|
this.inputElement?.nativeElement?.focus();
|
|
1912
1908
|
}
|
|
1913
|
-
|
|
1914
|
-
if (value
|
|
1909
|
+
formatter = (value) => {
|
|
1910
|
+
if (value === null || value === undefined || value === '') {
|
|
1915
1911
|
return '';
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
}
|
|
1919
|
-
const parts = `${value}`.split('.');
|
|
1920
|
-
const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.getSeparatorType() === 'comma' ? ',' : '.');
|
|
1921
|
-
return parts.length > 1
|
|
1922
|
-
? `${integerPart}${this.getSeparatorType() === 'comma' ? '.' : ','}${parts[1]}`
|
|
1923
|
-
: integerPart;
|
|
1912
|
+
}
|
|
1913
|
+
const str = value.toString().replace(/\D/g, '');
|
|
1914
|
+
return str.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
1924
1915
|
};
|
|
1925
|
-
|
|
1916
|
+
parser = (value) => {
|
|
1926
1917
|
if (!value)
|
|
1927
|
-
return 0;
|
|
1928
|
-
if (!this.getSeparatorType()) {
|
|
1929
|
-
return parseFloat(value);
|
|
1930
|
-
}
|
|
1931
|
-
// Bỏ ký tự phân cách hàng nghìn
|
|
1932
|
-
const cleaned = value
|
|
1933
|
-
.replace(new RegExp(`\\${this.getSeparatorType() === 'comma' ? ',' : '.'}`, 'g'), '')
|
|
1934
|
-
.replace(this.getSeparatorType() === 'comma' ? '.' : ',', '.');
|
|
1935
|
-
// Kiểm tra toàn bộ chuỗi có phải là số hợp lệ hay không
|
|
1936
|
-
if (!/^-?\d+(\.\d+)?$/.test(cleaned))
|
|
1937
1918
|
return NaN;
|
|
1919
|
+
const cleaned = (value = value.replace(/\./g, ''));
|
|
1938
1920
|
return parseFloat(cleaned);
|
|
1939
1921
|
};
|
|
1940
|
-
getSeparatorType() {
|
|
1941
|
-
if (this.separatorType == 'blank') {
|
|
1942
|
-
return '';
|
|
1943
|
-
}
|
|
1944
|
-
if (this.separatorType) {
|
|
1945
|
-
return this.separatorType;
|
|
1946
|
-
}
|
|
1947
|
-
return ExtendInputNumber.defaultSeparatorType;
|
|
1948
|
-
}
|
|
1949
1922
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ExtendInputNumber, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1950
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.7", type: ExtendInputNumber, isStandalone: true, selector: "extend-input-number", inputs: { layOutType: "layOutType", label: "label", placeHolder: "placeHolder", labelAlign: "labelAlign", labelSpan: "labelSpan", disabled: "disabled", required: "required", noBottom: "noBottom", size: "size", min: "min", max: "max", precision: "precision", inputWidth: "inputWidth", inputHeight: "inputHeight", borderBottomOnly: "borderBottomOnly", displayInline: "displayInline",
|
|
1923
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.7", type: ExtendInputNumber, isStandalone: true, selector: "extend-input-number", inputs: { layOutType: "layOutType", label: "label", placeHolder: "placeHolder", labelAlign: "labelAlign", labelSpan: "labelSpan", disabled: "disabled", required: "required", noBottom: "noBottom", size: "size", min: "min", max: "max", precision: "precision", inputWidth: "inputWidth", inputHeight: "inputHeight", borderBottomOnly: "borderBottomOnly", displayInline: "displayInline", formData: "formData", controlName: "controlName", _ngModel: "_ngModel" }, outputs: { _ngModelChange: "_ngModelChange" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }], ngImport: i0, template: "<div class=\"extend-wrapper\" [ngStyle]=\"{ display: displayInline ? 'inline' : null }\">\n @if (controlName) {\n <div [formGroup]=\"formData\">\n <nz-form-item>\n <nz-form-label\n [nzSpan]=\"layOutType == 'horizontal' ? labelSpan : null\"\n [nzLabelAlign]=\"labelAlign\"\n [nzRequired]=\"required\"\n [nzFor]=\"controlName\"\n nzNoColon\n nzLabelWrap\n >\n {{ label }}\n </nz-form-label>\n <nz-form-control\n [nzSpan]=\"layOutType == 'horizontal' ? 24 - labelSpan : null\"\n [ngClass]=\"{ 'full-width': layOutType == 'vertical' }\"\n [nzErrorTip]=\"'REQUIRED_FIELD' | translate\"\n >\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [formControlName]=\"controlName\"\n />\n </nz-form-control>\n </nz-form-item>\n </div>\n } @else {\n @if (label) {\n <nz-form-item>\n <nz-form-label\n [nzSpan]=\"layOutType == 'horizontal' ? labelSpan : null\"\n [nzLabelAlign]=\"labelAlign\"\n [nzRequired]=\"required\"\n [nzFor]=\"controlName\"\n nzNoColon\n nzLabelWrap\n >\n {{ label }}\n </nz-form-label>\n <nz-form-control\n [nzSpan]=\"layOutType == 'horizontal' ? 24 - labelSpan : null\"\n [ngClass]=\"{ 'full-width': layOutType == 'vertical' }\"\n [nzErrorTip]=\"'REQUIRED_FIELD' | translate\"\n >\n @if (min != null && max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (min != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n }\n </nz-form-control>\n </nz-form-item>\n } @else {\n @if (min != null && max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (min != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n [ngStyle]=\"{\n width: inputWidth,\n height: inputHeight,\n border: borderBottomOnly ? 'none' : '',\n 'border-bottom': borderBottomOnly ? '1px dashed' : '',\n }\"\n />\n }\n }\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: NzFormModule }, { kind: "directive", type: i4.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i4.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "component", type: i5.NzFormItemComponent, selector: "nz-form-item", exportAs: ["nzFormItem"] }, { kind: "component", type: i5.NzFormLabelComponent, selector: "nz-form-label", inputs: ["nzFor", "nzRequired", "nzNoColon", "nzTooltipTitle", "nzTooltipIcon", "nzLabelAlign", "nzLabelWrap"], exportAs: ["nzFormLabel"] }, { kind: "component", type: i5.NzFormControlComponent, selector: "nz-form-control", inputs: ["nzSuccessTip", "nzWarningTip", "nzErrorTip", "nzValidatingTip", "nzExtra", "nzAutoTips", "nzDisableAutoTips", "nzHasFeedback", "nzValidateStatus"], exportAs: ["nzFormControl"] }, { kind: "ngmodule", type: NzInputNumberModule }, { kind: "component", type: i6.NzInputNumberComponent, selector: "nz-input-number", inputs: ["nzId", "nzSize", "nzPlaceHolder", "nzStatus", "nzStep", "nzMin", "nzMax", "nzPrecision", "nzParser", "nzFormatter", "nzDisabled", "nzReadOnly", "nzAutoFocus", "nzBordered", "nzKeyboard", "nzControls"], outputs: ["nzOnStep"], exportAs: ["nzInputNumber"] }] });
|
|
1951
1924
|
}
|
|
1952
1925
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImport: i0, type: ExtendInputNumber, decorators: [{
|
|
1953
1926
|
type: Component,
|
|
1954
|
-
args: [{ selector: 'extend-input-number', imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, NzFormModule, NzInputNumberModule], template: "<div class=\"extend-wrapper\" [ngStyle]=\"{ display: displayInline ? 'inline' : null }\">\n @if (controlName) {\n <div [formGroup]=\"formData\">\n <nz-form-item>\n <nz-form-label\n [nzSpan]=\"layOutType == 'horizontal' ? labelSpan : null\"\n [nzLabelAlign]=\"labelAlign\"\n [nzRequired]=\"required\"\n [nzFor]=\"controlName\"\n nzNoColon\n nzLabelWrap\n >\n {{ label }}\n </nz-form-label>\n <nz-form-control\n [nzSpan]=\"layOutType == 'horizontal' ? 24 - labelSpan : null\"\n [ngClass]=\"{ 'full-width': layOutType == 'vertical' }\"\n [nzErrorTip]=\"'REQUIRED_FIELD' | translate\"\n >\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"
|
|
1927
|
+
args: [{ selector: 'extend-input-number', imports: [CommonModule, FormsModule, ReactiveFormsModule, TranslateModule, NzFormModule, NzInputNumberModule], template: "<div class=\"extend-wrapper\" [ngStyle]=\"{ display: displayInline ? 'inline' : null }\">\n @if (controlName) {\n <div [formGroup]=\"formData\">\n <nz-form-item>\n <nz-form-label\n [nzSpan]=\"layOutType == 'horizontal' ? labelSpan : null\"\n [nzLabelAlign]=\"labelAlign\"\n [nzRequired]=\"required\"\n [nzFor]=\"controlName\"\n nzNoColon\n nzLabelWrap\n >\n {{ label }}\n </nz-form-label>\n <nz-form-control\n [nzSpan]=\"layOutType == 'horizontal' ? 24 - labelSpan : null\"\n [ngClass]=\"{ 'full-width': layOutType == 'vertical' }\"\n [nzErrorTip]=\"'REQUIRED_FIELD' | translate\"\n >\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [formControlName]=\"controlName\"\n />\n </nz-form-control>\n </nz-form-item>\n </div>\n } @else {\n @if (label) {\n <nz-form-item>\n <nz-form-label\n [nzSpan]=\"layOutType == 'horizontal' ? labelSpan : null\"\n [nzLabelAlign]=\"labelAlign\"\n [nzRequired]=\"required\"\n [nzFor]=\"controlName\"\n nzNoColon\n nzLabelWrap\n >\n {{ label }}\n </nz-form-label>\n <nz-form-control\n [nzSpan]=\"layOutType == 'horizontal' ? 24 - labelSpan : null\"\n [ngClass]=\"{ 'full-width': layOutType == 'vertical' }\"\n [nzErrorTip]=\"'REQUIRED_FIELD' | translate\"\n >\n @if (min != null && max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (min != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n }\n </nz-form-control>\n </nz-form-item>\n } @else {\n @if (min != null && max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (min != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMin]=\"min\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else if (max != null) {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzMax]=\"max\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n />\n } @else {\n <nz-input-number\n class=\"full-width\"\n [nzSize]=\"size\"\n [nzFormatter]=\"formatter\"\n [nzParser]=\"parser\"\n [nzPrecision]=\"precision\"\n [nzDisabled]=\"disabled\"\n [(ngModel)]=\"_ngModel\"\n (ngModelChange)=\"_onNgModelChange()\"\n [ngStyle]=\"{\n width: inputWidth,\n height: inputHeight,\n border: borderBottomOnly ? 'none' : '',\n 'border-bottom': borderBottomOnly ? '1px dashed' : '',\n }\"\n />\n }\n }\n }\n</div>\n" }]
|
|
1955
1928
|
}], propDecorators: { layOutType: [{
|
|
1956
1929
|
type: Input
|
|
1957
1930
|
}], label: [{
|
|
@@ -1984,8 +1957,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.7", ngImpor
|
|
|
1984
1957
|
type: Input
|
|
1985
1958
|
}], displayInline: [{
|
|
1986
1959
|
type: Input
|
|
1987
|
-
}], separatorType: [{
|
|
1988
|
-
type: Input
|
|
1989
1960
|
}], formData: [{
|
|
1990
1961
|
type: Input
|
|
1991
1962
|
}], controlName: [{
|