How to use the @material/dialog.MDCDialog function in @material/dialog

To help you get started, we’ve selected a few @material/dialog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TEIC / romajs / src / components / dialogs / NewAttribute.js View on Github external
componentDidMount() {
    this.dialog = new MDCDialog(this.refs.na)
    this.dialog.listen('MDCDialog:closed', (event) => {
      // NB default action needs to happen in all cases,
      // do not add breaks.
      switch (event.detail.action) {
        case 'add_attribute':
          this.props.add(this.state.attribute)
        case 'add_from_picker':
        case 'cancel':
        default:
          this.setState({attribute: this.defaultValue})
          this.props.hide()
          this.dialog.close()
      }
    })
    this.dialog.listen('MDCDialog:opened', () => {
      this.dialog.layout()
github fintechstudios / angularjs-mdc / src / mdc-dialog / service / $mdcDialog.js View on Github external
const mdcTextContent = controller.textContent || options.textContent ||
          controller.content || options.content || '';

        if (mdcHtmlContent && !$injector.has('$sanitize')) {
          throw Error('The ngSanitize module must be loaded in order to use htmlContent.');
        }

        if (mdcHtmlContent && mdcTextContent) {
          throw Error('mdc-dialog cannot have both `htmlContent` and `textContent`');
        }

        // Only assign the content if nothing throws, otherwise it'll still be compiled.
        controller.mdcHtmlContent = mdcHtmlContent;
        controller.mdcTextContent = mdcTextContent;
      }
      options.mdcDialog = new MDCDialog(element[0]);
    }
github GoogleChromeLabs / sample-currency-converter / scripts / main.js View on Github external
this._snackbar = new MDCSnackbar(document.querySelector('.mm-snackbar'));

    // Add event listener to button to toggle the menu on and off.
    this._elements.more.addEventListener('click', () =>
        this._booted.then(() => (menu.open = !menu.open)));

    // Add event listener to open Settings screen.
    document.querySelector('.mm-menu__settings').addEventListener('click',
        () => this._settingsViewPromise.then((view) => {
          view.show(this._screens.convert);
          history.pushState({page: 'settings'}, 'Settings');
        }));

    const ratesDialog =
        new MDCDialog(document.querySelector('#mm-rates-dialog'));
    document.querySelector('.mm-menu__rates').addEventListener('click', () => {
      this._updateRateInfo();
      ratesDialog.show();
    });
    document.querySelector('.mm-convert__last-updated').addEventListener(
        'click', () => {
          this._updateRateInfo();
          ratesDialog.show();
        });

    const aboutDialog =
        new MDCDialog(document.querySelector('#mm-about-dialog'));
    document.querySelector('.mm-menu__about').addEventListener('click', () => {
      this._updateRateInfo();
      aboutDialog.show();
    });
github matsp / material-components-vue / src / components / Dialog / Dialog.vue View on Github external
mounted() {
        let vm = this;
        vm.mdcDialog = new MDCDialog(this.$el)
        vm.mdcDialog.listen('MDCDialog:accept', function() {
            vm.$emit('accept')
        })
        vm.mdcDialog.listen('MDCDialog:cancel', function() {
            vm.$emit('cancel')
        })

        if (vm.$slots.dialogAcceptButton)
            vm.$slots.dialogAcceptButton.map((n) => {
                n.elm.classList.add('mdc-dialog__footer__button')
                n.elm.classList.add('mdc-dialog__footer__button--accept')
            })
        if (vm.$slots.dialogCancelButton)
            vm.$slots.dialogCancelButton.map((n) => {
                n.elm.classList.add('mdc-dialog__footer__button')
                n.elm.classList.add('mdc-dialog__footer__button--cancel')
github TEIC / romajs / src / components / dialogs / NewDatatype.js View on Github external
componentDidMount() {
    this.dialog = new MDCDialog(this.refs.na)
    this.dialog.listen('MDCDialog:closed', (event) => {
      switch (event.detail.action) {
        case 'add':
          this.props.createNewDatatype(this.state.name, this.state.module)
          this.setState({canCreate: false})
          this.props.hide()
          this.dialog.close()
          this.props.navigateTo(`/datatype/${this.state.name}`)
          break
        case 'cancel':
        default:
          this.props.hide()
          this.dialog.close()
      }
    })
    this.dialog.listen('MDCDialog:opened', () => {
github TEIC / romajs / src / components / pickers / ModalPicker.js View on Github external
componentDidMount() {
    this.dialog = new MDCDialog(this.refs.picker)
    this.dialog.listen('MDCDialog:closed', (event) => {
      switch (event.detail.action) {
        case 'cancel':
          this.props.cancel()
        default:
          this.dialog.close()
      }
    })
  }
github dessant / search-by-image / src / components / Dialog.vue View on Github external
mounted: function() {
    this.dialog = new MDCDialog(document.querySelector(`#${this.id}`));
    this.dialog.listen('MDCDialog:accept', this.onAccept);
    this.dialog.listen('MDCDialog:cancel', this.onCancel);
  },
github Tencent / omi / packages / omim / src / dialog / index.tsx View on Github external
installed() {
    this.dialog = new MDCDialog(this.shadowRoot.querySelector('.mdc-dialog'))

    this.props.show ? this.dialog.open() : this.dialog.close()

    this.dialog.listen('MDCDialog:opening', (e) => { this._fire('opening', e) })
    this.dialog.listen('MDCDialog:opened', (e) => { this._fire('opened', e) })
    this.dialog.listen('MDCDialog:closing', (e) => { this._fire('closing', e) })
    this.dialog.listen('MDCDialog:closed', (e) => { this._fire('closed', e) })
  }
github TEIC / romajs / src / components / dialogs / ErrorReporting.js View on Github external
componentDidMount() {
    this.dialog = new MDCDialog(this.refs.na)
    this.dialog.listen('MDCDialog:closed', (event) => {
      switch (event.detail.action) {
        case 'restart':
          this.props.goHome()
        case 'cancel':
        default:
          this.props.hide()
          this.dialog.close()
      }
    })
    this.dialog.listen('MDCDialog:opened', () => {
      this.dialog.layout()
    })
  }