import 'bootstrap.css';
import '@mescius/wijmo.styles/wijmo.css';
import './styles.css';
//
import * as wijmo from '@mescius/wijmo';
import * as input from '@mescius/wijmo.input';
//
import '@angular/compiler';
import { Component, enableProdMode, Inject, ɵresolveComponentResources } from '@angular/core';
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
import { WjInputModule } from '@mescius/wijmo.angular2.input';
import { DataService } from './app.data';
//
@Component({
standalone: true,
providers: [DataService],
imports: [WjInputModule, BrowserModule],
selector: 'app-component',
templateUrl: 'src/app.component.html'
})
export class AppComponent {
data: any[];
//
constructor(@Inject(DataService) private dataService: DataService) {
this.data = dataService.getData();
}
//
format(text: string, data: any) {
return wijmo.format(text, data);
}
}
//
//
enableProdMode();
// Resolve resources (templateUrl, styleUrls etc), After resolution all URLs have been converted into `template` strings.
ɵresolveComponentResources(fetch).then(() => {
// Bootstrap application
bootstrapApplication(AppComponent).catch(err => console.error(err));
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MESCIUS Wijmo Multi-Column Combos</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Polyfills -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/fesm2015/zone.min.js"></script>
<!-- SystemJS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.21.5/system.src.js" integrity="sha512-skZbMyvYdNoZfLmiGn5ii6KmklM82rYX2uWctBhzaXPxJgiv4XBwJnFGr5k8s+6tE1pcR1nuTKghozJHyzMcoA==" crossorigin="anonymous"></script>
<script src="systemjs.config.js"></script>
<script>
// workaround to load 'rxjs/operators' from the rxjs bundle
System.import('rxjs').then(function (m) {
System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators));
System.import('./src/app.component');
});
</script>
</head>
<body>
<app-component></app-component>
</body>
</html>
<div class="container-fluid">
<p>
By default, the ComboBox displays one item per line in its drop-down list:
</p>
<div class="form-group">
<label for="theCombo">Default:</label>
<wj-combo-box [displayMemberPath]="'country'" [itemsSource]="data"></wj-combo-box>
</div>
<p>
If you have many short items, it may be interesting to use multiple columns in the drop-down. You can
accomplish this with a little CSS and the <b>dropDownCssClass</b> property:
</p>
<div class="form-group">
<label for="theComboCSS">Three Columns:</label>
<wj-combo-box [dropDownCssClass]="'cb-flex'" [displayMemberPath]="'country'" [itemsSource]="data">
</wj-combo-box>
</div>
<p>
If the items are complex objects, you may want to render a single item per line,
but with additional detail, as in a table or grid. You can accomplish this with
the <b>wjItemTemplate</b> directive and <b>headerPath</b> property:
</p>
<div class="form-group">
<label for="theComboTable">Table-Style:</label>
<wj-combo-box [headerPath]="'country'" [displayMemberPath]="'country'" [itemsSource]="data">
<ng-template wjItemTemplate let-item="item" let-itemIndex="itemIndex">
<table>
<tr>
<td>{{item.country}}</td>
<td class="number" title="GDP (million US$/year)">
{{format('{gdpm:c0}', item)}}
</td>
<td class="number" title="Population (thousands)">
{{format('{popk:n0}', item)}}
</td>
<td class="number" title="GDP/cap (US$/person/year)">
{{format('{gdpcap:c0}', item)}}
</td>
</tr>
</table>
</ng-template>
</wj-combo-box>
</div>
</div>
import { Injectable } from '@angular/core';
//
@Injectable()
export class DataService {
getData() {
return [
{ id: 1, country: 'Luxembourg', gdpm: 57825, popk: 563, gdpcap: 102708 },
{ id: 2, country: 'Switzerland', gdpm: 664005, popk: 8238, gdpcap: 80602 },
{ id: 3, country: 'Norway', gdpm: 388315, popk: 5205, gdpcap: 74604 },
{ id: 4, country: 'Macao', gdpm: 46178, popk: 647, gdpcap: 71372 },
{ id: 5, country: 'Qatar', gdpm: 166908, popk: 2421, gdpcap: 68941 },
{ id: 6, country: 'Ireland', gdpm: 283716, popk: 4635, gdpcap: 61211 },
{ id: 7, country: 'United States', gdpm: 18036650, popk: 321601, gdpcap: 56083 },
{ id: 8, country: 'Singapore', gdpm: 292734, popk: 5535, gdpcap: 52887 },
{ id: 9, country: 'Denmark', gdpm: 295091, popk: 5660, gdpcap: 52136 },
{ id: 10, country: 'Australia', gdpm: 1225286, popk: 23940, gdpcap: 51181 },
{ id: 11, country: 'Iceland', gdpm: 16718, popk: 333, gdpcap: 50204 },
{ id: 12, country: 'Sweden', gdpm: 493042, popk: 9851, gdpcap: 50049 },
{ id: 13, country: 'San Marino', gdpm: 1558, popk: 31, gdpcap: 50258 },
{ id: 14, country: 'Netherlands', gdpm: 750696, popk: 16937, gdpcap: 44322 },
{ id: 15, country: 'United Kingdom', gdpm: 2858482, popk: 65110, gdpcap: 43902 },
{ id: 16, country: 'Austria', gdpm: 374261, popk: 8621, gdpcap: 43412 },
{ id: 17, country: 'Canada', gdpm: 1550537, popk: 35825, gdpcap: 43280 },
{ id: 18, country: 'Finland', gdpm: 232077, popk: 5472, gdpcap: 42411 },
{ id: 19, country: 'Germany', gdpm: 3365293, popk: 82176, gdpcap: 40952 },
{ id: 20, country: 'Belgium', gdpm: 454288, popk: 11209, gdpcap: 40528 },
{ id: 21, country: 'United Arab Emirates', gdpm: 370296, popk: 9581, gdpcap: 38648 },
{ id: 22, country: 'France', gdpm: 2420163, popk: 64275, gdpcap: 37653 },
{ id: 23, country: 'New Zealand', gdpm: 172257, popk: 4647, gdpcap: 37068 },
{ id: 24, country: 'Israel', gdpm: 299413, popk: 8377, gdpcap: 35742 },
{ id: 25, country: 'Japan', gdpm: 4124211, popk: 126981, gdpcap: 32478 },
{ id: 26, country: 'Brunei Darussalam', gdpm: 12930, popk: 417, gdpcap: 31007 },
{ id: 27, country: 'Italy', gdpm: 1815759, popk: 60796, gdpcap: 29866 },
{ id: 28, country: 'Puerto Rico', gdpm: 102906, popk: 3474, gdpcap: 29621 },
{ id: 29, country: 'Kuwait', gdpm: 114079, popk: 4110, gdpcap: 27756 },
{ id: 30, country: 'South Korea', gdpm: 1377873, popk: 50617, gdpcap: 27221 },
{ id: 31, country: 'Spain', gdpm: 1199715, popk: 46423, gdpcap: 25843 },
{ id: 32, country: 'The Bahamas', gdpm: 8854, popk: 364, gdpcap: 24324 },
{ id: 33, country: 'Bahrain', gdpm: 31119, popk: 1294, gdpcap: 24048 },
{ id: 34, country: 'Cyprus', gdpm: 19330, popk: 847, gdpcap: 22821 },
{ id: 35, country: 'Malta', gdpm: 9752, popk: 429, gdpcap: 22731 },
{ id: 37, country: 'Slovenia', gdpm: 42798, popk: 2063, gdpcap: 20745 },
{ id: 38, country: 'Saudi Arabia', gdpm: 646002, popk: 31386, gdpcap: 20582 },
{ id: 39, country: 'Portugal', gdpm: 199032, popk: 10411, gdpcap: 19117 },
{ id: 40, country: 'Trinidad and Tobago', gdpm: 24631, popk: 1358, gdpcap: 18137 },
{ id: 41, country: 'Greece', gdpm: 195320, popk: 10858, gdpcap: 17988 },
{ id: 42, country: 'Czech Republic', gdpm: 185156, popk: 10538, gdpcap: 17570 },
{ id: 43, country: 'Estonia', gdpm: 22704, popk: 1313, gdpcap: 17291 },
{ id: 44, country: 'Equatorial Guinea', gdpm: 13819, popk: 799, gdpcap: 17295 },
{ id: 45, country: 'Oman', gdpm: 64121, popk: 3840, gdpcap: 16698 },
{ id: 46, country: 'St. Kitts and Nevis', gdpm: 915, popk: 56, gdpcap: 16339 },
{ id: 47, country: 'Palau', gdpm: 287, popk: 18, gdpcap: 15944 },
{ id: 48, country: 'Slovakia', gdpm: 86629, popk: 5421, gdpcap: 15980 },
{ id: 49, country: 'Barbados', gdpm: 4385, popk: 280, gdpcap: 15660 },
{ id: 50, country: 'Uruguay', gdpm: 53107, popk: 3416, gdpcap: 15546 }
];
}
}
.cb-flex {
display: flex;
flex-wrap: wrap;
width: 380px;
}
.cb-flex .wj-listbox-item {
width: 120px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
}
.wj-listbox-item table {
table-layout: fixed;
}
.wj-listbox-item td {
width: 120px;
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;
}
.wj-listbox-item td.number {
width: 80px;
text-align: right;
}
label {
margin-right: 3px;
}
body {
margin-bottom: 24px;
}
(function (global) {
SystemJS.config({
transpiler: './plugin-typescript.js',
typescriptOptions: {
"target": "ES2022",
"module": "system",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
},
baseURL: 'node_modules/',
meta: {
'typescript': {
"exports": "ts"
},
'*.css': { loader: 'systemjs-plugin-css' }
},
paths: {
// paths serve as alias
'npm:': ''
},
packageConfigPaths: [
'/node_modules/*/package.json',
"/node_modules/@angular/*/package.json",
"/node_modules/@mescius/*/package.json"
],
map: {
'core-js': 'https://cdn.jsdelivr.net/npm/core-js@2.6.12/client/shim.min.js',
'typescript': 'https://cdnjs.cloudflare.com/ajax/libs/typescript/5.2.2/typescript.min.js',
"rxjs": "https://cdnjs.cloudflare.com/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js",
'systemjs-plugin-css': 'https://cdn.jsdelivr.net/npm/systemjs-plugin-css@0.1.37/css.js',
'@mescius/wijmo': 'npm:@mescius/wijmo/index.js',
'@mescius/wijmo.input': 'npm:@mescius/wijmo.input/index.js',
'@mescius/wijmo.styles': 'npm:@mescius/wijmo.styles',
'@mescius/wijmo.cultures': 'npm:@mescius/wijmo.cultures',
'@mescius/wijmo.chart': 'npm:@mescius/wijmo.chart/index.js',
'@mescius/wijmo.chart.analytics': 'npm:@mescius/wijmo.chart.analytics/index.js',
'@mescius/wijmo.chart.animation': 'npm:@mescius/wijmo.chart.animation/index.js',
'@mescius/wijmo.chart.annotation': 'npm:@mescius/wijmo.chart.annotation/index.js',
'@mescius/wijmo.chart.finance': 'npm:@mescius/wijmo.chart.finance/index.js',
'@mescius/wijmo.chart.finance.analytics': 'npm:@mescius/wijmo.chart.finance.analytics/index.js',
'@mescius/wijmo.chart.hierarchical': 'npm:@mescius/wijmo.chart.hierarchical/index.js',
'@mescius/wijmo.chart.interaction': 'npm:@mescius/wijmo.chart.interaction/index.js',
'@mescius/wijmo.chart.radar': 'npm:@mescius/wijmo.chart.radar/index.js',
'@mescius/wijmo.chart.render': 'npm:@mescius/wijmo.chart.render/index.js',
'@mescius/wijmo.chart.webgl': 'npm:@mescius/wijmo.chart.webgl/index.js',
'@mescius/wijmo.chart.map': 'npm:@mescius/wijmo.chart.map/index.js',
'@mescius/wijmo.gauge': 'npm:@mescius/wijmo.gauge/index.js',
'@mescius/wijmo.grid': 'npm:@mescius/wijmo.grid/index.js',
'@mescius/wijmo.grid.detail': 'npm:@mescius/wijmo.grid.detail/index.js',
'@mescius/wijmo.grid.filter': 'npm:@mescius/wijmo.grid.filter/index.js',
'@mescius/wijmo.grid.search': 'npm:@mescius/wijmo.grid.search/index.js',
'@mescius/wijmo.grid.style': 'npm:@mescius/wijmo.grid.style/index.js',
'@mescius/wijmo.grid.grouppanel': 'npm:@mescius/wijmo.grid.grouppanel/index.js',
'@mescius/wijmo.grid.multirow': 'npm:@mescius/wijmo.grid.multirow/index.js',
'@mescius/wijmo.grid.transposed': 'npm:@mescius/wijmo.grid.transposed/index.js',
'@mescius/wijmo.grid.transposedmultirow': 'npm:@mescius/wijmo.grid.transposedmultirow/index.js',
'@mescius/wijmo.grid.pdf': 'npm:@mescius/wijmo.grid.pdf/index.js',
'@mescius/wijmo.grid.sheet': 'npm:@mescius/wijmo.grid.sheet/index.js',
'@mescius/wijmo.grid.xlsx': 'npm:@mescius/wijmo.grid.xlsx/index.js',
'@mescius/wijmo.grid.selector': 'npm:@mescius/wijmo.grid.selector/index.js',
'@mescius/wijmo.grid.cellmaker': 'npm:@mescius/wijmo.grid.cellmaker/index.js',
'@mescius/wijmo.nav': 'npm:@mescius/wijmo.nav/index.js',
'@mescius/wijmo.odata': 'npm:@mescius/wijmo.odata/index.js',
'@mescius/wijmo.olap': 'npm:@mescius/wijmo.olap/index.js',
'@mescius/wijmo.rest': 'npm:@mescius/wijmo.rest/index.js',
'@mescius/wijmo.pdf': 'npm:@mescius/wijmo.pdf/index.js',
'@mescius/wijmo.pdf.security': 'npm:@mescius/wijmo.pdf.security/index.js',
'@mescius/wijmo.viewer': 'npm:@mescius/wijmo.viewer/index.js',
'@mescius/wijmo.xlsx': 'npm:@mescius/wijmo.xlsx/index.js',
'@mescius/wijmo.undo': 'npm:@mescius/wijmo.undo/index.js',
'@mescius/wijmo.interop.grid': 'npm:@mescius/wijmo.interop.grid/index.js',
'@mescius/wijmo.touch': 'npm:@mescius/wijmo.touch/index.js',
'@mescius/wijmo.cloud': 'npm:@mescius/wijmo.cloud/index.js',
'@mescius/wijmo.barcode': 'npm:@mescius/wijmo.barcode/index.js',
'@mescius/wijmo.barcode.common': 'npm:@mescius/wijmo.barcode.common/index.js',
'@mescius/wijmo.barcode.composite': 'npm:@mescius/wijmo.barcode.composite/index.js',
'@mescius/wijmo.barcode.specialized': 'npm:@mescius/wijmo.barcode.specialized/index.js',
"@mescius/wijmo.angular2.chart.analytics": "npm:@mescius/wijmo.angular2.chart.analytics/index.js",
"@mescius/wijmo.angular2.chart.animation": "npm:@mescius/wijmo.angular2.chart.animation/index.js",
"@mescius/wijmo.angular2.chart.annotation": "npm:@mescius/wijmo.angular2.chart.annotation/index.js",
"@mescius/wijmo.angular2.chart.finance.analytics": "npm:@mescius/wijmo.angular2.chart.finance.analytics/index.js",
"@mescius/wijmo.angular2.chart.finance": "npm:@mescius/wijmo.angular2.chart.finance/index.js",
"@mescius/wijmo.angular2.chart.hierarchical": "npm:@mescius/wijmo.angular2.chart.hierarchical/index.js",
"@mescius/wijmo.angular2.chart.interaction": "npm:@mescius/wijmo.angular2.chart.interaction/index.js",
"@mescius/wijmo.angular2.chart.radar": "npm:@mescius/wijmo.angular2.chart.radar/index.js",
'@mescius/wijmo.angular2.chart.map': 'npm:@mescius/wijmo.angular2.chart.map/index.js',
"@mescius/wijmo.angular2.chart": "npm:@mescius/wijmo.angular2.chart/index.js",
"@mescius/wijmo.angular2.core": "npm:@mescius/wijmo.angular2.core/index.js",
"@mescius/wijmo.angular2.gauge": "npm:@mescius/wijmo.angular2.gauge/index.js",
"@mescius/wijmo.angular2.grid.detail": "npm:@mescius/wijmo.angular2.grid.detail/index.js",
"@mescius/wijmo.angular2.grid.filter": "npm:@mescius/wijmo.angular2.grid.filter/index.js",
"@mescius/wijmo.angular2.grid.grouppanel": "npm:@mescius/wijmo.angular2.grid.grouppanel/index.js",
"@mescius/wijmo.angular2.grid.search": "npm:@mescius/wijmo.angular2.grid.search/index.js",
"@mescius/wijmo.angular2.grid.multirow": "npm:@mescius/wijmo.angular2.grid.multirow/index.js",
"@mescius/wijmo.angular2.grid.sheet": "npm:@mescius/wijmo.angular2.grid.sheet/index.js",
'@mescius/wijmo.angular2.grid.transposed': 'npm:@mescius/wijmo.angular2.grid.transposed/index.js',
'@mescius/wijmo.angular2.grid.transposedmultirow': 'npm:@mescius/wijmo.angular2.grid.transposedmultirow/index.js',
"@mescius/wijmo.angular2.grid": "npm:@mescius/wijmo.angular2.grid/index.js",
"@mescius/wijmo.angular2.input": "npm:@mescius/wijmo.angular2.input/index.js",
"@mescius/wijmo.angular2.olap": "npm:@mescius/wijmo.angular2.olap/index.js",
"@mescius/wijmo.angular2.viewer": "npm:@mescius/wijmo.angular2.viewer/index.js",
"@mescius/wijmo.angular2.nav": "npm:@mescius/wijmo.angular2.nav/index.js",
"@mescius/wijmo.angular2.directivebase": "npm:@mescius/wijmo.angular2.directivebase/index.js",
'@mescius/wijmo.angular2.barcode.common': 'npm:@mescius/wijmo.angular2.barcode.common/index.js',
'@mescius/wijmo.angular2.barcode.composite': 'npm:@mescius/wijmo.angular2.barcode.composite/index.js',
'@mescius/wijmo.angular2.barcode.specialized': 'npm:@mescius/wijmo.angular2.barcode.specialized/index.js',
'bootstrap.css': 'npm:bootstrap/dist/css/bootstrap.min.css',
'jszip': 'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js',
"@angular/common/http": "https://cdn.jsdelivr.net/npm/@angular/common@16.2.6/fesm2022/http.mjs",
"@angular/core": "https://cdn.jsdelivr.net/npm/@angular/core@16.2.6/fesm2022/core.mjs",
"@angular/platform-browser": "https://cdn.jsdelivr.net/npm/@angular/platform-browser@16.2.6/fesm2022/platform-browser.mjs",
"@angular/common": "https://cdn.jsdelivr.net/npm/@angular/common@16.2.6/fesm2022/common.mjs",
"@angular/compiler": "https://cdn.jsdelivr.net/npm/@angular/compiler@16.2.6/fesm2022/compiler.mjs",
"@angular/forms": "https://cdn.jsdelivr.net/npm/@angular/forms@16.2.6/fesm2022/forms.mjs",
"@angular/localize": "https://cdn.jsdelivr.net/npm/@angular/localize@16.2.6/fesm2022/localize.mjs",
"@angular/platform-browser-dynamic": "https://cdn.jsdelivr.net/npm/@angular/platform-browser-dynamic@16.2.6/fesm2022/platform-browser-dynamic.mjs",
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
"./src": {
defaultExtension: 'ts'
},
"node_modules": {
defaultExtension: 'js'
},
wijmo: {
defaultExtension: 'js',
}
}
});
})(this);