タグのコピー&ペースト

このサンプルではタグボックスコントロールのコピー機能の使用を示しています。タグを選択して「Ctrl + C」でアイテムをコピーできます。

タグボックスは「Ctrl+C」キーを押下して選択したタグをコピーすることができます。 概要 タグボックスコントロールでコピー機能を使用するにはallowCopyTagプロパティにtrueを設定します。allowDragTagプロパティはタグボックスを初期化する場合のみ設定できます。初期化以降にallowDragTagプロパティの更新はできません。
import '@grapecity/inputman/CSS/gc.inputman-js.css'; import './styles.css'; import { InputMan } from '@grapecity/inputman'; import { products, gcProducts } from './data' InputMan.appearanceStyle = InputMan.AppearanceStyle.Modern; const gcTagBox1 = new InputMan.GcTagBox(document.getElementById('tagbox1'), { items: products, width: 300, height: 80, allowCopyTag: true, }); gcTagBox1.value = ['果汁100%グレープ', '果汁100%レモン']; const gcTagBox2 = new InputMan.GcTagBox(document.getElementById('tagbox2'), { showImage: true, width: 250, height: 80, displayMode: InputMan.TagBoxDisplayMode.Multiline, tagImageMemberPath: 'Image', tagTextMemberPath: 'Text', allowCopyTag: true, items: [ { Image: './img/AR.png', Text: 'ActiveReports', }, { Image: './img/C1.png', Text: 'ComponentOne', }, { Image: './img/DD.png', Text: 'DioDocs', }, { Image: './img/IM.png', Text: 'InputMan', }, { Image: './img/MR.png', Text: 'MultiRow', }, { Image: './img/SP.png', Text: 'SPREAD', }, ], }); gcTagBox2.value = ['SPREAD', 'ActiveReports']; const gcTagBox3 = new InputMan.GcTagBox(document.getElementById('tagbox3'), { items: gcProducts, width: 250, height: 150, showImage: true, tagImageMemberPath: 'logo', tagTextMemberPath: 'name', dropDownWidth: 450, dropDownHeight: 200, dropDownItemHeight: 50, autoDropDown: true, allowCopyTag: true, displayMode: InputMan.TagBoxDisplayMode.Multiline, tagTemplate: `<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>`, dropDownItemTemplate: `<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>`, }); gcTagBox3.value = ['MultiRow', 'ComponentOne']; const gcTagBox4 = new InputMan.GcTagBox(document.getElementById('tagbox4'), { items: products, width: 300, height: 80, allowCopyTag: true, }); const gcTagBox5 = new InputMan.GcTagBox(document.getElementById('tagbox5'), { showImage: true, width: 250, height: 80, displayMode: InputMan.TagBoxDisplayMode.Multiline, tagImageMemberPath: 'Image', tagTextMemberPath: 'Text', allowCopyTag: true, items: [ { Image: './img/AR.png', Text: 'ActiveReports', }, { Image: './img/C1.png', Text: 'ComponentOne', }, { Image: './img/DD.png', Text: 'DioDocs', }, { Image: './img/IM.png', Text: 'InputMan', }, { Image: './img/MR.png', Text: 'MultiRow', }, { Image: './img/SP.png', Text: 'SPREAD', }, ], }); const gcTagBox6 = new InputMan.GcTagBox(document.getElementById('tagbox6'), { items: gcProducts, width: 250, height: 150, showImage: true, tagImageMemberPath: 'logo', tagTextMemberPath: 'name', dropDownWidth: 500, dropDownHeight: 200, dropDownItemHeight: 50, autoDropDown: true, allowCopyTag: true, displayMode: InputMan.TagBoxDisplayMode.Multiline, tagTemplate: `<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>`, dropDownItemTemplate: `<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>`, }); // コピー機能 document.getElementById('allowCopyTag').addEventListener('change', (e) => { gcTagBox1.allowCopyTag = e.target.checked; gcTagBox2.allowCopyTag = e.target.checked; gcTagBox3.allowCopyTag = e.target.checked; gcTagBox4.allowCopyTag = e.target.checked; gcTagBox5.allowCopyTag = e.target.checked; gcTagBox6.allowCopyTag = e.target.checked; });
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>タグボックスコントロール - コピー機能</title> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="flexbox"> <div id="container1"> <div> コピー元のタグボックス 1<br> <div id="tagbox1"></div> </div> <br /> <div> コピー元のタグボックス 2<br> <div id="tagbox2"></div> </div> <br /> <div> コピー元のタグボックス 3<br> <div id="tagbox3"></div> </div> </div> <div id="container2"> <div> コピー先 1<br> <div id="tagbox4"></div> </div> <br /> <div> コピー先 2<br> <div id="tagbox5"></div> </div> <br /> <div> コピー先 3<br> <div id="tagbox6"></div> </div> </div> </div> <table class="sample"> <tr> <th>コピー機能</th> <td> <label><input type="checkbox" id="allowCopyTag" checked />有効</label> </td> </tr> </table> </body> </html>
.viewport { line-height: 1.3; } .template-item { height: 40px; 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: 12px; font-weight: bold; color: #2676c0; } .category { font-size: 12px; color: green; } .description { width: 200px; flex-grow: 1; white-space: normal; } .flexbox { display: flex; flex-wrap: wrap; } .flexbox>div { width: 300px; height: 400px; background-color: #f8f8f8; }
export const products = ['果汁100%オレンジ', '果汁100%グレープ', '果汁100%レモン', '果汁100%ピーチ', 'コーヒーマイルド', 'コーヒービター']; export const gcProducts = [ { logo: 'img/AR.png', name: 'ActiveReports', category: '帳票・レポート', description: '日本仕様の帳票開発に必要な機能を搭載したコンポーネント' }, { logo: 'img/SP.png', name: 'SPREAD', category: '表計算・グリッド', description: 'Excel風のビューと表計算機能を実現するUIコンポーネント' }, { logo: 'img/C1.png', name: 'ComponentOne', category: 'コンポーネントセット', description: 'Visual Studioで利用する.NET Framework用コンポーネント' }, { logo: 'img/IM.png', name: 'InputMan', category: '入力支援', description: '快適な入力を実現する日本仕様入力コンポーネントセット' }, { logo: 'img/MR.png', name: 'MultiRow', category: '多段明細', description: '1レコード複数行&日付表示に最適なグリッドコンポーネント' }, { logo: 'img/DD.png', name: 'DioDocs', category: 'ドキュメントAPI', description: 'ドキュメントを生成、更新するAPIライブラリ' }, ];
[gcim-control-appearance="modern"] .viewport { line-height: 1.3; } [gcim-control-appearance="modern"] .template-item { height: 40px; display: flex; justify-content: center; align-items: center; } [gcim-control-appearance="modern"] .template-item>* { margin: 0 5px; } [gcim-control-appearance="modern"] .image { width: 40px; height: 40px; } [gcim-control-appearance="modern"] .image img { width: 40px; } [gcim-control-appearance="modern"] .names { width: 150px; } [gcim-control-appearance="modern"] .name { font-size: 12px; font-weight: bold; color: #2676c0; } [gcim-control-appearance="modern"] .category { font-size: 12px; color: green; } [gcim-control-appearance="modern"] .description { width: 200px; flex-grow: 1; white-space: normal; } [gcim-control-appearance="modern"] .flexbox { display: flex; flex-wrap: wrap; } [gcim-control-appearance="modern"] .flexbox>div { width: 300px; height: 400px; background-color: #f8f8f8; }
System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@grapecity/inputman': 'npm:@grapecity/inputman/index.js', '@grapecity/inputman/CSS': 'npm:@grapecity/inputman/CSS', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' }, } });