<commit_before>import './cosmoz-omnitable-column-list-data';

import { PolymerElement } from '@polymer/polymer/polymer-element';
import { html } from '@polymer/polymer/lib/utils/html-tag';

import { translatable } from '@neovici/cosmoz-i18next';
import { columnMixin } from './cosmoz-omnitable-column-mixin';
import { listColumnMixin } from './cosmoz-omnitable-column-list-mixin';
import '@neovici/cosmoz-autocomplete';

/**
 * @polymer
 * @customElement
 * @appliesMixin listColumnMixin
 * @appliesMixin columnMixin
 */
class OmnitableColumnList extends listColumnMixin(
	columnMixin(translatable(PolymerElement))
) {
	static get template() {
		return html`
			<template class="cell" strip-whitespace>
				<cosmoz-omnitable-column-list-data
					items="[[ getTexts(item,valuePath, textProperty) ]]"
				>
				</cosmoz-omnitable-column-list-data>
			</template>

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

			<template class="header" strip-whitespace>
				<cosmoz-autocomplete-ui
					class$="external-values-[[ externalValues ]]"
					label="[[ title ]]"
					source="[[ _source ]]"
					text-property="[[ textProperty ]]"
					value="[[  _computeValue(filter, _source) ]]"
					text="[[ query ]]"
					on-change="[[ _onChange ]]"
					on-focus="[[ _onFocus ]]"
					on-text="[[ _onText ]]"
				>
					<template is="dom-if" if="[[ loading ]]">
						<paper-spinner-lite
							style="width: 20px; height: 20px;"
							suffix
							slot="suffix"
							active="[[ loading ]]"
						></paper-spinner-lite>
					</template>
				</cosmoz-autocomplete-ui>
			</template>
		`;
	}

	static get is() {
		return 'cosmoz-omnitable-column-list';
	}

}

customElements.define(OmnitableColumnList.is, OmnitableColumnList);
<commit_msg>fix(column-list): migrate templates to render functions<commit_after>import './cosmoz-omnitable-column-list-data';

import { PolymerElement } from '@polymer/polymer/polymer-element';
import {
	html, nothing
} from 'lit-html';

import { translatable } from '@neovici/cosmoz-i18next';
import { columnMixin } from './cosmoz-omnitable-column-mixin';
import { listColumnMixin } from './cosmoz-omnitable-column-list-mixin';
import '@neovici/cosmoz-autocomplete';

/**
 * @polymer
 * @customElement
 * @appliesMixin listColumnMixin
 * @appliesMixin columnMixin
 */
class OmnitableColumnList extends listColumnMixin(
	columnMixin(translatable(PolymerElement))
) {
	static get is() {
		return 'cosmoz-omnitable-column-list';
	}

	renderCell(column, { item }) {
		return html`<cosmoz-omnitable-column-list-data
			.items=${ column.getTexts(item, column.valuePath, column.textProperty) }
		></cosmoz-omnitable-column-list-data>`;
	}

	renderEditCell(column, { item }) {
		const onChange = event => {
			event.model = { item };
			return column._valueChanged(event);
		};

		return html`<paper-input
			no-label-float
			type="text"
			@change=${ onChange }
			.value=${ column.getString(item, column.valuePath) }
		></paper-input>`;
	}

	renderHeader(column) {
		const spinner = column.loading
			? html`<paper-spinner-lite style="width: 20px; height: 20px;" suffix slot="suffix" active></paper-spinner-lite>`
			: nothing;

		return html`<cosmoz-autocomplete-ui
			class="external-values-${ column.externalValues }"
			.label=${ column.title }
			.source=${ column._source }
			.textProperty=${ column.textProperty }
			.value=${ column._computeValue(column.filter, column._source) }
			.text=${ column.query }
			.onChange=${ column._onChange }
			.onFocus=${ column._onFocus }
			.onText=${ column._onText }
		>${ spinner }</cosmoz-autocomplete-ui>`;
	}
}

customElements.define(OmnitableColumnList.is, OmnitableColumnList);

{'fraction_non_alphanumeric': 0.16015727391874182, 'fraction_numerical': 0.003145478374836173, 'mean_word_length': 3.9494163424124515, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6589453', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1261, 'n_words': 220}