ng-select2-component 11.0.0 → 11.1.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog of ng-select2
2
2
 
3
+ ## V11.1.0 (2023-04-15)
4
+
5
+ ### Breaking Changes
6
+
7
+ - By default the template is now used in the selection. To revert to previous behavior use `noLabelTemplate`.
8
+ - Code removal for IE11 and Edge
9
+
10
+ ### Changes
11
+
12
+ - add `noLabelTemplate`: do not use the template in the selection, stay in text mode.
13
+ - add `autoCreate`: gives the possibility to add elements not present in the list. #48
14
+ - add CSS variables : `--select2-single-height`, `--select2-multiple-height`
15
+
3
16
  ## V11.0.0 (2023-04-06)
4
17
 
5
18
  ### Breaking Changes
package/README.md CHANGED
@@ -21,11 +21,12 @@ npm i ng-select2-component --save
21
21
  - `ngx-infinite-scroll@^15.0.0`
22
22
 
23
23
  > **Note:**<br>
24
- > * For `angular` 7, 8 and 9 (View Engine): use version `7.3.1`.
25
- > * For `angular` 10, 11 and 12 (View Engine): use version `8.1.0`.
26
- > * For `angular` 13 (Ivy): use version `9.0.0`.
27
- > * For `angular` 14 (Ivy): use version `10.0.0`.
28
- > * For `angular` 15 and more (Ivy): use version `11.0.0`.
24
+ >
25
+ > - For `angular` 7, 8 and 9 (View Engine): use version `7.3.1`.
26
+ > - For `angular` 10, 11 and 12 (View Engine): use version `8.1.0`.
27
+ > - For `angular` 13 (Ivy): use version `9.0.0`.
28
+ > - For `angular` 14 (Ivy): use version `10.0.0`.
29
+ > - For `angular` 15 and more (Ivy): use version `11.0.0`.
29
30
 
30
31
  ## Demo
31
32
 
@@ -43,6 +44,7 @@ npm i ng-select2-component --save
43
44
  - hide search box
44
45
  - placeholder
45
46
  - multiple selection
47
+ - add items not found in multiple
46
48
  - material style
47
49
  - form binding
48
50
  - templating
@@ -68,40 +70,42 @@ class MainModule {}
68
70
 
69
71
  ### properties and events of the component
70
72
 
