@wizishop/angular-components 14.4.1 → 14.4.3
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/esm2020/lib/directives/keyboard-events/two-digital-decimal-number.directive.mjs +37 -0
- package/esm2020/lib/directives/shared-directives.module.mjs +8 -4
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/wizishop-angular-components.mjs +42 -4
- package/fesm2015/wizishop-angular-components.mjs.map +1 -1
- package/fesm2020/wizishop-angular-components.mjs +42 -4
- package/fesm2020/wizishop-angular-components.mjs.map +1 -1
- package/lib/directives/keyboard-events/two-digital-decimal-number.directive.d.ts +12 -0
- package/lib/directives/shared-directives.module.d.ts +4 -3
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/wizishop-angular-components-14.4.3.tgz +0 -0
- package/wizishop-angular-components-14.4.1.tgz +0 -0
|
@@ -770,6 +770,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
|
|
|
770
770
|
args: ['keydown', ['$event']]
|
|
771
771
|
}] } });
|
|
772
772
|
|
|
773
|
+
class TwoDigitDecimalNumberDirective {
|
|
774
|
+
constructor(el) {
|
|
775
|
+
this.el = el;
|
|
776
|
+
this.decimalSeparator = ['.', ','];
|
|
777
|
+
this.regex = new RegExp(/^\d+[.,]?\d{0,2}$/g); // user can put . or , char.
|
|
778
|
+
// input also cannot start from , or .
|
|
779
|
+
this.specialKeys = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];
|
|
780
|
+
}
|
|
781
|
+
onKeyDown(event) {
|
|
782
|
+
if (this.specialKeys.includes(event.key)) {
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
const current = this.el.nativeElement.value;
|
|
786
|
+
const position = this.el.nativeElement.selectionStart;
|
|
787
|
+
const next = [current.slice(0, position), event.key == 'Decimal' ? '.' : event.key, current.slice(position)].join('');
|
|
788
|
+
const regex = new RegExp(`^\d+[${this.decimalSeparator.join('')}]?\d{0,2}$`, 'g');
|
|
789
|
+
if (next && !String(next).match(regex)) {
|
|
790
|
+
event.preventDefault();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
TwoDigitDecimalNumberDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: TwoDigitDecimalNumberDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
795
|
+
TwoDigitDecimalNumberDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: TwoDigitDecimalNumberDirective, selector: "[wacTwoDigitDecimalNumber]", inputs: { decimalSeparator: "decimalSeparator" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
|
|
796
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: TwoDigitDecimalNumberDirective, decorators: [{
|
|
797
|
+
type: Directive,
|
|
798
|
+
args: [{
|
|
799
|
+
selector: '[wacTwoDigitDecimalNumber]',
|
|
800
|
+
}]
|
|
801
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { decimalSeparator: [{
|
|
802
|
+
type: Input
|
|
803
|
+
}], onKeyDown: [{
|
|
804
|
+
type: HostListener,
|
|
805
|
+
args: ['keydown', ['$event']]
|
|
806
|
+
}] } });
|
|
807
|
+
|
|
773
808
|
const directives$2 = [
|
|
774
809
|
DebounceKeyupDirective,
|
|
775
810
|
AbstractDebounceDirective,
|
|
@@ -779,7 +814,8 @@ const directives$2 = [
|
|
|
779
814
|
KeypressEnterDirective,
|
|
780
815
|
SelectOptionDirective,
|
|
781
816
|
SelectDirective,
|
|
782
|
-
OnlyNumberDirective
|
|
817
|
+
OnlyNumberDirective,
|
|
818
|
+
TwoDigitDecimalNumberDirective
|
|
783
819
|
];
|
|
784
820
|
class SharedDirectives {
|
|
785
821
|
}
|
|
@@ -792,7 +828,8 @@ SharedDirectives.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
792
828
|
KeypressEnterDirective,
|
|
793
829
|
SelectOptionDirective,
|
|
794
830
|
SelectDirective,
|
|
795
|
-
OnlyNumberDirective
|
|
831
|
+
OnlyNumberDirective,
|
|
832
|
+
TwoDigitDecimalNumberDirective], imports: [CommonModule, FormsModule], exports: [DebounceKeyupDirective,
|
|
796
833
|
AbstractDebounceDirective,
|
|
797
834
|
AutoHideDirective,
|
|
798
835
|
ZindexToggleDirective,
|
|
@@ -800,7 +837,8 @@ SharedDirectives.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
800
837
|
KeypressEnterDirective,
|
|
801
838
|
SelectOptionDirective,
|
|
802
839
|
SelectDirective,
|
|
803
|
-
OnlyNumberDirective
|
|
840
|
+
OnlyNumberDirective,
|
|
841
|
+
TwoDigitDecimalNumberDirective] });
|
|
804
842
|
SharedDirectives.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, imports: [CommonModule, FormsModule] });
|
|
805
843
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SharedDirectives, decorators: [{
|
|
806
844
|
type: NgModule,
|
|
@@ -6153,5 +6191,5 @@ class TableFiltersGroup extends NwbFilterGroup {
|
|
|
6153
6191
|
* Generated bundle index. Do not edit.
|
|
6154
6192
|
*/
|
|
6155
6193
|
|
|
6156
|
-
export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockSeparatorComponent, BlockTitleLegacyComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, ChargingBarComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpandedPanelComponent, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FindOptionSelectedPipe, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, GooglePreviewComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OnlyNumberDirective, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectDirective, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, ValueChangeService, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
|
|
6194
|
+
export { ACCORDION_ITEM, AbstractDebounceDirective, AccordionComponent, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, BlockSeparatorComponent, BlockTitleLegacyComponent, BlockWithCheckboxComponent, BreadcrumbsComponent, ButtonComponent, CalendarComponent, CardPriceComponent, ChargingBarComponent, CheckBoxRow, CheckboxComponent, ConfirmDeleteComponent, ContentWithButtonsComponent, DebounceKeyupDirective, DeleteComponent, DraganddropListComponent, DropdownComponent, EXPANSION_PANEL_HEADER, ExpandedPanelComponent, ExpansionExport, ExpansionModule, ExpansionPanelBase, ExpansionPanelComponent, ExpansionPanelDirective, ExpansionPanelHeaderComponent, ExpansionPanelHeaderDirective, FilterOptionsPipe, FiltersComponent, FiltersTableService, FindOptionSelectedPipe, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, GooglePreviewComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, KeypressEnterDirective, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MosaicComponent, MultipleSearchComponent, MultipleSearchPlusComponent, OnlyNumberDirective, OptionCallToActionComponent, OptionComponent, OptionalDisableContainerComponent, PaginationComponent, PlaceholderComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectDirective, SelectFiltersPipe, SelectInTextComponent, SelectOptionDirective, SelectSearchTriggerComponent, SelectTestComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SummaryComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TagLabelComponent, TextAreaComponent, TextComponent, TokenCheckComponent, TooltipComponent, TreeComponent, TreeModule, TwoDigitDecimalNumberDirective, UploadComponent, ValueChangeService, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WrapperMultipleBlockComponent, WrapperSidebarComponent, WzEditInPlaceComponent, ZindexToggleDirective };
|
|
6157
6195
|
//# sourceMappingURL=wizishop-angular-components.mjs.map
|