@nuxeo/nuxeo-ui-elements
Version:
Nuxeo UI Web Components.
282 lines (269 loc) • 7.74 kB
HTML
<!--
@license
(C) Copyright Nuxeo Corp. (http://nuxeo.com/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>nuxeo-selectivity</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes" />
<script src="/components/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script type="module">
import '@polymer/polymer/polymer-legacy.js';
import '@nuxeo/nuxeo-elements/nuxeo-connection.js';
import '../nuxeo-demo.js';
import '../../widgets/nuxeo-selectivity.js';
</script>
</head>
<body>
<dom-bind>
<template>
<nuxeo-connection url="http://localhost:8080/nuxeo"></nuxeo-connection>
<nuxeo-demo-section heading="Select a single city" size="small">
<nuxeo-selectivity value="{{selectedCity}}" data="[[cities]]" placeholder="No city selected" allow-clear>
</nuxeo-selectivity>
<div>Selected city: [[selectedCity]]</div>
</nuxeo-demo-section>
<nuxeo-demo-section heading="Select multiple cities" size="small">
<nuxeo-selectivity value="{{selectedCities}}" data="[[cities]]" placeholder="Type to search a city" multiple>
</nuxeo-selectivity>
<div>Selected cities: [[selectedCities]]</div>
</nuxeo-demo-section>
<nuxeo-demo-section heading="Select a city by country" size="small">
<nuxeo-selectivity
value="{{selectedCityByCountry}}"
data="[[citiesByCountry]]"
placeholder="No city selected"
allow-clear
>
</nuxeo-selectivity>
<div>Selected city by country: [[selectedCityByCountry]]</div>
</nuxeo-demo-section>
</template>
</dom-bind>
<script type="module">
import '@polymer/polymer/polymer-legacy.js';
import '../nuxeo-demo.js';
import '../../widgets/nuxeo-selectivity.js';
const t = document.querySelector('dom-bind');
t.cities = [
'Amsterdam',
'Antwerp',
'Athens',
'Barcelona',
'Berlin',
'Birmingham',
'Bradford',
'Bremen',
'Brussels',
'Bucharest',
'Budapest',
'Cologne',
'Copenhagen',
'Dortmund',
'Dresden',
'Dublin',
'Düsseldorf',
'Essen',
'Frankfurt',
'Genoa',
'Glasgow',
'Gothenburg',
'Hamburg',
'Hannover',
'Helsinki',
'Leeds',
'Leipzig',
'Lisbon',
'Łódź',
'London',
'Kraków',
'Madrid',
'Málaga',
'Manchester',
'Marseille',
'Milan',
'Munich',
'Naples',
'Palermo',
'Paris',
'Poznań',
'Prague',
'Riga',
'Rome',
'Rotterdam',
'Seville',
'Sheffield',
'Sofia',
'Stockholm',
'Stuttgart',
'The Hague',
'Turin',
'Valencia',
'Vienna',
'Vilnius',
'Warsaw',
'Wrocław',
'Zagreb',
'Zaragoza',
];
t.citiesByCountry = [
{
text: 'Austria',
children: [{ id: 54, text: 'Vienna' }],
},
{
text: 'Belgium',
children: [
{ id: 2, text: 'Antwerp' },
{ id: 9, text: 'Brussels' },
],
},
{
text: 'Bulgaria',
children: [{ id: 48, text: 'Sofia' }],
},
{
text: 'Croatia',
children: [{ id: 58, text: 'Zagreb' }],
},
{
text: 'Czech Republic',
children: [{ id: 42, text: 'Prague' }],
},
{
text: 'Denmark',
children: [{ id: 13, text: 'Copenhagen' }],
},
{
text: 'England',
children: [
{ id: 6, text: 'Birmingham' },
{ id: 7, text: 'Bradford' },
{ id: 26, text: 'Leeds' },
{ id: 30, text: 'London' },
{ id: 34, text: 'Manchester' },
{ id: 47, text: 'Sheffield' },
],
},
{
text: 'Finland',
children: [{ id: 25, text: 'Helsinki' }],
},
{
text: 'France',
children: [
{ id: 35, text: 'Marseille' },
{ id: 40, text: 'Paris' },
],
},
{
text: 'Germany',
children: [
{ id: 5, text: 'Berlin' },
{ id: 8, text: 'Bremen' },
{ id: 12, text: 'Cologne' },
{ id: 14, text: 'Dortmund' },
{ id: 15, text: 'Dresden' },
{ id: 17, text: 'Düsseldorf' },
{ id: 18, text: 'Essen' },
{ id: 19, text: 'Frankfurt' },
{ id: 23, text: 'Hamburg' },
{ id: 24, text: 'Hannover' },
{ id: 27, text: 'Leipzig' },
{ id: 37, text: 'Munich' },
{ id: 50, text: 'Stuttgart' },
],
},
{
text: 'Greece',
children: [{ id: 3, text: 'Athens' }],
},
{
text: 'Hungary',
children: [{ id: 11, text: 'Budapest' }],
},
{
text: 'Ireland',
children: [{ id: 16, text: 'Dublin' }],
},
{
text: 'Italy',
children: [
{ id: 20, text: 'Genoa' },
{ id: 36, text: 'Milan' },
{ id: 38, text: 'Naples' },
{ id: 39, text: 'Palermo' },
{ id: 44, text: 'Rome' },
{ id: 52, text: 'Turin' },
],
},
{
text: 'Latvia',
children: [{ id: 43, text: 'Riga' }],
},
{
text: 'Lithuania',
children: [{ id: 55, text: 'Vilnius' }],
},
{
text: 'Netherlands',
children: [
{ id: 1, text: 'Amsterdam' },
{ id: 45, text: 'Rotterdam' },
{ id: 51, text: 'The Hague' },
],
},
{
text: 'Poland',
children: [
{ id: 29, text: 'Łódź' },
{ id: 31, text: 'Kraków' },
{ id: 41, text: 'Poznań' },
{ id: 56, text: 'Warsaw' },
{ id: 57, text: 'Wrocław' },
],
},
{
text: 'Portugal',
children: [{ id: 28, text: 'Lisbon' }],
},
{
text: 'Romania',
children: [{ id: 10, text: 'Bucharest' }],
},
{
text: 'Scotland',
children: [{ id: 21, text: 'Glasgow' }],
},
{
text: 'Spain',
children: [
{ id: 4, text: 'Barcelona' },
{ id: 32, text: 'Madrid' },
{ id: 33, text: 'Málaga' },
{ id: 46, text: 'Seville' },
{ id: 53, text: 'Valencia' },
{ id: 59, text: 'Zaragoza' },
],
},
{
text: 'Sweden',
children: [
{ id: 22, text: 'Gothenburg' },
{ id: 49, text: 'Stockholm' },
],
},
];
</script>
</body>
</html>