@tectra-ng/ui 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +26 -2
- package/amount/README.md +28 -0
- package/autocomplete/README.md +82 -0
- package/avatar/README.md +43 -0
- package/badge/README.md +19 -0
- package/button/README.md +46 -0
- package/button-group/README.md +8 -0
- package/card/README.md +30 -0
- package/cascade-select/README.md +49 -0
- package/checkbox/README.md +64 -0
- package/chip/README.md +38 -0
- package/chips-input/README.md +47 -0
- package/color-picker/README.md +43 -0
- package/confirm/README.md +46 -0
- package/country/README.md +23 -0
- package/country-select/README.md +39 -0
- package/dialog/README.md +84 -0
- package/divider/README.md +24 -0
- package/drawer/README.md +54 -0
- package/email-suggestion/README.md +20 -0
- package/fesm2022/tectra-ng-ui-amount.mjs +415 -0
- package/fesm2022/tectra-ng-ui-amount.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +730 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-avatar.mjs +670 -0
- package/fesm2022/tectra-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-badge.mjs +191 -0
- package/fesm2022/tectra-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-button-group.mjs +50 -0
- package/fesm2022/tectra-ng-ui-button-group.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-button.mjs +725 -0
- package/fesm2022/tectra-ng-ui-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-card.mjs +210 -0
- package/fesm2022/tectra-ng-ui-card.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +887 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-checkbox.mjs +1150 -0
- package/fesm2022/tectra-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-chip.mjs +344 -0
- package/fesm2022/tectra-ng-ui-chip.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-chips-input.mjs +649 -0
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-color-picker.mjs +828 -0
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-confirm.mjs +489 -0
- package/fesm2022/tectra-ng-ui-confirm.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-country-select.mjs +545 -0
- package/fesm2022/tectra-ng-ui-country-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-country.mjs +313 -0
- package/fesm2022/tectra-ng-ui-country.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-dialog.mjs +1539 -0
- package/fesm2022/tectra-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-divider.mjs +194 -0
- package/fesm2022/tectra-ng-ui-divider.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-drawer.mjs +540 -0
- package/fesm2022/tectra-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-email-suggestion.mjs +341 -0
- package/fesm2022/tectra-ng-ui-email-suggestion.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-field.mjs +492 -0
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-fieldset.mjs +258 -0
- package/fesm2022/tectra-ng-ui-fieldset.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-highlight-text.mjs +246 -0
- package/fesm2022/tectra-ng-ui-highlight-text.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-icon-field.mjs +478 -0
- package/fesm2022/tectra-ng-ui-icon-field.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs +113 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-mask.mjs +413 -0
- package/fesm2022/tectra-ng-ui-input-mask.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-number.mjs +1045 -0
- package/fesm2022/tectra-ng-ui-input-number.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-otp.mjs +553 -0
- package/fesm2022/tectra-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input.mjs +260 -0
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-key-filter.mjs +185 -0
- package/fesm2022/tectra-ng-ui-key-filter.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-knob.mjs +630 -0
- package/fesm2022/tectra-ng-ui-knob.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-label.mjs +271 -0
- package/fesm2022/tectra-ng-ui-label.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-link.mjs +699 -0
- package/fesm2022/tectra-ng-ui-link.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-listbox.mjs +484 -0
- package/fesm2022/tectra-ng-ui-listbox.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs +717 -0
- package/fesm2022/tectra-ng-ui-mention-textarea.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-menu.mjs +1484 -0
- package/fesm2022/tectra-ng-ui-menu.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-message.mjs +975 -0
- package/fesm2022/tectra-ng-ui-message.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs +569 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-overlay-badge.mjs +345 -0
- package/fesm2022/tectra-ng-ui-overlay-badge.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-paginator.mjs +849 -0
- package/fesm2022/tectra-ng-ui-paginator.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-panel.mjs +317 -0
- package/fesm2022/tectra-ng-ui-panel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-password-generator.mjs +292 -0
- package/fesm2022/tectra-ng-ui-password-generator.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-password.mjs +871 -0
- package/fesm2022/tectra-ng-ui-password.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-pill.mjs +361 -0
- package/fesm2022/tectra-ng-ui-pill.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-popover.mjs +742 -0
- package/fesm2022/tectra-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-progress-bar.mjs +440 -0
- package/fesm2022/tectra-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-progress-spinner.mjs +265 -0
- package/fesm2022/tectra-ng-ui-progress-spinner.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-radio-button.mjs +817 -0
- package/fesm2022/tectra-ng-ui-radio-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-rating.mjs +584 -0
- package/fesm2022/tectra-ng-ui-rating.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +2478 -0
- package/fesm2022/tectra-ng-ui-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-skeleton.mjs +548 -0
- package/fesm2022/tectra-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-slider.mjs +630 -0
- package/fesm2022/tectra-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-speed-dial.mjs +669 -0
- package/fesm2022/tectra-ng-ui-speed-dial.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-split-button.mjs +614 -0
- package/fesm2022/tectra-ng-ui-split-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-status-icon.mjs +295 -0
- package/fesm2022/tectra-ng-ui-status-icon.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-table.mjs +5997 -0
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tag.mjs +422 -0
- package/fesm2022/tectra-ng-ui-tag.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs +482 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toast.mjs +668 -0
- package/fesm2022/tectra-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toggle-button.mjs +416 -0
- package/fesm2022/tectra-ng-ui-toggle-button.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toggle-switch.mjs +560 -0
- package/fesm2022/tectra-ng-ui-toggle-switch.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tooltip.mjs +835 -0
- package/fesm2022/tectra-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs +986 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui.mjs +4 -0
- package/fesm2022/tectra-ng-ui.mjs.map +1 -0
- package/field/README.md +43 -0
- package/fieldset/README.md +36 -0
- package/highlight-text/README.md +20 -0
- package/icon-field/README.md +30 -0
- package/input/README.md +22 -0
- package/input-group/README.md +21 -0
- package/input-mask/README.md +30 -0
- package/input-number/README.md +61 -0
- package/input-otp/README.md +44 -0
- package/key-filter/README.md +31 -0
- package/knob/README.md +50 -0
- package/label/README.md +29 -0
- package/link/README.md +47 -0
- package/listbox/README.md +68 -0
- package/mention-textarea/README.md +47 -0
- package/menu/README.md +65 -0
- package/message/README.md +58 -0
- package/multiselect/README.md +85 -0
- package/overlay-badge/README.md +30 -0
- package/package.json +301 -3
- package/paginator/README.md +60 -0
- package/panel/README.md +45 -0
- package/password/README.md +60 -0
- package/password-generator/README.md +34 -0
- package/pill/README.md +42 -0
- package/popover/README.md +67 -0
- package/progress-bar/README.md +32 -0
- package/progress-spinner/README.md +22 -0
- package/radio-button/README.md +54 -0
- package/rating/README.md +49 -0
- package/select/README.md +78 -0
- package/skeleton/README.md +27 -0
- package/slider/README.md +48 -0
- package/speed-dial/README.md +49 -0
- package/split-button/README.md +45 -0
- package/status-icon/README.md +22 -0
- package/table/README.md +178 -0
- package/tag/README.md +42 -0
- package/textarea/README.md +37 -0
- package/toast/README.md +52 -0
- package/toggle-button/README.md +34 -0
- package/toggle-switch/README.md +49 -0
- package/tooltip/README.md +60 -0
- package/tree-select/README.md +49 -0
- package/types/tectra-ng-ui-amount.d.ts +135 -0
- package/types/tectra-ng-ui-amount.d.ts.map +1 -0
- package/types/tectra-ng-ui-autocomplete.d.ts +250 -0
- package/types/tectra-ng-ui-autocomplete.d.ts.map +1 -0
- package/types/tectra-ng-ui-avatar.d.ts +289 -0
- package/types/tectra-ng-ui-avatar.d.ts.map +1 -0
- package/types/tectra-ng-ui-badge.d.ts +119 -0
- package/types/tectra-ng-ui-badge.d.ts.map +1 -0
- package/types/tectra-ng-ui-button-group.d.ts +6 -0
- package/types/tectra-ng-ui-button-group.d.ts.map +1 -0
- package/types/tectra-ng-ui-button.d.ts +466 -0
- package/types/tectra-ng-ui-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-card.d.ts +71 -0
- package/types/tectra-ng-ui-card.d.ts.map +1 -0
- package/types/tectra-ng-ui-cascade-select.d.ts +244 -0
- package/types/tectra-ng-ui-cascade-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-checkbox.d.ts +450 -0
- package/types/tectra-ng-ui-checkbox.d.ts.map +1 -0
- package/types/tectra-ng-ui-chip.d.ts +106 -0
- package/types/tectra-ng-ui-chip.d.ts.map +1 -0
- package/types/tectra-ng-ui-chips-input.d.ts +187 -0
- package/types/tectra-ng-ui-chips-input.d.ts.map +1 -0
- package/types/tectra-ng-ui-color-picker.d.ts +237 -0
- package/types/tectra-ng-ui-color-picker.d.ts.map +1 -0
- package/types/tectra-ng-ui-confirm.d.ts +80 -0
- package/types/tectra-ng-ui-confirm.d.ts.map +1 -0
- package/types/tectra-ng-ui-country-select.d.ts +235 -0
- package/types/tectra-ng-ui-country-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-country.d.ts +105 -0
- package/types/tectra-ng-ui-country.d.ts.map +1 -0
- package/types/tectra-ng-ui-dialog.d.ts +453 -0
- package/types/tectra-ng-ui-dialog.d.ts.map +1 -0
- package/types/tectra-ng-ui-divider.d.ts +70 -0
- package/types/tectra-ng-ui-divider.d.ts.map +1 -0
- package/types/tectra-ng-ui-drawer.d.ts +188 -0
- package/types/tectra-ng-ui-drawer.d.ts.map +1 -0
- package/types/tectra-ng-ui-email-suggestion.d.ts +84 -0
- package/types/tectra-ng-ui-email-suggestion.d.ts.map +1 -0
- package/types/tectra-ng-ui-field.d.ts +139 -0
- package/types/tectra-ng-ui-field.d.ts.map +1 -0
- package/types/tectra-ng-ui-fieldset.d.ts +74 -0
- package/types/tectra-ng-ui-fieldset.d.ts.map +1 -0
- package/types/tectra-ng-ui-highlight-text.d.ts +75 -0
- package/types/tectra-ng-ui-highlight-text.d.ts.map +1 -0
- package/types/tectra-ng-ui-icon-field.d.ts +77 -0
- package/types/tectra-ng-ui-icon-field.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-group.d.ts +18 -0
- package/types/tectra-ng-ui-input-group.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-mask.d.ts +91 -0
- package/types/tectra-ng-ui-input-mask.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-number.d.ts +326 -0
- package/types/tectra-ng-ui-input-number.d.ts.map +1 -0
- package/types/tectra-ng-ui-input-otp.d.ts +173 -0
- package/types/tectra-ng-ui-input-otp.d.ts.map +1 -0
- package/types/tectra-ng-ui-input.d.ts +113 -0
- package/types/tectra-ng-ui-input.d.ts.map +1 -0
- package/types/tectra-ng-ui-key-filter.d.ts +43 -0
- package/types/tectra-ng-ui-key-filter.d.ts.map +1 -0
- package/types/tectra-ng-ui-knob.d.ts +207 -0
- package/types/tectra-ng-ui-knob.d.ts.map +1 -0
- package/types/tectra-ng-ui-label.d.ts +53 -0
- package/types/tectra-ng-ui-label.d.ts.map +1 -0
- package/types/tectra-ng-ui-link.d.ts +223 -0
- package/types/tectra-ng-ui-link.d.ts.map +1 -0
- package/types/tectra-ng-ui-listbox.d.ts +131 -0
- package/types/tectra-ng-ui-listbox.d.ts.map +1 -0
- package/types/tectra-ng-ui-mention-textarea.d.ts +169 -0
- package/types/tectra-ng-ui-mention-textarea.d.ts.map +1 -0
- package/types/tectra-ng-ui-menu.d.ts +512 -0
- package/types/tectra-ng-ui-menu.d.ts.map +1 -0
- package/types/tectra-ng-ui-message.d.ts +390 -0
- package/types/tectra-ng-ui-message.d.ts.map +1 -0
- package/types/tectra-ng-ui-multiselect.d.ts +216 -0
- package/types/tectra-ng-ui-multiselect.d.ts.map +1 -0
- package/types/tectra-ng-ui-overlay-badge.d.ts +104 -0
- package/types/tectra-ng-ui-overlay-badge.d.ts.map +1 -0
- package/types/tectra-ng-ui-paginator.d.ts +293 -0
- package/types/tectra-ng-ui-paginator.d.ts.map +1 -0
- package/types/tectra-ng-ui-panel.d.ts +133 -0
- package/types/tectra-ng-ui-panel.d.ts.map +1 -0
- package/types/tectra-ng-ui-password-generator.d.ts +80 -0
- package/types/tectra-ng-ui-password-generator.d.ts.map +1 -0
- package/types/tectra-ng-ui-password.d.ts +271 -0
- package/types/tectra-ng-ui-password.d.ts.map +1 -0
- package/types/tectra-ng-ui-pill.d.ts +167 -0
- package/types/tectra-ng-ui-pill.d.ts.map +1 -0
- package/types/tectra-ng-ui-popover.d.ts +244 -0
- package/types/tectra-ng-ui-popover.d.ts.map +1 -0
- package/types/tectra-ng-ui-progress-bar.d.ts +151 -0
- package/types/tectra-ng-ui-progress-bar.d.ts.map +1 -0
- package/types/tectra-ng-ui-progress-spinner.d.ts +95 -0
- package/types/tectra-ng-ui-progress-spinner.d.ts.map +1 -0
- package/types/tectra-ng-ui-radio-button.d.ts +380 -0
- package/types/tectra-ng-ui-radio-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-rating.d.ts +195 -0
- package/types/tectra-ng-ui-rating.d.ts.map +1 -0
- package/types/tectra-ng-ui-select.d.ts +761 -0
- package/types/tectra-ng-ui-select.d.ts.map +1 -0
- package/types/tectra-ng-ui-skeleton.d.ts +182 -0
- package/types/tectra-ng-ui-skeleton.d.ts.map +1 -0
- package/types/tectra-ng-ui-slider.d.ts +220 -0
- package/types/tectra-ng-ui-slider.d.ts.map +1 -0
- package/types/tectra-ng-ui-speed-dial.d.ts +175 -0
- package/types/tectra-ng-ui-speed-dial.d.ts.map +1 -0
- package/types/tectra-ng-ui-split-button.d.ts +139 -0
- package/types/tectra-ng-ui-split-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-status-icon.d.ts +105 -0
- package/types/tectra-ng-ui-status-icon.d.ts.map +1 -0
- package/types/tectra-ng-ui-table.d.ts +1301 -0
- package/types/tectra-ng-ui-table.d.ts.map +1 -0
- package/types/tectra-ng-ui-tag.d.ts +157 -0
- package/types/tectra-ng-ui-tag.d.ts.map +1 -0
- package/types/tectra-ng-ui-textarea.d.ts +146 -0
- package/types/tectra-ng-ui-textarea.d.ts.map +1 -0
- package/types/tectra-ng-ui-toast.d.ts +268 -0
- package/types/tectra-ng-ui-toast.d.ts.map +1 -0
- package/types/tectra-ng-ui-toggle-button.d.ts +184 -0
- package/types/tectra-ng-ui-toggle-button.d.ts.map +1 -0
- package/types/tectra-ng-ui-toggle-switch.d.ts +226 -0
- package/types/tectra-ng-ui-toggle-switch.d.ts.map +1 -0
- package/types/tectra-ng-ui-tooltip.d.ts +275 -0
- package/types/tectra-ng-ui-tooltip.d.ts.map +1 -0
- package/types/tectra-ng-ui-tree-select.d.ts +339 -0
- package/types/tectra-ng-ui-tree-select.d.ts.map +1 -0
- package/types/tectra-ng-ui.d.ts +2 -0
- package/types/tectra-ng-ui.d.ts.map +1 -0
|
@@ -0,0 +1,1045 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, booleanAttribute, computed, effect, forwardRef, inject, input, numberAttribute, output, signal, viewChild } from "@angular/core";
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
5
|
+
import { uniqueId } from "@tectra-ng/core/a11y";
|
|
6
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
7
|
+
import { injectFluid } from "@tectra-ng/core/fluid";
|
|
8
|
+
import { TxFormControlBase, injectFieldInvalid } from "@tectra-ng/core/forms";
|
|
9
|
+
import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
|
|
10
|
+
import { optionalBoolean, optionalNumber } from "@tectra-ng/core/utils";
|
|
11
|
+
import { TxIcon, TxIconRegistry } from "@tectra-ng/icons";
|
|
12
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
13
|
+
import { TxInput } from "@tectra-ng/ui/input";
|
|
14
|
+
const NUMBER_PARTS = [
|
|
15
|
+
"integer",
|
|
16
|
+
"group",
|
|
17
|
+
"decimal",
|
|
18
|
+
"fraction"
|
|
19
|
+
];
|
|
20
|
+
var TxNumberFormat = class {
|
|
21
|
+
decimal;
|
|
22
|
+
group;
|
|
23
|
+
before;
|
|
24
|
+
after;
|
|
25
|
+
maxFraction;
|
|
26
|
+
full;
|
|
27
|
+
integer;
|
|
28
|
+
constructor(options) {
|
|
29
|
+
const style = options.mode === "currency" ? {
|
|
30
|
+
style: "currency",
|
|
31
|
+
currency: options.currency ?? "USD",
|
|
32
|
+
currencyDisplay: options.currencyDisplay ?? "symbol"
|
|
33
|
+
} : { style: "decimal" };
|
|
34
|
+
const defaults = new Intl.NumberFormat(options.locale, style).resolvedOptions();
|
|
35
|
+
const currency = options.mode === "currency";
|
|
36
|
+
const min = options.minFractionDigits ?? (currency ? defaults.minimumFractionDigits ?? 2 : 0);
|
|
37
|
+
const max = Math.max(min, options.maxFractionDigits ?? (currency ? defaults.maximumFractionDigits ?? 2 : 3));
|
|
38
|
+
this.full = new Intl.NumberFormat(options.locale, {
|
|
39
|
+
...style,
|
|
40
|
+
useGrouping: options.useGrouping,
|
|
41
|
+
minimumFractionDigits: min,
|
|
42
|
+
maximumFractionDigits: max
|
|
43
|
+
});
|
|
44
|
+
this.integer = new Intl.NumberFormat(options.locale, {
|
|
45
|
+
useGrouping: options.useGrouping,
|
|
46
|
+
maximumFractionDigits: 0
|
|
47
|
+
});
|
|
48
|
+
const plain = new Intl.NumberFormat(options.locale).formatToParts(12345.6);
|
|
49
|
+
this.decimal = plain.find((part) => part.type === "decimal")?.value ?? ".";
|
|
50
|
+
this.group = plain.find((part) => part.type === "group")?.value ?? ",";
|
|
51
|
+
this.maxFraction = max;
|
|
52
|
+
const sample = this.full.formatToParts(-12345.6);
|
|
53
|
+
const first = sample.findIndex((part) => NUMBER_PARTS.includes(part.type));
|
|
54
|
+
const last = sample.length - 1 - [...sample].reverse().findIndex((part) => NUMBER_PARTS.includes(part.type));
|
|
55
|
+
const affix = (parts) => parts.filter((part) => part.type !== "minusSign").map((part) => part.value).join("");
|
|
56
|
+
this.before = (options.prefix ?? "") + affix(sample.slice(0, first));
|
|
57
|
+
this.after = affix(sample.slice(last + 1)) + (options.suffix ?? "");
|
|
58
|
+
}
|
|
59
|
+
format(value) {
|
|
60
|
+
if (value === null || Number.isNaN(value)) return "";
|
|
61
|
+
const number = this.full.formatToParts(Math.abs(value)).filter((part) => NUMBER_PARTS.includes(part.type)).map((part) => part.value).join("");
|
|
62
|
+
return `${value < 0 ? "-" : ""}${this.before}${number}${this.after}`;
|
|
63
|
+
}
|
|
64
|
+
formatTyping(text) {
|
|
65
|
+
const read = this.read(text);
|
|
66
|
+
if (read.digits === "" && read.fraction === null) return {
|
|
67
|
+
display: read.negative ? "-" : "",
|
|
68
|
+
value: null
|
|
69
|
+
};
|
|
70
|
+
const integer = (read.digits || "0").replace(/^0+(?=\d)/, "");
|
|
71
|
+
const fraction = read.fraction === null ? null : read.fraction.slice(0, this.maxFraction);
|
|
72
|
+
const grouped = this.integer.format(BigInt(integer));
|
|
73
|
+
return {
|
|
74
|
+
display: `${read.negative ? "-" : ""}${this.before}${grouped}${fraction === null ? "" : this.decimal + fraction}${this.after}`,
|
|
75
|
+
value: Number(`${read.negative ? "-" : ""}${integer}${fraction ? `.${fraction}` : ""}`)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
parse(text) {
|
|
79
|
+
return this.formatTyping(text).value;
|
|
80
|
+
}
|
|
81
|
+
countBefore(text, caret) {
|
|
82
|
+
let count = 0;
|
|
83
|
+
let decimalSeen = false;
|
|
84
|
+
for (const char of this.strip(text.slice(0, caret))) if (/\d/.test(char)) count += 1;
|
|
85
|
+
else if (!decimalSeen && this.isDecimal(char)) {
|
|
86
|
+
decimalSeen = true;
|
|
87
|
+
count += 1;
|
|
88
|
+
}
|
|
89
|
+
return count;
|
|
90
|
+
}
|
|
91
|
+
caretFor(display, count) {
|
|
92
|
+
const start = (display.startsWith("-") ? 1 : 0) + this.before.length;
|
|
93
|
+
if (count <= 0) return start;
|
|
94
|
+
let seen = 0;
|
|
95
|
+
for (let index = start; index < display.length - this.after.length; index += 1) if (/\d/.test(display[index]) || display[index] === this.decimal) {
|
|
96
|
+
seen += 1;
|
|
97
|
+
if (seen === count) return index + 1;
|
|
98
|
+
}
|
|
99
|
+
return display.length - this.after.length;
|
|
100
|
+
}
|
|
101
|
+
read(text) {
|
|
102
|
+
const negative = text.includes("-");
|
|
103
|
+
let digits = "";
|
|
104
|
+
let fraction = null;
|
|
105
|
+
for (const char of this.strip(text)) if (/\d/.test(char)) {
|
|
106
|
+
if (fraction === null) digits += char;
|
|
107
|
+
else fraction += char;
|
|
108
|
+
} else if (fraction === null && this.maxFraction > 0 && this.isDecimal(char)) fraction = "";
|
|
109
|
+
return {
|
|
110
|
+
negative,
|
|
111
|
+
digits,
|
|
112
|
+
fraction
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
strip(text) {
|
|
116
|
+
let body = text.replace("-", "");
|
|
117
|
+
if (this.before && body.startsWith(this.before)) body = body.slice(this.before.length);
|
|
118
|
+
if (this.after && body.endsWith(this.after)) body = body.slice(0, -this.after.length);
|
|
119
|
+
return body;
|
|
120
|
+
}
|
|
121
|
+
isDecimal(char) {
|
|
122
|
+
return char === this.decimal || this.decimal === "," && char === "." && this.group !== ".";
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const REPEAT_DELAY = 400;
|
|
126
|
+
const REPEAT_INTERVAL = 60;
|
|
127
|
+
var TxInputNumber = class TxInputNumber extends TxFormControlBase {
|
|
128
|
+
txIconRegistry = inject(TxIconRegistry);
|
|
129
|
+
localeService = inject(TxLocaleService);
|
|
130
|
+
generatedId = uniqueId("tx-input-number");
|
|
131
|
+
repeatTimer = null;
|
|
132
|
+
mode = input("decimal", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
|
|
133
|
+
currency = input(void 0, ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
|
|
134
|
+
currencyDisplay = input("symbol", ...ngDevMode ? [{ debugName: "currencyDisplay" }] : /* istanbul ignore next */ []);
|
|
135
|
+
locale = input(void 0, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
136
|
+
useGrouping = input(true, {
|
|
137
|
+
...ngDevMode ? { debugName: "useGrouping" } : /* istanbul ignore next */ {},
|
|
138
|
+
transform: booleanAttribute
|
|
139
|
+
});
|
|
140
|
+
minFractionDigits = input(void 0, {
|
|
141
|
+
...ngDevMode ? { debugName: "minFractionDigits" } : /* istanbul ignore next */ {},
|
|
142
|
+
transform: optionalNumber
|
|
143
|
+
});
|
|
144
|
+
maxFractionDigits = input(void 0, {
|
|
145
|
+
...ngDevMode ? { debugName: "maxFractionDigits" } : /* istanbul ignore next */ {},
|
|
146
|
+
transform: optionalNumber
|
|
147
|
+
});
|
|
148
|
+
prefix = input(void 0, ...ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []);
|
|
149
|
+
suffix = input(void 0, ...ngDevMode ? [{ debugName: "suffix" }] : /* istanbul ignore next */ []);
|
|
150
|
+
min = input(void 0, {
|
|
151
|
+
...ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {},
|
|
152
|
+
transform: optionalNumber
|
|
153
|
+
});
|
|
154
|
+
max = input(void 0, {
|
|
155
|
+
...ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {},
|
|
156
|
+
transform: optionalNumber
|
|
157
|
+
});
|
|
158
|
+
step = input(1, {
|
|
159
|
+
...ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {},
|
|
160
|
+
transform: numberAttribute
|
|
161
|
+
});
|
|
162
|
+
showButtons = input(false, {
|
|
163
|
+
...ngDevMode ? { debugName: "showButtons" } : /* istanbul ignore next */ {},
|
|
164
|
+
transform: booleanAttribute
|
|
165
|
+
});
|
|
166
|
+
buttonLayout = input("stacked", ...ngDevMode ? [{ debugName: "buttonLayout" }] : /* istanbul ignore next */ []);
|
|
167
|
+
incrementIcon = input(void 0, ...ngDevMode ? [{ debugName: "incrementIcon" }] : /* istanbul ignore next */ []);
|
|
168
|
+
decrementIcon = input(void 0, ...ngDevMode ? [{ debugName: "decrementIcon" }] : /* istanbul ignore next */ []);
|
|
169
|
+
allowEmpty = input(true, {
|
|
170
|
+
...ngDevMode ? { debugName: "allowEmpty" } : /* istanbul ignore next */ {},
|
|
171
|
+
transform: booleanAttribute
|
|
172
|
+
});
|
|
173
|
+
showClear = input(false, {
|
|
174
|
+
...ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {},
|
|
175
|
+
transform: booleanAttribute
|
|
176
|
+
});
|
|
177
|
+
placeholder = input(void 0, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
178
|
+
size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
179
|
+
variant = input("outlined", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
180
|
+
fluid = input(void 0, {
|
|
181
|
+
...ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {},
|
|
182
|
+
transform: optionalBoolean
|
|
183
|
+
});
|
|
184
|
+
invalid = input(void 0, {
|
|
185
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
186
|
+
transform: optionalBoolean
|
|
187
|
+
});
|
|
188
|
+
disabledInput = input(false, {
|
|
189
|
+
...ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {},
|
|
190
|
+
alias: "disabled",
|
|
191
|
+
transform: booleanAttribute
|
|
192
|
+
});
|
|
193
|
+
readonly = input(false, {
|
|
194
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
195
|
+
transform: booleanAttribute
|
|
196
|
+
});
|
|
197
|
+
required = input(false, {
|
|
198
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
199
|
+
transform: booleanAttribute
|
|
200
|
+
});
|
|
201
|
+
name = input(void 0, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
202
|
+
inputId = input(void 0, ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
203
|
+
ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
204
|
+
ariaLabelledBy = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
|
|
205
|
+
tabindex = input(void 0, {
|
|
206
|
+
...ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {},
|
|
207
|
+
transform: optionalNumber
|
|
208
|
+
});
|
|
209
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
210
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
211
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
212
|
+
unstyled = input(void 0, {
|
|
213
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
214
|
+
transform: optionalBoolean
|
|
215
|
+
});
|
|
216
|
+
changed = output();
|
|
217
|
+
cleared = output();
|
|
218
|
+
inputRef = viewChild.required("input", ...ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []);
|
|
219
|
+
translations = injectTranslations();
|
|
220
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
221
|
+
isFluid = injectFluid(this.fluid);
|
|
222
|
+
isInvalid = injectFieldInvalid(this.invalid);
|
|
223
|
+
passThrough = injectPassThrough("inputNumber", this, this.pt, this.ptOptions);
|
|
224
|
+
isFocused = signal(false, ...ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []);
|
|
225
|
+
resolvedId = computed(() => this.inputId() ?? this.generatedId, ...ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []);
|
|
226
|
+
isDisabled = computed(() => this.disabled() || this.disabledInput(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
227
|
+
isEditable = computed(() => !this.isDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "isEditable" }] : /* istanbul ignore next */ []);
|
|
228
|
+
format = computed(() => new TxNumberFormat({
|
|
229
|
+
locale: this.locale() ?? this.localeService.locale().intl,
|
|
230
|
+
mode: this.mode(),
|
|
231
|
+
currency: this.currency(),
|
|
232
|
+
currencyDisplay: this.currencyDisplay(),
|
|
233
|
+
useGrouping: this.useGrouping(),
|
|
234
|
+
minFractionDigits: this.minFractionDigits(),
|
|
235
|
+
maxFractionDigits: this.maxFractionDigits(),
|
|
236
|
+
prefix: this.prefix(),
|
|
237
|
+
suffix: this.suffix()
|
|
238
|
+
}), ...ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []);
|
|
239
|
+
canIncrement = computed(() => this.isEditable() && (this.max() === void 0 || (this.value() ?? 0) < this.max()), ...ngDevMode ? [{ debugName: "canIncrement" }] : /* istanbul ignore next */ []);
|
|
240
|
+
canDecrement = computed(() => this.isEditable() && (this.min() === void 0 || (this.value() ?? 0) > this.min()), ...ngDevMode ? [{ debugName: "canDecrement" }] : /* istanbul ignore next */ []);
|
|
241
|
+
incrementIconName = computed(() => this.iconName(this.incrementIcon(), this.buttonLayout() === "stacked" ? "chevron-up" : "plus"), ...ngDevMode ? [{ debugName: "incrementIconName" }] : /* istanbul ignore next */ []);
|
|
242
|
+
decrementIconName = computed(() => this.iconName(this.decrementIcon(), this.buttonLayout() === "stacked" ? "chevron-down" : "minus"), ...ngDevMode ? [{ debugName: "decrementIconName" }] : /* istanbul ignore next */ []);
|
|
243
|
+
hostStyle = computed(() => ({
|
|
244
|
+
...toStyleObject(this.dt(), "--tx-input-number"),
|
|
245
|
+
...this.passThrough().root?.style
|
|
246
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
247
|
+
constructor() {
|
|
248
|
+
super();
|
|
249
|
+
effect(() => {
|
|
250
|
+
this.format();
|
|
251
|
+
if (!this.isFocused()) this.paint(this.format().format(this.value()));
|
|
252
|
+
});
|
|
253
|
+
inject(DestroyRef).onDestroy(() => this.stopRepeat());
|
|
254
|
+
}
|
|
255
|
+
writeValue(value) {
|
|
256
|
+
super.writeValue(typeof value === "number" && !Number.isNaN(value) ? value : null);
|
|
257
|
+
queueMicrotask(() => this.paint(this.format().format(this.value())));
|
|
258
|
+
}
|
|
259
|
+
focus() {
|
|
260
|
+
this.inputRef().nativeElement.focus();
|
|
261
|
+
}
|
|
262
|
+
onInput(event) {
|
|
263
|
+
const element = this.inputRef().nativeElement;
|
|
264
|
+
const format = this.format();
|
|
265
|
+
const count = format.countBefore(element.value, element.selectionStart ?? element.value.length);
|
|
266
|
+
const typed = format.formatTyping(this.allowsNegative() ? element.value : element.value.replace("-", ""));
|
|
267
|
+
this.paint(typed.display);
|
|
268
|
+
element.setSelectionRange(format.caretFor(typed.display, count), format.caretFor(typed.display, count));
|
|
269
|
+
this.commit(typed.value, event);
|
|
270
|
+
}
|
|
271
|
+
onKeydown(event) {
|
|
272
|
+
if (!this.isEditable()) return;
|
|
273
|
+
switch (event.key) {
|
|
274
|
+
case "ArrowUp":
|
|
275
|
+
event.preventDefault();
|
|
276
|
+
this.spin(1, event);
|
|
277
|
+
break;
|
|
278
|
+
case "ArrowDown":
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
this.spin(-1, event);
|
|
281
|
+
break;
|
|
282
|
+
case "Home":
|
|
283
|
+
if (this.min() !== void 0) {
|
|
284
|
+
event.preventDefault();
|
|
285
|
+
this.commit(this.min(), event, true);
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
case "End":
|
|
289
|
+
if (this.max() !== void 0) {
|
|
290
|
+
event.preventDefault();
|
|
291
|
+
this.commit(this.max(), event, true);
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
case "Enter": this.finish(event);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
onFocus() {
|
|
298
|
+
this.isFocused.set(true);
|
|
299
|
+
}
|
|
300
|
+
onBlur(event) {
|
|
301
|
+
this.isFocused.set(false);
|
|
302
|
+
this.finish(event);
|
|
303
|
+
this.markTouched();
|
|
304
|
+
}
|
|
305
|
+
startRepeat(direction, event) {
|
|
306
|
+
if (event.button !== 0 || !this.isEditable()) return;
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
this.focus();
|
|
309
|
+
this.spin(direction, event);
|
|
310
|
+
this.stopRepeat();
|
|
311
|
+
const repeat = (delay) => {
|
|
312
|
+
this.repeatTimer = setTimeout(() => {
|
|
313
|
+
this.spin(direction, event);
|
|
314
|
+
repeat(REPEAT_INTERVAL);
|
|
315
|
+
}, delay);
|
|
316
|
+
};
|
|
317
|
+
repeat(REPEAT_DELAY);
|
|
318
|
+
}
|
|
319
|
+
stopRepeat() {
|
|
320
|
+
if (this.repeatTimer) {
|
|
321
|
+
clearTimeout(this.repeatTimer);
|
|
322
|
+
this.repeatTimer = null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
clear(event) {
|
|
326
|
+
this.commit(this.allowEmpty() ? null : this.min() ?? 0, event, true);
|
|
327
|
+
this.cleared.emit();
|
|
328
|
+
this.focus();
|
|
329
|
+
}
|
|
330
|
+
spin(direction, event) {
|
|
331
|
+
const current = this.value() ?? 0;
|
|
332
|
+
const precision = Math.max(decimals(this.step()), decimals(current));
|
|
333
|
+
const next = Number((current + direction * this.step()).toFixed(precision));
|
|
334
|
+
this.commit(this.clamp(next), event, true);
|
|
335
|
+
if (direction === 1 && !this.canIncrement() || direction === -1 && !this.canDecrement()) this.stopRepeat();
|
|
336
|
+
}
|
|
337
|
+
finish(event) {
|
|
338
|
+
let next = this.value();
|
|
339
|
+
if (next === null && !this.allowEmpty()) next = this.min() ?? 0;
|
|
340
|
+
next = next === null ? null : this.clamp(next);
|
|
341
|
+
this.commit(next, event, true);
|
|
342
|
+
}
|
|
343
|
+
commit(value, event, repaint = false) {
|
|
344
|
+
if (repaint) this.paint(this.format().format(value));
|
|
345
|
+
if (value !== this.value()) {
|
|
346
|
+
this.updateValue(value);
|
|
347
|
+
this.changed.emit({
|
|
348
|
+
value,
|
|
349
|
+
originalEvent: event
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
clamp(value) {
|
|
354
|
+
const min = this.min();
|
|
355
|
+
const max = this.max();
|
|
356
|
+
return Math.min(max ?? Infinity, Math.max(min ?? -Infinity, value));
|
|
357
|
+
}
|
|
358
|
+
allowsNegative() {
|
|
359
|
+
const min = this.min();
|
|
360
|
+
return min === void 0 || min < 0;
|
|
361
|
+
}
|
|
362
|
+
paint(text) {
|
|
363
|
+
const element = this.inputRef().nativeElement;
|
|
364
|
+
if (element.value !== text) element.value = text;
|
|
365
|
+
}
|
|
366
|
+
iconName(icon, fallback) {
|
|
367
|
+
const resolved = icon ?? fallback;
|
|
368
|
+
return this.txIconRegistry.has(resolved) ? {
|
|
369
|
+
name: resolved,
|
|
370
|
+
className: null
|
|
371
|
+
} : {
|
|
372
|
+
name: null,
|
|
373
|
+
className: resolved
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
377
|
+
minVersion: "12.0.0",
|
|
378
|
+
version: "22.2.3",
|
|
379
|
+
ngImport: i0,
|
|
380
|
+
type: TxInputNumber,
|
|
381
|
+
deps: [],
|
|
382
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
383
|
+
});
|
|
384
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
385
|
+
minVersion: "17.0.0",
|
|
386
|
+
version: "22.2.3",
|
|
387
|
+
type: TxInputNumber,
|
|
388
|
+
isStandalone: true,
|
|
389
|
+
selector: "tx-input-number",
|
|
390
|
+
inputs: {
|
|
391
|
+
mode: {
|
|
392
|
+
classPropertyName: "mode",
|
|
393
|
+
publicName: "mode",
|
|
394
|
+
isSignal: true,
|
|
395
|
+
isRequired: false,
|
|
396
|
+
transformFunction: null
|
|
397
|
+
},
|
|
398
|
+
currency: {
|
|
399
|
+
classPropertyName: "currency",
|
|
400
|
+
publicName: "currency",
|
|
401
|
+
isSignal: true,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
transformFunction: null
|
|
404
|
+
},
|
|
405
|
+
currencyDisplay: {
|
|
406
|
+
classPropertyName: "currencyDisplay",
|
|
407
|
+
publicName: "currencyDisplay",
|
|
408
|
+
isSignal: true,
|
|
409
|
+
isRequired: false,
|
|
410
|
+
transformFunction: null
|
|
411
|
+
},
|
|
412
|
+
locale: {
|
|
413
|
+
classPropertyName: "locale",
|
|
414
|
+
publicName: "locale",
|
|
415
|
+
isSignal: true,
|
|
416
|
+
isRequired: false,
|
|
417
|
+
transformFunction: null
|
|
418
|
+
},
|
|
419
|
+
useGrouping: {
|
|
420
|
+
classPropertyName: "useGrouping",
|
|
421
|
+
publicName: "useGrouping",
|
|
422
|
+
isSignal: true,
|
|
423
|
+
isRequired: false,
|
|
424
|
+
transformFunction: null
|
|
425
|
+
},
|
|
426
|
+
minFractionDigits: {
|
|
427
|
+
classPropertyName: "minFractionDigits",
|
|
428
|
+
publicName: "minFractionDigits",
|
|
429
|
+
isSignal: true,
|
|
430
|
+
isRequired: false,
|
|
431
|
+
transformFunction: null
|
|
432
|
+
},
|
|
433
|
+
maxFractionDigits: {
|
|
434
|
+
classPropertyName: "maxFractionDigits",
|
|
435
|
+
publicName: "maxFractionDigits",
|
|
436
|
+
isSignal: true,
|
|
437
|
+
isRequired: false,
|
|
438
|
+
transformFunction: null
|
|
439
|
+
},
|
|
440
|
+
prefix: {
|
|
441
|
+
classPropertyName: "prefix",
|
|
442
|
+
publicName: "prefix",
|
|
443
|
+
isSignal: true,
|
|
444
|
+
isRequired: false,
|
|
445
|
+
transformFunction: null
|
|
446
|
+
},
|
|
447
|
+
suffix: {
|
|
448
|
+
classPropertyName: "suffix",
|
|
449
|
+
publicName: "suffix",
|
|
450
|
+
isSignal: true,
|
|
451
|
+
isRequired: false,
|
|
452
|
+
transformFunction: null
|
|
453
|
+
},
|
|
454
|
+
min: {
|
|
455
|
+
classPropertyName: "min",
|
|
456
|
+
publicName: "min",
|
|
457
|
+
isSignal: true,
|
|
458
|
+
isRequired: false,
|
|
459
|
+
transformFunction: null
|
|
460
|
+
},
|
|
461
|
+
max: {
|
|
462
|
+
classPropertyName: "max",
|
|
463
|
+
publicName: "max",
|
|
464
|
+
isSignal: true,
|
|
465
|
+
isRequired: false,
|
|
466
|
+
transformFunction: null
|
|
467
|
+
},
|
|
468
|
+
step: {
|
|
469
|
+
classPropertyName: "step",
|
|
470
|
+
publicName: "step",
|
|
471
|
+
isSignal: true,
|
|
472
|
+
isRequired: false,
|
|
473
|
+
transformFunction: null
|
|
474
|
+
},
|
|
475
|
+
showButtons: {
|
|
476
|
+
classPropertyName: "showButtons",
|
|
477
|
+
publicName: "showButtons",
|
|
478
|
+
isSignal: true,
|
|
479
|
+
isRequired: false,
|
|
480
|
+
transformFunction: null
|
|
481
|
+
},
|
|
482
|
+
buttonLayout: {
|
|
483
|
+
classPropertyName: "buttonLayout",
|
|
484
|
+
publicName: "buttonLayout",
|
|
485
|
+
isSignal: true,
|
|
486
|
+
isRequired: false,
|
|
487
|
+
transformFunction: null
|
|
488
|
+
},
|
|
489
|
+
incrementIcon: {
|
|
490
|
+
classPropertyName: "incrementIcon",
|
|
491
|
+
publicName: "incrementIcon",
|
|
492
|
+
isSignal: true,
|
|
493
|
+
isRequired: false,
|
|
494
|
+
transformFunction: null
|
|
495
|
+
},
|
|
496
|
+
decrementIcon: {
|
|
497
|
+
classPropertyName: "decrementIcon",
|
|
498
|
+
publicName: "decrementIcon",
|
|
499
|
+
isSignal: true,
|
|
500
|
+
isRequired: false,
|
|
501
|
+
transformFunction: null
|
|
502
|
+
},
|
|
503
|
+
allowEmpty: {
|
|
504
|
+
classPropertyName: "allowEmpty",
|
|
505
|
+
publicName: "allowEmpty",
|
|
506
|
+
isSignal: true,
|
|
507
|
+
isRequired: false,
|
|
508
|
+
transformFunction: null
|
|
509
|
+
},
|
|
510
|
+
showClear: {
|
|
511
|
+
classPropertyName: "showClear",
|
|
512
|
+
publicName: "showClear",
|
|
513
|
+
isSignal: true,
|
|
514
|
+
isRequired: false,
|
|
515
|
+
transformFunction: null
|
|
516
|
+
},
|
|
517
|
+
placeholder: {
|
|
518
|
+
classPropertyName: "placeholder",
|
|
519
|
+
publicName: "placeholder",
|
|
520
|
+
isSignal: true,
|
|
521
|
+
isRequired: false,
|
|
522
|
+
transformFunction: null
|
|
523
|
+
},
|
|
524
|
+
size: {
|
|
525
|
+
classPropertyName: "size",
|
|
526
|
+
publicName: "size",
|
|
527
|
+
isSignal: true,
|
|
528
|
+
isRequired: false,
|
|
529
|
+
transformFunction: null
|
|
530
|
+
},
|
|
531
|
+
variant: {
|
|
532
|
+
classPropertyName: "variant",
|
|
533
|
+
publicName: "variant",
|
|
534
|
+
isSignal: true,
|
|
535
|
+
isRequired: false,
|
|
536
|
+
transformFunction: null
|
|
537
|
+
},
|
|
538
|
+
fluid: {
|
|
539
|
+
classPropertyName: "fluid",
|
|
540
|
+
publicName: "fluid",
|
|
541
|
+
isSignal: true,
|
|
542
|
+
isRequired: false,
|
|
543
|
+
transformFunction: null
|
|
544
|
+
},
|
|
545
|
+
invalid: {
|
|
546
|
+
classPropertyName: "invalid",
|
|
547
|
+
publicName: "invalid",
|
|
548
|
+
isSignal: true,
|
|
549
|
+
isRequired: false,
|
|
550
|
+
transformFunction: null
|
|
551
|
+
},
|
|
552
|
+
disabledInput: {
|
|
553
|
+
classPropertyName: "disabledInput",
|
|
554
|
+
publicName: "disabled",
|
|
555
|
+
isSignal: true,
|
|
556
|
+
isRequired: false,
|
|
557
|
+
transformFunction: null
|
|
558
|
+
},
|
|
559
|
+
readonly: {
|
|
560
|
+
classPropertyName: "readonly",
|
|
561
|
+
publicName: "readonly",
|
|
562
|
+
isSignal: true,
|
|
563
|
+
isRequired: false,
|
|
564
|
+
transformFunction: null
|
|
565
|
+
},
|
|
566
|
+
required: {
|
|
567
|
+
classPropertyName: "required",
|
|
568
|
+
publicName: "required",
|
|
569
|
+
isSignal: true,
|
|
570
|
+
isRequired: false,
|
|
571
|
+
transformFunction: null
|
|
572
|
+
},
|
|
573
|
+
name: {
|
|
574
|
+
classPropertyName: "name",
|
|
575
|
+
publicName: "name",
|
|
576
|
+
isSignal: true,
|
|
577
|
+
isRequired: false,
|
|
578
|
+
transformFunction: null
|
|
579
|
+
},
|
|
580
|
+
inputId: {
|
|
581
|
+
classPropertyName: "inputId",
|
|
582
|
+
publicName: "inputId",
|
|
583
|
+
isSignal: true,
|
|
584
|
+
isRequired: false,
|
|
585
|
+
transformFunction: null
|
|
586
|
+
},
|
|
587
|
+
ariaLabel: {
|
|
588
|
+
classPropertyName: "ariaLabel",
|
|
589
|
+
publicName: "ariaLabel",
|
|
590
|
+
isSignal: true,
|
|
591
|
+
isRequired: false,
|
|
592
|
+
transformFunction: null
|
|
593
|
+
},
|
|
594
|
+
ariaLabelledBy: {
|
|
595
|
+
classPropertyName: "ariaLabelledBy",
|
|
596
|
+
publicName: "ariaLabelledBy",
|
|
597
|
+
isSignal: true,
|
|
598
|
+
isRequired: false,
|
|
599
|
+
transformFunction: null
|
|
600
|
+
},
|
|
601
|
+
tabindex: {
|
|
602
|
+
classPropertyName: "tabindex",
|
|
603
|
+
publicName: "tabindex",
|
|
604
|
+
isSignal: true,
|
|
605
|
+
isRequired: false,
|
|
606
|
+
transformFunction: null
|
|
607
|
+
},
|
|
608
|
+
dt: {
|
|
609
|
+
classPropertyName: "dt",
|
|
610
|
+
publicName: "dt",
|
|
611
|
+
isSignal: true,
|
|
612
|
+
isRequired: false,
|
|
613
|
+
transformFunction: null
|
|
614
|
+
},
|
|
615
|
+
pt: {
|
|
616
|
+
classPropertyName: "pt",
|
|
617
|
+
publicName: "pt",
|
|
618
|
+
isSignal: true,
|
|
619
|
+
isRequired: false,
|
|
620
|
+
transformFunction: null
|
|
621
|
+
},
|
|
622
|
+
ptOptions: {
|
|
623
|
+
classPropertyName: "ptOptions",
|
|
624
|
+
publicName: "ptOptions",
|
|
625
|
+
isSignal: true,
|
|
626
|
+
isRequired: false,
|
|
627
|
+
transformFunction: null
|
|
628
|
+
},
|
|
629
|
+
unstyled: {
|
|
630
|
+
classPropertyName: "unstyled",
|
|
631
|
+
publicName: "unstyled",
|
|
632
|
+
isSignal: true,
|
|
633
|
+
isRequired: false,
|
|
634
|
+
transformFunction: null
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
outputs: {
|
|
638
|
+
changed: "changed",
|
|
639
|
+
cleared: "cleared"
|
|
640
|
+
},
|
|
641
|
+
host: {
|
|
642
|
+
properties: {
|
|
643
|
+
"class": "passThrough().root?.class",
|
|
644
|
+
"style": "hostStyle()",
|
|
645
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
646
|
+
"attr.data-layout": "showButtons() ? buttonLayout() : null",
|
|
647
|
+
"attr.data-size": "size()",
|
|
648
|
+
"class.tx-input-number--fluid": "isFluid()",
|
|
649
|
+
"class.tx-input-number--filled": "value() !== null",
|
|
650
|
+
"class.tx-input-number--invalid": "isInvalid()",
|
|
651
|
+
"class.tx-input-number--disabled": "isDisabled()"
|
|
652
|
+
},
|
|
653
|
+
classAttribute: "tx-input-number"
|
|
654
|
+
},
|
|
655
|
+
providers: [{
|
|
656
|
+
provide: NG_VALUE_ACCESSOR,
|
|
657
|
+
useExisting: forwardRef(() => TxInputNumber),
|
|
658
|
+
multi: true
|
|
659
|
+
}],
|
|
660
|
+
viewQueries: [{
|
|
661
|
+
propertyName: "inputRef",
|
|
662
|
+
first: true,
|
|
663
|
+
predicate: ["input"],
|
|
664
|
+
descendants: true,
|
|
665
|
+
isSignal: true
|
|
666
|
+
}],
|
|
667
|
+
usesInheritance: true,
|
|
668
|
+
ngImport: i0,
|
|
669
|
+
template: "@if (showButtons() && buttonLayout() !== 'stacked') {\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__decrement\"\n [class]=\"passThrough().decrement?.class\"\n [style]=\"passThrough().decrement?.style\"\n [attr.aria-label]=\"translations().decrement\"\n [disabled]=\"!canDecrement()\"\n (pointerdown)=\"startRepeat(-1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (decrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"decrementIconName().className\"></span>\n }\n </button>\n}\n<input\n #input\n txInput\n type=\"text\"\n role=\"spinbutton\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n class=\"tx-input-number__input\"\n [class]=\"passThrough().input?.class\"\n [style]=\"passThrough().input?.style\"\n [id]=\"resolvedId()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [fluid]=\"true\"\n [invalid]=\"isInvalid()\"\n [unstyled]=\"isUnstyled()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.placeholder]=\"placeholder() ?? null\"\n [attr.name]=\"name() ?? null\"\n [attr.tabindex]=\"tabindex() ?? null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() ?? null\"\n [attr.aria-valuenow]=\"value() ?? null\"\n [attr.aria-valuemin]=\"min() ?? null\"\n [attr.aria-valuemax]=\"max() ?? null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur($event)\"\n/>\n@if (showClear() && value() !== null && isEditable()) {\n <button\n type=\"button\"\n class=\"tx-input-number__clear\"\n [class]=\"passThrough().clear?.class\"\n [style]=\"passThrough().clear?.style\"\n [attr.aria-label]=\"translations().clear\"\n [title]=\"translations().clear\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"clear($event)\"\n >\n <tx-icon [name]=\"'times'\" />\n </button>\n}\n@if (showButtons()) {\n @if (buttonLayout() === 'stacked') {\n <span class=\"tx-input-number__stack\">\n <ng-container [ngTemplateOutlet]=\"increment\" />\n <ng-container [ngTemplateOutlet]=\"decrement\" />\n </span>\n } @else {\n <ng-container [ngTemplateOutlet]=\"increment\" />\n }\n}\n\n<ng-template #increment>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__increment\"\n [class]=\"passThrough().increment?.class\"\n [style]=\"passThrough().increment?.style\"\n [attr.aria-label]=\"translations().increment\"\n [disabled]=\"!canIncrement()\"\n (pointerdown)=\"startRepeat(1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (incrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"incrementIconName().className\"></span>\n }\n </button>\n</ng-template>\n<ng-template #decrement>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__decrement\"\n [class]=\"passThrough().decrement?.class\"\n [style]=\"passThrough().decrement?.style\"\n [attr.aria-label]=\"translations().decrement\"\n [disabled]=\"!canDecrement()\"\n (pointerdown)=\"startRepeat(-1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (decrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"decrementIconName().className\"></span>\n }\n </button>\n</ng-template>\n",
|
|
670
|
+
styles: [":host{position:relative;display:inline-flex;align-items:stretch;vertical-align:top}:host(.tx-input-number--fluid){display:flex;width:100%}.tx-input-number__input{flex:1 1 auto;min-width:0;font-variant-numeric:tabular-nums}:host([data-styled]){--_inset: 0px}:host([data-styled][data-layout=stacked]){--_inset: var(--tx-input-number-button-stacked-width)}:host([data-styled]) .tx-input-number__input{--tx-field-inset-end: calc(var(--_inset) + var(--_clear, 0px))}:host([data-styled]:has(.tx-input-number__clear)){--_clear: 28px}.tx-input-number__clear{position:absolute;top:50%;right:calc(var(--_inset, 0px) + 8px);transform:translateY(-50%)}:host([data-styled]) .tx-input-number__clear{display:grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tx-radius-sm);background:transparent;color:var(--tx-form-field-icon-color);font-size:var(--tx-form-field-font-size);cursor:pointer;pointer-events:auto;transition:background-color var(--tx-form-field-transition-duration),color var(--tx-form-field-transition-duration)}:host([data-styled]) .tx-input-number__clear:hover{background:var(--tx-surface-hover);color:var(--tx-form-field-color)}:host([data-styled]) .tx-input-number__clear:focus-visible{outline:2px solid var(--tx-focus-ring-color);outline-offset:1px}:host([data-styled]) .tx-input-number__button{display:grid;place-items:center;box-sizing:border-box;width:var(--tx-input-number-button-width);padding:0;border:1px solid var(--tx-input-number-button-border-color);background:var(--tx-input-number-button-background);color:var(--tx-input-number-button-color);font-size:var(--tx-input-number-button-icon-size);cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;transition:background-color var(--tx-form-field-transition-duration),color var(--tx-form-field-transition-duration)}:host([data-styled]) .tx-input-number__button:hover:enabled{background:var(--tx-input-number-button-hover-background);color:var(--tx-input-number-button-hover-color)}:host([data-styled]) .tx-input-number__button:active:enabled{background:var(--tx-input-number-button-active-background)}:host([data-styled]) .tx-input-number__button:disabled{cursor:not-allowed;opacity:.5}.tx-input-number__stack{position:absolute;top:1px;right:1px;bottom:1px;display:flex;flex-direction:column;overflow:hidden}:host([data-styled]) .tx-input-number__stack{width:var(--tx-input-number-button-stacked-width);border-radius:0 calc(var(--tx-form-field-border-radius) - 1px) calc(var(--tx-form-field-border-radius) - 1px) 0}:host([data-styled]) .tx-input-number__stack .tx-input-number__button{flex:1 1 0;width:100%;min-height:0;border-width:0 0 0 1px}:host([data-styled]) .tx-input-number__stack .tx-input-number__increment{border-bottom-width:1px}:host([data-styled][data-layout=horizontal]) .tx-input-number__input{border-radius:0}:host([data-styled][data-layout=horizontal]) .tx-input-number__decrement{border-right:none;border-radius:var(--tx-form-field-border-radius) 0 0 var(--tx-form-field-border-radius)}:host([data-styled][data-layout=horizontal]) .tx-input-number__increment{border-left:none;border-radius:0 var(--tx-form-field-border-radius) var(--tx-form-field-border-radius) 0}:host([data-layout=vertical]){flex-direction:column}:host([data-styled][data-layout=vertical]) .tx-input-number__input{border-radius:0;text-align:center}:host([data-styled][data-layout=vertical]) .tx-input-number__button{width:auto;height:var(--tx-input-number-button-width)}:host([data-styled][data-layout=vertical]) .tx-input-number__increment{order:-1;border-bottom:none;border-radius:var(--tx-form-field-border-radius) var(--tx-form-field-border-radius) 0 0}:host([data-styled][data-layout=vertical]) .tx-input-number__decrement{order:1;border-top:none;border-radius:0 0 var(--tx-form-field-border-radius) var(--tx-form-field-border-radius)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-input-number__button{transition:none}}\n"],
|
|
671
|
+
dependencies: [
|
|
672
|
+
{
|
|
673
|
+
kind: "directive",
|
|
674
|
+
type: TxInput,
|
|
675
|
+
selector: "input[txInput], textarea[txInput]",
|
|
676
|
+
inputs: [
|
|
677
|
+
"invalid",
|
|
678
|
+
"size",
|
|
679
|
+
"variant",
|
|
680
|
+
"fluid",
|
|
681
|
+
"dt",
|
|
682
|
+
"pt",
|
|
683
|
+
"ptOptions",
|
|
684
|
+
"unstyled"
|
|
685
|
+
]
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
kind: "component",
|
|
689
|
+
type: TxIcon,
|
|
690
|
+
selector: "tx-icon",
|
|
691
|
+
inputs: ["name"]
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
kind: "directive",
|
|
695
|
+
type: NgTemplateOutlet,
|
|
696
|
+
selector: "[ngTemplateOutlet]",
|
|
697
|
+
inputs: [
|
|
698
|
+
"ngTemplateOutletContext",
|
|
699
|
+
"ngTemplateOutlet",
|
|
700
|
+
"ngTemplateOutletInjector"
|
|
701
|
+
]
|
|
702
|
+
}
|
|
703
|
+
],
|
|
704
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
708
|
+
minVersion: "12.0.0",
|
|
709
|
+
version: "22.2.3",
|
|
710
|
+
ngImport: i0,
|
|
711
|
+
type: TxInputNumber,
|
|
712
|
+
decorators: [{
|
|
713
|
+
type: Component,
|
|
714
|
+
args: [{
|
|
715
|
+
selector: "tx-input-number",
|
|
716
|
+
imports: [
|
|
717
|
+
TxInput,
|
|
718
|
+
TxIcon,
|
|
719
|
+
NgTemplateOutlet
|
|
720
|
+
],
|
|
721
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
722
|
+
providers: [{
|
|
723
|
+
provide: NG_VALUE_ACCESSOR,
|
|
724
|
+
useExisting: forwardRef(() => TxInputNumber),
|
|
725
|
+
multi: true
|
|
726
|
+
}],
|
|
727
|
+
host: {
|
|
728
|
+
class: "tx-input-number",
|
|
729
|
+
"[class]": "passThrough().root?.class",
|
|
730
|
+
"[style]": "hostStyle()",
|
|
731
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
732
|
+
"[attr.data-layout]": "showButtons() ? buttonLayout() : null",
|
|
733
|
+
"[attr.data-size]": "size()",
|
|
734
|
+
"[class.tx-input-number--fluid]": "isFluid()",
|
|
735
|
+
"[class.tx-input-number--filled]": "value() !== null",
|
|
736
|
+
"[class.tx-input-number--invalid]": "isInvalid()",
|
|
737
|
+
"[class.tx-input-number--disabled]": "isDisabled()"
|
|
738
|
+
},
|
|
739
|
+
template: "@if (showButtons() && buttonLayout() !== 'stacked') {\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__decrement\"\n [class]=\"passThrough().decrement?.class\"\n [style]=\"passThrough().decrement?.style\"\n [attr.aria-label]=\"translations().decrement\"\n [disabled]=\"!canDecrement()\"\n (pointerdown)=\"startRepeat(-1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (decrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"decrementIconName().className\"></span>\n }\n </button>\n}\n<input\n #input\n txInput\n type=\"text\"\n role=\"spinbutton\"\n inputmode=\"decimal\"\n autocomplete=\"off\"\n class=\"tx-input-number__input\"\n [class]=\"passThrough().input?.class\"\n [style]=\"passThrough().input?.style\"\n [id]=\"resolvedId()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [fluid]=\"true\"\n [invalid]=\"isInvalid()\"\n [unstyled]=\"isUnstyled()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.placeholder]=\"placeholder() ?? null\"\n [attr.name]=\"name() ?? null\"\n [attr.tabindex]=\"tabindex() ?? null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() ?? null\"\n [attr.aria-valuenow]=\"value() ?? null\"\n [attr.aria-valuemin]=\"min() ?? null\"\n [attr.aria-valuemax]=\"max() ?? null\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur($event)\"\n/>\n@if (showClear() && value() !== null && isEditable()) {\n <button\n type=\"button\"\n class=\"tx-input-number__clear\"\n [class]=\"passThrough().clear?.class\"\n [style]=\"passThrough().clear?.style\"\n [attr.aria-label]=\"translations().clear\"\n [title]=\"translations().clear\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"clear($event)\"\n >\n <tx-icon [name]=\"'times'\" />\n </button>\n}\n@if (showButtons()) {\n @if (buttonLayout() === 'stacked') {\n <span class=\"tx-input-number__stack\">\n <ng-container [ngTemplateOutlet]=\"increment\" />\n <ng-container [ngTemplateOutlet]=\"decrement\" />\n </span>\n } @else {\n <ng-container [ngTemplateOutlet]=\"increment\" />\n }\n}\n\n<ng-template #increment>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__increment\"\n [class]=\"passThrough().increment?.class\"\n [style]=\"passThrough().increment?.style\"\n [attr.aria-label]=\"translations().increment\"\n [disabled]=\"!canIncrement()\"\n (pointerdown)=\"startRepeat(1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (incrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"incrementIconName().className\"></span>\n }\n </button>\n</ng-template>\n<ng-template #decrement>\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"tx-input-number__button tx-input-number__decrement\"\n [class]=\"passThrough().decrement?.class\"\n [style]=\"passThrough().decrement?.style\"\n [attr.aria-label]=\"translations().decrement\"\n [disabled]=\"!canDecrement()\"\n (pointerdown)=\"startRepeat(-1, $event)\"\n (pointerup)=\"stopRepeat()\"\n (pointerleave)=\"stopRepeat()\"\n (pointercancel)=\"stopRepeat()\"\n >\n @if (decrementIconName().name; as name) {\n <tx-icon [name]=\"name\" />\n } @else {\n <span [class]=\"decrementIconName().className\"></span>\n }\n </button>\n</ng-template>\n",
|
|
740
|
+
styles: [":host{position:relative;display:inline-flex;align-items:stretch;vertical-align:top}:host(.tx-input-number--fluid){display:flex;width:100%}.tx-input-number__input{flex:1 1 auto;min-width:0;font-variant-numeric:tabular-nums}:host([data-styled]){--_inset: 0px}:host([data-styled][data-layout=stacked]){--_inset: var(--tx-input-number-button-stacked-width)}:host([data-styled]) .tx-input-number__input{--tx-field-inset-end: calc(var(--_inset) + var(--_clear, 0px))}:host([data-styled]:has(.tx-input-number__clear)){--_clear: 28px}.tx-input-number__clear{position:absolute;top:50%;right:calc(var(--_inset, 0px) + 8px);transform:translateY(-50%)}:host([data-styled]) .tx-input-number__clear{display:grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tx-radius-sm);background:transparent;color:var(--tx-form-field-icon-color);font-size:var(--tx-form-field-font-size);cursor:pointer;pointer-events:auto;transition:background-color var(--tx-form-field-transition-duration),color var(--tx-form-field-transition-duration)}:host([data-styled]) .tx-input-number__clear:hover{background:var(--tx-surface-hover);color:var(--tx-form-field-color)}:host([data-styled]) .tx-input-number__clear:focus-visible{outline:2px solid var(--tx-focus-ring-color);outline-offset:1px}:host([data-styled]) .tx-input-number__button{display:grid;place-items:center;box-sizing:border-box;width:var(--tx-input-number-button-width);padding:0;border:1px solid var(--tx-input-number-button-border-color);background:var(--tx-input-number-button-background);color:var(--tx-input-number-button-color);font-size:var(--tx-input-number-button-icon-size);cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;transition:background-color var(--tx-form-field-transition-duration),color var(--tx-form-field-transition-duration)}:host([data-styled]) .tx-input-number__button:hover:enabled{background:var(--tx-input-number-button-hover-background);color:var(--tx-input-number-button-hover-color)}:host([data-styled]) .tx-input-number__button:active:enabled{background:var(--tx-input-number-button-active-background)}:host([data-styled]) .tx-input-number__button:disabled{cursor:not-allowed;opacity:.5}.tx-input-number__stack{position:absolute;top:1px;right:1px;bottom:1px;display:flex;flex-direction:column;overflow:hidden}:host([data-styled]) .tx-input-number__stack{width:var(--tx-input-number-button-stacked-width);border-radius:0 calc(var(--tx-form-field-border-radius) - 1px) calc(var(--tx-form-field-border-radius) - 1px) 0}:host([data-styled]) .tx-input-number__stack .tx-input-number__button{flex:1 1 0;width:100%;min-height:0;border-width:0 0 0 1px}:host([data-styled]) .tx-input-number__stack .tx-input-number__increment{border-bottom-width:1px}:host([data-styled][data-layout=horizontal]) .tx-input-number__input{border-radius:0}:host([data-styled][data-layout=horizontal]) .tx-input-number__decrement{border-right:none;border-radius:var(--tx-form-field-border-radius) 0 0 var(--tx-form-field-border-radius)}:host([data-styled][data-layout=horizontal]) .tx-input-number__increment{border-left:none;border-radius:0 var(--tx-form-field-border-radius) var(--tx-form-field-border-radius) 0}:host([data-layout=vertical]){flex-direction:column}:host([data-styled][data-layout=vertical]) .tx-input-number__input{border-radius:0;text-align:center}:host([data-styled][data-layout=vertical]) .tx-input-number__button{width:auto;height:var(--tx-input-number-button-width)}:host([data-styled][data-layout=vertical]) .tx-input-number__increment{order:-1;border-bottom:none;border-radius:var(--tx-form-field-border-radius) var(--tx-form-field-border-radius) 0 0}:host([data-styled][data-layout=vertical]) .tx-input-number__decrement{order:1;border-top:none;border-radius:0 0 var(--tx-form-field-border-radius) var(--tx-form-field-border-radius)}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-input-number__button{transition:none}}\n"]
|
|
741
|
+
}]
|
|
742
|
+
}],
|
|
743
|
+
ctorParameters: () => [],
|
|
744
|
+
propDecorators: {
|
|
745
|
+
mode: [{
|
|
746
|
+
type: i0.Input,
|
|
747
|
+
args: [{
|
|
748
|
+
isSignal: true,
|
|
749
|
+
alias: "mode",
|
|
750
|
+
required: false
|
|
751
|
+
}]
|
|
752
|
+
}],
|
|
753
|
+
currency: [{
|
|
754
|
+
type: i0.Input,
|
|
755
|
+
args: [{
|
|
756
|
+
isSignal: true,
|
|
757
|
+
alias: "currency",
|
|
758
|
+
required: false
|
|
759
|
+
}]
|
|
760
|
+
}],
|
|
761
|
+
currencyDisplay: [{
|
|
762
|
+
type: i0.Input,
|
|
763
|
+
args: [{
|
|
764
|
+
isSignal: true,
|
|
765
|
+
alias: "currencyDisplay",
|
|
766
|
+
required: false
|
|
767
|
+
}]
|
|
768
|
+
}],
|
|
769
|
+
locale: [{
|
|
770
|
+
type: i0.Input,
|
|
771
|
+
args: [{
|
|
772
|
+
isSignal: true,
|
|
773
|
+
alias: "locale",
|
|
774
|
+
required: false
|
|
775
|
+
}]
|
|
776
|
+
}],
|
|
777
|
+
useGrouping: [{
|
|
778
|
+
type: i0.Input,
|
|
779
|
+
args: [{
|
|
780
|
+
isSignal: true,
|
|
781
|
+
alias: "useGrouping",
|
|
782
|
+
required: false
|
|
783
|
+
}]
|
|
784
|
+
}],
|
|
785
|
+
minFractionDigits: [{
|
|
786
|
+
type: i0.Input,
|
|
787
|
+
args: [{
|
|
788
|
+
isSignal: true,
|
|
789
|
+
alias: "minFractionDigits",
|
|
790
|
+
required: false
|
|
791
|
+
}]
|
|
792
|
+
}],
|
|
793
|
+
maxFractionDigits: [{
|
|
794
|
+
type: i0.Input,
|
|
795
|
+
args: [{
|
|
796
|
+
isSignal: true,
|
|
797
|
+
alias: "maxFractionDigits",
|
|
798
|
+
required: false
|
|
799
|
+
}]
|
|
800
|
+
}],
|
|
801
|
+
prefix: [{
|
|
802
|
+
type: i0.Input,
|
|
803
|
+
args: [{
|
|
804
|
+
isSignal: true,
|
|
805
|
+
alias: "prefix",
|
|
806
|
+
required: false
|
|
807
|
+
}]
|
|
808
|
+
}],
|
|
809
|
+
suffix: [{
|
|
810
|
+
type: i0.Input,
|
|
811
|
+
args: [{
|
|
812
|
+
isSignal: true,
|
|
813
|
+
alias: "suffix",
|
|
814
|
+
required: false
|
|
815
|
+
}]
|
|
816
|
+
}],
|
|
817
|
+
min: [{
|
|
818
|
+
type: i0.Input,
|
|
819
|
+
args: [{
|
|
820
|
+
isSignal: true,
|
|
821
|
+
alias: "min",
|
|
822
|
+
required: false
|
|
823
|
+
}]
|
|
824
|
+
}],
|
|
825
|
+
max: [{
|
|
826
|
+
type: i0.Input,
|
|
827
|
+
args: [{
|
|
828
|
+
isSignal: true,
|
|
829
|
+
alias: "max",
|
|
830
|
+
required: false
|
|
831
|
+
}]
|
|
832
|
+
}],
|
|
833
|
+
step: [{
|
|
834
|
+
type: i0.Input,
|
|
835
|
+
args: [{
|
|
836
|
+
isSignal: true,
|
|
837
|
+
alias: "step",
|
|
838
|
+
required: false
|
|
839
|
+
}]
|
|
840
|
+
}],
|
|
841
|
+
showButtons: [{
|
|
842
|
+
type: i0.Input,
|
|
843
|
+
args: [{
|
|
844
|
+
isSignal: true,
|
|
845
|
+
alias: "showButtons",
|
|
846
|
+
required: false
|
|
847
|
+
}]
|
|
848
|
+
}],
|
|
849
|
+
buttonLayout: [{
|
|
850
|
+
type: i0.Input,
|
|
851
|
+
args: [{
|
|
852
|
+
isSignal: true,
|
|
853
|
+
alias: "buttonLayout",
|
|
854
|
+
required: false
|
|
855
|
+
}]
|
|
856
|
+
}],
|
|
857
|
+
incrementIcon: [{
|
|
858
|
+
type: i0.Input,
|
|
859
|
+
args: [{
|
|
860
|
+
isSignal: true,
|
|
861
|
+
alias: "incrementIcon",
|
|
862
|
+
required: false
|
|
863
|
+
}]
|
|
864
|
+
}],
|
|
865
|
+
decrementIcon: [{
|
|
866
|
+
type: i0.Input,
|
|
867
|
+
args: [{
|
|
868
|
+
isSignal: true,
|
|
869
|
+
alias: "decrementIcon",
|
|
870
|
+
required: false
|
|
871
|
+
}]
|
|
872
|
+
}],
|
|
873
|
+
allowEmpty: [{
|
|
874
|
+
type: i0.Input,
|
|
875
|
+
args: [{
|
|
876
|
+
isSignal: true,
|
|
877
|
+
alias: "allowEmpty",
|
|
878
|
+
required: false
|
|
879
|
+
}]
|
|
880
|
+
}],
|
|
881
|
+
showClear: [{
|
|
882
|
+
type: i0.Input,
|
|
883
|
+
args: [{
|
|
884
|
+
isSignal: true,
|
|
885
|
+
alias: "showClear",
|
|
886
|
+
required: false
|
|
887
|
+
}]
|
|
888
|
+
}],
|
|
889
|
+
placeholder: [{
|
|
890
|
+
type: i0.Input,
|
|
891
|
+
args: [{
|
|
892
|
+
isSignal: true,
|
|
893
|
+
alias: "placeholder",
|
|
894
|
+
required: false
|
|
895
|
+
}]
|
|
896
|
+
}],
|
|
897
|
+
size: [{
|
|
898
|
+
type: i0.Input,
|
|
899
|
+
args: [{
|
|
900
|
+
isSignal: true,
|
|
901
|
+
alias: "size",
|
|
902
|
+
required: false
|
|
903
|
+
}]
|
|
904
|
+
}],
|
|
905
|
+
variant: [{
|
|
906
|
+
type: i0.Input,
|
|
907
|
+
args: [{
|
|
908
|
+
isSignal: true,
|
|
909
|
+
alias: "variant",
|
|
910
|
+
required: false
|
|
911
|
+
}]
|
|
912
|
+
}],
|
|
913
|
+
fluid: [{
|
|
914
|
+
type: i0.Input,
|
|
915
|
+
args: [{
|
|
916
|
+
isSignal: true,
|
|
917
|
+
alias: "fluid",
|
|
918
|
+
required: false
|
|
919
|
+
}]
|
|
920
|
+
}],
|
|
921
|
+
invalid: [{
|
|
922
|
+
type: i0.Input,
|
|
923
|
+
args: [{
|
|
924
|
+
isSignal: true,
|
|
925
|
+
alias: "invalid",
|
|
926
|
+
required: false
|
|
927
|
+
}]
|
|
928
|
+
}],
|
|
929
|
+
disabledInput: [{
|
|
930
|
+
type: i0.Input,
|
|
931
|
+
args: [{
|
|
932
|
+
isSignal: true,
|
|
933
|
+
alias: "disabled",
|
|
934
|
+
required: false
|
|
935
|
+
}]
|
|
936
|
+
}],
|
|
937
|
+
readonly: [{
|
|
938
|
+
type: i0.Input,
|
|
939
|
+
args: [{
|
|
940
|
+
isSignal: true,
|
|
941
|
+
alias: "readonly",
|
|
942
|
+
required: false
|
|
943
|
+
}]
|
|
944
|
+
}],
|
|
945
|
+
required: [{
|
|
946
|
+
type: i0.Input,
|
|
947
|
+
args: [{
|
|
948
|
+
isSignal: true,
|
|
949
|
+
alias: "required",
|
|
950
|
+
required: false
|
|
951
|
+
}]
|
|
952
|
+
}],
|
|
953
|
+
name: [{
|
|
954
|
+
type: i0.Input,
|
|
955
|
+
args: [{
|
|
956
|
+
isSignal: true,
|
|
957
|
+
alias: "name",
|
|
958
|
+
required: false
|
|
959
|
+
}]
|
|
960
|
+
}],
|
|
961
|
+
inputId: [{
|
|
962
|
+
type: i0.Input,
|
|
963
|
+
args: [{
|
|
964
|
+
isSignal: true,
|
|
965
|
+
alias: "inputId",
|
|
966
|
+
required: false
|
|
967
|
+
}]
|
|
968
|
+
}],
|
|
969
|
+
ariaLabel: [{
|
|
970
|
+
type: i0.Input,
|
|
971
|
+
args: [{
|
|
972
|
+
isSignal: true,
|
|
973
|
+
alias: "ariaLabel",
|
|
974
|
+
required: false
|
|
975
|
+
}]
|
|
976
|
+
}],
|
|
977
|
+
ariaLabelledBy: [{
|
|
978
|
+
type: i0.Input,
|
|
979
|
+
args: [{
|
|
980
|
+
isSignal: true,
|
|
981
|
+
alias: "ariaLabelledBy",
|
|
982
|
+
required: false
|
|
983
|
+
}]
|
|
984
|
+
}],
|
|
985
|
+
tabindex: [{
|
|
986
|
+
type: i0.Input,
|
|
987
|
+
args: [{
|
|
988
|
+
isSignal: true,
|
|
989
|
+
alias: "tabindex",
|
|
990
|
+
required: false
|
|
991
|
+
}]
|
|
992
|
+
}],
|
|
993
|
+
dt: [{
|
|
994
|
+
type: i0.Input,
|
|
995
|
+
args: [{
|
|
996
|
+
isSignal: true,
|
|
997
|
+
alias: "dt",
|
|
998
|
+
required: false
|
|
999
|
+
}]
|
|
1000
|
+
}],
|
|
1001
|
+
pt: [{
|
|
1002
|
+
type: i0.Input,
|
|
1003
|
+
args: [{
|
|
1004
|
+
isSignal: true,
|
|
1005
|
+
alias: "pt",
|
|
1006
|
+
required: false
|
|
1007
|
+
}]
|
|
1008
|
+
}],
|
|
1009
|
+
ptOptions: [{
|
|
1010
|
+
type: i0.Input,
|
|
1011
|
+
args: [{
|
|
1012
|
+
isSignal: true,
|
|
1013
|
+
alias: "ptOptions",
|
|
1014
|
+
required: false
|
|
1015
|
+
}]
|
|
1016
|
+
}],
|
|
1017
|
+
unstyled: [{
|
|
1018
|
+
type: i0.Input,
|
|
1019
|
+
args: [{
|
|
1020
|
+
isSignal: true,
|
|
1021
|
+
alias: "unstyled",
|
|
1022
|
+
required: false
|
|
1023
|
+
}]
|
|
1024
|
+
}],
|
|
1025
|
+
changed: [{
|
|
1026
|
+
type: i0.Output,
|
|
1027
|
+
args: ["changed"]
|
|
1028
|
+
}],
|
|
1029
|
+
cleared: [{
|
|
1030
|
+
type: i0.Output,
|
|
1031
|
+
args: ["cleared"]
|
|
1032
|
+
}],
|
|
1033
|
+
inputRef: [{
|
|
1034
|
+
type: i0.ViewChild,
|
|
1035
|
+
args: ["input", { isSignal: true }]
|
|
1036
|
+
}]
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
function decimals(value) {
|
|
1040
|
+
const text = String(value);
|
|
1041
|
+
return text.includes(".") ? text.split(".")[1].length : 0;
|
|
1042
|
+
}
|
|
1043
|
+
export { TxInputNumber, TxNumberFormat };
|
|
1044
|
+
|
|
1045
|
+
//# sourceMappingURL=tectra-ng-ui-input-number.mjs.map
|