thomascybulski / paper-chip Goto Github PK
View Code? Open in Web Editor NEWPolymer 3.x Chips represent complex entities in small blocks, such as a contact.
License: MIT License
Polymer 3.x Chips represent complex entities in small blocks, such as a contact.
License: MIT License
Error removing chip using splice()
and <dom-repeat>
.
When removing A
chip, only A
chip is removed.
When removing A
chip, somehow both A
and B
chip are removed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Element Test Case</title>
<!-- Load webcomponents-loader.js to check and load any polyfills your browser needs -->
<script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="bower_components/polymer/polymer-element.html">
<link rel="import" href="bower_components/paper-chip/paper-chip.html">
</head>
<body>
<h1>paper-chip-remove-problem</h1>
<!-- Test case HTML goes here -->
<test-case>
</test-case>
<dom-module id="test-case">
<template>
Test Case:
<template is="dom-repeat" items="[[myChip]]">
<paper-chip
value$="[[item.value]]"
label="[[item.label]]"
on-chip-removed="onChipRemoved"
closable>
</paper-chip>
[[item.value]]([[item.label]])
</template>
</template>
</dom-module>
<script>
class TestCase extends Polymer.Element {
static get is() {
return 'test-case';
}
static get properties() {
return {
myChip: {
type: Array,
value: function() {
return [
{value: 'a', label: 'A'},
{value: 'b', label: 'B'},
{value: 'c', label: 'C'},
];
}
}
};
}
onChipRemoved(e) {
// console.log('onChipRemoved(e)', e);
let index = e.model.index;
let item = e.model.item;
this.splice('myChip', index, 1);
}
}
window.customElements.define(TestCase.is, TestCase);
</script>
</body>
</html>
The demo page sets a property called "sources" but there's no documentation about what sources is supposed to be. Is it a Array<String>
? Is it an Array<Object>
? How is there a way to let the user lookup values, but store an associated key for the value? For example, if I want to use it to lookup a list user's name and the user object looks something like this {id:1234, firstName:'John', lastName: 'Smith'}
, how would the user look this up? How would I get the ID of the selected user? Is there a way to create a custom paper-chip to handle selecting these kinds of objects? Since Polymer now supports ES6 classes, is there a way to have a User class with a toString method that returns the concatenated name that the autocomplete uses?
When I tried installing it using bower install --save ThomasCybulski/paper-chip
, it removed all the iron icons present in my application. Upon uninstallation, it started to display fine.
It would be nice if it were possible to apply styles for individual chips in the input element.
I'm pretty sure it's doable for the paper-chip-input-autocomplete
so that chips not selected from the autocomplete list (when additionalItems
is true) have different (user defined) styling than the ones from the list (by default they would be the same).
Not sure about the general case but perhaps it is doable using ::slotted() syntax.
Currently paper-chip
looks okay on Chrome, but looks ugly on other browsers:
I ran the demo from the webcomponents.org:
https://www.webcomponents.org/element/ThomasCybulski/paper-chip/demo/demo/index.html
Here are some screenshots:
Could you manage this issue?
Thank you.
I have placed at the end of the element with overflow: auto
CSS. Then suggestions were expanded into scroll area (therefore not visible on the tap/write) and were overflowing the parent element instead.
Currently I have no idea how to make them visible. I tried to set --paper-listbox: { position: fixed; width: initial; }
but the width is still broken and it is not 100% working solution anyway.
Anybody any suggestions on this?
Please add readonly
property / attribute for paper-chip-input
and paper-chip-input-autocomplete
.
Hi.
First of all thanks for a great element for polymer2. I’m wondering if I’m missing something or is there a bug removing a chip on paper-chip-input-autocomplete.html. I dug in a bit and noticed that on-chip-removed was not called. Traced the issue to the id of the element “slot” where paper-chip sends an event when id == “slot2”. If change this it works.
See:
paper-chip.html
_remove(event) {
if (this.parentNode.id == 'slot2') { …
paper-chip-input-autocomplete.html
<paper-input id="paperInput" label="[[label]]" on-keyup="_findItems" on-keydown="_keydown" value="{{_inputValue}}" autofocus>
<slot id="slot" name="input" slot="prefix">
Thanks.
Hi,
I want to execute a DeleteItem() function in JavaScript when my user closes a paper-chip. Is there any defined method for this kind of operation?
I've tested this element with Firefox Version 54, and all basic functionality seems to be available.
Add an attribute/property which indicates whether the input is empty or not. Intended usage is in CSS selectors ie
paper-chip-input-autocomplete[has-value] {...}
Unfortunately it seems that the standard :placeholder-shown
class is not working with polymer elements (ie even with paper-input
).
Vaadin elements do have (at least combo-box and date-picker) hasValue
property for this purpose.
Use case: every query changed, need to regenerate new datasource.
Tested the demo on MacOS (10.12.) Safari / Firefox (latest versions). Search results are not displayed at all.
It seems that focusing the autocomplete list with up/down key isn't working.
I tested the demo where the last one is "paper-chip's from autocomplete" - there I typed "al" and autocomplete list pops up, but when pressing up or down key then the caret jumps to the beginning or end of the input rather than selecting item in the autocomplete list.
Tested with
Chromium-browser Version 61.0.3163.79 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
Google-Chrome Version 60.0.3112.78 (Official Build) (64-bit)
To reproduce make new "polymer-2-starter-kit" application (with the polymer-cli), open the generated "my-view1.html" add paper-chip-input
as the last tag to the <div class="card">
. Now open the app in browser and enter several chips to the input until they won't fit onto the single line. The multi line input "spills" over the edge of it's container (see attached picture):
When moving through the demo in IE. paper-input-autocomplete
removes two chips on press of backspace. Also the styles are breaking for the paper-input
When I start searching with the paper-chip-input-autocomplete, the paper-list seems to be to wide and goes way beyond the paper-input width.
I would expect the width of the results to match the one from the paper-input blue line.
I think I've fixed the problem by adding in the styles of the paper-chip-input-autocomplete this
:host { display: block; position: relative; }
I'm not sure if it breaks in other scenarios
Add allow-duplicates
property for paper-chip-input-autocomplete
which when set would allow to have same chip mote than once in the input. This would also mean that acutocomplete list is not filtered and when additional-items
is set then same new item can be entered multiple times.
paper-chip-input-autocomplete
fires chip-created
when new chip is created (ie user enters label which doesn't exist in source
and presses Enter, requires additionalItems
to be true
) and chip-removed
is fired when chip is "closed". But there is no way to detect user selecting an chip from autocomplete list. So please add chip-added
(or chip-selected
?) event for that case.
When the number of chips in the autocomplete field causes the field to wrap, the label text moves from the top left, to the right. Is there a way to prevent this from happening?
paper-chip-input-autocomplete
, currently the source
must be an array of objects while items
is always array of strings.
It would be nice if the source
would also accept an array of strings in which case the items
would be strings. If the source
is assigned an array of objects then items
would also be an array of objects. When the source
is objects then additional item-label-path
property is used to determine which property of the objects is used for the chip label (defaults to text
to preserve current behaviour).
When source is objects but there is also item-value-path
property set then the items
would contain values of those properties instead of objects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.