71
- | name | type | status | default | description |
72
- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------------------------------------------------------------------------------------- |
73
- | `data` | [`Select2Data`](#select2-data-structure) | required | | the data of the select2 |
74
- | `value` | [`Select2Value`](#select2-data-structure) | | | initial value |
75
- | `minCharForSearch` | `number` | | `0` | start the search when the number of characters is reached (`0` = unlimited) |
76
- | `minCountForSearch` | `number` | | `6` | hide search box if `options.length < minCountForSearch` |
77
- | `displaySearchStatus` | `'default'`<br>`'hidden'`<br>`'always'` | | `'default'` | display the search box (`default` : is based on `minCountForSearch`) |
78
- | `placeholder` | `string` | | | the placeholder string if nothing selected |
79
- | `noResultMessage` | `string` | | | the message string if no results when using the search field |
80
- | `customSearchEnabled` | `boolean` | | `false` | will trigger `search` event, and disable inside filter |
81
- | `multiple` | `boolean` | | `false` | select multiple options |
82
- | `resettable` | `boolean` | | `false` | add a button to reset value (not with `multiple`) |
83
- | `limitSelection` | `number` | | `0` | to limit multiple selection (`0` = unlimited) |
84
- | `hideSelectedItems` | `boolean` | | `false` | for `multiple`, remove selected values |
85
- | `resultMaxHeight` | `string` | | `'200px'` | change the height size of results |
86
- | `maxResults` | `number` | | `0` | maximum results limit (`0` = unlimited)s |
87
- | `maxResultsMessage` | `string` | | `'Too much result…'` | message when maximum result |
88
- | `listPosition` | `'below'`<br>`'above'`<br>`'auto'` \* | | `'below'` | the position for the dropdown list<br> \* `'auto'`: only with `overlay` |
89
- | `infiniteScroll` | `boolean` | | `false` | active infiniteScroll on dropdown list ( with `ngx-infinite-scroll`) |
90
- | `infiniteScrollDistance` | `number` | | `1.5` | infiniteScroll distance |
91
- | `infiniteScrollThrottle` | `number` | | `150` | infiniteScroll throttle |
92
- | `overlay` | `boolean` | | `false` | active an overlay mode for dropdown list (with angular cdk). (See [Overlay](#overlay)) |
93
- | `styleMode` | `'default'`<br>`'material'`<br>`'noStyle'` | | `'default'` | change style for material style or remove border and background color |
94
- | `templates` | `TemplateRef`<br>`{option?: TemplateRef, group?: TemplateRef}`<br>`{templateId1: TemplateRef, ...}` | | | use templates for formatting content (see [Templating](#templating)) |
95
- | `editPattern` | `(str: string) => string` | | | use it for change the pattern of the filter search |
96
- | `ngModel`<br>`id`<br>`required`<br>`disabled`<br>`readonly`<br>`tabIndex` | | | | just like a `select` control |
97
- | `(update)` | `(event: `[`Select2UpdateEvent`](#select2-data-structure)`) => void` | event | | triggered when user select an option |
98
- | `(open)` | `(event: Select2) => void` | event | | triggered when user open the options |
99
- | `(close)` | `(event: Select2) => void` | event | | triggered when user close the options |
100
- | `(focus)` | `(event: Select2) => void` | event | | triggered when user enters the component |
101
- | `(blur)` | `(event: Select2) => void` | event | | triggered when user leaves the component |
102
- | `(search)` | `(event: `[`Select2SearchEvent`](#select2-data-structure)`) => void` | event | | triggered when search text changed |
103
- | `(scroll)` | `(event: `[`Select2ScrollEvent`](#select2-data-structure)`) => void` | event | | triggered when infiniteScroll is on `up` or `down` position |
104
- | `(removedOption)` | `(event: `[`Select2RemoveEvent`](#select2-data-structure)`) => void` | event | | for `multiple`, triggered when an option is removed from the list of selected options options list |
73
+ | name | type | status | default | description | required |
74
+ | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------------------------------------------------------------------------- | ----------------------------- |
75
+ | `data` | [`Select2Data`](#select2-data-structure) | required | | the data of the select2 | |
76
+ | `value` | [`Select2Value`](#select2-data-structure) | | | initial value | |
77
+ | `minCharForSearch` | `number` | | `0` | start the search when the number of characters is reached (`0` = unlimited) | |
78
+ | `minCountForSearch` | `number` | | `6` | hide search box if `options.length < minCountForSearch` | |
79
+ | `displaySearchStatus` | `'default'`<br>`'hidden'`<br>`'always'` | | `'default'` | display the search box (`default` : is based on `minCountForSearch`) | |
80
+ | `placeholder` | `string` | | | the placeholder string if nothing selected | |
81
+ | `noResultMessage` | `string` | | | the message string if no results when using the search field | |
82
+ | `customSearchEnabled` | `boolean` | | `false` | will trigger `search` event, and disable inside filter | |
83
+ | `multiple` | `boolean` | | `false` | select multiple options | |
84
+ | `resettable` | `boolean` | | `false` | add a button to reset value | not `multiple` |
85
+ | `autoCreate` | `boolean` | | `false` | gives the possibility to add elements not present in the list. | with `multiple` |
86
+ | `limitSelection` | `number` | | `0` | to limit multiple selection (`0` = unlimited) | |
87
+ | `hideSelectedItems` | `boolean` | | `false` | remove selected values | with `multiple` |
88
+ | `resultMaxHeight` | `string` | | `'200px'` | change the height size of results | |
89
+ | `maxResults` | `number` | | `0` | maximum results limit (`0` = unlimited) | |
90
+ | `maxResultsMessage` | `string` | | `'Too much result…'` | message when maximum result | |
91
+ | `listPosition` | `'below'`<br>`'above'`<br>`'auto'` \* | | `'below'` | the position for the dropdown list | `'auto'`: only with `overlay` |
92
+ | `infiniteScroll` | `boolean` | | `false` | active infiniteScroll on dropdown list | with `ngx-infinite-scroll` |
93
+ | `infiniteScrollDistance` | `number` | | `1.5` | infiniteScroll distance | with `ngx-infinite-scroll` |
94
+ | `infiniteScrollThrottle` | `number` | | `150` | infiniteScroll throttle | |
95
+ | `overlay` | `boolean` | | `false` | active an overlay mode for dropdown list (with angular cdk). (See [Overlay](#overlay)) | |
96
+ | `styleMode` | `'default'`<br>`'material'`<br>`'noStyle'` | | `'default'` | change style for material style or remove border and background color | |
97
+ | `templates` | `TemplateRef`<br>`{option?: TemplateRef, group?: TemplateRef}`<br>`{templateId1: TemplateRef, ...}` | | | use templates for formatting content (see [Templating](#templating)) | |
98
+ | `noLabelTemplate` | `boolean` | | `false` | do not use the template in the selection, stay in text mode | |
99
+ | `editPattern` | `(str: string) => string` | | | use it for change the pattern of the filter search | |
100
+ | `ngModel`<br>`id`<br>`required`<br>`disabled`<br>`readonly`<br>`tabIndex` | | | | just like a `select` control | |
101
+ | `(update)` | `(event: `[`Select2UpdateEvent`](#select2-data-structure)`) => void` | event | | triggered when user select an option | |
102
+ | `(open)` | `(event: Select2) => void` | event | | triggered when user open the options | |
103
+ | `(close)` | `(event: Select2) => void` | event | | triggered when user close the options | |
104
+ | `(focus)` | `(event: Select2) => void` | event | | triggered when user enters the component | |
105
+ | `(blur)` | `(event: Select2) => void` | event | | triggered when user leaves the component | |
106
+ | `(search)` | `(event: `[`Select2SearchEvent`](#select2-data-structure)`) => void` | event | | triggered when search text changed | with `customSearchEnabled` |
107
+ | `(scroll)` | `(event: `[`Select2ScrollEvent`](#select2-data-structure)`) => void` | event | | triggered when infiniteScroll is on `up` or `down` position | with `ngx-infinite-scroll` |
108
+ | `(removedOption)` | `(event: `[`Select2RemoveEvent`](#select2-data-structure)`) => void` | event | | triggered when an option is removed from the list of selected options options list | with `multiple` |
105
109
 
106
110
  ### select2 data structure
107
111
 
@@ -240,12 +244,16 @@ If the overlay mode is used / activated, add to the project root in CSS (with `V
240
244
  @import '~@angular/cdk/overlay-prebuilt.css';
241
245
  ```
242
246
 
243
- ## CSS variables (doesn't work on IE11)
247
+ ## CSS variables
244
248
 
245
249
  It's possible to change different colors (and more) with CSS variables without having to modify them with `::ng-deep` or other CSS rules :
246
250
 
247
251
  ```css
248
252
  :root {
253
+ /* size */
254
+ --select2-single-height: 28px;
255
+ --select2-multiple-height: 28px;
256
+
249
257
  /* label */
250
258
  --select2-label-text-color: #000;
251
259
  --select2-required-color: red;
@@ -256,7 +264,7 @@ It's possible to change different colors (and more) with CSS variables without h
256
264
  --select2-selection-disabled-background: #eee;
257
265
  --select2-selection-border-color: #aaa;
258
266
  --select2-selection-focus-border-color: #000;
259
- --select2-selection-text-color: #444;
267
+ --select2-selection-text-color: #111;
260
268
 
261
269
  /* selection: choice item (multiple) */
262
270
  --select2-selection-choice-background: #e4e4e4;
@@ -327,8 +335,6 @@ It's possible to change different colors (and more) with CSS variables without h
327
335
  }
328
336
  ```
329
337
 
330
- For IE11, see [css-vars-ponyfill](https://github.com/jhildenbiddle/css-vars-ponyfill).
331
-
332
338
  ## Publishing the library
333
339
 
334
340
  ```