How to use the @pluginjs/utils.arrayDiff function in @pluginjs/utils

To help you get started, we’ve selected a few @pluginjs/utils 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 pluginjs / pluginjs / modules / multi-select / src / main.js View on Github external
set(value, trigger) {
    value = this.purifyValue(value)
    if (!arrayEqual(value, this.value)) {
      const unselected = arrayDiff(this.value, value)
      const selected = arrayDiff(value, this.value)
      this.value = value
      selected.forEach(v => this.select(v, trigger, false))
      unselected.forEach(v => this.unselect(v, trigger, false))

      this.setValueForElement(value)

      if (this.DROPDOWN) {
        this.DROPDOWN.update()
      }

      if (value.length === 0) {
        removeClass(this.classes.SELECTED, this.$wrap)

        if (trigger) {
          this.trigger(EVENTS.CLEAR)
        }
github pluginjs / pluginjs / modules / multi-select / src / main.js View on Github external
set(value, trigger) {
    value = this.purifyValue(value)
    if (!arrayEqual(value, this.value)) {
      const unselected = arrayDiff(this.value, value)
      const selected = arrayDiff(value, this.value)
      this.value = value
      selected.forEach(v => this.select(v, trigger, false))
      unselected.forEach(v => this.unselect(v, trigger, false))

      this.setValueForElement(value)

      if (this.DROPDOWN) {
        this.DROPDOWN.update()
      }

      if (value.length === 0) {
        removeClass(this.classes.SELECTED, this.$wrap)

        if (trigger) {
          this.trigger(EVENTS.CLEAR)