@libs-ui/components-inputs-search 0.2.355-13 → 0.2.355-15

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.
Files changed (2) hide show
  1. package/README.md +125 -2
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # inputs-search
1
+ # Search Input Component
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ `@libs-ui/components-inputs-search` một thành phần nhập liệu chuyên dụng cho tính năng tìm kiếm. Nó được xây dựng dựa trên `LibsUiComponentsInputsInputComponent` và bổ sung các tính năng như tự động kích hoạt tìm kiếm sau một khoảng thời gian chờ (debounce), nút xóa nội dung tìm kiếm nhanh, và hỗ trợ các biểu tượng tùy chỉnh.
4
+
5
+ ## Tính năng nổi bật
6
+
7
+ - 🔍 **Auto-complete Search**: Tự động phát ra sự kiện tìm kiếm sau khi người dùng ngừng nhập (mặc định 1 giây).
8
+ - ⚡ **Debounce & Throttle**: Tích hợp sẵn cơ chế debounce cho việc nhập liệu và throttle cho phím Enter.
9
+ - 🧹 **Clearable Support**: Hỗ trợ nút xóa (`hasClearSearch`) xuất hiện khi có nội dung trong ô tìm kiếm.
10
+ - 🎨 **Flexible Styling**: Dễ dàng tùy chỉnh border, background, chiều cao và các class CSS bổ sung.
11
+ - ⌨️ **Keyboard Support**: Hỗ trợ phím Enter để kích hoạt tìm kiếm ngay lập tức.
12
+ - 🛡️ **Signal Based**: Hoạt động mượt mà với Angular Signals.
13
+
14
+ ## Cài đặt
15
+
16
+ Sử dụng npm hoặc yarn để cài đặt:
17
+
18
+ ```bash
19
+ npm install @libs-ui/components-inputs-search
20
+ ```
21
+
22
+ ## Cách sử dụng
23
+
24
+ ### Import Module
25
+
26
+ ```typescript
27
+ import { LibsUiComponentsInputsSearchComponent } from '@libs-ui/components-inputs-search';
28
+
29
+ @Component({
30
+ standalone: true,
31
+ imports: [LibsUiComponentsInputsSearchComponent],
32
+ // ...
33
+ })
34
+ export class YourComponent {}
35
+ ```
36
+
37
+ ### Ví dụ cơ bản
38
+
39
+ ```html
40
+ <libs_ui-components-inputs-search
41
+ (outSearch)="onSearch($event)"
42
+ [searchConfig]="{
43
+ placeholder: 'Tìm kiếm khách hàng...',
44
+ hasClearSearch: true
45
+ }"></libs_ui-components-inputs-search>
46
+ ```
47
+
48
+ ### Tùy chỉnh Debounce và Icon
49
+
50
+ ```html
51
+ <libs_ui-components-inputs-search
52
+ [debounceTime]="500"
53
+ [searchConfig]="{
54
+ iconLeftClass: 'libs-ui-icon-filter',
55
+ placeholder: 'Lọc nhanh...'
56
+ }"
57
+ (outSearch)="handleFastFilter($event)"></libs_ui-components-inputs-search>
58
+ ```
59
+
60
+ ## API Reference
61
+
62
+ ### Inputs
63
+
64
+ | Thuộc tính | Kiểu dữ liệu | Mặc định | Mô tả |
65
+ | :------------------- | :------------------- | :------- | :-------------------------------------------------------- |
66
+ | `searchConfig` | `IInputSearchConfig` | `{}` | Cấu hình cho ô tìm kiếm (placeholder, value, icons, ...). |
67
+ | `disable` | `boolean` | `false` | Vô hiệu hóa ô tìm kiếm. |
68
+ | `readonly` | `boolean` | `false` | Chế độ chỉ đọc. |
69
+ | `debounceTime` | `number` | `1000` | Thời gian chờ (ms) trước khi phát ra `outSearch`. |
70
+ | `ignoreAutoComplete` | `boolean` | `false` | Nếu true, sẽ không tự động emit `outSearch`. |
71
+
72
+ ### Outputs
73
+
74
+ | Sự kiện | Kiểu dữ liệu | Mô tả |
75
+ | :-------------------- | :--------------------------- | :--------------------------------------------------------------------------- |
76
+ | `outSearch` | `string` | Phát ra nội dung tìm kiếm sau khoảng thời gian debounce hoặc khi nhấn Enter. |
77
+ | `outValueChange` | `string` | Phát ra nội dung mới ngay lập tức mỗi khi gõ phím. |
78
+ | `outIconLeft` | `string` | Sự kiện khi click vào icon bên trái. |
79
+ | `outIconRight` | `string` | Sự kiện khi click vào icon bên phải. |
80
+ | `outFunctionsControl` | `IInputFunctionControlEvent` | Cung cấp các phương thức điều khiển (focus, blur, ...). |
81
+
82
+ ## Types & Interfaces
83
+
84
+ ### IInputSearchConfig
85
+
86
+ Giao diện cấu hình toàn diện cho component Search.
87
+
88
+ ```typescript
89
+ export interface IInputSearchConfig {
90
+ classInclude?: string;
91
+ classContainerInput?: string;
92
+ placeholder?: string;
93
+ value?: string;
94
+ noBorder?: boolean;
95
+ backgroundNone?: boolean;
96
+ iconLeftClass?: string;
97
+ iconRightClass?: string;
98
+ defaultHeight?: number;
99
+ classCoverInputSearch?: string;
100
+ hasClearSearch?: boolean;
101
+ popoverContentIconRight?: string;
102
+ }
103
+ ```
104
+
105
+ ### IInputFunctionControlEvent
106
+
107
+ Được kế thừa từ component Input cơ bản để điều khiển hành vi.
108
+
109
+ ```typescript
110
+ export interface IInputFunctionControlEvent {
111
+ focus: (emitEvent?: boolean) => Promise<void>;
112
+ blur: (emitEvent?: boolean) => Promise<void>;
113
+ resetValue: () => Promise<void>;
114
+ insertContent: (data: string | number) => Promise<void>;
115
+ // ... and other methods from @libs-ui/components-inputs-input
116
+ }
117
+ ```
118
+
119
+ ## Tech Stack
120
+
121
+ - **Core**: Angular 18+, RxJS (Subject, debounceTime, throttleTime)
122
+ - **Base**: `@libs-ui/components-inputs-input`
123
+
124
+ ## License
125
+
126
+ MIT
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@libs-ui/components-inputs-search",
3
- "version": "0.2.355-13",
3
+ "version": "0.2.355-15",
4
4
  "peerDependencies": {
5
5
  "@angular/core": ">=18.0.0",
6
- "@libs-ui/components-inputs-input": "0.2.355-13",
7
- "@libs-ui/interfaces-types": "0.2.355-13",
6
+ "@libs-ui/components-inputs-input": "0.2.355-15",
7
+ "@libs-ui/interfaces-types": "0.2.355-15",
8
8
  "@ngx-translate/core": "^15.0.0",
9
9
  "rxjs": "~7.8.0"
10
10
  },