@exhaustive-ui/core 22.0.0-alpha.9 → 22.0.0-rc.2
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/exhaustive-ui-core-accordion.mjs +5 -5
- package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-api.mjs +3 -3
- package/fesm2022/exhaustive-ui-core-api.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs +25 -14
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-avatar.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-avatar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-avatargroup.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-avatargroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-badge.mjs +12 -3
- package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-basecomponent.mjs +34 -4
- package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs +4 -2
- package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-blockui.mjs +9 -2
- package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +13 -6
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-button.mjs +35 -13
- package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-card.mjs +2 -6
- package/fesm2022/exhaustive-ui-core-card.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-carousel.mjs +9 -4
- package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +12 -11
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chart.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-checkbox.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chip.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-chip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-config.mjs +3 -1
- package/fesm2022/exhaustive-ui-core-config.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +65 -26
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +28 -5
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs +15 -8
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dataview.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-datepicker.mjs +188 -95
- package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dialog.mjs +31 -13
- package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-divider.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-divider.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dock.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dom.mjs +3 -1
- package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-drawer.mjs +24 -6
- package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +9 -5
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-editor.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fieldset.mjs +4 -4
- package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fileupload.mjs +25 -14
- package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-focustrap.mjs +0 -2
- package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-galleria.mjs +5 -5
- package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-iconfield.mjs +18 -3
- package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-image.mjs +12 -4
- package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inplace.mjs +3 -3
- package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs +11 -2
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputicon.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-inputicon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputmask.mjs +31 -7
- package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs +85 -25
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputotp.mjs +9 -3
- package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputtext.mjs +8 -9
- package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs +27 -17
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-knob.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-knob.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-listbox.mjs +17 -6
- package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-megamenu.mjs +4 -3
- package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menu.mjs +15 -4
- package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menubar.mjs +64 -15
- package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-message.mjs +2 -4
- package/fesm2022/exhaustive-ui-core-message.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-metergroup.mjs +7 -7
- package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-multiselect.mjs +38 -27
- package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-orderlist.mjs +19 -6
- package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-overlay.mjs +6 -4
- package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +4 -4
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-paginator.mjs +12 -5
- package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panel.mjs +9 -11
- package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs +43 -15
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-password.mjs +93 -25
- package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-picklist.mjs +33 -12
- package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-popover.mjs +27 -8
- package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-progressbar.mjs +5 -5
- package/fesm2022/exhaustive-ui-core-progressbar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-progressspinner.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-progressspinner.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-radiobutton.mjs +8 -3
- package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-rating.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-rating.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scroller.mjs +14 -4
- package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs +11 -3
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-select.mjs +102 -29
- package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs +13 -7
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-skeleton.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-skeleton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-slider.mjs +18 -5
- package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-speeddial.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs +9 -5
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitter.mjs +29 -8
- package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-stepper.mjs +8 -4
- package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-steps.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-table.mjs +535 -203
- package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tabs.mjs +44 -8
- package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tag.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-tag.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-terminal.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-terminal.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-textarea.mjs +9 -4
- package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +31 -16
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-timeline.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-timeline.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toast.mjs +17 -5
- package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs +11 -4
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +2 -4
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toolbar.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tooltip.mjs +5 -1
- package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tree.mjs +30 -11
- package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treeselect.mjs +53 -6
- package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treetable.mjs +93 -21
- package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-usestyle.mjs +49 -0
- package/fesm2022/exhaustive-ui-core-usestyle.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-utils.mjs +2 -1
- package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/migrate-from-primeflex/index.js +4 -2
- package/schematics/migrate-from-primeflex/schema.json +5 -0
- package/schematics/utils/package-json.js +17 -0
- package/schematics/utils/primeflex.js +45 -10
- package/schematics/utils/versions.json +8 -8
- package/types/exhaustive-ui-core-api.d.ts +6 -0
- package/types/exhaustive-ui-core-autocomplete.d.ts +2 -0
- package/types/exhaustive-ui-core-badge.d.ts +1 -0
- package/types/exhaustive-ui-core-basecomponent.d.ts +16 -0
- package/types/exhaustive-ui-core-breadcrumb.d.ts +7 -1
- package/types/exhaustive-ui-core-button.d.ts +12 -1
- package/types/exhaustive-ui-core-cascadeselect.d.ts +2 -1
- package/types/exhaustive-ui-core-chart.d.ts +2 -2
- package/types/exhaustive-ui-core-confirmdialog.d.ts +17 -5
- package/types/exhaustive-ui-core-confirmpopup.d.ts +4 -0
- package/types/exhaustive-ui-core-datepicker.d.ts +10 -2
- package/types/exhaustive-ui-core-dialog.d.ts +2 -0
- package/types/exhaustive-ui-core-drawer.d.ts +1 -0
- package/types/exhaustive-ui-core-fileupload.d.ts +4 -0
- package/types/exhaustive-ui-core-iconfield.d.ts +1 -2
- package/types/exhaustive-ui-core-image.d.ts +6 -1
- package/types/exhaustive-ui-core-inputnumber.d.ts +8 -0
- package/types/exhaustive-ui-core-keyfilter.d.ts +1 -0
- package/types/exhaustive-ui-core-megamenu.d.ts +1 -0
- package/types/exhaustive-ui-core-menu.d.ts +2 -0
- package/types/exhaustive-ui-core-menubar.d.ts +6 -0
- package/types/exhaustive-ui-core-metergroup.d.ts +1 -1
- package/types/exhaustive-ui-core-multiselect.d.ts +1 -1
- package/types/exhaustive-ui-core-orderlist.d.ts +11 -1
- package/types/exhaustive-ui-core-paginator.d.ts +1 -0
- package/types/exhaustive-ui-core-panelmenu.d.ts +7 -0
- package/types/exhaustive-ui-core-password.d.ts +9 -1
- package/types/exhaustive-ui-core-picklist.d.ts +8 -3
- package/types/exhaustive-ui-core-popover.d.ts +3 -0
- package/types/exhaustive-ui-core-select.d.ts +13 -1
- package/types/exhaustive-ui-core-selectbutton.d.ts +3 -0
- package/types/exhaustive-ui-core-splitbutton.d.ts +2 -1
- package/types/exhaustive-ui-core-splitter.d.ts +7 -1
- package/types/exhaustive-ui-core-stepper.d.ts +3 -2
- package/types/exhaustive-ui-core-table.d.ts +34 -4
- package/types/exhaustive-ui-core-tabs.d.ts +4 -0
- package/types/exhaustive-ui-core-tieredmenu.d.ts +2 -0
- package/types/exhaustive-ui-core-togglebutton.d.ts +1 -0
- package/types/exhaustive-ui-core-tree.d.ts +2 -0
- package/types/exhaustive-ui-core-treeselect.d.ts +12 -1
- package/types/exhaustive-ui-core-treetable.d.ts +22 -2
- package/types/exhaustive-ui-core-types-chart.d.ts +21 -1
- package/types/exhaustive-ui-core-types-confirmdialog.d.ts +1 -3
- package/types/exhaustive-ui-core-types-table.d.ts +1 -1
- package/types/exhaustive-ui-core-types-treetable.d.ts +2 -2
- package/types/exhaustive-ui-core-usestyle.d.ts +17 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i2 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, InjectionToken, forwardRef, inject, Injector,
|
|
4
|
+
import { Injectable, InjectionToken, forwardRef, inject, Injector, input, booleanAttribute, numberAttribute, output, contentChild, contentChildren, viewChild, computed, signal, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
5
5
|
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
6
6
|
import { getSelection } from '@exhaustive-ui/utils';
|
|
7
7
|
import { PrimeTemplate, SharedModule } from '@exhaustive-ui/core/api';
|
|
@@ -132,7 +132,7 @@ class InputNumber extends BaseInput {
|
|
|
132
132
|
bindDirectiveInstance = inject(Bind, { self: true });
|
|
133
133
|
constructor() {
|
|
134
134
|
super();
|
|
135
|
-
|
|
135
|
+
this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptms(['host', 'root']));
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Displays spinner buttons.
|
|
@@ -413,6 +413,10 @@ class InputNumber extends BaseInput {
|
|
|
413
413
|
...(ngDevMode ? [{ debugName: "timer" }] : /* istanbul ignore next */ []));
|
|
414
414
|
lastValue = signal(undefined, /* @ts-ignore */
|
|
415
415
|
...(ngDevMode ? [{ debugName: "lastValue" }] : /* istanbul ignore next */ []));
|
|
416
|
+
blurChangePending = signal(false, /* @ts-ignore */
|
|
417
|
+
...(ngDevMode ? [{ debugName: "blurChangePending" }] : /* istanbul ignore next */ []));
|
|
418
|
+
pasted = signal(null, /* @ts-ignore */
|
|
419
|
+
...(ngDevMode ? [{ debugName: "pasted" }] : /* istanbul ignore next */ []));
|
|
416
420
|
_numeral = computed(() => {
|
|
417
421
|
const numerals = [...new Intl.NumberFormat(this.locale(), { useGrouping: false }).format(9876543210)].reverse();
|
|
418
422
|
return new RegExp(`[${numerals.join('')}]`, 'g');
|
|
@@ -573,7 +577,16 @@ class InputNumber extends BaseInput {
|
|
|
573
577
|
spin(event, dir) {
|
|
574
578
|
let step = (this.step() ?? 1) * dir;
|
|
575
579
|
let currentValue = this.parseValue(this.input().nativeElement.value) || 0;
|
|
576
|
-
let
|
|
580
|
+
let sum = currentValue + step;
|
|
581
|
+
if (typeof sum === 'number') {
|
|
582
|
+
// round the sum to the decimals of its operands: 0.2 + 0.1 must give 0.3, not 0.30000000000000004
|
|
583
|
+
const decimalsOf = (operand) => {
|
|
584
|
+
const [mantissa, exponent] = String(operand).split('e-');
|
|
585
|
+
return (mantissa.split('.')[1]?.length ?? 0) + (exponent ? +exponent : 0);
|
|
586
|
+
};
|
|
587
|
+
sum = +sum.toFixed(Math.min(Math.max(decimalsOf(currentValue), decimalsOf(step)), 100));
|
|
588
|
+
}
|
|
589
|
+
let newValue = this.validateValue(sum);
|
|
577
590
|
const max = this.maxlength();
|
|
578
591
|
if (max && max < this.formatValue(newValue).length) {
|
|
579
592
|
return;
|
|
@@ -653,8 +666,27 @@ class InputNumber extends BaseInput {
|
|
|
653
666
|
if (this.readonly()) {
|
|
654
667
|
return;
|
|
655
668
|
}
|
|
656
|
-
|
|
657
|
-
|
|
669
|
+
const target = event.target;
|
|
670
|
+
const { inputType, data } = event;
|
|
671
|
+
if (inputType === 'insertFromPaste' && this.pasted()) {
|
|
672
|
+
this.insertPasted(event, target);
|
|
673
|
+
}
|
|
674
|
+
else if (this.isSpecialChar()) {
|
|
675
|
+
target.value = this.lastValue();
|
|
676
|
+
}
|
|
677
|
+
else if (inputType === 'insertText' && data && this.lastValue() != null) {
|
|
678
|
+
// Soft keyboards insert text without a keypress, where characters are filtered: undo the raw insertion
|
|
679
|
+
// and insert the accepted characters the way onInputKeyPress does.
|
|
680
|
+
const caret = Math.max((target.selectionStart ?? data.length) - data.length, 0);
|
|
681
|
+
target.value = this.lastValue();
|
|
682
|
+
target.setSelectionRange(caret, caret);
|
|
683
|
+
for (const char of data) {
|
|
684
|
+
const isDecimalSign = this.isDecimalSign(char);
|
|
685
|
+
const isMinusSign = this.isMinusSign(char);
|
|
686
|
+
if ((char >= '0' && char <= '9') || isDecimalSign || isMinusSign) {
|
|
687
|
+
this.insert(event, char, { isDecimalSign, isMinusSign });
|
|
688
|
+
}
|
|
689
|
+
}
|
|
658
690
|
}
|
|
659
691
|
this.isSpecialChar.set(false);
|
|
660
692
|
}
|
|
@@ -850,19 +882,28 @@ class InputNumber extends BaseInput {
|
|
|
850
882
|
}
|
|
851
883
|
onPaste(event) {
|
|
852
884
|
if (!this.$disabled() && !this.readonly()) {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
885
|
+
// Let the native paste land (cancelling it flags the input as paste-preventing) and sanitize it in onUserInput
|
|
886
|
+
const { value, selectionStart, selectionEnd } = event.target;
|
|
887
|
+
const data = (event.clipboardData || this.document.defaultView['clipboardData']).getData('Text');
|
|
888
|
+
this.pasted.set({ value, selectionStart, selectionEnd, data });
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
insertPasted(event, target) {
|
|
892
|
+
const { value, selectionStart, selectionEnd } = this.pasted();
|
|
893
|
+
let data = this.pasted().data;
|
|
894
|
+
this.pasted.set(null);
|
|
895
|
+
target.value = value;
|
|
896
|
+
target.setSelectionRange(selectionStart ?? value.length, selectionEnd ?? value.length);
|
|
897
|
+
if (this.inputId() === 'integeronly' && /[^\d-]/.test(data)) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
if (data) {
|
|
901
|
+
if (this.maxlength()) {
|
|
902
|
+
data = data.toString().substring(0, this.maxlength());
|
|
857
903
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
let filteredData = this.parseValue(data);
|
|
863
|
-
if (filteredData != null) {
|
|
864
|
-
this.insert(event, filteredData.toString());
|
|
865
|
-
}
|
|
904
|
+
let filteredData = this.parseValue(data);
|
|
905
|
+
if (filteredData != null) {
|
|
906
|
+
this.insert(event, filteredData.toString());
|
|
866
907
|
}
|
|
867
908
|
}
|
|
868
909
|
}
|
|
@@ -940,8 +981,9 @@ class InputNumber extends BaseInput {
|
|
|
940
981
|
this.updateValue(event, newValueStr, text, 'insert');
|
|
941
982
|
}
|
|
942
983
|
else if (decimalCharIndex === -1 && this.maxFractionDigits()) {
|
|
943
|
-
|
|
944
|
-
this.
|
|
984
|
+
// a decimal separator typed in an empty input starts the fraction of 0
|
|
985
|
+
newValueStr = inputValue ? this.insertText(inputValue, text, selectionStart, selectionEnd) : '0' + text;
|
|
986
|
+
this.updateValue(event, newValueStr, inputValue ? text : newValueStr, 'insert');
|
|
945
987
|
}
|
|
946
988
|
}
|
|
947
989
|
else {
|
|
@@ -1069,13 +1111,22 @@ class InputNumber extends BaseInput {
|
|
|
1069
1111
|
if (valueStr != null) {
|
|
1070
1112
|
newValue = this.parseValue(valueStr);
|
|
1071
1113
|
newValue = !newValue && !this.allowEmpty() ? 0 : newValue;
|
|
1114
|
+
// maxlength counts the characters of the formatted value, as the spin buttons do: reject an insertion beyond it
|
|
1115
|
+
const maxlength = this.maxlength();
|
|
1116
|
+
if (maxlength && currentValue && (operation === 'insert' || operation === 'range-insert') && this.formatValue(newValue).length > maxlength) {
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1072
1119
|
this.updateInput(newValue, insertedValueStr, operation, valueStr);
|
|
1073
1120
|
this.handleOnInput(event, currentValue, newValue);
|
|
1074
1121
|
}
|
|
1075
1122
|
}
|
|
1076
1123
|
handleOnInput(event, currentValue, newValue) {
|
|
1077
1124
|
if (this.isValueChanged(currentValue, newValue)) {
|
|
1078
|
-
this.input().nativeElement
|
|
1125
|
+
const inputEl = this.input().nativeElement;
|
|
1126
|
+
// updateInput() already rendered the value; reformatting it would drop an in-progress fraction such as '0,'.
|
|
1127
|
+
if (this.parseValue(inputEl.value) !== newValue) {
|
|
1128
|
+
inputEl.value = this.formatValue(newValue);
|
|
1129
|
+
}
|
|
1079
1130
|
this.input().nativeElement.setAttribute('aria-valuenow', newValue);
|
|
1080
1131
|
this.updateModel(event, newValue);
|
|
1081
1132
|
this.onInput.emit({ originalEvent: event, value: newValue, formattedValue: currentValue });
|
|
@@ -1224,6 +1275,13 @@ class InputNumber extends BaseInput {
|
|
|
1224
1275
|
}
|
|
1225
1276
|
formattedValue = computed(() => {
|
|
1226
1277
|
const val = !this.value() && !this.allowEmpty() ? 0 : this.value();
|
|
1278
|
+
// While editing, keep the typed text when it already holds this value (e.g. '0,' after deleting the last fraction digit).
|
|
1279
|
+
if (this.focused()) {
|
|
1280
|
+
const inputValue = this.input()?.nativeElement.value;
|
|
1281
|
+
if (inputValue && this.parseValue(inputValue) === val) {
|
|
1282
|
+
return inputValue;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1227
1285
|
return this.formatValue(val);
|
|
1228
1286
|
}, /* @ts-ignore */
|
|
1229
1287
|
...(ngDevMode ? [{ debugName: "formattedValue" }] : /* istanbul ignore next */ []));
|
|
@@ -1232,10 +1290,16 @@ class InputNumber extends BaseInput {
|
|
|
1232
1290
|
if (this.value() !== value) {
|
|
1233
1291
|
this.value.set(value);
|
|
1234
1292
|
if (!(isBlurUpdateOnMode && this.focused())) {
|
|
1293
|
+
this.blurChangePending.set(false);
|
|
1235
1294
|
this.onModelChange(value);
|
|
1236
1295
|
}
|
|
1296
|
+
else {
|
|
1297
|
+
this.blurChangePending.set(true);
|
|
1298
|
+
}
|
|
1237
1299
|
}
|
|
1238
|
-
else if (isBlurUpdateOnMode) {
|
|
1300
|
+
else if (isBlurUpdateOnMode && !this.focused() && this.blurChangePending()) {
|
|
1301
|
+
// report the change deferred while focused, but not a blur without an edit (it would mark the control dirty)
|
|
1302
|
+
this.blurChangePending.set(false);
|
|
1239
1303
|
this.onModelChange(value);
|
|
1240
1304
|
}
|
|
1241
1305
|
}
|
|
@@ -1293,8 +1357,6 @@ class InputNumber extends BaseInput {
|
|
|
1293
1357
|
[attr.minlength]="minlength()"
|
|
1294
1358
|
[attr.tabindex]="tabindex()"
|
|
1295
1359
|
[attr.aria-required]="ariaRequired()"
|
|
1296
|
-
[attr.min]="min()"
|
|
1297
|
-
[attr.max]="max()"
|
|
1298
1360
|
[attr.step]="step() ?? 1"
|
|
1299
1361
|
[attr.required]="required() ? '' : undefined"
|
|
1300
1362
|
[attr.readonly]="readonly() ? '' : undefined"
|
|
@@ -1461,8 +1523,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
1461
1523
|
[attr.minlength]="minlength()"
|
|
1462
1524
|
[attr.tabindex]="tabindex()"
|
|
1463
1525
|
[attr.aria-required]="ariaRequired()"
|
|
1464
|
-
[attr.min]="min()"
|
|
1465
|
-
[attr.max]="max()"
|
|
1466
1526
|
[attr.step]="step() ?? 1"
|
|
1467
1527
|
[attr.required]="required() ? '' : undefined"
|
|
1468
1528
|
[attr.readonly]="readonly() ? '' : undefined"
|