Convert gr-confirm-cherrypick-conflict-dialog to typescript

Change-Id: Ia8869076771c0c6447ceee2af587b2bd142f13ae
This commit is contained in:
Dhruv Srivastava
2020-08-25 13:09:21 +02:00
parent 5c8ba85d29
commit af7dff9348

View File

@@ -14,21 +14,27 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import '../../../styles/shared-styles.js'; import '../../../styles/shared-styles';
import '../../shared/gr-dialog/gr-dialog.js'; import '../../shared/gr-dialog/gr-dialog';
import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners.js'; import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners';
import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin.js'; import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin';
import {PolymerElement} from '@polymer/polymer/polymer-element.js'; import {PolymerElement} from '@polymer/polymer/polymer-element';
import {htmlTemplate} from './gr-confirm-cherrypick-conflict-dialog_html.js'; import {htmlTemplate} from './gr-confirm-cherrypick-conflict-dialog_html';
import {customElement} from '@polymer/decorators';
/** declare global {
* @extends PolymerElement interface HTMLElementTagNameMap {
*/ 'gr-confirm-cherrypick-conflict-dialog': GrConfirmCherrypickConflictDialog;
class GrConfirmCherrypickConflictDialog extends GestureEventListeners( }
LegacyElementMixin(PolymerElement)) { }
static get template() { return htmlTemplate; }
static get is() { return 'gr-confirm-cherrypick-conflict-dialog'; } @customElement('gr-confirm-cherrypick-conflict-dialog')
export class GrConfirmCherrypickConflictDialog extends GestureEventListeners(
LegacyElementMixin(PolymerElement)
) {
static get template() {
return htmlTemplate;
}
/** /**
* Fired when the confirm button is pressed. * Fired when the confirm button is pressed.
@@ -42,22 +48,25 @@ class GrConfirmCherrypickConflictDialog extends GestureEventListeners(
* @event cancel * @event cancel
*/ */
_handleConfirmTap(e) { _handleConfirmTap(e: Event) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.dispatchEvent(new CustomEvent('confirm', { this.dispatchEvent(
composed: true, bubbles: false, new CustomEvent('confirm', {
})); composed: true,
bubbles: false,
})
);
} }
_handleCancelTap(e) { _handleCancelTap(e: Event) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.dispatchEvent(new CustomEvent('cancel', { this.dispatchEvent(
composed: true, bubbles: false, new CustomEvent('cancel', {
})); composed: true,
bubbles: false,
})
);
} }
} }
customElements.define(GrConfirmCherrypickConflictDialog.is,
GrConfirmCherrypickConflictDialog);