import { subscribeDOM } from '@kano/common/index.js';
import { PartEditorField } from '../field.js';
export class StringPartEditorField extends PartEditorField {
    constructor(component, key) {
        super(component, key);
        this.subscriptions = [];
        this._el = document.createElement('div');
        this._label = document.createElement('label');
        this._label.innerText = this.getFullKeyName();
        this._input = document.createElement('input');
        this._input.value = this._component[this._key];
        subscribeDOM(this._input, 'input', this._onKeyUp, this, this.subscriptions);
        this._el.appendChild(this._label);
        this._el.appendChild(this._input);
    }
    static get propertyType() {
        return String;
    }
    _getInputValue() {
        return this._input.value;
    }
    _onKeyUp() {
        this.setValue(this._getInputValue());
        this._component.invalidate();
    }
    dispose() {
        super.dispose();
        this.subscriptions.forEach(d => d.dispose());
        this.subscriptions.length = 0;
    }
}
//# sourceMappingURL=string.js.map