forked from bcgov/business-filings-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AGM Location Change second PR (bcgov#554)
* AGM Location Change second PR * Fixed unit tests * fixed in response to Sev's comments * fixed error text
- Loading branch information
1 parent
1b7a981
commit a6cc5e2
Showing
6 changed files
with
149 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<template> | ||
<v-text-field | ||
id="agm-location" | ||
ref="textAreaRef" | ||
filled | ||
:label="textFieldlabel" | ||
:rules="rules" | ||
:value="locationValue" | ||
@input="emitInput($event)" | ||
/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Emit, Prop, Vue, Watch } from 'vue-property-decorator' | ||
@Component({}) | ||
export default class AgmLocation extends Vue { | ||
// Refs | ||
$refs!: { | ||
textAreaRef: any | ||
} | ||
/** The AGM location text field value. */ | ||
@Prop({ default: '' }) readonly locationValue!: string | ||
/** The AGM location text field label. */ | ||
@Prop({ default: 'AGM Location' }) readonly textFieldlabel!: string | ||
/** The AGM location text field rules. */ | ||
@Prop({ default: () => [] }) readonly rules!: any[] | ||
/** Prompt the validations. Used for global validations. */ | ||
@Prop({ default: false }) readonly validateForm!: boolean | ||
agmLocation = '' | ||
/** Called when component is created. */ | ||
created (): void { | ||
// inform parent of initial validity | ||
this.emitValid(this.locationValue) | ||
} | ||
/** Validate the AGM location text field */ | ||
@Watch('validateForm') | ||
validateAgmLocation (): void { | ||
if (this.validateForm && !this.agmLocation) { | ||
this.$refs.textAreaRef.validate() | ||
this.$refs.textAreaRef.error = true | ||
} | ||
} | ||
/** Emits an event with the changed input (ie, updated v-model). */ | ||
@Emit('update:agmLocation') | ||
emitInput (val: string): void { | ||
this.emitValid(val) | ||
this.$refs.textAreaRef.error = false | ||
} | ||
/** Emits an event indicating whether or not this component is valid. */ | ||
@Emit('valid') | ||
emitValid (val: string): boolean { | ||
// component is valid if every rule is valid | ||
return this.rules.every(rule => rule(val) === true) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './office-address-schema' | ||
export * from './location-address-schema' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.