Lime Web Components API Documentation - v7.9.0
    Preparing search index...

    Type Alias ConfigMetadata

    Extensible metadata for registered resources in the Lime CRM platform.

    This metadata structure is used to describe various resources like web components, commands, actions, and other extensible elements. It provides a consistent way to attach human-readable information, icons, tags, and configuration components to any registered resource.

    Resources that use this metadata include:

    • Web components (via WebComponentRegistry)
    • Commands (via CommandBus and @Command decorator)
    import { PlatformServiceName } from '@limetech/lime-web-components';

    const registry = platform.get(PlatformServiceName.WebComponentRegistry);

    registry.register('customer-insights', {
    title: 'Customer Insights',
    description: 'Advanced analytics dashboard for customer behavior',
    icon: 'chart-line',
    tags: ['card-widget', 'start-page'],
    configComponent: {
    name: 'customer-insights-config',
    props: { defaultView: 'monthly' },
    },
    });
    import {
    Command,
    CommandHandler,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    @Command({ id: 'export-to-excel' })
    class ExportToExcelCommand {
    ids: number[];
    }

    const handler: CommandHandler = {
    handle: (command: ExportToExcelCommand) => {
    const http = platform.get(PlatformServiceName.Http);

    return http.post('exports/excel', { ids: command.ids });
    },
    };

    const commandBus = platform.get(PlatformServiceName.CommandBus);

    commandBus.register(ExportToExcelCommand, handler, {
    title: 'Export to Excel',
    description: 'Export selected records to Microsoft Excel',
    icon: { name: 'file-excel', color: 'green' },
    tags: ['bulk-object'],
    });
    type ConfigMetadata = {
        configComponent?: ComponentDescriptor;
        description?: string;
        icon?: string | Icon;
        tags?: string[];
        title?: string;
        describeConfig?(config: unknown): ConfigDescription | undefined;
    }
    Index

    Properties

    configComponent?: ComponentDescriptor

    Optional configuration UI component for this resource.

    Specifies a web component that provides a configuration interface for customizing the resource's behavior. This is typically used in admin interfaces or setup wizards.

    description?: string

    Detailed description of what the resource does.

    Provide helpful context about the resource's purpose, functionality, and any important usage notes. This typically appears in tooltips or help documentation.

    icon?: string | Icon

    Icon to visually represent the resource.

    Can be either a string referencing an icon name from the icon library, or an Icon object with additional properties like color and style.

    tags?: string[]

    Semantic tags for categorization and context-aware filtering.

    Tags help the platform determine where a component can be placed and when it is relevant for a given context. These tags typically describe the slot types or contexts that the component is suited for.

    The available tags are platform-specific and depend on the extensibility points provided by the host application.

    title?: string

    Human-readable display name for the resource.

    This should be a concise, user-friendly name that appears in UI elements like menus, toolbars, and configuration screens.

    Methods

    • Beta

      Describe one configured instance of this resource.

      It tells instances of the same resource apart, for example by the limetype and the filter they show.

      The platform registers it as a ConfigDescriber. A web component is described under its tag and gets its props. A command is described under its id and gets the params of its config. A rule primitive is described under its id and gets its args, or null when the leaf has no args.

      Parameters

      • config: unknown

        The config of one instance, for example the props of a web component.

      Returns ConfigDescription | undefined

      A description of the instance, or undefined if there is nothing to add.

      import {
      ConfigDescription,
      PlatformServiceName,
      } from '@limetech/lime-web-components';

      interface InfoTileConfig {
      limetype: string;
      filterId: string;
      }

      const limetypes = platform.get(PlatformServiceName.LimeTypeRepository);
      const filters = platform.get(PlatformServiceName.FilterRepository);
      const application = platform.get(PlatformServiceName.Application);
      const translator = platform.get(PlatformServiceName.Translate);

      function describeInfoTile(config: InfoTileConfig): ConfigDescription {
      const limetype = limetypes.getLimeType(config.limetype);
      const filter = filters.getFilter?.(config.filterId);
      const filterName = filter?.name[application.getLanguage()];

      return {
      facts: [
      {
      label: translator.get('my-addon.info-tile.limetype'),
      text: limetype?.localname.plural ?? config.limetype,
      },
      {
      label: translator.get('my-addon.info-tile.filter'),
      text: filterName ?? config.filterId,
      },
      ],
      };
      }

      const registry = platform.get(PlatformServiceName.WebComponentRegistry);

      registry.register('my-addon-info-tile', {
      title: 'Info tile',
      icon: 'info',
      describeConfig: describeInfoTile,
      });