2.0.2 • Published 6 years ago

@softheon/forms v2.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Softheon Forms

Softheon Forms provides Angular developers pre defined form components so developers can quickly create forms in their web applications.

Quick Links


Getting Started

Step 1: Install Softheon Forms

Install the package.

npm install --save @softheon/forms@latest

Include a link to Softheon Workshop

<link rel="stylesheet" ref="https://softheonworkshop.azureedge.net/alpha-9-5/workshop.min.css">

Step 2: Install the component modules

Import the NgModule for each component you want to use:

import { SofNameModule, SofAddressModule } from '@softheon/forms';
@NgModule({
    ...
    imports: [SofNameModule, SofAddressModule]
    ...
})
export class MyAppModule { }

Alternatively, you can create a separate NgModule that imports all of the Angular Material components that you will use in your application. Then you can include this module wherever you'd like to use the components.

import { SofNameModule, SofAddressModule } from '@softheon/forms';
@NgModule({
    ...
    imports: [SofNameModule, SofAddressModule],
    exports: [SofNameModule, SofAddressModule]
    ...
})
export class MyCustomSoftheonFormsModule { }

Components

Address Component

<softheon-form-address> is a component used to wrap several Softheon inputs together which allows a user to enter their address.

API reference for Softheon Address Component

import { SofAddressModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
address: AddressThe address model.YesNull
required: booleanWhether the address is required.NoTrue
streetRequired: booleanWhether the street address is required. Overrides required property.NoNull
zipRequired: booleanWhether the zip code is required. Overrides the required property.NoNull
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
readonly: booleanWhether the component should be readonly.NoFalse
showStreetName2: booleanWhether to show Apt./Ste. input.NoFalse
disableState: booleanWhether to disable the state.NoFalse
defaultState: stringThe default state.NoNull
showZipCodeExt: booleanWhether to allow zip code to be greater than 5 digits.NoTrue
justZip: booleanWhether only the zip code field should be shown.NoFalse
street1Placeholder: stringPlaceholder text for street 1NoStreet
street2Placeholder: stringPlaceholder text for street 2NoApt./Ste. #
cityPlaceholder: stringPlaceholder text for cityNoCity
zipCodePlaceholder: stringPlaceholder text for cityNoZip Code

Additional Classes

Address

API reference for Address

import { Address } from '@softheon/forms';

Properties

NameDescription
streeName1: stringThe first line of the street address.
streetName2: stringThe second line of the street address.
cityName: stringThe name of the city where the address is located.
stateCode: stringThe two letter USPS State Code.
zipCode: stringThe full five or nine digit zip code

Alert Component

<softheon-form-alert> is a component used for displaying an alert message to the user

API reference for Softheon Form Alert Component

import { SofAlertModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
text: stringThe alert message to display.YesNull
show: booleanWhether the alert message should be shown.NoTrue
align: stringThe HTML alignment of the component. Can be left, center, or right.Nocenter

Amount Component

Coming Soon


Checkbox Validator Component

Coming Soon


Currency Component

<softheon-form-currency> is a component used for gathering currency amount.

API reference for Softheon Currency Component

import { SofCurrencyModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
value: stringThe currency modelYesNull
valueChange: EventEmitter<string>The currency amount output event emitterNoEventEmitter<string>
required: booleanWhether the currency component is required.NoTrue
prefix: stringWhat to display before the amount.No'$'
suffix: stringWhat to display after the amount.No''
includeThousandsSeparator: booleanWhether or not to separate thousands.NoTrue
thousandsSeparatorSymbol: stringCharacter with which to separate thousands.No','
allowDecimal: booleanWhether to allow the user to enter a fraction with the amount.NoTrue
decimalSymbol: stringCharacter that will act as a decimal point.No.
decimalLimit: numberHow many digits to allow after the decimal.No2
integerLimit: numberLimit the maximum currency amount. Set to null for no limit.NoNull
requireDecimal: booleanWhether to always include a decimal point and placeholder for decimal digits after the integer.NoFalse
allowNegative: booleanWhether to allow negative numbers.NoFalse
allowLeadingZeroes: booleanWhether to allow leading zeroes.NoFalse
placeHolder: stringThe placeholder text for the input.NoAmount

Date Picker Component

<softheon-form-date-picker> is a component used for creating an input that allows a user to select a date using a calendar.

API reference for Softheon Form Date Picker Component

import { SofDatePickerModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
date: DateThe Date model.YesNull
required: booleanWhether the date is required.NoTrue
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
placeholder: stringPlaceholder text for the date picker input.YesNull
maxDate: DateThe maximum date the date picker should allow.NoNull
minDate: DateThe minimum date the date picker should allow.NoNull
startAt: DateThe date the date picker should start with.NoNull

Email Component

Coming Soon


Name Component

<softheon-form-name> is a component used to wrap several Softheon inputs together which allows a user to enter their full name.

API reference for Softheon Form Name Component

import { SofNameModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
name: NameThe Name model.YesNull
required: booleanWhether first and last name should be required.NoTrue
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
showMiddle: booleanWhether middle name should be shown.NoTrue
showSuffix: booleanWhether suffix should be shown.NoTrue
suffixOptions: Suffix[]Array of suffixes to choose from.NoSuffix

Additional Classes

Name


Properties

NameDescription
firstName: stringThe first name.
middleName?: stringThe middle name.
lastName: stringThe last name.
suffix?: SuffixThe suffix.

Suffix


Enumeration of suffixes:

export enum Suffix {
    Jr = "Jr.",
    Sr = "Sr.",
    Ii = "II",
    Iii = "III",
    Iv = "IV"
  }

Phone Number Component

<softheon-form-phone-number> is a component used to collect a user's phone number with options to include phone type, calling code and extension code as well.

API reference for Softheon Phone Number Component

import { SofPhoneNumberModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
phoneNumber: PhoneNumberThe phone number model.YesNull
required: booleanWhether the phone number is required.NoTrue
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
showPhoneType: booleanWhether to ask for the phone type.NoTrue
showCallingCode: booleanWhether to ask for the calling code.NoFalse
showExtensionCode: booleanWhether to show the extension code.NoTrue
placeholder: stringThe placeholder text for the input.No'Phone Number'
placeholderExt: stringThe placeholder text for the extension code.No'Extension Code'
placeholderType: stringThe place older text for the phone type.No'Phone Type'

Additional Classes

Phone Number

This is the model for the phone number input. It includes the phone type, calling code, phone number and extension code.

Properties

NameDescription
type: PhoneTypeThe type of phone number. Usually can be work, mobile or home.
callingCode: stringThe calling code for the phone number. I.e. U.S.A is 1.
callingCodeName: stringThe country name for the calling code.
number: stringThe phone number.
extensionCode: stringThe extension code.

Methods

NameDescription
getCleanPhoneNumber(): stringRemoves any paranthesis, hyphens, or spaces from the phone number. I.e. (012) 345-6789 => 0123456789

|

Phone Type

Enumeration of phone types:

export enum PhoneType {
    HOME = 'HOME',
    WORK = 'WORK',
    MOBILE = 'MOBILE'
  }

Properties

Relationship Component

<softheon-form-relationship> is a component used to collect a user's relationship to the applicant.

API reference for Relationship Component

import { SofRelationshipModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
relationshipConst: stringRelationship category to use. Can be either family, legal or tax.Nofamily
required: booleanWhether relationship input is required.NoFalse
relationshipOptions: Relationship[]Array of available relationship options.No[]
isSpouse: booleanWhether the applicant is a spouse.NoFalse
relationship: RelationshipThe relationship model.YesNull
relationshipChange: EventEmitter<Relationship>Event emitter for relationship change event.NoEventEmitter<Relationship>

Additional Classes

Relationship Enumeration

This is the enumeration of all possible relationship options. Note you can define and pass your relationship options via the relationshipOptions property defined above.

export enum Relationship {
    SPOUSE = 'Spouse',
    PARENT = 'Parent',
    SON_DAUGHTER = 'Son or Daughter',
    STEPSON_STEPDAUGHTER = 'Stepchild',
    GRANDCHILD = 'Grandchild',
    SIBLING = 'Sibling',
    DOMESTIC_PARTNER = 'Domestic Partner',
    CHILD_OF_DOMESTIC_PARTNER = 'Child of Domestic Partner',
    UNRELATED = 'Unrelated',
    OTHER_RELATIVE = 'Other Relative',
    STEP_PARENT = 'Step Parent',
    AUNT_UNCLE = 'Aunt or Uncle',
    NEPHEW_NIECE = 'Nephew or Niece',
    GRANDPARENT = 'Grandparent',
    FIRST_COUSIN = 'First Cousin',
    PARENTS_DOMESTIC_PARTNER = 'Parent\'s Domestic Partner',
    OTHER = 'Other',
    BROTHER_IN_LAW_SISTER_IN_LAW = 'Sibling in law',
    DAUGHTER_IN_LAW_SON_IN_LAW = 'Son or Daughter in law',
    MOTHER_IN_LAW_FATHER_IN_LAW = 'Parent in law',
    SPONSORED_DEPENDENT = 'Sponsored Dependent',
    DEPENDENT_OF_A_MINOR_DEPENDENT = 'Dependent of Minor Dependent',
    SELF = 'Self',
  
    //legal specific
    FOSTER_CHILD = 'Foster Child',
    COURT_APPOINTED_GUARDIAN = 'Court Appointed Guardian',
    ADOPTED_CHILD = 'Adopted Child',
    FORMER_SPOUSE = 'Former Spouse',
    FOSTER_PARENT = 'formerParent',
    GUARDIAN = 'Guardian',
    ANNUITANT = 'Annuitant',
    TRUSTEE = 'Trustee',
    WARD = 'Ward',
  
    //Tax Specific
    TAX_FILER = 'Tax Filer',
    TAX_DEPENDENT = 'Tax Dependent',
    COLLATERAL_DEPENDENT = 'Collateral Dependent',
  
    // Other
    NONE = 'None of these'
  }

Family Relationships

Array of all family relationships.

/** Enumeration for family relationships */
export const FamilyRelationships: Relationship[] = [
  Relationship.SPOUSE,
  Relationship.PARENT,
  Relationship.SON_DAUGHTER,
  Relationship.STEPSON_STEPDAUGHTER,
  Relationship.GRANDCHILD,
  Relationship.SIBLING,
  Relationship.DOMESTIC_PARTNER,
  Relationship.CHILD_OF_DOMESTIC_PARTNER,
  Relationship.UNRELATED,
  Relationship.OTHER_RELATIVE,
  Relationship.STEP_PARENT,
  Relationship.AUNT_UNCLE,
  Relationship.NEPHEW_NIECE,
  Relationship.GRANDPARENT,
  Relationship.FIRST_COUSIN,
  Relationship.PARENTS_DOMESTIC_PARTNER,
  Relationship.OTHER,
  Relationship.BROTHER_IN_LAW_SISTER_IN_LAW,
  Relationship.DAUGHTER_IN_LAW_SON_IN_LAW,
  Relationship.MOTHER_IN_LAW_FATHER_IN_LAW,
  Relationship.SPONSORED_DEPENDENT,
  Relationship.DEPENDENT_OF_A_MINOR_DEPENDENT,
  Relationship.SELF,
];

Legal Relationships

Array of all legal relationships.

export const LegalRelationships: Relationship[] = [
  Relationship.ADOPTED_CHILD,
  Relationship.COURT_APPOINTED_GUARDIAN,
  Relationship.FORMER_SPOUSE,
  Relationship.FOSTER_CHILD,
  Relationship.FOSTER_PARENT,
  Relationship.GUARDIAN,
  Relationship.ANNUITANT,
  Relationship.TRUSTEE,
  Relationship.WARD,
  Relationship.OTHER,
];

Tax Relationships

Array of all tax relationships.

export const TaxRelationships: Relationship[] = [
  Relationship.TAX_FILER,
  Relationship.TAX_DEPENDENT,
  Relationship.COLLATERAL_DEPENDENT
];

Relationship Helper

Helper class providing methods for relationship component.

Properties

NameDescription
getCounterRelationship(relationship: Relationship)Gets the counter relationship for the given relationship. For example param = parent, return = child.

Social Security Number Component

<softheon-form-ssn> is a component used to collect a user's social security number. It automatically supports masking the user's social security number as well.

API reference for Social Security Number Component

import { SofSocialSecurityNumberModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
ssn: stringThe social security number modelYesNull
required: booleanWhether the social security number should be required.NoTrue
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
ssnChange: EventEmitter<string>Social security number change event emitter.NoEventEmitter<string>

State Component

Coming Soon


Status Frame Component

<softheon-form-ssn> is a component used to display a frame around the given HTML content. It displays a green bar in the frame once the content inside the frame is valid.

API reference for Status Frame Component

import { SofStatusFrameModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
name: stringThe name to be displayed in the status frame titleNoEmpty String
status: stringStatus of the frameNocomplete, progress or edit
valid: booleanWhether the content in the frame is validNoFalse
showHeader: booleanWhether to show the headerNoTrue
showStatus: booleanWhether to show the status based on form validityNoTrue
minimizable: booleanWhether the status frame component can be minimized/collapsedNoFalse
isMinimized: EventEmitter<boolean>Emits whether the status frame is minimized/collapsedNoEventEmitter<boolean>

Yes/No Question Component

<softheon-form-yes-no-question> is a component used to ask a general yes or no question.

API reference for Yes/No Question Component

import { SofYesNoQuestionModule } from '@softheon/forms';

Properties

NameDescriptionRequiredDefault
required: booleanWhether the question requires an answer.NoTrue
id: stringID used to differentiate a component when multiple instances appear on the same page.No''
label: stringThe question to ask.YesNull
tooltip: stringThe text to be displayed in the tool-tip.NoNull
yesText: stringThe text to display for the true option.NoYes
noText: stringThe text to display for the false option.NoNo
switchOrder: booleanIf true, the false option will be shown first.NoFalse
hasUnknown: booleanWhether there should be an unkonwn option.NoFalse
booleanChange: EventEmitter<boolean>The boolean output event.NoEventEmitter<boolean>
unknownChange: EventEmitter<boolean>The unkonwn boolean output event.NoEventEmitter<boolean>
onChange: EventEmitter<boolean>Event to hook into on change events.NoEventEmitter<boolean>

Directives

You can import all of the directives listed below by importing the SofDirecteModule module or you can import the individual directives that you need.

import { SofDirectiveModule } from '@softheon/forms';

Letters Only Directive

[lettersOnly] is a directive for restricting the input to be letters only.

API reference for Number of Digits Directive

import { LettersOnlyDirective } from '@softheon/forms';

Example

<input id="name" placeholder="Forst Name" [lettersOnly]="true"/>

Number of Digits Directive

[numberOfDigits] is a directive for validating the input has the required number of digits.

API reference for Number of Digits Directive

import { NumberOfDigitsDirective } from '@softheon/forms';

Example

<input id="ssn" placeholder="Social Security Number" [numberOfDigits]="9"/>

Number of Digits Range Directive

[numberOfDigitsRange] is a directive for validating the input has the required number of digits.

API reference for Number of Digits Directive

import { NumberOfDigitsRangeDirective } from '@softheon/forms';

Example

  /** The possible zip code length values */
  public readonly zipCodeLengthRange: number[] = [5, 9];
<input id="zipCode" placeholder="Zip Code" [numberOfDigitsRange]="zipCodeLengthRange"/>

Numbers Only Directive

[numbersOnly] is a directive for allowing only numbers to be entered into an input.

API reference for Numbers Only Directive

import { NumbersOnlyDirective } from '@softheon/forms';

Example

<input id="zipCode" placeholder="Zip Code" [numbersOnly]="true"/>

Provide Parent Form Directive

[provide-parent-form] is a directive that allows the parent form to be passed to the child.

API reference for Provide Parent Form Directive

import { ProvideParentFormDirective } from '@softheon/forms';

Example

<form #theForm="ngForm">
    <div provide-parent-form>        
    </div>
</form>
2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

7 years ago

1.10.9

7 years ago

1.10.8

7 years ago

1.10.7

7 years ago

1.10.6

7 years ago

1.10.5

7 years ago

1.10.4

7 years ago

1.10.3

7 years ago

1.10.2

7 years ago

1.10.1

7 years ago

1.10.0

7 years ago

1.9.4

7 years ago

1.9.3

7 years ago

1.9.2

7 years ago

1.9.1

7 years ago

1.9.0

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.1

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.4

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.6

7 years ago

1.4.54

7 years ago

1.4.53

7 years ago

1.4.52

7 years ago

1.4.51

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.0.1

7 years ago