<commit_before>import Component from '../component';
import { GRID_NAME } from '@grid/view/definition';
import { jobLine } from '@grid/core/services/job.line';
import { Fastdom } from '@grid/core/services/fastdom';

class CellHandler extends Component {
	constructor($element) {
		super();

		this.element = $element[0];
		this.job = jobLine(150);
	}

	onInit() {
		const model = this.root.model;
		const table = this.root.table;
		const element = this.element;

		// When navigate first or when animation wasn't applied we need to omit
		// next navigation event to make handler to correct position.
		let isValid = false;
		model.navigationChanged.watch(e => {
			if (e.hasChanges('cell')) {
				const cell = e.state.cell;
				if (cell) {
					const oldColumn = e.changes.cell.oldValue ? e.changes.cell.oldValue.column : {};
					const newColumn = e.changes.cell.newValue ? e.changes.cell.newValue.column : {};

					// Do not apply animation for columns that have viewWidth assigned
					// because it can be animated too.
					const shouldAnimate = oldColumn.key === newColumn.key || !(oldColumn.viewWidth || newColumn.viewWidth);
					if (!shouldAnimate) {
						isValid = false;
						return;
					}

					const domCell = table.body.cell(e.state.rowIndex, e.state.columnIndex);
					if (isValid) {
						domCell.addClass('q-grid-animate');
						element.classList.add('q-grid-active');

						this.job(() => {
							element.classList.remove('q-grid-active');
							domCell.removeClass('q-grid-animate');
						});
					}

					Fastdom.measure(() => {
						const target = domCell.element;
						const scrollState = model.scroll();<commit_msg>clear q-grid-animate on job reset<commit_after>import Component from '../component';
import { GRID_NAME } from '@grid/view/definition';
import { jobLine } from '@grid/core/services/job.line';
import { Fastdom } from '@grid/core/services/fastdom';

class CellHandler extends Component {
	constructor($element) {
		super();

		this.element = $element[0];
		this.job = jobLine(150);
	}

	onInit() {
		const model = this.root.model;
		const table = this.root.table;
		const element = this.element;

		// When navigate first or when animation wasn't applied we need to omit
		// next navigation event to make handler to correct position.
		let isValid = false;
		model.navigationChanged.watch(e => {
			if (e.hasChanges('cell')) {
				const cell = e.state.cell;
				if (cell) {
					const oldColumn = e.changes.cell.oldValue ? e.changes.cell.oldValue.column : {};
					const newColumn = e.changes.cell.newValue ? e.changes.cell.newValue.column : {};

					// Do not apply animation for columns that have viewWidth assigned
					// because it can be animated too.
					const shouldAnimate = oldColumn.key === newColumn.key || !(oldColumn.viewWidth || newColumn.viewWidth);
					if (!shouldAnimate) {
						isValid = false;
						return;
					}

					const domCell = table.body.cell(e.state.rowIndex, e.state.columnIndex);
					if (isValid) {
						domCell.addClass('q-grid-animate');
						element.classList.add('q-grid-active');

						this.job(() => {
							element.classList.remove('q-grid-active');
							domCell.removeClass('q-grid-animate');
						}).catch(() => {
							domCell.removeClass('q-grid-animate');
						});
					}

					Fastdom.measure(() => {
						const target = domCell.element;
						const scrollState = model.scroll();
{'fraction_non_alphanumeric': 0.14015933903806432, 'fraction_numerical': 0.002360578341693715, 'mean_word_length': 3.045346062052506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '4726834', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1013, 'n_words': 247}