@net7/boilerplate-muruca 5.5.7 → 5.5.9

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.
@@ -7,3 +7,4 @@ export * from './read-more/read-more';
7
7
  export * from './resource-modal/resource-modal';
8
8
  export * from './search-page-description/search-page-description';
9
9
  export * from './metadata-dynamic/metadata-dynamic';
10
+ export * from './input-typeahead/input-typeahead';
@@ -0,0 +1,67 @@
1
+ /**
2
+ * MrInputTypeaheadComponent
3
+ *
4
+ * A text input with an inline autocomplete dropdown. Supports two modes:
5
+ *
6
+ * 1. **Static (local) filtering** — provide a fixed list of strings via `data.options`.
7
+ * No API call is made; suggestions are filtered client-side on every keystroke.
8
+ *
9
+ * ```ts
10
+ * {
11
+ * id: 'my-field',
12
+ * type: 'typeahead',
13
+ * data: {
14
+ * id: 'my-field',
15
+ * label: 'My Field',
16
+ * options: ['Apple', 'Banana', 'Cherry'],
17
+ * }
18
+ * }
19
+ * ```
20
+ *
21
+ * 2. **Dynamic (API) autocomplete** — omit `data.options` and provide
22
+ * `data.communicationKey` instead. The component calls
23
+ * `CommunicationService.request$(communicationKey, { queryParams: { q } })`
24
+ * after a 200 ms debounce. The endpoint must return `string[]`.
25
+ *
26
+ * ```ts
27
+ * {
28
+ * id: 'my-field',
29
+ * type: 'typeahead',
30
+ * data: {
31
+ * id: 'my-field',
32
+ * label: 'My Field',
33
+ * communicationKey: 'myAutocompleteEndpoint',
34
+ * }
35
+ * }
36
+ * ```
37
+ *
38
+ * Suggestions appear after 2 characters are typed. Tab completes with the first
39
+ * suggestion. Clicking outside dismisses the dropdown.
40
+ */
41
+ import { ElementRef, OnDestroy } from '@angular/core';
42
+ import { CommunicationService } from '@net7/boilerplate-common';
43
+ import * as i0 from "@angular/core";
44
+ export declare class MrInputTypeaheadComponent implements OnDestroy {
45
+ private communication;
46
+ private el;
47
+ data: any;
48
+ emit: (type: string, payload?: any) => void;
49
+ suggestions: string[];
50
+ isLoading: boolean;
51
+ currentQuery: string;
52
+ private timer;
53
+ constructor(communication: CommunicationService, el: ElementRef);
54
+ /** Wraps the form emit to intercept change events for autocomplete fetching */
55
+ localEmit: (type: string, payload?: any) => void;
56
+ /** Wraps the first occurrence of `query` in `text` with a <strong> tag */
57
+ highlight(text: string, query: string): string;
58
+ /** Completes with the first suggestion on Tab */
59
+ onKeydown(event: KeyboardEvent): void;
60
+ /** Selects a suggestion, updates the input and form state */
61
+ onSelect(suggestion: string, event?: MouseEvent): void;
62
+ onDocumentClick(event: Event): void;
63
+ ngOnDestroy(): void;
64
+ private onValueChange;
65
+ static ɵfac: i0.ɵɵFactoryDeclaration<MrInputTypeaheadComponent, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<MrInputTypeaheadComponent, "mr-input-typeahead", never, { "data": { "alias": "data"; "required": false; }; "emit": { "alias": "emit"; "required": false; }; }, {}, never, never, false, never>;
67
+ }
@@ -0,0 +1,12 @@
1
+ import { DataSource } from '@net7/core';
2
+ import { MrFormInputState, MrInputDataSource } from '../../interfaces/form.interface';
3
+ export type MrInputTypeaheadValue = string | null;
4
+ export declare class MrInputTypeaheadDS extends DataSource implements MrInputDataSource<MrInputTypeaheadValue> {
5
+ id: string;
6
+ state: MrFormInputState<MrInputTypeaheadValue>;
7
+ protected transform(data: any): any;
8
+ getState: () => MrFormInputState<string>;
9
+ setState(newState: MrFormInputState<MrInputTypeaheadValue>): void;
10
+ clear(): void;
11
+ refresh(): void;
12
+ }
@@ -0,0 +1,9 @@
1
+ import { EventHandler } from '@net7/core';
2
+ import { Subject } from 'rxjs';
3
+ import { MrInputTypeaheadDS } from '../../data-sources/form/input-typeahead.ds';
4
+ import { MrInputEventHandler, MrChangedParams } from '../../interfaces/form.interface';
5
+ export declare class MrInputTypeaheadEH extends EventHandler implements MrInputEventHandler {
6
+ changed$: Subject<MrChangedParams>;
7
+ dataSource: MrInputTypeaheadDS;
8
+ listen(): void;
9
+ }
@@ -7,7 +7,7 @@ export declare class MrFormModel {
7
7
  [id: string]: {
8
8
  ds: any;
9
9
  eh: any;
10
- emit: (t: string, p: any) => Function;
10
+ emit: (t: string, p: any) => void;
11
11
  };
12
12
  };
