import * as tslib_1 from "tslib";
import ADialog from './ADialog';
/** @internal */
var EditPatternDialog = /** @class */ (function (_super) {
    tslib_1.__extends(EditPatternDialog, _super);
    function EditPatternDialog(column, dialog, idPrefix) {
        var _this = _super.call(this, dialog, {
            fullDialog: true
        }) || this;
        _this.column = column;
        _this.idPrefix = idPrefix;
        return _this;
    }
    EditPatternDialog.prototype.build = function (node) {
        var templates = this.column.patternTemplates;
        node.insertAdjacentHTML('beforeend', "<strong>Edit Pattern (access via ${value}, ${item})</strong><input\n        type=\"text\"\n        size=\"30\"\n        value=\"" + this.column.getPattern() + "\"\n        required\n        autofocus\n        placeholder=\"pattern (access via ${value}, ${item})\"\n        " + (templates.length > 0 ? "list=\"ui" + this.idPrefix + "lineupPatternList\"" : '') + "\n      >");
        if (templates.length > 0) {
            node.insertAdjacentHTML('beforeend', "<datalist id=\"ui" + this.idPrefix + "lineupPatternList\">" + templates.map(function (t) { return "<option value=\"" + t + "\">"; }) + "</datalist>");
        }
    };
    EditPatternDialog.prototype.reset = function () {
        this.node.querySelector('input').value = '';
        this.column.setPattern('');
    };
    EditPatternDialog.prototype.submit = function () {
        var newValue = this.node.querySelector('input').value;
        this.column.setPattern(newValue);
        return true;
    };
    return EditPatternDialog;
}(ADialog));
export default EditPatternDialog;
//# sourceMappingURL=EditPatternDialog.js.map