@angular/material/checkbox#MatCheckboxChange TypeScript Examples

The following examples show how to use @angular/material/checkbox#MatCheckboxChange. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: get-addons.component.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
public async onColumnVisibleChange(event: MatCheckboxChange, column: ColumnState): Promise<void> {
    const colState = this.columnStates.find((col) => col.name === column.name);
    if (!colState) {
      return;
    }

    colState.visible = event.checked;
    await this._wowUpService.setGetAddonsHiddenColumns([...this.columnStates]);

    this.gridColumnApi.setColumnVisible(column.name, event.checked);
  }
Example #2
Source File: my-addons.component.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
public async onColumnVisibleChange(event: MatCheckboxChange, column: ColumnState): Promise<void> {
    const colState = this.columns.find((col) => col.name === column.name);
    if (!colState) {
      console.warn(`Column state not found: ${column.name}`);
      return;
    }

    colState.visible = event.checked;

    await this.wowUpService.setMyAddonsHiddenColumns([...this.columns]);

    this.gridColumnApi.setColumnVisible(column.name, event.checked);

    if (column.name === "latestVersion") {
      this._sessionService.myAddonsCompactVersion = !event.checked;
    }
  }
Example #3
Source File: algo-selector.component.ts    From zorro-fire-log with MIT License 6 votes vote down vote up
handleChange($event: MatCheckboxChange, node: Node, all: boolean = false) {
    if (all || !$event.checked) {
      this.checkNode($event.checked, node);
    }
    node.enabled = $event.checked;
    // this.enableByDescendant(this.nodes);
    const logFilter: LogFilter = {
      aliases: this.nodes.reduce((aliasacc, alias) => {
        aliasacc[alias.name] = {
          enabled: alias.enabled,
          expanded: alias.expanded,
          algos: alias.children.reduce((algoacc, algo) => {
            algoacc[algo.name] = {
              enabled: algo.enabled,
              expanded: algo.expanded,
              symbols: algo.children.reduce((symbolacc, symbol) => {
                symbolacc[symbol.name] = { enabled: symbol.enabled };
                return symbolacc;
              }, <SymbolFilter>{}),
            };
            return algoacc;
          }, <AlgoFilter>{}),
        };
        return aliasacc;
      }, <AliasFilter>{}),
    };
    this.logFilterChange.emit(logFilter);
  }
Example #4
Source File: delete-torrent-dialog.component.ts    From qbit-matUI with MIT License 5 votes vote down vote up
updateDeleteFilesFromDisk(event: MatCheckboxChange): void {
    this.deleteFilesOnDisk = event.checked;
  }
Example #5
Source File: configuration.component.ts    From bitcoin-s-ts with MIT License 5 votes vote down vote up
useTorChanged(change: MatCheckboxChange) {
    console.debug('useTorChanged()', change)
    this.torService.useTor = change.checked
  }
Example #6
Source File: json-schema-form.component.ts    From json-schema-form with Apache License 2.0 5 votes vote down vote up
/**
   * input element change handler.
   * normalize the different kind of events, handle the datatypes, set the value and emit the change
   */
  change(event: any) {

    let eventTarget: any;

    if (event instanceof MatSelectChange) {
      event = event.value;
    } else if (event instanceof MatDatepickerInputEvent) {
      event = this.serializeDate(event.value, this.schema.dateFormat, this.schema.type);
    } else if (event instanceof MatAutocompleteSelectedEvent) {
      event = event.option.value;
    } else if (event instanceof MatCheckboxChange) {
      event = event.checked;
    } else {
      // save the event target in case the parsing changes the value
      // (e.g. integer input 5.3 becomes 5, this is reflected on the UI via this handle)
      eventTarget = event.target;
      event = event.target.value;
    }

    if (event === '') {
      event = null;
    }

    if (event == null) {
      this.value = null;
    }

    if (this.schema.type === 'number') {
      this.value = parseFloat(event);
    } else if (this.schema.type === 'integer') {
      this.value = parseInt(event, 10);
    } else if (this.schema.type === 'boolean') {
      if (typeof event === 'string') {
        if (event === 'true') {
          this.value = true;
        } else if (event === 'false') {
          this.value = false;
        } else {
          this.value = null;
        }
      } else {
        this.value = event;
      }
    } else if (this.schema.type === 'string') {
      this.value = event;
    } else if (this.schema.type === 'array') {
      this.value = event;
    } else {
      throw new Error('unknown type: ' + this.schema.type);
    }

    this.emit(this.value);
  }
Example #7
Source File: checkbox.component.ts    From flingo with MIT License 5 votes vote down vote up
changed($event: MatCheckboxChange) {
        this.eventFunction();
    }