import { DesignSystem } from '@ni/fast-foundation';
import { styles } from '../base/styles';
import { template } from '../base/template';
import { TableColumnTextBase, mixinTextBase } from '../text-base';
import { TableColumnSortOperation } from '../base/types';
import { tableColumnTextGroupHeaderViewTag } from './group-header-view';
import { tableColumnTextCellViewTag } from './cell-view';
import { mixinCustomSortOrderColumnAPI } from '../mixins/custom-sort-order';
import { TableColumnTextValidator } from './models/table-column-text-validator';
/**
 * The table column for displaying string fields as text.
 */
export class TableColumnText extends mixinCustomSortOrderColumnAPI(mixinTextBase((TableColumnTextBase))) {
    constructor() {
        super(...arguments);
        this.defaultSortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
    }
    placeholderChanged() {
        this.columnInternals.columnConfig = {
            placeholder: this.placeholder
        };
    }
    handleSortConfigurationChange() {
        this.updateColumnInternalsSortConfiguration();
    }
    getColumnInternalsOptions() {
        return {
            cellRecordFieldNames: ['value'],
            cellViewTag: tableColumnTextCellViewTag,
            groupHeaderViewTag: tableColumnTextGroupHeaderViewTag,
            delegatedEvents: [],
            sortOperation: this.getResolvedSortOperation(this.defaultSortOperation),
            validator: new TableColumnTextValidator()
        };
    }
    fieldNameChanged() {
        this.columnInternals.dataRecordFieldNames = [this.fieldName];
        this.updateColumnInternalsSortConfiguration();
    }
    updateColumnInternalsSortConfiguration() {
        this.columnInternals.operandDataRecordFieldName = this.getResolvedOperandDataRecordFieldName(this.fieldName);
        this.columnInternals.sortOperation = this.getResolvedSortOperation(this.defaultSortOperation);
    }
}
const nimbleTableColumnText = TableColumnText.compose({
    baseName: 'table-column-text',
    template,
    styles
});
DesignSystem.getOrCreate()
    .withPrefix('nimble')
    .register(nimbleTableColumnText());
export const tableColumnTextTag = 'nimble-table-column-text';
//# sourceMappingURL=index.js.map