How to use the @bentley/presentation-common.PropertyValueFormat.Primitive function in @bentley/presentation-common

To help you get started, we’ve selected a few @bentley/presentation-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / presentation / components / src / common / ContentBuilder.ts View on Github external
const createRecordDescription = (typeDescription: TypeDescription, displayValue: Omit): string | undefined => {
  if (PropertyValueFormat.Array === typeDescription.valueFormat || PropertyValueFormat.Struct === typeDescription.valueFormat)
    return undefined;
  if (PropertyValueFormat.Primitive !== typeDescription.valueFormat || !DisplayValue.isPrimitive(displayValue))
    throw new PresentationError(PresentationStatus.InvalidArgument, "displayValue is of wrong type");
  return displayValue.toString();
};
github imodeljs / imodeljs / presentation / components / src / common / ContentBuilder.ts View on Github external
public static createPropertyDescription(field: Field, props?: PropertyDescriptionCreationProps): PropertyDescription {
    const descr: PropertyDescription = {
      name: applyOptionalPrefix(field.name, props ? props.namePrefix : undefined),
      displayLabel: field.label,
      typename: field.type.typeName,
    };
    if (field.editor) {
      descr.editor = { name: field.editor.name, params: [] } as PropertyEditorInfo;
    }
    if (field.type.valueFormat === PropertyValueFormat.Primitive && "enum" === field.type.typeName && field.isPropertiesField() && field.properties[0].property.enumerationInfo) {
      const enumInfo = field.properties[0].property.enumerationInfo;
      descr.enum = {
        choices: enumInfo.choices,
        isStrict: enumInfo.isStrict,
      } as EnumerationChoicesInfo;
    }
    return descr;
  }
}
github imodeljs / imodeljs / presentation / components / src / propertygrid / DataProvider.ts View on Github external
const includeField = (category: CategoryDescription, field: Field) => {
      if (field.type.valueFormat !== PresentationPropertyValueFormat.Primitive && !this._includeWithCompositeValues)
        return;

      if (!categoryFields.hasOwnProperty(category.name)) {
        categories.push(category);
        categoryFields[category.name] = new Array();
      }
      categoryFields[category.name].push(field);
    };
    const visitField = (category: CategoryDescription, field: Field, isNested: boolean) => {