igniteui-angular 13.0.0-alpha.6 → 13.0.0-alpha.7
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/README.md +31 -30
- package/esm2020/lib/action-strip/grid-actions/grid-editing-actions.component.mjs +2 -2
- package/esm2020/lib/banner/banner.component.mjs +1 -1
- package/esm2020/lib/combo/combo-dropdown.component.mjs +12 -6
- package/esm2020/lib/combo/combo-item.component.mjs +5 -3
- package/esm2020/lib/combo/combo.api.mjs +3 -3
- package/esm2020/lib/combo/combo.common.mjs +1100 -2
- package/esm2020/lib/combo/combo.component.mjs +107 -1231
- package/esm2020/lib/combo/combo.directives.mjs +9 -25
- package/esm2020/lib/combo/combo.pipes.mjs +4 -6
- package/esm2020/lib/combo/public_api.mjs +5 -1
- package/esm2020/lib/core/utils.mjs +11 -1
- package/esm2020/lib/dialog/dialog.component.mjs +22 -10
- package/esm2020/lib/directives/focus-trap/focus-trap.directive.mjs +112 -0
- package/esm2020/lib/directives/for-of/for_of.directive.mjs +2 -2
- package/esm2020/lib/directives/radio/radio-group.directive.mjs +5 -13
- package/esm2020/lib/drop-down/drop-down-item.base.mjs +1 -5
- package/esm2020/lib/grids/column-actions/column-actions.component.mjs +4 -4
- package/esm2020/lib/grids/columns/column-layout.component.mjs +3 -3
- package/esm2020/lib/grids/columns/column.component.mjs +5 -5
- package/esm2020/lib/grids/common/crud.service.mjs +2 -2
- package/esm2020/lib/grids/filtering/advanced-filtering/advanced-filtering-dialog.component.mjs +2 -2
- package/esm2020/lib/grids/filtering/grid-filtering.service.mjs +9 -9
- package/esm2020/lib/grids/grid/grid.component.mjs +4 -8
- package/esm2020/lib/grids/grid-base.directive.mjs +82 -69
- package/esm2020/lib/grids/grid-public-row.mjs +3 -12
- package/esm2020/lib/grids/grouping/group-by-area.directive.mjs +2 -2
- package/esm2020/lib/grids/headers/grid-header-row.component.mjs +3 -3
- package/esm2020/lib/grids/hierarchical-grid/hierarchical-grid.component.mjs +4 -8
- package/esm2020/lib/grids/state.directive.mjs +2 -2
- package/esm2020/lib/grids/tree-grid/tree-grid.component.mjs +4 -8
- package/esm2020/lib/services/overlay/utilities.mjs +1 -1
- package/esm2020/lib/simple-combo/public_api.mjs +2 -0
- package/esm2020/lib/simple-combo/simple-combo.component.mjs +375 -0
- package/esm2020/lib/toast/toast.component.mjs +3 -6
- package/esm2020/public_api.mjs +3 -1
- package/fesm2015/igniteui-angular.mjs +1723 -1405
- package/fesm2015/igniteui-angular.mjs.map +1 -1
- package/fesm2020/igniteui-angular.mjs +1714 -1402
- package/fesm2020/igniteui-angular.mjs.map +1 -1
- package/lib/banner/banner.component.d.ts +1 -2
- package/lib/combo/combo-dropdown.component.d.ts +3 -1
- package/lib/combo/combo-item.component.d.ts +3 -1
- package/lib/combo/combo.common.d.ts +733 -4
- package/lib/combo/combo.component.d.ts +41 -799
- package/lib/combo/combo.pipes.d.ts +1 -1
- package/lib/combo/public_api.d.ts +4 -0
- package/lib/core/utils.d.ts +4 -0
- package/lib/dialog/dialog.component.d.ts +11 -2
- package/lib/directives/focus-trap/focus-trap.directive.d.ts +41 -0
- package/lib/directives/radio/radio-group.directive.d.ts +4 -4
- package/lib/grids/columns/column.component.d.ts +1 -1
- package/lib/grids/grid/grid.component.d.ts +2 -1
- package/lib/grids/grid-base.directive.d.ts +64 -8
- package/lib/grids/grid-public-row.d.ts +2 -3
- package/lib/grids/hierarchical-grid/hierarchical-grid.component.d.ts +2 -1
- package/lib/grids/tree-grid/tree-grid.component.d.ts +2 -1
- package/lib/services/overlay/utilities.d.ts +2 -1
- package/lib/simple-combo/public_api.d.ts +1 -0
- package/lib/simple-combo/simple-combo.component.d.ts +134 -0
- package/lib/toast/toast.component.d.ts +2 -0
- package/migrations/common/filterSourceDirs.d.ts +2 -2
- package/migrations/common/filterSourceDirs.js +2 -2
- package/migrations/update-13_0_0/changes/members.json +26 -0
- package/migrations/update-13_0_0/index.js +0 -31
- package/package.json +51 -43
- package/public_api.d.ts +2 -0
- package/src/lib/combo/README.md +14 -14
- package/src/lib/directives/focus-trap/README.md +17 -0
- package/src/lib/simple-combo/README.md +317 -0
- package/esm2020/lib/core/deprecateDecorators.mjs +0 -99
- package/lib/core/deprecateDecorators.d.ts +0 -20
|
@@ -10,29 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const UpdateChanges_1 = require("../common/UpdateChanges");
|
|
13
|
-
const util_1 = require("../common/util");
|
|
14
13
|
const import_helper_js_1 = require("../common/import-helper.js");
|
|
15
14
|
const version = '13.0.0';
|
|
16
15
|
exports.default = () => (host, context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
var _a;
|
|
18
16
|
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
|
|
19
17
|
const { HtmlParser } = yield (0, import_helper_js_1.nativeImport)('@angular/compiler');
|
|
20
18
|
const update = new UpdateChanges_1.UpdateChanges(__dirname, host, context);
|
|
21
19
|
const GRIDS = ['IgxGridComponent', 'IgxTreeGridComponent', 'IgxHierarchicalGridComponent'];
|
|
22
20
|
const TAGS = ['igx-grid', 'igx-tree-grid', 'igx-hierarchical-grid'];
|
|
23
21
|
const tsFiles = update.tsFiles;
|
|
24
|
-
for (const path of update.templateFiles) {
|
|
25
|
-
(0, util_1.findElementNodes)((0, util_1.parseFile)(new HtmlParser(), host, path), TAGS)
|
|
26
|
-
.map(node => (0, util_1.getSourceOffset)(node))
|
|
27
|
-
.forEach(offset => {
|
|
28
|
-
const { file, node } = offset;
|
|
29
|
-
if (file.content.includes('columns')) {
|
|
30
|
-
const gridRef = node.attrs.find(e => e.name.includes('#')).name.substring(1);
|
|
31
|
-
const content = file.content.split(gridRef + '.columns').join(gridRef + '.columnsCollection');
|
|
32
|
-
host.overwrite(path, content);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
22
|
const getIndicesOf = (searchStr, str) => {
|
|
37
23
|
if (searchStr.length === 0) {
|
|
38
24
|
return [];
|
|
@@ -46,22 +32,5 @@ exports.default = () => (host, context) => __awaiter(void 0, void 0, void 0, fun
|
|
|
46
32
|
}
|
|
47
33
|
return indexes;
|
|
48
34
|
};
|
|
49
|
-
for (const path of tsFiles) {
|
|
50
|
-
let content = (_a = host.read(path)) === null || _a === void 0 ? void 0 : _a.toString();
|
|
51
|
-
GRIDS.forEach(grid => {
|
|
52
|
-
if (content.indexOf(grid) > -1) {
|
|
53
|
-
const indexes = getIndicesOf('@ViewChild', content);
|
|
54
|
-
indexes.forEach(index => {
|
|
55
|
-
const viewChildRef = content.substring(index, content.indexOf(';', index)).replace(/\s\s+/g, ' ');
|
|
56
|
-
if (viewChildRef.includes(grid)) {
|
|
57
|
-
const gridDeclaration = viewChildRef.substring(viewChildRef.indexOf(')') + 1).replace(/\:/g, '').trim();
|
|
58
|
-
const gridName = gridDeclaration.split(' ')[1];
|
|
59
|
-
content = content.split(gridName + '.columns').join(gridName + '.columnsCollection');
|
|
60
|
-
host.overwrite(path, content);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
35
|
update.applyChanges();
|
|
67
36
|
});
|
package/package.json
CHANGED
|
@@ -1,69 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-angular",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.7",
|
|
4
4
|
"description": "Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps",
|
|
5
5
|
"author": "Infragistics",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"homepage": "https://www.infragistics.com/products/ignite-ui-angular",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/IgniteUI/igniteui-angular"
|
|
10
|
+
"url": "https://github.com/IgniteUI/igniteui-angular.git",
|
|
11
|
+
"directory": "projects/igniteui-angular"
|
|
10
12
|
},
|
|
11
13
|
"bugs": {
|
|
12
14
|
"url": "https://github.com/IgniteUI/igniteui-angular/issues"
|
|
13
15
|
},
|
|
14
16
|
"keywords": [
|
|
15
17
|
"angular",
|
|
16
|
-
"angular6",
|
|
17
18
|
"UI components",
|
|
18
|
-
"
|
|
19
|
-
"data table",
|
|
20
|
-
"tree grid",
|
|
21
|
-
"tree table",
|
|
22
|
-
"hierarchical grid",
|
|
23
|
-
"hierarchical table",
|
|
24
|
-
"combo",
|
|
25
|
-
"drop down",
|
|
26
|
-
"select",
|
|
19
|
+
"accordion",
|
|
27
20
|
"auto complete",
|
|
28
21
|
"autocomplete",
|
|
29
|
-
"list",
|
|
30
|
-
"tabs",
|
|
31
|
-
"calendar",
|
|
32
|
-
"date picker",
|
|
33
|
-
"datepicker",
|
|
34
|
-
"time picker",
|
|
35
|
-
"timepicker",
|
|
36
|
-
"dialog",
|
|
37
|
-
"navbar",
|
|
38
|
-
"navdrawer",
|
|
39
|
-
"toggle",
|
|
40
|
-
"carousel",
|
|
41
22
|
"avatar",
|
|
42
23
|
"badge",
|
|
43
|
-
"
|
|
44
|
-
"checkbox",
|
|
45
|
-
"switch",
|
|
46
|
-
"input",
|
|
24
|
+
"banner",
|
|
47
25
|
"bottom nav",
|
|
48
|
-
"mask",
|
|
49
26
|
"button",
|
|
50
|
-
"
|
|
27
|
+
"calendar",
|
|
28
|
+
"card",
|
|
29
|
+
"carousel",
|
|
30
|
+
"checkbox",
|
|
31
|
+
"chip",
|
|
32
|
+
"chips",
|
|
33
|
+
"circular progress",
|
|
34
|
+
"combo",
|
|
35
|
+
"csv export",
|
|
36
|
+
"data table",
|
|
37
|
+
"date picker",
|
|
38
|
+
"datepicker",
|
|
39
|
+
"datetime editor",
|
|
40
|
+
"dialog",
|
|
51
41
|
"drag drop",
|
|
52
42
|
"drag",
|
|
43
|
+
"drop down",
|
|
53
44
|
"drop",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
45
|
+
"excel export",
|
|
46
|
+
"expansion panel",
|
|
47
|
+
"grid",
|
|
48
|
+
"hierarchical grid",
|
|
49
|
+
"hierarchical table",
|
|
56
50
|
"icon",
|
|
57
|
-
"
|
|
58
|
-
"circular progress",
|
|
51
|
+
"input",
|
|
59
52
|
"linear progress",
|
|
53
|
+
"list",
|
|
54
|
+
"mask",
|
|
55
|
+
"navbar",
|
|
56
|
+
"navdrawer",
|
|
57
|
+
"progress bar",
|
|
58
|
+
"radio",
|
|
59
|
+
"select",
|
|
60
60
|
"slider",
|
|
61
|
-
"toast",
|
|
62
61
|
"snackbar",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
62
|
+
"switch",
|
|
63
|
+
"tabs",
|
|
64
|
+
"time picker",
|
|
65
|
+
"timepicker",
|
|
66
|
+
"toast",
|
|
67
|
+
"toggle",
|
|
68
|
+
"tree grid",
|
|
69
|
+
"tree table",
|
|
70
|
+
"tree view",
|
|
71
|
+
"tree"
|
|
67
72
|
],
|
|
68
73
|
"dependencies": {
|
|
69
74
|
"@types/hammerjs": "^2.0.40",
|
|
@@ -76,11 +81,14 @@
|
|
|
76
81
|
"@igniteui/material-icons-extended": "^2.10.0"
|
|
77
82
|
},
|
|
78
83
|
"exports": {
|
|
79
|
-
"./
|
|
80
|
-
"
|
|
84
|
+
"./lib/core/styles/themes/index": {
|
|
85
|
+
"sass": "./lib/core/styles/themes/_index.scss"
|
|
86
|
+
},
|
|
87
|
+
"./theming": {
|
|
88
|
+
"sass": "./lib/core/styles/themes/_index.scss"
|
|
81
89
|
},
|
|
82
|
-
"./
|
|
83
|
-
"
|
|
90
|
+
"./themes": {
|
|
91
|
+
"sass": "./lib/core/styles/themes/_index.scss"
|
|
84
92
|
},
|
|
85
93
|
"./package.json": {
|
|
86
94
|
"default": "./package.json"
|
package/public_api.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './lib/directives/drag-drop/drag-drop.strategy';
|
|
|
13
13
|
export * from './lib/directives/drag-drop/drag-drop.directive';
|
|
14
14
|
export * from './lib/directives/filter/filter.directive';
|
|
15
15
|
export * from './lib/directives/focus/focus.directive';
|
|
16
|
+
export * from './lib/directives/focus-trap/focus-trap.directive';
|
|
16
17
|
export * from './lib/directives/for-of/for_of.directive';
|
|
17
18
|
export * from './lib/directives/layout/layout.directive';
|
|
18
19
|
export * from './lib/directives/mask/mask.directive';
|
|
@@ -54,6 +55,7 @@ export * from './lib/carousel/public_api';
|
|
|
54
55
|
export * from './lib/checkbox/checkbox.component';
|
|
55
56
|
export * from './lib/chips/public_api';
|
|
56
57
|
export * from './lib/combo/public_api';
|
|
58
|
+
export * from './lib/simple-combo/public_api';
|
|
57
59
|
export * from './lib/date-picker/public_api';
|
|
58
60
|
export * from './lib/dialog/dialog.component';
|
|
59
61
|
export * from './lib/drop-down/public_api';
|
package/src/lib/combo/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The igx-combo exposes intuitive keyboard navigation and it is accessibility comp
|
|
|
7
7
|
Drop Down items are virtualized, which guarantees smooth work, even if the igx-combo is bound to data source with a lot of items.
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
`igx-combo` is a component.
|
|
10
|
+
`igx-combo` is a component.
|
|
11
11
|
A walkthrough of how to get started can be found [here](https://www.infragistics.com/products/ignite-ui-angular/angular/components/combo.html)
|
|
12
12
|
|
|
13
13
|
# Usage
|
|
@@ -24,17 +24,17 @@ Remote binding, defining `valueKey` and `displayKey`, and exposing `dataPreLoad`
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
|
-
public ngOnInit() {
|
|
27
|
+
public ngOnInit(): void {
|
|
28
28
|
this.remoteData = this.remoteService.remoteData;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public ngAfterViewInit() {
|
|
31
|
+
public ngAfterViewInit(): void {
|
|
32
32
|
this.remoteService.getData(this.combo.virtualizationState, (data) => {
|
|
33
33
|
this.combo.totalItemCount = data.length;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
public dataLoading(evt) {
|
|
37
|
+
public dataLoading(evt): void {
|
|
38
38
|
if (this.prevRequest) {
|
|
39
39
|
this.prevRequest.unsubscribe();
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ public dataLoading(evt) {
|
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
> Note: In order to have combo with remote data, what you need is to have a service that retrieves data chunks from a server.
|
|
49
|
+
> Note: In order to have combo with remote data, what you need is to have a service that retrieves data chunks from a server.
|
|
50
50
|
What the combo exposes is a `virtualizationState` property that gives state of the combo - first index and the number of items that needs to be loaded.
|
|
51
51
|
The service, should inform the combo for the total items that are on the server - using the `totalItemCount` property.
|
|
52
52
|
|
|
@@ -67,9 +67,9 @@ export class MyCombo {
|
|
|
67
67
|
public combo: IgxComboComponent;
|
|
68
68
|
public myCustomData: { id: number, text: string } = [{ id: 0, name: "One" }, ...];
|
|
69
69
|
...
|
|
70
|
-
ngOnInit() {
|
|
70
|
+
public ngOnInit(): void {
|
|
71
71
|
// Selection is done only by valueKey property value
|
|
72
|
-
this.combo.
|
|
72
|
+
this.combo.select([0, 1]);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
```
|
|
@@ -80,8 +80,8 @@ export class MyCombo {
|
|
|
80
80
|
```
|
|
81
81
|
```typescript
|
|
82
82
|
export class MyCombo {
|
|
83
|
-
ngOnInit() {
|
|
84
|
-
this.combo.
|
|
83
|
+
public ngOnInit(): void {
|
|
84
|
+
this.combo.select([this.data[0], this.data[1]]);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
```
|
|
@@ -166,7 +166,7 @@ Defining a combo's groupKey option will group the items, according to that key.
|
|
|
166
166
|
|
|
167
167
|
### Templates
|
|
168
168
|
Templates for different parts of the control can be defined, including items, header and footer, etc.
|
|
169
|
-
When defining one of
|
|
169
|
+
When defining one of them, you need to reference list of predefined names, as follows:
|
|
170
170
|
|
|
171
171
|
#### Defining item template:
|
|
172
172
|
```html
|
|
@@ -289,7 +289,7 @@ When igxCombo is opened, allow custom values are enabled and add item button is
|
|
|
289
289
|
|
|
290
290
|
## Display Density
|
|
291
291
|
**igx-combo** supports setting of different display densities.
|
|
292
|
-
Display density is received through Angular's DI engine or can be set through the `[displayDensity]` input. The
|
|
292
|
+
Display density is received through Angular's DI engine or can be set through the `[displayDensity]` input. The possible display densities are `compact`, `cosy` and `comfortable` (default).
|
|
293
293
|
Setting `[displayDensity]` affects the control's items' and inputs' css properties, most notably heights, padding, font-size.
|
|
294
294
|
|
|
295
295
|
## API
|
|
@@ -349,8 +349,8 @@ Setting `[displayDensity]` affects the control's items' and inputs' css properti
|
|
|
349
349
|
| `close` | Closes drop down | `void` | `None` |
|
|
350
350
|
| `toggle` | Toggles drop down | `void` | `None` |
|
|
351
351
|
| `selectedItems` | Get current selection state | `any[]` | `None` |
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
352
|
+
| `select` | Select defined items | `void` | items: `any[]`, clearCurrentSelection: `boolean` |
|
|
353
|
+
| `deselect` | Deselect defined items | `void` | items: `any[]` |
|
|
354
354
|
| `selectAllItems` | Select all (filtered) items | `void` | ignoreFilter?: `boolean` - if `true` selects **all** values |
|
|
355
355
|
| `deselectAllItems` | Deselect (filtered) all items | `void` | ignoreFilter?: `boolean` - if `true` deselects **all** values |
|
|
356
|
-
| `
|
|
356
|
+
| `selected` | Toggles (select/deselect) an item by key | `void` | itemID: any, select = true, event?: Event |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# IgxFocusTrap Directive
|
|
2
|
+
|
|
3
|
+
The **IgxFocusTrap** directive provides functionality to trap the focus within an element. The focus should not leave the element when the user keeps tabbing through the focusable elements. Typically, when the focus leaves the last element, it should move to the first element. And vice versa, when SHIFT + TAB is pressed, when the focus leaves the first element, the last element should be focused. In case the element does not contain any focusable elements, the focus will be trapped on the element itself.
|
|
4
|
+
|
|
5
|
+
#Usage
|
|
6
|
+
```typescript
|
|
7
|
+
import { IgxFocusTrapModule } from "igniteui-angular";
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Basic initialization
|
|
11
|
+
```html
|
|
12
|
+
<div [igxFocusTrap]="true" tabindex="0">
|
|
13
|
+
<input type="text" name="uname">
|
|
14
|
+
<input type="password" name="psw">
|
|
15
|
+
<button>SIGN IN</button>
|
|
16
|
+
</div>
|
|
17
|
+
```
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# igx-simple-combo
|
|
2
|
+
The `igx-simple-combo` is a modification of the `igx-combo` component that allows single selection and has the appropriate UI and behavior for that. It inherits most of the `igx-combo`'s API.
|
|
3
|
+
It provides an editable input used for filtering data while also using the IgniteUI for Angular's `igx-drop-down` component to display the items in the data set.
|
|
4
|
+
Alongside easy filtering and selection of a single item, the control provides grouping and adding of custom values to the data set.
|
|
5
|
+
Templates can be provided in order to customize different areas of the components, such as items, header, footer, etc.
|
|
6
|
+
Additionally, the control is integrated with the Template Driven and Reactive Forms.
|
|
7
|
+
It also exposes intuitive keyboard navigation and it is accessibility compliant.
|
|
8
|
+
Another thing worth mentioning is that the Drop Down items are virtualized, which guarantees smooth work, even if the control is bound to data source with a lot of items.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
A walk through of how to get started can be found [here](https://www.infragistics.com/products/ignite-ui-angular/angular/components/simple-combo.html)
|
|
12
|
+
|
|
13
|
+
# Usage
|
|
14
|
+
Basic usage of `igx-simple-combo` bound to a local data source, defining `valueKey` and `displayKey`:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<igx-simple-combo [data]="localData" [valueKey]="'ProductID'" [displayKey]="'ProductName'"></igx-simple-combo>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Remote binding, defining `valueKey` and `displayKey`, and exposing `dataPreLoad` that allows to load new chunk of remote data to the combo (see the sample above as a reference):
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<igx-simple-combo [data]="remoteData | async" (dataPreLoad)="dataLoading($event)" [valueKey]="'ProductID'" [displayKey]="'ProductName'" ></igx-simple-combo>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
public ngOnInit(): void {
|
|
28
|
+
this.remoteData = this.remoteService.remoteData;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public ngAfterViewInit(): void {
|
|
32
|
+
this.remoteService.getData(this.combo.virtualizationState, (data) => {
|
|
33
|
+
this.combo.totalItemCount = data.length;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public dataLoading(evt): void {
|
|
38
|
+
if (this.prevRequest) {
|
|
39
|
+
this.prevRequest.unsubscribe();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.prevRequest = this.remoteService.getData(this.combo.virtualizationState, () => {
|
|
43
|
+
this.cdr.detectChanges();
|
|
44
|
+
this.combo.triggerCheck();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> Note: In order to have a combo with remote data, what you need is to have a service that retrieves data chunks from a server.
|
|
50
|
+
What the combo exposes is a `virtualizationState` property that gives state of the combo - first index and the number of items that needs to be loaded.
|
|
51
|
+
The service, should inform the combo for the total items that are on the server - using the `totalItemCount` property.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
### Selection
|
|
56
|
+
|
|
57
|
+
Combo selection depends on the `[valueKey]` input property:
|
|
58
|
+
|
|
59
|
+
- If a `[valueKey]` is specified, **all** methods and events tied to the selection operate w/ the value key property of the combo's `[data]` items:
|
|
60
|
+
```html
|
|
61
|
+
<igx-simple-combo [data]="myCustomData" valueKey="id" displayKey="text"></igx-simple-combo>
|
|
62
|
+
```
|
|
63
|
+
```typescript
|
|
64
|
+
export class MyCombo {
|
|
65
|
+
...
|
|
66
|
+
public combo: IgxSimpleComboComponent;
|
|
67
|
+
public myCustomData: { id: number, text: string } = [{ id: 0, name: "One" }, ...];
|
|
68
|
+
...
|
|
69
|
+
public ngOnInit(): void {
|
|
70
|
+
// Selection is done only by valueKey property value
|
|
71
|
+
this.combo.select(0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- When **no** `valueKey` is specified, selection is handled by **equality (===)**. To select items by object reference, the `valueKey` property should be removed:
|
|
77
|
+
```html
|
|
78
|
+
<igx-simple-combo [data]="myCustomData" displayKey="text"></igx-simple-combo>
|
|
79
|
+
```
|
|
80
|
+
```typescript
|
|
81
|
+
export class MyCombo {
|
|
82
|
+
public ngOnInit(): void {
|
|
83
|
+
this.combo.select(this.data[0]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Value Binding
|
|
89
|
+
|
|
90
|
+
If we want to use a two-way data-binding, we could just use `ngModel` like this:
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<igx-simple-combo #combo [data]="data" valueKey="id" displayKey="text" [(ngModel)]="value"></igx-simple-combo>
|
|
94
|
+
```
|
|
95
|
+
```typescript
|
|
96
|
+
export class MyExampleComponent {
|
|
97
|
+
...
|
|
98
|
+
public data: {text: string, id: number, ... }[] = ...;
|
|
99
|
+
...
|
|
100
|
+
public value: number = ...;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
When the `data` input is made up of complex types (i.e. objects), it is advised to bind the selected data via `valueKey` (as in the above code snippet). Specify a property that is unique for each data entry and pass in a value to the combo that is the same as the unique identifier in the data set.
|
|
105
|
+
|
|
106
|
+
If you want to bind the selected data by reference, **do not** specify a `valueKey`:
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<igx-simple-combo #combo [data]="data" displayKey="text" [(ngModel)]="value"></igx-simple-combo>
|
|
110
|
+
```
|
|
111
|
+
```typescript
|
|
112
|
+
export class MyExampleComponent {
|
|
113
|
+
...
|
|
114
|
+
public data: {text: string, id: number, ... }[] = ...;
|
|
115
|
+
...
|
|
116
|
+
public value: {text: string, id: number, ...} = this.items[0];
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<div class="divider--half"></div>
|
|
121
|
+
|
|
122
|
+
### Filtering
|
|
123
|
+
Unlike the `igx-combo`, filtering in the `igx-simple-combo` is always enabled.
|
|
124
|
+
|
|
125
|
+
<div class="divider--half"></div>
|
|
126
|
+
|
|
127
|
+
### Custom Values
|
|
128
|
+
Enabling the custom values will add values that are missing from the list, using the combo's interface.
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<igx-simple-combo [allowCustomValues]="true"></igx-simple-combo>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
<div class="divider--half"></div>
|
|
135
|
+
|
|
136
|
+
### Disabled
|
|
137
|
+
You can disable the combo using the following code:
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<igx-simple-combo [disabled]="true"></igx-simple-combo>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
<div class="divider--half"></div>
|
|
144
|
+
|
|
145
|
+
### Grouping
|
|
146
|
+
Defining a combo's groupKey option will group the items, according to that key.
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<igx-simple-combo [groupKey]="'groupKey'"></igx-simple-combo>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
<div class="divider--half"></div>
|
|
153
|
+
|
|
154
|
+
### Templates
|
|
155
|
+
Templates for different parts of the control can be defined, including items, header and footer, etc.
|
|
156
|
+
When defining one of them, you need to reference list of predefined names, as follows:
|
|
157
|
+
|
|
158
|
+
#### Defining item template:
|
|
159
|
+
```html
|
|
160
|
+
<igx-simple-combo>
|
|
161
|
+
<ng-template igxComboItem let-display let-key="valueKey">
|
|
162
|
+
<div class="item">
|
|
163
|
+
<span class="state">State: {{ display[key] }}</span>
|
|
164
|
+
<span class="region">Region: {{ display.region }}</span>
|
|
165
|
+
</div>
|
|
166
|
+
</ng-template>
|
|
167
|
+
</igx-simple-combo>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Defining group headers template:
|
|
171
|
+
|
|
172
|
+
```html
|
|
173
|
+
<igx-simple-combo>
|
|
174
|
+
<ng-template igxComboHeaderItem let-headerItem let-key="groupKey">
|
|
175
|
+
<div class="group-header-class">
|
|
176
|
+
Header for {{ headerItem[key] }}
|
|
177
|
+
</div>
|
|
178
|
+
</ng-template>
|
|
179
|
+
</igx-simple-combo>
|
|
180
|
+
```
|
|
181
|
+
#### Defining header template:
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<igx-simple-combo>
|
|
185
|
+
<ng-template igxComboHeader>
|
|
186
|
+
<div class="header-class">Custom header</div>
|
|
187
|
+
<img src=""/>
|
|
188
|
+
</ng-template>
|
|
189
|
+
</igx-simple-combo>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### Defining footer template:
|
|
193
|
+
|
|
194
|
+
```html
|
|
195
|
+
<igx-simple-combo>
|
|
196
|
+
<ng-template igxComboFooter>
|
|
197
|
+
<div class="footer-class">Custom footer</div>
|
|
198
|
+
<img src=""/>
|
|
199
|
+
</ng-template>
|
|
200
|
+
</igx-simple-combo>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Defining empty template:
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<igx-simple-combo>
|
|
207
|
+
<ng-template igxComboEmpty>
|
|
208
|
+
<span>List is empty</div>
|
|
209
|
+
</ng-template>
|
|
210
|
+
</igx-simple-combo>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Defining add template:
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<igx-simple-combo>
|
|
217
|
+
<ng-template igxComboAddItem>
|
|
218
|
+
<span>Add town</span>
|
|
219
|
+
</ng-template>
|
|
220
|
+
</igx-simple-combo>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### Defining toggle icon template:
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<igx-simple-combo>
|
|
227
|
+
<ng-template igxComboToggleIcon let-collapsed>
|
|
228
|
+
<igx-icon>{{ collapsed ? 'remove_circle' : 'remove_circle_outline'}}</igx-icon>
|
|
229
|
+
</ng-template>
|
|
230
|
+
</igx-simple-combo>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### Defining toggle icon template:
|
|
234
|
+
|
|
235
|
+
```html
|
|
236
|
+
<igx-simple-combo>
|
|
237
|
+
<ng-template igxComboClearIcon>
|
|
238
|
+
<igx-icon>clear</igx-icon>
|
|
239
|
+
</ng-template>
|
|
240
|
+
</igx-simple-combo>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Keyboard Navigation
|
|
244
|
+
|
|
245
|
+
When the combo is closed and focused:
|
|
246
|
+
- `ArrowDown` or `Alt` + `ArrowDown` will open the dropdown and will move focus to the selected item, if no selected item is present, the first item in the list will lbe focused.
|
|
247
|
+
|
|
248
|
+
When the combo is opened:
|
|
249
|
+
- `ArrowUp` will close the dropdown and will move focus to the input while also selecting all of the text in the input if the currently focused item is the first item in the list. Otherwise `ArrowUp` will move to the previous list item.
|
|
250
|
+
- `ArrowDown` will move focus from the search input to the first list item. If list is empty and custom values are enabled will move it to the Add new item button.
|
|
251
|
+
- `Alt` + `ArrowUp` will close the dropdown.
|
|
252
|
+
|
|
253
|
+
When the combo is opened and a list item is focused:
|
|
254
|
+
- `End` will move to last list item.
|
|
255
|
+
- `Home` will move to first list item.
|
|
256
|
+
- `Space` will select/deselect active list item without closing the dropdown.
|
|
257
|
+
- `Enter` will confirm the currently focused item as selected and will close the dropdown.
|
|
258
|
+
- `Esc` will close the dropdown.
|
|
259
|
+
|
|
260
|
+
When the combo is opened, allow custom values are enabled and add item button is focused:
|
|
261
|
+
- `Enter` will add new item with `valueKey` and `displayKey` equal to the text in the input and will select the new item.
|
|
262
|
+
- `ArrowUp` will move the focus back to the last list item or if the list is empty will move it to the input.
|
|
263
|
+
|
|
264
|
+
<div class="divider--half"></div>
|
|
265
|
+
|
|
266
|
+
## Display Density
|
|
267
|
+
**igx-simple-combo** supports setting of different display densities.
|
|
268
|
+
Display density is received through Angular's DI engine or can be set through the `[displayDensity]` input. The possible display densities are `compact`, `cosy` and `comfortable` (default).
|
|
269
|
+
Setting `[displayDensity]` affects the control's items' and inputs' css properties, most notably heights, padding, font-size.
|
|
270
|
+
|
|
271
|
+
### Properties
|
|
272
|
+
| Name | Description | Type |
|
|
273
|
+
|--------------------------|---------------------------------------------------|-----------------------------|
|
|
274
|
+
| `id` | The combo's id. | `string` |
|
|
275
|
+
| `data` | The combo's data source. | `any` |
|
|
276
|
+
| `value` | The combo's value. | `string` |
|
|
277
|
+
| `allowCustomValue` | Enables/disables combo custom value. | `boolean` |
|
|
278
|
+
| `valueKey` | Determines which column in the data source is used to determine the value. | `string` |
|
|
279
|
+
| `displayKey` | Determines which column in the data source is used to determine the display value. | `string` |
|
|
280
|
+
| `groupKey` | The combo's item group. | `string` |
|
|
281
|
+
| `virtualizationState` | Defines the current state of the virtualized data. It contains `startIndex` and `chunkSize`. | `IForOfState` |
|
|
282
|
+
| `totalItemCount` | Total count of the virtual data items, when using remote service. | `number` |
|
|
283
|
+
| `width ` | Defines combo width. | `string` |
|
|
284
|
+
| `height` | Defines combo height. | `string` |
|
|
285
|
+
| `itemsMaxHeight ` | Defines dropdown maximum height. | `number` |
|
|
286
|
+
| `itemsWidth ` | Defines dropdown width. | `string` |
|
|
287
|
+
| `itemHeight ` | Defines dropdown item height. | `number` |
|
|
288
|
+
| `placeholder ` | Defines the "empty value" text. | `string` |
|
|
289
|
+
| `collapsed` | Gets the dropdown state. | `boolean` |
|
|
290
|
+
| `disabled` | Defines whether the control is active or not. | `boolean` |
|
|
291
|
+
| `ariaLabelledBy` | Defines label ID related to combo. | `boolean` |
|
|
292
|
+
| `valid` | gets if control is valid, when used in a form. | `boolean` |
|
|
293
|
+
| `overlaySettings` | Controls how the dropdown is displayed. | `OverlaySettings` |
|
|
294
|
+
| `selected` | Get current selection state. | `Array<any>` |
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
### Methods
|
|
298
|
+
| Name | Description | Return type | Parameters |
|
|
299
|
+
|----------------- |-----------------------------|----------------------|-----------------------------|
|
|
300
|
+
| `open` | Opens dropdown | `void` | `None` |
|
|
301
|
+
| `close` | Closes dropdown | `void` | `None` |
|
|
302
|
+
| `toggle` | Toggles dropdown | `void` | `None` |
|
|
303
|
+
| `select` | Select a defined item | `void` | newItem: `any` |
|
|
304
|
+
| `deselect` | Deselect the currently selected item | `void` | `None` |
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
### Events
|
|
308
|
+
| Name | Description | Cancelable | Parameters |
|
|
309
|
+
|------------------ |-------------------------------------------------------------------------|------------- |-----------------------------------------|
|
|
310
|
+
| `selectionChanging` | Emitted when item selection is changing, before the selection completes | true | { oldSelection: `any`, newSelection: `any`, displayText: `string`, owner: `IgxSimpleComboComponent` } |
|
|
311
|
+
| `searchInputUpdate` | Emitted when an the search input's input event is triggered | true | `IComboSearchInputEventArgs` |
|
|
312
|
+
| `addition` | Emitted when an item is being added to the data collection | false | { oldCollection: `Array<any>`, addedItem: `<any>`, newCollection: `Array<any>`, owner: `IgxSimpleComboComponent` }|
|
|
313
|
+
| `onDataPreLoad` | Emitted when new chunk of data is loaded from the virtualization | false | `IForOfState` |
|
|
314
|
+
| `opening` | Emitted before the dropdown is opened | true | `IBaseCancelableBrowserEventArgs` |
|
|
315
|
+
| `opened` | Emitted after the dropdown is opened | false | `IBaseEventArgs` |
|
|
316
|
+
| `closing` | Emitted before the dropdown is closed | true | `IBaseCancelableBrowserEventArgs` |
|
|
317
|
+
| `closed` | Emitted after the dropdown is closed | false | `IBaseEventArgs` |
|