Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1x 8x 8x 8x 1x | import { FormlyFieldConfig } from '@ngx-formly/core'; import { Address } from 'ish-core/models/address/address.model'; /* * Abstract class that valid address configurations have to extend. * The countryCode, businessCustomer and shortForm properties will be set by the AddressFormConfigurationProvider */ export abstract class AddressFormConfiguration { countryCode = 'default'; businessCustomer = false; shortForm = false; abstract getFieldConfiguration(countryCode?: string): FormlyFieldConfig[]; abstract getModel(model?: Partial<Address>): Partial<Address>; } // helper method to reduce repetition when defining address form configurations containing standard fields export function addressesFieldConfiguration( keys: ( | keyof Address | (FormlyFieldConfig & { key: keyof Address }) | (keyof Address | (FormlyFieldConfig & { key: keyof Address }))[] )[] ): FormlyFieldConfig[] { return keys .map(key => Array.isArray(key) ? key?.length && { type: 'ish-fieldset-field', fieldGroup: addressesFieldConfiguration(key), } : typeof key === 'string' ? { type: `#${key}` } : key ) .filter(x => !!x); } |