|
|
|
@ -11,6 +11,7 @@ import { EntityProp, EntityPropList } from '../models/entity-props'; |
|
|
|
import { FormProp, FormPropList } from '../models/form-props'; |
|
|
|
import { ObjectExtensions } from '../models/object-extensions'; |
|
|
|
import { PropCallback } from '../models/props'; |
|
|
|
import { jsonNetCamelCase } from './case.util'; |
|
|
|
import { createEnum, createEnumOptions, createEnumValueResolver } from './enum.util'; |
|
|
|
import { createDisplayNameLocalizationPipeKeyGenerator } from './localization.util'; |
|
|
|
import { createExtraPropertyValueResolver } from './props.util'; |
|
|
|
@ -121,6 +122,7 @@ function createPropertiesToContributorsMapper<T = any>( |
|
|
|
|
|
|
|
Object.keys(properties).forEach((name: string) => { |
|
|
|
const property = properties[name]; |
|
|
|
const propName = jsonNetCamelCase(name); |
|
|
|
const lookup = property.ui.lookup || ({} as ExtensionPropertyUiLookupDto); |
|
|
|
const type = getTypeaheadType(lookup, name) || getTypeFromProperty(property); |
|
|
|
const displayName = generateDisplayName(property.displayName, { name, resource }); |
|
|
|
@ -130,12 +132,12 @@ function createPropertiesToContributorsMapper<T = any>( |
|
|
|
const columnWidth = type === ePropType.Boolean ? 150 : 250; |
|
|
|
const valueResolver = |
|
|
|
type === ePropType.Enum |
|
|
|
? createEnumValueResolver(property.type, enums[property.type], name) |
|
|
|
: createExtraPropertyValueResolver<T>(name); |
|
|
|
? createEnumValueResolver(property.type, enums[property.type], propName) |
|
|
|
: createExtraPropertyValueResolver<T>(propName); |
|
|
|
|
|
|
|
const entityProp = new EntityProp<T>({ |
|
|
|
type, |
|
|
|
name, |
|
|
|
name: propName, |
|
|
|
displayName, |
|
|
|
sortable, |
|
|
|
columnWidth, |
|
|
|
@ -154,12 +156,12 @@ function createPropertiesToContributorsMapper<T = any>( |
|
|
|
const defaultValue = property.defaultValue; |
|
|
|
const validators = () => getValidatorsFromProperty(property); |
|
|
|
let options: PropCallback<any, Observable<ABP.Option<any>[]>>; |
|
|
|
if (type === ePropType.Enum) options = createEnumOptions(name, enums[property.type]); |
|
|
|
if (type === ePropType.Enum) options = createEnumOptions(propName, enums[property.type]); |
|
|
|
else if (type === ePropType.Typeahead) options = createTypeaheadOptions(lookup); |
|
|
|
|
|
|
|
const formProp = new FormProp({ |
|
|
|
type, |
|
|
|
name, |
|
|
|
name: propName, |
|
|
|
displayName, |
|
|
|
options, |
|
|
|
defaultValue, |
|
|
|
|