@pongrass/utils 1.1.8-v20 → 1.1.10-v20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/pongrass-utils.mjs +66 -61
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +6 -9
- package/package.json +1 -1
|
@@ -664,7 +664,7 @@ class CheckboxCellRendererComponent {
|
|
|
664
664
|
}
|
|
665
665
|
// Return Cell Value
|
|
666
666
|
refresh(params) {
|
|
667
|
-
this.value = params.value === 'Y' || params.value === 1 ? true : false;
|
|
667
|
+
this.value = params.value === 'Y' || params.value === 1 || params.value === '1' ? true : false;
|
|
668
668
|
return true;
|
|
669
669
|
}
|
|
670
670
|
onChangeCheckBox(event) {
|
|
@@ -1686,72 +1686,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1686
1686
|
args: ['keydown', ['$event']]
|
|
1687
1687
|
}] } });
|
|
1688
1688
|
|
|
1689
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1690
1689
|
class DecimalInputDirective {
|
|
1691
1690
|
el = inject((ElementRef));
|
|
1692
|
-
control = inject(NgControl);
|
|
1693
|
-
sub;
|
|
1691
|
+
control = inject(NgControl, { optional: true });
|
|
1694
1692
|
wsDecimalInput = 4;
|
|
1695
1693
|
wsAcceptStringInput = true;
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
// Only format when value comes from patchValue / setValue (not typing)
|
|
1699
|
-
this.sub = this.control.valueChanges?.subscribe(value => {
|
|
1700
|
-
const inputEl = this.el.nativeElement;
|
|
1701
|
-
// Skip if input element is focused (user typing)
|
|
1702
|
-
if (document.activeElement === inputEl)
|
|
1703
|
-
return;
|
|
1704
|
-
this.formatValue(value);
|
|
1705
|
-
});
|
|
1694
|
+
get decimalPlaces() {
|
|
1695
|
+
return this.wsDecimalInput;
|
|
1706
1696
|
}
|
|
1707
|
-
|
|
1708
|
-
this.sub?.unsubscribe();
|
|
1709
|
-
}
|
|
1710
|
-
onKeyDown(event) {
|
|
1697
|
+
onInput(e) {
|
|
1711
1698
|
const input = this.el.nativeElement;
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
if (
|
|
1716
|
-
|
|
1717
|
-
return;
|
|
1699
|
+
const before = input.value;
|
|
1700
|
+
let cleaned = before.replace(/[^0-9.]/g, '');
|
|
1701
|
+
const parts = cleaned.split('.');
|
|
1702
|
+
if (parts.length > 2) {
|
|
1703
|
+
cleaned = parts[0] + '.' + parts.slice(1).join('');
|
|
1718
1704
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1705
|
+
if (parts.length === 2 && parts[1].length > this.decimalPlaces) {
|
|
1706
|
+
cleaned = parts[0] + '.' + parts[1].slice(0, this.decimalPlaces);
|
|
1707
|
+
}
|
|
1708
|
+
if (cleaned !== before) {
|
|
1709
|
+
const cursorPos = input.selectionStart ?? 0;
|
|
1710
|
+
input.value = cleaned;
|
|
1711
|
+
const newPos = cursorPos + (cleaned.length - before.length);
|
|
1712
|
+
input.setSelectionRange(newPos, newPos);
|
|
1713
|
+
this.control?.control?.setValue(this.wsAcceptStringInput ? cleaned : Number(cleaned) || null, { emitEvent: false, onlySelf: true });
|
|
1723
1714
|
}
|
|
1724
1715
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1716
|
+
onPaste(e) {
|
|
1717
|
+
const text = e.clipboardData?.getData('text') ?? '';
|
|
1718
|
+
if (!/^\d*\.?\d*$/.test(text)) {
|
|
1719
|
+
e.preventDefault();
|
|
1720
|
+
}
|
|
1727
1721
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1722
|
+
onBlur() {
|
|
1723
|
+
const val = this.el.nativeElement.value.trim();
|
|
1724
|
+
if (!val)
|
|
1730
1725
|
return;
|
|
1731
|
-
|
|
1726
|
+
const num = Number(val);
|
|
1727
|
+
if (isNaN(num))
|
|
1732
1728
|
return;
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
formatted = integerPart + '.' + decimalPart.slice(0, this.wsDecimalInput);
|
|
1737
|
-
}
|
|
1738
|
-
if (this.wsAcceptStringInput) {
|
|
1739
|
-
this.control.control?.setValue(formatted, { emitEvent: false });
|
|
1729
|
+
let str = num.toFixed(this.decimalPlaces);
|
|
1730
|
+
if (!this.wsAcceptStringInput) {
|
|
1731
|
+
this.control?.control?.setValue(num, { emitEvent: false });
|
|
1740
1732
|
}
|
|
1741
1733
|
else {
|
|
1742
|
-
this.control
|
|
1734
|
+
this.control?.control?.setValue(str, { emitEvent: false });
|
|
1743
1735
|
}
|
|
1744
|
-
this.el.nativeElement.value =
|
|
1736
|
+
this.el.nativeElement.value = str;
|
|
1745
1737
|
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1738
|
+
constructor() {
|
|
1739
|
+
this.control?.valueChanges?.subscribe(v => {
|
|
1740
|
+
if (document.activeElement !== this.el.nativeElement) {
|
|
1741
|
+
this.formatProgrammatic(v);
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1749
1744
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1745
|
+
formatProgrammatic(value) {
|
|
1746
|
+
if (value == null || value === '') {
|
|
1747
|
+
this.el.nativeElement.value = '';
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
const str = Number(value).toFixed(this.decimalPlaces);
|
|
1751
|
+
this.el.nativeElement.value = str;
|
|
1752
1752
|
}
|
|
1753
1753
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DecimalInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1754
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: DecimalInputDirective, isStandalone: true, selector: "[wsDecimalInput]", inputs: { wsDecimalInput: "wsDecimalInput", wsAcceptStringInput: "wsAcceptStringInput" }, host: { listeners: { "
|
|
1754
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: DecimalInputDirective, isStandalone: true, selector: "[wsDecimalInput]", inputs: { wsDecimalInput: "wsDecimalInput", wsAcceptStringInput: "wsAcceptStringInput" }, host: { listeners: { "input": "onInput($event)", "paste": "onPaste($event)", "blur": "onBlur()" } }, ngImport: i0 });
|
|
1755
1755
|
}
|
|
1756
1756
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: DecimalInputDirective, decorators: [{
|
|
1757
1757
|
type: Directive,
|
|
@@ -1759,13 +1759,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
1759
1759
|
selector: '[wsDecimalInput]',
|
|
1760
1760
|
standalone: true
|
|
1761
1761
|
}]
|
|
1762
|
-
}], propDecorators: { wsDecimalInput: [{
|
|
1762
|
+
}], ctorParameters: () => [], propDecorators: { wsDecimalInput: [{
|
|
1763
1763
|
type: Input
|
|
1764
1764
|
}], wsAcceptStringInput: [{
|
|
1765
1765
|
type: Input
|
|
1766
|
-
}],
|
|
1766
|
+
}], onInput: [{
|
|
1767
1767
|
type: HostListener,
|
|
1768
|
-
args: ['
|
|
1768
|
+
args: ['input', ['$event']]
|
|
1769
|
+
}], onPaste: [{
|
|
1770
|
+
type: HostListener,
|
|
1771
|
+
args: ['paste', ['$event']]
|
|
1769
1772
|
}], onBlur: [{
|
|
1770
1773
|
type: HostListener,
|
|
1771
1774
|
args: ['blur']
|
|
@@ -2217,7 +2220,7 @@ class MultiFormComponent {
|
|
|
2217
2220
|
this.multiForm.markAsPristine();
|
|
2218
2221
|
}
|
|
2219
2222
|
getTruthyOrFalsy(value) {
|
|
2220
|
-
return value === '1' ? true : false;
|
|
2223
|
+
return value === '1' || value === 1 ? true : false;
|
|
2221
2224
|
}
|
|
2222
2225
|
getValidators(validations) {
|
|
2223
2226
|
const validators = [];
|
|
@@ -2314,9 +2317,11 @@ class MultiFormComponent {
|
|
|
2314
2317
|
}
|
|
2315
2318
|
handleSearch(field, keyword) {
|
|
2316
2319
|
const fieldConfig = field.config;
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
+
if (fieldConfig) {
|
|
2321
|
+
this.jsonrpcService.postJsonRpcRequest(fieldConfig.method, { keyword }).subscribe((response) => {
|
|
2322
|
+
field.options = response?.result || [];
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2320
2325
|
}
|
|
2321
2326
|
setDefaultAdvanceDate(currentDate, defaultAdvance) {
|
|
2322
2327
|
if (defaultAdvance === 'weekly') {
|
|
@@ -2472,7 +2477,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
2472
2477
|
FormCheckInputDirective,
|
|
2473
2478
|
EditionListGroupedComponent,
|
|
2474
2479
|
MultiSelectStylerDirective,
|
|
2475
|
-
TimePickerModule
|
|
2480
|
+
TimePickerModule,
|
|
2476
2481
|
],
|
|
2477
2482
|
exports: [MultiFormComponent, DateTimePickerComponent]
|
|
2478
2483
|
}]
|
|
@@ -2701,7 +2706,7 @@ class TableGridComponent {
|
|
|
2701
2706
|
const initialState = this.tableGridState.map(item => ({
|
|
2702
2707
|
colId: item.key,
|
|
2703
2708
|
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
2704
|
-
width: item.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth
|
|
2709
|
+
width: item.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth,
|
|
2705
2710
|
sort: item.sort || null
|
|
2706
2711
|
}));
|
|
2707
2712
|
this.gridAPI.api.applyColumnState({
|
|
@@ -2715,7 +2720,7 @@ class TableGridComponent {
|
|
|
2715
2720
|
this.tableGridState.push({
|
|
2716
2721
|
key: columnState.colId,
|
|
2717
2722
|
visible: columnState.hide ? !columnState.hide : true,
|
|
2718
|
-
width: columnState.width
|
|
2723
|
+
width: columnState.width,
|
|
2719
2724
|
sort: columnState.sort
|
|
2720
2725
|
});
|
|
2721
2726
|
});
|
|
@@ -2850,7 +2855,7 @@ class TableGridComponent {
|
|
|
2850
2855
|
}
|
|
2851
2856
|
this.tableConfiguration.initialState.forEach((col) => {
|
|
2852
2857
|
col.visible = col.visible === null || col.visible === undefined ? true : col.visible;
|
|
2853
|
-
col.width = col.width
|
|
2858
|
+
col.width = col.width;
|
|
2854
2859
|
col.sort = null;
|
|
2855
2860
|
this.tableGridState.push(col);
|
|
2856
2861
|
this.columnsListselectionForm.controls[col.key].setValue(true);
|
|
@@ -2860,7 +2865,7 @@ class TableGridComponent {
|
|
|
2860
2865
|
state: this.tableGridState.map(item => ({
|
|
2861
2866
|
colId: item.key,
|
|
2862
2867
|
hide: item.visible === null || item.visible === undefined ? false : !item.visible,
|
|
2863
|
-
width: item.width
|
|
2868
|
+
width: item.width,
|
|
2864
2869
|
sort: item.sort || null,
|
|
2865
2870
|
flex: 1
|
|
2866
2871
|
})),
|
|
@@ -2926,7 +2931,7 @@ class TableGridComponent {
|
|
|
2926
2931
|
const columnState = this.tableGridState.map(item => ({
|
|
2927
2932
|
colId: item.key,
|
|
2928
2933
|
hide: true,
|
|
2929
|
-
width: this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2934
|
+
width: item?.width || this.configurationService.allConfigValues()?.tableGridConfig?.defaultMinWidth || 100,
|
|
2930
2935
|
sort: item.sort || null,
|
|
2931
2936
|
flex: 1
|
|
2932
2937
|
}));
|