@sourceloop/search-element 9.0.0 → 11.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,120 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [11.0.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@10.0.0...@sourceloop/search-element@11.0.0) (2025-12-30)
7
+
8
+ ### Features
9
+
10
+ - **deps:** angular version upgrade and converted into workspace ([#65](https://github.com/sourcefuse/arc-ng-components/issues/65)) ([54dfe07](https://github.com/sourcefuse/arc-ng-components/commit/54dfe07c3834b206d4115f7932d9220ce2c73c44)), closes [#64](https://github.com/sourcefuse/arc-ng-components/issues/64)
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - **deps:** YES
15
+
16
+ ## Description
17
+
18
+ This pull request introduces significant refactoring and modernization
19
+ of the `SearchComponent` in the `search-lib` package, focusing on
20
+ adopting Angular's new signal-based inputs/outputs, streamlining
21
+ configuration management, and improving testability. Additionally, it
22
+ includes workspace and dependency updates at the root level, and some
23
+ cleanup of outdated scripts and files.
24
+
25
+ # [10.0.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@9.0.1...@sourceloop/search-element@10.0.0) (2025-12-11)
26
+
27
+ ### Features
28
+
29
+ - **search-client:** add support for angular v21 ([#52](https://github.com/sourcefuse/arc-ng-components/issues/52)) ([26486e8](https://github.com/sourcefuse/arc-ng-components/commit/26486e8c683f63e37b29e7a41bb9c806f9ffc90c)), closes [#50](https://github.com/sourcefuse/arc-ng-components/issues/50)
30
+
31
+ ### BREAKING CHANGES
32
+
33
+ - **search-client:** YES
34
+
35
+ ## Description
36
+
37
+ This pull request upgrades the Angular dependencies for the search
38
+ module and related packages from Angular v20 to Angular v21. It also
39
+ updates the deprecation notice in documentation to reflect this new
40
+ support window.
41
+
42
+ ## [9.0.1](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@9.0.0...@sourceloop/search-element@9.0.1) (2025-12-10)
43
+
44
+ **Note:** Version bump only for package @sourceloop/search-element
45
+
46
+ # [9.0.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@8.0.1...@sourceloop/search-element@9.0.0) (2025-12-09)
47
+
48
+ ### Features
49
+
50
+ - **deps:** add support for angular v20 ([#49](https://github.com/sourcefuse/arc-ng-components/issues/49)) ([3ef0a0f](https://github.com/sourcefuse/arc-ng-components/commit/3ef0a0fdb0e3de05c1645e9e55f2de1069bfc6fe)), closes [#48](https://github.com/sourcefuse/arc-ng-components/issues/48)
51
+
52
+ ### BREAKING CHANGES
53
+
54
+ - **deps:** YES
55
+
56
+ ## [8.0.1](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@8.0.0...@sourceloop/search-element@8.0.1) (2025-12-09)
57
+
58
+ **Note:** Version bump only for package @sourceloop/search-element
59
+
60
+ # [8.0.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@6.1.0...@sourceloop/search-element@8.0.0) (2025-12-09)
61
+
62
+ ### Documentation
63
+
64
+ - **search-client:** update readme after upgrading to angular 17 ([#34](https://github.com/sourcefuse/arc-ng-components/issues/34)) ([2471785](https://github.com/sourcefuse/arc-ng-components/commit/247178534a7c5a4561fd54d38f19412e3b58beac)), closes [#30](https://github.com/sourcefuse/arc-ng-components/issues/30) [#30](https://github.com/sourcefuse/arc-ng-components/issues/30)
65
+
66
+ ### Features
67
+
68
+ - **deps:** adds support for Angular 19 and migrates the component to a fully standalone structure ([#45](https://github.com/sourcefuse/arc-ng-components/issues/45)) ([8f7f7e3](https://github.com/sourcefuse/arc-ng-components/commit/8f7f7e3f46c3edefd87877bf886db7eb31716435)), closes [#42](https://github.com/sourcefuse/arc-ng-components/issues/42)
69
+ - **sandbox:** add ai-assistant sandbox example in package ([#22](https://github.com/sourcefuse/arc-ng-components/issues/22)) ([cfa4d20](https://github.com/sourcefuse/arc-ng-components/commit/cfa4d20bc9fc4fa93dbaf31b6a68ebe9a9f326ee))
70
+
71
+ ### BREAKING CHANGES
72
+
73
+ - **deps:** YES
74
+
75
+ ## Description
76
+
77
+ This pull request modernizes the `@sourceloop/search-client` library and
78
+ its example by upgrading to Angular 19, refactoring the search component
79
+ to be standalone, and updating documentation and configuration to
80
+ reflect these changes. The updates simplify integration for consumers
81
+ and leverage Angular's latest features for improved modularity and
82
+ maintainability.
83
+
84
+ - **search-client:**
85
+
86
+ # [7.0.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@6.1.0...@sourceloop/search-element@7.0.0) (2025-07-18)
87
+
88
+ ### Documentation
89
+
90
+ - **search-client:** update readme after upgrading to angular 17 ([#34](https://github.com/sourcefuse/arc-ng-components/issues/34)) ([2471785](https://github.com/sourcefuse/arc-ng-components/commit/247178534a7c5a4561fd54d38f19412e3b58beac)), closes [#30](https://github.com/sourcefuse/arc-ng-components/issues/30) [#30](https://github.com/sourcefuse/arc-ng-components/issues/30)
91
+
92
+ ### Features
93
+
94
+ - **sandbox:** add ai-assistant sandbox example in package ([#22](https://github.com/sourcefuse/arc-ng-components/issues/22)) ([cfa4d20](https://github.com/sourcefuse/arc-ng-components/commit/cfa4d20bc9fc4fa93dbaf31b6a68ebe9a9f326ee))
95
+
96
+ ### BREAKING CHANGES
97
+
98
+ - **search-client:**
99
+
100
+ # [6.1.0](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@6.0.1...@sourceloop/search-element@6.1.0) (2024-04-10)
101
+
102
+ ### Features
103
+
104
+ - **search-client:** allow custom allLabel ([#15](https://github.com/sourcefuse/arc-ng-components/issues/15)) ([8b45291](https://github.com/sourcefuse/arc-ng-components/commit/8b4529171ea587ff2fd8c733ccd50a819491fe47)), closes [#14](https://github.com/sourcefuse/arc-ng-components/issues/14)
105
+
106
+ ## [6.0.1](https://github.com/sourcefuse/arc-ng-components/compare/@sourceloop/search-element@6.0.0...@sourceloop/search-element@6.0.1) (2024-01-12)
107
+
108
+ ### Bug Fixes
109
+
110
+ - **search-client:** refactor the SCSS file in the search component to remove 'important' keyword ([#12](https://github.com/sourcefuse/arc-ng-components/issues/12)) ([1324f19](https://github.com/sourcefuse/arc-ng-components/commit/1324f194f3b3405505137d4a5919547195143175))
111
+
112
+ # 6.0.0 (2023-11-28)
113
+
114
+ ### Features
115
+
116
+ - **deps:** add support for angular v14 ([#10](https://github.com/sourcefuse/arc-ng-components/issues/10)) ([acdb006](https://github.com/sourcefuse/arc-ng-components/commit/acdb006dc782f04283d0ce7e4335781e2f5360e3)), closes [#9](https://github.com/sourcefuse/arc-ng-components/issues/9) [#9](https://github.com/sourcefuse/arc-ng-components/issues/9)
117
+
118
+ ### BREAKING CHANGES
119
+
120
+ - **deps:** search library does not support angular v13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourceloop/search-element",
3
- "version": "9.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "A global search element for search microservice. ",
5
5
  "main": "./search-element.js",
6
6
  "private": false,
@@ -19,6 +19,5 @@
19
19
  },
20
20
  "author": "Sourcefuse",
21
21
  "license": "MIT",
22
- "hash": "adbe715646a8cbd3ab73a84fcfbb804c861817bdfd7f3d407aa86efb0aa5f0f0",
23
- "gitHead": "b50931d75a9a3e6ffa57091c7f4f286ce24cde56"
22
+ "hash": "6dd267d252bfc75383c89775926b88227dcc444d771549ac9d72b6871f6577dc"
24
23
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [2023] [SourceFuse]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,244 +0,0 @@
1
- # Search Library
2
-
3
- An Angular module that exports a component that can enable users to search over configured models using the search microservice provided in the sourceloop microservice catalog.
4
-
5
- ### Deprecation Notice
6
-
7
- Search-client now supports Angular v19, we will provide support for the older version that is based on Angular v19 till 30th
8
- June 2026 .
9
-
10
- ## Angular Module
11
-
12
- ### Installation
13
-
14
- ```sh
15
- npm i @sourceloop/search-client
16
- ```
17
-
18
- ### Usage
19
-
20
- Create a new Application using Angular CLI and import the `SearchComponent` in your application.SearchComponent is now a standalone component, so no NgModule is required.Also create a new service that implements the ISearchService interface exported by the search library. This service will be used by the exported component to make API calls whenever needed. You will have to update the providers section of your module with { provide: SEARCH_SERVICE_TOKEN, useExisting: Your_Service_Name }
21
-
22
- ```ts
23
- import { Component } from '@angular/core';
24
- import { SearchComponent, SEARCH_SERVICE_TOKEN } from '@sourceloop/search-client';
25
- import { SearchService } from './search.service';
26
-
27
- @Component({
28
- selector: 'app-root',
29
- standalone: true,
30
- imports: [SearchComponent],
31
- templateUrl: './app.component.html',
32
- providers: [{ provide: SEARCH_SERVICE_TOKEN, useClass: SearchService }],
33
- })
34
- export class AppComponent {}
35
- ```
36
-
37
- ### Search Service
38
-
39
- Create a new service using the Angular CLI. This service should implement ISearchService. You will have to implement searchApiRequest method which should return Observable<T[]>. Here T refers to the type of data returned from the search microservice. If you are using the default settings for the search microservice you can use IDefaultReturnType interface, else you need to pass your own return type interface.
40
- searchApiRequest receives two parameters - requestParameters: ISearchQuery, saveInRecents: boolean,
41
-
42
- ```ts
43
- export interface ISearchQuery {
44
- match: string;
45
- limit: number | null;
46
- order: string | null;
47
- limitByType: boolean | null;
48
- offset: number | null;
49
- sources: string[] | null;
50
- }
51
- ```
52
-
53
- Implementing the recentSearchApiRequest method is optional and its implementation depends on if you want recent search functionality as a part of the search suggestions dropdown
54
-
55
- ### Configuration
56
-
57
- You need to provide some configuration for using the search component using its selector - '<sourceloop-search></sourceloop-search>'
58
- This can be provided as an Object of Configuration type as input to the component. To do so, create a property/field in your component of type Configuration<IDefaultReturnType> (IDefaultReturnType can be replaced by your own return type interface). In the constructor initialize the Configuration object with the following properties:
59
-
60
- - **displayPropertyName (keyof IDefaultReturnType/Your_Return_Type) :** This is one of the properties returned by the search microservice. It is the property whose value will be displayed in the search dropdown.
61
- - **models ( Array<IModel>) :** You need to provide the list of models you used in your search microservice. You also need to provide the displayName for each Model, this will be used in the search dropdown and categorize button dropdown.
62
-
63
- Apart from these there are some optional properties that you can give:
64
-
65
- - **limit (number) :** The number of results you want to display. Default value is 20.
66
- - **limitByType (boolean) :** Option to put limit on basis of model. Default value is false.
67
- - **order (Array<string>) :** Array of strings that specify the order format for the request sent to search API. Example, you want your results to be sorted on basis of name property first and then description. In this case you can give order = ["name ASC", "description DESC"]. By default order = []
68
- - **offset (number) :** Number of matched results to skip. Default is 0.
69
- - **saveInRecents (boolean) :** Option for saving the search results of the user. Default value is true.
70
- - **categorizeResults (boolean) :** Option for displaying results in search dropdown according to the Model they come from. Default value is true.
71
- - **hideRecentSearch (boolean) :** Option to provide recent search functionality. Default value is false.
72
- - **hideCategorizeButton (boolean) :** Option to hide the categorize button on the right of search dropdown. Default is false.
73
- - **saveInRecentsOnlyOnEnter (boolean) :** Option to save search query in recent searches only when user presses enter key or changes the category he/she is searching on. Default value is false.
74
- - **searchOnlyOnEnter (boolean) :** Option to call API to display search results only when user presses enter key. Default value is false.
75
- - **noResultMessage (string) :** Message to display in dropdown incase no matching result found.
76
- - **searchIconClass (string) :** Can be used to give custom icon for search in search bar.
77
- - **crossIconClass (string) :** Can be used to give custom icon for clearing text input in search bar.
78
- - **dropDownButtonIconClass (string) :** Can be used to give custom icon for category drop down button.
79
- - **recentSearchIconClass (string) :** Can be used to give custom icon for recent searches displayed in the search dropdown.
80
-
81
- Your component might look something like
82
-
83
- ```ts
84
- export class XComponent implements OnInit {
85
- config: Configuration<IDefaultReturnType>;
86
-
87
- constructor(private fb: FormBuilder) {
88
- this.config = new Configuration<IDefaultReturnType>({
89
- displayPropertyName: 'name',
90
- models: [
91
- {
92
- name: 'ToDo',
93
- displayName: 'List',
94
- },
95
- {
96
- name: 'User',
97
- displayName: 'Users',
98
- imageUrl: 'https://picsum.photos/id/1/50',
99
- },
100
- ],
101
- order: [`name ASC`, `description DESC`],
102
- });
103
- }
104
-
105
- ngOnInit(): void {}
106
- }
107
- ```
108
-
109
- Now in your template you can add the search library component selector like
110
-
111
- ```ts
112
- <sourceloop-search [config]="config" [(ngModel)]="value"></sourceloop-search>
113
- ```
114
-
115
- You can access the value in the search input using [(ngModel)]. You can also listen to clicked and searched events.
116
- Clicked event is of type ItemClickedEvent. It is emitted when user clicks one of the suggested results. Searched event is emitted when request is made to the api when user types and relevant suggestinons are displayed. It is of type RecentSearchEvent.
117
-
118
- ```ts
119
- type ItemClickedEvent<T> = {
120
- event: MouseEvent;
121
- item: T;
122
- };
123
-
124
- type RecentSearchEvent = {
125
- event: KeyboardEvent | Event;
126
- keyword: string;
127
- category: 'All' | IModel;
128
- };
129
- ```
130
-
131
- ```html
132
- <sourceloop-search
133
- [config]="config"
134
- [(ngModel)]="value"
135
- (clicked)="logItemClickedEvent($event)"
136
- (searched)="logRecentSearchEvent($event)"
137
- disabled="false"
138
- ></sourceloop-search>
139
- ```
140
-
141
- ### Icons
142
-
143
- To use the default icons you will have to import the following in your styles.scss:
144
-
145
- ```
146
- @import '../node_modules/@sourceloop/search-client/assets/icomoon/style.css';
147
- ```
148
-
149
- You can also choose to use your own icons by providing classes for icons in the configuration.
150
-
151
- ## Web Component
152
-
153
- This library is also available as a [Web Component](https://developer.mozilla.org/en-US/docs/Web/Web_Components) so users of frameworks like React and Vue can also integrate this search element in their application with minimal effort.
154
-
155
- ### Installation
156
-
157
- ```sh
158
- npm i @sourceloop/search-client
159
- ```
160
-
161
- In the node modules you can find two files relevant to the element - `element/search-element.js` and `element/style.css`. How you serve and include these files in your non Angular project depend on the framework that you are using. For example, for Vanilla JS and HTML you can simply import the js and styles in your HTML ->
162
-
163
- ```html
164
- <script type="text/javascript" src="search-element.js"></script>
165
- ```
166
-
167
- ### Usage
168
-
169
- The web component accepts all the same inputs and services as the regular Angular Module, but instead of passing them through bindings and DI, you pass them as properties of the element as shown below.
170
-
171
- ```html
172
- <!DOCTYPE html>
173
- <html>
174
- <head>
175
- ...
176
- <link rel="stylesheet" href="assets/icomoon/style.css" />
177
- <link rel="stylesheet" href="styles.css" />
178
- ...
179
- </head>
180
- <body>
181
- <sourceloop-search-element></sourceloop-search-element>
182
- <script type="text/javascript" src="search-element.js"></script>
183
- <script>
184
- document.addEventListener('DOMContentLoaded', () => {
185
- const element = document.querySelector('sourceloop-search-element');
186
- // Code to set inputs of the component
187
- element.searchProvider = {
188
- searchApiRequestWithPromise: () =>
189
- Promise.resolve([
190
- {
191
- name: 'Test',
192
- description: 'Test',
193
- rank: 0.4,
194
- source: 'ToDo',
195
- },
196
- {
197
- name: 'Akshat',
198
- description: 'Dubey',
199
- rank: 0.4,
200
- source: 'User',
201
- },
202
- ]),
203
- recentSearchApiRequestWithPromise: () => Promise.resolve([]),
204
- };
205
- element.config = new SearchConfiguration({
206
- displayPropertyName: 'name',
207
- models: [
208
- {
209
- name: 'ToDo',
210
- displayName: 'List',
211
- imageUrl: 'https://picsum.photos/id/1000/50',
212
- },
213
- {
214
- name: 'User',
215
- displayName: 'Users',
216
- imageUrl: 'https://picsum.photos/id/1/50',
217
- },
218
- ],
219
- order: [`name ASC`, `description DESC`],
220
- hideCategorizeButton: false,
221
- placeholder: 'Search Programs, Projects or Dashboards',
222
- categorizeResults: true,
223
- saveInRecents: true,
224
- limit: 4,
225
- });
226
- });
227
- </script>
228
- </body>
229
- </html>
230
- ```
231
-
232
- Note that the instance of `SearchService` passed to the element is following a different interface -
233
-
234
- ```ts
235
- export interface ISearchServiceWithPromises<T extends IReturnType> {
236
- searchApiRequestWithPromise(
237
- requestParameters: ISearchQuery,
238
- saveInRecents: boolean,
239
- ): Promise<T[]>;
240
- recentSearchApiRequestWithPromise?(): Promise<ISearchQuery[]>;
241
- }
242
- ```
243
-
244
- This facilitates the use of the `Web Component` without relying on [rxjs](https://rxjs.dev/). You can still use the `Observable` based service if you want by importing the rxjs library manually.