ng-select2-component 15.2.1 → 16.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 +18 -0
- package/README.md +60 -45
- package/fesm2022/ng-select2-component.mjs +147 -22
- package/fesm2022/ng-select2-component.mjs.map +1 -1
- package/lib/select2-hint.component.d.ts.map +1 -1
- package/lib/select2-interfaces.d.ts +4 -0
- package/lib/select2-interfaces.d.ts.map +1 -1
- package/lib/select2-label.component.d.ts.map +1 -1
- package/lib/select2.component.d.ts +23 -3
- package/lib/select2.component.d.ts.map +1 -1
- package/package.json +5 -7
- package/esm2022/lib/select2-const.mjs +0 -48
- package/esm2022/lib/select2-hint.component.mjs +0 -11
- package/esm2022/lib/select2-interfaces.mjs +0 -2
- package/esm2022/lib/select2-label.component.mjs +0 -11
- package/esm2022/lib/select2-utils.mjs +0 -273
- package/esm2022/lib/select2.component.mjs +0 -1001
- package/esm2022/lib/select2.module.mjs +0 -23
- package/esm2022/ng-select2-component.mjs +0 -5
- package/esm2022/public_api.mjs +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog of ng-select2
|
|
2
2
|
|
|
3
|
+
## V16.0.0 (2024-11-27)
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- minimum required support has been upgraded to Angular `19.0`.
|
|
8
|
+
|
|
9
|
+
## V15.3.0 (2024-11-16)
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Add properties:
|
|
14
|
+
- `selectionOverride`: Change what is displayed in the selection area #79
|
|
15
|
+
- `selectionNoWrap`: Force selection on one line #79
|
|
16
|
+
- `showSelectAll`: Add an option to select all options c #80
|
|
17
|
+
- `selectAllText`: Text when all options as not selected #80
|
|
18
|
+
- `removeAllText`: Text when all options as selected #80
|
|
19
|
+
- Fix labels of selected options #81
|
|
20
|
+
|
|
3
21
|
## V15.2.1 (2024-08-22)
|
|
4
22
|
|
|
5
23
|
### Changes
|
package/README.md
CHANGED
|
@@ -14,11 +14,11 @@ npm i ng-select2-component --save
|
|
|
14
14
|
|
|
15
15
|
- peerDependencies:
|
|
16
16
|
|
|
17
|
-
- `angular`
|
|
18
|
-
- `angular/cdk`
|
|
17
|
+
- `angular` 19.0.0 and more
|
|
18
|
+
- `angular/cdk` 19.0.0 and more
|
|
19
19
|
|
|
20
20
|
- dependencies (include):
|
|
21
|
-
- `ngx-infinite-scroll`
|
|
21
|
+
- `ngx-infinite-scroll` 19.0.0 and more
|
|
22
22
|
|
|
23
23
|
> **Note:**<br>
|
|
24
24
|
>
|
|
@@ -28,9 +28,10 @@ npm i ng-select2-component --save
|
|
|
28
28
|
> - For `angular` 14 (Ivy): use version `10.0.0`.
|
|
29
29
|
> - For `angular` 15 (Ivy): use version `11.1.0`.
|
|
30
30
|
> - For `angular` 16 (Ivy): use version `12.1.0`.
|
|
31
|
-
> - For `angular` 16.1 (Ivy): use version `13.0.
|
|
31
|
+
> - For `angular` 16.1 (Ivy): use version `13.0.12`.
|
|
32
32
|
> - For `angular` 17 (Ivy): use version `14.0.1`.
|
|
33
|
-
> - For `angular` 18
|
|
33
|
+
> - For `angular` 18 (Ivy): use version `15.3.0`.
|
|
34
|
+
> - For `angular` 19 and more (Ivy): use version `16.0.0`.
|
|
34
35
|
|
|
35
36
|
## Demo
|
|
36
37
|
|
|
@@ -74,46 +75,58 @@ class MainModule {}
|
|
|
74
75
|
|
|
75
76
|
### properties and events of the component
|
|
76
77
|
|
|
77
|
-
| name | type | status | default | description
|
|
78
|
-
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------- |
|
|
79
|
-
| `data` | [`Select2Data`](#select2-data-structure) | required | | the data of the select2
|
|
80
|
-
| `value` | [`Select2Value`](#select2-data-structure) | | | initial value
|
|
81
|
-
| `minCharForSearch` | `number` | | `0` | start the search when the number of characters is reached (`0` = unlimited)
|
|
82
|
-
| `minCountForSearch` | `number` | | `6` | hide search box if `options.length < minCountForSearch`
|
|
83
|
-
| `displaySearchStatus` | `'default'`<br>`'hidden'`<br>`'always'` | | `'default'` | display the search box (`default` : is based on `minCountForSearch`)
|
|
84
|
-
| `placeholder` | `string` | | | the placeholder string if nothing selected
|
|
85
|
-
| `noResultMessage` | `string` | | | the message string if no results when using the search field
|
|
86
|
-
| `customSearchEnabled` | `boolean` | | `false` | will trigger `search` event, and disable inside filter
|
|
87
|
-
| `multiple` | `boolean` | | `false` | select multiple options
|
|
88
|
-
| `resettable` | `boolean` | | `false` | add a button to reset value
|
|
89
|
-
| `resetSelectedValue` | `any` | | `undefined` | selected option when × is clicked
|
|
90
|
-
| `autoCreate` | `boolean` | | `false` | gives the possibility to add elements not present in the list.
|
|
91
|
-
| `limitSelection` | `number` | | `0` | to limit multiple selection (`0` = unlimited)
|
|
92
|
-
| `hideSelectedItems` | `boolean` | | `false` | remove selected values
|
|
93
|
-
| `resultMaxHeight` | `string` | | `'200px'` | change the height size of results
|
|
94
|
-
| `maxResults` | `number` | | `0` | maximum results limit (`0` = unlimited)
|
|
95
|
-
| `maxResultsMessage` | `string` | | `'Too much result…'` | message when maximum result
|
|
96
|
-
| `grid` | `number` or `string` | | | option by line in grid layout (empty or `0` = no grid layout)<br
|
|
97
|
-
| `listPosition` | `'below'`<br>`'above'`<br>`'auto'` ¹ | | `'below'` | the position for the dropdown list
|
|
98
|
-
| `infiniteScroll` | `boolean` | | `false` | active infiniteScroll on dropdown list
|
|
99
|
-
| `infiniteScrollDistance` | `number` | | `1.5` | infiniteScroll distance
|
|
100
|
-
| `infiniteScrollThrottle` | `number` | | `150` | infiniteScroll throttle
|
|
101
|
-
| `overlay` | `boolean` | | `false` | active an overlay mode for dropdown list (with angular cdk). (See [Overlay](#overlay))
|
|
102
|
-
| `styleMode` | `'default'`<br>`'material'`<br>`'noStyle'`<br>`'borderless'` | | `'default'` | change style for material style or remove border and background color
|
|
103
|
-
| `templates` | `TemplateRef`<br>`{option?: TemplateRef, group?: TemplateRef}`<br>etc.<br>(see ”possible object” in [Templating](#templating)) | | | use templates for formatting content (see [Templating](#templating))
|
|
104
|
-
| `templateSelection` | `TemplateRef` | | | use templates for formatting content (see [Templating](#templating))
|
|
105
|
-
| `noLabelTemplate` | `boolean` | | `false` | do not use the template in the selection, stay in text mode
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `(
|
|
114
|
-
| `(
|
|
115
|
-
| `(
|
|
116
|
-
| `(
|
|
78
|
+
| name | type | status | default | description | required |
|
|
79
|
+
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
|
80
|
+
| `data` | [`Select2Data`](#select2-data-structure) | required | | the data of the select2 | |
|
|
81
|
+
| `value` | [`Select2Value`](#select2-data-structure) | | | initial value | |
|
|
82
|
+
| `minCharForSearch` | `number` | | `0` | start the search when the number of characters is reached (`0` = unlimited) | |
|
|
83
|
+
| `minCountForSearch` | `number` | | `6` | hide search box if `options.length < minCountForSearch` | |
|
|
84
|
+
| `displaySearchStatus` | `'default'`<br>`'hidden'`<br>`'always'` | | `'default'` | display the search box (`default` : is based on `minCountForSearch`) | |
|
|
85
|
+
| `placeholder` | `string` | | | the placeholder string if nothing selected | |
|
|
86
|
+
| `noResultMessage` | `string` | | | the message string if no results when using the search field | |
|
|
87
|
+
| `customSearchEnabled` | `boolean` | | `false` | will trigger `search` event, and disable inside filter | |
|
|
88
|
+
| `multiple` | `boolean` | | `false` | select multiple options | |
|
|
89
|
+
| `resettable` | `boolean` | | `false` | add a button to reset value | not `multiple` |
|
|
90
|
+
| `resetSelectedValue` | `any` | | `undefined` | selected option when × is clicked | not `multiple` and with `resettable` |
|
|
91
|
+
| `autoCreate` | `boolean` | | `false` | gives the possibility to add elements not present in the list. | |
|
|
92
|
+
| `limitSelection` | `number` | | `0` | to limit multiple selection (`0` = unlimited) | |
|
|
93
|
+
| `hideSelectedItems` | `boolean` | | `false` | remove selected values | with `multiple` |
|
|
94
|
+
| `resultMaxHeight` | `string` | | `'200px'` | change the height size of results | |
|
|
95
|
+
| `maxResults` | `number` | | `0` | maximum results limit (`0` = unlimited) | |
|
|
96
|
+
| `maxResultsMessage` | `string` | | `'Too much result…'` | message when maximum result | |
|
|
97
|
+
| `grid` | `number` or `string` | | | option by line in grid layout (empty or `0` = no grid layout)<br>`number`: item by line<br>`string`: minimal item width | |
|
|
98
|
+
| `listPosition` | `'below'`<br>`'above'`<br>`'auto'` ¹ | | `'below'` | the position for the dropdown list | ¹ `'auto'`: only with `overlay` |
|
|
99
|
+
| `infiniteScroll` | `boolean` | | `false` | active infiniteScroll on dropdown list | with `ngx-infinite-scroll` |
|
|
100
|
+
| `infiniteScrollDistance` | `number` | | `1.5` | infiniteScroll distance | with `ngx-infinite-scroll` |
|
|
101
|
+
| `infiniteScrollThrottle` | `number` | | `150` | infiniteScroll throttle | |
|
|
102
|
+
| `overlay` | `boolean` | | `false` | active an overlay mode for dropdown list (with angular cdk). (See [Overlay](#overlay)) | |
|
|
103
|
+
| `styleMode` | `'default'`<br>`'material'`<br>`'noStyle'`<br>`'borderless'` | | `'default'` | change style for material style or remove border and background color | |
|
|
104
|
+
| `templates` | `TemplateRef`<br>`{option?: TemplateRef, group?: TemplateRef}`<br>etc.<br>(see ”possible object” in [Templating](#templating)) | | | use templates for formatting content (see [Templating](#templating)) | |
|
|
105
|
+
| `templateSelection` | `TemplateRef` | | | use templates for formatting content (see [Templating](#templating)) | |
|
|
106
|
+
| `noLabelTemplate` | `boolean` | | `false` | do not use the template in the selection, stay in text mode | |
|
|
107
|
+
| `selectionOverride` | `string` or function ([`Select2SelectionOverride`](#select2-data-structure)) | | | Replace selection by a text<br>`string`: `%size%` = total selected options<br>`function`: juste show the string | |
|
|
108
|
+
| `selectionNoWrap` | `boolean` | | `false` | Force selection on one line | |
|
|
109
|
+
| `showSelectAll` | `boolean` | | `false` | Add an option to select all options | with `multiple` |
|
|
110
|
+
| `selectAllText` | `string` | | `'Select all'` | Text when all options as not selected | with `multiple` |
|
|
111
|
+
| `removeAllText` | `string` | | `'Remove all'` | Text when all options as selected | with `multiple` |
|
|
112
|
+
| `editPattern` | `(str: string) => string` | | | use it for change the pattern of the filter search | |
|
|
113
|
+
| `ngModel`<br>`id`<br>`required`<br>`disabled`<br>`readonly`<br>`tabIndex` | | | | just like a `select` control | |
|
|
114
|
+
| `(update)` | `(event: `[`Select2UpdateEvent`](#select2-data-structure)`) => void` | event | | triggered when user select an option | |
|
|
115
|
+
| `(open)` | `(event: Select2) => void` | event | | triggered when user open the options | |
|
|
116
|
+
| `(close)` | `(event: Select2) => void` | event | | triggered when user close the options | |
|
|
117
|
+
| `(focus)` | `(event: Select2) => void` | event | | triggered when user enters the component | |
|
|
118
|
+
| `(blur)` | `(event: Select2) => void` | event | | triggered when user leaves the component | |
|
|
119
|
+
| `(search)` | `(event: `[`Select2SearchEvent`](#select2-data-structure)`) => void` | event | | triggered when search text changed | with `customSearchEnabled` |
|
|
120
|
+
| `(scroll)` | `(event: `[`Select2ScrollEvent`](#select2-data-structure)`) => void` | event | | triggered when infiniteScroll is on `up` or `down` position | with `ngx-infinite-scroll` |
|
|
121
|
+
| `(removeOption)` | `(event: `[`Select2RemoveEvent`](#select2-data-structure)`) => void` | event | | triggered when an option is removed from the list of selected options options list | with `multiple` |
|
|
122
|
+
| `(autoCreateItem)` | `(event: `[`Select2AutoCreateEvent`](#select2-data-structure)`) => void` | event | | triggered when a new item has been added | with `autoCreate` |
|
|
123
|
+
|
|
124
|
+
@Input() selectionOverride: Select2SelectionOverride;
|
|
125
|
+
|
|
126
|
+
/** force selection on one line */
|
|
127
|
+
@HostBinding('class.select2-selection-nowrap')
|
|
128
|
+
@Input({ transform: booleanAttribute })
|
|
129
|
+
selectionNoWrap = false;
|
|
117
130
|
|
|
118
131
|
### select2 data structure
|
|
119
132
|
|
|
@@ -206,6 +219,8 @@ export interface Select2ScrollEvent {
|
|
|
206
219
|
/** current data */
|
|
207
220
|
readonly data: Select2Data;
|
|
208
221
|
}
|
|
222
|
+
|
|
223
|
+
export type Select2SelectionOverride = string | ((params: { size: number; options: Select2Option[] | null }) => string);
|
|
209
224
|
```
|
|
210
225
|
|
|
211
226
|
### Templating
|