概要

このサンプルではコンボコントロールを使用してドロップダウンリストに標準の文字列リストを表示するほか、複数列や画像を含むテンプレートリストなどの表示方法を確認することができます。

コンボ(GcComboBox)コントロールは、複数列(マルチカラム)のリスト表示機能やスピンボタンによる入力機能など、標準のコンボボックス(セレクトボックス)にはない豊富な機能を備えています。また、テキストエリアへの値の直接入力に対応しており、入力された値に合致する項目を自動的に表示するオートフィルタ機能なども提供しています。
<template> <div class="flexbox"> <div> 単純なリスト<br> <GcComboBoxComponent :items='items1' /> </div> <div> 複数列<br> <GcComboBoxComponent :items="items2" :columns='columns' :display-member-path='"product"' :value-member-path='"product"' :drop-down-width='"auto"' /> </div> <div> テンプレート<br> <GcComboBoxComponent :items='items3' :item-height='50' :display-member-path='"name"' :value-member-path='"name"' :drop-down-width='"auto"' :item-template='itemTemplate' :generating-item='generatingItem' /> </div> </div> </template> <script setup> import '@mescius/inputman/CSS/gc.inputman-js.css'; import {createApp} from 'vue'; import '@mescius/inputman.vue'; import { InputMan } from '@mescius/inputman'; import data from './data.mjs'; import {GcComboBoxComponent} from '@mescius/inputman.vue'; InputMan.appearanceStyle = InputMan.AppearanceStyle.Modern; const { products, orders, gcProducts } = data; var items1 = products; var items2 = orders; var items3 = gcProducts; var columns = [ { name: 'id', label: '商品コード', width: 80, clickSort: true }, { name: 'product', label: '商品名', width: 200 }, { name: 'date', label: '受注日', width: 120, clickSort: true }, { name: 'price', label: '単価', width: 80, clickSort: true }, { name: 'amount', label: '数量', width: 80, clickSort: true }, ]; var itemTemplate = `<div class="template-item"> <div class="image"><img src="{!logo}"></div> <div class="names"><div class="name">{!name}</div><div class="category">{!category}</div></div> <div class="description">{!description}</div> </div>`; var generatingItem = function(args) { args.item.classList.add(args.index % 2 ? 'odd' : 'even'); } </script> <style> body { min-height: 350px; } .viewport { line-height: 1.3; } .template-item { height: 50px; display: flex; justify-content: center; align-items: center; } .template-item>* { margin: 0 5px; } .image { width: 40px; height: 40px; } .image img { width: 40px; } .names { width: 150px; } .name { font-size: 16px; font-weight: bold; color: #2676c0; } .category { font-size: 12px; color: green; } .description { width: 210px; white-space: normal; } .list-item[selected="true"] .name, .list-item[selected="true"] .category { color: white; } .odd { background: aliceblue; } </style>
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>コンボコントロール - 概要</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script src="compiler.js" type="module"></script> <script> window.onload = function() { var System = SystemJS; System.import("./src/app.js"); } </script> </head> <body> <div id="app"></div> </body> </html>
(function (global) { SystemJS.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, packageConfigPaths: [ './node_modules/*/package.json', "./node_modules/@mescius/*/package.json", "./node_modules/@babel/*/package.json", "./node_modules/@vue/*/package.json" ], map: { 'vue': "npm:vue/dist/vue.esm-browser.js", 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', "systemjs-babel-build": "npm:systemjs-plugin-babel/systemjs-babel-browser.js", "@mescius/inputman": 'npm:@mescius/inputman/index.js', "@mescius/inputman.vue": 'npm:@mescius/inputman.vue/lib/gc.inputman.plugin.vue.js', "@mescius/inputman/CSS": "npm:@mescius/inputman/CSS", "@mescius/inputman.richtexteditor": "npm:@mescius/inputman.richtexteditor/index.js", "@mescius/inputman.richtexteditor.vue": "npm:/@mescius/inputman.richtexteditor.vue/lib/gc.inputman.richtexteditor.plugin.vue.js", "@mescius/inputman.richtexteditor/CSS": "npm:@mescius/inputman.richtexteditor/CSS", '@mescius/wijmo': 'npm:@mescius/wijmo/index.js', '@mescius/wijmo.styles': 'npm:@mescius/wijmo.styles', '@mescius/wijmo.cultures': 'npm:@mescius/wijmo.cultures/wijmo.culture.ja.js', '@mescius/wijmo.nav': 'npm:@mescius/wijmo.nav/index.js', '@mescius/wijmo.input': 'npm:@mescius/wijmo.input/index.js', '@mescius/wijmo.grid': 'npm:@mescius/wijmo.grid/index.js', '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-resources-ja': 'npm:@mescius/spread-sheets-resources-ja/index.js', '@mescius/spread-sheets/styles': 'npm:@mescius/spread-sheets/styles', 'css': 'npm:systemjs-plugin-css/css.js', }, meta: { '*.css': { loader: 'css' }, '*.vue': { loader: "../plugin-vue/index.js" } } }); })(this);