Move gr-shell-command to typescript
Change-Id: I3d32c7c293ecc44f599ccaa0aa648a2c38788e59
This commit is contained in:
@@ -14,31 +14,40 @@
|
|||||||
* 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 '../gr-copy-clipboard/gr-copy-clipboard.js';
|
import '../gr-copy-clipboard/gr-copy-clipboard';
|
||||||
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-shell-command_html.js';
|
import {htmlTemplate} from './gr-shell-command_html';
|
||||||
|
import {customElement, property} from '@polymer/decorators';
|
||||||
|
|
||||||
/** @extends PolymerElement */
|
declare global {
|
||||||
class GrShellCommand extends GestureEventListeners(
|
interface HTMLElementTagNameMap {
|
||||||
LegacyElementMixin(
|
'gr-shell-command': GrShellCommand;
|
||||||
PolymerElement)) {
|
|
||||||
static get template() { return htmlTemplate; }
|
|
||||||
|
|
||||||
static get is() { return 'gr-shell-command'; }
|
|
||||||
|
|
||||||
static get properties() {
|
|
||||||
return {
|
|
||||||
command: String,
|
|
||||||
label: String,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('gr-shell-command')
|
||||||
|
class GrShellCommand extends GestureEventListeners(
|
||||||
|
LegacyElementMixin(PolymerElement)
|
||||||
|
) {
|
||||||
|
static get template() {
|
||||||
|
return htmlTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property({type: String})
|
||||||
|
command: string | undefined;
|
||||||
|
|
||||||
|
@property({type: String})
|
||||||
|
label: string | undefined;
|
||||||
|
|
||||||
focusOnCopy() {
|
focusOnCopy() {
|
||||||
this.shadowRoot.querySelector('gr-copy-clipboard').focusOnCopy();
|
if (this.shadowRoot !== null) {
|
||||||
|
const copyClipboard = this.shadowRoot.querySelector('gr-copy-clipboard');
|
||||||
|
if (copyClipboard !== null) {
|
||||||
|
copyClipboard.focusOnCopy();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define(GrShellCommand.is, GrShellCommand);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user