本文整理汇总了TypeScript中novo-elements.FormUtils.setInitialValues方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormUtils.setInitialValues方法的具体用法?TypeScript FormUtils.setInitialValues怎么用?TypeScript FormUtils.setInitialValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类novo-elements.FormUtils
的用法示例。
在下文中一共展示了FormUtils.setInitialValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private formUtils: FormUtils) {
// Dynamic
this.dynamicVertical = formUtils.toControls(MockMeta, '$ USD', {}, { token: 'TOKEN', military: true });
formUtils.setInitialValues(this.dynamicVertical, { number: 0, firstName: 'Bobby Flay' });
this.dynamicVerticalForm = formUtils.toFormGroup(this.dynamicVertical);
}
示例2: constructor
//.........这里部分代码省略.........
data: (item: any): string => {
return item['label'];
},
},
{
label: 'Id',
data: (item: any): string => {
return item.value['id'];
},
},
],
},
});
this.rowMultiPickerControlWithMaxlength = new PickerControl({
key: 'rowMultiPickerControlWithMaxlength',
tooltip: 'Multiple Rows With Maxlength',
label: 'Multiple Rows With Maxlength',
multiple: true,
maxlength: 4,
config: {
format: '$name',
options: cities,
type: 'candidate',
columns: [
{
label: 'Name',
data: (item: any): string => {
return item['label'];
},
},
{
label: 'Id',
data: (item: any): string => {
return item.value['id'];
},
},
],
},
});
this.textPickerWithGetLabels = new PickerControl({
key: 'textPickerWithGetLabels',
tooltip: 'Text Value Picker with getLabels()',
label: 'Text Value Picker with getLabels()',
multiple: false,
config: {
field: 'value',
format: '$label',
options: states,
useGetLabels: true,
getLabels: (value) => {
return new Promise((resolve) => {
states.forEach((state) => {
if (state.value === value) {
resolve(state);
}
});
});
},
},
});
let controls = [
this.singlePickerControl,
this.multiPickerControl,
this.entityMultiPickerControl,
this.multiPickerControlWithMaxlength,
this.multiPickerControlWithMaxlengthAndPreselects,
this.rowMultiPickerControl,
// this.rowMultiPickerControlWithMaxlength,
this.textPickerWithGetLabels,
];
formUtils.setInitialValues(controls, {
entityMultiPicker: [
{
title: 'Federal Bank',
name: 'Federal Bank',
email: 'info@federalbank.com',
phone: '(545) 555-1212',
address: { city: 'Arlington', state: 'VA' },
searchEntity: 'ClientCorporation',
},
],
multiPickerControlWithMaxlengthAndPreselects: ['Oranges', 'Bananas'],
rowMultiPickerControlWithMaxlength: [
{
id: 1,
name: 'Boston',
},
{
id: 5,
name: 'Houston',
},
{
id: 6,
name: 'Chicago',
},
],
textPickerWithGetLabels: 'MD',
});
this.pickerForm = formUtils.toFormGroup(controls);
}