@bcrs-shared-components/base-address 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ import type { Meta } from '@storybook/vue'
2
+ import { BaseAddress } from './index'
3
+ import Vuetify from 'vuetify'
4
+
5
+ const meta: Meta<typeof BaseAddress> = {
6
+ title: 'component/BaseAddress'
7
+ }
8
+ export default meta
9
+
10
+ const Template = (args, { argTypes }) => ({
11
+ vuetify: new Vuetify({ iconfont: 'mdi' }),
12
+ props: Object.keys(argTypes),
13
+ components: { BaseAddress },
14
+ template: '<BaseAddress v-bind="$props" />' // $props comes from args below
15
+ })
16
+
17
+ export const DefaultBaseAddress = Template.bind({})
18
+ DefaultBaseAddress['args'] = {
19
+ editing: true,
20
+ schema: null,
21
+ address: {}
22
+ }
23
+ export const FilledInBaseAddress = Template.bind({})
24
+ FilledInBaseAddress['args'] = {
25
+ editing: true,
26
+ schema: null,
27
+ address: {
28
+ streetAddress: '1234 Sesame Street',
29
+ streetAddressAdditional: '4th Floor',
30
+ addressCity: 'Victoria',
31
+ addressRegion: 'British Columbia',
32
+ addressCountry: 'Canada',
33
+ postalCode: 'V8N 1A1',
34
+ deliveryInstructions: 'Leave at front door'
35
+ },
36
+ noPoBox: true
37
+ }
@@ -0,0 +1,558 @@
1
+ //
2
+ // Copyright © 2020 Province of British Columbia
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5
+ // the License. You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10
+ // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11
+ // specific language governing permissions and limitations under the License.
12
+ //
13
+
14
+ <template>
15
+ <div class="base-address">
16
+ <!-- Display fields -->
17
+ <v-expand-transition>
18
+ <div
19
+ v-if="!editing"
20
+ class="address-block"
21
+ >
22
+ <div class="address-block__info pre-line">
23
+ <div class="address-block__info-row street-address">
24
+ {{ addressLocal.streetAddress }}
25
+ </div>
26
+
27
+ <div class="address-block__info-row street-address-additional">
28
+ {{ addressLocal.streetAddressAdditional }}
29
+ </div>
30
+
31
+ <div class="address-block__info-row">
32
+ <span class="address-city">{{ addressLocal.addressCity }}</span>
33
+
34
+ <template v-if="addressLocal.addressRegion">
35
+ <span class="address-region">&nbsp;{{ addressLocal.addressRegion }}</span>
36
+ </template>
37
+
38
+ <template v-if="addressLocal.postalCode">
39
+ <span class="postal-code">&nbsp;{{ addressLocal.postalCode }}</span>
40
+ </template>
41
+ </div>
42
+
43
+ <div class="address-block__info-row address-country">
44
+ {{ getCountryName(addressCountry) }}
45
+ </div>
46
+
47
+ <template v-if="addressLocal.deliveryInstructions">
48
+ <div class="address-block__info-row delivery-instructions mt-5 font-italic">
49
+ {{ addressLocal.deliveryInstructions }}
50
+ </div>
51
+ </template>
52
+ </div>
53
+ </div>
54
+ </v-expand-transition>
55
+
56
+ <!-- Edit fields -->
57
+ <v-expand-transition>
58
+ <v-form
59
+ v-if="editing"
60
+ ref="addressForm"
61
+ name="address-form"
62
+ lazy-validation
63
+ >
64
+ <div class="form__row">
65
+ <!-- NB1: AddressComplete needs to be enabled each time user clicks in this search field.
66
+ NB2: Only process first keypress -- assumes if user moves between instances of this
67
+ component then they are using the mouse (and thus, clicking). -->
68
+ <v-text-field
69
+ :id="streetAddressId"
70
+ v-model="addressLocal.streetAddress"
71
+ autocomplete="chrome-off"
72
+ :name="Math.random()"
73
+ filled
74
+ class="street-address"
75
+ :hint="streetAddressHint"
76
+ persistent-hint
77
+ :label="streetAddressLabel"
78
+ :rules="[...rules.streetAddress, ...spaceRules]"
79
+ @keypress.once="enableAddressComplete()"
80
+ @click="enableAddressComplete()"
81
+ />
82
+ </div>
83
+ <div class="form__row">
84
+ <v-textarea
85
+ v-model="addressLocal.streetAddressAdditional"
86
+ auto-grow
87
+ filled
88
+ class="street-address-additional"
89
+ :label="streetAddressAdditionalLabel"
90
+ rows="1"
91
+ :rules="[...rules.streetAddressAdditional, ...spaceRules]"
92
+ />
93
+ </div>
94
+ <div class="form__row three-column">
95
+ <v-text-field
96
+ v-model="addressLocal.addressCity"
97
+ filled
98
+ class="item address-city"
99
+ :label="addressCityLabel"
100
+ :rules="[...rules.addressCity, ...spaceRules]"
101
+ />
102
+ <v-select
103
+ v-if="useCountryRegions(addressCountry)"
104
+ v-model="addressLocal.addressRegion"
105
+ filled
106
+ class="item address-region"
107
+ :menu-props="{maxHeight:'40rem'}"
108
+ :label="addressRegionLabel"
109
+ item-text="name"
110
+ item-value="short"
111
+ :items="getCountryRegions(addressCountry)"
112
+ :rules="[...rules.addressRegion, ...spaceRules]"
113
+ />
114
+ <v-text-field
115
+ v-else
116
+ v-model="addressLocal.addressRegion"
117
+ filled
118
+ class="item address-region"
119
+ :label="addressRegionLabel"
120
+ :rules="[...rules.addressRegion, ...spaceRules]"
121
+ />
122
+ <v-text-field
123
+ v-model="addressLocal.postalCode"
124
+ filled
125
+ class="item postal-code"
126
+ :label="postalCodeLabel"
127
+ :rules="[...rules.postalCode, ...spaceRules]"
128
+ />
129
+ </div>
130
+ <div class="form__row">
131
+ <v-select
132
+ v-model="addressLocal.addressCountry"
133
+ filled
134
+ class="address-country"
135
+ :label="addressCountryLabel"
136
+ menu-props="auto"
137
+ item-text="name"
138
+ item-value="code"
139
+ :items="getCountries()"
140
+ :rules="[...rules.addressCountry, ...spaceRules]"
141
+ @change="resetRegion()"
142
+ />
143
+ <!-- special field to select AddressComplete country, separate from our model field -->
144
+ <input
145
+ :id="addressCountryId"
146
+ type="hidden"
147
+ :value="addressCountry"
148
+ >
149
+ </div>
150
+ <div class="form__row">
151
+ <v-textarea
152
+ v-model="addressLocal.deliveryInstructions"
153
+ auto-grow
154
+ filled
155
+ class="delivery-instructions"
156
+ :label="deliveryInstructionsLabel"
157
+ rows="2"
158
+ :rules="[...rules.deliveryInstructions, ...spaceRules]"
159
+ />
160
+ </div>
161
+ </v-form>
162
+ </v-expand-transition>
163
+ </div>
164
+ </template>
165
+
166
+ <script lang="ts">
167
+ import Vue from 'vue'
168
+ import { required } from 'vuelidate/lib/validators'
169
+ import { Component, Mixins, Emit, Prop, Watch } from 'vue-property-decorator'
170
+ import { Validation } from 'vue-plugin-helper-decorator'
171
+ import { uniqueId } from 'lodash'
172
+ import { ValidationMixin, CountriesProvincesMixin } from '@bcrs-shared-components/mixins'
173
+
174
+ /**
175
+ * The component for displaying and editing an address.
176
+ * Vuelidate is used to implement the validation rules (eg, what 'required' means and whether it's satisfied).
177
+ * Vuetify is used to display any validation errors/styling.
178
+ * Optionally uses Canada Post AddressComplete (aka Postal Code Anywhere - PCA) for address lookup.
179
+ */
180
+ @Component({
181
+ mixins: [ValidationMixin, CountriesProvincesMixin]
182
+ })
183
+ export default class BaseAddress extends Mixins(ValidationMixin, CountriesProvincesMixin) {
184
+ /**
185
+ * The validation object used by Vuelidate to compute address model validity.
186
+ * @returns the Vuelidate validations object
187
+ */
188
+ @Validation()
189
+ public validations (): any {
190
+ return { addressLocal: { ...this.schemaLocal } }
191
+ }
192
+
193
+ /**
194
+ * The address to be displayed/edited.
195
+ * Default is "empty address" in case parent doesn't provide it (eg, for new address).
196
+ */
197
+ @Prop({
198
+ default: () => ({
199
+ streetAddress: '',
200
+ streetAddressAdditional: '',
201
+ addressCity: '',
202
+ addressRegion: '',
203
+ postalCode: '',
204
+ addressCountry: '',
205
+ deliveryInstructions: ''
206
+ })
207
+ })
208
+ readonly address: object
209
+
210
+ /** Whether the address should be shown in editing mode (true) or display mode (false). */
211
+ @Prop({ default: false })
212
+ readonly editing: boolean
213
+
214
+ /** The address schema containing Vuelidate rules. */
215
+ @Prop({ default: null })
216
+ readonly schema: any
217
+
218
+ @Prop({ default: false })
219
+ readonly noPoBox: boolean
220
+
221
+ resetRegion () {
222
+ this.addressLocal['addressRegion'] = ''
223
+ }
224
+
225
+ /** A local (working) copy of the address, to contain the fields edited by the component (ie, the model). */
226
+ addressLocal: object = {}
227
+
228
+ /** A local (working) copy of the address schema. */
229
+ schemaLocal: any = {}
230
+
231
+ /** A unique id for this instance of this component. */
232
+ uniqueId = uniqueId()
233
+
234
+ /** A unique id for the Street Address input. */
235
+ get streetAddressId (): string {
236
+ return `street-address-${this.uniqueId}`
237
+ }
238
+
239
+ /** A unique id for the Address Country input. */
240
+ addressCountryId (): string {
241
+ return `address-country-${this.uniqueId}`
242
+ }
243
+
244
+ /** The Address Country, to simplify the template and so we can watch it below. */
245
+ get addressCountry (): string {
246
+ return this.addressLocal['addressCountry']
247
+ }
248
+
249
+ /** The Street Address Additional label with 'optional' as needed. */
250
+ get streetAddressAdditionalLabel (): string {
251
+ return 'Additional Street Address' + (this.isSchemaRequired('streetAddressAdditional') ? '' : ' (Optional)')
252
+ }
253
+
254
+ /** The Street Address label with 'optional' as needed. */
255
+ get streetAddressLabel (): string {
256
+ return 'Street Address' + (this.isSchemaRequired('streetAddress') ? '' : ' (Optional)')
257
+ }
258
+
259
+ /** The Address City label with 'optional' as needed. */
260
+ get addressCityLabel (): string {
261
+ return 'City' + (this.isSchemaRequired('addressCity') ? '' : ' (Optional)')
262
+ }
263
+
264
+ /** The Address Region label with 'optional' as needed. */
265
+ get addressRegionLabel (): string {
266
+ let label: string
267
+ let required = this.isSchemaRequired('addressRegion')
268
+
269
+ // NB: make region required for Canada and USA
270
+ if (this.addressLocal['addressCountry'] === 'CA') {
271
+ label = 'Province'
272
+ required = true
273
+ } else if (this.addressLocal['addressCountry'] === 'US') {
274
+ label = 'State'
275
+ required = true
276
+ } else {
277
+ label = 'Province/State'
278
+ }
279
+
280
+ return label + (required ? '' : ' (Optional)')
281
+ }
282
+
283
+ /** The Postal Code label with 'optional' as needed. */
284
+ get postalCodeLabel (): string {
285
+ let label: string
286
+ if (this.addressLocal['addressCountry'] === 'US') {
287
+ label = 'Zip Code'
288
+ } else {
289
+ label = 'Postal Code'
290
+ }
291
+ return label + (this.isSchemaRequired('postalCode') ? '' : ' (Optional)')
292
+ }
293
+
294
+ /** The Address Country label with 'optional' as needed. */
295
+ get addressCountryLabel (): string {
296
+ return 'Country' + (this.isSchemaRequired('addressCountry') ? '' : ' (Optional)')
297
+ }
298
+
299
+ /** The Delivery Instructions label with 'optional' as needed. */
300
+ get deliveryInstructionsLabel (): string {
301
+ return 'Delivery Instructions' + (this.isSchemaRequired('deliveryInstructions') ? '' : ' (Optional)')
302
+ }
303
+
304
+ get streetAddressHint (): string {
305
+ return this.noPoBox ? 'Address cannot be a PO Box' : ''
306
+ }
307
+
308
+ /** Whether the specified prop is required according to the schema. */
309
+ isSchemaRequired (prop: string): boolean {
310
+ return Boolean(this.schemaLocal && this.schemaLocal[prop] && this.schemaLocal[prop].required)
311
+ }
312
+
313
+ /** Array of validation rules used by input elements to prevent extra whitespace. */
314
+ readonly spaceRules: Array<(v: string) => boolean | string> = [
315
+ v => !/^\s/g.test(v) || 'Invalid spaces', // leading spaces
316
+ v => !/\s$/g.test(v) || 'Invalid spaces', // trailing spaces
317
+ v => !/\s\s/g.test(v) || 'Invalid word spacing' // multiple inline spaces
318
+ ]
319
+
320
+ /**
321
+ * The Vuetify rules object. Used to display any validation errors/styling.
322
+ * NB: As a getter, this is initialized between created() and mounted().
323
+ * @returns the Vuetify validation rules object
324
+ */
325
+ get rules (): { [attr: string]: Array<() => boolean | string> } {
326
+ return this.createVuetifyRulesObject('addressLocal') as { [attr: string]: Array<() => boolean | string> }
327
+ }
328
+ /** Emits an update message for the address prop, so that the caller can ".sync" with it. */
329
+ @Emit('update:address')
330
+ emitAddress (address: object): void { }
331
+
332
+ /** Emits the validity of the address entered by the user. */
333
+ @Emit('valid')
334
+ emitValid (valid: boolean): void { }
335
+
336
+ /**
337
+ * Watches changes to the Schema object, so that if the parent changes the data, then
338
+ * the working copy of it is updated.
339
+ */
340
+ @Watch('schema', { deep: true, immediate: true })
341
+ onSchemaChanged (): void {
342
+ this.schemaLocal = { ...this.schema }
343
+ }
344
+
345
+ /**
346
+ * Watches changes to the Address object, so that if the parent changes the data, then
347
+ * the working copy of it is updated.
348
+ */
349
+ @Watch('address', { deep: true, immediate: true })
350
+ onAddressChanged (): void {
351
+ this.addressLocal = { ...this.address }
352
+ }
353
+
354
+ /**
355
+ * Watches changes to the Address Country and updates the schema accordingly.
356
+ */
357
+ @Watch('addressCountry')
358
+ onAddressCountryChanged (): void {
359
+ // skip this if component is called without a schema (eg, display mode)
360
+ if (this.schema) {
361
+ if (this.useCountryRegions(this.addressLocal['addressCountry'])) {
362
+ // we are using a region list for the current country so make region a required field
363
+ const addressRegion = { ...this.schema.addressRegion, required }
364
+ // re-assign the local schema because Vue does not detect property addition
365
+ this.schemaLocal = { ...this.schema, addressRegion }
366
+ } else {
367
+ // we are not using a region list for the current country so remove required property
368
+ const { required, ...addressRegion } = this.schema.addressRegion
369
+ // re-assign the local schema because Vue does not detect property deletion
370
+ this.schemaLocal = { ...this.schema, addressRegion }
371
+ }
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Watches changes to the Address Local object, to catch any changes to the fields within the address.
377
+ * Will notify the parent object with the new address and whether or not the address is valid.
378
+ */
379
+ @Watch('addressLocal', { deep: true, immediate: true })
380
+ onAddressLocalChanged (): void {
381
+ this.emitAddress(this.addressLocal)
382
+ this.emitValid(!this.$v.$invalid)
383
+ }
384
+
385
+ /**
386
+ * Determines whether to use a country's known regions (ie, provinces/states).
387
+ * @param code the short code of the country
388
+ * @returns whether to use v-select (true) or v-text-field (false) for input
389
+ */
390
+ useCountryRegions (code: string): boolean {
391
+ return (code === 'CA' || code === 'US')
392
+ }
393
+
394
+ /** Enables AddressComplete for this instance of the address. */
395
+ enableAddressComplete (): void {
396
+ // If you want to use this component with the Canada Post AddressComplete service:
397
+ // 1. The AddressComplete JavaScript script (and stylesheet) must be loaded.
398
+ // 2. Your AddressComplete account key must be defined.
399
+ const pca = window['pca']
400
+ const key = window['addressCompleteKey']
401
+ if (!pca || !key) {
402
+ // eslint-disable-next-line no-console
403
+ console.log('AddressComplete not initialized due to missing script and/or key')
404
+ return
405
+ }
406
+
407
+ // Destroy the old object if it exists, and create a new one.
408
+ if (window['currentAddressComplete']) {
409
+ window['currentAddressComplete'].destroy()
410
+ }
411
+ window['currentAddressComplete'] = this.createAddressComplete(pca, key)
412
+ }
413
+
414
+ /**
415
+ * Creates the AddressComplete object for this instance of the component.
416
+ * @param pca the Postal Code Anywhere object provided by AddressComplete
417
+ * @param key the key for the Canada Post account that is to be charged for lookups
418
+ * @returns an object that is a pca.Address instance
419
+ */
420
+ createAddressComplete (pca, key: string): object {
421
+ // Set up the two fields that AddressComplete will use for input.
422
+ // Ref: https://www.canadapost.ca/pca/support/guides/advanced
423
+ // Note: Use special field for country, which user can't click, and which AC will overwrite
424
+ // but that we don't care about.
425
+ const fields = [
426
+ { element: this.streetAddressId, field: 'Line1', mode: pca.fieldMode.SEARCH },
427
+ { element: this.addressCountryId, field: 'CountryName', mode: pca.fieldMode.COUNTRY }
428
+ ]
429
+ const options = { key }
430
+
431
+ const addressComplete = new pca.Address(fields, options)
432
+
433
+ // The documentation contains sample load/populate callback code that doesn't work, but this will. The side effect
434
+ // is that it breaks the autofill functionality provided by the library, but we really don't want the library
435
+ // altering the DOM because Vue is already doing so, and the two don't play well together.
436
+ addressComplete.listen('populate', this.addressCompletePopulate)
437
+
438
+ return addressComplete
439
+ }
440
+
441
+ /**
442
+ * Callback to update the address data after the user chooses a suggested address.
443
+ * @param address the data object returned by the AddressComplete Retrieve API
444
+ */
445
+ addressCompletePopulate (address: object): void {
446
+ const newAddressLocal: object = {}
447
+
448
+ newAddressLocal['streetAddress'] = address['Line1'] || 'N/A'
449
+ // Combine extra address lines into Street Address Additional field.
450
+ newAddressLocal['streetAddressAdditional'] = this.combineLines(
451
+ this.combineLines(address['Line2'], address['Line3']),
452
+ this.combineLines(address['Line4'], address['Line5'])
453
+ )
454
+ newAddressLocal['addressCity'] = address['City']
455
+ if (this.useCountryRegions(address['CountryIso2'])) {
456
+ // In this case, v-select will map known province code to province name
457
+ // or v-select will be blank and user will have to select a known item.
458
+ newAddressLocal['addressRegion'] = address['ProvinceCode']
459
+ } else {
460
+ // In this case, v-text-input will allow manual entry but province info is probably too long
461
+ // so set region to null and add province name to the Street Address Additional field.
462
+ // If length is excessive, user will have to fix it.
463
+ newAddressLocal['addressRegion'] = null
464
+ newAddressLocal['streetAddressAdditional'] = this.combineLines(
465
+ newAddressLocal['streetAddressAdditional'], address['ProvinceName']
466
+ )
467
+ }
468
+ newAddressLocal['postalCode'] = address['PostalCode']
469
+ newAddressLocal['addressCountry'] = address['CountryIso2']
470
+
471
+ // re-assign the local address to force Vuetify update
472
+ this.addressLocal = newAddressLocal
473
+
474
+ // Validate the form, in case any fields are missing or incorrect.
475
+ Vue.nextTick(() => { (this.$refs.addressForm as any).validate() })
476
+ }
477
+
478
+ combineLines (line1: string, line2: string) {
479
+ if (!line1) return line2
480
+ if (!line2) return line1
481
+ return line1 + '\n' + line2
482
+ }
483
+ }
484
+ </script>
485
+
486
+ <style lang="scss" scoped>
487
+ @import "../../assets/styles/theme.scss";
488
+
489
+ // Address Block Layout
490
+ .address-block {
491
+ display: flex;
492
+ }
493
+
494
+ .address-block__info {
495
+ flex: 1 1 auto;
496
+ }
497
+
498
+ .address-block__info-row {
499
+ color: $gray7;
500
+ }
501
+
502
+ // Form Row Elements
503
+ .form__row.three-column {
504
+ align-items: stretch;
505
+ display: flex;
506
+ flex-flow: row nowrap;
507
+ margin-left: -0.5rem;
508
+ margin-right: -0.5rem;
509
+
510
+ .item {
511
+ flex: 1 1 auto;
512
+ flex-basis: 0;
513
+ margin-left: 0.5rem;
514
+ margin-right: 0.5rem;
515
+ }
516
+ }
517
+
518
+ // text field labels
519
+ ::v-deep .v-label {
520
+ color: $gray7;
521
+ font-size: $px-16;
522
+ font-weight: normal;
523
+ }
524
+
525
+ // text field inputs
526
+ ::v-deep {
527
+ .v-input input {
528
+ color: $gray9;
529
+ }
530
+ }
531
+
532
+ .pre-line {
533
+ white-space: pre-line;
534
+ }
535
+
536
+ // make 'readonly' inputs looks disabled
537
+ // (can't use 'disabled' because we want normal error styling)
538
+ .v-select.v-input--is-readonly,
539
+ .v-text-field.v-input--is-readonly {
540
+ pointer-events: none;
541
+
542
+ ::v-deep .v-label {
543
+ // set label colour to same as disabled
544
+ color: rgba(0,0,0,.38);
545
+ }
546
+
547
+ ::v-deep .v-select__selection {
548
+ // set selection colour to same as disabled
549
+ color: rgba(0,0,0,.38);
550
+ }
551
+
552
+ ::v-deep .v-icon {
553
+ // set error icon colour to same as disabled
554
+ color: rgba(0,0,0,.38) !important;
555
+ opacity: 0.6;
556
+ }
557
+ }
558
+ </style>
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as BaseAddress } from './BaseAddress.vue'
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@bcrs-shared-components/base-address",
3
+ "version": "2.0.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "dependencies": {
8
+ "@bcrs-shared-components/mixins": "^1.1.20",
9
+ "lodash.uniqueid": "^4.0.1",
10
+ "vue": "^2.7.14",
11
+ "vuelidate": "^0.7.4"
12
+ },
13
+ "devDependencies": {
14
+ "vue-plugin-helper-decorator": "^0.0.11",
15
+ "vue-property-decorator": "^9.1.2"
16
+ },
17
+ "gitHead": "a3832931fe42e8f70d534735131f775bf1864f35"
18
+ }