13
13
  private inputTypes;
@@ -24,15 +24,16 @@ import * as i19 from "./components/resource-modal/resource-modal";
24
24
  import * as i20 from "./components/gallery/gallery";
25
25
  import * as i21 from "./components/advanced-result/advanced-result";
26
26
  import * as i22 from "./components/metadata-dynamic/metadata-dynamic";
27
- import * as i23 from "@angular/common";
28
- import * as i24 from "@net7/components";
29
- import * as i25 from "@net7/boilerplate-common";
27
+ import * as i23 from "./components/input-typeahead/input-typeahead";
28
+ import * as i24 from "@angular/common";
29
+ import * as i25 from "@net7/components";
30
+ import * as i26 from "@net7/boilerplate-common";
30
31
  export declare class N7BoilerplateMurucaModule {
31
32
  private localeService;
32
33
  private mainState;
33
34
  private router;
34
35
  constructor(localeService: MrLocaleService, mainState: MainStateService, router: Router);
35
36
  static ɵfac: i0.ɵɵFactoryDeclaration<N7BoilerplateMurucaModule, never>;
36
- static ɵmod: i0.ɵɵNgModuleDeclaration<N7BoilerplateMurucaModule, [typeof i1.EscapeHtmlPipe, typeof i2.MrAdvancedResultsLayoutComponent, typeof i3.MrAdvancedSearchLayoutComponent, typeof i4.MrHomeLayoutComponent, typeof i5.MrItineraryLayoutComponent, typeof i6.MrMapLayoutComponent, typeof i7.MrNetworkLayoutComponent, typeof i8.MrMetadataReadmoreComponent, typeof i9.MrPostsLayoutComponent, typeof i10.MrResourceLayoutComponent, typeof i11.MrSearchFacetsLayoutComponent, typeof i12.MrSearchLayoutComponent, typeof i13.MrStaticLayoutComponent, typeof i14.MrTimelineLayoutComponent, typeof i15.ReadMoreComponent, typeof i16.MrFormComponent, typeof i17.MrFormWrapperAccordionComponent, typeof i18.MrSearchPageDescriptionComponent, typeof i19.MrResourceModalComponent, typeof i20.MrGalleryComponent, typeof i21.MrAdvancedResultComponent, typeof i22.MrMetadataDynamicComponent], [typeof i23.CommonModule, typeof i24.DvComponentsLibModule, typeof i25.N7BoilerplateCommonModule], [typeof i2.MrAdvancedResultsLayoutComponent, typeof i3.MrAdvancedSearchLayoutComponent, typeof i4.MrHomeLayoutComponent, typeof i5.MrItineraryLayoutComponent, typeof i6.MrMapLayoutComponent, typeof i7.MrNetworkLayoutComponent, typeof i8.MrMetadataReadmoreComponent, typeof i9.MrPostsLayoutComponent, typeof i10.MrResourceLayoutComponent, typeof i11.MrSearchFacetsLayoutComponent, typeof i12.MrSearchLayoutComponent, typeof i13.MrStaticLayoutComponent, typeof i14.MrTimelineLayoutComponent, typeof i15.ReadMoreComponent, typeof i16.MrFormComponent, typeof i17.MrFormWrapperAccordionComponent, typeof i18.MrSearchPageDescriptionComponent, typeof i19.MrResourceModalComponent, typeof i20.MrGalleryComponent, typeof i21.MrAdvancedResultComponent, typeof i22.MrMetadataDynamicComponent]>;
37
+ static ɵmod: i0.ɵɵNgModuleDeclaration<N7BoilerplateMurucaModule, [typeof i1.EscapeHtmlPipe, typeof i2.MrAdvancedResultsLayoutComponent, typeof i3.MrAdvancedSearchLayoutComponent, typeof i4.MrHomeLayoutComponent, typeof i5.MrItineraryLayoutComponent, typeof i6.MrMapLayoutComponent, typeof i7.MrNetworkLayoutComponent, typeof i8.MrMetadataReadmoreComponent, typeof i9.MrPostsLayoutComponent, typeof i10.MrResourceLayoutComponent, typeof i11.MrSearchFacetsLayoutComponent, typeof i12.MrSearchLayoutComponent, typeof i13.MrStaticLayoutComponent, typeof i14.MrTimelineLayoutComponent, typeof i15.ReadMoreComponent, typeof i16.MrFormComponent, typeof i17.MrFormWrapperAccordionComponent, typeof i18.MrSearchPageDescriptionComponent, typeof i19.MrResourceModalComponent, typeof i20.MrGalleryComponent, typeof i21.MrAdvancedResultComponent, typeof i22.MrMetadataDynamicComponent, typeof i23.MrInputTypeaheadComponent], [typeof i24.CommonModule, typeof i25.DvComponentsLibModule, typeof i26.N7BoilerplateCommonModule], [typeof i2.MrAdvancedResultsLayoutComponent, typeof i3.MrAdvancedSearchLayoutComponent, typeof i4.MrHomeLayoutComponent, typeof i5.MrItineraryLayoutComponent, typeof i6.MrMapLayoutComponent, typeof i7.MrNetworkLayoutComponent, typeof i8.MrMetadataReadmoreComponent, typeof i9.MrPostsLayoutComponent, typeof i10.MrResourceLayoutComponent, typeof i11.MrSearchFacetsLayoutComponent, typeof i12.MrSearchLayoutComponent, typeof i13.MrStaticLayoutComponent, typeof i14.MrTimelineLayoutComponent, typeof i15.ReadMoreComponent, typeof i16.MrFormComponent, typeof i17.MrFormWrapperAccordionComponent, typeof i18.MrSearchPageDescriptionComponent, typeof i19.MrResourceModalComponent, typeof i20.MrGalleryComponent, typeof i21.MrAdvancedResultComponent, typeof i22.MrMetadataDynamicComponent, typeof i23.MrInputTypeaheadComponent]>;
37
38
  static ɵinj: i0.ɵɵInjectorDeclaration<N7BoilerplateMurucaModule>;
38
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@net7/boilerplate-muruca",
3
- "version": "5.5.7",
3
+ "version": "5.5.9",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.11",
6
6
  "@angular/core": "^17.3.11"
@@ -0,0 +1,59 @@
1
+ /**
2
+ * INPUT TYPEAHEAD
3
+ *
4
+ * Text input with an inline autocomplete dropdown.
5
+ */
6
+
7
+ /* ------------------------------------ *\
8
+ #INPUT-TYPEAHEAD
9
+ \* ------------------------------------ */
10
+ .mr-input-typeahead {
11
+ position: relative;
12
+
13
+ &__dropdown {
14
+ position: absolute;
15
+ top: 100%;
16
+ left: 0;
17
+ right: 0;
18
+ z-index: 100;
19
+ margin: 0;
20
+ padding: calc($space / 2) 0;
21
+ list-style: none;
22
+ background: $color-background-base;
23
+ border: 1px solid $color-border-normal;
24
+ border-radius: $border-radius;
25
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
26
+ }
27
+
28
+ &__option {
29
+ padding: calc($space * 0.75) $space * 1.5;
30
+ border-radius: calc($border-radius / 2);
31
+ margin: 0 calc($space / 2);
32
+ cursor: pointer;
33
+ font-size: $font-size-m;
34
+ color: $color-text;
35
+
36
+ &:hover {
37
+ background: $color-background-light;
38
+ color: $color-text-link;
39
+ }
40
+
41
+ strong {
42
+ font-weight: $font-weight-bold;
43
+ }
44
+ }
45
+ }
46
+
47
+
48
+ /* ------------------------------------ *\
49
+ #MEDIA-QUERIES
50
+ \* ------------------------------------ */
51
+ @media all and (max-width: $breakpoint-ipad-portrait) {
52
+ }
53
+
54
+ @media all and (max-width: $breakpoint-smartphone-landscape) {
55
+ }
56
+
57
+ /* Retina */
58
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
59
+ }