private IReadOnlyCollection <Func <string, FormItem> > getIndependentControls() => new Func <string, FormItem>[] { id => { var pb = PostBack.CreateFull(id: id); return(FormState.ExecuteWithDataModificationsAndDefaultAction(pb.ToCollection(), () => get("Standard", null)(id))); }, id => { var pb = PostBack.CreateFull(id: id); return(FormState.ExecuteWithDataModificationsAndDefaultAction( pb.ToCollection(), () => get( "Auto-complete, triggers action when item selected", NumberControlSetup.CreateAutoComplete(TestService.GetInfo(), triggersActionWhenItemSelected: true))(id))); }, id => { var pb = PostBack.CreateFull(id: id); return(FormState.ExecuteWithDataModificationsAndDefaultAction( pb.ToCollection(), () => get( "Auto-complete, triggers action when item selected or value changed", NumberControlSetup.CreateAutoComplete( TestService.GetInfo(), triggersActionWhenItemSelected: true, valueChangedAction: new PostBackFormAction(pb)))(id))); } };
private IReadOnlyCollection <Func <string, FormItem> > getControls() => new[] { get("Standard", null), get("[1,2] with .25 step", null, minValue: 1, maxValue: 2, valueStep: .25m), get("Placeholder", NumberControlSetup.Create(placeholder: "Type here")), get("Birthday year auto-fill", NumberControlSetup.Create(autoFillTokens: "bday-year")), get("Auto-complete", NumberControlSetup.CreateAutoComplete(TestService.GetInfo())), id => { var pb = PostBack.CreateIntermediate(null, id: id); return(FormState.ExecuteWithDataModificationsAndDefaultAction( FormState.Current.DataModifications.Append(pb), () => get("Separate value-changed action", NumberControlSetup.Create(valueChangedAction: new PostBackFormAction(pb)))(id))); }, new Func <Func <string, FormItem> >( () => { var pmv = new PageModificationValue <decimal?>(); return(get("Page modification", NumberControlSetup.Create(pageModificationValue: pmv), pageModificationValue: pmv)); })(), get("Read-only", NumberControlSetup.CreateReadOnly()), getImprecise("Imprecise", null), getImprecise("Imprecise [1,2] with .25 step", null, minValue: 1, maxValue: 2, valueStep: .25m), id => { var pb = PostBack.CreateIntermediate(null, id: id); return(FormState.ExecuteWithDataModificationsAndDefaultAction( FormState.Current.DataModifications.Append(pb), () => getImprecise( "Imprecise with separate value-changed action", ImpreciseNumberControlSetup.Create(valueChangedAction: new PostBackFormAction(pb)))(id))); }, new Func <Func <string, FormItem> >( () => { var pmv = new PageModificationValue <decimal>(); return(getImprecise( "Imprecise with page modification", ImpreciseNumberControlSetup.Create(pageModificationValue: pmv), pageModificationValue: pmv)); })(), getImprecise("Imprecise read-only", ImpreciseNumberControlSetup.CreateReadOnly()) };