Skip to content

Commit

Permalink
feat(angular): add formly date element (#573)
Browse files Browse the repository at this point in the history
* feat(angular): add formly date element

* feat(angular): fix build

---------

Co-authored-by: Tim Sielemann <[email protected]>
  • Loading branch information
TimSielemann and Tim Sielemann authored Sep 27, 2024
1 parent 4113e59 commit 896cd9d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Component } from '@angular/core';
import { FieldType, FieldTypeConfig } from '@ngx-formly/core';

@Component({
selector: 'formly-date',
template: `
<cat-date
[formControl]="formControl"
[formlyAttributes]="field"
[requiredMarker]="props.requiredMarker"
[horizontal]="props.horizontal"
[autoComplete]="props.autoComplete"
[clearable]="props.clearable"
[hint]="props.hint"
[icon]="props.icon"
[iconRight]="props.iconRight"
[identifier]="props.identifier"
[label]="props.label"
[labelHidden]="props.labelHidden"
[max]="props.max"
[min]="props.min"
[name]="props.name"
[placeholder]="props.placeholder"
[textPrefix]="props.textPrefix"
[textSuffix]="props.textSuffix"
[readonly]="props.readonly"
[errors]="props.errors"
[errorUpdate]="props.errorUpdate"
[errorInit]="props.errorInit"
[nativeAttributes]="props.nativeAttributes"
>
</cat-date>
`
})
export class CatDateFieldType extends FieldType<FieldTypeConfig> {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { FormlyModule } from '@ngx-formly/core';
import { CatalystModule } from '@haiilo/catalyst-angular';
import { CatCheckboxFieldType } from './formly-checkbox/formly-checkbox.component';
import { CatDateFieldType } from './formly-date/formly-date.component';
import { CatDatepickerFieldType } from './formly-datepicker/formly-datepicker.component';
import { CatInputFieldType } from './formly-input/formly-input.component';
import { CatRadioGroupFieldType } from './formly-radio-group/formly-radio-group.component';
Expand All @@ -15,6 +16,7 @@ import { CatToggleFieldType } from './formly-toggle/formly-toggle.component';
@NgModule({
declarations: [
CatCheckboxFieldType,
CatDateFieldType,
CatDatepickerFieldType,
CatInputFieldType,
CatRadioFieldType,
Expand Down Expand Up @@ -60,12 +62,17 @@ import { CatToggleFieldType } from './formly-toggle/formly-toggle.component';
{
name: 'cat-select-formly',
component: CatSelectFieldType
},
{
name: 'cat-date-formly',
component: CatDateFieldType
}
]
})
],
exports: [
CatCheckboxFieldType,
CatDateFieldType,
CatDatepickerFieldType,
CatInputFieldType,
CatRadioFieldType,
Expand Down
1 change: 1 addition & 0 deletions angular/projects/catalyst-formly/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './lib/formly/formly-textarea/formly-textarea.component';
export * from './lib/formly/formly-radio-group/formly-radio-group.component';
export * from './lib/formly/formly-datepicker/formly-datepicker.component';
export * from './lib/formly/formly-select/formly-select.component';
export * from './lib/formly/formly-date/formly-date.component';

0 comments on commit 896cd9d

Please sign in to comment.