@koobiq/components 18.2.1 → 18.4.0
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/code-block/_code-block-theme.scss +1 -1
- package/code-block/actionbar.component.d.ts +14 -4
- package/code-block/code-block-tokens.scss +4 -4
- package/code-block/code-block.component.d.ts +12 -15
- package/code-block/code-block.types.d.ts +12 -0
- package/core/common-behaviors/color.d.ts +1 -1
- package/core/common-behaviors/error-state.d.ts +1 -1
- package/core/error/error-state-matcher.d.ts +26 -0
- package/core/form-field/form-field-ref.d.ts +7 -0
- package/core/forms/index.d.ts +1 -0
- package/core/forms/validators.d.ts +107 -0
- package/core/locales/en-US.d.ts +13 -0
- package/core/locales/es-LA.d.ts +13 -0
- package/core/locales/fa-IR.d.ts +13 -0
- package/core/locales/locale-service.d.ts +89 -0
- package/core/locales/pt-BR.d.ts +13 -0
- package/core/locales/ru-RU.d.ts +13 -0
- package/core/locales/zh-CN.d.ts +13 -0
- package/core/public-api.d.ts +1 -2
- package/core/select/common.d.ts +2 -0
- package/core/services/theme.service.d.ts +2 -2
- package/core/styles/theming/_components-theming.scss +1 -1
- package/core/validation/validation.d.ts +1 -0
- package/datepicker/_datepicker-theme.scss +1 -1
- package/datepicker/datepicker-tokens.scss +2 -2
- package/dropdown/_dropdown-theme.scss +1 -1
- package/dropdown/dropdown-tokens.scss +1 -1
- package/esm2022/code-block/actionbar.component.mjs +35 -8
- package/esm2022/code-block/code-block.component.mjs +28 -19
- package/esm2022/code-block/code-block.types.mjs +5 -2
- package/esm2022/core/common-behaviors/color.mjs +2 -2
- package/esm2022/core/common-behaviors/error-state.mjs +1 -1
- package/esm2022/core/error/error-state-matcher.mjs +43 -0
- package/esm2022/core/form-field/form-field-ref.mjs +4 -1
- package/esm2022/core/forms/index.mjs +2 -1
- package/esm2022/core/forms/validators.mjs +163 -0
- package/esm2022/core/locales/en-US.mjs +14 -1
- package/esm2022/core/locales/es-LA.mjs +14 -1
- package/esm2022/core/locales/fa-IR.mjs +14 -1
- package/esm2022/core/locales/locale-service.mjs +30 -1
- package/esm2022/core/locales/pt-BR.mjs +14 -1
- package/esm2022/core/locales/ru-RU.mjs +14 -1
- package/esm2022/core/locales/zh-CN.mjs +14 -1
- package/esm2022/core/public-api.mjs +2 -3
- package/esm2022/core/select/common.mjs +7 -1
- package/esm2022/core/services/theme.service.mjs +3 -3
- package/esm2022/core/validation/validation.mjs +2 -1
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-header.component.mjs +5 -6
- package/esm2022/datepicker/datepicker.component.mjs +3 -3
- package/esm2022/dropdown/dropdown.component.mjs +3 -3
- package/esm2022/file-upload/file-upload.mjs +2 -3
- package/esm2022/file-upload/multiple-file-upload.component.mjs +57 -17
- package/esm2022/file-upload/single-file-upload.component.mjs +31 -19
- package/esm2022/form-field/form-field-control.mjs +1 -1
- package/esm2022/icon/icon.component.mjs +2 -2
- package/esm2022/icon/icon.module.mjs +1 -1
- package/esm2022/input/input-number.mjs +74 -80
- package/esm2022/markdown/markdown.values.mjs +4 -2
- package/esm2022/modal/modal.component.mjs +2 -2
- package/esm2022/navbar/navbar-item.component.mjs +2 -2
- package/esm2022/navbar/navbar.component.mjs +2 -2
- package/esm2022/navbar/vertical-navbar.component.mjs +2 -2
- package/esm2022/popover/popover-confirm.component.mjs +3 -3
- package/esm2022/popover/popover.component.mjs +3 -3
- package/esm2022/select/select.component.mjs +1 -1
- package/esm2022/select/select.module.mjs +3 -7
- package/esm2022/sidepanel/sidepanel-container.component.mjs +3 -3
- package/esm2022/timezone/timezone-select.component.mjs +20 -10
- package/esm2022/tooltip/tooltip.component.mjs +13 -1
- package/fesm2022/koobiq-components-code-block.mjs +58 -24
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +310 -16
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +10 -11
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-dropdown.mjs +2 -2
- package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-file-upload.mjs +76 -27
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-icon.mjs +1 -1
- package/fesm2022/koobiq-components-icon.mjs.map +1 -1
- package/fesm2022/koobiq-components-input.mjs +74 -80
- package/fesm2022/koobiq-components-input.mjs.map +1 -1
- package/fesm2022/koobiq-components-markdown.mjs +3 -1
- package/fesm2022/koobiq-components-markdown.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +2 -2
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +6 -6
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-popover.mjs +4 -4
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +3 -6
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs +2 -2
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +18 -8
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-tooltip.mjs +12 -0
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
- package/file-upload/_file-upload-theme.scss +6 -10
- package/file-upload/file-upload.d.ts +3 -0
- package/file-upload/file-upload.scss +6 -0
- package/file-upload/multiple-file-upload.component.d.ts +28 -5
- package/file-upload/multiple-file-upload.component.scss +0 -4
- package/file-upload/single-file-upload.component.d.ts +13 -4
- package/file-upload/single-file-upload.component.scss +0 -12
- package/form-field/form-field-control.d.ts +3 -2
- package/form-field/hint.scss +0 -3
- package/input/input-number.d.ts +24 -14
- package/markdown/markdown.values.d.ts +3 -0
- package/modal/_modal-theme.scss +1 -1
- package/modal/modal-tokens.scss +2 -2
- package/navbar/_navbar-theme.scss +1 -1
- package/navbar/navbar-tokens.scss +2 -8
- package/package.json +5 -4
- package/popover/_popover-theme.scss +2 -2
- package/popover/popover-tokens.scss +2 -2
- package/popover/popover.scss +2 -2
- package/schematics/ng-add/index.js +2 -2
- package/select/select.component.d.ts +1 -1
- package/select/select.module.d.ts +1 -2
- package/sidepanel/_sidepanel-theme.scss +1 -1
- package/sidepanel/sidepanel-tokens.scss +2 -2
- package/timezone/timezone-select.component.d.ts +5 -6
- package/tooltip/tooltip.component.d.ts +9 -0
- package/core/error/error-options.d.ts +0 -14
- package/core/label/label-options.d.ts +0 -13
- package/esm2022/core/error/error-options.mjs +0 -26
- package/esm2022/core/label/label-options.mjs +0 -4
|
@@ -22,7 +22,7 @@ class KbqIcon extends KbqIconMixinBase {
|
|
|
22
22
|
this.hasError = false;
|
|
23
23
|
this.name = 'KbqIcon';
|
|
24
24
|
this.updateState = () => {
|
|
25
|
-
this.hasError = this.formField.
|
|
25
|
+
this.hasError = this.formField.control?.errorState;
|
|
26
26
|
this.changeDetectorRef.markForCheck();
|
|
27
27
|
};
|
|
28
28
|
if (iconName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koobiq-components-icon.mjs","sources":["../../../packages/components/icon/icon.component.ts","../../../packages/components/icon/icon-button.component.ts","../../../packages/components/icon/icon-item.component.ts","../../../packages/components/icon/icon.module.ts","../../../packages/components/icon/koobiq-components-icon.ts"],"sourcesContent":["import {\n AfterContentInit,\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport {\n CanColor,\n CanColorCtor,\n KBQ_FORM_FIELD_REF,\n KbqComponentColors,\n KbqFormFieldRef,\n mixinColor\n} from '@koobiq/components/core';\n\n/** @docs-private */\nexport class KbqIconBase {\n constructor(public elementRef: ElementRef) {}\n}\n\n/** @docs-private */\nexport const KbqIconMixinBase: CanColorCtor & typeof KbqIconBase = mixinColor(\n KbqIconBase,\n KbqComponentColors.ContrastFade\n);\n\n@Component({\n standalone: true,\n selector: '[kbq-icon]',\n template: '<ng-content />',\n styleUrls: ['icon.scss', 'icon-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon',\n '[class.kbq-error]': 'color === \"error\" || hasError'\n }\n})\nexport class KbqIcon extends KbqIconMixinBase implements CanColor, AfterContentInit {\n @Input() small = false;\n @Input() autoColor = false;\n\n hasError: boolean = false;\n\n protected name = 'KbqIcon';\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon') protected iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) protected formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef\n ) {\n super(elementRef);\n\n if (iconName) {\n this.getHostElement().classList.add(iconName);\n }\n }\n\n getHostElement() {\n return this.elementRef.nativeElement;\n }\n\n updateMaxHeight() {\n if (this.name !== 'KbqIcon') {\n return;\n }\n\n const size = parseInt(this.iconName?.split('_')[1]);\n\n if (size) {\n this.getHostElement().style.maxHeight = `${size}px`;\n }\n }\n\n ngAfterContentInit(): void {\n if (this.autoColor) {\n this.formField.control?.stateChanges.subscribe(this.updateState);\n\n this.updateState();\n }\n\n this.updateMaxHeight();\n }\n\n private updateState = () => {\n this.hasError = this.formField.shouldForward('invalid');\n\n this.changeDetectorRef.markForCheck();\n };\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n Attribute,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n OnDestroy,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport { CanColor, KBQ_FORM_FIELD_REF, KbqFormFieldRef } from '@koobiq/components/core';\nimport { KbqIcon } from './icon.component';\n\n@Component({\n standalone: true,\n selector: `[kbq-icon-button]`,\n template: '<ng-content />',\n styleUrls: ['icon-button.scss', 'icon-button-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon kbq-icon-button',\n\n '[attr.tabindex]': 'tabindex',\n '[attr.disabled]': 'disabled',\n\n '[class.kbq-disabled]': 'disabled',\n '[class.kbq-icon-button_small]': 'small'\n }\n})\nexport class KbqIconButton extends KbqIcon implements OnDestroy, CanColor {\n @Input() small = false;\n\n @Input()\n get tabindex() {\n return this.disabled ? null : this._tabindex;\n }\n\n set tabindex(value: any) {\n this._tabindex = value;\n }\n\n private _tabindex = 0;\n\n /** Whether the button is disabled. */\n @Input({ transform: booleanAttribute })\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(value: boolean) {\n if (this._disabled !== value) {\n this._disabled = value;\n\n this._disabled ? this.stopFocusMonitor() : this.runFocusMonitor();\n }\n }\n\n private _disabled: boolean;\n\n override name = 'KbqIconButton';\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon-button') iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef,\n private focusMonitor: FocusMonitor\n ) {\n super(elementRef, iconName, formField, changeDetectorRef);\n\n this.runFocusMonitor();\n }\n\n ngOnDestroy() {\n this.stopFocusMonitor();\n }\n\n private runFocusMonitor() {\n this.focusMonitor.monitor(this.getHostElement(), true);\n }\n\n private stopFocusMonitor() {\n this.focusMonitor.stopMonitoring(this.getHostElement());\n }\n}\n","import {\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport { CanColor, KBQ_FORM_FIELD_REF, KbqFormFieldRef } from '@koobiq/components/core';\nimport { KbqIcon } from './icon.component';\n\n@Component({\n standalone: true,\n selector: `[kbq-icon-item]`,\n template: '<ng-content />',\n styleUrls: ['icon-item.scss', 'icon-item-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon kbq-icon-item kbq-icon-item_filled',\n '[class.kbq-icon-item_normal]': '!big',\n '[class.kbq-icon-item_big]': 'big',\n '[class.kbq-icon-item_fade-off]': '!fade',\n '[class.kbq-icon-item_fade-on]': 'fade'\n }\n})\nexport class KbqIconItem extends KbqIcon implements CanColor {\n override name = 'KbqIconItem';\n\n @Input() fade: boolean = false;\n @Input() big: boolean = false;\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon-item') iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef\n ) {\n super(elementRef, iconName, formField, changeDetectorRef);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { KbqIconButton } from './icon-button.component';\nimport { KbqIconItem } from './icon-item.component';\nimport { KbqIcon } from './icon.component';\n\nconst COMPONENTS = [\n KbqIcon,\n KbqIconButton,\n KbqIconItem\n];\n@NgModule({\n imports: COMPONENTS,\n exports: COMPONENTS\n})\nexport class KbqIconModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAqBA;MACa,WAAW,CAAA;AACpB,IAAA,WAAA,CAAmB,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU,CAAY;KAAI;AAChD,CAAA;AAED;AACO,MAAM,gBAAgB,GAAsC,UAAU,CACzE,WAAW,EACX,kBAAkB,CAAC,YAAY,EACjC;AAeI,MAAO,OAAQ,SAAQ,gBAAgB,CAAA;AAQzC,IAAA,WAAA,CACI,UAAsB,EACW,QAAgB,EACC,SAA0B,EAClE,iBAAoC,EAAA;QAE9C,KAAK,CAAC,UAAU,CAAC,CAAC;QAJe,IAAQ,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sBAAZ,KAAK;gBACG,GAAG,EAAA,CAAA;sBAAX,KAAK;;;AC7BV,MAAM,UAAU,GAAG;IACf,OAAO;IACP,aAAa;IACb,WAAW;CACd,CAAC;MAKW,aAAa,CAAA;iIAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAb,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YARtB,OAAO;YACP,aAAa;AACb,YAAA,WAAW,aAFX,OAAO;YACP,aAAa;YACb,WAAW,CAAA,EAAA,CAAA,CAAA,EAAA;kIAMF,aAAa,EAAA,CAAA,CAAA,EAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,UAAU;AACnB,oBAAA,OAAO,EAAE,UAAU;AACtB,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"koobiq-components-icon.mjs","sources":["../../../packages/components/icon/icon.component.ts","../../../packages/components/icon/icon-button.component.ts","../../../packages/components/icon/icon-item.component.ts","../../../packages/components/icon/icon.module.ts","../../../packages/components/icon/koobiq-components-icon.ts"],"sourcesContent":["import {\n AfterContentInit,\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport {\n CanColor,\n CanColorCtor,\n KBQ_FORM_FIELD_REF,\n KbqComponentColors,\n KbqFormFieldRef,\n mixinColor\n} from '@koobiq/components/core';\n\n/** @docs-private */\nexport class KbqIconBase {\n constructor(public elementRef: ElementRef) {}\n}\n\n/** @docs-private */\nexport const KbqIconMixinBase: CanColorCtor & typeof KbqIconBase = mixinColor(\n KbqIconBase,\n KbqComponentColors.ContrastFade\n);\n\n@Component({\n standalone: true,\n selector: '[kbq-icon]',\n template: '<ng-content />',\n styleUrls: ['icon.scss', 'icon-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon',\n '[class.kbq-error]': 'color === \"error\" || hasError'\n }\n})\nexport class KbqIcon extends KbqIconMixinBase implements CanColor, AfterContentInit {\n @Input() small = false;\n @Input() autoColor = false;\n\n hasError: boolean = false;\n\n protected name = 'KbqIcon';\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon') protected iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) protected formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef\n ) {\n super(elementRef);\n\n if (iconName) {\n this.getHostElement().classList.add(iconName);\n }\n }\n\n getHostElement() {\n return this.elementRef.nativeElement;\n }\n\n updateMaxHeight() {\n if (this.name !== 'KbqIcon') {\n return;\n }\n\n const size = parseInt(this.iconName?.split('_')[1]);\n\n if (size) {\n this.getHostElement().style.maxHeight = `${size}px`;\n }\n }\n\n ngAfterContentInit(): void {\n if (this.autoColor) {\n this.formField.control?.stateChanges.subscribe(this.updateState);\n\n this.updateState();\n }\n\n this.updateMaxHeight();\n }\n\n private updateState = () => {\n this.hasError = this.formField.control?.errorState;\n\n this.changeDetectorRef.markForCheck();\n };\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n Attribute,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n OnDestroy,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport { CanColor, KBQ_FORM_FIELD_REF, KbqFormFieldRef } from '@koobiq/components/core';\nimport { KbqIcon } from './icon.component';\n\n@Component({\n standalone: true,\n selector: `[kbq-icon-button]`,\n template: '<ng-content />',\n styleUrls: ['icon-button.scss', 'icon-button-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon kbq-icon-button',\n\n '[attr.tabindex]': 'tabindex',\n '[attr.disabled]': 'disabled',\n\n '[class.kbq-disabled]': 'disabled',\n '[class.kbq-icon-button_small]': 'small'\n }\n})\nexport class KbqIconButton extends KbqIcon implements OnDestroy, CanColor {\n @Input() small = false;\n\n @Input()\n get tabindex() {\n return this.disabled ? null : this._tabindex;\n }\n\n set tabindex(value: any) {\n this._tabindex = value;\n }\n\n private _tabindex = 0;\n\n /** Whether the button is disabled. */\n @Input({ transform: booleanAttribute })\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(value: boolean) {\n if (this._disabled !== value) {\n this._disabled = value;\n\n this._disabled ? this.stopFocusMonitor() : this.runFocusMonitor();\n }\n }\n\n private _disabled: boolean;\n\n override name = 'KbqIconButton';\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon-button') iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef,\n private focusMonitor: FocusMonitor\n ) {\n super(elementRef, iconName, formField, changeDetectorRef);\n\n this.runFocusMonitor();\n }\n\n ngOnDestroy() {\n this.stopFocusMonitor();\n }\n\n private runFocusMonitor() {\n this.focusMonitor.monitor(this.getHostElement(), true);\n }\n\n private stopFocusMonitor() {\n this.focusMonitor.stopMonitoring(this.getHostElement());\n }\n}\n","import {\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n Input,\n Optional,\n ViewEncapsulation\n} from '@angular/core';\nimport { CanColor, KBQ_FORM_FIELD_REF, KbqFormFieldRef } from '@koobiq/components/core';\nimport { KbqIcon } from './icon.component';\n\n@Component({\n standalone: true,\n selector: `[kbq-icon-item]`,\n template: '<ng-content />',\n styleUrls: ['icon-item.scss', 'icon-item-tokens.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: ['color'],\n host: {\n class: 'kbq kbq-icon kbq-icon-item kbq-icon-item_filled',\n '[class.kbq-icon-item_normal]': '!big',\n '[class.kbq-icon-item_big]': 'big',\n '[class.kbq-icon-item_fade-off]': '!fade',\n '[class.kbq-icon-item_fade-on]': 'fade'\n }\n})\nexport class KbqIconItem extends KbqIcon implements CanColor {\n override name = 'KbqIconItem';\n\n @Input() fade: boolean = false;\n @Input() big: boolean = false;\n\n constructor(\n elementRef: ElementRef,\n @Attribute('kbq-icon-item') iconName: string,\n @Optional() @Inject(KBQ_FORM_FIELD_REF) formField: KbqFormFieldRef,\n protected changeDetectorRef: ChangeDetectorRef\n ) {\n super(elementRef, iconName, formField, changeDetectorRef);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { KbqIconButton } from './icon-button.component';\nimport { KbqIconItem } from './icon-item.component';\nimport { KbqIcon } from './icon.component';\n\nconst COMPONENTS = [\n KbqIcon,\n KbqIconButton,\n KbqIconItem\n];\n\n@NgModule({\n imports: COMPONENTS,\n exports: COMPONENTS\n})\nexport class KbqIconModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAqBA;MACa,WAAW,CAAA;AACpB,IAAA,WAAA,CAAmB,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU,CAAY;KAAI;AAChD,CAAA;AAED;AACO,MAAM,gBAAgB,GAAsC,UAAU,CACzE,WAAW,EACX,kBAAkB,CAAC,YAAY,EACjC;AAeI,MAAO,OAAQ,SAAQ,gBAAgB,CAAA;AAQzC,IAAA,WAAA,CACI,UAAsB,EACW,QAAgB,EACC,SAA0B,EAClE,iBAAoC,EAAA;QAE9C,KAAK,CAAC,UAAU,CAAC,CAAC;QAJe,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;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;sBAAX,KAAK;;;AC7BV,MAAM,UAAU,GAAG;IACf,OAAO;IACP,aAAa;IACb,WAAW;CACd,CAAC;MAMW,aAAa,CAAA;iIAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAb,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YATtB,OAAO;YACP,aAAa;AACb,YAAA,WAAW,aAFX,OAAO;YACP,aAAa;YACb,WAAW,CAAA,EAAA,CAAA,CAAA,EAAA;kIAOF,aAAa,EAAA,CAAA,CAAA,EAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,UAAU;AACnB,oBAAA,OAAO,EAAE,UAAU;AACtB,iBAAA,CAAA;;;ACdD;;AAEG;;;;"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
2
|
import { getSupportedInputTypes } from '@angular/cdk/platform';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { forwardRef, EventEmitter, Directive, Attribute, Optional, Inject, Input, InjectionToken, Self, NgModule } from '@angular/core';
|
|
4
|
+
import { forwardRef, EventEmitter, booleanAttribute, Directive, Attribute, Optional, Inject, Input, InjectionToken, Self, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators, FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i3 from '@koobiq/components/core';
|
|
8
|
-
import { KBQ_LOCALE_SERVICE, mixinErrorState, KbqCommonModule } from '@koobiq/components/core';
|
|
8
|
+
import { ruRUFormattersData, checkAndNormalizeLocalizedNumber, normalizeNumber, KBQ_LOCALE_SERVICE, mixinErrorState, KbqCommonModule } from '@koobiq/components/core';
|
|
9
9
|
import { KbqFormFieldControl } from '@koobiq/components/form-field';
|
|
10
|
-
import { Subject
|
|
11
|
-
import {
|
|
10
|
+
import { Subject } from 'rxjs';
|
|
11
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
import { V, X, Z, NUMPAD_MINUS, DASH, FF_MINUS, DELETE, BACKSPACE, TAB, ESCAPE, ENTER, LEFT_ARROW, RIGHT_ARROW, HOME, END, isSelectAll, isCopy, isFunctionKey, isNumberKey, isNumpadKey, UP_ARROW, DOWN_ARROW } from '@koobiq/cdk/keycodes';
|
|
12
13
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
13
14
|
import { KbqIconModule } from '@koobiq/components/icon';
|
|
14
15
|
|
|
@@ -16,6 +17,7 @@ function getKbqInputUnsupportedTypeError(inputType) {
|
|
|
16
17
|
return Error(`Input type "${inputType}" isn't supported by kbqInput.`);
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
const KBQ_INPUT_NUMBER_DEFAULT_CONFIGURATION = ruRUFormattersData.input.number;
|
|
19
21
|
const BIG_STEP = 10;
|
|
20
22
|
const SMALL_STEP = 1;
|
|
21
23
|
function normalizeSplitter(value) {
|
|
@@ -82,6 +84,12 @@ class KbqNumberInput {
|
|
|
82
84
|
get ngControl() {
|
|
83
85
|
return this.control;
|
|
84
86
|
}
|
|
87
|
+
get fractionSeparator() {
|
|
88
|
+
return this.config.fractionSeparator;
|
|
89
|
+
}
|
|
90
|
+
get groupSeparator() {
|
|
91
|
+
return this.config.groupSeparator;
|
|
92
|
+
}
|
|
85
93
|
constructor(elementRef, renderer, step, bigStep, min, max, localeService) {
|
|
86
94
|
this.elementRef = elementRef;
|
|
87
95
|
this.renderer = renderer;
|
|
@@ -91,14 +99,29 @@ class KbqNumberInput {
|
|
|
91
99
|
/** Emits when the disabled state has changed */
|
|
92
100
|
this.disabledChange = new EventEmitter();
|
|
93
101
|
this.stateChanges = new Subject();
|
|
102
|
+
/**
|
|
103
|
+
* Allows input and pasting of integers only.
|
|
104
|
+
*/
|
|
105
|
+
this.integer = false;
|
|
94
106
|
this.withThousandSeparator = true;
|
|
95
107
|
this._disabled = false;
|
|
96
108
|
this.focused = false;
|
|
97
|
-
this.localeSubscription = Subscription.EMPTY;
|
|
98
109
|
this.onTouched = () => { };
|
|
110
|
+
this.isCtrlV = (event) => {
|
|
111
|
+
return event.keyCode === V && (event.ctrlKey || event.metaKey);
|
|
112
|
+
};
|
|
113
|
+
this.isCtrlX = (event) => {
|
|
114
|
+
return event.keyCode === X && (event.ctrlKey || event.metaKey);
|
|
115
|
+
};
|
|
116
|
+
this.isCtrlZ = (event) => {
|
|
117
|
+
return event.keyCode === Z && (event.ctrlKey || event.metaKey);
|
|
118
|
+
};
|
|
119
|
+
this.isPeriod = (event) => {
|
|
120
|
+
return this.groupSeparator.includes(event.key) || [this.fractionSeparator, '.'].includes(event.key);
|
|
121
|
+
};
|
|
99
122
|
this.cvaOnChange = () => { };
|
|
100
|
-
this.updateLocaleParams = (
|
|
101
|
-
this.
|
|
123
|
+
this.updateLocaleParams = () => {
|
|
124
|
+
this.config = this.localeService.getParams('input').number;
|
|
102
125
|
this.setViewValue(this.formatNumber(this.value));
|
|
103
126
|
};
|
|
104
127
|
this.step = isDigit(step) ? parseFloat(step) : SMALL_STEP;
|
|
@@ -113,16 +136,12 @@ class KbqNumberInput {
|
|
|
113
136
|
}
|
|
114
137
|
});
|
|
115
138
|
}
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
ngAfterContentInit() {
|
|
122
|
-
this.renderer.setProperty(this.nativeElement, 'type', 'text');
|
|
139
|
+
this.localeService?.changes.pipe(takeUntilDestroyed()).subscribe(this.updateLocaleParams);
|
|
140
|
+
if (!localeService) {
|
|
141
|
+
this.initDefaultParams();
|
|
142
|
+
}
|
|
123
143
|
}
|
|
124
144
|
ngOnDestroy() {
|
|
125
|
-
this.localeSubscription.unsubscribe();
|
|
126
145
|
this.valueChange.complete();
|
|
127
146
|
this.disabledChange.complete();
|
|
128
147
|
}
|
|
@@ -156,36 +175,26 @@ class KbqNumberInput {
|
|
|
156
175
|
}
|
|
157
176
|
onKeyDown(event) {
|
|
158
177
|
const keyCode = event.keyCode;
|
|
159
|
-
const isCtrlA = (e) => e.keyCode === A && (e.ctrlKey || e.metaKey);
|
|
160
|
-
const isCtrlC = (e) => e.keyCode === C && (e.ctrlKey || e.metaKey);
|
|
161
|
-
const isCtrlV = (e) => e.keyCode === V && (e.ctrlKey || e.metaKey);
|
|
162
|
-
const isCtrlX = (e) => e.keyCode === X && (e.ctrlKey || e.metaKey);
|
|
163
|
-
const isCtrlZ = (e) => e.keyCode === Z && (e.ctrlKey || e.metaKey);
|
|
164
|
-
const isPeriod = (e) => this.numberLocaleConfig.groupSeparator.includes(e.key) ||
|
|
165
|
-
[this.numberLocaleConfig.fractionSeparator, '.'].includes(e.key);
|
|
166
178
|
const minuses = [NUMPAD_MINUS, DASH, FF_MINUS];
|
|
167
179
|
const serviceKeys = [DELETE, BACKSPACE, TAB, ESCAPE, ENTER];
|
|
168
180
|
const arrows = [LEFT_ARROW, RIGHT_ARROW];
|
|
169
181
|
const allowedKeys = [HOME, END].concat(arrows).concat(serviceKeys).concat(minuses);
|
|
170
|
-
if (
|
|
182
|
+
if ((this.integer && this.isPeriod(event)) ||
|
|
183
|
+
(minuses.includes(keyCode) && (this.viewValue.includes(event.key) || this.min >= 0)) ||
|
|
184
|
+
(this.isPeriod(event) &&
|
|
185
|
+
event.key === this.fractionSeparator &&
|
|
186
|
+
this.viewValue.indexOf(this.fractionSeparator) !== -1)) {
|
|
171
187
|
event.preventDefault();
|
|
172
188
|
return;
|
|
173
189
|
}
|
|
174
|
-
if (isPeriod(event)) {
|
|
175
|
-
if (event.key === this.numberLocaleConfig.fractionSeparator &&
|
|
176
|
-
this.viewValue.indexOf(this.numberLocaleConfig.fractionSeparator) !== -1) {
|
|
177
|
-
event.preventDefault();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
190
|
if (allowedKeys.indexOf(keyCode) !== -1 || [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
isCtrlV,
|
|
185
|
-
isCtrlX,
|
|
186
|
-
isCtrlZ,
|
|
191
|
+
isSelectAll,
|
|
192
|
+
isCopy,
|
|
193
|
+
this.isCtrlV,
|
|
194
|
+
this.isCtrlX,
|
|
195
|
+
this.isCtrlZ,
|
|
187
196
|
isFunctionKey,
|
|
188
|
-
isPeriod
|
|
197
|
+
this.isPeriod
|
|
189
198
|
].some((fn) => fn(event))) {
|
|
190
199
|
// let it happen, don't do anything
|
|
191
200
|
return;
|
|
@@ -229,10 +238,16 @@ class KbqNumberInput {
|
|
|
229
238
|
});
|
|
230
239
|
}
|
|
231
240
|
onPaste(event) {
|
|
232
|
-
this.valueFromPaste =
|
|
241
|
+
this.valueFromPaste = checkAndNormalizeLocalizedNumber(event.clipboardData?.getData('text'));
|
|
233
242
|
if (this.valueFromPaste === null) {
|
|
234
243
|
event.preventDefault();
|
|
235
244
|
}
|
|
245
|
+
else if (this.integer && isFloat(this.valueFromPaste.toString())) {
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
const parsedValue = Number.parseInt(this.valueFromPaste.toString());
|
|
248
|
+
this.setViewValue(this.formatNumber(parsedValue));
|
|
249
|
+
this.viewToModelUpdate(parsedValue.toString());
|
|
250
|
+
}
|
|
236
251
|
}
|
|
237
252
|
stepUp(step) {
|
|
238
253
|
this.nativeElement.focus();
|
|
@@ -250,6 +265,9 @@ class KbqNumberInput {
|
|
|
250
265
|
this.cvaOnChange(res);
|
|
251
266
|
this.valueChange.emit(res);
|
|
252
267
|
}
|
|
268
|
+
initDefaultParams() {
|
|
269
|
+
this.config = KBQ_INPUT_NUMBER_DEFAULT_CONFIGURATION;
|
|
270
|
+
}
|
|
253
271
|
setViewValue(value, savePosition = false) {
|
|
254
272
|
const cursorPosition = this.nativeElement.selectionStart;
|
|
255
273
|
this.renderer.setProperty(this.nativeElement, 'value', value);
|
|
@@ -259,7 +277,7 @@ class KbqNumberInput {
|
|
|
259
277
|
}
|
|
260
278
|
}
|
|
261
279
|
viewToModelUpdate(newValue) {
|
|
262
|
-
const normalizedValue = newValue === null ? null : +
|
|
280
|
+
const normalizedValue = newValue === null ? null : +normalizeNumber(newValue, this.config);
|
|
263
281
|
if (normalizedValue !== this.value) {
|
|
264
282
|
this._value = normalizedValue;
|
|
265
283
|
this.cvaOnChange(normalizedValue);
|
|
@@ -268,21 +286,20 @@ class KbqNumberInput {
|
|
|
268
286
|
this.ngControl?.updateValueAndValidity({ emitEvent: false });
|
|
269
287
|
}
|
|
270
288
|
formatViewValue() {
|
|
271
|
-
if (this.viewValue === null ||
|
|
289
|
+
if (this.viewValue === null ||
|
|
290
|
+
this.viewValue === '' ||
|
|
291
|
+
Number.isNaN(+normalizeNumber(this.viewValue, this.config))) {
|
|
272
292
|
return null;
|
|
273
293
|
}
|
|
274
|
-
const separator = this.
|
|
275
|
-
? /[,.]/
|
|
276
|
-
: this.numberLocaleConfig.fractionSeparator;
|
|
294
|
+
const separator = this.groupSeparator.includes(' ') && this.fractionSeparator === ',' ? /[,.]/ : this.fractionSeparator;
|
|
277
295
|
const [intPart, fractionPart] = this.viewValue
|
|
278
296
|
.split(separator)
|
|
279
|
-
.map((valuePart) =>
|
|
297
|
+
.map((valuePart) => normalizeNumber(valuePart, this.config));
|
|
280
298
|
return this.createLocalizedNumberFromParts(+intPart, fractionPart);
|
|
281
299
|
}
|
|
282
300
|
formatNumber(value) {
|
|
283
|
-
if (value === null || value === undefined)
|
|
301
|
+
if (value === null || value === undefined)
|
|
284
302
|
return null;
|
|
285
|
-
}
|
|
286
303
|
const [intPart, fractionPart] = value.toString().split('.');
|
|
287
304
|
return this.createLocalizedNumberFromParts(+intPart, fractionPart);
|
|
288
305
|
}
|
|
@@ -291,10 +308,10 @@ class KbqNumberInput {
|
|
|
291
308
|
useGrouping: this.withThousandSeparator,
|
|
292
309
|
maximumFractionDigits: 20
|
|
293
310
|
};
|
|
294
|
-
if (this.withThousandSeparator && this.
|
|
295
|
-
formatOptions.useGrouping = intPart >= Math.pow(10, this.
|
|
311
|
+
if (this.withThousandSeparator && this.config.startFormattingFrom) {
|
|
312
|
+
formatOptions.useGrouping = intPart >= Math.pow(10, this.config.startFormattingFrom);
|
|
296
313
|
}
|
|
297
|
-
const localeId = this.localeService.id === 'es-LA' ? 'ru-RU' : this.localeService.id;
|
|
314
|
+
const localeId = !this.localeService || this.localeService.id === 'es-LA' ? 'ru-RU' : this.localeService.id;
|
|
298
315
|
const formatter = new Intl.NumberFormat(localeId, formatOptions);
|
|
299
316
|
const formattedFractionPart = fractionPart
|
|
300
317
|
?.split('')
|
|
@@ -302,37 +319,10 @@ class KbqNumberInput {
|
|
|
302
319
|
.join('');
|
|
303
320
|
return formattedFractionPart === undefined
|
|
304
321
|
? formatter.format(intPart)
|
|
305
|
-
: `${formatter.format(intPart)}${this.
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Method that returns a string representation of a number without localized separators
|
|
309
|
-
*/
|
|
310
|
-
normalizeNumber(value, customConfig) {
|
|
311
|
-
if (value === null || value === undefined) {
|
|
312
|
-
return '';
|
|
313
|
-
}
|
|
314
|
-
const { groupSeparator, fractionSeparator } = customConfig || this.numberLocaleConfig;
|
|
315
|
-
const groupSeparatorRegexp = new RegExp(`[${groupSeparator.join('')}]`, 'g');
|
|
316
|
-
const fractionSeparatorRegexp = new RegExp(`\\${fractionSeparator}`, 'g');
|
|
317
|
-
return value.toString().replace(groupSeparatorRegexp, '').replace(fractionSeparatorRegexp, '.');
|
|
318
|
-
}
|
|
319
|
-
checkAndNormalizeLocalizedNumber(num) {
|
|
320
|
-
if (num === null || num === undefined) {
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
/* if some locale input config satisfies pasted number, try to normalize with selected locale config */
|
|
324
|
-
let numberOutput = null;
|
|
325
|
-
for (const { config } of this.allNumberLocaleConfigs) {
|
|
326
|
-
const normalized = +this.normalizeNumber(num, config);
|
|
327
|
-
if (!Number.isNaN(normalized)) {
|
|
328
|
-
numberOutput = normalized;
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return numberOutput;
|
|
322
|
+
: `${formatter.format(intPart)}${this.fractionSeparator}${formattedFractionPart}`;
|
|
333
323
|
}
|
|
334
324
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqNumberInput, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: 'step', attribute: true }, { token: 'big-step', attribute: true }, { token: 'min', attribute: true }, { token: 'max', attribute: true }, { token: KBQ_LOCALE_SERVICE, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
335
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
325
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.6", type: KbqNumberInput, selector: "input[kbqNumberInput]", inputs: { integer: ["integer", "integer", booleanAttribute], bigStep: "bigStep", step: "step", min: "min", max: "max", withThousandSeparator: ["withThousandSeparator", "withThousandSeparator", booleanAttribute], startFormattingFrom: "startFormattingFrom", value: "value", disabled: "disabled" }, host: { listeners: { "blur": "focusChanged(false)", "focus": "focusChanged(true)", "paste": "onPaste($event)", "keydown": "onKeyDown($event)", "input": "onInput($event)" } }, providers: [KBQ_NUMBER_INPUT_VALUE_ACCESSOR], exportAs: ["kbqNumericalInput"], ngImport: i0 }); }
|
|
336
326
|
}
|
|
337
327
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImport: i0, type: KbqNumberInput, decorators: [{
|
|
338
328
|
type: Directive,
|
|
@@ -365,7 +355,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
|
|
|
365
355
|
}, {
|
|
366
356
|
type: Inject,
|
|
367
357
|
args: [KBQ_LOCALE_SERVICE]
|
|
368
|
-
}] }], propDecorators: {
|
|
358
|
+
}] }], propDecorators: { integer: [{
|
|
359
|
+
type: Input,
|
|
360
|
+
args: [{ transform: booleanAttribute }]
|
|
361
|
+
}], bigStep: [{
|
|
369
362
|
type: Input
|
|
370
363
|
}], step: [{
|
|
371
364
|
type: Input
|
|
@@ -374,7 +367,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
|
|
|
374
367
|
}], max: [{
|
|
375
368
|
type: Input
|
|
376
369
|
}], withThousandSeparator: [{
|
|
377
|
-
type: Input
|
|
370
|
+
type: Input,
|
|
371
|
+
args: [{ transform: booleanAttribute }]
|
|
378
372
|
}], startFormattingFrom: [{
|
|
379
373
|
type: Input
|
|
380
374
|
}], value: [{
|
|
@@ -1036,5 +1030,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.6", ngImpor
|
|
|
1036
1030
|
* Generated bundle index. Do not edit.
|
|
1037
1031
|
*/
|
|
1038
1032
|
|
|
1039
|
-
export { BIG_STEP, KBQ_INPUT_VALUE_ACCESSOR, KBQ_NUMBER_INPUT_VALUE_ACCESSOR, KbqInput, KbqInputBase, KbqInputMixinBase, KbqInputModule, KbqInputMono, KbqInputPassword, KbqNumberInput, MAX_VALIDATOR, MIN_VALIDATOR, MaxValidator, MinValidator, SMALL_STEP, add, getPrecision, isDigit, isFloat, isInt, normalizeSplitter };
|
|
1033
|
+
export { BIG_STEP, KBQ_INPUT_NUMBER_DEFAULT_CONFIGURATION, KBQ_INPUT_VALUE_ACCESSOR, KBQ_NUMBER_INPUT_VALUE_ACCESSOR, KbqInput, KbqInputBase, KbqInputMixinBase, KbqInputModule, KbqInputMono, KbqInputPassword, KbqNumberInput, MAX_VALIDATOR, MIN_VALIDATOR, MaxValidator, MinValidator, SMALL_STEP, add, getPrecision, isDigit, isFloat, isInt, normalizeSplitter };
|
|
1040
1034
|
//# sourceMappingURL=koobiq-components-input.mjs.map
|