UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

30 lines 1.25 kB
import { itemsMetadata } from "./ItemsMetadata"; export function Property(value) { return function (target, propertyKey) { var type = target.constructor.type; if (itemsMetadata.data[type] == null) itemsMetadata.data[type] = {}; var typeMetadata = itemsMetadata.data[type]; if (typeMetadata[propertyKey] != null) return; typeMetadata[propertyKey] = { type: checkType(value, target, propertyKey), displayName: (value != null && value.displayName != null) ? value.displayName : propertyKey, propertyFactory: value.factory, values: value.enumObject != null ? Object.keys(value.enumObject).map(function (k) { return value.enumObject[k]; }).filter(function (v) { return typeof v === "string"; }) : null, ignore: value.ignore != null ? value.ignore : true }; }; } export var checkType = function (meta, target, key) { if (meta.type != null) return meta.type; if (meta.enumObject != null) return "enum"; if (meta.factory != null) return meta.factory.type; return typeof target[key]; }; //# sourceMappingURL=Property.js.map