How to use the @material/list/foundation function in @material/list

To help you get started, we’ve selected a few @material/list 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 pgbross / vue-material-adapter / packages / mcwv-list / mdc-list.js View on Github external
notifyAction: index => {
        emitCustomEvent(
          this.$el,
          ACTION_EVENT,
          { index },
          /** shouldBubble */ true,
        );
        this.$emit('action', { index });
      },
      isFocusInsideList: () => {
        return this.$el.contains(document.activeElement);
      },
    };

    this.foundation = new MDCListFoundation(adapter);

    this.foundation.init();
    this.foundation.layout();
    this.initializeListType();

    this.foundation.setSingleSelection(this.singleSelection);

    if (
      this.singleSelection &&
      typeof this.selectedIndex === 'number' &&
      !isNaN(this.selectedIndex)
    ) {
      this.foundation.setSelectedIndex(this.selectedIndex);
    }

    this.foundation.setWrapFocus(wrapFocus);
github pgbross / vue-material-adapter / packages / mcwv-list / list.js View on Github external
notifyAction: index => {
        emitCustomEvent(
          this.$el,
          ACTION_EVENT,
          { index },
          /** shouldBubble */ true,
        );
        this.$emit('action', { index });
      },
      isFocusInsideList: () => {
        return this.$el.contains(document.activeElement);
      },
      isRootFocused: () => document.activeElement === this.$el,
    };

    this.foundation = new MDCListFoundation(adapter);

    this.foundation.init();
    this.foundation.layout();
    this.initializeListType();

    this.foundation.setSingleSelection(this.singleSelection);

    if (
      this.singleSelection &&
      typeof this.selectedIndex === 'number' &&
      !isNaN(this.selectedIndex)
    ) {
      this.foundation.setSelectedIndex(this.selectedIndex);
    }

    this.foundation.setWrapFocus(wrapFocus);