From 13e70ddf5c22b33713dcb0d3bbdcb292e21cebf0 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Thu, 9 May 2024 15:30:56 -0700 Subject: [PATCH 1/2] 20989-add initial value prop --- src/components/jurisdiction/Jurisdiction.stories.ts | 11 +++++++++++ src/components/jurisdiction/Jurisdiction.vue | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/components/jurisdiction/Jurisdiction.stories.ts b/src/components/jurisdiction/Jurisdiction.stories.ts index ed8d6399..82160944 100644 --- a/src/components/jurisdiction/Jurisdiction.stories.ts +++ b/src/components/jurisdiction/Jurisdiction.stories.ts @@ -16,3 +16,14 @@ export const Default = Template.bind({}) Default['args'] = { showUsaJurisdictions: false } + +export const JurisdictionInitialValue = Template.bind({}) +JurisdictionInitialValue['args'] = { + showUsaJurisdictions: false, + initialValue: { + group: 0, + text: 'Alberta', + value: 'AB', + separator: false + } +} diff --git a/src/components/jurisdiction/Jurisdiction.vue b/src/components/jurisdiction/Jurisdiction.vue index ad7e13d5..98ce7031 100644 --- a/src/components/jurisdiction/Jurisdiction.vue +++ b/src/components/jurisdiction/Jurisdiction.vue @@ -23,10 +23,18 @@ export default class Jurisdiction extends Vue { @Prop({ default: 'Select the home jurisdiction' }) readonly label!: string @Prop() readonly errorMessages!: string @Prop({ default: false }) readonly showUsaJurisdictions!: boolean + @Prop({ default: null }) readonly initialValue!: string // variables jurisdiction = null + /** Called when component is created. */ + created (): void { + if (this.initialValue) { + this.jurisdiction = this.initialValue + } + } + /** The jursidiction select options */ get jurisdictionOptions (): Array { const array = [] as Array From 0620ddc329781aa38dfa486afbd2c444c5a71c11 Mon Sep 17 00:00:00 2001 From: ketaki-deodhar Date: Fri, 10 May 2024 08:23:39 -0700 Subject: [PATCH 2/2] 20989-update logic --- .../jurisdiction/Jurisdiction.stories.ts | 6 +-- src/components/jurisdiction/Jurisdiction.vue | 46 +++++++++++++++++-- .../foreign-jurisdiction-interface.ts | 8 ++++ 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 src/interfaces/foreign-jurisdiction-interface.ts diff --git a/src/components/jurisdiction/Jurisdiction.stories.ts b/src/components/jurisdiction/Jurisdiction.stories.ts index 82160944..bd6d981b 100644 --- a/src/components/jurisdiction/Jurisdiction.stories.ts +++ b/src/components/jurisdiction/Jurisdiction.stories.ts @@ -21,9 +21,7 @@ export const JurisdictionInitialValue = Template.bind({}) JurisdictionInitialValue['args'] = { showUsaJurisdictions: false, initialValue: { - group: 0, - text: 'Alberta', - value: 'AB', - separator: false + country: 'CA', + region: 'FD' } } diff --git a/src/components/jurisdiction/Jurisdiction.vue b/src/components/jurisdiction/Jurisdiction.vue index 98ce7031..0d6e566c 100644 --- a/src/components/jurisdiction/Jurisdiction.vue +++ b/src/components/jurisdiction/Jurisdiction.vue @@ -10,20 +10,22 @@