NG Dynamic Forms Core
Installation
npm i @ng-dynamic-forms/core -S
Import
@NgModule({
imports: [
ReactiveFormsModule,
DynamicFormsCoreModule
]
})
export class AppModule {}
A rapid form development library for Angular
npm i @ng-dynamic-forms/core -S
@NgModule({
imports: [
ReactiveFormsModule,
DynamicFormsCoreModule
]
})
export class AppModule {}
distinctUntilChanged()
operator in DynamicFormsRelationService
to performance problems (closes #1060)karma-coverage
from karma-coverage-instanbul-reporter
angular2-text-mask
has finally been replaced with ngx-mask
This means from now text masking is only available to UI components that use a built-in
mask feature or do not already apply a custom ControlValueAccessor
like Material.
In order to integrate ngx-mask
properly, a maskConfig
property has been added to DynamicInputModel
while the type of mask
has been
narrowed to string
.
mask?: string;
maskConfig?: Partial<IConfig>;
DynamicFormService.detectChanges()
(closes #1060)Customizing the condition for displaying validation error messages can now be achieved by providing a
DynamicErrorMessagesMatcher
via newly introduced injection token DYNAMIC_ERROR_MESSAGES_MATCHER
:
function myCustomErrorMessagesMatcher (control: AbstractControl, model: DynamicFormControlModel, hasFocus: boolean) {
return //...
};
providers: [
{
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
useValue: myCustomErrorMessagesMatcher
},
By default the DEFAULT_ERROR_STATE_MATCHER
is active:
export const DEFAULT_ERROR_STATE_MATCHER: DynamicErrorMessagesMatcher =
(control: AbstractControl, model: DynamicFormControlModel, hasFocus: boolean) => {
return control.touched && !hasFocus;
};
Please read the updated chapter on validation messaging
ChangeDetectionStrategy.OnPush
under the hood.
Whenever modifying a DynamicFormControlModel
(except for value
and disabled
setters) that means you need to manually
trigger change detection by simply calling detectChanges()
on DynamicFormService
. Please also read the new chapter on updating form controls.
BEFORE:
// Immeditialy triggers UI update
myModel.value = "New Value";
myModel.disabled = true;
myModel.label = "New Label";
AFTER:
// This still works
myModel.value = "New Value";
myModel.disabled = true;
// This doesn't work automatically any more
myModel.label = "New Label";
// You need to manually trigger change detection
this.formService.detectChanges();
findModelById<T>
and findControlByModel<T>
now use a type variable so you don't need to cast its return value any more.DISABLED_MATCHER
has been renamed to DISABLED_MATCHER_PROVIDER
HIDDEN_MATCHER
has been renamed to HIDDEN_MATCHER_PROVIDER
REQUIRED_MATCHER
has been renamed to REQUIRED_MATCHER_PROVIDER
A new UI package @ng-dynamic-forms/ui-ngx-bootstrap
has been released. This allows using ngx-bootstrap with Bootstrap 4 now.
Thus the package @ng-dynamic-forms/ui-bootstrap
from now on is only recommended if still need to support Bootstrap 3.correctly
appendTo
input now works in PrimeNG Dropdown and MultiselectdecimalSeparator
, thousandSeparator
, formatInput
and size
inputs now works in PrimeNG SpinnerUpdating value
and disabled
properties of any DynamicFormControlModel
is now possible via simple setters:
BEFORE:
myModel.valueUpdates.next("New Value");
myModel.disabledUpdates.next(true);
AFTER:
myModel.value = "New Value";
myModel.disabled = true;
Therefore both valueUpdates
and disabledUpdates
Subject
s have been removed from DynamicFormControlModel
.
You can still track changes via newly introduced valueChanges
and disabledChanges
Observable
s.
reflect-metadata
is now directly imported by the library so there's no need to import it on your own in polyfills.ts
any more.
closed
output now working correctly in ng-bootstrap datepicker (closes #994)modules
closes #996)rootPath
is now correctly processed for multiple related form controls (closes #990)min
/max
properties are null
(closes #989)DynamicFormComponentService
now gives warning instead of failing when called with index argument for non-array (closes #974)DynamicFormControlContainerComponent
model type css classDynamicFormLayout
now supports selecting of form control types and multiple idsDynamicFormControlContainerComponent
templates now render a css class by model typefindControlByModel()
function added to DynamicFormService
findByModel() function added to
DynamicFormLayoutService`relation
property of DynamicFormControlModel
has been renamed to relations
action
property on DynamicFormControlRelation
has been renamed to match
connective
property on DynamicFormControlRelation
has been renamed to operator
DynamicFormInstancesService
now working correctly (closes #933)autoWidth
removed from DynamicPrimeNGDropdownComponent
(closes #945)fullTemplateCheck
(closes #884)DynamicPrimeNGCalendarComponent
bug fixed (closes #921)event-stream
dependencies removed@ng-bootstrap/ng-bootstrap
dependency version has been corrected (closes #872)MatAutocomplete
via list
propertybindId
@Input() has been completely removedDynamicIdDirective
has been abandoned internally in favor of always setting an element id nowDynamicFormModel
is now a type alias for DynamicFormControlModel[]
DynamicFormsCoreModule
via forRoot()
has been removedDynamicFormsCoreModule
via forRoot
is now deprecated and will be removed in next major versionchildren
property added to DynamicFormControlLayoutConfig
(closes #821)onLabel
and offLabel
inputs have been removed from Prime NG input switch componentcompareWithFn
support for DynamicSelectModel
(closes #820)ChangeDetection.OnPush
removed from Material UI components due to issues (closes #808)cdkTextareaAutosize
support for Material UI textarea component (closes #819)DynamicMaterialChipsComponent
now correctly implements model value updates (closes #774)DynamicOptionControlModel
works again (closes #763)DynamicKendoCheckboxGroupComponent
and DynamicNGBootstrapCheckboxGroupComponent
now correctly update values on checkbox model (closes #744)showTime
input (closes #723)MAT_RIPPLE_GLOBAL_OPTIONS
, MAT_LABEL_GLOBAL_OPTIONS
, MAT_CHIPS_DEFAULT_OPTIONS
and MAT_AUTOCOMPLETE_DEFAULT_OPTIONS
DynamicRatingModel
NgbDatepickerConfig
, NgbRatingConfig
and NgbTimepickerConfig
Please note that there's currently no release for ui-ionic
package due to build incompatibilities with Angular 6!
hasErrorMessaging
input has been completely removed in favor of solely relying on model.hasErrorMessages
getterdf
prefix has been removed from outputs in favor of simply using (blur)
, (change)
and (focus)
againDynamicFormControlValue
type has been completely removed in favor of simply using any
DynamicFormControlComponent
has been renamed to DynamicFormControlContainerComponent
4.0.0
stable (closes #687)value
property of DynamicFormValueControlModel
now accepts 0
(closes #710)color
and disableRipple
inputs via additional
)1.0.0
stablepattern
binding added to ion input (closes #645)2.0.0
maxLength
attribute added to Material textarea controlbeta.9
hidden
property added to DynamicFormControlModel
for hiding form controls InjectionToken
DYNAMIC_VALIDATORS
for entirely avoiding any mangling issues when using custom validators
(see updated chapter on Custom Validators)beta.8
ngx-bootstrap
is now a peer dependency of @ng-dynamic-forms/ui-bootstrap
)DynamicColorPickerModel
additional
property added to DynamicFormValueControlModel
for individually configuring UI components
(see new chapter on form component configuration)beta.7
name
property can now be configured on any DynamicFormControlModel
(closes #600)5.0.0
hint
support for Select in Material UI package (closes #608)5.0.0-rc.2
beta.6
strictNullChecks
again (closes #614)clsConfig
for providing layout information is now deprecated5.0.0-rc.1
5.0.0
5.0.0-rc0
blur
, focus
and change
outputs have been prefixed with df
to avoid any interference with native control events bubbling up
(see updated README.md)asyncValidator
and validator
properties from DynamicFormGroupModel
and DynamicFormArrayModel
have been removed and replaced by asyncValidators
and validators
groupAsyncValidator
and groupValidator
properties from DynamicFormArrayModel
have been removed and replaced by groupAsyncValidators
and groupValidators
getAsyncValidator()
and getValidator()
function signatures from DynamicFormValidationService
have been changedcreateFormGroup()
function from DynamicFormService
now accepts AbstractControlOptions
instead of extra
asyncValidators
and validators
on FormArray
and FormGroup
FormHooks
via new property updateOn
on DynamicFormControlModel
DynamicFormControlComponent
instead of either / orvalidators
and asyncValidators
at runtime via new updateValidators()
and updateAsyncValidators()
functions on DynamicFormValidationService
(closes #342) DynamicDateControlModel
now accepts date values of type object
in order to support proprietary date representations, e.g. NgbDateStruct
in NG Bootstrap (closes #556)This will be the last release before Angular 5.
There'll be a major version incrementation to 5.0.0
to fully stay in sync with Angular version numbers in the future.
beta.12
@angular/common
to be bundled with *.es.js
files@angular/compiler-cli
(closes #514)beta.11
:bangbang:@ng2-dynamic-forms has been renamed to @ng-dynamic-forms:bangbang:
Please update your dependencies:
npm uninstall @ng2-dynamic-forms/core @ng2-dynamic-forms/ui-<package_name> -S
npm install @ng-dynamic-forms/core @ng-dynamic-forms/ui-<package_name> -S
k-required
is now automatically added to error messages in Kendo for color styling<ng-content>
has been removed as it has little benefit and never been officially documented noUnusedParameters
and strictNullChecks
TypeScript transpiler checks (closes #497)DynamicValidationService
now correctly resolves alternate validator notationoptions
property added to ClsConfig
for applying CSS classes to a single option in a radio groupsui-primeng
beta.4
FormGroup
s (closes #475)indeterminated
support added for DynamicCheckboxModel
in most UI templatesDynamicFormControlComponent
selectors have been added <dynamic-form-bootstrap-control>
becomes <dynamic-bootstrap-form-control>
DynamicFormComponent
<dynamic-bootstrap-form>
DynamicFormControlComponents
via *ngFor
DynamiCheckboxGroupModel
btn-primary
is not applied automatically anymore DynamicRatingModel
filterable
support for dropdown and multiselect controls in Prime NG UI package (closes #448) 1.4.17
has been removed in favor of a more global approach due to impassesparent
property added for DynamicFormControlModel
via newly introduced interface DynamicPathable
getPath()
method added to DynamicFormService
(see #414)DynamicFormArrayGroupModel
can now directly be referenced by a local default template variable (see updated README.md)createGroup
of DynamicFormArrayModel
**has been renamed to groupFactory
(see updated README.md)parent
and path
getter added to DynamicFormArrayGroupModel
(closes #414DynamicFormAutoFillService
has been refactored to a simple utility class AutoFillUtils
(see updated README.md)group
and host
added for more flexible custom layouts<div>
instead of <fieldset>
due to CSS Flexbox bug<ng-template>
input property type
has been renamed to as
(currently suported by Kendo UI and Prime NG - see updated README.md)DynamicFormService
imports cleaned up (closes #402)package.json
files (closes #398)DynamicFormControlEvent
has been enhanced by group
and context
properties (closes #378)disabled
input bindings have been completely removed from Kendo UI template of
Observable operator import added (closes #372)option
property of DynamicOptionControlModel
now finally supports Observable
s (closes #165) NgbRadioGroup
(closes #356)beta.5
NgbRadioGroup
(closes #351)**/bundles/*.umd.js
bundle files are not affected by this)tabIndex
now supported in ui-primeng
FileList
is now correctly read from file inputs (closes #304)DynamicTimePickerModel
addedui-ionic
, ui-ng-bootstrap
and ui-primeng
4.0.0
(closes #340)noImplicitAny: true
TypeScript errors have been removed (closes #345)ui-kendo
moveFormGroupControl()
function added to DynamicFormService
(closes #339)DynamicDatepickerModel
has been renamed to DynamicDatePickerModel
placeholder
property added to DynamicDateControlModel
ui-kendo
DynamicFormBootstrapComponent
now has new @Input() asBootstrapFormGroup
:
This is a major improvement to make complex form layouts more easy to achieve.
By default form-group
CSS class now is not set for nested form models anymore. README.md
files of UI packages now contain form control overview multiple
now working for DynamicSelectModel
in ui-material
md-error
added for DynamicInputModel
and DynamicTextareaModel
in ui-material
DynamicEditorModel
in ui-primeng
(closes #317)format
property added to DynamicDateControl
(closes #318)ui-primeng
(closes #319)Dateinput
in ui-kendo
[controlGroup]
input binding of DynamicFormControlComponent
is now deprecated! Use [group]
instead!moduleId
is now removed from distributed component *.ts files (closes #301)ui-material
and ui-primeng
(closes #294)module
and typings
properties to package.json
to fix Rollup "MISSING IMPORTS" error (probably closes #267)DynamicFormArrayModel
typings adjusted (closes #289)ui-primeng
(see example)findById()
function of DynamicFormService
is now capable of looking up nested form group models (closes #286)Chips
in ui-primeng
(closes #275)NG_VALIDATORS
now working when using Angular CLI without webpack.config
(closes #271)Upload
in ui-kendo
2.4.8
@angular/material beta.2
align
property (closes #264)modelType
property (closes #265)2.4.7
2.0.0
max
and min
support for calendar in ui-kendo
2.4.6
Calendar
in ui-kendo
and ui-primeng
fromJSON(json: string | Object[])
function refactored to accept raw JSON strings and to revive Date
objects2.4.5
DynamicFormService
(closes #252)AutoComplete
, MaskedTextBox
and NumericTextBox
in ui-kendo
2.4.4
ui-kendo
2.4.3
ui-material
and ui-primeng
(closes #240)2.4.2
DynamicFormService
has now a function moveFormArrayGroup(index: number, step: number, formArray: FormArray, model: DynamicFormArrayModel)
to dynamically move form array elements (see updated live example)get(index: number)
function added to DynamicFormArrayGroupModel
[(ngModel)]
could be completely removed from ui-primeng
template at last !!! IMPORTANT !!!
Adding custom templates has become more powerful!
You now need to assign a modelId
attribute to any of your custom templates.
Please see new chapter in README.md and updated examples!
@angular 2.4.1
@angular/material beta.1
@Input() showCharacterHint
added in DynamicFormMaterialComponent
DynamicSelectModel
now enabled in ui-kendo
DynamicFormsCoreModule
now working when used in async routes (closes #212)hint
property added to Cls
interfaceDynamicSliderModel
and DynamicSwitchModel
are now correctly deserialized from JSONmin
and max
typing updated (closes #206)@angular 2.3.1
foundation 6.3.0
primeng 1.1.0
DynamicSliderModel
added (working in ui-material
, ui-kendo
, ui-primeng
)DynamicSelectModel
now working in ui-material
hint
now working in ui-basic
(closes #203)@angular 2.3.0
rxjs rc.4
zone.js 0.7.2
@angular-material alpha-11.3
!!! IMPORTANT !!! All Validators
of any DynamicFormControlModel
now need to be configured by a simply object literal (similar to errorMessages
) instead of an Array<ValidatorFn | AsyncValidatorFn>
.
This change was unavoidable to allow proper serialization for all validators as well as a significant code reduction (closes #200)!.
Defining validators becomes even more easy now!
Before:
new DynamicInputModel({
id: "myInput",
validators: [Validators.required, Validators.minLength(3)]
})
After:
new DynamicInputModel({
id: "myInput",
validators: {
required: null,
minLength: 3
}
})
Please see updated example for practical use!!!
ui-material
now supports offLabel
and onLabel
properties of DynamicSwitchModel
(see Material example)@angular 2.2.4
change
event handler in DynamicFormBasicComponent
corrected (closes #197)@angular/material
import removed from DynamicFormControlComponent
(closes #194)ui-foundation
and ui-primeng
now support DynamicSwitchModel
DynamicSwitchModel
now has offLabel
and onLabel
propertiesDynamicFormControlRelationModel
refactored and DynamicFormRelationService
introduced 4.0.0
DynamicCheckboxGroupModel
internally works identical to DynamicFormGroupModel
now in order to make property bindings work correctly
(closes #172 and #189)blur, focus, change
events are now emitted for single checkbox in a DynamicCheckboxGroupModel
instead of the whole group@angular/material
change events are now correctly included in DynamicFormControlEvent
@angular 2.2.3
primeng 1.0.0
addGroup()
function of DynamicFormArrayModel
does now work correctly (closes #183)@angular 2.2.1
primeng rc.5
add()
, insert()
and remove()
function added to DynamicOptionControlModel
(closes #180)DynamicFormControlComponent
does now emit a DynamicFormControlEvent
on blur, change and focus instead of simply passing through $event
:
export interface DynamicFormControlEvent {
$event: Event | FocusEvent;
control: FormControl;
model: DynamicFormControlModel;
}
@angular 2.2.0
@angular/material alpha.10
primeng rc.4
valueUpdates Rx.Subject
can now safely be used from anywhere to listen to new valueschecked
setter/getter and toggle()
function added to DynamicCheckControlModel
checkAll()
and uncheckAll()
function added to DynamicCheckboxGroupModel
select()
and get()
function added to DynamicOptionControlModel
get()
function added to DynamicFormGroupModel
and DynamicFormArrayModel
ui-material
addedchecked
attribute added to templates (closes #168) validators
deserialization fixed (closes #163) rxjs
peer dependency downgraded to match with Angular 2 (closes #162) ui-basic
(closes #154) DynamicCheckboxGroupModel
template bugs fixed (closes #160) label
, legend
, prefix
, suffix
and hint
are now bound via [innerHTML]
(see #157) ui-bootstrap
and ui-foundation
added (closes #153
, see README.md) Thanks @DavyJohnes @Output() change
EventEmitter<Event>
added to DynamicFormControlComponent
(#149)@angular 2.1.2
fromJSON()
finally working flawless2.1.0
templates
(closes #139) disabledUpdates
Rx.Subject
added for setting activation state at model levelfocus
and blur
outputs added to DynamicFormControlComponent
for event bindings (closes #130) [(ngModel)]
bindings have been completely removed. If you need to update the value
of any DynamicFormControlModel
at runtime use valueUpdates
Rx.Subject
(see README.md) DynamicFormControlModel
s (closes #125)_ DynamicSwitchModel
introduced in ui-material
id
attribute is now bound again to improve accessibility (see #42) disabled
bindings added in ui-material
where appropriateREADME.md
)files
field added to DynamicInputModel
(closes #114) bundles
sub folder fromJSON()
function added to DynamicFormService
(closes #99)README.md
)BrowserModule
imports replaced by CommonModule
(closes #89) ui-primeng
working again)DynamicFormsCoreModule
now needs to be imported in app root NgModule
via forRoot()
disabled
property bindings were removed! Use disable()
and enable()
functions of DynamicFormControlComponent
instead
(see Known Issues for explanation)help
property of DynamicFormControlModel
renamed to hint
required
property binding re-added to DynamicFormControlComponent
s due to fixes in Angular 2 RC.6tabIndex
property added to DynamicFormValueControlModel
Changing the disabled
property of DynamicFormControlModel
after initialization has no effect.
This is due to Angular 2 RC.6 not supporting disabled
property bindings anymore!
Use disable()
and enable()
functions of DynamicFormControlComponent
as a workaround!
Setting disabled: true
on any DynamicFormControlModel
in ui-material
causes an exception.
This is due to a bug in Angular 2 Material alpha.8-1.
FormGroup
validator extras now set correctly (closes #79) *.ts
files added to npm packages for source map support (closes #82)validatorsAsync
of DynamicFormValueControlModel
renamed to asyncValidators
FormGroup
and FormArray
validator functions added (closes #79)ui-primeng
now working with NgModule
required
attribute (temporarily) removed from templates due to issues
still not being resolved in Angular 2NgTemplateOutletContext
is now correctly set for <template>
for DynamicFormArrayModel
(closes #67)NgModule
--> Please read updated `README.mdDynamicFormArrayModel
and DynamicFormGroupModel
now working in all UI packages DynamicFormModel
has been completely removed --> use a simple Array<DynamicFormControlModel>
insteadfindById()
function of DynamicFormModel
has been moved to DynamicFormService
DynamicCheckboxModel
now working correctly again in ui-primeng
DynamicFormControlModel
renamed to DynamicFormValueControlModel
DynamicFormAbstractControlModel
renamed to DynamicFormControlModel
DynamicFormControlModel
coniguration objects added Please checkout updated README and examples!
items
property of DynamicFormControlModel
and DynamicCheckboxGroup
has been renamed to group
DynamicFormService.createFormGroup
now expects Array<DynamicFormControlModel<any>>
instead of DynamicFormModel
@Input()
form
of DynamicFormControlComponent
has been renamed to controlGroup
id
property binding of DynamicFormControlModel
has been removedrequired
property of DynamicFormControlModel
is now bound via [required]
and does not manually apply Validators.required
under the hood any morereadonly
property of DynamicInputControlModel
renamed to readOnly
spellCheck
property added to DynamicInputControlModel
autocomplete
property of DynamicFormControlModel
is now on
instead of off
text
property of DynamicFormOption
renamed to label
DynamicCheckboxGroup
now working correctly in ui-material
DynamicFormAutoFillService
added for importing and validating new HTML5 autofill detail tokensui-primeng
has arrivedmaxlength
attribute is now bound correctly (closes #43)DynamicCheckboxGroup
items do render now in ui-basic
(closes #44)name
attribute now added to <fieldset>
(closes #45)disabled
attribute now added to all form controlscls
configuration object has now nested element
configuration object to set css classes for certain elements (see example)name
property of DynamicFormControlModel
cannot be set anymore by configuration (automatically mapped to id
)DynamicFormControlComponent
now throws when being bound to non-supported type of DynamicFormControlModel
ui-material
finally working again after upgrading to new Angular 2 Material alpha.6 (closes #29)value
of DynamicCheckboxModel
is now always initizialized with false
instead of null
when not explicitly set to true
DynamicInputControlModel
(list
property)label
property of DynamicFormControlModel
is now just a plain string
instead of object
(hidden
property is removed)DynamicCheckboxGroupModel
has arrived (closes #32)cls
is now a true optional declared constructor parameterid
configuration propertyui-foundation
has arrivedcls
configuration object is now a separate constructor parameter (the second) of DynamicFormControlModel
in order
to uncouple pure model configuration from style configurationcls
bugs in template files fixedreadonly
property introduced for DynamicFormInputModel
cls
property of DynamicFormControlModel
refactored for advanced form layoutsui-material is currently broken due to Angular 2 Material not having upgraded to @angular/forms yet
order
property removed from DynamicFormControlModel
DynamicRadioModel
renamed to DynamicRadioGroupModel
model
property of DynamicFormModel
renamed to items
text
property removed from DynamicCheckboxModel
due to redundancy (use
text
property of label
object instead)DynamicTextInputModel
and DynamicNumberInputModel
condensed to DynamicInputModel
onBlur
and onFocus
event listeners added for input and textarea controls in ui-basic and ui-bootstrapmax
, min
, `step attributes now working correctly in ui-basic and ui-bootstraplabel
is now a configuration object with properties cls
, hidden
and text
cls
introduced in DynamicFormControlModel
for manually setting CSS classes for controls