How to use the vuelidate/lib/validators.minValue function in vuelidate

To help you get started, we’ve selected a few vuelidate 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 gardener / dashboard / frontend / src / components / ShootWorkers / WorkerInputGeneric.vue View on Github external
return {
        worker: {
          name: {
            required,
            maxLength: maxLength(15),
            noStartEndHyphen, // Order is important for UI hints
            resourceName,
            uniqueWorkerName
          },
          volume: {
            size: {
              minVolumeSize: minVolumeSize(this.minimumVolumeSize)
            }
          },
          minimum: {
            minValue: minValue(0)
          },
          maximum: {
            minValue: minValue(0)
          },
          maxSurge: {
            numberOrPercentage
          },
          zones: {
            required
          }
        }
      }
    },
    machineTypes () {
github sogehige / sogeBot / src / panel / views / managers / price / price-edit.vue View on Github external
} = {
    loading: this.$state.progress,
    save: this.$state.idle,
    pending: false,
  }

  item: Price = {
    id: uuid(), command: '', price: 1, enabled: true
  }


  @Validations()
  validations = {
    item: {
      command: { required },
      price: { minValue: minValue(1), required },
    }
  }

  @Watch('item', { deep: true })
  pending() {
    if (this.state.loading === this.$state.success) {
      this.state.pending = true;
    }
  }

  async mounted() {
    if (this.$route.params.id) {
      await new Promise((resolve, reject) => {
        this.socket.emit('price::getOne', this.$route.params.id, (data) => {
        console.debug({price_data: data})
        this.item = data;
github sogehige / sogeBot / src / panel / views / registries / alerts / components / form-resubs.vue View on Github external
@PropSync('alert') readonly data !: AlertResub
  @Prop() readonly index !: number

  customShow: 'html' | 'css' | 'js' = 'html';
  fonts: {text: string; value: string}[] = [];

  @Watch('$v', { deep: true })
  emitValidation() {
    this.$emit('update:isValid', !this.$v.$error)
  }

  @Validations()
  validations = {
    data: {
      messageTemplate: {required},
      variantAmount: {required, minValue: minValue(0)},
    }
  }

  async mounted() {
    if (this.data.advancedMode.html === null) {
      this.data.advancedMode.html = text;
    }
    if (this.data.advancedMode.js === null) {
      this.data.advancedMode.js = textjs;
    }
    const { response } = await new Promise(resolve => {
      const request = new XMLHttpRequest();
      request.open('GET', '/fonts', true);

      request.onload = function() {
        if (!(this.status >= 200 && this.status < 400)) {
github bytefury / crater / resources / assets / js / views / estimates / Item.vue View on Github external
validations () {
    return {
      item: {
        name: {
          required
        },
        quantity: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        price: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        discount_val: {
          between: between(0, this.maxDiscount)
        },
        description: {
          maxLength: maxLength(255)
        }
      }
    }
  },
  created () {
github gardener / dashboard / frontend / src / components / WorkerInputGce.vue View on Github external
}

  const validations = {
    worker: {
      name: {
        required,
        uniqueWorkerName
      },
      volumeSize: {
        minVolumeSize: minVolumeSize(1)
      },
      autoScalerMin: {
        minValue: minValue(1)
      },
      autoScalerMax: {
        minValue: minValue(1)
      }
    }
  }

  export default {
    components: {
      SizeInput,
      MachineType,
      VolumeType
    },
    props: {
      worker: {
        type: Object,
        required: true
      },
      workers: {
github desec-io / desec-stack / webapp / src / components / Domain / RRset.vue View on Github external
methods: {
    getRecordComponentName (type) {
      let genericComponentName = 'Record'
      let specificComponentName = genericComponentName + type
      if (this.types.includes(type) && specificComponentName in this.$options.components) {
        return specificComponentName
      }
      return genericComponentName
    }
  },
  validations: {
    rrset: {
      ttl: {
        required,
        integer,
        minValue: minValue(MinTTL)
      }
    }
  },
  computed: {
    errors () {
      return Object.entries(this.errorDict).filter(entry => !this.$v.rrset.ttl[entry[0]]).map(entry => entry[1])
    },
    left () {
      return this.limit - this.current()
    }
  }
}
github sogehige / sogeBot / src / panel / views / registries / carousel-overlay / carousel-overlay-edit.vue View on Github external
]

  state: {
    loading: number;
    save: number;
    pending: boolean;
  } = {
    loading: this.$state.progress,
    save: this.$state.idle,
    pending: false,
  }

  @Validations()
  validations = {
    item: {
      waitBefore: {required, minValue: minValue(0)},
      waitAfter: {required, minValue: minValue(0)},
      animationInDuration: {required, minValue: minValue(100)},
      animationOutDuration: {required, minValue: minValue(100)},
    }
  }

  @Watch('item', { deep: true })
  pending() {
    if (this.state.loading === this.$state.success) {
      this.state.pending = true;
    }
  }

  save() {
    this.$v.$touch();
    if (!this.$v.$invalid) {
github bytefury / crater / resources / assets / js / views / items / Create.vue View on Github external
created () {
    if (this.isEdit) {
      this.loadEditData()
    }
  },
  validations: {
    formData: {
      name: {
        required,
        minLength: minLength(3)
      },
      price: {
        required,
        numeric,
        maxLength: maxLength(10),
        minValue: minValue(0.1)
      },
      description: {
        maxLength: maxLength(255)
      }
    }
  },
  methods: {
    ...mapActions('item', [
      'addItem',
      'fetchItem',
      'updateItem'
    ]),
    async loadEditData () {
      let response = await this.fetchItem(this.$route.params.id)
      this.formData = response.data.item
      this.formData.unit = this.units.find(_unit => response.data.item.unit === _unit.name)
github bytefury / crater / resources / assets / js / views / invoices / Item.vue View on Github external
validations () {
    return {
      item: {
        name: {
          required
        },
        quantity: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        price: {
          required,
          minValue: minValue(1),
          maxLength: maxLength(20)
        },
        discount_val: {
          between: between(0, this.maxDiscount)
        },
        description: {
          maxLength: maxLength(255)
        }
      }
    }
  },
github frankfoerster / tipsy / src / Assets / js / src / components / GameVote.vue View on Github external
validations() {
      return {
        result1: {
          required,
          integer,
          minValue: minValue(0)
        },
        result2: {
          required,
          integer,
          minValue: minValue(0)
        }
      }
    },