<link rel="import" href="cosmoz-omnitable-column-behavior.html">
<link rel="import" href="../paper-input/paper-input.html"/>

<dom-module id="cosmoz-omnitable-column">
	<template>
		<template class="cell">
			<span class="default-column">[[ getString(item, valuePath) ]]</span>
		</template>

		<template class="edit-cell">
			<paper-input no-label-float type="text" on-change="_valueChanged" value="[[ getString(item, valuePath) ]]">
			</paper-input>
		</template>

		<template class="header">
			<paper-input label="[[ title ]]" value="{{ filter }}" focused="{{ headerFocused }}"></paper-input>
		</template>

	</template>
	<script>
		Polymer({

			is: 'cosmoz-omnitable-column',

			behaviors: [
				Cosmoz.OmnitableColumnBehavior
			],
			_serializeFilter: function (filter = this.filter) {
				return filter || null;
			},

			_deserializeFilter: function (obj) {
				return obj || null;
			},

			resetFilter: function () {
				this.filter = null;
			}
		});

	</script>
</dom-module>

<link rel="import" href="cosmoz-omnitable-column-behavior.html">
<link rel="import" href="../iron-icon/iron-icon.html"/>
<link rel="import" href="../paper-input/paper-input.html"/>

<dom-module id="cosmoz-omnitable-column">
	<template>
		<template class="cell">
			<span class="default-column">[[ getString(item, valuePath) ]]</span>
		</template>

		<template class="edit-cell">
			<paper-input no-label-float type="text" on-change="_valueChanged" value="[[ getString(item, valuePath) ]]">
			</paper-input>
		</template>

		<template class="header">
			<paper-input label="[[ title ]]" value="{{ filter }}" focused="{{ headerFocused }}">
				<iron-icon icon="clear" suffix slot="suffix" hidden$="[[ !filter.length ]]" style="cursor: pointer;" on-click="resetFilter"></iron-icon>
			</paper-input>
		</template>

	</template>
	<script>
		Polymer({

			is: 'cosmoz-omnitable-column',

			behaviors: [
				Cosmoz.OmnitableColumnBehavior
			],

			_serializeFilter(filter = this.filter) {
				return filter || null;
			},

			_deserializeFilter(obj) {
				return obj || null;
			},

			resetFilter() {
				this.filter = null;
			}
		});

	</script>
</dom-module>

Add clear button for regular columns
Add clear button for regular columns

Signed-off-by: Patrik Kullman <8612fec4a6bb0a11ae3ca5e27ebb050b4a73b7ea@neovici.se>
